diff --git a/packages/domain-expansion/package/src/contextTracking.ts b/packages/domain-expansion/package/src/contextTracking.ts index d84471b..04c1668 100644 --- a/packages/domain-expansion/package/src/contextTracking.ts +++ b/packages/domain-expansion/package/src/contextTracking.ts @@ -94,6 +94,7 @@ export function getCurrentContext(): ContextTracking | undefined { const assetTrackingSym = Symbol.for('@domain-expansion:astro-asset-tracking'); (globalThis as any)[assetTrackingSym] = (original: typeof getImage): typeof getImage => { debug('Assigning original getImage, skipping wrapper'); + debugger runtime.getImage = original; return original; }; diff --git a/packages/imagetools/.npmignore b/packages/imagetools/.npmignore index 4f257ea..77b2318 100644 --- a/packages/imagetools/.npmignore +++ b/packages/imagetools/.npmignore @@ -1,4 +1,4 @@ -*.test.ts -test-fixtures -astroViteConfigs.js -vitest.config.ts +*.test.ts +test-fixtures +astroViteConfigs.js +vitest.config.ts diff --git a/packages/imagetools/README.md b/packages/imagetools/README.md index eda0dbe..5168cf7 100644 --- a/packages/imagetools/README.md +++ b/packages/imagetools/README.md @@ -1,39 +1,39 @@ -# **Astro ImageTools** - -**Astro ImageTools** is a collection of tools for optimizing images, background images, and generating responsive images for the **Astro JS** framework. - -## Features - -Below is a short list of features that **Astro ImageTools** offers. For more information, please see component-specific or API-specific documentation. - -- ✅ **Regular Image Optimization** (`` and ``) -- ✅ **Background Image Optimization** -- ✅ **Responsive Images** -- ✅ **Simple and intuitive Art Direction API** -- ✅ **Lazy Loading** -- ✅ **Programmatic APIs** -- ✅ **Asynchronous Decoding** -- ✅ **Unique Breakpoints Calculation** -- ✅ **Preloading for urgent images** -- ✅ **SVG Tracing and Posterization** -- ✅ **100% Scoped CSS** -- ✅ **Four kind of Layouts: `constrained`, `fixed`, `fullWidth` & `fill`** -- ✅ **Three kind of Placeholder Images: `blurred`, `dominantColor` & `tracedSVG`** -- ✅ **Long list of supported Image Formats** -- ✅ **Long List of supported Configuration Options** -- ✅ **Supports Remote Images and Data URIs too** -- ✅ **Support for _`sharp`less_ Environments** -- ✅ **Both Memory-based and FS-based Caching for better Performance** -- ✅ **Respects to _Semantics of HTML_ as much as possible** - -## Getting Started - -To get started with **Astro ImageTools**, first check out the [Installation](https://astro-imagetools-docs.vercel.app/en/installation) documentation for instructions on how to install the `astro-imagetools` package. - -If you are looking for the available components and APIs, please check out the [Components and APIs](https://astro-imagetools-docs.vercel.app/en/components-and-apis) documentation. - -If you want to view live examples of the components, APIs, layouts, and placeholder images, check out the [Astro ImageTools Demo](https://astro-imagetools-demo.vercel.app/) website. - -If you want to report any issues or have found a missing feature, please report it on [GitHub](https://github.com/RafidMuhymin/astro-imagetools/)! - -Good luck out there, Astronaut. 🧑‍🚀 +# **Astro ImageTools** + +**Astro ImageTools** is a collection of tools for optimizing images, background images, and generating responsive images for the **Astro JS** framework. + +## Features + +Below is a short list of features that **Astro ImageTools** offers. For more information, please see component-specific or API-specific documentation. + +- ✅ **Regular Image Optimization** (`` and ``) +- ✅ **Background Image Optimization** +- ✅ **Responsive Images** +- ✅ **Simple and intuitive Art Direction API** +- ✅ **Lazy Loading** +- ✅ **Programmatic APIs** +- ✅ **Asynchronous Decoding** +- ✅ **Unique Breakpoints Calculation** +- ✅ **Preloading for urgent images** +- ✅ **SVG Tracing and Posterization** +- ✅ **100% Scoped CSS** +- ✅ **Four kind of Layouts: `constrained`, `fixed`, `fullWidth` & `fill`** +- ✅ **Three kind of Placeholder Images: `blurred`, `dominantColor` & `tracedSVG`** +- ✅ **Long list of supported Image Formats** +- ✅ **Long List of supported Configuration Options** +- ✅ **Supports Remote Images and Data URIs too** +- ✅ **Support for _`sharp`less_ Environments** +- ✅ **Both Memory-based and FS-based Caching for better Performance** +- ✅ **Respects to _Semantics of HTML_ as much as possible** + +## Getting Started + +To get started with **Astro ImageTools**, first check out the [Installation](https://astro-imagetools-docs.vercel.app/en/installation) documentation for instructions on how to install the `astro-imagetools` package. + +If you are looking for the available components and APIs, please check out the [Components and APIs](https://astro-imagetools-docs.vercel.app/en/components-and-apis) documentation. + +If you want to view live examples of the components, APIs, layouts, and placeholder images, check out the [Astro ImageTools Demo](https://astro-imagetools-demo.vercel.app/) website. + +If you want to report any issues or have found a missing feature, please report it on [GitHub](https://github.com/RafidMuhymin/astro-imagetools/)! + +Good luck out there, Astronaut. 🧑‍🚀 diff --git a/packages/imagetools/api/importImage.d.ts b/packages/imagetools/api/importImage.d.ts index bb0bb97..96e6f95 100644 --- a/packages/imagetools/api/importImage.d.ts +++ b/packages/imagetools/api/importImage.d.ts @@ -1 +1 @@ -export default function importImage(url: string): Promise; +export default function importImage(url: string): Promise; diff --git a/packages/imagetools/api/importImage.js b/packages/imagetools/api/importImage.js index b22ca0b..d50b2de 100644 --- a/packages/imagetools/api/importImage.js +++ b/packages/imagetools/api/importImage.js @@ -1,23 +1,23 @@ -import load from "../plugin/hooks/load.js"; -import { getSrcPath } from "./utils/getSrcPath.js"; -import getResolvedSrc from "./utils/getResolvedSrc.js"; - -export default async function importImage(path) { - try { - const { search, protocol, pathname } = new URL(path); - - const { src: id, base } = await getResolvedSrc( - protocol === "data:" ? protocol + pathname : path - ); - - const src = (await load(id + search, base)).slice(16, -1); - - return src; - } catch (error) { - const id = await getSrcPath(path); - - const src = (await load(id)).slice(16, -1); - - return src; - } -} +import load from "../plugin/hooks/load.js"; +import { getSrcPath } from "./utils/getSrcPath.js"; +import getResolvedSrc from "./utils/getResolvedSrc.js"; + +export default async function importImage(path) { + try { + const { search, protocol, pathname } = new URL(path); + + const { src: id, base } = await getResolvedSrc( + protocol === "data:" ? protocol + pathname : path + ); + + const src = (await load(id + search, base)).slice(16, -1); + + return src; + } catch (error) { + const id = await getSrcPath(path); + + const src = (await load(id)).slice(16, -1); + + return src; + } +} diff --git a/packages/imagetools/api/index.js b/packages/imagetools/api/index.js index 062d6ad..6096b59 100644 --- a/packages/imagetools/api/index.js +++ b/packages/imagetools/api/index.js @@ -1,6 +1,6 @@ -export { default as renderImg } from "./renderImg.js"; -export { default as renderPicture } from "./renderPicture.js"; -export { default as renderBackgroundImage } from "./renderBackgroundImage.js"; -export { default as renderBackgroundPicture } from "./renderBackgroundPicture.js"; -export { default as importImage } from "./importImage.js"; -export { getImageDetails, loadImage } from "./utils/imagetools.js" \ No newline at end of file +export { default as renderImg } from "./renderImg.js"; +export { default as renderPicture } from "./renderPicture.js"; +export { default as renderBackgroundImage } from "./renderBackgroundImage.js"; +export { default as renderBackgroundPicture } from "./renderBackgroundPicture.js"; +export { default as importImage } from "./importImage.js"; +export { getImageDetails, loadImage } from "./utils/imagetools.js" diff --git a/packages/imagetools/api/renderBackgroundImage.d.ts b/packages/imagetools/api/renderBackgroundImage.d.ts index e7e601b..af6a45a 100644 --- a/packages/imagetools/api/renderBackgroundImage.d.ts +++ b/packages/imagetools/api/renderBackgroundImage.d.ts @@ -1,8 +1,8 @@ -import type { - BackgroundImageConfigOptions, - BackgroundImageHTMLData, -} from "../types"; - -export default function renderBackgroundImage( - config: BackgroundImageConfigOptions -): Promise; +import type { + BackgroundImageConfigOptions, + BackgroundImageHTMLData, +} from "../types"; + +export default function renderBackgroundImage( + config: BackgroundImageConfigOptions +): Promise; diff --git a/packages/imagetools/api/renderBackgroundImage.js b/packages/imagetools/api/renderBackgroundImage.js index f56b308..8c30baf 100644 --- a/packages/imagetools/api/renderBackgroundImage.js +++ b/packages/imagetools/api/renderBackgroundImage.js @@ -1,159 +1,156 @@ -// @ts-check -import crypto from "node:crypto"; -import getImage from "./utils/getImage.js"; -import getLinkElement from "./utils/getLinkElement.js"; -import getStyleElement from "./utils/getStyleElement.js"; -import getFilteredProps from "./utils/getFilteredProps.js"; -import getContainerElement from "./utils/getContainerElement.js"; - -export default async function renderBackgroundImage(props) { - const type = "BackgroundImage"; - - const { filteredProps, transformConfigs } = getFilteredProps(type, props); - - const { - src, - tag, - content, - preload, - attributes, - placeholder, - breakpoints, - backgroundSize, - backgroundPosition, - format, - fallbackFormat, - includeSourceFormat, - formatOptions, - artDirectives, - } = filteredProps; - - const { - link: linkAttributes = {}, - style: styleAttributes = {}, - container: containerAttributes = {}, - } = attributes; - - const sizes = ""; - - const { uuid, images } = await getImage({ - src, - type, - sizes, - format, - breakpoints, - placeholder, - artDirectives, - fallbackFormat, - includeSourceFormat, - formatOptions, - transformConfigs, - }); - - const className = `astro-imagetools-background-image-${uuid}`; - - const { imagesizes } = images[images.length - 1]; - - const link = getLinkElement({ images, preload, imagesizes, linkAttributes }); - - const backgroundImageStylesArray = images.map(({ media, sources }) => { - const uuid = crypto.randomBytes(4).toString("hex").toUpperCase(); - - const fallbackUrlCustomVariable = `--astro-imagetools-background-image-fallback-url${uuid}`; - - const newSources = {}; - - sources.forEach(({ src, format, srcset }) => { - const sources = srcset - .split(", ") - .map((source) => [ - source.slice(0, source.lastIndexOf(" ")), - source.slice(source.lastIndexOf(" ") + 1, -1), - ]); - - sources.forEach(([path, width]) => { - if (!newSources[width]) { - newSources[width] = []; - } - - newSources[width].push({ src, format, path }); - }); - }); - - const widths = Object.keys(newSources) - .map((width) => parseInt(width)) - .reverse(); - - const maxWidth = Math.max(...widths); - - const styles = widths - .map((width) => { - const sources = newSources[width]; - - const styles = sources - .map( - ({ format, path }, i) => - ` - ${i !== sources.length - 1 ? `.${format} ` : ""}.${className} { - background-repeat: no-repeat; - background-image: url(${path}), - var(${fallbackUrlCustomVariable}); - background-size: ${backgroundSize}; - background-position: ${backgroundPosition}; - } - ` - ) - .reverse() - .join(""); - - return width === maxWidth - ? styles - : ` - @media screen and (max-width: ${width}px) { - ${styles} - } - `; - }) - .join(""); - - return { - fallbackUrlCustomVariable, - styles: media - ? ` - @media ${media} { - ${styles} - } - ` - : styles, - }; - }); - - const containerStyles = ` - .${className} { - position: relative; - ${images - .map(({ fallback }, i) => { - const fallbackUrlCustomVariable = - backgroundImageStylesArray[i].fallbackUrlCustomVariable; - - return `${fallbackUrlCustomVariable}: url("${encodeURI(fallback)}");`; - }) - .join("\n")} - } - `; - - const backgroundStyles = - backgroundImageStylesArray.map(({ styles }) => styles).join("\n") + - containerStyles; - - const style = getStyleElement({ styleAttributes, backgroundStyles }); - - const htmlElement = getContainerElement({ - tag, - content, - className, - containerAttributes, - }); - - return { link, style, htmlElement }; -} +// @ts-check +import crypto from "node:crypto"; +import getImage from "./utils/getImage.js"; +import getLinkElement from "./utils/getLinkElement.js"; +import getStyleElement from "./utils/getStyleElement.js"; +import getFilteredProps from "./utils/getFilteredProps.js"; +import getContainerElement from "./utils/getContainerElement.js"; + +export default async function renderBackgroundImage(props) { + const type = "BackgroundImage"; + + const { filteredProps, transformConfigs } = getFilteredProps(type, props); + + const { + src, + tag, + content, + preload, + attributes, + placeholder, + breakpoints, + backgroundSize, + backgroundPosition, + format, + fallbackFormat, + includeSourceFormat, + formatOptions, + artDirectives, + } = filteredProps; + + const { + link: linkAttributes = {}, + style: styleAttributes = {}, + container: containerAttributes = {}, + } = attributes; + + const sizes = ""; + + const { uuid, images } = await getImage({ + src, + type, + sizes, + format, + breakpoints, + placeholder, + artDirectives, + fallbackFormat, + includeSourceFormat, + formatOptions, + transformConfigs, + }); + + const className = `astro-imagetools-background-image-${uuid}`; + + const { imagesizes } = images[images.length - 1]; + + const link = getLinkElement({ images, preload, imagesizes, linkAttributes }); + + const backgroundImageStylesArray = images.map(({ media, sources }) => { + const uuid = crypto.randomBytes(4).toString("hex").toUpperCase() + const fallbackUrlCustomVariable = `--astro-imagetools-background-image-fallback-url${uuid}` + const newSources = {}; + sources.forEach(({ src, format, srcset }) => { + const sources = srcset + .split(", ") + .map((source) => [ + source.slice(0, source.lastIndexOf(" ")), + source.slice(source.lastIndexOf(" ") + 1, -1), + ]); + + sources.forEach(([path, width]) => { + if (!newSources[width]) { + newSources[width] = []; + } + + newSources[width].push({ src, format, path }); + }); + }); + + const widths = Object.keys(newSources) + .map((width) => parseInt(width)) + .reverse(); + + const maxWidth = Math.max(...widths); + + const styles = widths + .map((width) => { + const sources = newSources[width]; + + const styles = sources + .map( + ({ format, path }, i) => + ` + ${i !== sources.length - 1 ? `.${format} ` : ""}.${className} { + background-repeat: no-repeat; + background-image: url(${path}), + var(${fallbackUrlCustomVariable}); + background-size: ${backgroundSize}; + background-position: ${backgroundPosition}; + } + ` + ) + .reverse() + .join(""); + + return width === maxWidth + ? styles + : ` + @media screen and (max-width: ${width}px) { + ${styles} + } + `; + }) + .join(""); + + return { + fallbackUrlCustomVariable, + styles: media + ? ` + @media ${media} { + ${styles} + } + ` + : styles, + }; + }); + + const containerStyles = ` + .${className} { + position: relative; + ${images + .map(({ fallback }, i) => { + const fallbackUrlCustomVariable = + backgroundImageStylesArray[i].fallbackUrlCustomVariable; + + return `${fallbackUrlCustomVariable}: url("${encodeURI(fallback)}");`; + }) + .join("\n")} + } + `; + + const backgroundStyles = + backgroundImageStylesArray.map(({ styles }) => styles).join("\n") + + containerStyles; + + const style = getStyleElement({ styleAttributes, backgroundStyles }); + + const htmlElement = getContainerElement({ + tag, + content, + className, + containerAttributes, + }); + + return { link, style, htmlElement }; +} diff --git a/packages/imagetools/api/renderBackgroundPicture.d.ts b/packages/imagetools/api/renderBackgroundPicture.d.ts index a566421..c38de62 100644 --- a/packages/imagetools/api/renderBackgroundPicture.d.ts +++ b/packages/imagetools/api/renderBackgroundPicture.d.ts @@ -1,8 +1,8 @@ -import type { - BackgroundPictureConfigOptions, - BackgroundPictureHTMLData, -} from "../types"; - -export default function renderBackgroundPicture( - config: BackgroundPictureConfigOptions -): Promise; +import type { + BackgroundPictureConfigOptions, + BackgroundPictureHTMLData, +} from "../types"; + +export default function renderBackgroundPicture( + config: BackgroundPictureConfigOptions +): Promise; diff --git a/packages/imagetools/api/renderBackgroundPicture.js b/packages/imagetools/api/renderBackgroundPicture.js index 1eea4e1..605f935 100644 --- a/packages/imagetools/api/renderBackgroundPicture.js +++ b/packages/imagetools/api/renderBackgroundPicture.js @@ -1,127 +1,127 @@ -// @ts-check -import getImage from "./utils/getImage.js"; -import getImgElement from "./utils/getImgElement.js"; -import getLinkElement from "./utils/getLinkElement.js"; -import getStyleElement from "./utils/getStyleElement.js"; -import getLayoutStyles from "./utils/getLayoutStyles.js"; -import getFilteredProps from "./utils/getFilteredProps.js"; -import getPictureElement from "./utils/getPictureElement.js"; -import getBackgroundStyles from "./utils/getBackgroundStyles.js"; -import getContainerElement from "./utils/getContainerElement.js"; - -export default async function renderBackgroundPicture(props) { - const type = "BackgroundPicture"; - - const { filteredProps, transformConfigs } = getFilteredProps(type, props); - - const { - src, - tag, - content, - sizes, - preload, - loading, - decoding, - attributes, - placeholder, - breakpoints, - objectFit, - objectPosition, - format, - fallbackFormat, - includeSourceFormat, - formatOptions, - fadeInTransition, - artDirectives, - } = filteredProps; - - const { - img: imgAttributes = {}, - link: linkAttributes = {}, - style: styleAttributes = {}, - picture: pictureAttributes = {}, - container: containerAttributes = {}, - } = attributes; - - const { uuid, images } = await getImage({ - src, - type, - sizes, - format, - breakpoints, - placeholder, - artDirectives, - fallbackFormat, - includeSourceFormat, - formatOptions, - transformConfigs, - }); - - const className = `astro-imagetools-picture-${uuid}`, - containerClassName = `astro-imagetools-background-picture-${uuid}`; - - const { imagesizes } = images[images.length - 1]; - - const backgroundStyles = getBackgroundStyles( - images, - className, - objectFit, - objectPosition, - fadeInTransition, - { isBackgroundPicture: true, containerClassName } - ); - - const style = getStyleElement({ styleAttributes, backgroundStyles }); - - const link = getLinkElement({ images, preload, imagesizes, linkAttributes }); - - const layoutStyles = getLayoutStyles({ isBackgroundImage: true }); - - // Background Images shouldn't convey important information - const alt = ""; - - const sources = images.flatMap(({ media, sources, sizes, imagesizes }) => - sources.map(({ format, src, srcset }) => - src - ? getImgElement({ - src, - alt, - sizes, - style, - srcset, - loading, - decoding, - imagesizes, - fadeInTransition, - layoutStyles, - imgAttributes, - }) - : `` - ) - ); - - const picture = getPictureElement({ - sources, - className, - layoutStyles, - pictureAttributes, - isBackgroundPicture: true, - }); - - const htmlElement = getContainerElement({ - tag, - content: picture + content, - containerAttributes, - isBackgroundPicture: true, - containerClassName, - }); - - return { link, style, htmlElement }; -} +// @ts-check +import getImage from "./utils/getImage.js"; +import getImgElement from "./utils/getImgElement.js"; +import getLinkElement from "./utils/getLinkElement.js"; +import getStyleElement from "./utils/getStyleElement.js"; +import getLayoutStyles from "./utils/getLayoutStyles.js"; +import getFilteredProps from "./utils/getFilteredProps.js"; +import getPictureElement from "./utils/getPictureElement.js"; +import getBackgroundStyles from "./utils/getBackgroundStyles.js"; +import getContainerElement from "./utils/getContainerElement.js"; + +export default async function renderBackgroundPicture(props) { + const type = "BackgroundPicture"; + + const { filteredProps, transformConfigs } = getFilteredProps(type, props); + + const { + src, + tag, + content, + sizes, + preload, + loading, + decoding, + attributes, + placeholder, + breakpoints, + objectFit, + objectPosition, + format, + fallbackFormat, + includeSourceFormat, + formatOptions, + fadeInTransition, + artDirectives, + } = filteredProps; + + const { + img: imgAttributes = {}, + link: linkAttributes = {}, + style: styleAttributes = {}, + picture: pictureAttributes = {}, + container: containerAttributes = {}, + } = attributes; + + const { uuid, images } = await getImage({ + src, + type, + sizes, + format, + breakpoints, + placeholder, + artDirectives, + fallbackFormat, + includeSourceFormat, + formatOptions, + transformConfigs, + }); + + const className = `imagetools-picture-${uuid}`, + containerClassName = `astro-imagetools-background-picture-${uuid}`; + + const { imagesizes } = images[images.length - 1]; + + const backgroundStyles = getBackgroundStyles( + images, + className, + objectFit, + objectPosition, + fadeInTransition, + { isBackgroundPicture: true, containerClassName } + ); + + const style = getStyleElement({ styleAttributes, backgroundStyles }); + + const link = getLinkElement({ images, preload, imagesizes, linkAttributes }); + + const layoutStyles = getLayoutStyles({ isBackgroundImage: true }); + + // Background Images shouldn't convey important information + const alt = ""; + + const sources = images.flatMap(({ media, sources, sizes, imagesizes }) => + sources.map(({ format, src, srcset }) => + src + ? getImgElement({ + src, + alt, + sizes, + style, + srcset, + loading, + decoding, + imagesizes, + fadeInTransition, + layoutStyles, + imgAttributes, + }) + : `` + ) + ); + + const picture = getPictureElement({ + sources, + className, + layoutStyles, + pictureAttributes, + isBackgroundPicture: true, + }); + + const htmlElement = getContainerElement({ + tag, + content: picture + content, + containerAttributes, + isBackgroundPicture: true, + containerClassName, + }); + + return { link, style, htmlElement }; +} diff --git a/packages/imagetools/api/renderImg.d.ts b/packages/imagetools/api/renderImg.d.ts index abbc304..338ef90 100644 --- a/packages/imagetools/api/renderImg.d.ts +++ b/packages/imagetools/api/renderImg.d.ts @@ -1,5 +1,5 @@ -import type { ImgConfigOptions, ImgHTMLData } from "../types"; - -export default function renderImg( - config: ImgConfigOptions -): Promise; +import type { ImgConfigOptions, ImgHTMLData } from "../types"; + +export default function renderImg( + config: ImgConfigOptions +): Promise; diff --git a/packages/imagetools/api/renderImg.js b/packages/imagetools/api/renderImg.js index 3bc2bf3..31fb130 100644 --- a/packages/imagetools/api/renderImg.js +++ b/packages/imagetools/api/renderImg.js @@ -1,93 +1,93 @@ -// @ts-check -import getImage from "./utils/getImage.js"; -import getImgElement from "./utils/getImgElement.js"; -import getLinkElement from "./utils/getLinkElement.js"; -import getStyleElement from "./utils/getStyleElement.js"; -import getLayoutStyles from "./utils/getLayoutStyles.js"; -import getFilteredProps from "./utils/getFilteredProps.js"; -import getBackgroundStyles from "./utils/getBackgroundStyles.js"; - -export default async function renderImg(props) { - const type = "Img"; - - const { filteredProps, transformConfigs } = getFilteredProps(type, props); - - const { - src, - alt, - sizes, - preload, - loading, - decoding, - attributes, - layout, - breakpoints, - placeholder, - objectFit, - objectPosition, - format, - formatOptions, - } = filteredProps; - - const artDirectives = [], - fallbackFormat = format, - fadeInTransition = false, - includeSourceFormat = false; - - const { - img: imgAttributes = {}, - link: linkAttributes = {}, - style: styleAttributes = {}, - } = attributes; - - const { uuid, images } = await getImage({ - src, - type, - sizes, - format, - breakpoints, - placeholder, - artDirectives, - fallbackFormat, - includeSourceFormat, - formatOptions, - transformConfigs, - }); - - const className = `astro-imagetools-img-${uuid}`; - - const { imagesizes } = images[images.length - 1]; - const backgroundStyles = getBackgroundStyles( - images, - className, - objectFit, - objectPosition, - fadeInTransition, - { isImg: true } - ); - const style = getStyleElement({ styleAttributes, backgroundStyles }) - const link = getLinkElement({ images, preload, imagesizes, linkAttributes }) - const layoutStyles = getLayoutStyles({ layout }) - - const sources = images.flatMap(({ sources, sizes, imagesizes }) => - sources.map(({ src, srcset }) => - getImgElement({ - src, - alt, - sizes, - style, - srcset, - loading, - decoding, - imagesizes, - fadeInTransition, - layoutStyles, - imgAttributes, - imgClassName: className, - }) - ) - ) - - const [img] = sources - return { link, style, img } -} +// @ts-check +import getImage from "./utils/getImage.js" +import getImgElement from "./utils/getImgElement.js" +import getLinkElement from "./utils/getLinkElement.js" +import getStyleElement from "./utils/getStyleElement.js" +import getLayoutStyles from "./utils/getLayoutStyles.js" +import getFilteredProps from "./utils/getFilteredProps.js" +import getBackgroundStyles from "./utils/getBackgroundStyles.js" + +export default async function renderImg(props) { + const type = "Img" + const { filteredProps, transformConfigs } = getFilteredProps(type, props) + const { + src, + alt, + sizes, + preload, + loading, + decoding, + attributes, + layout, + breakpoints, + placeholder, + objectFit, + objectPosition, + format, + formatOptions, + } = filteredProps; + + const artDirectives = [], + fallbackFormat = format, + fadeInTransition = false, + includeSourceFormat = false + + const { + img: imgAttributes = {}, + link: linkAttributes = {}, + style: styleAttributes = {}, + } = attributes + + const { uuid, images } = await getImage({ + src, + type, + sizes, + format, + breakpoints, + placeholder, + artDirectives, + fallbackFormat, + includeSourceFormat, + formatOptions, + transformConfigs, + }) + + const className = `imagetools-img-${uuid}` + const { imagesizes } = images[images.length - 1] + const backgroundStyles = getBackgroundStyles( + images, + className, + objectFit, + objectPosition, + fadeInTransition, + { isImg: true } + ); + + const style = getStyleElement({ styleAttributes, backgroundStyles }) + const link = getLinkElement({ images, preload, imagesizes, linkAttributes }) + const layoutStyles = getLayoutStyles({ layout }) + + const sources = images.flatMap(({ sources, sizes, imagesizes }) => + sources.map(({ src, srcset }) => + getImgElement({ + src, + alt, + sizes, + style, + srcset, + loading, + decoding, + imagesizes, + fadeInTransition, + layoutStyles, + imgAttributes, + imgClassName: className, + uuid + }) + ) + ); + + const [img] = sources; + + return { link, style, img } +} diff --git a/packages/imagetools/api/renderPicture.d.ts b/packages/imagetools/api/renderPicture.d.ts index 54ccfe5..a0fc9c3 100644 --- a/packages/imagetools/api/renderPicture.d.ts +++ b/packages/imagetools/api/renderPicture.d.ts @@ -1,5 +1,5 @@ -import type { PictureConfigOptions, PictureHTMLData } from "../types"; - -export default function renderPicture( - config: PictureConfigOptions -): Promise; +import type { PictureConfigOptions, PictureHTMLData } from "../types.d.ts" + +export default function renderPicture( + config: PictureConfigOptions +): Promise; diff --git a/packages/imagetools/api/renderPicture.js b/packages/imagetools/api/renderPicture.js index 8a98d1c..84fc7c9 100644 --- a/packages/imagetools/api/renderPicture.js +++ b/packages/imagetools/api/renderPicture.js @@ -1,111 +1,106 @@ -// @ts-check -import getImage from "./utils/getImage.js"; -import getImgElement from "./utils/getImgElement.js"; -import getLinkElement from "./utils/getLinkElement.js"; -import getStyleElement from "./utils/getStyleElement.js"; -import getLayoutStyles from "./utils/getLayoutStyles.js"; -import getFilteredProps from "./utils/getFilteredProps.js"; -import getPictureElement from "./utils/getPictureElement.js"; -import getBackgroundStyles from "./utils/getBackgroundStyles.js"; - -export default async function renderPicture(props) { - const type = "Picture"; - - const { filteredProps, transformConfigs } = getFilteredProps(type, props); - - const { - src, - alt, - sizes, - preload, - loading, - decoding, - attributes, - layout, - placeholder, - breakpoints, - objectFit, - objectPosition, - format, - fallbackFormat, - includeSourceFormat, - formatOptions, - fadeInTransition, - artDirectives, - } = filteredProps; - - const { - img: imgAttributes = {}, - link: linkAttributes = {}, - style: styleAttributes = {}, - picture: pictureAttributes = {}, - } = attributes; - - const { uuid, images } = await getImage({ - src, - type, - sizes, - format, - breakpoints, - placeholder, - fallbackFormat, - includeSourceFormat, - formatOptions, - artDirectives, - transformConfigs, - }); - - const className = `astro-imagetools-picture-${uuid}`; - - const { imagesizes } = images[images.length - 1]; - - const backgroundStyles = getBackgroundStyles( - images, - className, - objectFit, - objectPosition, - fadeInTransition - ); - - const style = getStyleElement({ styleAttributes, backgroundStyles }); - - const link = getLinkElement({ images, preload, imagesizes, linkAttributes }); - - const layoutStyles = getLayoutStyles({ layout }); - - const sources = images.flatMap(({ media, sources, sizes, imagesizes }) => - sources.map(({ format, src, srcset }) => - src - ? getImgElement({ - src, - alt, - sizes, - style, - srcset, - loading, - decoding, - imagesizes, - fadeInTransition, - layoutStyles, - imgAttributes, - }) - : `` - ) - ); - - const picture = getPictureElement({ - sources, - className, - layoutStyles, - pictureAttributes, - }); - - return { link, style, picture }; -} +// @ts-check +import getImage from "./utils/getImage.js" +import getImgElement from "./utils/getImgElement.js" +import getLinkElement from "./utils/getLinkElement.js" +import getStyleElement from "./utils/getStyleElement.js" +import getLayoutStyles from "./utils/getLayoutStyles.js" +import getFilteredProps from "./utils/getFilteredProps.js" +import getPictureElement from "./utils/getPictureElement.js" +import getBackgroundStyles from "./utils/getBackgroundStyles.js" + +export default async function renderPicture(props) { + const type = "Picture" + const { filteredProps, transformConfigs } = getFilteredProps(type, props) + const { + src, + alt, + sizes, + preload, + loading, + decoding, + attributes, + layout, + placeholder, + breakpoints, + objectFit, + objectPosition, + format, + fallbackFormat, + includeSourceFormat, + formatOptions, + fadeInTransition, + artDirectives, + } = filteredProps; + + const { + img: imgAttributes = {}, + link: linkAttributes = {}, + style: styleAttributes = {}, + picture: pictureAttributes = {}, + } = attributes; + + const { uuid, images } = await getImage({ + src, + type, + sizes, + format, + breakpoints, + placeholder, + fallbackFormat, + includeSourceFormat, + formatOptions, + artDirectives, + transformConfigs, + }) + + const className = `imagetools-picture-${uuid}` + + const { imagesizes } = images[images.length - 1] + + const backgroundStyles = getBackgroundStyles( + images, + className, + objectFit, + objectPosition, + fadeInTransition + ) + + const style = getStyleElement({ styleAttributes, backgroundStyles }) + const link = getLinkElement({ images, preload, imagesizes, linkAttributes }) + const layoutStyles = getLayoutStyles({ layout }) + const sources = images.flatMap(({ media, sources, sizes, imagesizes }) => + sources.map(({ format, src, srcset }) => + src + ? getImgElement({ + src, + alt, + sizes, + style, + srcset, + loading, + decoding, + imagesizes, + fadeInTransition, + layoutStyles, + imgAttributes, + }) + : `` + ) + ) + + const picture = getPictureElement({ + sources, + className, + layoutStyles, + pictureAttributes, + }) + + return { link, style, picture } +} diff --git a/packages/imagetools/api/utils/codecs.js b/packages/imagetools/api/utils/codecs.js index 8f72571..8dfb21d 100644 --- a/packages/imagetools/api/utils/codecs.js +++ b/packages/imagetools/api/utils/codecs.js @@ -1,38 +1,36 @@ -// @ts-check -import fs from "node:fs"; -import { extname } from "node:path"; -import * as codecs from "@astropub/codecs"; - -export async function getImageDetails(path, width, height, aspect) { - const extension = extname(path).slice(1); - - const imageFormat = extension === "jpeg" ? "jpg" : extension; - - const buffer = fs.readFileSync(path); - const decodedImage = await codecs.jpg.decode(buffer); - - if (aspect && !width && !height) { - if (!width && !height) { - ({ width } = decodedImage); - } - - if (width) { - height = width / aspect; - } - - if (height) { - width = height * aspect; - } - } - - const image = await decodedImage.resize({ width, height }); - - const { width: imageWidth, height: imageHeight } = image; - - return { - image, - imageWidth, - imageHeight, - imageFormat, - }; -} +// @ts-check +import fs from "node:fs"; +import { extname } from "node:path"; +import * as codecs from "@astropub/codecs"; + +export async function getImageDetails(path, width, height, aspect) { + const extension = extname(path).slice(1); + const imageFormat = extension === "jpeg" ? "jpg" : extension; + const buffer = fs.readFileSync(path); + const decodedImage = await codecs.jpg.decode(buffer); + + if (aspect && !width && !height) { + if (!width && !height) { + ({ width } = decodedImage); + } + + if (width) { + height = width / aspect; + } + + if (height) { + width = height * aspect; + } + } + + const image = await decodedImage.resize({ width, height }); + + const { width: imageWidth, height: imageHeight } = image; + + return { + image, + imageWidth, + imageHeight, + imageFormat, + }; +} diff --git a/packages/imagetools/api/utils/getArtDirectedImages.js b/packages/imagetools/api/utils/getArtDirectedImages.js index 1f7c073..ca23e50 100644 --- a/packages/imagetools/api/utils/getArtDirectedImages.js +++ b/packages/imagetools/api/utils/getArtDirectedImages.js @@ -1,137 +1,137 @@ -// @ts-check -import getSrcset from "./getSrcset.js"; -import getConfigOptions from "./getConfigOptions.js"; -import getFallbackImage from "./getFallbackImage.js"; -import getProcessedImage from "./getProcessedImage.js"; - -export default async function getArtDirectedImages( - artDirectives = [], - placeholder, - format, - imagesizes, - breakpoints, - fallbackFormat, - includeSourceFormat, - formatOptions, - rest -) { - const images = await Promise.all( - artDirectives.map( - async ({ - src, - media, - sizes: directiveImagesizes, - placeholder: directivePlaceholder, - breakpoints: directiveBreakpoints, - objectFit, - objectPosition, - backgroundSize, - backgroundPosition, - format: directiveFormat, - fallbackFormat: directiveFallbackFormat, - includeSourceFormat: directiveIncludeSourceFormat, - formatOptions: directiveFormatOptions = {}, - ...configOptions - }) => { - const { - path, - base, - rest: rest2, - image, - imageWidth, - imageHeight, - imageFormat, - } = await getProcessedImage(src, configOptions); - - rest2.aspect = `${imageWidth / imageHeight}`; - - const calculatedConfigs = getConfigOptions( - imageWidth, - directiveImagesizes || imagesizes, - directiveBreakpoints || breakpoints, - directiveFormat || format, - imageFormat, - directiveFallbackFormat || fallbackFormat, - directiveIncludeSourceFormat || includeSourceFormat - ); - - const { formats, requiredBreakpoints } = calculatedConfigs; - - imagesizes = calculatedConfigs.imagesizes; - - const maxWidth = requiredBreakpoints[requiredBreakpoints.length - 1]; - - const sources = await Promise.all( - formats.map(async (format) => { - const srcset = await getSrcset( - path, - base, - requiredBreakpoints, - format, - { - ...rest, - ...rest2, - ...formatOptions[format], - ...directiveFormatOptions[format], - } - ); - - return { - format, - srcset, - }; - }) - ); - - const sizes = { - width: maxWidth, - height: Math.round(maxWidth / rest2.aspect), - }; - - const object = { - fit: objectFit, - position: objectPosition, - }; - - const background = { - size: backgroundSize, - position: backgroundPosition, - }; - - const fallback = await getFallbackImage( - path, - directivePlaceholder || placeholder, - image, - imageFormat, - { ...formatOptions, ...directiveFormatOptions }, - { ...rest, ...rest2 } - ); - - const returnValue = { - media, - sources, - sizes, - fallback, - imagesizes, - }; - - const isBackgroundImage = !!backgroundSize || !!backgroundPosition; - - isBackgroundImage - ? (returnValue.background = background) - : (returnValue.object = object); - - return { - media, - sources, - sizes, - object, - fallback, - imagesizes, - }; - } - ) - ); - - return images; -} +// @ts-check +import getSrcset from "./getSrcset.js"; +import getConfigOptions from "./getConfigOptions.js"; +import getFallbackImage from "./getFallbackImage.js"; +import getProcessedImage from "./getProcessedImage.js"; + +export default async function getArtDirectedImages( + artDirectives = [], + placeholder, + format, + imagesizes, + breakpoints, + fallbackFormat, + includeSourceFormat, + formatOptions, + rest +) { + const images = await Promise.all( + artDirectives.map( + async ({ + src, + media, + sizes: directiveImagesizes, + placeholder: directivePlaceholder, + breakpoints: directiveBreakpoints, + objectFit, + objectPosition, + backgroundSize, + backgroundPosition, + format: directiveFormat, + fallbackFormat: directiveFallbackFormat, + includeSourceFormat: directiveIncludeSourceFormat, + formatOptions: directiveFormatOptions = {}, + ...configOptions + }) => { + const { + path, + base, + rest: rest2, + image, + imageWidth, + imageHeight, + imageFormat, + } = await getProcessedImage(src, configOptions); + + rest2.aspect = `${imageWidth / imageHeight}`; + + const calculatedConfigs = getConfigOptions( + imageWidth, + directiveImagesizes || imagesizes, + directiveBreakpoints || breakpoints, + directiveFormat || format, + imageFormat, + directiveFallbackFormat || fallbackFormat, + directiveIncludeSourceFormat || includeSourceFormat + ); + + const { formats, requiredBreakpoints } = calculatedConfigs; + + imagesizes = calculatedConfigs.imagesizes; + + const maxWidth = requiredBreakpoints[requiredBreakpoints.length - 1]; + + const sources = await Promise.all( + formats.map(async (format) => { + const srcset = await getSrcset( + path, + base, + requiredBreakpoints, + format, + { + ...rest, + ...rest2, + ...formatOptions[format], + ...directiveFormatOptions[format], + } + ); + + return { + format, + srcset, + }; + }) + ); + + const sizes = { + width: maxWidth, + height: Math.round(maxWidth / rest2.aspect), + }; + + const object = { + fit: objectFit, + position: objectPosition, + }; + + const background = { + size: backgroundSize, + position: backgroundPosition, + }; + + const fallback = await getFallbackImage( + path, + directivePlaceholder || placeholder, + image, + imageFormat, + { ...formatOptions, ...directiveFormatOptions }, + { ...rest, ...rest2 } + ); + + const returnValue = { + media, + sources, + sizes, + fallback, + imagesizes, + }; + + const isBackgroundImage = !!backgroundSize || !!backgroundPosition; + + isBackgroundImage + ? (returnValue.background = background) + : (returnValue.object = object); + + return { + media, + sources, + sizes, + object, + fallback, + imagesizes, + }; + } + ) + ); + + return images; +} diff --git a/packages/imagetools/api/utils/getAttributesString.js b/packages/imagetools/api/utils/getAttributesString.js index e9bd1c1..22975e5 100644 --- a/packages/imagetools/api/utils/getAttributesString.js +++ b/packages/imagetools/api/utils/getAttributesString.js @@ -1,27 +1,27 @@ -// @ts-check - -import printWarning from "../../utils/printWarning.js"; - -export default function getAttributesString({ - attributes, - element = "", - excludeArray = [], -}) { - const attributesString = Object.keys(attributes) - .filter((key) => { - if (excludeArray.includes(key)) { - printWarning({ - key, - element, - }); - - return false; - } - - return true; - }) - .map((key) => `${key}="${attributes[key]}"`) - .join(" "); - - return attributesString; -} +// @ts-check + +import printWarning from "../../utils/printWarning.js"; + +export default function getAttributesString({ + attributes, + element = "", + excludeArray = [], +}) { + const attributesString = Object.keys(attributes) + .filter((key) => { + if (excludeArray.includes(key)) { + printWarning({ + key, + element, + }); + + return false; + } + + return true; + }) + .map((key) => `${key}="${attributes[key]}"`) + .join(" "); + + return attributesString; +} diff --git a/packages/imagetools/api/utils/getBackgroundStyles.js b/packages/imagetools/api/utils/getBackgroundStyles.js index 111233c..fff3ad3 100644 --- a/packages/imagetools/api/utils/getBackgroundStyles.js +++ b/packages/imagetools/api/utils/getBackgroundStyles.js @@ -1,97 +1,97 @@ -// @ts-check - -export default function getBackgroundStyles( - images, - className, - objectFit, - objectPosition, - fadeInTransition, - { isImg = false, isBackgroundPicture = false, containerClassName = "" } = {} -) { - const sourcesWithFallback = images.filter(({ fallback }) => fallback); - - if (sourcesWithFallback.length === 0) return ""; - - const staticStyles = !fadeInTransition - ? "" - : ` - ${ - isBackgroundPicture - ? ` - .${containerClassName} * { - z-index: 1; - position: relative; - } - ` - : "" - } - - .${className} { - --opacity: 1; - --z-index: 0; - } - - ${ - !isBackgroundPicture - ? ` - .${className} img { - z-index: 1; - position: relative; - } - ` - : "" - } - - .${className}::after { - inset: 0; - content: ""; - left: 0; - width: 100%; - height: 100%; - position: absolute; - pointer-events: none; - transition: opacity ${ - typeof fadeInTransition !== "object" - ? "1s" - : (() => { - const { - delay = "0s", - duration = "1s", - timingFunction = "ease", - } = fadeInTransition; - - return `${duration} ${timingFunction} ${delay}`; - })() - }; - opacity: var(--opacity); - z-index: var(--z-index); - } - `; - - const dynamicStyles = images - .map(({ media, fallback, object }) => { - const elementSelector = className + (!isImg ? " img" : ""), - backgroundElementSelector = - className + (fadeInTransition ? "::after" : ""); - - const style = ` - .${elementSelector} { - object-fit: ${object?.fit || objectFit}; - object-position: ${object?.position || objectPosition}; - } - - .${backgroundElementSelector} { - background-size: ${object?.fit || objectFit}; - background-image: url("${encodeURI(fallback)}"); - background-position: ${object?.position || objectPosition}; - } - `; - - return media ? `@media ${media} { ${style} }` : style; - }) - .reverse(); - - const backgroundStyles = [staticStyles, ...dynamicStyles].join(""); - - return backgroundStyles; -} +// @ts-check + +export default function getBackgroundStyles( + images, + className, + objectFit, + objectPosition, + fadeInTransition, + { isImg = false, isBackgroundPicture = false, containerClassName = "" } = {} +) { + const sourcesWithFallback = images.filter(({ fallback }) => fallback); + + if (sourcesWithFallback.length === 0) return ""; + + const staticStyles = !fadeInTransition + ? "" + : ` + ${ + isBackgroundPicture + ? ` + .${containerClassName} * { + z-index: 1; + position: relative; + } + ` + : "" + } + + .${className} { + --opacity: 1; + --z-index: 0; + } + + ${ + !isBackgroundPicture + ? ` + .${className} img { + z-index: 1; + position: relative; + } + ` + : "" + } + + .${className}::after { + inset: 0; + content: ""; + left: 0; + width: 100%; + height: 100%; + position: absolute; + pointer-events: none; + transition: opacity ${ + typeof fadeInTransition !== "object" + ? "1s" + : (() => { + const { + delay = "0s", + duration = "1s", + timingFunction = "ease", + } = fadeInTransition; + + return `${duration} ${timingFunction} ${delay}`; + })() + }; + opacity: var(--opacity); + z-index: var(--z-index); + } + `; + + const dynamicStyles = images + .map(({ media, fallback, object }) => { + const elementSelector = className + (!isImg ? " img" : ""), + backgroundElementSelector = + className + (fadeInTransition ? "::after" : ""); + + const style = ` + .${elementSelector} { + object-fit: ${object?.fit || objectFit}; + object-position: ${object?.position || objectPosition}; + } + + .${backgroundElementSelector} { + background-size: ${object?.fit || objectFit}; + background-image: url("${encodeURI(fallback)}"); + background-position: ${object?.position || objectPosition}; + } + `; + + return media ? `@media ${media} { ${style} }` : style; + }) + .reverse(); + + const backgroundStyles = [staticStyles, ...dynamicStyles].join(""); + + return backgroundStyles; +} diff --git a/packages/imagetools/api/utils/getBreakpoints.js b/packages/imagetools/api/utils/getBreakpoints.js index 02a098e..edfb827 100644 --- a/packages/imagetools/api/utils/getBreakpoints.js +++ b/packages/imagetools/api/utils/getBreakpoints.js @@ -1,77 +1,77 @@ -// @ts-check -import printWarning from "../../utils/printWarning.js"; - -export default function getBreakpoints(breakpoints, imageWidth) { - if (Array.isArray(breakpoints)) { - return breakpoints.sort((a, b) => a - b); - } - - const { count, minWidth = 320 } = breakpoints || {}; - - const maxWidth = (() => { - if (breakpoints?.maxWidth) return breakpoints.maxWidth; - - if (imageWidth > 3840) { - printWarning({ - message: - "The width of the source image is greater than 3840px. The generated breakpoints will be capped at 3840px. If you need breakpoints larger than this, please pass the maxWidth option to the breakpoints property.", - }); - - return 3840; - } - - return imageWidth; - })(); - - const breakPoints = []; - - const diff = maxWidth - minWidth; - - const n = - count || - (maxWidth <= 400 - ? 1 - : maxWidth <= 640 - ? 2 - : maxWidth <= 800 - ? 3 - : maxWidth <= 1024 - ? 4 - : maxWidth <= 1280 - ? 5 - : maxWidth <= 1440 - ? 6 - : maxWidth <= 1920 - ? 7 - : maxWidth <= 2560 - ? 8 - : maxWidth <= 2880 - ? 9 - : maxWidth <= 3840 - ? 10 - : 11); - - let currentWidth = minWidth; - - n > 1 && breakPoints.push(currentWidth); - - let steps = 0; - - for (let i = 1; i < n; i++) { - steps += i; - } - - const pixelsPerStep = diff / steps; - - for (let i = 1; i < n - 1; i++) { - const next = pixelsPerStep * (n - i) + currentWidth; - - breakPoints.push(Math.round(next)); - - currentWidth = next; - } - - breakPoints.push(maxWidth); - - return [...new Set(breakPoints)]; -} +// @ts-check +import printWarning from "../../utils/printWarning.js"; + +export default function getBreakpoints(breakpoints, imageWidth) { + if (Array.isArray(breakpoints)) { + return breakpoints.sort((a, b) => a - b); + } + + const { count, minWidth = 320 } = breakpoints || {}; + + const maxWidth = (() => { + if (breakpoints?.maxWidth) return breakpoints.maxWidth; + + if (imageWidth > 3840) { + printWarning({ + message: + "The width of the source image is greater than 3840px. The generated breakpoints will be capped at 3840px. If you need breakpoints larger than this, please pass the maxWidth option to the breakpoints property.", + }); + + return 3840; + } + + return imageWidth; + })(); + + const breakPoints = []; + + const diff = maxWidth - minWidth; + + const n = + count || + (maxWidth <= 400 + ? 1 + : maxWidth <= 640 + ? 2 + : maxWidth <= 800 + ? 3 + : maxWidth <= 1024 + ? 4 + : maxWidth <= 1280 + ? 5 + : maxWidth <= 1440 + ? 6 + : maxWidth <= 1920 + ? 7 + : maxWidth <= 2560 + ? 8 + : maxWidth <= 2880 + ? 9 + : maxWidth <= 3840 + ? 10 + : 11); + + let currentWidth = minWidth; + + n > 1 && breakPoints.push(currentWidth); + + let steps = 0; + + for (let i = 1; i < n; i++) { + steps += i; + } + + const pixelsPerStep = diff / steps; + + for (let i = 1; i < n - 1; i++) { + const next = pixelsPerStep * (n - i) + currentWidth; + + breakPoints.push(Math.round(next)); + + currentWidth = next; + } + + breakPoints.push(maxWidth); + + return [...new Set(breakPoints)]; +} diff --git a/packages/imagetools/api/utils/getConfigOptions.js b/packages/imagetools/api/utils/getConfigOptions.js index 3b3797d..16220e5 100644 --- a/packages/imagetools/api/utils/getConfigOptions.js +++ b/packages/imagetools/api/utils/getConfigOptions.js @@ -1,34 +1,34 @@ -// @ts-check -import getBreakpoints from "./getBreakpoints.js"; - -export default function getConfigOptions( - imageWidth, - imagesizes, - breakpoints, - format, - imageFormat, - fallbackFormat, - includeSourceFormat -) { - const formats = [ - ...new Set( - [format, includeSourceFormat && imageFormat] - .flat() - .filter((f) => f && f !== fallbackFormat) - ), - fallbackFormat, - ]; - - const requiredBreakpoints = getBreakpoints(breakpoints, imageWidth); - - imagesizes = - typeof imagesizes === "string" - ? imagesizes - : imagesizes(requiredBreakpoints); - - return { - formats, - imagesizes, - requiredBreakpoints, - }; -} +// @ts-check +import getBreakpoints from "./getBreakpoints.js"; + +export default function getConfigOptions( + imageWidth, + imagesizes, + breakpoints, + format, + imageFormat, + fallbackFormat, + includeSourceFormat +) { + const formats = [ + ...new Set( + [format, includeSourceFormat && imageFormat] + .flat() + .filter((f) => f && f !== fallbackFormat) + ), + fallbackFormat, + ]; + + const requiredBreakpoints = getBreakpoints(breakpoints, imageWidth); + + imagesizes = + typeof imagesizes === "string" + ? imagesizes + : imagesizes(requiredBreakpoints); + + return { + formats, + imagesizes, + requiredBreakpoints, + }; +} diff --git a/packages/imagetools/api/utils/getContainerElement.js b/packages/imagetools/api/utils/getContainerElement.js index 9c5b710..8ae04d6 100644 --- a/packages/imagetools/api/utils/getContainerElement.js +++ b/packages/imagetools/api/utils/getContainerElement.js @@ -1,48 +1,48 @@ -// @ts-check -import getAttributesString from "./getAttributesString.js"; - -export default function getContainerElement({ - tag, - content, - className = "", - containerAttributes, - isBackgroundPicture = false, - containerClassName = "", -}) { - const { - class: customClasses = "", - style: customInlineStyles = "", - ...restContainerAttributes - } = containerAttributes; - - const attributesString = getAttributesString({ - attributes: restContainerAttributes, - }); - - const classAttribute = [ - isBackgroundPicture - ? "astro-imagetools-background-picture" - : "astro-imagetools-background-image", - isBackgroundPicture ? containerClassName : className, - customClasses, - ] - .join(" ") - .trim(); - - const styleAttribute = [ - isBackgroundPicture ? "position: relative;" : "", - customInlineStyles + (customInlineStyles.endsWith(";") ? "" : ";"), - ] - .join(" ") - .trim(); - - const containerElement = `<${tag} - ${attributesString} - class="${classAttribute}" - style="${styleAttribute}" - > - ${content} - `; - - return containerElement; -} +// @ts-check +import getAttributesString from "./getAttributesString.js"; + +export default function getContainerElement({ + tag, + content, + className = "", + containerAttributes, + isBackgroundPicture = false, + containerClassName = "", +}) { + const { + class: customClasses = "", + style: customInlineStyles = "", + ...restContainerAttributes + } = containerAttributes; + + const attributesString = getAttributesString({ + attributes: restContainerAttributes, + }); + + const classAttribute = [ + isBackgroundPicture + ? "astro-imagetools-background-picture" + : "astro-imagetools-background-image", + isBackgroundPicture ? containerClassName : className, + customClasses, + ] + .join(" ") + .trim(); + + const styleAttribute = [ + isBackgroundPicture ? "position: relative;" : "", + customInlineStyles + (customInlineStyles.endsWith(";") ? "" : ";"), + ] + .join(" ") + .trim(); + + const containerElement = `<${tag} + ${attributesString} + class="${classAttribute}" + style="${styleAttribute}" + > + ${content} + `; + + return containerElement; +} diff --git a/packages/imagetools/api/utils/getFallbackImage.js b/packages/imagetools/api/utils/getFallbackImage.js index b085286..91d1fad 100644 --- a/packages/imagetools/api/utils/getFallbackImage.js +++ b/packages/imagetools/api/utils/getFallbackImage.js @@ -1,58 +1,58 @@ -// @ts-check - -import util from "node:util"; -import potrace from "potrace"; -import getSrcset from "./getSrcset.js"; -import { sharp } from "../../utils/runtimeChecks.js"; - -export default async function getFallbackImage( - src, - placeholder, - image, - format, - formatOptions, - rest -) { - const base = null; - - switch (placeholder) { - case "blurred": { - const dataUri = await getSrcset(src, base, [20], format, { - inline: true, - ...rest, - ...formatOptions[format], - }); - - return dataUri; - } - case "tracedSVG": { - const { function: fn, options } = formatOptions.tracedSVG; - - const traceSVG = util.promisify(potrace[fn]); - - const imageBuffer = sharp - ? await image.toBuffer() - : Buffer.from( - (await image.encode(`image/${format === "jpg" ? "jpeg" : format}`)) - .data - ); - - const tracedSVG = await traceSVG(imageBuffer, options); - - return `data:image/svg+xml;utf8,${tracedSVG}`; - } - case "dominantColor": { - if (sharp) { - var { r, g, b } = (await image.stats()).dominant; - } else { - [r, g, b] = image.color; - } - - const svg = ``; - - return `data:image/svg+xml;utf8,${svg}`; - } - default: - return null; - } -} +// @ts-check + +import util from "node:util"; +import potrace from "potrace"; +import getSrcset from "./getSrcset.js"; +import { sharp } from "../../utils/runtimeChecks.js"; + +export default async function getFallbackImage( + src, + placeholder, + image, + format, + formatOptions, + rest +) { + const base = null; + + switch (placeholder) { + case "blurred": { + const dataUri = await getSrcset(src, base, [20], format, { + inline: true, + ...rest, + ...formatOptions[format], + }); + + return dataUri; + } + case "tracedSVG": { + const { function: fn, options } = formatOptions.tracedSVG; + + const traceSVG = util.promisify(potrace[fn]); + + const imageBuffer = sharp + ? await image.toBuffer() + : Buffer.from( + (await image.encode(`image/${format === "jpg" ? "jpeg" : format}`)) + .data + ); + + const tracedSVG = await traceSVG(imageBuffer, options); + + return `data:image/svg+xml;utf8,${tracedSVG}`; + } + case "dominantColor": { + if (sharp) { + var { r, g, b } = (await image.stats()).dominant; + } else { + [r, g, b] = image.color; + } + + const svg = ``; + + return `data:image/svg+xml;utf8,${svg}`; + } + default: + return null; + } +} diff --git a/packages/imagetools/api/utils/getFilteredProps.js b/packages/imagetools/api/utils/getFilteredProps.js index 9c791ba..4d9d7f0 100644 --- a/packages/imagetools/api/utils/getFilteredProps.js +++ b/packages/imagetools/api/utils/getFilteredProps.js @@ -1,138 +1,138 @@ -// @ts-check -import filterConfigs from "../../utils/filterConfigs.js"; -import { - supportedConfigs, - GlobalConfigOptions, -} from "../../utils/runtimeChecks.js"; - -const GlobalOnlyProperties = ["cacheDir", "assetFileNames"]; - -const NonGlobalSupportedConfigs = supportedConfigs.filter( - (key) => !GlobalOnlyProperties.includes(key) -); - -const NonProperties = { - Img: [ - "tag", - "content", - "backgroundSize", - "backgroundPosition", - "fallbackFormat", - "includeSourceFormat", - "fadeInTransition", - "artDirectives", - ], - Picture: ["tag", "content", "backgroundSize", "backgroundPosition"], - BackgroundImage: [ - "alt", - "loading", - "decoding", - "layout", - "objectFit", - "objectPosition", - "fadeInTransition", - ], - BackgroundPicture: ["alt", "backgroundSize", "backgroundPosition"], -}; - -const ImgProperties = NonGlobalSupportedConfigs.filter( - (key) => !NonProperties.Img.includes(key) - ), - PictureProperties = NonGlobalSupportedConfigs.filter( - (key) => !NonProperties.Picture.includes(key) - ), - BackgroundImageProperties = NonGlobalSupportedConfigs.filter( - (key) => !NonProperties.BackgroundImage.includes(key) - ), - BackgroundPictureProperties = NonGlobalSupportedConfigs.filter( - (key) => !NonProperties.BackgroundPicture.includes(key) - ); - -const SupportedProperties = { - Img: ImgProperties, - Picture: PictureProperties, - BackgroundImage: BackgroundImageProperties, - BackgroundPicture: BackgroundPictureProperties, -}; - -export default function getFilteredProps(type, props) { - const filteredGlobalConfigs = filterConfigs( - "Global", - GlobalConfigOptions, - SupportedProperties[type], - { warn: false } - ); - - const { search, searchParams } = new URL(props.src, "file://"); - - props.src = props.src.replace(search, ""); - - const paramOptions = Object.fromEntries(searchParams); - - const filteredLocalProps = filterConfigs( - type, - { - ...paramOptions, - ...props, - }, - SupportedProperties[type] - ); - - const resolvedProps = { - ...filteredGlobalConfigs, - ...filteredLocalProps, - }; - - const { - src, - alt, - tag = "section", - content = "", - sizes = function (breakpoints) { - const maxWidth = breakpoints[breakpoints.length - 1]; - return `(min-width: ${maxWidth}px) ${maxWidth}px, 100vw`; - }, - preload, - loading = preload ? "eager" : "lazy", - decoding = "async", - attributes = {}, - layout = "constrained", - placeholder = "blurred", - breakpoints, - objectFit = "cover", - objectPosition = "50% 50%", - backgroundSize = "cover", - backgroundPosition = "50% 50%", - format = type === "Img" ? undefined : ["avif", "webp"], - fallbackFormat, - includeSourceFormat = true, - formatOptions = { - tracedSVG: { - function: "trace", - }, - }, - fadeInTransition = true, - artDirectives, - ...transformConfigs - } = resolvedProps; - - // prettier-ignore - const allProps = { - src, alt, tag, content, sizes, preload, loading, decoding, attributes, layout, placeholder, - breakpoints, objectFit, objectPosition, backgroundSize, backgroundPosition, format, - fallbackFormat, includeSourceFormat, formatOptions, fadeInTransition, artDirectives, - ...transformConfigs, - }; - - const filteredProps = filterConfigs( - type, - allProps, - SupportedProperties[type], - { warn: false } - ); - - return { - filteredProps, - transformConfigs, - }; -} +// @ts-check +import filterConfigs from "../../utils/filterConfigs.js"; +import { + supportedConfigs, + GlobalConfigOptions, +} from "../../utils/runtimeChecks.js"; + +const GlobalOnlyProperties = ["cacheDir", "assetFileNames"]; + +const NonGlobalSupportedConfigs = supportedConfigs.filter( + (key) => !GlobalOnlyProperties.includes(key) +); + +const NonProperties = { + Img: [ + "tag", + "content", + "backgroundSize", + "backgroundPosition", + "fallbackFormat", + "includeSourceFormat", + "fadeInTransition", + "artDirectives", + ], + Picture: ["tag", "content", "backgroundSize", "backgroundPosition"], + BackgroundImage: [ + "alt", + "loading", + "decoding", + "layout", + "objectFit", + "objectPosition", + "fadeInTransition", + ], + BackgroundPicture: ["alt", "backgroundSize", "backgroundPosition"], +}; + +const ImgProperties = NonGlobalSupportedConfigs.filter( + (key) => !NonProperties.Img.includes(key) + ), + PictureProperties = NonGlobalSupportedConfigs.filter( + (key) => !NonProperties.Picture.includes(key) + ), + BackgroundImageProperties = NonGlobalSupportedConfigs.filter( + (key) => !NonProperties.BackgroundImage.includes(key) + ), + BackgroundPictureProperties = NonGlobalSupportedConfigs.filter( + (key) => !NonProperties.BackgroundPicture.includes(key) + ); + +const SupportedProperties = { + Img: ImgProperties, + Picture: PictureProperties, + BackgroundImage: BackgroundImageProperties, + BackgroundPicture: BackgroundPictureProperties, +}; + +export default function getFilteredProps(type, props) { + const filteredGlobalConfigs = filterConfigs( + "Global", + GlobalConfigOptions, + SupportedProperties[type], + { warn: false } + ); + + const { search, searchParams } = new URL(props.src, "file://"); + + props.src = props.src.replace(search, ""); + + const paramOptions = Object.fromEntries(searchParams); + + const filteredLocalProps = filterConfigs( + type, + { + ...paramOptions, + ...props, + }, + SupportedProperties[type] + ); + + const resolvedProps = { + ...filteredGlobalConfigs, + ...filteredLocalProps, + }; + + const { + src, + alt, + tag = "section", + content = "", + sizes = function (breakpoints) { + const maxWidth = breakpoints[breakpoints.length - 1]; + return `(min-width: ${maxWidth}px) ${maxWidth}px, 100vw`; + }, + preload, + loading = preload ? "eager" : "lazy", + decoding = "async", + attributes = {}, + layout = "constrained", + placeholder = "blurred", + breakpoints, + objectFit = "cover", + objectPosition = "50% 50%", + backgroundSize = "cover", + backgroundPosition = "50% 50%", + format = type === "Img" ? undefined : ["avif", "webp"], + fallbackFormat, + includeSourceFormat = true, + formatOptions = { + tracedSVG: { + function: "trace", + }, + }, + fadeInTransition = true, + artDirectives, + ...transformConfigs + } = resolvedProps; + + // prettier-ignore + const allProps = { + src, alt, tag, content, sizes, preload, loading, decoding, attributes, layout, placeholder, + breakpoints, objectFit, objectPosition, backgroundSize, backgroundPosition, format, + fallbackFormat, includeSourceFormat, formatOptions, fadeInTransition, artDirectives, + ...transformConfigs, + }; + + const filteredProps = filterConfigs( + type, + allProps, + SupportedProperties[type], + { warn: false } + ); + + return { + filteredProps, + transformConfigs, + }; +} diff --git a/packages/imagetools/api/utils/getFilteredProps.test.ts b/packages/imagetools/api/utils/getFilteredProps.test.ts index 7b8f20c..cdca949 100644 --- a/packages/imagetools/api/utils/getFilteredProps.test.ts +++ b/packages/imagetools/api/utils/getFilteredProps.test.ts @@ -1,49 +1,49 @@ -import { describe, expect, it } from "vitest"; -import getFilteredProps from "./getFilteredProps"; - -describe("getFilteredProps", () => { - it("should should merge in default props", () => { - const result = getFilteredProps("Img", { src: "/img.jpeg", alt: "alt" }); - expect(result).toEqual({ - filteredProps: { - alt: "alt", - attributes: {}, - breakpoints: undefined, - decoding: "async", - format: undefined, - formatOptions: { - tracedSVG: { - function: "trace", - }, - }, - layout: "constrained", - loading: "lazy", - objectFit: "cover", - objectPosition: "50% 50%", - placeholder: "blurred", - preload: undefined, - sizes: expect.any(Function), - src: "/img.jpeg", - }, - transformConfigs: {}, - }); - }); - - it("should accept empty string for `alt` prop on Img", () => { - const result = getFilteredProps("Img", { src: "/img.jpeg", alt: "" }); - expect(result).toMatchObject({ - filteredProps: { - alt: "", - }, - }); - }); - - it("should accept empty string for `alt` prop on Picture", () => { - const result = getFilteredProps("Picture", { src: "/img.jpeg", alt: "" }); - expect(result).toMatchObject({ - filteredProps: { - alt: "", - }, - }); - }); -}); +import { describe, expect, it } from "vitest"; +import getFilteredProps from "./getFilteredProps"; + +describe("getFilteredProps", () => { + it("should should merge in default props", () => { + const result = getFilteredProps("Img", { src: "/img.jpeg", alt: "alt" }); + expect(result).toEqual({ + filteredProps: { + alt: "alt", + attributes: {}, + breakpoints: undefined, + decoding: "async", + format: undefined, + formatOptions: { + tracedSVG: { + function: "trace", + }, + }, + layout: "constrained", + loading: "lazy", + objectFit: "cover", + objectPosition: "50% 50%", + placeholder: "blurred", + preload: undefined, + sizes: expect.any(Function), + src: "/img.jpeg", + }, + transformConfigs: {}, + }); + }); + + it("should accept empty string for `alt` prop on Img", () => { + const result = getFilteredProps("Img", { src: "/img.jpeg", alt: "" }); + expect(result).toMatchObject({ + filteredProps: { + alt: "", + }, + }); + }); + + it("should accept empty string for `alt` prop on Picture", () => { + const result = getFilteredProps("Picture", { src: "/img.jpeg", alt: "" }); + expect(result).toMatchObject({ + filteredProps: { + alt: "", + }, + }); + }); +}); diff --git a/packages/imagetools/api/utils/getImage.js b/packages/imagetools/api/utils/getImage.js index b2ad3c9..21865ea 100644 --- a/packages/imagetools/api/utils/getImage.js +++ b/packages/imagetools/api/utils/getImage.js @@ -1,108 +1,80 @@ -// @ts-check -import crypto from "node:crypto"; -import objectHash from "object-hash"; -import getImageSources from "./getImageSources.js"; -import getProcessedImage from "./getProcessedImage.js"; -import getArtDirectedImages from "./getArtDirectedImages.js"; -import pMap from "p-map"; -// Caching moved to plugin level for proper store population - -const imagesData = new Map(); - -const delay = (ms) => new Promise((resolve) => setTimeout(resolve, ms)); - -// Cache helpers moved to plugin level - -export default async function ({ - src, - type, - sizes: imagesizes, - format, - breakpoints, - placeholder, - fallbackFormat, - includeSourceFormat, - formatOptions, - artDirectives, - transformConfigs, -}) { - try { - const args = Array.from(arguments); - const hash = objectHash(args); - - // Check in-memory cache first - if (imagesData.has(hash)) { - return imagesData.get(hash); - } - - // Caching removed from this level to ensure proper Vite store population - // Cache is now handled at the plugin level where it can properly manage the store - const { path, base, rest, image, imageWidth, imageHeight, imageFormat } = - await getProcessedImage(src, transformConfigs); - - src = path; - - rest.aspect = `${imageWidth / imageHeight}`; - if (!fallbackFormat) { - fallbackFormat = imageFormat; - } - - // Fetch both image sources and art-directed images - const [mainImage, artDirectedImages] = await pMap( - [ - async () => - await getImageSources( - src, - base, - image, - format, - imageWidth, - imagesizes, - breakpoints, - placeholder, - imageFormat, - formatOptions, - fallbackFormat, - includeSourceFormat, - rest - ), - async () => { - return await getArtDirectedImages( - artDirectives, - placeholder, - format, - imagesizes, - breakpoints, - fallbackFormat, - includeSourceFormat, - formatOptions, - rest - ); - }, - ], - async (task) => await task(), - { concurrency: 1 } - ); - - // Ensure artDirectedImages is an array - const images = Array.isArray(artDirectedImages) ? [...artDirectedImages, mainImage] : [mainImage]; - - // Create deterministic UUID based on input hash for consistent caching - const uuid = crypto.createHash('md5').update(hash).digest("hex").slice(0, 8).toUpperCase(); - - const returnObject = { - uuid, - images, - }; - - // Cache only in memory at this level - imagesData.set(hash, returnObject); - - // Persistent caching moved to plugin level for proper store management - - return returnObject; - } catch (error) { - console.error(`Error processing images:: ${src}`, error, error.stack); - throw error; - } -} +// @ts-check +import crypto from "node:crypto"; +import objectHash from "object-hash"; +import getImageSources from "./getImageSources.js"; +import getProcessedImage from "./getProcessedImage.js"; +import getArtDirectedImages from "./getArtDirectedImages.js"; + +const imagesData = new Map(); + +export default async function ({ + src, + type, + sizes: imagesizes, + format, + breakpoints, + placeholder, + fallbackFormat, + includeSourceFormat, + formatOptions, + artDirectives, + transformConfigs, +}) { + const args = Array.from(arguments); + const hash = objectHash(args); + if (imagesData.has(hash)) { + return imagesData.get(hash); + } + const { path, base, rest, image, imageWidth, imageHeight, imageFormat } = + await getProcessedImage(src, transformConfigs); + + src = path; + + rest.aspect = `${imageWidth / imageHeight}`; + + if (!fallbackFormat) { + fallbackFormat = imageFormat; + } + try { + const [mainImage, artDirectedImages] = await Promise.all([ + getImageSources( + src, + base, + image, + format, + imageWidth, + imagesizes, + breakpoints, + placeholder, + imageFormat, + formatOptions, + fallbackFormat, + includeSourceFormat, + rest + ), + getArtDirectedImages( + artDirectives, + placeholder, + format, + imagesizes, + breakpoints, + fallbackFormat, + includeSourceFormat, + formatOptions, + rest + ), + ]); + + const images = [...artDirectedImages, mainImage] + //const uuid = crypto.createHash('md5').update(src).digest('hex').substring(0, 5) + const uuid = crypto.randomBytes(4).toString("hex").toUpperCase() + const returnObject = { + uuid, + images, + } + imagesData.set(hash, returnObject) + return returnObject; + } catch (error) { + console.error(`Error getImage :${src}`, error) + } +} diff --git a/packages/imagetools/api/utils/getImageSources.js b/packages/imagetools/api/utils/getImageSources.js index d0dca00..7a728e4 100644 --- a/packages/imagetools/api/utils/getImageSources.js +++ b/packages/imagetools/api/utils/getImageSources.js @@ -1,91 +1,74 @@ -// @ts-check -import getSrcset from "./getSrcset.js"; -import getConfigOptions from "./getConfigOptions.js"; -import getFallbackImage from "./getFallbackImage.js"; -import pMap from "p-map"; - -function delay(ms) { - return new Promise((resolve) => setTimeout(resolve, ms)); -} - -export default async function getImageSources( - src, - base, - image, - format, - imageWidth, - imagesizes, - breakpoints, - placeholder, - imageFormat, - formatOptions, - fallbackFormat, - includeSourceFormat, - rest -) { - try { - const calculatedConfigs = getConfigOptions( - imageWidth, - imagesizes, - breakpoints, - format, - imageFormat, - fallbackFormat, - includeSourceFormat - ); - - const { formats, requiredBreakpoints } = calculatedConfigs; - imagesizes = calculatedConfigs.imagesizes; - const maxWidth = requiredBreakpoints[requiredBreakpoints.length - 1]; - const sliceLength = -(maxWidth.toString().length + 2); - - const sources = await pMap( - formats, - async (format) => { - try { - await delay(250); - const srcset = await getSrcset(src, base, requiredBreakpoints, format, { - ...rest, - ...formatOptions[format], - }); - - const srcsets = srcset.split(", "); - const srcObject = - format === fallbackFormat - ? { src: srcsets[srcsets.length - 1].slice(0, sliceLength) } - : {}; - - return { - ...srcObject, - format, - srcset, - }; - } catch (error) { - console.error(`Error processing format ${format}:`, error); - return null; - } - }, - { concurrency: 1 } - ); - - const filteredSources = sources.filter(Boolean); - - const sizes = { - width: maxWidth, - height: Math.round(maxWidth / rest.aspect), - }; - - const fallback = await getFallbackImage( - src, - placeholder, - image, - fallbackFormat, - formatOptions, - rest - ) - return { sources: filteredSources, sizes, fallback, imagesizes }; - } catch (error) { - console.error("Error in getImageSources:", error); - return { sources: [], sizes: {}, fallback: null, imagesizes: null }; - } -} +// @ts-check +import getSrcset from "./getSrcset.js"; +import getConfigOptions from "./getConfigOptions.js"; +import getFallbackImage from "./getFallbackImage.js"; + +export default async function getImageSources( + src, + base, + image, + format, + imageWidth, + imagesizes, + breakpoints, + placeholder, + imageFormat, + formatOptions, + fallbackFormat, + includeSourceFormat, + rest +) { + const calculatedConfigs = getConfigOptions( + imageWidth, + imagesizes, + breakpoints, + format, + imageFormat, + fallbackFormat, + includeSourceFormat + ); + + const { formats, requiredBreakpoints } = calculatedConfigs; + + imagesizes = calculatedConfigs.imagesizes; + + const maxWidth = requiredBreakpoints[requiredBreakpoints.length - 1]; + const sliceLength = -(maxWidth.toString().length + 2); + + const sources = await Promise.all( + formats.map(async (format) => { + const srcset = await getSrcset(src, base, requiredBreakpoints, format, { + ...rest, + ...formatOptions[format], + }); + + const srcsets = srcset.split(", "); + const srcObject = + format === fallbackFormat + ? { src: srcsets[srcsets.length - 1].slice(0, sliceLength) } + : {}; + + return { + ...srcObject, + format, + srcset, + }; + }) + ); + + const sizes = { + width: maxWidth, + height: Math.round(maxWidth / rest.aspect), + }; + + const fallback = await getFallbackImage( + src, + placeholder, + image, + fallbackFormat, + formatOptions, + rest + ); + + return { sources, sizes, fallback, imagesizes }; +} diff --git a/packages/imagetools/api/utils/getImgElement.js b/packages/imagetools/api/utils/getImgElement.js index fea4109..a119a5f 100644 --- a/packages/imagetools/api/utils/getImgElement.js +++ b/packages/imagetools/api/utils/getImgElement.js @@ -1,80 +1,80 @@ -// @ts-check - -import getAttributesString from "./getAttributesString.js"; - -export default function getImgElement({ - src, - alt, - sizes, - style, - srcset, - loading, - decoding, - imagesizes, - fadeInTransition, - layoutStyles, - imgAttributes, - imgClassName = "", -}) { - const { - class: customClasses = "", - style: customInlineStyles = "", - onload: customOnload = "", - ...restImgAttributes - } = imgAttributes; - - const attributesString = getAttributesString({ - attributes: restImgAttributes, - element: "img", - excludeArray: [ - "src", - "alt", - "srcset", - "sizes", - "width", - "height", - "loading", - "decoding", - ], - }); - - const classAttribute = ["astro-imagetools-img", imgClassName, customClasses] - .join(" ") - .trim(); - - const styleAttribute = [ - "display: inline-block; overflow: hidden; vertical-align: middle;", - customInlineStyles + (customInlineStyles.endsWith(";") ? "" : ";"), - layoutStyles, - ] - .join(" ") - .trim(); - - const onloadAttribute = [ - !imgClassName && style - ? fadeInTransition - ? `parentElement.style.setProperty('--z-index', 1); parentElement.style.setProperty('--opacity', 0);` - : `parentElement.style.backgroundImage = 'unset';` - : "", - customOnload, - ] - .join(" ") - .trim(); - - const imgElement = `==`; - - return imgElement; -} +// @ts-check +import getAttributesString from "./getAttributesString.js" +export default function getImgElement({ + src, + alt, + sizes, + style, + srcset, + loading, + decoding, + imagesizes, + fadeInTransition, + layoutStyles, + imgAttributes, + imgClassName = "", + uuid = "" +}) { + const { + class: customClasses = "", + style: customInlineStyles = "", + onload: customOnload = "", + ...restImgAttributes + } = imgAttributes; + + const attributesString = getAttributesString({ + attributes: restImgAttributes, + element: "img", + excludeArray: [ + "src", + "alt", + "srcset", + "sizes", + "width", + "height", + "loading", + "decoding", + ], + }); + + const classAttribute = ["imagetools-img", imgClassName, customClasses] + .join(" ") + .trim(); + + const styleAttribute = [ + "display: inline-block; overflow: hidden; vertical-align: middle;", + customInlineStyles + (customInlineStyles.endsWith(";") ? "" : ";"), + layoutStyles, + ] + .join(" ") + .trim(); + + const onloadAttribute = [ + !imgClassName && style + ? fadeInTransition + ? `parentElement.style.setProperty('--z-index', 1); parentElement.style.setProperty('--opacity', 0);` + : `parentElement.style.backgroundImage = 'unset';` + : "", + customOnload, + ] + .join(" ") + .trim(); + + const imgElement = `==`; + + return imgElement; +} diff --git a/packages/imagetools/api/utils/getLayoutStyles.js b/packages/imagetools/api/utils/getLayoutStyles.js index efa6d96..296c6d1 100644 --- a/packages/imagetools/api/utils/getLayoutStyles.js +++ b/packages/imagetools/api/utils/getLayoutStyles.js @@ -1,16 +1,9 @@ -// @ts-check - -export default function getLayoutStyles({ - layout = null, - isBackgroundImage = false, -}) { - return isBackgroundImage - ? "width: 100%; height: 100%;" - : layout === "fill" - ? `width: 100%; height: 100%;` - : layout === "fullWidth" - ? `width: 100%; height: auto;` - : layout === "fixed" - ? "" - : "max-width: 100%; height: auto;"; -} +// @ts-check + +export default function getLayoutStyles({ + layout = null, + isBackgroundImage = false, +}) { + return isBackgroundImage ? + "max-width: 100%; height: 100%;" : "" ; +} diff --git a/packages/imagetools/api/utils/getLinkElement.js b/packages/imagetools/api/utils/getLinkElement.js index 2fcfb7a..ad2a1aa 100644 --- a/packages/imagetools/api/utils/getLinkElement.js +++ b/packages/imagetools/api/utils/getLinkElement.js @@ -1,34 +1,34 @@ -// @ts-check -import getAttributesString from "./getAttributesString.js"; - -export default function getLinkElement({ - images = [], - preload = "", - imagesizes = "", - linkAttributes, -}) { - const imagesrcset = - preload && - images[images.length - 1]?.sources.find( - ({ format: fmt }) => fmt === preload - )?.srcset; - - const attributesString = getAttributesString({ - element: "link", - attributes: linkAttributes, - excludeArray: ["as", "rel", "imagesizes", "imagesrcset"], - }); - - const linkElement = - preload && images.length - ? `` - : ""; - - return linkElement; -} +// @ts-check +import getAttributesString from "./getAttributesString.js"; + +export default function getLinkElement({ + images = [], + preload = "", + imagesizes = "", + linkAttributes, +}) { + const imagesrcset = + preload && + images[images.length - 1]?.sources.find( + ({ format: fmt }) => fmt === preload + )?.srcset; + + const attributesString = getAttributesString({ + element: "link", + attributes: linkAttributes, + excludeArray: ["as", "rel", "imagesizes", "imagesrcset"], + }); + + const linkElement = + preload && images.length + ? `` + : ""; + + return linkElement; +} diff --git a/packages/imagetools/api/utils/getLinkElement.test.ts b/packages/imagetools/api/utils/getLinkElement.test.ts index 83d435a..ead19e4 100644 --- a/packages/imagetools/api/utils/getLinkElement.test.ts +++ b/packages/imagetools/api/utils/getLinkElement.test.ts @@ -1,14 +1,14 @@ -import { describe, expect, it } from "vitest"; -import getLinkElement from "./getLinkElement"; - -describe("getLinkElement", () => { - it("returns an empty string if preload is not set", () => { - const result = getLinkElement({ linkAttributes: {} }); - expect(result).toBe(""); - }); - - it("returns an empty string if no images are provided", () => { - const result = getLinkElement({ linkAttributes: {}, preload: "webp" }); - expect(result).toBe(""); - }); -}); +import { describe, expect, it } from "vitest"; +import getLinkElement from "./getLinkElement"; + +describe("getLinkElement", () => { + it("returns an empty string if preload is not set", () => { + const result = getLinkElement({ linkAttributes: {} }); + expect(result).toBe(""); + }); + + it("returns an empty string if no images are provided", () => { + const result = getLinkElement({ linkAttributes: {}, preload: "webp" }); + expect(result).toBe(""); + }); +}); diff --git a/packages/imagetools/api/utils/getPictureElement.js b/packages/imagetools/api/utils/getPictureElement.js index b0d62c3..ba18092 100644 --- a/packages/imagetools/api/utils/getPictureElement.js +++ b/packages/imagetools/api/utils/getPictureElement.js @@ -1,43 +1,43 @@ -// @ts-check -import getAttributesString from "./getAttributesString.js"; - -export default function getPictureElement({ - sources, - className, - layoutStyles, - pictureAttributes, - isBackgroundPicture = false, -}) { - const { - class: customClasses = "", - style: customInlineStyles = "", - ...restPictureAttributes - } = pictureAttributes; - - const attributesString = getAttributesString({ - attributes: restPictureAttributes, - }); - - const classAttribute = ["astro-imagetools-picture", className, customClasses] - .join(" ") - .trim(); - - const styleAttribute = [ - isBackgroundPicture - ? `position: absolute; z-index: 0; width: 100%; height: 100%; display: inline-block;` - : `position: relative; display: inline-block;`, - customInlineStyles + (customInlineStyles.endsWith(";") ? "" : ";"), - layoutStyles, - ] - .join(" ") - .trim(); - - const pictureElement = `${sources.join("\n")} - `; - - return pictureElement; -} +// @ts-check +import getAttributesString from "./getAttributesString.js"; + +export default function getPictureElement({ + sources, + className, + layoutStyles, + pictureAttributes, + isBackgroundPicture = false, +}) { + const { + class: customClasses = "", + style: customInlineStyles = "", + ...restPictureAttributes + } = pictureAttributes; + + const attributesString = getAttributesString({ + attributes: restPictureAttributes, + }); + + const classAttribute = ["imagetools-picture", className, customClasses] + .join(" ") + .trim(); + + const styleAttribute = [ + isBackgroundPicture + ? `position: absolute; z-index: 0; width: 100%; height: 100%; display: inline-block;` + : `position: relative; display: inline-block;`, + customInlineStyles + (customInlineStyles.endsWith(";") ? "" : ";"), + layoutStyles, + ] + .join(" ") + .trim(); + + const pictureElement = `${sources.join("\n")} + `; + + return pictureElement; +} diff --git a/packages/imagetools/api/utils/getProcessedImage.js b/packages/imagetools/api/utils/getProcessedImage.js index 98eae1d..ec6f619 100644 --- a/packages/imagetools/api/utils/getProcessedImage.js +++ b/packages/imagetools/api/utils/getProcessedImage.js @@ -1,63 +1,52 @@ -// @ts-check -import { fileURLToPath } from "node:url"; -import { extname, relative, resolve } from "node:path"; - -import { getSrcPath } from "./getSrcPath.js"; -import getResolvedSrc from "./getResolvedSrc.js"; -import { cwd, sharp } from "../../utils/runtimeChecks.js"; -import throwErrorIfUnsupported from "./throwErrorIfUnsupported.js"; - -const { getImageDetails } = await (sharp - ? import("./imagetools.js") - : import("./codecs.js")); - -export default async function getProcessedImage(src, transformConfigs) { - throwErrorIfUnsupported(src, extname(src).slice(1)); - - let base; - - if (src.match("(http://|https://|data:image/).*")) { - ({ src, base } = await getResolvedSrc(src)); - } else { - const { - default: { isSsrBuild }, - } = await import("../../astroViteConfigs.js"); - - if (isSsrBuild) { - const filename = fileURLToPath(import.meta.url); - - const assetPath = resolve(filename, "../../client") + src; - - src = "/" + relative(cwd, assetPath); - } - } - - const { - w, - h, - ar, - width = w, - height = h, - aspect = ar, - ...rest - } = transformConfigs; - - const path = src.replace(/\\/g, `/`); - - const { image, imageWidth, imageHeight, imageFormat } = await getImageDetails( - await getSrcPath(src), - width, - height, - aspect - ); - - return { - path, - base, - rest, - image, - imageWidth, - imageHeight, - imageFormat, - }; -} +import { fileURLToPath } from "node:url" +import { extname, relative, resolve } from "node:path" +import { getSrcPath } from "./getSrcPath.js" +import getResolvedSrc from "./getResolvedSrc.js" +import { cwd, sharp, fsCachePath } from "../../utils/runtimeChecks.js" +import throwErrorIfUnsupported from "./throwErrorIfUnsupported.js" +import { getImageDetails } from "./imagetools.js" + +export default async function getProcessedImage(src, transformConfigs) { + throwErrorIfUnsupported(src, extname(src).slice(1)); + let base; + if (src.match("(http://|https://|data:image/).*")) { + ({ src, base } = await getResolvedSrc(src)); + } else { + const { + default: { isSsrBuild }, + } = await import("../../astroViteConfigs.js"); + + if (isSsrBuild) { + const filename = fileURLToPath(import.meta.url); + const assetPath = resolve(filename, "../../client") + src; + src = "/" + relative(cwd, assetPath); + } + } + + const { + w, + h, + ar, + width = w, + height = h, + aspect = ar, + ...rest + } = transformConfigs + + const path = src.replace(/\\/g, `/`) + const { image, imageWidth, imageHeight, imageFormat } = await getImageDetails( + await getSrcPath(src), + width, + height, + aspect + ) + return { + path, + base, + rest, + image, + imageWidth, + imageHeight, + imageFormat, + } +} diff --git a/packages/imagetools/api/utils/getResolvedSrc.js b/packages/imagetools/api/utils/getResolvedSrc.js index 548a59c..befa7e3 100644 --- a/packages/imagetools/api/utils/getResolvedSrc.js +++ b/packages/imagetools/api/utils/getResolvedSrc.js @@ -1,87 +1,45 @@ -// @ts-check -import fs from "node:fs"; -import crypto from "node:crypto"; -import { join, parse, relative } from "node:path"; -import throwErrorIfUnsupported from "./throwErrorIfUnsupported.js"; -import { - cwd, - fsCachePath, - supportedImageTypes, -} from "../../utils/runtimeChecks.js"; - -const { fileTypeFromBuffer } = await import("file-type"); - -// Retry mechanism with exponential backoff -async function retryWithBackoff(fn, retries = 3, baseDelay = 150) { - for (let i = 0; i < retries; i++) { - try { - return await fn(); - } catch (error) { - if (i === retries - 1) { - throw error; // Last attempt failed - } - - // Check if it's a file system error that we should retry - const isRetryableError = error.code === 'EBUSY' || - error.code === 'ENOENT' || - error.code === 'EPERM' || - error.errno === -4094 || // UNKNOWN error on Windows - error.message.includes('UNKNOWN: unknown error'); - - if (!isRetryableError) { - throw error; // Don't retry non-transient errors - } - - const delay = baseDelay * Math.pow(2, i); // Exponential backoff - console.warn(`Retry attempt ${i + 1}/${retries} for file operation after ${delay}ms delay:`, error.message); - await new Promise(resolve => setTimeout(resolve, delay)); - } - } -} - -export default async function getResolvedSrc(src) { - const token = crypto.createHash("md5").update(src).digest("hex"); - let filepath = fsCachePath + token; - - const fileExists = await retryWithBackoff(() => { - for (const type of supportedImageTypes) { - const fileExists = fs.existsSync(filepath + `.${type}`); - - if (fileExists) { - filepath += `.${type}`; - return true; - } - } - return false; - }); - - if (!fileExists) { - const buffer = Buffer.from(await (await fetch(src)).arrayBuffer()); - - const { ext } = (await fileTypeFromBuffer(buffer)) || {}; - - throwErrorIfUnsupported(src, ext); - - filepath += `.${ext}`; - - // Use retry mechanism for file write operations - await retryWithBackoff(() => { - return new Promise((resolve, reject) => { - try { - fs.writeFileSync(filepath, buffer); - resolve(undefined); - } catch (error) { - reject(error); - } - }); - }); - } - - const base = /^https?:/.test(src) - ? parse(new URL(src).pathname).name - : undefined; - - src = join("/", relative(cwd, filepath)); - - return { src, base }; -} +// @ts-check +import fs from "node:fs"; +import crypto from "node:crypto"; +import { join, parse, relative } from "node:path"; +import throwErrorIfUnsupported from "./throwErrorIfUnsupported.js"; +import { + cwd, + fsCachePath, + supportedImageTypes, +} from "../../utils/runtimeChecks.js"; + +const { fileTypeFromBuffer } = await import("file-type"); + +export default async function getResolvedSrc(src) { + // const token = crypto.createHash("md5").update(src).digest("hex"); + const token = crypto.randomBytes(4).toString("hex").toUpperCase() + + let filepath = fsCachePath + token; + + const fileExists = (() => { + for (const type of supportedImageTypes) { + const fileExists = fs.existsSync(filepath + `.${type}`); + + if (fileExists) { + filepath += `.${type}`; + + return true; + } + } + })(); + + if (!fileExists) { + const buffer = Buffer.from(await (await fetch(src)).arrayBuffer()) + const { ext } = (await fileTypeFromBuffer(buffer)) || {} + throwErrorIfUnsupported(src, ext) + filepath += `.${ext}` + fs.writeFileSync(filepath, buffer) + } + + const base = /^https?:/.test(src) + ? parse(new URL(src).pathname).name + : undefined + //src = join("/", relative(cwd, filepath)) + return { src: filepath, base } +} diff --git a/packages/imagetools/api/utils/getSrcPath.js b/packages/imagetools/api/utils/getSrcPath.js index 3a7a7da..8878956 100644 --- a/packages/imagetools/api/utils/getSrcPath.js +++ b/packages/imagetools/api/utils/getSrcPath.js @@ -1,32 +1,32 @@ -import fs from "node:fs"; -import path from "node:path"; - -// To strip off params when checking for file on disk. -const paramPattern = /\?.*/; - -/** - * getSrcPath allows the use of `src` attributes relative to either the public folder or project root. - * - * It first checks to see if the src is a file relative to the project root. - * If the file isn't found, it will look in the public folder. - * Finally, if it still can't be found, the original input will be returned. - */ -export async function getSrcPath(src) { - const { default: astroViteConfigs } = await import( - "../../astroViteConfigs.js" - ); - - // If this is already resolved to a file, return it. - if (fs.existsSync(src.replace(paramPattern, ""))) return src; - - const rootPath = path.join(astroViteConfigs.rootDir, src); - const rootTest = rootPath.replace(paramPattern, ""); - if (fs.existsSync(rootTest)) return rootPath; - - const publicPath = path.join(astroViteConfigs.publicDir, src); - const publicTest = publicPath.replace(paramPattern, ""); - if (fs.existsSync(publicTest)) return publicPath; - - // Fallback - return src; -} +import fs from "node:fs"; +import path from "node:path"; + +// To strip off params when checking for file on disk. +const paramPattern = /\?.*/; + +/** + * getSrcPath allows the use of `src` attributes relative to either the public folder or project root. + * + * It first checks to see if the src is a file relative to the project root. + * If the file isn't found, it will look in the public folder. + * Finally, if it still can't be found, the original input will be returned. + */ +export async function getSrcPath(src) { + const { default: astroViteConfigs } = await import( + "../../astroViteConfigs.js" + ); + + // If this is already resolved to a file, return it. + if (fs.existsSync(src.replace(paramPattern, ""))) return src; + + const rootPath = path.join(astroViteConfigs.rootDir, src); + const rootTest = rootPath.replace(paramPattern, ""); + if (fs.existsSync(rootTest)) return rootPath; + + const publicPath = path.join(astroViteConfigs.publicDir, src); + const publicTest = publicPath.replace(paramPattern, ""); + if (fs.existsSync(publicTest)) return publicPath; + + // Fallback + return src; +} diff --git a/packages/imagetools/api/utils/getSrcPath.test.ts b/packages/imagetools/api/utils/getSrcPath.test.ts index bb267dd..0dec2ce 100644 --- a/packages/imagetools/api/utils/getSrcPath.test.ts +++ b/packages/imagetools/api/utils/getSrcPath.test.ts @@ -1,67 +1,67 @@ -import path from "node:path"; -import { describe, expect, it, afterAll, vi } from "vitest"; -import { getSrcPath } from "./getSrcPath"; - -vi.mock("../../astroViteConfigs.js", () => { - return { - default: { - rootDir: buildPath(), - // Custom publicDir - publicDir: buildPath("out"), - }, - }; -}); - -/** - * Build an absolute path to the target in the fixture directory - */ -function buildPath(target = "") { - return path.resolve(__dirname, "../../test-fixtures/getSrcPath", target); -} - -describe("getLinkElement", () => { - afterAll(() => { - vi.unmock("../../astroViteConfigs.js"); - }); - - it("finds a file in the root of the project", async () => { - const result = await getSrcPath("root.jpeg"); - expect(result).toBe(buildPath("root.jpeg")); - }); - - it("finds a file in the public folder", async () => { - const result = await getSrcPath("out.jpeg"); - expect(result).toBe(buildPath("out/out.jpeg")); - }); - - it("returns an absolute path unchanged, if it exists", async () => { - const result = await getSrcPath(buildPath("out/out.jpeg")); - expect(result).toBe(buildPath("out/out.jpeg")); - }); - - it("handles query parameters", async () => { - const result = await getSrcPath("root.jpeg?w=200"); - expect(result).toBe(buildPath("root.jpeg?w=200")); - }); - - it("handles query parameters for public-resolved files", async () => { - const result = await getSrcPath("out.jpeg?w=200"); - expect(result).toBe(buildPath("out/out.jpeg?w=200")); - }); - - it("returns the original input if the file is not found", async () => { - const result = await getSrcPath( - "https://cdn.nedis.com/images/products_high_res/TVRC2080BK_P30.JPG" - ); - expect(result).toBe( - "https://cdn.nedis.com/images/products_high_res/TVRC2080BK_P30.JPG" - ); - }); - - it("finds relative paths correctly", async () => { - const outResult = await getSrcPath("./out/out.jpeg"); - const rootResult = await getSrcPath("./root.jpeg"); - expect(outResult).toBe(buildPath("out/out.jpeg")); - expect(rootResult).toBe(buildPath("root.jpeg")); - }); -}); +import path from "node:path"; +import { describe, expect, it, afterAll, vi } from "vitest"; +import { getSrcPath } from "./getSrcPath"; + +vi.mock("../../astroViteConfigs.js", () => { + return { + default: { + rootDir: buildPath(), + // Custom publicDir + publicDir: buildPath("out"), + }, + }; +}); + +/** + * Build an absolute path to the target in the fixture directory + */ +function buildPath(target = "") { + return path.resolve(__dirname, "../../test-fixtures/getSrcPath", target); +} + +describe("getLinkElement", () => { + afterAll(() => { + vi.unmock("../../astroViteConfigs.js"); + }); + + it("finds a file in the root of the project", async () => { + const result = await getSrcPath("root.jpeg"); + expect(result).toBe(buildPath("root.jpeg")); + }); + + it("finds a file in the public folder", async () => { + const result = await getSrcPath("out.jpeg"); + expect(result).toBe(buildPath("out/out.jpeg")); + }); + + it("returns an absolute path unchanged, if it exists", async () => { + const result = await getSrcPath(buildPath("out/out.jpeg")); + expect(result).toBe(buildPath("out/out.jpeg")); + }); + + it("handles query parameters", async () => { + const result = await getSrcPath("root.jpeg?w=200"); + expect(result).toBe(buildPath("root.jpeg?w=200")); + }); + + it("handles query parameters for public-resolved files", async () => { + const result = await getSrcPath("out.jpeg?w=200"); + expect(result).toBe(buildPath("out/out.jpeg?w=200")); + }); + + it("returns the original input if the file is not found", async () => { + const result = await getSrcPath( + "https://cdn.nedis.com/images/products_high_res/TVRC2080BK_P30.JPG" + ); + expect(result).toBe( + "https://cdn.nedis.com/images/products_high_res/TVRC2080BK_P30.JPG" + ); + }); + + it("finds relative paths correctly", async () => { + const outResult = await getSrcPath("./out/out.jpeg"); + const rootResult = await getSrcPath("./root.jpeg"); + expect(outResult).toBe(buildPath("out/out.jpeg")); + expect(rootResult).toBe(buildPath("root.jpeg")); + }); +}); diff --git a/packages/imagetools/api/utils/getSrcset.js b/packages/imagetools/api/utils/getSrcset.js index ac290a9..6bc3991 100644 --- a/packages/imagetools/api/utils/getSrcset.js +++ b/packages/imagetools/api/utils/getSrcset.js @@ -1,45 +1,39 @@ -// @ts-check -import { getSrcPath } from "./getSrcPath.js"; - -export default async function getSrcset( - src, - base, - breakpoints, - format, - options -) { - options = { - format, - w: breakpoints, - ...options, - }; - - const keys = Object.keys(options); - - const params = keys.length - ? keys - .map((key) => - Array.isArray(options[key]) - ? `&${key}=${options[key].join(";")}` - : `&${key}=${options[key]}` - ) - .join("") - : ""; - - const id = `${src}?${params.slice(1)}`; - - const fullPath = await getSrcPath(id); - - const { default: load } = await import("../../plugin/hooks/load.js"); - - let srcset = null - - try { - srcset = (await load(fullPath, base))?.slice(16, -1); - } catch (error) { - console.error(`Error loading image from ${fullPath}:`, error); - srcset = ''; - } - - return srcset; -} +// @ts-check +import { getSrcPath } from "./getSrcPath.js"; + +export default async function getSrcset( + src, + base, + breakpoints, + format, + options +) { + options = { + format, + w: breakpoints, + ...options, + }; + + const keys = Object.keys(options); + + const params = keys.length + ? keys + .map((key) => + Array.isArray(options[key]) + ? `&${key}=${options[key].join(";")}` + : `&${key}=${options[key]}` + ) + .join("") + : ""; + + const id = `${src}?${params.slice(1)}`; + + const fullPath = await getSrcPath(id); + + const { default: load } = await import("../../plugin/hooks/load.js"); + + // @ts-ignore + const srcset = (await load(fullPath, base)).slice(16, -1); + + return srcset; +} diff --git a/packages/imagetools/api/utils/getStyleElement.js b/packages/imagetools/api/utils/getStyleElement.js index 30ad4d7..1c1c19c 100644 --- a/packages/imagetools/api/utils/getStyleElement.js +++ b/packages/imagetools/api/utils/getStyleElement.js @@ -1,15 +1,15 @@ -// @ts-check -import getAttributesString from "./getAttributesString.js"; - -export default function getStyleElement({ - styleAttributes, - backgroundStyles = "", -}) { - const attributesString = getAttributesString({ - attributes: styleAttributes, - }); - - const styleElement = ``; - - return styleElement; -} +// @ts-check +import getAttributesString from "./getAttributesString.js"; + +export default function getStyleElement({ + styleAttributes, + backgroundStyles = "", +}) { + const attributesString = getAttributesString({ + attributes: styleAttributes, + }); + + const styleElement = ``; + + return styleElement; +} diff --git a/packages/imagetools/api/utils/imagetools.js b/packages/imagetools/api/utils/imagetools.js index 530abd1..c3d89c3 100644 --- a/packages/imagetools/api/utils/imagetools.js +++ b/packages/imagetools/api/utils/imagetools.js @@ -1,40 +1,41 @@ -// @ts-check -import { - builtins, - loadImage, - applyTransforms, - generateTransforms, -} from "imagetools-core"; -export { - loadImage -} from "imagetools-core"; -export async function getImageDetails(path, width, height, aspect) { - const loadedImage = loadImage(path); - - if (aspect && !width && !height) { - if (!width && !height) { - ({ width } = await loadedImage.metadata()); - } - - if (width) { - height = width / aspect; - } - - if (height) { - width = height * aspect; - } - } - - const { image, metadata } = await applyTransforms( - generateTransforms({ width, height }, builtins).transforms, - loadedImage - ); - - const { - width: imageWidth, - height: imageHeight, - format: imageFormat, - } = metadata; - - return { image, imageWidth, imageHeight, imageFormat }; -} +// @ts-check +import { + builtins, + loadImage, + applyTransforms, + generateTransforms, +} from "imagetools-core"; + +export { + loadImage +} from "imagetools-core"; + +export async function getImageDetails(path, width, height, aspect) { + const loadedImage = loadImage(path) + if (aspect && !width && !height) { + if (!width && !height) { + ({ width } = await loadedImage.metadata()); + } + + if (width) { + height = width / aspect; + } + + if (height) { + width = height * aspect; + } + } + + const { image, metadata } = await applyTransforms( + generateTransforms({ width, height }, builtins).transforms, + loadedImage + ); + + const { + width: imageWidth, + height: imageHeight, + format: imageFormat, + } = metadata; + + return { image, imageWidth, imageHeight, imageFormat }; +} diff --git a/packages/imagetools/api/utils/throwErrorIfUnsupported.js b/packages/imagetools/api/utils/throwErrorIfUnsupported.js index 581ca16..730f47e 100644 --- a/packages/imagetools/api/utils/throwErrorIfUnsupported.js +++ b/packages/imagetools/api/utils/throwErrorIfUnsupported.js @@ -1,14 +1,14 @@ -// @ts-check -import { supportedImageTypes } from "../../utils/runtimeChecks.js"; - -export default function throwErrorIfUnsupported(src, ext) { - if (!ext && typeof ext !== "string") { - throw new Error(`Failed to load ${src}; Invalid image format`); - } - - if (ext && !supportedImageTypes.includes(ext.toLowerCase())) { - throw new Error( - `Failed to load ${src}; Invalid image format ${ext} or the format is not supported by astro-imagetools` - ); - } -} +// @ts-check +import { supportedImageTypes } from "../../utils/runtimeChecks.js"; + +export default function throwErrorIfUnsupported(src, ext) { + if (!ext && typeof ext !== "string") { + throw new Error(`Failed to load ${src}; Invalid image format`); + } + + if (ext && !supportedImageTypes.includes(ext.toLowerCase())) { + throw new Error( + `Failed to load ${src}; Invalid image format ${ext} or the format is not supported by astro-imagetools` + ); + } +} diff --git a/packages/imagetools/components/BackgroundImage.astro b/packages/imagetools/components/BackgroundImage.astro index 47d2b44..9ae417a 100644 --- a/packages/imagetools/components/BackgroundImage.astro +++ b/packages/imagetools/components/BackgroundImage.astro @@ -1,46 +1,46 @@ ---- -import renderBackgroundImage from "../api/renderBackgroundImage.js"; -import type { BackgroundImageConfigOptions } from "../types.d"; - -const content = await Astro.slots.render("default"); - -declare interface Props - extends Pick< - BackgroundImageConfigOptions, - Exclude - > {} - -const { link, style, htmlElement } = await renderBackgroundImage({ - content, - ...(Astro.props as Props), -}); ---- - - - - +--- +import renderBackgroundImage from "../api/renderBackgroundImage.js"; +import type { BackgroundImageConfigOptions } from "../types.d"; + +const content = await Astro.slots.render("default"); + +declare interface Props + extends Pick< + BackgroundImageConfigOptions, + Exclude + > {} + +const { link, style, htmlElement } = await renderBackgroundImage({ + content, + ...(Astro.props as Props), +}); +--- + + + + diff --git a/packages/imagetools/components/BackgroundPicture.astro b/packages/imagetools/components/BackgroundPicture.astro index a53bab8..0919dcb 100644 --- a/packages/imagetools/components/BackgroundPicture.astro +++ b/packages/imagetools/components/BackgroundPicture.astro @@ -1,19 +1,19 @@ ---- -import renderBackgroundPicture from "../api/renderBackgroundPicture.js"; -import { BackgroundPictureConfigOptions } from "../types.d"; - -declare interface Props - extends Pick< - BackgroundPictureConfigOptions, - Exclude - > {} - -const content = await Astro.slots.render("default"); - -const { link, style, htmlElement } = await renderBackgroundPicture({ - content, - ...(Astro.props as Props), -}); ---- - - +--- +import renderBackgroundPicture from "../api/renderBackgroundPicture.js"; +import { BackgroundPictureConfigOptions } from "../types.d"; + +declare interface Props + extends Pick< + BackgroundPictureConfigOptions, + Exclude + > {} + +const content = await Astro.slots.render("default"); + +const { link, style, htmlElement } = await renderBackgroundPicture({ + content, + ...(Astro.props as Props), +}); +--- + + diff --git a/packages/imagetools/components/Image.astro b/packages/imagetools/components/Image.astro index d2d547a..28eda36 100644 --- a/packages/imagetools/components/Image.astro +++ b/packages/imagetools/components/Image.astro @@ -1,10 +1,8 @@ ---- -import renderImage from "../api/renderImage.js"; -import type { PictureConfigOptions as ImageConfigOptions } from "../types.d"; - -const { link, style, image } = await renderImage( - Astro.props as ImageConfigOptions -); ---- - - +--- +import renderImage from "../api/renderImg.js" +import type { PictureConfigOptions as ImageConfigOptions } from "../types.d" +const { link, style, image } = await renderImage( + Astro.props as ImageConfigOptions +) +--- + diff --git a/packages/imagetools/components/ImageSupportDetection.astro b/packages/imagetools/components/ImageSupportDetection.astro index 9e62ae7..2ddddf8 100644 --- a/packages/imagetools/components/ImageSupportDetection.astro +++ b/packages/imagetools/components/ImageSupportDetection.astro @@ -1,4 +1,4 @@ - - + + diff --git a/packages/imagetools/components/Img.astro b/packages/imagetools/components/Img.astro index 4f3198d..21e573c 100644 --- a/packages/imagetools/components/Img.astro +++ b/packages/imagetools/components/Img.astro @@ -1,7 +1,10 @@ ---- -import renderImg from "../api/renderImg.js" -import type { ImgConfigOptions } from "../types.d" -declare interface Props extends ImgConfigOptions {} -const { link, style, img } = await renderImg(Astro.props as Props) ---- - +--- +import renderImg from "../api/renderImg.js"; +import type { ImgConfigOptions } from "../types.d"; + +declare interface Props extends ImgConfigOptions {} + +const { link, style, img } = await renderImg(Astro.props as Props); +--- + + diff --git a/packages/imagetools/components/Picture.astro b/packages/imagetools/components/Picture.astro index 737bd77..54f2e09 100644 --- a/packages/imagetools/components/Picture.astro +++ b/packages/imagetools/components/Picture.astro @@ -1,10 +1,7 @@ ---- -import renderPicture from "../api/renderPicture.js"; -import type { PictureConfigOptions } from "../types.d"; - -declare interface Props extends PictureConfigOptions {} - -const { link, style, picture } = await renderPicture(Astro.props as Props); ---- - - +--- +import renderPicture from "../api/renderPicture.js" +import type { PictureConfigOptions } from "../types.d" +declare interface Props extends PictureConfigOptions {} +const { link, style, picture } = await renderPicture(Astro.props as Props) +--- + diff --git a/packages/imagetools/components/index.js b/packages/imagetools/components/index.js index a6c6389..e639c8f 100644 --- a/packages/imagetools/components/index.js +++ b/packages/imagetools/components/index.js @@ -1,5 +1,5 @@ -export { default as Img } from "./Img.astro"; -export { default as Picture } from "./Picture.astro"; -export { default as BackgroundImage } from "./BackgroundImage.astro"; -export { default as BackgroundPicture } from "./BackgroundPicture.astro"; -export { default as ImageSupportDetection } from "./ImageSupportDetection.astro"; +export { default as Img } from "./Img.astro"; +export { default as Picture } from "./Picture.astro"; +export { default as BackgroundImage } from "./BackgroundImage.astro"; +export { default as BackgroundPicture } from "./BackgroundPicture.astro"; +export { default as ImageSupportDetection } from "./ImageSupportDetection.astro"; diff --git a/packages/imagetools/config.d.ts b/packages/imagetools/config.d.ts index 8569ca9..77d6b73 100644 --- a/packages/imagetools/config.d.ts +++ b/packages/imagetools/config.d.ts @@ -1,3 +1,3 @@ -import type { GlobalConfigOptions } from "./types"; - -export function defineConfig(config: GlobalConfigOptions): GlobalConfigOptions; +import type { GlobalConfigOptions } from "./types"; + +export function defineConfig(config: GlobalConfigOptions): GlobalConfigOptions; diff --git a/packages/imagetools/config.mjs b/packages/imagetools/config.mjs index 64a4c49..0059b4a 100644 --- a/packages/imagetools/config.mjs +++ b/packages/imagetools/config.mjs @@ -1,3 +1,3 @@ -export function defineConfig(config) { - return config; -} +export function defineConfig(config) { + return config; +} diff --git a/packages/imagetools/index.js b/packages/imagetools/index.js index b5e1b78..44b179a 100644 --- a/packages/imagetools/index.js +++ b/packages/imagetools/index.js @@ -1,3 +1,2 @@ -import astroImageTools from "./integration/index.js"; - -export { astroImageTools as imagetools } +import imagetools from "./integration/index.js" +export { imagetools } diff --git a/packages/imagetools/integration/index.js b/packages/imagetools/integration/index.js index 3a22fe3..ecf601e 100644 --- a/packages/imagetools/integration/index.js +++ b/packages/imagetools/integration/index.js @@ -1,116 +1,79 @@ -// @ts-check -import fs from "node:fs" -import { fileURLToPath } from "node:url" -import { posix as path, resolve } from "node:path" -import { saveAndCopyAsset } from "./utils/saveAndCopyAsset.js" -import vitePluginAstroImageTools, { store } from "../plugin/index.js" -import pMap from "p-map" - -const filename = fileURLToPath(import.meta.url); -const astroViteConfigsPath = resolve(filename, "../../astroViteConfigs.js"); - -export default { - name: "imagetools", - hooks: { - "astro:config:setup": async function ({ config, command, updateConfig }) { - const environment = command; - const isSsrBuild = - command === "build" && !!config.adapter && config.output === "server"; - - let projectBase = path.normalize(config.base); - if (projectBase.startsWith("./")) projectBase = projectBase.slice(1); - if (!projectBase.startsWith("/")) projectBase = "/" + projectBase; - if (projectBase.endsWith("/")) projectBase = projectBase.slice(0, -1); - - const astroViteConfigs = { - environment, - isSsrBuild, - projectBase, - publicDir: fileURLToPath(config.publicDir.href), - rootDir: fileURLToPath(config.root.href), - }; - - await fs.promises.writeFile( - astroViteConfigsPath, - `export default ${JSON.stringify(astroViteConfigs)}` - ); - - updateConfig({ - vite: { - plugins: [vitePluginAstroImageTools], - }, - }); - }, - - "astro:build:done": async function closeBundle() { - const { default: astroViteConfigs } = await import( - "../astroViteConfigs.js" - ); - const { mode, outDir, assetsDir, isSsrBuild } = astroViteConfigs; - if (mode === "build") { - const allEntries = [...store.entries()]; - const assetPaths = allEntries.filter( - ([, { hash = null } = {}]) => hash - ); - await pMap( - assetPaths, - async ([assetPath, { hash, image, buffer }]) => { - // Retry mechanism with exponential backoff for image processing - /* - const retryWithBackoff = async (fn, retries = 3, baseDelay = 10) => { - for (let i = 0; i < retries; i++) { - try { - return await fn(); - } catch (error) { - if (i === retries - 1) { - throw error; // Last attempt failed - } - - // Check if it's a vips/sharp related error that we should retry - const isRetryableError = error.message.includes('vips') || - error.message.includes('sharp') || - error.message.includes('UNKNOWN: unknown error') || - error.code === 'EBUSY' || - error.code === 'ENOENT' || - error.errno === -4094; - - if (!isRetryableError) { - throw error; // Don't retry non-transient errors - } - - const delay = baseDelay * Math.pow(2, i); // Exponential backoff - console.warn(`Retry attempt ${i + 1}/${retries} for image ${assetPath} after ${delay}ms delay:`, error.message); - await new Promise(resolve => setTimeout(resolve, delay)); - } - } - }; - */ - - try { - // await retryWithBackoff(async () => { - console.log(`[imagetools] Saving and copying asset ${assetPath}`); - await saveAndCopyAsset( - hash, - image, - buffer, - outDir, - assetsDir, - assetPath, - isSsrBuild - ); - - console.log(`[imagetools] Saved and copied asset ${assetPath}`); - - // }); - } catch (error) { - console.error(`Failed to process image ${assetPath} after retries:`, error); - // Continue processing other images even if one fails - } - }, - // higher concurrency causes sharp/vips errors as well - { concurrency: 1 } - ); - } - }, - }, -}; +// @ts-check +import fs from "node:fs"; +import { fileURLToPath } from "node:url"; +import { posix as path, resolve } from "node:path"; +import { saveAndCopyAsset } from "./utils/saveAndCopyAsset.js"; +import vitePluginAstroImageTools, { store } from "../plugin/index.js"; + +const filename = fileURLToPath(import.meta.url); +const astroViteConfigsPath = resolve(filename, "../../astroViteConfigs.js"); + +export default { + name: "imagetools", + hooks: { + "astro:config:setup": async function ({ config, command, updateConfig }) { + const environment = command; + const isSsrBuild = + command === "build" && !!config.adapter && config.output === "server"; + + let projectBase = path.normalize(config.base); + + if (projectBase.startsWith("./")) projectBase = projectBase.slice(1); + + if (!projectBase.startsWith("/")) projectBase = "/" + projectBase; + + if (projectBase.endsWith("/")) projectBase = projectBase.slice(0, -1); + + const astroViteConfigs = { + environment, + isSsrBuild, + projectBase, + publicDir: fileURLToPath(config.publicDir.href), + rootDir: fileURLToPath(config.root.href), + }; + + await fs.promises.writeFile( + astroViteConfigsPath, + `export default ${JSON.stringify(astroViteConfigs)}` + ); + + updateConfig({ + vite: { + plugins: [vitePluginAstroImageTools], + }, + }); + }, + + "astro:build:done": async function closeBundle() { + const { default: astroViteConfigs } = await import( + // @ts-ignore + "../astroViteConfigs.js" + ); + + const { mode, outDir, assetsDir, isSsrBuild } = astroViteConfigs; + + if (mode === "production") { + const allEntries = [...store.entries()]; + + const assetPaths = allEntries.filter( + ([, { hash = null } = {}]) => hash + ); + + await Promise.all( + assetPaths.map( + async ([assetPath, { hash, image, buffer }]) => + await saveAndCopyAsset( + hash, + image, + buffer, + outDir, + assetsDir, + assetPath, + isSsrBuild + ) + ) + ); + } + }, + }, +}; diff --git a/packages/imagetools/integration/utils/saveAndCopyAsset.js b/packages/imagetools/integration/utils/saveAndCopyAsset.js index f075377..a4d9a74 100644 --- a/packages/imagetools/integration/utils/saveAndCopyAsset.js +++ b/packages/imagetools/integration/utils/saveAndCopyAsset.js @@ -1,46 +1,46 @@ -import fs from "node:fs/promises"; -import { posix as path } from "node:path"; -import { fsCachePath } from "../../utils/runtimeChecks.js"; - -const copied = []; -let assetsDirExists; - -export async function saveAndCopyAsset( - hash, - image, - buffer, - outDir, - assetsDir, - assetPath, - isSsrBuild -) { - const src = fsCachePath + hash; - - const dest = path.join(outDir, isSsrBuild ? "/client" : "", assetPath); - - assetsDir = path.join(outDir, isSsrBuild ? "/client" : "/", assetsDir); - - if (copied.includes(assetPath)) return; - - if (!assetsDirExists) { - await fs.mkdir(assetsDir, { - recursive: true, - }); - - assetsDirExists = true; - } - - await fs.copyFile(src, dest).catch(async (error) => { - if (error.code === "ENOENT") { - const imageBuffer = buffer || (await image.toBuffer()); - - await Promise.all( - [src, dest].map(async (dir) => { - await fs.writeFile(dir, imageBuffer); - }) - ); - } else throw error; - }); - - copied.push(assetPath); -} +import fs from "node:fs/promises"; +import { posix as path } from "node:path"; +import { fsCachePath } from "../../utils/runtimeChecks.js"; + +const copied = []; +let assetsDirExists; + +export async function saveAndCopyAsset( + hash, + image, + buffer, + outDir, + assetsDir, + assetPath, + isSsrBuild +) { + const src = fsCachePath + hash; + + const dest = path.join(outDir, isSsrBuild ? "/client" : "", assetPath); + + assetsDir = path.join(outDir, isSsrBuild ? "/client" : "/", assetsDir); + + if (copied.includes(assetPath)) return; + + if (!assetsDirExists) { + await fs.mkdir(assetsDir, { + recursive: true, + }); + + assetsDirExists = true; + } + + await fs.copyFile(src, dest).catch(async (error) => { + if (error.code === "ENOENT") { + const imageBuffer = buffer || (await image.toBuffer()); + + await Promise.all( + [src, dest].map(async (dir) => { + await fs.writeFile(dir, imageBuffer); + }) + ); + } else throw error; + }); + + copied.push(assetPath); +} diff --git a/packages/imagetools/package-lock.json b/packages/imagetools/package-lock.json new file mode 100644 index 0000000..0897b85 --- /dev/null +++ b/packages/imagetools/package-lock.json @@ -0,0 +1,8838 @@ +{ + "name": "imagetools", + "version": "0.9.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "imagetools", + "version": "0.9.0", + "license": "MIT", + "dependencies": { + "@astropub/codecs": "0.4.4", + "@polymech/cache": "file:../../../polymech-mono/packages/cache", + "@polymech/commons": "file:../../../polymech-mono/packages/commons", + "@polymech/fs": "file:../../../polymech-mono/packages/fs", + "@polymech/log": "file:../../../polymech-mono/packages/log", + "file-type": "17.1.1", + "find-cache-dir": "3.3.2", + "find-up": "^6.3.0", + "node-addon-api": "^8.3.0", + "node-gyp": "^11.1.0", + "object-hash": "3.0.0", + "potrace": "2.1.8", + "sharp": "^0.33.5" + }, + "devDependencies": { + "vitest": "^0.12.4" + }, + "engines": { + "node": "^14.15.0 || >=16.0.0" + }, + "optionalDependencies": { + "imagetools-core": "3.0.2" + }, + "peerDependencies": { + "astro": ">=0.26 || >=1.0.0-beta" + } + }, + "../../../polymech-mono/packages/cache": { + "name": "@polymech/cache", + "version": "0.4.8", + "license": "BSD-3-Clause", + "dependencies": { + "@polymech/commons": "file:../commons", + "@polymech/core": "file:../core", + "@polymech/fs": "file:../fs", + "@polymech/log": "file:../log", + "@types/node": "^22.10.2", + "cacache": "^19.0.1", + "md5": "^2.3.0", + "p-map": "^7.0.3", + "ssri": "^10.0.1", + "yargs": "^17.7.2" + }, + "engines": { + "node": ">= 14.0.0" + } + }, + "../../../polymech-mono/packages/commons": { + "name": "@polymech/commons", + "version": "0.2.6", + "license": "BSD", + "dependencies": { + "@polymech/core": "file:../core", + "@polymech/fs": "file:../fs", + "@repo/typescript-config": "file:../typescript-config", + "@schemastore/package": "^0.0.10", + "env-var": "^7.5.0", + "glob": "^10.4.5", + "js-yaml": "^4.1.0", + "jsonpath-plus": "^10.3.0", + "normalize-url": "^8.0.1", + "p-map": "^7.0.3", + "p-throttle": "^4.1.1", + "regedit": "^5.1.4", + "tslog": "^3.3.3", + "tsup": "^2.0.3", + "yargs": "^17.7.2", + "zod": "^3.24.3", + "zod-to-json-schema": "^3.24.5", + "zod-to-ts": "^1.2.0" + }, + "bin": { + "pm-cli": "dist/main.js" + }, + "devDependencies": { + "@types/node": "^22.12.0", + "typescript": "^5.7.3" + } + }, + "../../../polymech-mono/packages/fs": { + "name": "@polymech/fs", + "version": "0.13.41", + "license": "BSD-3-Clause", + "dependencies": { + "@polymech/core": "file:../core", + "@repo/typescript-config": "file:../typescript-config", + "denodeify": "^1.2.1", + "glob": "^10.4.1", + "mime": "^2.0.3", + "minimatch": "^10.0.1", + "mkdirp": "^3.0.1", + "q": "^1.4.1", + "rimraf": "^6.0.1", + "write-file-atomic": "^6.0.0", + "yargs": "^17.7.2" + }, + "devDependencies": { + "@types/denodeify": "^1.2.31", + "@types/mime": "^2.0.0", + "@types/node": "^22.10.2", + "fs-extra": "^4.0.2", + "globals": "^15.14.0", + "ts-node": "^10.9.1", + "typescript": "^5.7.2" + }, + "engines": { + "node": ">= 8.0.0" + } + }, + "../../../polymech-mono/packages/log": { + "name": "@polymech/log", + "version": "0.2.6", + "license": "BSD", + "dependencies": { + "@polymech/core": "file:../core", + "@repo/typescript-config": "file:../typescript-config", + "tslog": "^3.3.3", + "tsup": "^8.3.5", + "zod": "^3.24.1" + }, + "devDependencies": { + "@eslint/js": "^9.18.0", + "@types/node": "^22.10.9", + "eslint": "^8.57.1", + "eslint-plugin-import": "^2.31.0", + "eslint-plugin-regexp": "^2.7.0", + "ts-node": "^10.9.1", + "typescript": "^4.9.5", + "typescript-eslint": "^8.20.0" + } + }, + "node_modules/@astrojs/compiler": { + "version": "2.10.4", + "resolved": "https://registry.npmjs.org/@astrojs/compiler/-/compiler-2.10.4.tgz", + "integrity": "sha512-86B3QGagP99MvSNwuJGiYSBHnh8nLvm2Q1IFI15wIUJJsPeQTO3eb2uwBmrqRsXykeR/mBzH8XCgz5AAt1BJrQ==", + "license": "MIT", + "peer": true + }, + "node_modules/@astrojs/internal-helpers": { + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/@astrojs/internal-helpers/-/internal-helpers-0.5.1.tgz", + "integrity": "sha512-M7rAge1n2+aOSxNvKUFa0u/KFn0W+sZy7EW91KOSERotm2Ti8qs+1K0xx3zbOxtAVrmJb5/J98eohVvvEqtNkw==", + "license": "MIT", + "peer": true + }, + "node_modules/@astrojs/markdown-remark": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/@astrojs/markdown-remark/-/markdown-remark-6.1.0.tgz", + "integrity": "sha512-emZNNSTPGgPc3V399Cazpp5+snogjaF04ocOSQn9vy3Kw/eIC4vTQjXOrWDEoSEy+AwPDZX9bQ4wd3bxhpmGgQ==", + "license": "MIT", + "peer": true, + "dependencies": { + "@astrojs/prism": "3.2.0", + "github-slugger": "^2.0.0", + "hast-util-from-html": "^2.0.3", + "hast-util-to-text": "^4.0.2", + "import-meta-resolve": "^4.1.0", + "js-yaml": "^4.1.0", + "mdast-util-definitions": "^6.0.0", + "rehype-raw": "^7.0.0", + "rehype-stringify": "^10.0.1", + "remark-gfm": "^4.0.0", + "remark-parse": "^11.0.0", + "remark-rehype": "^11.1.1", + "remark-smartypants": "^3.0.2", + "shiki": "^1.29.1", + "smol-toml": "^1.3.1", + "unified": "^11.0.5", + "unist-util-remove-position": "^5.0.0", + "unist-util-visit": "^5.0.0", + "unist-util-visit-parents": "^6.0.1", + "vfile": "^6.0.3" + } + }, + "node_modules/@astrojs/prism": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/@astrojs/prism/-/prism-3.2.0.tgz", + "integrity": "sha512-GilTHKGCW6HMq7y3BUv9Ac7GMe/MO9gi9GW62GzKtth0SwukCu/qp2wLiGpEujhY+VVhaG9v7kv/5vFzvf4NYw==", + "license": "MIT", + "peer": true, + "dependencies": { + "prismjs": "^1.29.0" + }, + "engines": { + "node": "^18.17.1 || ^20.3.0 || >=22.0.0" + } + }, + "node_modules/@astrojs/telemetry": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/@astrojs/telemetry/-/telemetry-3.2.0.tgz", + "integrity": "sha512-wxhSKRfKugLwLlr4OFfcqovk+LIFtKwLyGPqMsv+9/ibqqnW3Gv7tBhtKEb0gAyUAC4G9BTVQeQahqnQAhd6IQ==", + "license": "MIT", + "peer": true, + "dependencies": { + "ci-info": "^4.1.0", + "debug": "^4.3.7", + "dlv": "^1.1.3", + "dset": "^3.1.4", + "is-docker": "^3.0.0", + "is-wsl": "^3.1.0", + "which-pm-runs": "^1.1.0" + }, + "engines": { + "node": "^18.17.1 || ^20.3.0 || >=22.0.0" + } + }, + "node_modules/@astropub/codecs": { + "version": "0.4.4", + "resolved": "https://registry.npmjs.org/@astropub/codecs/-/codecs-0.4.4.tgz", + "integrity": "sha512-jHmdZK2B7dfelTsVzkWVb93WPjuKkHz07xUcyg5WtUxTeCCxdDVLnvZlsB5PC2r7HmJLf03TP1QYb1ZgrEebyQ==", + "license": "(CC0-1.0 AND Apache-2.0 AND BSD-3-Clause)" + }, + "node_modules/@babel/helper-string-parser": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.25.9.tgz", + "integrity": "sha512-4A/SCr/2KLd5jrtOMFzaKjVtAei3+2r/NChoBNoZ3EyP/+GlhoaEGoWOZUmFmoITP7zOJyHIMm+DYRd8o3PvHA==", + "license": "MIT", + "peer": true, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-validator-identifier": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.25.9.tgz", + "integrity": "sha512-Ed61U6XJc3CVRfkERJWDz4dJwKe7iLmmJsbOGu9wSloNSFttHV0I8g6UAgb7qnK5ly5bGLPd4oXZlxCdANBOWQ==", + "license": "MIT", + "peer": true, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/parser": { + "version": "7.26.9", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.26.9.tgz", + "integrity": "sha512-81NWa1njQblgZbQHxWHpxxCzNsa3ZwvFqpUg7P+NNUU6f3UU2jBEg4OlF/J6rl8+PQGh1q6/zWScd001YwcA5A==", + "license": "MIT", + "peer": true, + "dependencies": { + "@babel/types": "^7.26.9" + }, + "bin": { + "parser": "bin/babel-parser.js" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@babel/runtime": { + "version": "7.26.9", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.26.9.tgz", + "integrity": "sha512-aA63XwOkcl4xxQa3HjPMqOP6LiK0ZDv3mUPYEFXkpHbaFjtGggE1A61FjFzJnB+p7/oy2gA8E+rcBNl/zC1tMg==", + "license": "MIT", + "dependencies": { + "regenerator-runtime": "^0.14.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/runtime/node_modules/regenerator-runtime": { + "version": "0.14.1", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.14.1.tgz", + "integrity": "sha512-dYnhHh0nJoMfnkZs6GmmhFknAGRrLznOu5nc9ML+EJxGvrx6H7teuevqVqCuPcPK//3eDrrjQhehXVx9cnkGdw==", + "license": "MIT" + }, + "node_modules/@babel/types": { + "version": "7.26.9", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.26.9.tgz", + "integrity": "sha512-Y3IR1cRnOxOCDvMmNiym7XpXQ93iGDDPHx+Zj+NM+rg0fBaShfQLkg+hKPaZCEvg5N/LeCo4+Rj/i3FuJsIQaw==", + "license": "MIT", + "peer": true, + "dependencies": { + "@babel/helper-string-parser": "^7.25.9", + "@babel/helper-validator-identifier": "^7.25.9" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@emnapi/runtime": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/@emnapi/runtime/-/runtime-1.3.1.tgz", + "integrity": "sha512-kEBmG8KyqtxJZv+ygbEim+KCGtIq1fC22Ms3S4ziXmYKm8uyoLX0MHONVKwp+9opg390VaKRNt4a7A9NwmpNhw==", + "license": "MIT", + "optional": true, + "dependencies": { + "tslib": "^2.4.0" + } + }, + "node_modules/@esbuild/aix-ppc64": { + "version": "0.24.2", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.24.2.tgz", + "integrity": "sha512-thpVCb/rhxE/BnMLQ7GReQLLN8q9qbHmI55F4489/ByVg2aQaQ6kbcLb6FHkocZzQhxc4gx0sCk0tJkKBFzDhA==", + "cpu": [ + "ppc64" + ], + "license": "MIT", + "optional": true, + "os": [ + "aix" + ], + "peer": true, + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-arm": { + "version": "0.24.2", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.24.2.tgz", + "integrity": "sha512-tmwl4hJkCfNHwFB3nBa8z1Uy3ypZpxqxfTQOcHX+xRByyYgunVbZ9MzUUfb0RxaHIMnbHagwAxuTL+tnNM+1/Q==", + "cpu": [ + "arm" + ], + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "peer": true, + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-arm64": { + "version": "0.24.2", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.24.2.tgz", + "integrity": "sha512-cNLgeqCqV8WxfcTIOeL4OAtSmL8JjcN6m09XIgro1Wi7cF4t/THaWEa7eL5CMoMBdjoHOTh/vwTO/o2TRXIyzg==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "peer": true, + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-x64": { + "version": "0.24.2", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.24.2.tgz", + "integrity": "sha512-B6Q0YQDqMx9D7rvIcsXfmJfvUYLoP722bgfBlO5cGvNVb5V/+Y7nhBE3mHV9OpxBf4eAS2S68KZztiPaWq4XYw==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "peer": true, + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/darwin-arm64": { + "version": "0.24.2", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.24.2.tgz", + "integrity": "sha512-kj3AnYWc+CekmZnS5IPu9D+HWtUI49hbnyqk0FLEJDbzCIQt7hg7ucF1SQAilhtYpIujfaHr6O0UHlzzSPdOeA==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "peer": true, + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/darwin-x64": { + "version": "0.24.2", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.24.2.tgz", + "integrity": "sha512-WeSrmwwHaPkNR5H3yYfowhZcbriGqooyu3zI/3GGpF8AyUdsrrP0X6KumITGA9WOyiJavnGZUwPGvxvwfWPHIA==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "peer": true, + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/freebsd-arm64": { + "version": "0.24.2", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.24.2.tgz", + "integrity": "sha512-UN8HXjtJ0k/Mj6a9+5u6+2eZ2ERD7Edt1Q9IZiB5UZAIdPnVKDoG7mdTVGhHJIeEml60JteamR3qhsr1r8gXvg==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "peer": true, + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/freebsd-x64": { + "version": "0.24.2", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.24.2.tgz", + "integrity": "sha512-TvW7wE/89PYW+IevEJXZ5sF6gJRDY/14hyIGFXdIucxCsbRmLUcjseQu1SyTko+2idmCw94TgyaEZi9HUSOe3Q==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "peer": true, + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-arm": { + "version": "0.24.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.24.2.tgz", + "integrity": "sha512-n0WRM/gWIdU29J57hJyUdIsk0WarGd6To0s+Y+LwvlC55wt+GT/OgkwoXCXvIue1i1sSNWblHEig00GBWiJgfA==", + "cpu": [ + "arm" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "peer": true, + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-arm64": { + "version": "0.24.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.24.2.tgz", + "integrity": "sha512-7HnAD6074BW43YvvUmE/35Id9/NB7BeX5EoNkK9obndmZBUk8xmJJeU7DwmUeN7tkysslb2eSl6CTrYz6oEMQg==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "peer": true, + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-ia32": { + "version": "0.24.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.24.2.tgz", + "integrity": "sha512-sfv0tGPQhcZOgTKO3oBE9xpHuUqguHvSo4jl+wjnKwFpapx+vUDcawbwPNuBIAYdRAvIDBfZVvXprIj3HA+Ugw==", + "cpu": [ + "ia32" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "peer": true, + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-loong64": { + "version": "0.24.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.24.2.tgz", + "integrity": "sha512-CN9AZr8kEndGooS35ntToZLTQLHEjtVB5n7dl8ZcTZMonJ7CCfStrYhrzF97eAecqVbVJ7APOEe18RPI4KLhwQ==", + "cpu": [ + "loong64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "peer": true, + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-mips64el": { + "version": "0.24.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.24.2.tgz", + "integrity": "sha512-iMkk7qr/wl3exJATwkISxI7kTcmHKE+BlymIAbHO8xanq/TjHaaVThFF6ipWzPHryoFsesNQJPE/3wFJw4+huw==", + "cpu": [ + "mips64el" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "peer": true, + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-ppc64": { + "version": "0.24.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.24.2.tgz", + "integrity": "sha512-shsVrgCZ57Vr2L8mm39kO5PPIb+843FStGt7sGGoqiiWYconSxwTiuswC1VJZLCjNiMLAMh34jg4VSEQb+iEbw==", + "cpu": [ + "ppc64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "peer": true, + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-riscv64": { + "version": "0.24.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.24.2.tgz", + "integrity": "sha512-4eSFWnU9Hhd68fW16GD0TINewo1L6dRrB+oLNNbYyMUAeOD2yCK5KXGK1GH4qD/kT+bTEXjsyTCiJGHPZ3eM9Q==", + "cpu": [ + "riscv64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "peer": true, + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-s390x": { + "version": "0.24.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.24.2.tgz", + "integrity": "sha512-S0Bh0A53b0YHL2XEXC20bHLuGMOhFDO6GN4b3YjRLK//Ep3ql3erpNcPlEFed93hsQAjAQDNsvcK+hV90FubSw==", + "cpu": [ + "s390x" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "peer": true, + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-x64": { + "version": "0.24.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.24.2.tgz", + "integrity": "sha512-8Qi4nQcCTbLnK9WoMjdC9NiTG6/E38RNICU6sUNqK0QFxCYgoARqVqxdFmWkdonVsvGqWhmm7MO0jyTqLqwj0Q==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "peer": true, + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/netbsd-arm64": { + "version": "0.24.2", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.24.2.tgz", + "integrity": "sha512-wuLK/VztRRpMt9zyHSazyCVdCXlpHkKm34WUyinD2lzK07FAHTq0KQvZZlXikNWkDGoT6x3TD51jKQ7gMVpopw==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "peer": true, + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/netbsd-x64": { + "version": "0.24.2", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.24.2.tgz", + "integrity": "sha512-VefFaQUc4FMmJuAxmIHgUmfNiLXY438XrL4GDNV1Y1H/RW3qow68xTwjZKfj/+Plp9NANmzbH5R40Meudu8mmw==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "peer": true, + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openbsd-arm64": { + "version": "0.24.2", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.24.2.tgz", + "integrity": "sha512-YQbi46SBct6iKnszhSvdluqDmxCJA+Pu280Av9WICNwQmMxV7nLRHZfjQzwbPs3jeWnuAhE9Jy0NrnJ12Oz+0A==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "peer": true, + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openbsd-x64": { + "version": "0.24.2", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.24.2.tgz", + "integrity": "sha512-+iDS6zpNM6EnJyWv0bMGLWSWeXGN/HTaF/LXHXHwejGsVi+ooqDfMCCTerNFxEkM3wYVcExkeGXNqshc9iMaOA==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "peer": true, + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/sunos-x64": { + "version": "0.24.2", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.24.2.tgz", + "integrity": "sha512-hTdsW27jcktEvpwNHJU4ZwWFGkz2zRJUz8pvddmXPtXDzVKTTINmlmga3ZzwcuMpUvLw7JkLy9QLKyGpD2Yxig==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "sunos" + ], + "peer": true, + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-arm64": { + "version": "0.24.2", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.24.2.tgz", + "integrity": "sha512-LihEQ2BBKVFLOC9ZItT9iFprsE9tqjDjnbulhHoFxYQtQfai7qfluVODIYxt1PgdoyQkz23+01rzwNwYfutxUQ==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "peer": true, + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-ia32": { + "version": "0.24.2", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.24.2.tgz", + "integrity": "sha512-q+iGUwfs8tncmFC9pcnD5IvRHAzmbwQ3GPS5/ceCyHdjXubwQWI12MKWSNSMYLJMq23/IUCvJMS76PDqXe1fxA==", + "cpu": [ + "ia32" + ], + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "peer": true, + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-x64": { + "version": "0.24.2", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.24.2.tgz", + "integrity": "sha512-7VTgWzgMGvup6aSqDPLiW5zHaxYJGTO4OokMjIlrCtf+VpEL+cXKtCvg723iguPYI5oaUNdS+/V7OU2gvXVWEg==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "peer": true, + "engines": { + "node": ">=18" + } + }, + "node_modules/@img/sharp-darwin-arm64": { + "version": "0.33.5", + "resolved": "https://registry.npmjs.org/@img/sharp-darwin-arm64/-/sharp-darwin-arm64-0.33.5.tgz", + "integrity": "sha512-UT4p+iz/2H4twwAoLCqfA9UH5pI6DggwKEGuaPy7nCVQ8ZsiY5PIcrRvD1DzuY3qYL07NtIQcWnBSY/heikIFQ==", + "cpu": [ + "arm64" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-darwin-arm64": "1.0.4" + } + }, + "node_modules/@img/sharp-darwin-x64": { + "version": "0.33.5", + "resolved": "https://registry.npmjs.org/@img/sharp-darwin-x64/-/sharp-darwin-x64-0.33.5.tgz", + "integrity": "sha512-fyHac4jIc1ANYGRDxtiqelIbdWkIuQaI84Mv45KvGRRxSAa7o7d1ZKAOBaYbnepLC1WqxfpimdeWfvqqSGwR2Q==", + "cpu": [ + "x64" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-darwin-x64": "1.0.4" + } + }, + "node_modules/@img/sharp-libvips-darwin-arm64": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-darwin-arm64/-/sharp-libvips-darwin-arm64-1.0.4.tgz", + "integrity": "sha512-XblONe153h0O2zuFfTAbQYAX2JhYmDHeWikp1LM9Hul9gVPjFY427k6dFEcOL72O01QxQsWi761svJ/ev9xEDg==", + "cpu": [ + "arm64" + ], + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "darwin" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-darwin-x64": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-darwin-x64/-/sharp-libvips-darwin-x64-1.0.4.tgz", + "integrity": "sha512-xnGR8YuZYfJGmWPvmlunFaWJsb9T/AO2ykoP3Fz/0X5XV2aoYBPkX6xqCQvUTKKiLddarLaxpzNe+b1hjeWHAQ==", + "cpu": [ + "x64" + ], + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "darwin" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linux-arm": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-arm/-/sharp-libvips-linux-arm-1.0.5.tgz", + "integrity": "sha512-gvcC4ACAOPRNATg/ov8/MnbxFDJqf/pDePbBnuBDcjsI8PssmjoKMAz4LtLaVi+OnSb5FK/yIOamqDwGmXW32g==", + "cpu": [ + "arm" + ], + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "linux" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linux-arm64": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-arm64/-/sharp-libvips-linux-arm64-1.0.4.tgz", + "integrity": "sha512-9B+taZ8DlyyqzZQnoeIvDVR/2F4EbMepXMc/NdVbkzsJbzkUjhXv/70GQJ7tdLA4YJgNP25zukcxpX2/SueNrA==", + "cpu": [ + "arm64" + ], + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "linux" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linux-s390x": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-s390x/-/sharp-libvips-linux-s390x-1.0.4.tgz", + "integrity": "sha512-u7Wz6ntiSSgGSGcjZ55im6uvTrOxSIS8/dgoVMoiGE9I6JAfU50yH5BoDlYA1tcuGS7g/QNtetJnxA6QEsCVTA==", + "cpu": [ + "s390x" + ], + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "linux" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linux-x64": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-x64/-/sharp-libvips-linux-x64-1.0.4.tgz", + "integrity": "sha512-MmWmQ3iPFZr0Iev+BAgVMb3ZyC4KeFc3jFxnNbEPas60e1cIfevbtuyf9nDGIzOaW9PdnDciJm+wFFaTlj5xYw==", + "cpu": [ + "x64" + ], + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "linux" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linuxmusl-arm64": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linuxmusl-arm64/-/sharp-libvips-linuxmusl-arm64-1.0.4.tgz", + "integrity": "sha512-9Ti+BbTYDcsbp4wfYib8Ctm1ilkugkA/uscUn6UXK1ldpC1JjiXbLfFZtRlBhjPZ5o1NCLiDbg8fhUPKStHoTA==", + "cpu": [ + "arm64" + ], + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "linux" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linuxmusl-x64": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linuxmusl-x64/-/sharp-libvips-linuxmusl-x64-1.0.4.tgz", + "integrity": "sha512-viYN1KX9m+/hGkJtvYYp+CCLgnJXwiQB39damAO7WMdKWlIhmYTfHjwSbQeUK/20vY154mwezd9HflVFM1wVSw==", + "cpu": [ + "x64" + ], + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "linux" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-linux-arm": { + "version": "0.33.5", + "resolved": "https://registry.npmjs.org/@img/sharp-linux-arm/-/sharp-linux-arm-0.33.5.tgz", + "integrity": "sha512-JTS1eldqZbJxjvKaAkxhZmBqPRGmxgu+qFKSInv8moZ2AmT5Yib3EQ1c6gp493HvrvV8QgdOXdyaIBrhvFhBMQ==", + "cpu": [ + "arm" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linux-arm": "1.0.5" + } + }, + "node_modules/@img/sharp-linux-arm64": { + "version": "0.33.5", + "resolved": "https://registry.npmjs.org/@img/sharp-linux-arm64/-/sharp-linux-arm64-0.33.5.tgz", + "integrity": "sha512-JMVv+AMRyGOHtO1RFBiJy/MBsgz0x4AWrT6QoEVVTyh1E39TrCUpTRI7mx9VksGX4awWASxqCYLCV4wBZHAYxA==", + "cpu": [ + "arm64" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linux-arm64": "1.0.4" + } + }, + "node_modules/@img/sharp-linux-s390x": { + "version": "0.33.5", + "resolved": "https://registry.npmjs.org/@img/sharp-linux-s390x/-/sharp-linux-s390x-0.33.5.tgz", + "integrity": "sha512-y/5PCd+mP4CA/sPDKl2961b+C9d+vPAveS33s6Z3zfASk2j5upL6fXVPZi7ztePZ5CuH+1kW8JtvxgbuXHRa4Q==", + "cpu": [ + "s390x" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linux-s390x": "1.0.4" + } + }, + "node_modules/@img/sharp-linux-x64": { + "version": "0.33.5", + "resolved": "https://registry.npmjs.org/@img/sharp-linux-x64/-/sharp-linux-x64-0.33.5.tgz", + "integrity": "sha512-opC+Ok5pRNAzuvq1AG0ar+1owsu842/Ab+4qvU879ippJBHvyY5n2mxF1izXqkPYlGuP/M556uh53jRLJmzTWA==", + "cpu": [ + "x64" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linux-x64": "1.0.4" + } + }, + "node_modules/@img/sharp-linuxmusl-arm64": { + "version": "0.33.5", + "resolved": "https://registry.npmjs.org/@img/sharp-linuxmusl-arm64/-/sharp-linuxmusl-arm64-0.33.5.tgz", + "integrity": "sha512-XrHMZwGQGvJg2V/oRSUfSAfjfPxO+4DkiRh6p2AFjLQztWUuY/o8Mq0eMQVIY7HJ1CDQUJlxGGZRw1a5bqmd1g==", + "cpu": [ + "arm64" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linuxmusl-arm64": "1.0.4" + } + }, + "node_modules/@img/sharp-linuxmusl-x64": { + "version": "0.33.5", + "resolved": "https://registry.npmjs.org/@img/sharp-linuxmusl-x64/-/sharp-linuxmusl-x64-0.33.5.tgz", + "integrity": "sha512-WT+d/cgqKkkKySYmqoZ8y3pxx7lx9vVejxW/W4DOFMYVSkErR+w7mf2u8m/y4+xHe7yY9DAXQMWQhpnMuFfScw==", + "cpu": [ + "x64" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linuxmusl-x64": "1.0.4" + } + }, + "node_modules/@img/sharp-wasm32": { + "version": "0.33.5", + "resolved": "https://registry.npmjs.org/@img/sharp-wasm32/-/sharp-wasm32-0.33.5.tgz", + "integrity": "sha512-ykUW4LVGaMcU9lu9thv85CbRMAwfeadCJHRsg2GmeRa/cJxsVY9Rbd57JcMxBkKHag5U/x7TSBpScF4U8ElVzg==", + "cpu": [ + "wasm32" + ], + "license": "Apache-2.0 AND LGPL-3.0-or-later AND MIT", + "optional": true, + "dependencies": { + "@emnapi/runtime": "^1.2.0" + }, + "engines": { + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-win32-ia32": { + "version": "0.33.5", + "resolved": "https://registry.npmjs.org/@img/sharp-win32-ia32/-/sharp-win32-ia32-0.33.5.tgz", + "integrity": "sha512-T36PblLaTwuVJ/zw/LaH0PdZkRz5rd3SmMHX8GSmR7vtNSP5Z6bQkExdSK7xGWyxLw4sUknBuugTelgw2faBbQ==", + "cpu": [ + "ia32" + ], + "license": "Apache-2.0 AND LGPL-3.0-or-later", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-win32-x64": { + "version": "0.33.5", + "resolved": "https://registry.npmjs.org/@img/sharp-win32-x64/-/sharp-win32-x64-0.33.5.tgz", + "integrity": "sha512-MpY/o8/8kj+EcnxwvrP4aTJSWw/aZ7JIGR4aBeZkZw5B7/Jn+tY9/VNwtcoGmdT7GfggGIU4kygOMSbYnOrAbg==", + "cpu": [ + "x64" + ], + "license": "Apache-2.0 AND LGPL-3.0-or-later", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@isaacs/cliui": { + "version": "8.0.2", + "resolved": "https://registry.npmjs.org/@isaacs/cliui/-/cliui-8.0.2.tgz", + "integrity": "sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==", + "license": "ISC", + "dependencies": { + "string-width": "^5.1.2", + "string-width-cjs": "npm:string-width@^4.2.0", + "strip-ansi": "^7.0.1", + "strip-ansi-cjs": "npm:strip-ansi@^6.0.1", + "wrap-ansi": "^8.1.0", + "wrap-ansi-cjs": "npm:wrap-ansi@^7.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/@isaacs/cliui/node_modules/emoji-regex": { + "version": "9.2.2", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz", + "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==", + "license": "MIT" + }, + "node_modules/@isaacs/cliui/node_modules/string-width": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz", + "integrity": "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==", + "license": "MIT", + "dependencies": { + "eastasianwidth": "^0.2.0", + "emoji-regex": "^9.2.2", + "strip-ansi": "^7.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@isaacs/cliui/node_modules/wrap-ansi": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz", + "integrity": "sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==", + "license": "MIT", + "dependencies": { + "ansi-styles": "^6.1.0", + "string-width": "^5.0.1", + "strip-ansi": "^7.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/@isaacs/fs-minipass": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/@isaacs/fs-minipass/-/fs-minipass-4.0.1.tgz", + "integrity": "sha512-wgm9Ehl2jpeqP3zw/7mo3kRHFp5MEDhqAdwy1fTGkHAwnkGOVsgpvQhL8B5n1qlb01jV3n/bI0ZfZp5lWA1k4w==", + "license": "ISC", + "dependencies": { + "minipass": "^7.0.4" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@jimp/bmp": { + "version": "0.14.0", + "resolved": "https://registry.npmjs.org/@jimp/bmp/-/bmp-0.14.0.tgz", + "integrity": "sha512-5RkX6tSS7K3K3xNEb2ygPuvyL9whjanhoaB/WmmXlJS6ub4DjTqrapu8j4qnIWmO4YYtFeTbDTXV6v9P1yMA5A==", + "license": "MIT", + "dependencies": { + "@babel/runtime": "^7.7.2", + "@jimp/utils": "^0.14.0", + "bmp-js": "^0.1.0" + }, + "peerDependencies": { + "@jimp/custom": ">=0.3.5" + } + }, + "node_modules/@jimp/core": { + "version": "0.14.0", + "resolved": "https://registry.npmjs.org/@jimp/core/-/core-0.14.0.tgz", + "integrity": "sha512-S62FcKdtLtj3yWsGfJRdFXSutjvHg7aQNiFogMbwq19RP4XJWqS2nOphu7ScB8KrSlyy5nPF2hkWNhLRLyD82w==", + "license": "MIT", + "dependencies": { + "@babel/runtime": "^7.7.2", + "@jimp/utils": "^0.14.0", + "any-base": "^1.1.0", + "buffer": "^5.2.0", + "exif-parser": "^0.1.12", + "file-type": "^9.0.0", + "load-bmfont": "^1.3.1", + "mkdirp": "^0.5.1", + "phin": "^2.9.1", + "pixelmatch": "^4.0.2", + "tinycolor2": "^1.4.1" + } + }, + "node_modules/@jimp/core/node_modules/file-type": { + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/file-type/-/file-type-9.0.0.tgz", + "integrity": "sha512-Qe/5NJrgIOlwijpq3B7BEpzPFcgzggOTagZmkXQY4LA6bsXKTUstK7Wp12lEJ/mLKTpvIZxmIuRcLYWT6ov9lw==", + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/@jimp/custom": { + "version": "0.14.0", + "resolved": "https://registry.npmjs.org/@jimp/custom/-/custom-0.14.0.tgz", + "integrity": "sha512-kQJMeH87+kWJdVw8F9GQhtsageqqxrvzg7yyOw3Tx/s7v5RToe8RnKyMM+kVtBJtNAG+Xyv/z01uYQ2jiZ3GwA==", + "license": "MIT", + "dependencies": { + "@babel/runtime": "^7.7.2", + "@jimp/core": "^0.14.0" + } + }, + "node_modules/@jimp/gif": { + "version": "0.14.0", + "resolved": "https://registry.npmjs.org/@jimp/gif/-/gif-0.14.0.tgz", + "integrity": "sha512-DHjoOSfCaCz72+oGGEh8qH0zE6pUBaBxPxxmpYJjkNyDZP7RkbBkZJScIYeQ7BmJxmGN4/dZn+MxamoQlr+UYg==", + "license": "MIT", + "dependencies": { + "@babel/runtime": "^7.7.2", + "@jimp/utils": "^0.14.0", + "gifwrap": "^0.9.2", + "omggif": "^1.0.9" + }, + "peerDependencies": { + "@jimp/custom": ">=0.3.5" + } + }, + "node_modules/@jimp/jpeg": { + "version": "0.14.0", + "resolved": "https://registry.npmjs.org/@jimp/jpeg/-/jpeg-0.14.0.tgz", + "integrity": "sha512-561neGbr+87S/YVQYnZSTyjWTHBm9F6F1obYHiyU3wVmF+1CLbxY3FQzt4YolwyQHIBv36Bo0PY2KkkU8BEeeQ==", + "license": "MIT", + "dependencies": { + "@babel/runtime": "^7.7.2", + "@jimp/utils": "^0.14.0", + "jpeg-js": "^0.4.0" + }, + "peerDependencies": { + "@jimp/custom": ">=0.3.5" + } + }, + "node_modules/@jimp/plugin-blit": { + "version": "0.14.0", + "resolved": "https://registry.npmjs.org/@jimp/plugin-blit/-/plugin-blit-0.14.0.tgz", + "integrity": "sha512-YoYOrnVHeX3InfgbJawAU601iTZMwEBZkyqcP1V/S33Qnz9uzH1Uj1NtC6fNgWzvX6I4XbCWwtr4RrGFb5CFrw==", + "license": "MIT", + "dependencies": { + "@babel/runtime": "^7.7.2", + "@jimp/utils": "^0.14.0" + }, + "peerDependencies": { + "@jimp/custom": ">=0.3.5" + } + }, + "node_modules/@jimp/plugin-blur": { + "version": "0.14.0", + "resolved": "https://registry.npmjs.org/@jimp/plugin-blur/-/plugin-blur-0.14.0.tgz", + "integrity": "sha512-9WhZcofLrT0hgI7t0chf7iBQZib//0gJh9WcQMUt5+Q1Bk04dWs8vTgLNj61GBqZXgHSPzE4OpCrrLDBG8zlhQ==", + "license": "MIT", + "dependencies": { + "@babel/runtime": "^7.7.2", + "@jimp/utils": "^0.14.0" + }, + "peerDependencies": { + "@jimp/custom": ">=0.3.5" + } + }, + "node_modules/@jimp/plugin-circle": { + "version": "0.14.0", + "resolved": "https://registry.npmjs.org/@jimp/plugin-circle/-/plugin-circle-0.14.0.tgz", + "integrity": "sha512-o5L+wf6QA44tvTum5HeLyLSc5eVfIUd5ZDVi5iRfO4o6GT/zux9AxuTSkKwnjhsG8bn1dDmywAOQGAx7BjrQVA==", + "license": "MIT", + "dependencies": { + "@babel/runtime": "^7.7.2", + "@jimp/utils": "^0.14.0" + }, + "peerDependencies": { + "@jimp/custom": ">=0.3.5" + } + }, + "node_modules/@jimp/plugin-color": { + "version": "0.14.0", + "resolved": "https://registry.npmjs.org/@jimp/plugin-color/-/plugin-color-0.14.0.tgz", + "integrity": "sha512-JJz512SAILYV0M5LzBb9sbOm/XEj2fGElMiHAxb7aLI6jx+n0agxtHpfpV/AePTLm1vzzDxx6AJxXbKv355hBQ==", + "license": "MIT", + "dependencies": { + "@babel/runtime": "^7.7.2", + "@jimp/utils": "^0.14.0", + "tinycolor2": "^1.4.1" + }, + "peerDependencies": { + "@jimp/custom": ">=0.3.5" + } + }, + "node_modules/@jimp/plugin-contain": { + "version": "0.14.0", + "resolved": "https://registry.npmjs.org/@jimp/plugin-contain/-/plugin-contain-0.14.0.tgz", + "integrity": "sha512-RX2q233lGyaxiMY6kAgnm9ScmEkNSof0hdlaJAVDS1OgXphGAYAeSIAwzESZN4x3ORaWvkFefeVH9O9/698Evg==", + "license": "MIT", + "dependencies": { + "@babel/runtime": "^7.7.2", + "@jimp/utils": "^0.14.0" + }, + "peerDependencies": { + "@jimp/custom": ">=0.3.5", + "@jimp/plugin-blit": ">=0.3.5", + "@jimp/plugin-resize": ">=0.3.5", + "@jimp/plugin-scale": ">=0.3.5" + } + }, + "node_modules/@jimp/plugin-cover": { + "version": "0.14.0", + "resolved": "https://registry.npmjs.org/@jimp/plugin-cover/-/plugin-cover-0.14.0.tgz", + "integrity": "sha512-0P/5XhzWES4uMdvbi3beUgfvhn4YuQ/ny8ijs5kkYIw6K8mHcl820HahuGpwWMx56DJLHRl1hFhJwo9CeTRJtQ==", + "license": "MIT", + "dependencies": { + "@babel/runtime": "^7.7.2", + "@jimp/utils": "^0.14.0" + }, + "peerDependencies": { + "@jimp/custom": ">=0.3.5", + "@jimp/plugin-crop": ">=0.3.5", + "@jimp/plugin-resize": ">=0.3.5", + "@jimp/plugin-scale": ">=0.3.5" + } + }, + "node_modules/@jimp/plugin-crop": { + "version": "0.14.0", + "resolved": "https://registry.npmjs.org/@jimp/plugin-crop/-/plugin-crop-0.14.0.tgz", + "integrity": "sha512-Ojtih+XIe6/XSGtpWtbAXBozhCdsDMmy+THUJAGu2x7ZgKrMS0JotN+vN2YC3nwDpYkM+yOJImQeptSfZb2Sug==", + "license": "MIT", + "dependencies": { + "@babel/runtime": "^7.7.2", + "@jimp/utils": "^0.14.0" + }, + "peerDependencies": { + "@jimp/custom": ">=0.3.5" + } + }, + "node_modules/@jimp/plugin-displace": { + "version": "0.14.0", + "resolved": "https://registry.npmjs.org/@jimp/plugin-displace/-/plugin-displace-0.14.0.tgz", + "integrity": "sha512-c75uQUzMgrHa8vegkgUvgRL/PRvD7paFbFJvzW0Ugs8Wl+CDMGIPYQ3j7IVaQkIS+cAxv+NJ3TIRBQyBrfVEOg==", + "license": "MIT", + "dependencies": { + "@babel/runtime": "^7.7.2", + "@jimp/utils": "^0.14.0" + }, + "peerDependencies": { + "@jimp/custom": ">=0.3.5" + } + }, + "node_modules/@jimp/plugin-dither": { + "version": "0.14.0", + "resolved": "https://registry.npmjs.org/@jimp/plugin-dither/-/plugin-dither-0.14.0.tgz", + "integrity": "sha512-g8SJqFLyYexXQQsoh4dc1VP87TwyOgeTElBcxSXX2LaaMZezypmxQfLTzOFzZoK8m39NuaoH21Ou1Ftsq7LzVQ==", + "license": "MIT", + "dependencies": { + "@babel/runtime": "^7.7.2", + "@jimp/utils": "^0.14.0" + }, + "peerDependencies": { + "@jimp/custom": ">=0.3.5" + } + }, + "node_modules/@jimp/plugin-fisheye": { + "version": "0.14.0", + "resolved": "https://registry.npmjs.org/@jimp/plugin-fisheye/-/plugin-fisheye-0.14.0.tgz", + "integrity": "sha512-BFfUZ64EikCaABhCA6mR3bsltWhPpS321jpeIQfJyrILdpFsZ/OccNwCgpW1XlbldDHIoNtXTDGn3E+vCE7vDg==", + "license": "MIT", + "dependencies": { + "@babel/runtime": "^7.7.2", + "@jimp/utils": "^0.14.0" + }, + "peerDependencies": { + "@jimp/custom": ">=0.3.5" + } + }, + "node_modules/@jimp/plugin-flip": { + "version": "0.14.0", + "resolved": "https://registry.npmjs.org/@jimp/plugin-flip/-/plugin-flip-0.14.0.tgz", + "integrity": "sha512-WtL1hj6ryqHhApih+9qZQYA6Ye8a4HAmdTzLbYdTMrrrSUgIzFdiZsD0WeDHpgS/+QMsWwF+NFmTZmxNWqKfXw==", + "license": "MIT", + "dependencies": { + "@babel/runtime": "^7.7.2", + "@jimp/utils": "^0.14.0" + }, + "peerDependencies": { + "@jimp/custom": ">=0.3.5", + "@jimp/plugin-rotate": ">=0.3.5" + } + }, + "node_modules/@jimp/plugin-gaussian": { + "version": "0.14.0", + "resolved": "https://registry.npmjs.org/@jimp/plugin-gaussian/-/plugin-gaussian-0.14.0.tgz", + "integrity": "sha512-uaLwQ0XAQoydDlF9tlfc7iD9drYPriFe+jgYnWm8fbw5cN+eOIcnneEX9XCOOzwgLPkNCxGox6Kxjn8zY6GxtQ==", + "license": "MIT", + "dependencies": { + "@babel/runtime": "^7.7.2", + "@jimp/utils": "^0.14.0" + }, + "peerDependencies": { + "@jimp/custom": ">=0.3.5" + } + }, + "node_modules/@jimp/plugin-invert": { + "version": "0.14.0", + "resolved": "https://registry.npmjs.org/@jimp/plugin-invert/-/plugin-invert-0.14.0.tgz", + "integrity": "sha512-UaQW9X9vx8orQXYSjT5VcITkJPwDaHwrBbxxPoDG+F/Zgv4oV9fP+udDD6qmkgI9taU+44Fy+zm/J/gGcMWrdg==", + "license": "MIT", + "dependencies": { + "@babel/runtime": "^7.7.2", + "@jimp/utils": "^0.14.0" + }, + "peerDependencies": { + "@jimp/custom": ">=0.3.5" + } + }, + "node_modules/@jimp/plugin-mask": { + "version": "0.14.0", + "resolved": "https://registry.npmjs.org/@jimp/plugin-mask/-/plugin-mask-0.14.0.tgz", + "integrity": "sha512-tdiGM69OBaKtSPfYSQeflzFhEpoRZ+BvKfDEoivyTjauynbjpRiwB1CaiS8En1INTDwzLXTT0Be9SpI3LkJoEA==", + "license": "MIT", + "dependencies": { + "@babel/runtime": "^7.7.2", + "@jimp/utils": "^0.14.0" + }, + "peerDependencies": { + "@jimp/custom": ">=0.3.5" + } + }, + "node_modules/@jimp/plugin-normalize": { + "version": "0.14.0", + "resolved": "https://registry.npmjs.org/@jimp/plugin-normalize/-/plugin-normalize-0.14.0.tgz", + "integrity": "sha512-AfY8sqlsbbdVwFGcyIPy5JH/7fnBzlmuweb+Qtx2vn29okq6+HelLjw2b+VT2btgGUmWWHGEHd86oRGSoWGyEQ==", + "license": "MIT", + "dependencies": { + "@babel/runtime": "^7.7.2", + "@jimp/utils": "^0.14.0" + }, + "peerDependencies": { + "@jimp/custom": ">=0.3.5" + } + }, + "node_modules/@jimp/plugin-print": { + "version": "0.14.0", + "resolved": "https://registry.npmjs.org/@jimp/plugin-print/-/plugin-print-0.14.0.tgz", + "integrity": "sha512-MwP3sH+VS5AhhSTXk7pui+tEJFsxnTKFY3TraFJb8WFbA2Vo2qsRCZseEGwpTLhENB7p/JSsLvWoSSbpmxhFAQ==", + "license": "MIT", + "dependencies": { + "@babel/runtime": "^7.7.2", + "@jimp/utils": "^0.14.0", + "load-bmfont": "^1.4.0" + }, + "peerDependencies": { + "@jimp/custom": ">=0.3.5", + "@jimp/plugin-blit": ">=0.3.5" + } + }, + "node_modules/@jimp/plugin-resize": { + "version": "0.14.0", + "resolved": "https://registry.npmjs.org/@jimp/plugin-resize/-/plugin-resize-0.14.0.tgz", + "integrity": "sha512-qFeMOyXE/Bk6QXN0GQo89+CB2dQcXqoxUcDb2Ah8wdYlKqpi53skABkgVy5pW3EpiprDnzNDboMltdvDslNgLQ==", + "license": "MIT", + "dependencies": { + "@babel/runtime": "^7.7.2", + "@jimp/utils": "^0.14.0" + }, + "peerDependencies": { + "@jimp/custom": ">=0.3.5" + } + }, + "node_modules/@jimp/plugin-rotate": { + "version": "0.14.0", + "resolved": "https://registry.npmjs.org/@jimp/plugin-rotate/-/plugin-rotate-0.14.0.tgz", + "integrity": "sha512-aGaicts44bvpTcq5Dtf93/8TZFu5pMo/61lWWnYmwJJU1RqtQlxbCLEQpMyRhKDNSfPbuP8nyGmaqXlM/82J0Q==", + "license": "MIT", + "dependencies": { + "@babel/runtime": "^7.7.2", + "@jimp/utils": "^0.14.0" + }, + "peerDependencies": { + "@jimp/custom": ">=0.3.5", + "@jimp/plugin-blit": ">=0.3.5", + "@jimp/plugin-crop": ">=0.3.5", + "@jimp/plugin-resize": ">=0.3.5" + } + }, + "node_modules/@jimp/plugin-scale": { + "version": "0.14.0", + "resolved": "https://registry.npmjs.org/@jimp/plugin-scale/-/plugin-scale-0.14.0.tgz", + "integrity": "sha512-ZcJk0hxY5ZKZDDwflqQNHEGRblgaR+piePZm7dPwPUOSeYEH31P0AwZ1ziceR74zd8N80M0TMft+e3Td6KGBHw==", + "license": "MIT", + "dependencies": { + "@babel/runtime": "^7.7.2", + "@jimp/utils": "^0.14.0" + }, + "peerDependencies": { + "@jimp/custom": ">=0.3.5", + "@jimp/plugin-resize": ">=0.3.5" + } + }, + "node_modules/@jimp/plugin-shadow": { + "version": "0.14.0", + "resolved": "https://registry.npmjs.org/@jimp/plugin-shadow/-/plugin-shadow-0.14.0.tgz", + "integrity": "sha512-p2igcEr/iGrLiTu0YePNHyby0WYAXM14c5cECZIVnq/UTOOIQ7xIcWZJ1lRbAEPxVVXPN1UibhZAbr3HAb5BjQ==", + "license": "MIT", + "dependencies": { + "@babel/runtime": "^7.7.2", + "@jimp/utils": "^0.14.0" + }, + "peerDependencies": { + "@jimp/custom": ">=0.3.5", + "@jimp/plugin-blur": ">=0.3.5", + "@jimp/plugin-resize": ">=0.3.5" + } + }, + "node_modules/@jimp/plugin-threshold": { + "version": "0.14.0", + "resolved": "https://registry.npmjs.org/@jimp/plugin-threshold/-/plugin-threshold-0.14.0.tgz", + "integrity": "sha512-N4BlDgm/FoOMV/DQM2rSpzsgqAzkP0DXkWZoqaQrlRxQBo4zizQLzhEL00T/YCCMKnddzgEhnByaocgaaa0fKw==", + "license": "MIT", + "dependencies": { + "@babel/runtime": "^7.7.2", + "@jimp/utils": "^0.14.0" + }, + "peerDependencies": { + "@jimp/custom": ">=0.3.5", + "@jimp/plugin-color": ">=0.8.0", + "@jimp/plugin-resize": ">=0.8.0" + } + }, + "node_modules/@jimp/plugins": { + "version": "0.14.0", + "resolved": "https://registry.npmjs.org/@jimp/plugins/-/plugins-0.14.0.tgz", + "integrity": "sha512-vDO3XT/YQlFlFLq5TqNjQkISqjBHT8VMhpWhAfJVwuXIpilxz5Glu4IDLK6jp4IjPR6Yg2WO8TmRY/HI8vLrOw==", + "license": "MIT", + "dependencies": { + "@babel/runtime": "^7.7.2", + "@jimp/plugin-blit": "^0.14.0", + "@jimp/plugin-blur": "^0.14.0", + "@jimp/plugin-circle": "^0.14.0", + "@jimp/plugin-color": "^0.14.0", + "@jimp/plugin-contain": "^0.14.0", + "@jimp/plugin-cover": "^0.14.0", + "@jimp/plugin-crop": "^0.14.0", + "@jimp/plugin-displace": "^0.14.0", + "@jimp/plugin-dither": "^0.14.0", + "@jimp/plugin-fisheye": "^0.14.0", + "@jimp/plugin-flip": "^0.14.0", + "@jimp/plugin-gaussian": "^0.14.0", + "@jimp/plugin-invert": "^0.14.0", + "@jimp/plugin-mask": "^0.14.0", + "@jimp/plugin-normalize": "^0.14.0", + "@jimp/plugin-print": "^0.14.0", + "@jimp/plugin-resize": "^0.14.0", + "@jimp/plugin-rotate": "^0.14.0", + "@jimp/plugin-scale": "^0.14.0", + "@jimp/plugin-shadow": "^0.14.0", + "@jimp/plugin-threshold": "^0.14.0", + "timm": "^1.6.1" + }, + "peerDependencies": { + "@jimp/custom": ">=0.3.5" + } + }, + "node_modules/@jimp/png": { + "version": "0.14.0", + "resolved": "https://registry.npmjs.org/@jimp/png/-/png-0.14.0.tgz", + "integrity": "sha512-0RV/mEIDOrPCcNfXSPmPBqqSZYwGADNRVUTyMt47RuZh7sugbYdv/uvKmQSiqRdR0L1sfbCBMWUEa5G/8MSbdA==", + "license": "MIT", + "dependencies": { + "@babel/runtime": "^7.7.2", + "@jimp/utils": "^0.14.0", + "pngjs": "^3.3.3" + }, + "peerDependencies": { + "@jimp/custom": ">=0.3.5" + } + }, + "node_modules/@jimp/tiff": { + "version": "0.14.0", + "resolved": "https://registry.npmjs.org/@jimp/tiff/-/tiff-0.14.0.tgz", + "integrity": "sha512-zBYDTlutc7j88G/7FBCn3kmQwWr0rmm1e0FKB4C3uJ5oYfT8645lftUsvosKVUEfkdmOaMAnhrf4ekaHcb5gQw==", + "license": "MIT", + "dependencies": { + "@babel/runtime": "^7.7.2", + "utif": "^2.0.1" + }, + "peerDependencies": { + "@jimp/custom": ">=0.3.5" + } + }, + "node_modules/@jimp/types": { + "version": "0.14.0", + "resolved": "https://registry.npmjs.org/@jimp/types/-/types-0.14.0.tgz", + "integrity": "sha512-hx3cXAW1KZm+b+XCrY3LXtdWy2U+hNtq0rPyJ7NuXCjU7lZR3vIkpz1DLJ3yDdS70hTi5QDXY3Cd9kd6DtloHQ==", + "license": "MIT", + "dependencies": { + "@babel/runtime": "^7.7.2", + "@jimp/bmp": "^0.14.0", + "@jimp/gif": "^0.14.0", + "@jimp/jpeg": "^0.14.0", + "@jimp/png": "^0.14.0", + "@jimp/tiff": "^0.14.0", + "timm": "^1.6.1" + }, + "peerDependencies": { + "@jimp/custom": ">=0.3.5" + } + }, + "node_modules/@jimp/utils": { + "version": "0.14.0", + "resolved": "https://registry.npmjs.org/@jimp/utils/-/utils-0.14.0.tgz", + "integrity": "sha512-MY5KFYUru0y74IsgM/9asDwb3ERxWxXEu3CRCZEvE7DtT86y1bR1XgtlSliMrptjz4qbivNGMQSvUBpEFJDp1A==", + "license": "MIT", + "dependencies": { + "@babel/runtime": "^7.7.2", + "regenerator-runtime": "^0.13.3" + } + }, + "node_modules/@jridgewell/sourcemap-codec": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.0.tgz", + "integrity": "sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ==", + "license": "MIT", + "peer": true + }, + "node_modules/@nodelib/fs.scandir": { + "version": "2.1.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", + "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", + "license": "MIT", + "peer": true, + "dependencies": { + "@nodelib/fs.stat": "2.0.5", + "run-parallel": "^1.1.9" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@nodelib/fs.stat": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", + "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==", + "license": "MIT", + "peer": true, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@nodelib/fs.walk": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", + "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", + "license": "MIT", + "peer": true, + "dependencies": { + "@nodelib/fs.scandir": "2.1.5", + "fastq": "^1.6.0" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@npmcli/agent": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@npmcli/agent/-/agent-3.0.0.tgz", + "integrity": "sha512-S79NdEgDQd/NGCay6TCoVzXSj74skRZIKJcpJjC5lOq34SZzyI6MqtiiWoiVWoVrTcGjNeC4ipbh1VIHlpfF5Q==", + "license": "ISC", + "dependencies": { + "agent-base": "^7.1.0", + "http-proxy-agent": "^7.0.0", + "https-proxy-agent": "^7.0.1", + "lru-cache": "^10.0.1", + "socks-proxy-agent": "^8.0.3" + }, + "engines": { + "node": "^18.17.0 || >=20.5.0" + } + }, + "node_modules/@npmcli/fs": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/@npmcli/fs/-/fs-4.0.0.tgz", + "integrity": "sha512-/xGlezI6xfGO9NwuJlnwz/K14qD1kCSAGtacBHnGzeAIuJGazcp45KP5NuyARXoKb7cwulAGWVsbeSxdG/cb0Q==", + "license": "ISC", + "dependencies": { + "semver": "^7.3.5" + }, + "engines": { + "node": "^18.17.0 || >=20.5.0" + } + }, + "node_modules/@oslojs/encoding": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@oslojs/encoding/-/encoding-1.1.0.tgz", + "integrity": "sha512-70wQhgYmndg4GCPxPPxPGevRKqTIJ2Nh4OkiMWmDAVYsTQ+Ta7Sq+rPevXyXGdzr30/qZBnyOalCszoMxlyldQ==", + "license": "MIT", + "peer": true + }, + "node_modules/@pkgjs/parseargs": { + "version": "0.11.0", + "resolved": "https://registry.npmjs.org/@pkgjs/parseargs/-/parseargs-0.11.0.tgz", + "integrity": "sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==", + "license": "MIT", + "optional": true, + "engines": { + "node": ">=14" + } + }, + "node_modules/@polymech/cache": { + "resolved": "../../../polymech-mono/packages/cache", + "link": true + }, + "node_modules/@polymech/commons": { + "resolved": "../../../polymech-mono/packages/commons", + "link": true + }, + "node_modules/@polymech/fs": { + "resolved": "../../../polymech-mono/packages/fs", + "link": true + }, + "node_modules/@polymech/log": { + "resolved": "../../../polymech-mono/packages/log", + "link": true + }, + "node_modules/@rollup/pluginutils": { + "version": "5.1.4", + "resolved": "https://registry.npmjs.org/@rollup/pluginutils/-/pluginutils-5.1.4.tgz", + "integrity": "sha512-USm05zrsFxYLPdWWq+K3STlWiT/3ELn3RcV5hJMghpeAIhxfsUIg6mt12CBJBInWMV4VneoV7SfGv8xIwo2qNQ==", + "license": "MIT", + "peer": true, + "dependencies": { + "@types/estree": "^1.0.0", + "estree-walker": "^2.0.2", + "picomatch": "^4.0.2" + }, + "engines": { + "node": ">=14.0.0" + }, + "peerDependencies": { + "rollup": "^1.20.0||^2.0.0||^3.0.0||^4.0.0" + }, + "peerDependenciesMeta": { + "rollup": { + "optional": true + } + } + }, + "node_modules/@rollup/pluginutils/node_modules/estree-walker": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-2.0.2.tgz", + "integrity": "sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==", + "license": "MIT", + "peer": true + }, + "node_modules/@rollup/rollup-android-arm-eabi": { + "version": "4.34.7", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.34.7.tgz", + "integrity": "sha512-l6CtzHYo8D2TQ3J7qJNpp3Q1Iye56ssIAtqbM2H8axxCEEwvN7o8Ze9PuIapbxFL3OHrJU2JBX6FIIVnP/rYyw==", + "cpu": [ + "arm" + ], + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "peer": true + }, + "node_modules/@rollup/rollup-android-arm64": { + "version": "4.34.7", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.34.7.tgz", + "integrity": "sha512-KvyJpFUueUnSp53zhAa293QBYqwm94TgYTIfXyOTtidhm5V0LbLCJQRGkQClYiX3FXDQGSvPxOTD/6rPStMMDg==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "peer": true + }, + "node_modules/@rollup/rollup-darwin-arm64": { + "version": "4.34.7", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.34.7.tgz", + "integrity": "sha512-jq87CjmgL9YIKvs8ybtIC98s/M3HdbqXhllcy9EdLV0yMg1DpxES2gr65nNy7ObNo/vZ/MrOTxt0bE5LinL6mA==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "peer": true + }, + "node_modules/@rollup/rollup-darwin-x64": { + "version": "4.34.7", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.34.7.tgz", + "integrity": "sha512-rSI/m8OxBjsdnMMg0WEetu/w+LhLAcCDEiL66lmMX4R3oaml3eXz3Dxfvrxs1FbzPbJMaItQiksyMfv1hoIxnA==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "peer": true + }, + "node_modules/@rollup/rollup-freebsd-arm64": { + "version": "4.34.7", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.34.7.tgz", + "integrity": "sha512-oIoJRy3ZrdsXpFuWDtzsOOa/E/RbRWXVokpVrNnkS7npz8GEG++E1gYbzhYxhxHbO2om1T26BZjVmdIoyN2WtA==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "peer": true + }, + "node_modules/@rollup/rollup-freebsd-x64": { + "version": "4.34.7", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.34.7.tgz", + "integrity": "sha512-X++QSLm4NZfZ3VXGVwyHdRf58IBbCu9ammgJxuWZYLX0du6kZvdNqPwrjvDfwmi6wFdvfZ/s6K7ia0E5kI7m8Q==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "peer": true + }, + "node_modules/@rollup/rollup-linux-arm-gnueabihf": { + "version": "4.34.7", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.34.7.tgz", + "integrity": "sha512-Z0TzhrsNqukTz3ISzrvyshQpFnFRfLunYiXxlCRvcrb3nvC5rVKI+ZXPFG/Aa4jhQa1gHgH3A0exHaRRN4VmdQ==", + "cpu": [ + "arm" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "peer": true + }, + "node_modules/@rollup/rollup-linux-arm-musleabihf": { + "version": "4.34.7", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.34.7.tgz", + "integrity": "sha512-nkznpyXekFAbvFBKBy4nNppSgneB1wwG1yx/hujN3wRnhnkrYVugMTCBXED4+Ni6thoWfQuHNYbFjgGH0MBXtw==", + "cpu": [ + "arm" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "peer": true + }, + "node_modules/@rollup/rollup-linux-arm64-gnu": { + "version": "4.34.7", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.34.7.tgz", + "integrity": "sha512-KCjlUkcKs6PjOcxolqrXglBDcfCuUCTVlX5BgzgoJHw+1rWH1MCkETLkLe5iLLS9dP5gKC7mp3y6x8c1oGBUtA==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "peer": true + }, + "node_modules/@rollup/rollup-linux-arm64-musl": { + "version": "4.34.7", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.34.7.tgz", + "integrity": "sha512-uFLJFz6+utmpbR313TTx+NpPuAXbPz4BhTQzgaP0tozlLnGnQ6rCo6tLwaSa6b7l6gRErjLicXQ1iPiXzYotjw==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "peer": true + }, + "node_modules/@rollup/rollup-linux-loongarch64-gnu": { + "version": "4.34.7", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loongarch64-gnu/-/rollup-linux-loongarch64-gnu-4.34.7.tgz", + "integrity": "sha512-ws8pc68UcJJqCpneDFepnwlsMUFoWvPbWXT/XUrJ7rWUL9vLoIN3GAasgG+nCvq8xrE3pIrd+qLX/jotcLy0Qw==", + "cpu": [ + "loong64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "peer": true + }, + "node_modules/@rollup/rollup-linux-powerpc64le-gnu": { + "version": "4.34.7", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-powerpc64le-gnu/-/rollup-linux-powerpc64le-gnu-4.34.7.tgz", + "integrity": "sha512-vrDk9JDa/BFkxcS2PbWpr0C/LiiSLxFbNOBgfbW6P8TBe9PPHx9Wqbvx2xgNi1TOAyQHQJ7RZFqBiEohm79r0w==", + "cpu": [ + "ppc64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "peer": true + }, + "node_modules/@rollup/rollup-linux-riscv64-gnu": { + "version": "4.34.7", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.34.7.tgz", + "integrity": "sha512-rB+ejFyjtmSo+g/a4eovDD1lHWHVqizN8P0Hm0RElkINpS0XOdpaXloqM4FBkF9ZWEzg6bezymbpLmeMldfLTw==", + "cpu": [ + "riscv64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "peer": true + }, + "node_modules/@rollup/rollup-linux-s390x-gnu": { + "version": "4.34.7", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.34.7.tgz", + "integrity": "sha512-nNXNjo4As6dNqRn7OrsnHzwTgtypfRA3u3AKr0B3sOOo+HkedIbn8ZtFnB+4XyKJojIfqDKmbIzO1QydQ8c+Pw==", + "cpu": [ + "s390x" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "peer": true + }, + "node_modules/@rollup/rollup-linux-x64-gnu": { + "version": "4.34.7", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.34.7.tgz", + "integrity": "sha512-9kPVf9ahnpOMSGlCxXGv980wXD0zRR3wyk8+33/MXQIpQEOpaNe7dEHm5LMfyRZRNt9lMEQuH0jUKj15MkM7QA==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "peer": true + }, + "node_modules/@rollup/rollup-linux-x64-musl": { + "version": "4.34.7", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.34.7.tgz", + "integrity": "sha512-7wJPXRWTTPtTFDFezA8sle/1sdgxDjuMoRXEKtx97ViRxGGkVQYovem+Q8Pr/2HxiHp74SSRG+o6R0Yq0shPwQ==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "peer": true + }, + "node_modules/@rollup/rollup-win32-arm64-msvc": { + "version": "4.34.7", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.34.7.tgz", + "integrity": "sha512-MN7aaBC7mAjsiMEZcsJvwNsQVNZShgES/9SzWp1HC9Yjqb5OpexYnRjF7RmE4itbeesHMYYQiAtUAQaSKs2Rfw==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "peer": true + }, + "node_modules/@rollup/rollup-win32-ia32-msvc": { + "version": "4.34.7", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.34.7.tgz", + "integrity": "sha512-aeawEKYswsFu1LhDM9RIgToobquzdtSc4jSVqHV8uApz4FVvhFl/mKh92wc8WpFc6aYCothV/03UjY6y7yLgbg==", + "cpu": [ + "ia32" + ], + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "peer": true + }, + "node_modules/@rollup/rollup-win32-x64-msvc": { + "version": "4.34.7", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.34.7.tgz", + "integrity": "sha512-4ZedScpxxIrVO7otcZ8kCX1mZArtH2Wfj3uFCxRJ9NO80gg1XV0U/b2f/MKaGwj2X3QopHfoWiDQ917FRpwY3w==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "peer": true + }, + "node_modules/@shikijs/core": { + "version": "1.29.2", + "resolved": "https://registry.npmjs.org/@shikijs/core/-/core-1.29.2.tgz", + "integrity": "sha512-vju0lY9r27jJfOY4Z7+Rt/nIOjzJpZ3y+nYpqtUZInVoXQ/TJZcfGnNOGnKjFdVZb8qexiCuSlZRKcGfhhTTZQ==", + "license": "MIT", + "peer": true, + "dependencies": { + "@shikijs/engine-javascript": "1.29.2", + "@shikijs/engine-oniguruma": "1.29.2", + "@shikijs/types": "1.29.2", + "@shikijs/vscode-textmate": "^10.0.1", + "@types/hast": "^3.0.4", + "hast-util-to-html": "^9.0.4" + } + }, + "node_modules/@shikijs/engine-javascript": { + "version": "1.29.2", + "resolved": "https://registry.npmjs.org/@shikijs/engine-javascript/-/engine-javascript-1.29.2.tgz", + "integrity": "sha512-iNEZv4IrLYPv64Q6k7EPpOCE/nuvGiKl7zxdq0WFuRPF5PAE9PRo2JGq/d8crLusM59BRemJ4eOqrFrC4wiQ+A==", + "license": "MIT", + "peer": true, + "dependencies": { + "@shikijs/types": "1.29.2", + "@shikijs/vscode-textmate": "^10.0.1", + "oniguruma-to-es": "^2.2.0" + } + }, + "node_modules/@shikijs/engine-oniguruma": { + "version": "1.29.2", + "resolved": "https://registry.npmjs.org/@shikijs/engine-oniguruma/-/engine-oniguruma-1.29.2.tgz", + "integrity": "sha512-7iiOx3SG8+g1MnlzZVDYiaeHe7Ez2Kf2HrJzdmGwkRisT7r4rak0e655AcM/tF9JG/kg5fMNYlLLKglbN7gBqA==", + "license": "MIT", + "peer": true, + "dependencies": { + "@shikijs/types": "1.29.2", + "@shikijs/vscode-textmate": "^10.0.1" + } + }, + "node_modules/@shikijs/langs": { + "version": "1.29.2", + "resolved": "https://registry.npmjs.org/@shikijs/langs/-/langs-1.29.2.tgz", + "integrity": "sha512-FIBA7N3LZ+223U7cJDUYd5shmciFQlYkFXlkKVaHsCPgfVLiO+e12FmQE6Tf9vuyEsFe3dIl8qGWKXgEHL9wmQ==", + "license": "MIT", + "peer": true, + "dependencies": { + "@shikijs/types": "1.29.2" + } + }, + "node_modules/@shikijs/themes": { + "version": "1.29.2", + "resolved": "https://registry.npmjs.org/@shikijs/themes/-/themes-1.29.2.tgz", + "integrity": "sha512-i9TNZlsq4uoyqSbluIcZkmPL9Bfi3djVxRnofUHwvx/h6SRW3cwgBC5SML7vsDcWyukY0eCzVN980rqP6qNl9g==", + "license": "MIT", + "peer": true, + "dependencies": { + "@shikijs/types": "1.29.2" + } + }, + "node_modules/@shikijs/types": { + "version": "1.29.2", + "resolved": "https://registry.npmjs.org/@shikijs/types/-/types-1.29.2.tgz", + "integrity": "sha512-VJjK0eIijTZf0QSTODEXCqinjBn0joAHQ+aPSBzrv4O2d/QSbsMw+ZeSRx03kV34Hy7NzUvV/7NqfYGRLrASmw==", + "license": "MIT", + "peer": true, + "dependencies": { + "@shikijs/vscode-textmate": "^10.0.1", + "@types/hast": "^3.0.4" + } + }, + "node_modules/@shikijs/vscode-textmate": { + "version": "10.0.1", + "resolved": "https://registry.npmjs.org/@shikijs/vscode-textmate/-/vscode-textmate-10.0.1.tgz", + "integrity": "sha512-fTIQwLF+Qhuws31iw7Ncl1R3HUDtGwIipiJ9iU+UsDUwMhegFcQKQHd51nZjb7CArq0MvON8rbgCGQYWHUKAdg==", + "license": "MIT", + "peer": true + }, + "node_modules/@tokenizer/token": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/@tokenizer/token/-/token-0.3.0.tgz", + "integrity": "sha512-OvjF+z51L3ov0OyAU0duzsYuvO01PH7x4t6DJx+guahgTnBHkhJdG7soQeTSFLWN3efnHyibZ4Z8l2EuWwJN3A==", + "license": "MIT" + }, + "node_modules/@types/chai": { + "version": "4.3.20", + "resolved": "https://registry.npmjs.org/@types/chai/-/chai-4.3.20.tgz", + "integrity": "sha512-/pC9HAB5I/xMlc5FP77qjCnI16ChlJfW0tGa0IUcFn38VJrTV6DeZ60NU5KZBtaOZqjdpwTWohz5HU1RrhiYxQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/chai-subset": { + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/@types/chai-subset/-/chai-subset-1.3.5.tgz", + "integrity": "sha512-c2mPnw+xHtXDoHmdtcCXGwyLMiauiAyxWMzhGpqHC4nqI/Y5G2XhTampslK2rb59kpcuHon03UH8W6iYUzw88A==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/chai": "*" + } + }, + "node_modules/@types/cookie": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/@types/cookie/-/cookie-0.6.0.tgz", + "integrity": "sha512-4Kh9a6B2bQciAhf7FSuMRRkUWecJgJu9nPnx3yzpsfXX/c50REIqpHY4C82bXP90qrLtXtkDxTZosYO3UpOwlA==", + "license": "MIT", + "peer": true + }, + "node_modules/@types/debug": { + "version": "4.1.12", + "resolved": "https://registry.npmjs.org/@types/debug/-/debug-4.1.12.tgz", + "integrity": "sha512-vIChWdVG3LG1SMxEvI/AK+FWJthlrqlTu7fbrlywTkkaONwk/UAGaULXRlf8vkzFBLVm0zkMdCquhL5aOjhXPQ==", + "license": "MIT", + "peer": true, + "dependencies": { + "@types/ms": "*" + } + }, + "node_modules/@types/estree": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.6.tgz", + "integrity": "sha512-AYnb1nQyY49te+VRAVgmzfcgjYS91mY5P0TKUDCLEM+gNnA+3T6rWITXRLYCpahpqSQbN5cE+gHpnPyXjHWxcw==", + "license": "MIT", + "peer": true + }, + "node_modules/@types/hast": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/@types/hast/-/hast-3.0.4.tgz", + "integrity": "sha512-WPs+bbQw5aCj+x6laNGWLH3wviHtoCv/P3+otBhbOhJgG8qtpdAMlTCxLtsTWA7LH1Oh/bFCHsBn0TPS5m30EQ==", + "license": "MIT", + "peer": true, + "dependencies": { + "@types/unist": "*" + } + }, + "node_modules/@types/mdast": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/@types/mdast/-/mdast-4.0.4.tgz", + "integrity": "sha512-kGaNbPh1k7AFzgpud/gMdvIm5xuECykRR+JnWKQno9TAXVa6WIVCGTPvYGekIDL4uwCZQSYbUxNBSb1aUo79oA==", + "license": "MIT", + "peer": true, + "dependencies": { + "@types/unist": "*" + } + }, + "node_modules/@types/ms": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/@types/ms/-/ms-2.1.0.tgz", + "integrity": "sha512-GsCCIZDE/p3i96vtEqx+7dBUGXrc7zeSK3wwPHIaRThS+9OhWIXRqzs4d6k1SVU8g91DrNRWxWUGhp5KXQb2VA==", + "license": "MIT", + "peer": true + }, + "node_modules/@types/nlcst": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/@types/nlcst/-/nlcst-2.0.3.tgz", + "integrity": "sha512-vSYNSDe6Ix3q+6Z7ri9lyWqgGhJTmzRjZRqyq15N0Z/1/UnVsno9G/N40NBijoYx2seFDIl0+B2mgAb9mezUCA==", + "license": "MIT", + "peer": true, + "dependencies": { + "@types/unist": "*" + } + }, + "node_modules/@types/node": { + "version": "22.13.4", + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.13.4.tgz", + "integrity": "sha512-ywP2X0DYtX3y08eFVx5fNIw7/uIv8hYUKgXoK8oayJlLnKcRfEYCxWMVE1XagUdVtCJlZT1AU4LXEABW+L1Peg==", + "license": "MIT", + "optional": true, + "peer": true, + "dependencies": { + "undici-types": "~6.20.0" + } + }, + "node_modules/@types/unist": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/@types/unist/-/unist-3.0.3.tgz", + "integrity": "sha512-ko/gIFJRv177XgZsZcBwnqJN5x/Gien8qNOn0D5bQU/zAzVf9Zt3BlcUiLqhV9y4ARk0GbT3tnUiPNgnTXzc/Q==", + "license": "MIT", + "peer": true + }, + "node_modules/@ungap/structured-clone": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@ungap/structured-clone/-/structured-clone-1.3.0.tgz", + "integrity": "sha512-WmoN8qaIAo7WTYWbAZuG8PYEhn5fkz7dZrqTBZ7dtt//lL2Gwms1IcnQ5yHqjDfX8Ft5j4YzDM23f87zBfDe9g==", + "license": "ISC", + "peer": true + }, + "node_modules/abbrev": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-3.0.0.tgz", + "integrity": "sha512-+/kfrslGQ7TNV2ecmQwMJj/B65g5KVq1/L3SGVZ3tCYGqlzFuFCGBZJtMP99wH3NpEUyAjn0zPdPUg0D+DwrOA==", + "license": "ISC", + "engines": { + "node": "^18.17.0 || >=20.5.0" + } + }, + "node_modules/abort-controller": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/abort-controller/-/abort-controller-3.0.0.tgz", + "integrity": "sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==", + "license": "MIT", + "dependencies": { + "event-target-shim": "^5.0.0" + }, + "engines": { + "node": ">=6.5" + } + }, + "node_modules/acorn": { + "version": "8.14.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.14.0.tgz", + "integrity": "sha512-cl669nCJTZBsL97OF4kUQm5g5hC2uihk0NxY3WENAC0TYdILVkAyHymAntgxGkl7K+t0cXIrH5siy5S4XkFycA==", + "license": "MIT", + "peer": true, + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/agent-base": { + "version": "7.1.3", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-7.1.3.tgz", + "integrity": "sha512-jRR5wdylq8CkOe6hei19GGZnxM6rBGwFl3Bg0YItGDimvjGtAvdZk4Pu6Cl4u4Igsws4a1fd1Vq3ezrhn4KmFw==", + "license": "MIT", + "engines": { + "node": ">= 14" + } + }, + "node_modules/ansi-align": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/ansi-align/-/ansi-align-3.0.1.tgz", + "integrity": "sha512-IOfwwBF5iczOjp/WeY4YxyjqAFMQoZufdQWDd19SEExbVLNXqvpzSJ/M7Za4/sCPmQ0+GRquoA7bGcINcxew6w==", + "license": "ISC", + "peer": true, + "dependencies": { + "string-width": "^4.1.0" + } + }, + "node_modules/ansi-align/node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "license": "MIT", + "peer": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/ansi-align/node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "license": "MIT", + "peer": true + }, + "node_modules/ansi-align/node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "license": "MIT", + "peer": true, + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/ansi-align/node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "license": "MIT", + "peer": true, + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/ansi-regex": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.1.0.tgz", + "integrity": "sha512-7HSX4QQb4CspciLpVFwyRe79O3xsIZDDLER21kERQ71oaPodF8jL725AgJMFAYbooIqolJoRLuM81SpeUkpkvA==", + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-regex?sponsor=1" + } + }, + "node_modules/ansi-styles": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.1.tgz", + "integrity": "sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==", + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/any-base": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/any-base/-/any-base-1.1.0.tgz", + "integrity": "sha512-uMgjozySS8adZZYePpaWs8cxB9/kdzmpX6SgJZ+wbz1K5eYk5QMYDVJaZKhxyIHUdnnJkfR7SVgStgH7LkGUyg==", + "license": "MIT" + }, + "node_modules/anymatch": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", + "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", + "license": "ISC", + "peer": true, + "dependencies": { + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/anymatch/node_modules/picomatch": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "license": "MIT", + "peer": true, + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "license": "Python-2.0", + "peer": true + }, + "node_modules/aria-query": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/aria-query/-/aria-query-5.3.2.tgz", + "integrity": "sha512-COROpnaoap1E2F000S62r6A60uHZnmlvomhfyT2DlTcrY1OrBKn2UhH7qn5wTC9zMvD0AY7csdPSNwKP+7WiQw==", + "license": "Apache-2.0", + "peer": true, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/array-iterate": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/array-iterate/-/array-iterate-2.0.1.tgz", + "integrity": "sha512-I1jXZMjAgCMmxT4qxXfPXa6SthSoE8h6gkSI9BGGNv8mP8G/v0blc+qFnZu6K42vTOiuME596QaLO0TP3Lk0xg==", + "license": "MIT", + "peer": true, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/assertion-error": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.1.0.tgz", + "integrity": "sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==", + "dev": true, + "license": "MIT", + "engines": { + "node": "*" + } + }, + "node_modules/astro": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/astro/-/astro-5.3.0.tgz", + "integrity": "sha512-e88l/Yk/6enR/ZDddLbqtM+oblBFk5mneNSmNesyVYGL/6Dj4UA67GPAZOk79VxT5dbLlclZSyyw/wlxN1aj3A==", + "license": "MIT", + "peer": true, + "dependencies": { + "@astrojs/compiler": "^2.10.3", + "@astrojs/internal-helpers": "0.5.1", + "@astrojs/markdown-remark": "6.1.0", + "@astrojs/telemetry": "3.2.0", + "@oslojs/encoding": "^1.1.0", + "@rollup/pluginutils": "^5.1.4", + "@types/cookie": "^0.6.0", + "acorn": "^8.14.0", + "aria-query": "^5.3.2", + "axobject-query": "^4.1.0", + "boxen": "8.0.1", + "ci-info": "^4.1.0", + "clsx": "^2.1.1", + "common-ancestor-path": "^1.0.1", + "cookie": "^0.7.2", + "cssesc": "^3.0.0", + "debug": "^4.4.0", + "deterministic-object-hash": "^2.0.2", + "devalue": "^5.1.1", + "diff": "^5.2.0", + "dlv": "^1.1.3", + "dset": "^3.1.4", + "es-module-lexer": "^1.6.0", + "esbuild": "^0.24.2", + "estree-walker": "^3.0.3", + "fast-glob": "^3.3.3", + "flattie": "^1.1.1", + "github-slugger": "^2.0.0", + "html-escaper": "3.0.3", + "http-cache-semantics": "^4.1.1", + "js-yaml": "^4.1.0", + "kleur": "^4.1.5", + "magic-string": "^0.30.17", + "magicast": "^0.3.5", + "micromatch": "^4.0.8", + "mrmime": "^2.0.0", + "neotraverse": "^0.6.18", + "p-limit": "^6.2.0", + "p-queue": "^8.1.0", + "preferred-pm": "^4.1.1", + "prompts": "^2.4.2", + "rehype": "^13.0.2", + "semver": "^7.7.1", + "shiki": "^1.29.2", + "tinyexec": "^0.3.2", + "tsconfck": "^3.1.4", + "ultrahtml": "^1.5.3", + "unist-util-visit": "^5.0.0", + "unstorage": "^1.14.4", + "vfile": "^6.0.3", + "vite": "^6.0.11", + "vitefu": "^1.0.5", + "which-pm": "^3.0.1", + "xxhash-wasm": "^1.1.0", + "yargs-parser": "^21.1.1", + "yocto-spinner": "^0.2.0", + "zod": "^3.24.1", + "zod-to-json-schema": "^3.24.1", + "zod-to-ts": "^1.2.0" + }, + "bin": { + "astro": "astro.js" + }, + "engines": { + "node": "^18.17.1 || ^20.3.0 || >=22.0.0", + "npm": ">=9.6.5", + "pnpm": ">=7.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/astrodotbuild" + }, + "optionalDependencies": { + "sharp": "^0.33.3" + } + }, + "node_modules/axobject-query": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/axobject-query/-/axobject-query-4.1.0.tgz", + "integrity": "sha512-qIj0G9wZbMGNLjLmg1PT6v2mE9AH2zlnADJD/2tC6E00hgmhUOfEB6greHPAfLRSufHqROIUTkw6E+M3lH0PTQ==", + "license": "Apache-2.0", + "peer": true, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/bail": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/bail/-/bail-2.0.2.tgz", + "integrity": "sha512-0xO6mYd7JB2YesxDKplafRpsiOzPt9V02ddPCLbY1xYGPOX24NTyN50qnUxgCPcSoYMhKpAuBTjQoRZCAkUDRw==", + "license": "MIT", + "peer": true, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "license": "MIT" + }, + "node_modules/base-64": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/base-64/-/base-64-1.0.0.tgz", + "integrity": "sha512-kwDPIFCGx0NZHog36dj+tHiwP4QMzsZ3AgMViUBKI0+V5n4U0ufTCUMhnQ04diaRI8EX/QcPfql7zlhZ7j4zgg==", + "license": "MIT", + "peer": true + }, + "node_modules/base64-js": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", + "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT" + }, + "node_modules/binary-extensions": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.3.0.tgz", + "integrity": "sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw==", + "license": "MIT", + "peer": true, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/bl": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/bl/-/bl-4.1.0.tgz", + "integrity": "sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==", + "license": "MIT", + "optional": true, + "dependencies": { + "buffer": "^5.5.0", + "inherits": "^2.0.4", + "readable-stream": "^3.4.0" + } + }, + "node_modules/bl/node_modules/readable-stream": { + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", + "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", + "license": "MIT", + "optional": true, + "dependencies": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/bmp-js": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/bmp-js/-/bmp-js-0.1.0.tgz", + "integrity": "sha512-vHdS19CnY3hwiNdkaqk93DvjVLfbEcI8mys4UjuWrlX1haDmroo8o4xCzh4wD6DGV6HxRCyauwhHRqMTfERtjw==", + "license": "MIT" + }, + "node_modules/boxen": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/boxen/-/boxen-8.0.1.tgz", + "integrity": "sha512-F3PH5k5juxom4xktynS7MoFY+NUWH5LC4CnH11YB8NPew+HLpmBLCybSAEyb2F+4pRXhuhWqFesoQd6DAyc2hw==", + "license": "MIT", + "peer": true, + "dependencies": { + "ansi-align": "^3.0.1", + "camelcase": "^8.0.0", + "chalk": "^5.3.0", + "cli-boxes": "^3.0.0", + "string-width": "^7.2.0", + "type-fest": "^4.21.0", + "widest-line": "^5.0.0", + "wrap-ansi": "^9.0.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/braces": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", + "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", + "license": "MIT", + "peer": true, + "dependencies": { + "fill-range": "^7.1.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/buffer": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz", + "integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT", + "dependencies": { + "base64-js": "^1.3.1", + "ieee754": "^1.1.13" + } + }, + "node_modules/buffer-equal": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/buffer-equal/-/buffer-equal-0.0.1.tgz", + "integrity": "sha512-RgSV6InVQ9ODPdLWJ5UAqBqJBOg370Nz6ZQtRzpt6nUjc8v0St97uJ4PYC6NztqIScrAXafKM3mZPMygSe1ggA==", + "license": "MIT", + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/cacache": { + "version": "19.0.1", + "resolved": "https://registry.npmjs.org/cacache/-/cacache-19.0.1.tgz", + "integrity": "sha512-hdsUxulXCi5STId78vRVYEtDAjq99ICAUktLTeTYsLoTE6Z8dS0c8pWNCxwdrk9YfJeobDZc2Y186hD/5ZQgFQ==", + "license": "ISC", + "dependencies": { + "@npmcli/fs": "^4.0.0", + "fs-minipass": "^3.0.0", + "glob": "^10.2.2", + "lru-cache": "^10.0.1", + "minipass": "^7.0.3", + "minipass-collect": "^2.0.1", + "minipass-flush": "^1.0.5", + "minipass-pipeline": "^1.2.4", + "p-map": "^7.0.2", + "ssri": "^12.0.0", + "tar": "^7.4.3", + "unique-filename": "^4.0.0" + }, + "engines": { + "node": "^18.17.0 || >=20.5.0" + } + }, + "node_modules/camelcase": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-8.0.0.tgz", + "integrity": "sha512-8WB3Jcas3swSvjIeA2yvCJ+Miyz5l1ZmB6HFb9R1317dt9LCQoswg/BGrmAmkWVEszSrrg4RwmO46qIm2OEnSA==", + "license": "MIT", + "peer": true, + "engines": { + "node": ">=16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/ccount": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/ccount/-/ccount-2.0.1.tgz", + "integrity": "sha512-eyrF0jiFpY+3drT6383f1qhkbGsLSifNAjA61IUjZjmLCWjItY6LB9ft9YhoDgwfmclB2zhu51Lc7+95b8NRAg==", + "license": "MIT", + "peer": true, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/centra": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/centra/-/centra-2.7.0.tgz", + "integrity": "sha512-PbFMgMSrmgx6uxCdm57RUos9Tc3fclMvhLSATYN39XsDV29B89zZ3KA89jmY0vwSGazyU+uerqwa6t+KaodPcg==", + "license": "MIT", + "dependencies": { + "follow-redirects": "^1.15.6" + } + }, + "node_modules/chai": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/chai/-/chai-4.5.0.tgz", + "integrity": "sha512-RITGBfijLkBddZvnn8jdqoTypxvqbOLYQkGGxXzeFjVHvudaPw0HNFD9x928/eUwYWd2dPCugVqspGALTZZQKw==", + "dev": true, + "license": "MIT", + "dependencies": { + "assertion-error": "^1.1.0", + "check-error": "^1.0.3", + "deep-eql": "^4.1.3", + "get-func-name": "^2.0.2", + "loupe": "^2.3.6", + "pathval": "^1.1.1", + "type-detect": "^4.1.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/chalk": { + "version": "5.4.1", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.4.1.tgz", + "integrity": "sha512-zgVZuo2WcZgfUEmsn6eO3kINexW8RAE4maiQ8QNs8CtpPCSyMiYsULR3HQYkm3w8FIA3SberyMJMSldGsW+U3w==", + "license": "MIT", + "peer": true, + "engines": { + "node": "^12.17.0 || ^14.13 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/character-entities": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/character-entities/-/character-entities-2.0.2.tgz", + "integrity": "sha512-shx7oQ0Awen/BRIdkjkvz54PnEEI/EjwXDSIZp86/KKdbafHh1Df/RYGBhn4hbe2+uKC9FnT5UCEdyPz3ai9hQ==", + "license": "MIT", + "peer": true, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/character-entities-html4": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/character-entities-html4/-/character-entities-html4-2.1.0.tgz", + "integrity": "sha512-1v7fgQRj6hnSwFpq1Eu0ynr/CDEw0rXo2B61qXrLNdHZmPKgb7fqS1a2JwF0rISo9q77jDI8VMEHoApn8qDoZA==", + "license": "MIT", + "peer": true, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/character-entities-legacy": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/character-entities-legacy/-/character-entities-legacy-3.0.0.tgz", + "integrity": "sha512-RpPp0asT/6ufRm//AJVwpViZbGM/MkjQFxJccQRHmISF/22NBtsHqAWmL+/pmkPWoIUJdWyeVleTl1wydHATVQ==", + "license": "MIT", + "peer": true, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/check-error": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.3.tgz", + "integrity": "sha512-iKEoDYaRmd1mxM90a2OEfWhjsjPpYPuQ+lMYsoxB126+t8fw7ySEO48nmDg5COTjxDI65/Y2OWpeEHk3ZOe8zg==", + "dev": true, + "license": "MIT", + "dependencies": { + "get-func-name": "^2.0.2" + }, + "engines": { + "node": "*" + } + }, + "node_modules/chokidar": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.6.0.tgz", + "integrity": "sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==", + "license": "MIT", + "peer": true, + "dependencies": { + "anymatch": "~3.1.2", + "braces": "~3.0.2", + "glob-parent": "~5.1.2", + "is-binary-path": "~2.1.0", + "is-glob": "~4.0.1", + "normalize-path": "~3.0.0", + "readdirp": "~3.6.0" + }, + "engines": { + "node": ">= 8.10.0" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + }, + "optionalDependencies": { + "fsevents": "~2.3.2" + } + }, + "node_modules/chownr": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.4.tgz", + "integrity": "sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg==", + "license": "ISC", + "optional": true + }, + "node_modules/ci-info": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-4.1.0.tgz", + "integrity": "sha512-HutrvTNsF48wnxkzERIXOe5/mlcfFcbfCmwcg6CJnizbSue78AbDt+1cgl26zwn61WFxhcPykPfZrbqjGmBb4A==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/sibiraj-s" + } + ], + "license": "MIT", + "peer": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/cli-boxes": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/cli-boxes/-/cli-boxes-3.0.0.tgz", + "integrity": "sha512-/lzGpEWL/8PfI0BmBOPRwp0c/wFNX1RdUML3jK/RcSBA9T8mZDdQpqYBKtCFTOfQbwPqWEOpjqW+Fnayc0969g==", + "license": "MIT", + "peer": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/clsx": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/clsx/-/clsx-2.1.1.tgz", + "integrity": "sha512-eYm0QWBtUrBWZWG0d386OGAw16Z995PiOVo2B7bjWSbHedGl5e0ZWaq65kOGgUSNesEIDkB9ISbTg/JK9dhCZA==", + "license": "MIT", + "peer": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/color": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/color/-/color-4.2.3.tgz", + "integrity": "sha512-1rXeuUUiGGrykh+CeBdu5Ie7OJwinCgQY0bc7GCRxy5xVHy+moaqkpL/jqQq0MtQOeYcrqEz4abc5f0KtU7W4A==", + "license": "MIT", + "dependencies": { + "color-convert": "^2.0.1", + "color-string": "^1.9.0" + }, + "engines": { + "node": ">=12.5.0" + } + }, + "node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "license": "MIT", + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "license": "MIT" + }, + "node_modules/color-string": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/color-string/-/color-string-1.9.1.tgz", + "integrity": "sha512-shrVawQFojnZv6xM40anx4CkoDP+fZsw/ZerEMsW/pyzsRbElpsL/DBVW7q3ExxwusdNXI3lXpuhEZkzs8p5Eg==", + "license": "MIT", + "dependencies": { + "color-name": "^1.0.0", + "simple-swizzle": "^0.2.2" + } + }, + "node_modules/comma-separated-tokens": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/comma-separated-tokens/-/comma-separated-tokens-2.0.3.tgz", + "integrity": "sha512-Fu4hJdvzeylCfQPp9SGWidpzrMs7tTrlu6Vb8XGaRGck8QSNZJJp538Wrb60Lax4fPwR64ViY468OIUTbRlGZg==", + "license": "MIT", + "peer": true, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/common-ancestor-path": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/common-ancestor-path/-/common-ancestor-path-1.0.1.tgz", + "integrity": "sha512-L3sHRo1pXXEqX8VU28kfgUY+YGsk09hPqZiZmLacNib6XNTCM8ubYeT7ryXQw8asB1sKgcU5lkB7ONug08aB8w==", + "license": "ISC", + "peer": true + }, + "node_modules/commondir": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/commondir/-/commondir-1.0.1.tgz", + "integrity": "sha512-W9pAhw0ja1Edb5GVdIF1mjZw/ASI0AlShXM83UUGe2DVr5TdAPEA1OA8m/g8zWp9x6On7gqufY+FatDbC3MDQg==", + "license": "MIT" + }, + "node_modules/cookie": { + "version": "0.7.2", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.7.2.tgz", + "integrity": "sha512-yki5XnKuf750l50uGTllt6kKILY4nQ1eNIQatoXEByZ5dWgnKqbnqmTrBE5B4N7lrMJKQ2ytWMiTO2o0v6Ew/w==", + "license": "MIT", + "peer": true, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/cookie-es": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/cookie-es/-/cookie-es-1.2.2.tgz", + "integrity": "sha512-+W7VmiVINB+ywl1HGXJXmrqkOhpKrIiVZV6tQuV54ZyQC7MMuBt81Vc336GMLoHBq5hV/F9eXgt5Mnx0Rha5Fg==", + "license": "MIT", + "peer": true + }, + "node_modules/cross-spawn": { + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", + "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", + "license": "MIT", + "dependencies": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/cross-spawn/node_modules/isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", + "license": "ISC" + }, + "node_modules/cross-spawn/node_modules/which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "license": "ISC", + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/crossws": { + "version": "0.3.4", + "resolved": "https://registry.npmjs.org/crossws/-/crossws-0.3.4.tgz", + "integrity": "sha512-uj0O1ETYX1Bh6uSgktfPvwDiPYGQ3aI4qVsaC/LWpkIzGj1nUYm5FK3K+t11oOlpN01lGbprFCH4wBlKdJjVgw==", + "license": "MIT", + "peer": true, + "dependencies": { + "uncrypto": "^0.1.3" + } + }, + "node_modules/cssesc": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/cssesc/-/cssesc-3.0.0.tgz", + "integrity": "sha512-/Tb/JcjK111nNScGob5MNtsntNM1aCNUDipB/TkwZFhyDrrE47SOx/18wF2bbjgc3ZzCSKW1T5nt5EbFoAz/Vg==", + "license": "MIT", + "peer": true, + "bin": { + "cssesc": "bin/cssesc" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/debug": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.0.tgz", + "integrity": "sha512-6WTZ/IxCY/T6BALoZHaE4ctp9xm+Z5kY/pzYaCHRFeyVhojxlrm+46y68HA6hr0TcwEssoxNiDEUJQjfPZ/RYA==", + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/decode-named-character-reference": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/decode-named-character-reference/-/decode-named-character-reference-1.0.2.tgz", + "integrity": "sha512-O8x12RzrUF8xyVcY0KJowWsmaJxQbmy0/EtnNtHRpsOcT7dFk5W598coHqBVpmWo1oQQfsCqfCmkZN5DJrZVdg==", + "license": "MIT", + "peer": true, + "dependencies": { + "character-entities": "^2.0.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/decompress-response": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-6.0.0.tgz", + "integrity": "sha512-aW35yZM6Bb/4oJlZncMH2LCoZtJXTRxES17vE3hoRiowU2kWHaJKFkSBDnDR+cm9J+9QhXmREyIfv0pji9ejCQ==", + "license": "MIT", + "optional": true, + "dependencies": { + "mimic-response": "^3.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/deep-eql": { + "version": "4.1.4", + "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-4.1.4.tgz", + "integrity": "sha512-SUwdGfqdKOwxCPeVYjwSyRpJ7Z+fhpwIAtmCUdZIWZ/YP5R9WAsyuSgpLVDi9bjWoN2LXHNss/dk3urXtdQxGg==", + "dev": true, + "license": "MIT", + "dependencies": { + "type-detect": "^4.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/deep-extend": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz", + "integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==", + "license": "MIT", + "optional": true, + "engines": { + "node": ">=4.0.0" + } + }, + "node_modules/defu": { + "version": "6.1.4", + "resolved": "https://registry.npmjs.org/defu/-/defu-6.1.4.tgz", + "integrity": "sha512-mEQCMmwJu317oSz8CwdIOdwf3xMif1ttiM8LTufzc3g6kR+9Pe236twL8j3IYT1F7GfRgGcW6MWxzZjLIkuHIg==", + "license": "MIT", + "peer": true + }, + "node_modules/dequal": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/dequal/-/dequal-2.0.3.tgz", + "integrity": "sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA==", + "license": "MIT", + "peer": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/destr": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/destr/-/destr-2.0.3.tgz", + "integrity": "sha512-2N3BOUU4gYMpTP24s5rF5iP7BDr7uNTCs4ozw3kf/eKfvWSIu93GEBi5m427YoyJoeOzQ5smuu4nNAPGb8idSQ==", + "license": "MIT", + "peer": true + }, + "node_modules/detect-libc": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.0.3.tgz", + "integrity": "sha512-bwy0MGW55bG41VqxxypOsdSdGqLwXPI/focwgTYCFMbdUiBAxLg9CFzG08sz2aqzknwiX7Hkl0bQENjg8iLByw==", + "license": "Apache-2.0", + "engines": { + "node": ">=8" + } + }, + "node_modules/deterministic-object-hash": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/deterministic-object-hash/-/deterministic-object-hash-2.0.2.tgz", + "integrity": "sha512-KxektNH63SrbfUyDiwXqRb1rLwKt33AmMv+5Nhsw1kqZ13SJBRTgZHtGbE+hH3a1mVW1cz+4pqSWVPAtLVXTzQ==", + "license": "MIT", + "peer": true, + "dependencies": { + "base-64": "^1.0.0" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/devalue": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/devalue/-/devalue-5.1.1.tgz", + "integrity": "sha512-maua5KUiapvEwiEAe+XnlZ3Rh0GD+qI1J/nb9vrJc3muPXvcF/8gXYTWF76+5DAqHyDUtOIImEuo0YKE9mshVw==", + "license": "MIT", + "peer": true + }, + "node_modules/devlop": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/devlop/-/devlop-1.1.0.tgz", + "integrity": "sha512-RWmIqhcFf1lRYBvNmr7qTNuyCt/7/ns2jbpp1+PalgE/rDQcBT0fioSMUpJ93irlUhC5hrg4cYqe6U+0ImW0rA==", + "license": "MIT", + "peer": true, + "dependencies": { + "dequal": "^2.0.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/diff": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/diff/-/diff-5.2.0.tgz", + "integrity": "sha512-uIFDxqpRZGZ6ThOk84hEfqWoHx2devRFvpTZcTHur85vImfaxUbTW9Ryh4CpCuDnToOP1CEtXKIgytHBPVff5A==", + "license": "BSD-3-Clause", + "peer": true, + "engines": { + "node": ">=0.3.1" + } + }, + "node_modules/dlv": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/dlv/-/dlv-1.1.3.tgz", + "integrity": "sha512-+HlytyjlPKnIG8XuRG8WvmBP8xs8P71y+SKKS6ZXWoEgLuePxtDoUEiH7WkdePWrQ5JBpE6aoVqfZfJUQkjXwA==", + "license": "MIT", + "peer": true + }, + "node_modules/dom-walk": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/dom-walk/-/dom-walk-0.1.2.tgz", + "integrity": "sha512-6QvTW9mrGeIegrFXdtQi9pk7O/nSK6lSdXW2eqUspN5LWD7UTji2Fqw5V2YLjBpHEoU9Xl/eUWNpDeZvoyOv2w==" + }, + "node_modules/dset": { + "version": "3.1.4", + "resolved": "https://registry.npmjs.org/dset/-/dset-3.1.4.tgz", + "integrity": "sha512-2QF/g9/zTaPDc3BjNcVTGoBbXBgYfMTTceLaYcFJ/W9kggFUkhxD/hMEeuLKbugyef9SqAx8cpgwlIP/jinUTA==", + "license": "MIT", + "peer": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/eastasianwidth": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz", + "integrity": "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==", + "license": "MIT" + }, + "node_modules/emoji-regex": { + "version": "10.4.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-10.4.0.tgz", + "integrity": "sha512-EC+0oUMY1Rqm4O6LLrgjtYDvcVYTy7chDnM4Q7030tP4Kwj3u/pR6gP9ygnp2CJMK5Gq+9Q2oqmrFJAz01DXjw==", + "license": "MIT", + "peer": true + }, + "node_modules/emoji-regex-xs": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex-xs/-/emoji-regex-xs-1.0.0.tgz", + "integrity": "sha512-LRlerrMYoIDrT6jgpeZ2YYl/L8EulRTt5hQcYjy5AInh7HWXKimpqx68aknBFpGL2+/IcogTcaydJEgaTmOpDg==", + "license": "MIT", + "peer": true + }, + "node_modules/encoding": { + "version": "0.1.13", + "resolved": "https://registry.npmjs.org/encoding/-/encoding-0.1.13.tgz", + "integrity": "sha512-ETBauow1T35Y/WZMkio9jiM0Z5xjHHmJ4XmjZOq1l/dXz3lr2sRn87nJy20RupqSh1F2m3HHPSp8ShIPQJrJ3A==", + "license": "MIT", + "optional": true, + "dependencies": { + "iconv-lite": "^0.6.2" + } + }, + "node_modules/end-of-stream": { + "version": "1.4.4", + "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz", + "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==", + "license": "MIT", + "optional": true, + "dependencies": { + "once": "^1.4.0" + } + }, + "node_modules/entities": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/entities/-/entities-4.5.0.tgz", + "integrity": "sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==", + "license": "BSD-2-Clause", + "peer": true, + "engines": { + "node": ">=0.12" + }, + "funding": { + "url": "https://github.com/fb55/entities?sponsor=1" + } + }, + "node_modules/env-paths": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/env-paths/-/env-paths-2.2.1.tgz", + "integrity": "sha512-+h1lkLKhZMTYjog1VEpJNG7NZJWcuc2DDk/qsqSTRRCOXiLjeQ1d1/udrUGhqMxUgAlwKNZ0cf2uqan5GLuS2A==", + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/err-code": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/err-code/-/err-code-2.0.3.tgz", + "integrity": "sha512-2bmlRpNKBxT/CRmPOlyISQpNj+qSeYvcym/uT0Jx2bMOlKLtSy1ZmLuVxSEKKyor/N5yhvp/ZiG1oE3DEYMSFA==", + "license": "MIT" + }, + "node_modules/es-module-lexer": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-1.6.0.tgz", + "integrity": "sha512-qqnD1yMU6tk/jnaMosogGySTZP8YtUgAffA9nMN+E/rjxcfRQ6IEk7IiozUjgxKoFHBGjTLnrHB/YC45r/59EQ==", + "license": "MIT", + "peer": true + }, + "node_modules/esbuild": { + "version": "0.24.2", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.24.2.tgz", + "integrity": "sha512-+9egpBW8I3CD5XPe0n6BfT5fxLzxrlDzqydF3aviG+9ni1lDC/OvMHcxqEFV0+LANZG5R1bFMWfUrjVsdwxJvA==", + "hasInstallScript": true, + "license": "MIT", + "peer": true, + "bin": { + "esbuild": "bin/esbuild" + }, + "engines": { + "node": ">=18" + }, + "optionalDependencies": { + "@esbuild/aix-ppc64": "0.24.2", + "@esbuild/android-arm": "0.24.2", + "@esbuild/android-arm64": "0.24.2", + "@esbuild/android-x64": "0.24.2", + "@esbuild/darwin-arm64": "0.24.2", + "@esbuild/darwin-x64": "0.24.2", + "@esbuild/freebsd-arm64": "0.24.2", + "@esbuild/freebsd-x64": "0.24.2", + "@esbuild/linux-arm": "0.24.2", + "@esbuild/linux-arm64": "0.24.2", + "@esbuild/linux-ia32": "0.24.2", + "@esbuild/linux-loong64": "0.24.2", + "@esbuild/linux-mips64el": "0.24.2", + "@esbuild/linux-ppc64": "0.24.2", + "@esbuild/linux-riscv64": "0.24.2", + "@esbuild/linux-s390x": "0.24.2", + "@esbuild/linux-x64": "0.24.2", + "@esbuild/netbsd-arm64": "0.24.2", + "@esbuild/netbsd-x64": "0.24.2", + "@esbuild/openbsd-arm64": "0.24.2", + "@esbuild/openbsd-x64": "0.24.2", + "@esbuild/sunos-x64": "0.24.2", + "@esbuild/win32-arm64": "0.24.2", + "@esbuild/win32-ia32": "0.24.2", + "@esbuild/win32-x64": "0.24.2" + } + }, + "node_modules/esbuild-android-64": { + "version": "0.14.54", + "resolved": "https://registry.npmjs.org/esbuild-android-64/-/esbuild-android-64-0.14.54.tgz", + "integrity": "sha512-Tz2++Aqqz0rJ7kYBfz+iqyE3QMycD4vk7LBRyWaAVFgFtQ/O8EJOnVmTOiDWYZ/uYzB4kvP+bqejYdVKzE5lAQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-android-arm64": { + "version": "0.14.54", + "resolved": "https://registry.npmjs.org/esbuild-android-arm64/-/esbuild-android-arm64-0.14.54.tgz", + "integrity": "sha512-F9E+/QDi9sSkLaClO8SOV6etqPd+5DgJje1F9lOWoNncDdOBL2YF59IhsWATSt0TLZbYCf3pNlTHvVV5VfHdvg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-darwin-64": { + "version": "0.14.54", + "resolved": "https://registry.npmjs.org/esbuild-darwin-64/-/esbuild-darwin-64-0.14.54.tgz", + "integrity": "sha512-jtdKWV3nBviOd5v4hOpkVmpxsBy90CGzebpbO9beiqUYVMBtSc0AL9zGftFuBon7PNDcdvNCEuQqw2x0wP9yug==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-darwin-arm64": { + "version": "0.14.54", + "resolved": "https://registry.npmjs.org/esbuild-darwin-arm64/-/esbuild-darwin-arm64-0.14.54.tgz", + "integrity": "sha512-OPafJHD2oUPyvJMrsCvDGkRrVCar5aVyHfWGQzY1dWnzErjrDuSETxwA2HSsyg2jORLY8yBfzc1MIpUkXlctmw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-freebsd-64": { + "version": "0.14.54", + "resolved": "https://registry.npmjs.org/esbuild-freebsd-64/-/esbuild-freebsd-64-0.14.54.tgz", + "integrity": "sha512-OKwd4gmwHqOTp4mOGZKe/XUlbDJ4Q9TjX0hMPIDBUWWu/kwhBAudJdBoxnjNf9ocIB6GN6CPowYpR/hRCbSYAg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-freebsd-arm64": { + "version": "0.14.54", + "resolved": "https://registry.npmjs.org/esbuild-freebsd-arm64/-/esbuild-freebsd-arm64-0.14.54.tgz", + "integrity": "sha512-sFwueGr7OvIFiQT6WeG0jRLjkjdqWWSrfbVwZp8iMP+8UHEHRBvlaxL6IuKNDwAozNUmbb8nIMXa7oAOARGs1Q==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-linux-32": { + "version": "0.14.54", + "resolved": "https://registry.npmjs.org/esbuild-linux-32/-/esbuild-linux-32-0.14.54.tgz", + "integrity": "sha512-1ZuY+JDI//WmklKlBgJnglpUL1owm2OX+8E1syCD6UAxcMM/XoWd76OHSjl/0MR0LisSAXDqgjT3uJqT67O3qw==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-linux-64": { + "version": "0.14.54", + "resolved": "https://registry.npmjs.org/esbuild-linux-64/-/esbuild-linux-64-0.14.54.tgz", + "integrity": "sha512-EgjAgH5HwTbtNsTqQOXWApBaPVdDn7XcK+/PtJwZLT1UmpLoznPd8c5CxqsH2dQK3j05YsB3L17T8vE7cp4cCg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-linux-arm": { + "version": "0.14.54", + "resolved": "https://registry.npmjs.org/esbuild-linux-arm/-/esbuild-linux-arm-0.14.54.tgz", + "integrity": "sha512-qqz/SjemQhVMTnvcLGoLOdFpCYbz4v4fUo+TfsWG+1aOu70/80RV6bgNpR2JCrppV2moUQkww+6bWxXRL9YMGw==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-linux-arm64": { + "version": "0.14.54", + "resolved": "https://registry.npmjs.org/esbuild-linux-arm64/-/esbuild-linux-arm64-0.14.54.tgz", + "integrity": "sha512-WL71L+0Rwv+Gv/HTmxTEmpv0UgmxYa5ftZILVi2QmZBgX3q7+tDeOQNqGtdXSdsL8TQi1vIaVFHUPDe0O0kdig==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-linux-mips64le": { + "version": "0.14.54", + "resolved": "https://registry.npmjs.org/esbuild-linux-mips64le/-/esbuild-linux-mips64le-0.14.54.tgz", + "integrity": "sha512-qTHGQB8D1etd0u1+sB6p0ikLKRVuCWhYQhAHRPkO+OF3I/iSlTKNNS0Lh2Oc0g0UFGguaFZZiPJdJey3AGpAlw==", + "cpu": [ + "mips64el" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-linux-ppc64le": { + "version": "0.14.54", + "resolved": "https://registry.npmjs.org/esbuild-linux-ppc64le/-/esbuild-linux-ppc64le-0.14.54.tgz", + "integrity": "sha512-j3OMlzHiqwZBDPRCDFKcx595XVfOfOnv68Ax3U4UKZ3MTYQB5Yz3X1mn5GnodEVYzhtZgxEBidLWeIs8FDSfrQ==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-linux-riscv64": { + "version": "0.14.54", + "resolved": "https://registry.npmjs.org/esbuild-linux-riscv64/-/esbuild-linux-riscv64-0.14.54.tgz", + "integrity": "sha512-y7Vt7Wl9dkOGZjxQZnDAqqn+XOqFD7IMWiewY5SPlNlzMX39ocPQlOaoxvT4FllA5viyV26/QzHtvTjVNOxHZg==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-linux-s390x": { + "version": "0.14.54", + "resolved": "https://registry.npmjs.org/esbuild-linux-s390x/-/esbuild-linux-s390x-0.14.54.tgz", + "integrity": "sha512-zaHpW9dziAsi7lRcyV4r8dhfG1qBidQWUXweUjnw+lliChJqQr+6XD71K41oEIC3Mx1KStovEmlzm+MkGZHnHA==", + "cpu": [ + "s390x" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-netbsd-64": { + "version": "0.14.54", + "resolved": "https://registry.npmjs.org/esbuild-netbsd-64/-/esbuild-netbsd-64-0.14.54.tgz", + "integrity": "sha512-PR01lmIMnfJTgeU9VJTDY9ZerDWVFIUzAtJuDHwwceppW7cQWjBBqP48NdeRtoP04/AtO9a7w3viI+PIDr6d+w==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-openbsd-64": { + "version": "0.14.54", + "resolved": "https://registry.npmjs.org/esbuild-openbsd-64/-/esbuild-openbsd-64-0.14.54.tgz", + "integrity": "sha512-Qyk7ikT2o7Wu76UsvvDS5q0amJvmRzDyVlL0qf5VLsLchjCa1+IAvd8kTBgUxD7VBUUVgItLkk609ZHUc1oCaw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-sunos-64": { + "version": "0.14.54", + "resolved": "https://registry.npmjs.org/esbuild-sunos-64/-/esbuild-sunos-64-0.14.54.tgz", + "integrity": "sha512-28GZ24KmMSeKi5ueWzMcco6EBHStL3B6ubM7M51RmPwXQGLe0teBGJocmWhgwccA1GeFXqxzILIxXpHbl9Q/Kw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "sunos" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-windows-32": { + "version": "0.14.54", + "resolved": "https://registry.npmjs.org/esbuild-windows-32/-/esbuild-windows-32-0.14.54.tgz", + "integrity": "sha512-T+rdZW19ql9MjS7pixmZYVObd9G7kcaZo+sETqNH4RCkuuYSuv9AGHUVnPoP9hhuE1WM1ZimHz1CIBHBboLU7w==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-windows-64": { + "version": "0.14.54", + "resolved": "https://registry.npmjs.org/esbuild-windows-64/-/esbuild-windows-64-0.14.54.tgz", + "integrity": "sha512-AoHTRBUuYwXtZhjXZbA1pGfTo8cJo3vZIcWGLiUcTNgHpJJMC1rVA44ZereBHMJtotyN71S8Qw0npiCIkW96cQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-windows-arm64": { + "version": "0.14.54", + "resolved": "https://registry.npmjs.org/esbuild-windows-arm64/-/esbuild-windows-arm64-0.14.54.tgz", + "integrity": "sha512-M0kuUvXhot1zOISQGXwWn6YtS+Y/1RT9WrVIOywZnJHo3jCDyewAc79aKNQWFCQm+xNHVTq9h8dZKvygoXQQRg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/escape-string-regexp": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-5.0.0.tgz", + "integrity": "sha512-/veY75JbMK4j1yjvuUxuVsiS/hr/4iHs9FTT6cgTexxdE0Ly/glccBAkloH/DofkjRbZU3bnoj38mOmhkZ0lHw==", + "license": "MIT", + "peer": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/esprima": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", + "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", + "license": "BSD-2-Clause", + "peer": true, + "bin": { + "esparse": "bin/esparse.js", + "esvalidate": "bin/esvalidate.js" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/estree-walker": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-3.0.3.tgz", + "integrity": "sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==", + "license": "MIT", + "peer": true, + "dependencies": { + "@types/estree": "^1.0.0" + } + }, + "node_modules/event-target-shim": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/event-target-shim/-/event-target-shim-5.0.1.tgz", + "integrity": "sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==", + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/eventemitter3": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-5.0.1.tgz", + "integrity": "sha512-GWkBvjiSZK87ELrYOSESUYeVIc9mvLLf/nXalMOS5dYrgZq9o5OVkbZAVM06CVxYsCwH9BDZFPlQTlPA1j4ahA==", + "license": "MIT", + "peer": true + }, + "node_modules/events": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/events/-/events-3.3.0.tgz", + "integrity": "sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q==", + "license": "MIT", + "engines": { + "node": ">=0.8.x" + } + }, + "node_modules/exif-parser": { + "version": "0.1.12", + "resolved": "https://registry.npmjs.org/exif-parser/-/exif-parser-0.1.12.tgz", + "integrity": "sha512-c2bQfLNbMzLPmzQuOr8fy0csy84WmwnER81W88DzTp9CYNPJ6yzOj2EZAh9pywYpqHnshVLHQJ8WzldAyfY+Iw==" + }, + "node_modules/expand-template": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/expand-template/-/expand-template-2.0.3.tgz", + "integrity": "sha512-XYfuKMvj4O35f/pOXLObndIRvyQ+/+6AhODh+OKWj9S9498pHHn/IMszH+gt0fBCRWMNfk1ZSp5x3AifmnI2vg==", + "license": "(MIT OR WTFPL)", + "optional": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/exponential-backoff": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/exponential-backoff/-/exponential-backoff-3.1.2.tgz", + "integrity": "sha512-8QxYTVXUkuy7fIIoitQkPwGonB8F3Zj8eEO8Sqg9Zv/bkI7RJAzowee4gr81Hak/dUTpA2Z7VfQgoijjPNlUZA==", + "license": "Apache-2.0" + }, + "node_modules/extend": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", + "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==", + "license": "MIT", + "peer": true + }, + "node_modules/fast-glob": { + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.3.tgz", + "integrity": "sha512-7MptL8U0cqcFdzIzwOTHoilX9x5BrNqye7Z/LuC7kCMRio1EMSyqRK3BEAUD7sXRq4iT4AzTVuZdhgQ2TCvYLg==", + "license": "MIT", + "peer": true, + "dependencies": { + "@nodelib/fs.stat": "^2.0.2", + "@nodelib/fs.walk": "^1.2.3", + "glob-parent": "^5.1.2", + "merge2": "^1.3.0", + "micromatch": "^4.0.8" + }, + "engines": { + "node": ">=8.6.0" + } + }, + "node_modules/fastq": { + "version": "1.19.0", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.19.0.tgz", + "integrity": "sha512-7SFSRCNjBQIZH/xZR3iy5iQYR8aGBE0h3VG6/cwlbrpdciNYBMotQav8c1XI3HjHH+NikUpP53nPdlZSdWmFzA==", + "license": "ISC", + "peer": true, + "dependencies": { + "reusify": "^1.0.4" + } + }, + "node_modules/file-type": { + "version": "17.1.1", + "resolved": "https://registry.npmjs.org/file-type/-/file-type-17.1.1.tgz", + "integrity": "sha512-heRUMZHby2Qj6wZAA3YHeMlRmZNQTcb6VxctkGmM+mcM6ROQKvHpr7SS6EgdfEhH+s25LDshBjvPx/Ecm+bOVQ==", + "license": "MIT", + "dependencies": { + "readable-web-to-node-stream": "^3.0.2", + "strtok3": "^7.0.0-alpha.7", + "token-types": "^5.0.0-alpha.2" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sindresorhus/file-type?sponsor=1" + } + }, + "node_modules/fill-range": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", + "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", + "license": "MIT", + "peer": true, + "dependencies": { + "to-regex-range": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/find-cache-dir": { + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/find-cache-dir/-/find-cache-dir-3.3.2.tgz", + "integrity": "sha512-wXZV5emFEjrridIgED11OoUKLxiYjAcqot/NJdAkOhlJ+vGzwhOAfcG5OX1jP+S0PcjEn8bdMJv+g2jwQ3Onig==", + "license": "MIT", + "dependencies": { + "commondir": "^1.0.1", + "make-dir": "^3.0.2", + "pkg-dir": "^4.1.0" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/avajs/find-cache-dir?sponsor=1" + } + }, + "node_modules/find-up": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-6.3.0.tgz", + "integrity": "sha512-v2ZsoEuVHYy8ZIlYqwPe/39Cy+cFDzp4dXPaxNvkEuouymu+2Jbz0PxpKarJHYJTmv2HWT3O382qY8l4jMWthw==", + "license": "MIT", + "dependencies": { + "locate-path": "^7.1.0", + "path-exists": "^5.0.0" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/find-up-simple": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/find-up-simple/-/find-up-simple-1.0.0.tgz", + "integrity": "sha512-q7Us7kcjj2VMePAa02hDAF6d+MzsdsAWEwYyOpwUtlerRBkOEPBCRZrAV4XfcSN8fHAgaD0hP7miwoay6DCprw==", + "license": "MIT", + "peer": true, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/find-yarn-workspace-root2": { + "version": "1.2.16", + "resolved": "https://registry.npmjs.org/find-yarn-workspace-root2/-/find-yarn-workspace-root2-1.2.16.tgz", + "integrity": "sha512-hr6hb1w8ePMpPVUK39S4RlwJzi+xPLuVuG8XlwXU3KD5Yn3qgBWVfy3AzNlDhWvE1EORCE65/Qm26rFQt3VLVA==", + "license": "Apache-2.0", + "peer": true, + "dependencies": { + "micromatch": "^4.0.2", + "pkg-dir": "^4.2.0" + } + }, + "node_modules/flattie": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/flattie/-/flattie-1.1.1.tgz", + "integrity": "sha512-9UbaD6XdAL97+k/n+N7JwX46K/M6Zc6KcFYskrYL8wbBV/Uyk0CTAMY0VT+qiK5PM7AIc9aTWYtq65U7T+aCNQ==", + "license": "MIT", + "peer": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/follow-redirects": { + "version": "1.15.9", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.9.tgz", + "integrity": "sha512-gew4GsXizNgdoRyqmyfMHyAmXsZDk6mHkSxZFCzW9gwlbtOW44CDtYavM+y+72qD/Vq2l550kMF52DT8fOLJqQ==", + "funding": [ + { + "type": "individual", + "url": "https://github.com/sponsors/RubenVerborgh" + } + ], + "license": "MIT", + "engines": { + "node": ">=4.0" + }, + "peerDependenciesMeta": { + "debug": { + "optional": true + } + } + }, + "node_modules/foreground-child": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-3.3.0.tgz", + "integrity": "sha512-Ld2g8rrAyMYFXBhEqMz8ZAHBi4J4uS1i/CxGMDnjyFWddMXLVcDp051DZfu+t7+ab7Wv6SMqpWmyFIj5UbfFvg==", + "license": "ISC", + "dependencies": { + "cross-spawn": "^7.0.0", + "signal-exit": "^4.0.1" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/fs-constants": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs-constants/-/fs-constants-1.0.0.tgz", + "integrity": "sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow==", + "license": "MIT", + "optional": true + }, + "node_modules/fs-minipass": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-3.0.3.tgz", + "integrity": "sha512-XUBA9XClHbnJWSfBzjkm6RvPsyg3sryZt06BEQoXcF7EK/xpGaQYJgQKDJSUH5SGZ76Y7pFx1QBnXz09rU5Fbw==", + "license": "ISC", + "dependencies": { + "minipass": "^7.0.3" + }, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/fsevents": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "hasInstallScript": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "node_modules/function-bind": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", + "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-east-asian-width": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/get-east-asian-width/-/get-east-asian-width-1.3.0.tgz", + "integrity": "sha512-vpeMIQKxczTD/0s2CdEWHcb0eeJe6TFjxb+J5xgX7hScxqrGuyjmv4c1D4A/gelKfyox0gJJwIHF+fLjeaM8kQ==", + "license": "MIT", + "peer": true, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/get-func-name": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.2.tgz", + "integrity": "sha512-8vXOvuE167CtIc3OyItco7N/dpRtBbYOsPsXCz7X/PMnlGjYjSGuZJgM1Y7mmew7BKf9BqvLX2tnOVy1BBUsxQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": "*" + } + }, + "node_modules/gifwrap": { + "version": "0.9.4", + "resolved": "https://registry.npmjs.org/gifwrap/-/gifwrap-0.9.4.tgz", + "integrity": "sha512-MDMwbhASQuVeD4JKd1fKgNgCRL3fGqMM4WaqpNhWO0JiMOAjbQdumbs4BbBZEy9/M00EHEjKN3HieVhCUlwjeQ==", + "license": "MIT", + "dependencies": { + "image-q": "^4.0.0", + "omggif": "^1.0.10" + } + }, + "node_modules/github-from-package": { + "version": "0.0.0", + "resolved": "https://registry.npmjs.org/github-from-package/-/github-from-package-0.0.0.tgz", + "integrity": "sha512-SyHy3T1v2NUXn29OsWdxmK6RwHD+vkj3v8en8AOBZ1wBQ/hCAQ5bAQTD02kW4W9tUp/3Qh6J8r9EvntiyCmOOw==", + "license": "MIT", + "optional": true + }, + "node_modules/github-slugger": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/github-slugger/-/github-slugger-2.0.0.tgz", + "integrity": "sha512-IaOQ9puYtjrkq7Y0Ygl9KDZnrf/aiUJYUpVf89y8kyaxbRG7Y1SrX/jaumrv81vc61+kiMempujsM3Yw7w5qcw==", + "license": "ISC", + "peer": true + }, + "node_modules/glob": { + "version": "10.4.5", + "resolved": "https://registry.npmjs.org/glob/-/glob-10.4.5.tgz", + "integrity": "sha512-7Bv8RF0k6xjo7d4A/PxYLbUCfb6c+Vpd2/mB2yRDlew7Jb5hEXiCD9ibfO7wpk8i4sevK6DFny9h7EYbM3/sHg==", + "license": "ISC", + "dependencies": { + "foreground-child": "^3.1.0", + "jackspeak": "^3.1.2", + "minimatch": "^9.0.4", + "minipass": "^7.1.2", + "package-json-from-dist": "^1.0.0", + "path-scurry": "^1.11.1" + }, + "bin": { + "glob": "dist/esm/bin.mjs" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "license": "ISC", + "peer": true, + "dependencies": { + "is-glob": "^4.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/global": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/global/-/global-4.4.0.tgz", + "integrity": "sha512-wv/LAoHdRE3BeTGz53FAamhGlPLhlssK45usmGFThIi4XqnBmjKQ16u+RNbP7WvigRZDxUsM0J3gcQ5yicaL0w==", + "license": "MIT", + "dependencies": { + "min-document": "^2.19.0", + "process": "^0.11.10" + } + }, + "node_modules/graceful-fs": { + "version": "4.2.11", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", + "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==", + "license": "ISC" + }, + "node_modules/h3": { + "version": "1.15.0", + "resolved": "https://registry.npmjs.org/h3/-/h3-1.15.0.tgz", + "integrity": "sha512-OsjX4JW8J4XGgCgEcad20pepFQWnuKH+OwkCJjogF3C+9AZ1iYdtB4hX6vAb5DskBiu5ljEXqApINjR8CqoCMQ==", + "license": "MIT", + "peer": true, + "dependencies": { + "cookie-es": "^1.2.2", + "crossws": "^0.3.3", + "defu": "^6.1.4", + "destr": "^2.0.3", + "iron-webcrypto": "^1.2.1", + "node-mock-http": "^1.0.0", + "ohash": "^1.1.4", + "radix3": "^1.1.2", + "ufo": "^1.5.4", + "uncrypto": "^0.1.3" + } + }, + "node_modules/hasown": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz", + "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/hast-util-from-html": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/hast-util-from-html/-/hast-util-from-html-2.0.3.tgz", + "integrity": "sha512-CUSRHXyKjzHov8yKsQjGOElXy/3EKpyX56ELnkHH34vDVw1N1XSQ1ZcAvTyAPtGqLTuKP/uxM+aLkSPqF/EtMw==", + "license": "MIT", + "peer": true, + "dependencies": { + "@types/hast": "^3.0.0", + "devlop": "^1.1.0", + "hast-util-from-parse5": "^8.0.0", + "parse5": "^7.0.0", + "vfile": "^6.0.0", + "vfile-message": "^4.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/hast-util-from-parse5": { + "version": "8.0.2", + "resolved": "https://registry.npmjs.org/hast-util-from-parse5/-/hast-util-from-parse5-8.0.2.tgz", + "integrity": "sha512-SfMzfdAi/zAoZ1KkFEyyeXBn7u/ShQrfd675ZEE9M3qj+PMFX05xubzRyF76CCSJu8au9jgVxDV1+okFvgZU4A==", + "license": "MIT", + "peer": true, + "dependencies": { + "@types/hast": "^3.0.0", + "@types/unist": "^3.0.0", + "devlop": "^1.0.0", + "hastscript": "^9.0.0", + "property-information": "^6.0.0", + "vfile": "^6.0.0", + "vfile-location": "^5.0.0", + "web-namespaces": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/hast-util-is-element": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/hast-util-is-element/-/hast-util-is-element-3.0.0.tgz", + "integrity": "sha512-Val9mnv2IWpLbNPqc/pUem+a7Ipj2aHacCwgNfTiK0vJKl0LF+4Ba4+v1oPHFpf3bLYmreq0/l3Gud9S5OH42g==", + "license": "MIT", + "peer": true, + "dependencies": { + "@types/hast": "^3.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/hast-util-parse-selector": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/hast-util-parse-selector/-/hast-util-parse-selector-4.0.0.tgz", + "integrity": "sha512-wkQCkSYoOGCRKERFWcxMVMOcYE2K1AaNLU8DXS9arxnLOUEWbOXKXiJUNzEpqZ3JOKpnha3jkFrumEjVliDe7A==", + "license": "MIT", + "peer": true, + "dependencies": { + "@types/hast": "^3.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/hast-util-raw": { + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/hast-util-raw/-/hast-util-raw-9.1.0.tgz", + "integrity": "sha512-Y8/SBAHkZGoNkpzqqfCldijcuUKh7/su31kEBp67cFY09Wy0mTRgtsLYsiIxMJxlu0f6AA5SUTbDR8K0rxnbUw==", + "license": "MIT", + "peer": true, + "dependencies": { + "@types/hast": "^3.0.0", + "@types/unist": "^3.0.0", + "@ungap/structured-clone": "^1.0.0", + "hast-util-from-parse5": "^8.0.0", + "hast-util-to-parse5": "^8.0.0", + "html-void-elements": "^3.0.0", + "mdast-util-to-hast": "^13.0.0", + "parse5": "^7.0.0", + "unist-util-position": "^5.0.0", + "unist-util-visit": "^5.0.0", + "vfile": "^6.0.0", + "web-namespaces": "^2.0.0", + "zwitch": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/hast-util-to-html": { + "version": "9.0.4", + "resolved": "https://registry.npmjs.org/hast-util-to-html/-/hast-util-to-html-9.0.4.tgz", + "integrity": "sha512-wxQzXtdbhiwGAUKrnQJXlOPmHnEehzphwkK7aluUPQ+lEc1xefC8pblMgpp2w5ldBTEfveRIrADcrhGIWrlTDA==", + "license": "MIT", + "peer": true, + "dependencies": { + "@types/hast": "^3.0.0", + "@types/unist": "^3.0.0", + "ccount": "^2.0.0", + "comma-separated-tokens": "^2.0.0", + "hast-util-whitespace": "^3.0.0", + "html-void-elements": "^3.0.0", + "mdast-util-to-hast": "^13.0.0", + "property-information": "^6.0.0", + "space-separated-tokens": "^2.0.0", + "stringify-entities": "^4.0.0", + "zwitch": "^2.0.4" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/hast-util-to-parse5": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/hast-util-to-parse5/-/hast-util-to-parse5-8.0.0.tgz", + "integrity": "sha512-3KKrV5ZVI8if87DVSi1vDeByYrkGzg4mEfeu4alwgmmIeARiBLKCZS2uw5Gb6nU9x9Yufyj3iudm6i7nl52PFw==", + "license": "MIT", + "peer": true, + "dependencies": { + "@types/hast": "^3.0.0", + "comma-separated-tokens": "^2.0.0", + "devlop": "^1.0.0", + "property-information": "^6.0.0", + "space-separated-tokens": "^2.0.0", + "web-namespaces": "^2.0.0", + "zwitch": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/hast-util-to-text": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/hast-util-to-text/-/hast-util-to-text-4.0.2.tgz", + "integrity": "sha512-KK6y/BN8lbaq654j7JgBydev7wuNMcID54lkRav1P0CaE1e47P72AWWPiGKXTJU271ooYzcvTAn/Zt0REnvc7A==", + "license": "MIT", + "peer": true, + "dependencies": { + "@types/hast": "^3.0.0", + "@types/unist": "^3.0.0", + "hast-util-is-element": "^3.0.0", + "unist-util-find-after": "^5.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/hast-util-whitespace": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/hast-util-whitespace/-/hast-util-whitespace-3.0.0.tgz", + "integrity": "sha512-88JUN06ipLwsnv+dVn+OIYOvAuvBMy/Qoi6O7mQHxdPXpjy+Cd6xRkWwux7DKO+4sYILtLBRIKgsdpS2gQc7qw==", + "license": "MIT", + "peer": true, + "dependencies": { + "@types/hast": "^3.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/hastscript": { + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/hastscript/-/hastscript-9.0.0.tgz", + "integrity": "sha512-jzaLBGavEDKHrc5EfFImKN7nZKKBdSLIdGvCwDZ9TfzbF2ffXiov8CKE445L2Z1Ek2t/m4SKQ2j6Ipv7NyUolw==", + "license": "MIT", + "peer": true, + "dependencies": { + "@types/hast": "^3.0.0", + "comma-separated-tokens": "^2.0.0", + "hast-util-parse-selector": "^4.0.0", + "property-information": "^6.0.0", + "space-separated-tokens": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/html-escaper": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/html-escaper/-/html-escaper-3.0.3.tgz", + "integrity": "sha512-RuMffC89BOWQoY0WKGpIhn5gX3iI54O6nRA0yC124NYVtzjmFWBIiFd8M0x+ZdX0P9R4lADg1mgP8C7PxGOWuQ==", + "license": "MIT", + "peer": true + }, + "node_modules/html-void-elements": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/html-void-elements/-/html-void-elements-3.0.0.tgz", + "integrity": "sha512-bEqo66MRXsUGxWHV5IP0PUiAWwoEjba4VCzg0LjFJBpchPaTfyfCKTG6bc5F8ucKec3q5y6qOdGyYTSBEvhCrg==", + "license": "MIT", + "peer": true, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/http-cache-semantics": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.1.1.tgz", + "integrity": "sha512-er295DKPVsV82j5kw1Gjt+ADA/XYHsajl82cGNQG2eyoPkvgUhX+nDIyelzhIWbbsXP39EHcI6l5tYs2FYqYXQ==", + "license": "BSD-2-Clause" + }, + "node_modules/http-proxy-agent": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-7.0.2.tgz", + "integrity": "sha512-T1gkAiYYDWYx3V5Bmyu7HcfcvL7mUrTWiM6yOfa3PIphViJ/gFPbvidQ+veqSOHci/PxBcDabeUNCzpOODJZig==", + "license": "MIT", + "dependencies": { + "agent-base": "^7.1.0", + "debug": "^4.3.4" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/https-proxy-agent": { + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-7.0.6.tgz", + "integrity": "sha512-vK9P5/iUfdl95AI+JVyUuIcVtd4ofvtrOr3HNtM2yxC9bnMbEdp3x01OhQNnjb8IJYi38VlTE3mBXwcfvywuSw==", + "license": "MIT", + "dependencies": { + "agent-base": "^7.1.2", + "debug": "4" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/iconv-lite": { + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz", + "integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==", + "license": "MIT", + "optional": true, + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/ieee754": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", + "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "BSD-3-Clause" + }, + "node_modules/image-q": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/image-q/-/image-q-4.0.0.tgz", + "integrity": "sha512-PfJGVgIfKQJuq3s0tTDOKtztksibuUEbJQIYT3by6wctQo+Rdlh7ef4evJ5NCdxY4CfMbvFkocEwbl4BF8RlJw==", + "license": "MIT", + "dependencies": { + "@types/node": "16.9.1" + } + }, + "node_modules/image-q/node_modules/@types/node": { + "version": "16.9.1", + "resolved": "https://registry.npmjs.org/@types/node/-/node-16.9.1.tgz", + "integrity": "sha512-QpLcX9ZSsq3YYUUnD3nFDY8H7wctAhQj/TFKL8Ya8v5fMm3CFXxo8zStsLAl780ltoYoo1WvKUVGBQK+1ifr7g==", + "license": "MIT" + }, + "node_modules/imagetools-core": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/imagetools-core/-/imagetools-core-3.0.2.tgz", + "integrity": "sha512-DlArpNiefCc1syIqvOONcE8L8IahN8GjwaEjm6wIJIvuKoFoI1RcKmWWfS2dYxSlTiSp2X5b3JnHDjUXmWqlVA==", + "license": "MIT", + "optional": true, + "dependencies": { + "sharp": "^0.29.3" + }, + "engines": { + "node": ">=12.0.0" + } + }, + "node_modules/imagetools-core/node_modules/detect-libc": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-1.0.3.tgz", + "integrity": "sha512-pGjwhsmsp4kL2RTz08wcOlGN83otlqHeD/Z5T8GXZB+/YcpQ/dgo+lbU8ZsGxV0HIvqqxo9l7mqYwyYMD9bKDg==", + "license": "Apache-2.0", + "optional": true, + "bin": { + "detect-libc": "bin/detect-libc.js" + }, + "engines": { + "node": ">=0.10" + } + }, + "node_modules/imagetools-core/node_modules/node-addon-api": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-4.3.0.tgz", + "integrity": "sha512-73sE9+3UaLYYFmDsFZnqCInzPyh3MqIwZO9cw58yIqAZhONrrabrYyYe3TuIqtIiOuTXVhsGau8hcrhhwSsDIQ==", + "license": "MIT", + "optional": true + }, + "node_modules/imagetools-core/node_modules/sharp": { + "version": "0.29.3", + "resolved": "https://registry.npmjs.org/sharp/-/sharp-0.29.3.tgz", + "integrity": "sha512-fKWUuOw77E4nhpyzCCJR1ayrttHoFHBT2U/kR/qEMRhvPEcluG4BKj324+SCO1e84+knXHwhJ1HHJGnUt4ElGA==", + "hasInstallScript": true, + "license": "Apache-2.0", + "optional": true, + "dependencies": { + "color": "^4.0.1", + "detect-libc": "^1.0.3", + "node-addon-api": "^4.2.0", + "prebuild-install": "^7.0.0", + "semver": "^7.3.5", + "simple-get": "^4.0.0", + "tar-fs": "^2.1.1", + "tunnel-agent": "^0.6.0" + }, + "engines": { + "node": ">=12.13.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/import-meta-resolve": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/import-meta-resolve/-/import-meta-resolve-4.1.0.tgz", + "integrity": "sha512-I6fiaX09Xivtk+THaMfAwnA3MVA5Big1WHF1Dfx9hFuvNIWpXnorlkzhcQf6ehrqQiiZECRt1poOAkPmer3ruw==", + "license": "MIT", + "peer": true, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/imurmurhash": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", + "integrity": "sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==", + "license": "MIT", + "engines": { + "node": ">=0.8.19" + } + }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "license": "ISC", + "optional": true + }, + "node_modules/ini": { + "version": "1.3.8", + "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz", + "integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==", + "license": "ISC", + "optional": true + }, + "node_modules/ip-address": { + "version": "9.0.5", + "resolved": "https://registry.npmjs.org/ip-address/-/ip-address-9.0.5.tgz", + "integrity": "sha512-zHtQzGojZXTwZTHQqra+ETKd4Sn3vgi7uBmlPoXVWZqYvuKmtI0l/VZTjqGmJY9x88GGOaZ9+G9ES8hC4T4X8g==", + "license": "MIT", + "dependencies": { + "jsbn": "1.1.0", + "sprintf-js": "^1.1.3" + }, + "engines": { + "node": ">= 12" + } + }, + "node_modules/ip-address/node_modules/sprintf-js": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.1.3.tgz", + "integrity": "sha512-Oo+0REFV59/rz3gfJNKQiBlwfHaSESl1pcGyABQsnnIfWOFt6JNj5gCog2U6MLZ//IGYD+nA8nI+mTShREReaA==", + "license": "BSD-3-Clause" + }, + "node_modules/iron-webcrypto": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/iron-webcrypto/-/iron-webcrypto-1.2.1.tgz", + "integrity": "sha512-feOM6FaSr6rEABp/eDfVseKyTMDt+KGpeB35SkVn9Tyn0CqvVsY3EwI0v5i8nMHyJnzCIQf7nsy3p41TPkJZhg==", + "license": "MIT", + "peer": true, + "funding": { + "url": "https://github.com/sponsors/brc-dd" + } + }, + "node_modules/is-arrayish": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.3.2.tgz", + "integrity": "sha512-eVRqCvVlZbuw3GrM63ovNSNAeA1K16kaR/LRY/92w0zxQ5/1YzwblUX652i4Xs9RwAGjW9d9y6X88t8OaAJfWQ==", + "license": "MIT" + }, + "node_modules/is-binary-path": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", + "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", + "license": "MIT", + "peer": true, + "dependencies": { + "binary-extensions": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/is-core-module": { + "version": "2.16.1", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.16.1.tgz", + "integrity": "sha512-UfoeMA6fIJ8wTYFEUjelnaGI67v6+N7qXJEvQuIGa99l4xsCruSYOVSQ0uPANn4dAzm8lkYPaKLrrijLq7x23w==", + "dev": true, + "license": "MIT", + "dependencies": { + "hasown": "^2.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-docker": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-docker/-/is-docker-3.0.0.tgz", + "integrity": "sha512-eljcgEDlEns/7AXFosB5K/2nCM4P7FQPkGc/DWLy5rmFEWvZayGrik1d9/QIY5nJ4f9YsVvBkA6kJpHn9rISdQ==", + "license": "MIT", + "peer": true, + "bin": { + "is-docker": "cli.js" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", + "license": "MIT", + "peer": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/is-function": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-function/-/is-function-1.0.2.tgz", + "integrity": "sha512-lw7DUp0aWXYg+CBCN+JKkcE0Q2RayZnSvnZBlwgxHBQhqt5pZNVy4Ri7H9GmmXkdu7LUthszM+Tor1u/2iBcpQ==", + "license": "MIT" + }, + "node_modules/is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "license": "MIT", + "peer": true, + "dependencies": { + "is-extglob": "^2.1.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-inside-container": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-inside-container/-/is-inside-container-1.0.0.tgz", + "integrity": "sha512-KIYLCCJghfHZxqjYBE7rEy0OBuTd5xCHS7tHVgvCLkx7StIoaxwNW3hCALgEUjFfeRk+MG/Qxmp/vtETEF3tRA==", + "license": "MIT", + "peer": true, + "dependencies": { + "is-docker": "^3.0.0" + }, + "bin": { + "is-inside-container": "cli.js" + }, + "engines": { + "node": ">=14.16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "license": "MIT", + "peer": true, + "engines": { + "node": ">=0.12.0" + } + }, + "node_modules/is-plain-obj": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-4.1.0.tgz", + "integrity": "sha512-+Pgi+vMuUNkJyExiMBt5IlFoMyKnr5zhJ4Uspz58WOhBF5QoIZkFyNHIbBAtHwzVAgk5RtndVNsDRN61/mmDqg==", + "license": "MIT", + "peer": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/is-wsl": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-3.1.0.tgz", + "integrity": "sha512-UcVfVfaK4Sc4m7X3dUSoHoozQGBEFeDC+zVo06t98xe8CzHSZZBekNXH+tu0NalHolcJ/QAGqS46Hef7QXBIMw==", + "license": "MIT", + "peer": true, + "dependencies": { + "is-inside-container": "^1.0.0" + }, + "engines": { + "node": ">=16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/isexe": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-3.1.1.tgz", + "integrity": "sha512-LpB/54B+/2J5hqQ7imZHfdU31OlgQqx7ZicVlkm9kzg9/w8GKLEcFfJl/t7DCEDueOyBAD6zCCwTO6Fzs0NoEQ==", + "license": "ISC", + "engines": { + "node": ">=16" + } + }, + "node_modules/jackspeak": { + "version": "3.4.3", + "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-3.4.3.tgz", + "integrity": "sha512-OGlZQpz2yfahA/Rd1Y8Cd9SIEsqvXkLVoSw/cgwhnhFMDbsQFeZYoJJ7bIZBS9BcamUW96asq/npPWugM+RQBw==", + "license": "BlueOak-1.0.0", + "dependencies": { + "@isaacs/cliui": "^8.0.2" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + }, + "optionalDependencies": { + "@pkgjs/parseargs": "^0.11.0" + } + }, + "node_modules/jimp": { + "version": "0.14.0", + "resolved": "https://registry.npmjs.org/jimp/-/jimp-0.14.0.tgz", + "integrity": "sha512-8BXU+J8+SPmwwyq9ELihpSV4dWPTiOKBWCEgtkbnxxAVMjXdf3yGmyaLSshBfXc8sP/JQ9OZj5R8nZzz2wPXgA==", + "license": "MIT", + "dependencies": { + "@babel/runtime": "^7.7.2", + "@jimp/custom": "^0.14.0", + "@jimp/plugins": "^0.14.0", + "@jimp/types": "^0.14.0", + "regenerator-runtime": "^0.13.3" + } + }, + "node_modules/jpeg-js": { + "version": "0.4.4", + "resolved": "https://registry.npmjs.org/jpeg-js/-/jpeg-js-0.4.4.tgz", + "integrity": "sha512-WZzeDOEtTOBK4Mdsar0IqEU5sMr3vSV2RqkAIzUEV2BHnUfKGyswWFPFwK5EeDo93K3FohSHbLAjj0s1Wzd+dg==", + "license": "BSD-3-Clause" + }, + "node_modules/js-yaml": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", + "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", + "license": "MIT", + "peer": true, + "dependencies": { + "argparse": "^2.0.1" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "node_modules/jsbn": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-1.1.0.tgz", + "integrity": "sha512-4bYVV3aAMtDTTu4+xsDYa6sy9GyJ69/amsu9sYF2zqjiEoZA5xJi3BrfX3uY+/IekIu7MwdObdbDWpoZdBv3/A==", + "license": "MIT" + }, + "node_modules/kleur": { + "version": "4.1.5", + "resolved": "https://registry.npmjs.org/kleur/-/kleur-4.1.5.tgz", + "integrity": "sha512-o+NO+8WrRiQEE4/7nwRJhN1HWpVmJm511pBHUxPLtp0BUISzlBplORYSmTclCnJvQq2tKu/sgl3xVpkc7ZWuQQ==", + "license": "MIT", + "peer": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/load-bmfont": { + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/load-bmfont/-/load-bmfont-1.4.2.tgz", + "integrity": "sha512-qElWkmjW9Oq1F9EI5Gt7aD9zcdHb9spJCW1L/dmPf7KzCCEJxq8nhHz5eCgI9aMf7vrG/wyaCqdsI+Iy9ZTlog==", + "license": "MIT", + "dependencies": { + "buffer-equal": "0.0.1", + "mime": "^1.3.4", + "parse-bmfont-ascii": "^1.0.3", + "parse-bmfont-binary": "^1.0.5", + "parse-bmfont-xml": "^1.1.4", + "phin": "^3.7.1", + "xhr": "^2.0.1", + "xtend": "^4.0.0" + } + }, + "node_modules/load-bmfont/node_modules/phin": { + "version": "3.7.1", + "resolved": "https://registry.npmjs.org/phin/-/phin-3.7.1.tgz", + "integrity": "sha512-GEazpTWwTZaEQ9RhL7Nyz0WwqilbqgLahDM3D0hxWwmVDI52nXEybHqiN6/elwpkJBhcuj+WbBu+QfT0uhPGfQ==", + "license": "MIT", + "dependencies": { + "centra": "^2.7.0" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/load-yaml-file": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/load-yaml-file/-/load-yaml-file-0.2.0.tgz", + "integrity": "sha512-OfCBkGEw4nN6JLtgRidPX6QxjBQGQf72q3si2uvqyFEMbycSFFHwAZeXx6cJgFM9wmLrf9zBwCP3Ivqa+LLZPw==", + "license": "MIT", + "peer": true, + "dependencies": { + "graceful-fs": "^4.1.5", + "js-yaml": "^3.13.0", + "pify": "^4.0.1", + "strip-bom": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/load-yaml-file/node_modules/argparse": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", + "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", + "license": "MIT", + "peer": true, + "dependencies": { + "sprintf-js": "~1.0.2" + } + }, + "node_modules/load-yaml-file/node_modules/js-yaml": { + "version": "3.14.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz", + "integrity": "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==", + "license": "MIT", + "peer": true, + "dependencies": { + "argparse": "^1.0.7", + "esprima": "^4.0.0" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "node_modules/local-pkg": { + "version": "0.4.3", + "resolved": "https://registry.npmjs.org/local-pkg/-/local-pkg-0.4.3.tgz", + "integrity": "sha512-SFppqq5p42fe2qcZQqqEOiVRXl+WCP1MdT6k7BDEW1j++sp5fIY+/fdRQitvKgB5BrBcmrs5m/L0v2FrU5MY1g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/antfu" + } + }, + "node_modules/locate-path": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-7.2.0.tgz", + "integrity": "sha512-gvVijfZvn7R+2qyPX8mAuKcFGDf6Nc61GdvGafQsHL0sBIxfKzA+usWn4GFC/bk+QdwPUD4kWFJLhElipq+0VA==", + "license": "MIT", + "dependencies": { + "p-locate": "^6.0.0" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/longest-streak": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/longest-streak/-/longest-streak-3.1.0.tgz", + "integrity": "sha512-9Ri+o0JYgehTaVBBDoMqIl8GXtbWg711O3srftcHhZ0dqnETqLaoIK0x17fUw9rFSlK/0NlsKe0Ahhyl5pXE2g==", + "license": "MIT", + "peer": true, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/loupe": { + "version": "2.3.7", + "resolved": "https://registry.npmjs.org/loupe/-/loupe-2.3.7.tgz", + "integrity": "sha512-zSMINGVYkdpYSOBmLi0D1Uo7JU9nVdQKrHxC8eYlV+9YKK9WePqAlL7lSlorG/U2Fw1w0hTBmaa/jrQ3UbPHtA==", + "dev": true, + "license": "MIT", + "dependencies": { + "get-func-name": "^2.0.1" + } + }, + "node_modules/lru-cache": { + "version": "10.4.3", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.4.3.tgz", + "integrity": "sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ==", + "license": "ISC" + }, + "node_modules/magic-string": { + "version": "0.30.17", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.17.tgz", + "integrity": "sha512-sNPKHvyjVf7gyjwS4xGTaW/mCnF8wnjtifKBEhxfZ7E/S8tQ0rssrwGNn6q8JH/ohItJfSQp9mBtQYuTlH5QnA==", + "license": "MIT", + "peer": true, + "dependencies": { + "@jridgewell/sourcemap-codec": "^1.5.0" + } + }, + "node_modules/magicast": { + "version": "0.3.5", + "resolved": "https://registry.npmjs.org/magicast/-/magicast-0.3.5.tgz", + "integrity": "sha512-L0WhttDl+2BOsybvEOLK7fW3UA0OQ0IQ2d6Zl2x/a6vVRs3bAY0ECOSHHeL5jD+SbOpOCUEi0y1DgHEn9Qn1AQ==", + "license": "MIT", + "peer": true, + "dependencies": { + "@babel/parser": "^7.25.4", + "@babel/types": "^7.25.4", + "source-map-js": "^1.2.0" + } + }, + "node_modules/make-dir": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz", + "integrity": "sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==", + "license": "MIT", + "dependencies": { + "semver": "^6.0.0" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/make-dir/node_modules/semver": { + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + } + }, + "node_modules/make-fetch-happen": { + "version": "14.0.3", + "resolved": "https://registry.npmjs.org/make-fetch-happen/-/make-fetch-happen-14.0.3.tgz", + "integrity": "sha512-QMjGbFTP0blj97EeidG5hk/QhKQ3T4ICckQGLgz38QF7Vgbk6e6FTARN8KhKxyBbWn8R0HU+bnw8aSoFPD4qtQ==", + "license": "ISC", + "dependencies": { + "@npmcli/agent": "^3.0.0", + "cacache": "^19.0.1", + "http-cache-semantics": "^4.1.1", + "minipass": "^7.0.2", + "minipass-fetch": "^4.0.0", + "minipass-flush": "^1.0.5", + "minipass-pipeline": "^1.2.4", + "negotiator": "^1.0.0", + "proc-log": "^5.0.0", + "promise-retry": "^2.0.1", + "ssri": "^12.0.0" + }, + "engines": { + "node": "^18.17.0 || >=20.5.0" + } + }, + "node_modules/markdown-table": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/markdown-table/-/markdown-table-3.0.4.tgz", + "integrity": "sha512-wiYz4+JrLyb/DqW2hkFJxP7Vd7JuTDm77fvbM8VfEQdmSMqcImWeeRbHwZjBjIFki/VaMK2BhFi7oUUZeM5bqw==", + "license": "MIT", + "peer": true, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/mdast-util-definitions": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/mdast-util-definitions/-/mdast-util-definitions-6.0.0.tgz", + "integrity": "sha512-scTllyX6pnYNZH/AIp/0ePz6s4cZtARxImwoPJ7kS42n+MnVsI4XbnG6d4ibehRIldYMWM2LD7ImQblVhUejVQ==", + "license": "MIT", + "peer": true, + "dependencies": { + "@types/mdast": "^4.0.0", + "@types/unist": "^3.0.0", + "unist-util-visit": "^5.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-find-and-replace": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/mdast-util-find-and-replace/-/mdast-util-find-and-replace-3.0.2.tgz", + "integrity": "sha512-Tmd1Vg/m3Xz43afeNxDIhWRtFZgM2VLyaf4vSTYwudTyeuTneoL3qtWMA5jeLyz/O1vDJmmV4QuScFCA2tBPwg==", + "license": "MIT", + "peer": true, + "dependencies": { + "@types/mdast": "^4.0.0", + "escape-string-regexp": "^5.0.0", + "unist-util-is": "^6.0.0", + "unist-util-visit-parents": "^6.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-from-markdown": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/mdast-util-from-markdown/-/mdast-util-from-markdown-2.0.2.tgz", + "integrity": "sha512-uZhTV/8NBuw0WHkPTrCqDOl0zVe1BIng5ZtHoDk49ME1qqcjYmmLmOf0gELgcRMxN4w2iuIeVso5/6QymSrgmA==", + "license": "MIT", + "peer": true, + "dependencies": { + "@types/mdast": "^4.0.0", + "@types/unist": "^3.0.0", + "decode-named-character-reference": "^1.0.0", + "devlop": "^1.0.0", + "mdast-util-to-string": "^4.0.0", + "micromark": "^4.0.0", + "micromark-util-decode-numeric-character-reference": "^2.0.0", + "micromark-util-decode-string": "^2.0.0", + "micromark-util-normalize-identifier": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0", + "unist-util-stringify-position": "^4.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-gfm": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/mdast-util-gfm/-/mdast-util-gfm-3.1.0.tgz", + "integrity": "sha512-0ulfdQOM3ysHhCJ1p06l0b0VKlhU0wuQs3thxZQagjcjPrlFRqY215uZGHHJan9GEAXd9MbfPjFJz+qMkVR6zQ==", + "license": "MIT", + "peer": true, + "dependencies": { + "mdast-util-from-markdown": "^2.0.0", + "mdast-util-gfm-autolink-literal": "^2.0.0", + "mdast-util-gfm-footnote": "^2.0.0", + "mdast-util-gfm-strikethrough": "^2.0.0", + "mdast-util-gfm-table": "^2.0.0", + "mdast-util-gfm-task-list-item": "^2.0.0", + "mdast-util-to-markdown": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-gfm-autolink-literal": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/mdast-util-gfm-autolink-literal/-/mdast-util-gfm-autolink-literal-2.0.1.tgz", + "integrity": "sha512-5HVP2MKaP6L+G6YaxPNjuL0BPrq9orG3TsrZ9YXbA3vDw/ACI4MEsnoDpn6ZNm7GnZgtAcONJyPhOP8tNJQavQ==", + "license": "MIT", + "peer": true, + "dependencies": { + "@types/mdast": "^4.0.0", + "ccount": "^2.0.0", + "devlop": "^1.0.0", + "mdast-util-find-and-replace": "^3.0.0", + "micromark-util-character": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-gfm-footnote": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/mdast-util-gfm-footnote/-/mdast-util-gfm-footnote-2.1.0.tgz", + "integrity": "sha512-sqpDWlsHn7Ac9GNZQMeUzPQSMzR6Wv0WKRNvQRg0KqHh02fpTz69Qc1QSseNX29bhz1ROIyNyxExfawVKTm1GQ==", + "license": "MIT", + "peer": true, + "dependencies": { + "@types/mdast": "^4.0.0", + "devlop": "^1.1.0", + "mdast-util-from-markdown": "^2.0.0", + "mdast-util-to-markdown": "^2.0.0", + "micromark-util-normalize-identifier": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-gfm-strikethrough": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/mdast-util-gfm-strikethrough/-/mdast-util-gfm-strikethrough-2.0.0.tgz", + "integrity": "sha512-mKKb915TF+OC5ptj5bJ7WFRPdYtuHv0yTRxK2tJvi+BDqbkiG7h7u/9SI89nRAYcmap2xHQL9D+QG/6wSrTtXg==", + "license": "MIT", + "peer": true, + "dependencies": { + "@types/mdast": "^4.0.0", + "mdast-util-from-markdown": "^2.0.0", + "mdast-util-to-markdown": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-gfm-table": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/mdast-util-gfm-table/-/mdast-util-gfm-table-2.0.0.tgz", + "integrity": "sha512-78UEvebzz/rJIxLvE7ZtDd/vIQ0RHv+3Mh5DR96p7cS7HsBhYIICDBCu8csTNWNO6tBWfqXPWekRuj2FNOGOZg==", + "license": "MIT", + "peer": true, + "dependencies": { + "@types/mdast": "^4.0.0", + "devlop": "^1.0.0", + "markdown-table": "^3.0.0", + "mdast-util-from-markdown": "^2.0.0", + "mdast-util-to-markdown": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-gfm-task-list-item": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/mdast-util-gfm-task-list-item/-/mdast-util-gfm-task-list-item-2.0.0.tgz", + "integrity": "sha512-IrtvNvjxC1o06taBAVJznEnkiHxLFTzgonUdy8hzFVeDun0uTjxxrRGVaNFqkU1wJR3RBPEfsxmU6jDWPofrTQ==", + "license": "MIT", + "peer": true, + "dependencies": { + "@types/mdast": "^4.0.0", + "devlop": "^1.0.0", + "mdast-util-from-markdown": "^2.0.0", + "mdast-util-to-markdown": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-phrasing": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/mdast-util-phrasing/-/mdast-util-phrasing-4.1.0.tgz", + "integrity": "sha512-TqICwyvJJpBwvGAMZjj4J2n0X8QWp21b9l0o7eXyVJ25YNWYbJDVIyD1bZXE6WtV6RmKJVYmQAKWa0zWOABz2w==", + "license": "MIT", + "peer": true, + "dependencies": { + "@types/mdast": "^4.0.0", + "unist-util-is": "^6.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-to-hast": { + "version": "13.2.0", + "resolved": "https://registry.npmjs.org/mdast-util-to-hast/-/mdast-util-to-hast-13.2.0.tgz", + "integrity": "sha512-QGYKEuUsYT9ykKBCMOEDLsU5JRObWQusAolFMeko/tYPufNkRffBAQjIE+99jbA87xv6FgmjLtwjh9wBWajwAA==", + "license": "MIT", + "peer": true, + "dependencies": { + "@types/hast": "^3.0.0", + "@types/mdast": "^4.0.0", + "@ungap/structured-clone": "^1.0.0", + "devlop": "^1.0.0", + "micromark-util-sanitize-uri": "^2.0.0", + "trim-lines": "^3.0.0", + "unist-util-position": "^5.0.0", + "unist-util-visit": "^5.0.0", + "vfile": "^6.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-to-markdown": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/mdast-util-to-markdown/-/mdast-util-to-markdown-2.1.2.tgz", + "integrity": "sha512-xj68wMTvGXVOKonmog6LwyJKrYXZPvlwabaryTjLh9LuvovB/KAH+kvi8Gjj+7rJjsFi23nkUxRQv1KqSroMqA==", + "license": "MIT", + "peer": true, + "dependencies": { + "@types/mdast": "^4.0.0", + "@types/unist": "^3.0.0", + "longest-streak": "^3.0.0", + "mdast-util-phrasing": "^4.0.0", + "mdast-util-to-string": "^4.0.0", + "micromark-util-classify-character": "^2.0.0", + "micromark-util-decode-string": "^2.0.0", + "unist-util-visit": "^5.0.0", + "zwitch": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-to-string": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/mdast-util-to-string/-/mdast-util-to-string-4.0.0.tgz", + "integrity": "sha512-0H44vDimn51F0YwvxSJSm0eCDOJTRlmN0R1yBh4HLj9wiV1Dn0QoXGbvFAWj2hSItVTlCmBF1hqKlIyUBVFLPg==", + "license": "MIT", + "peer": true, + "dependencies": { + "@types/mdast": "^4.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/merge2": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", + "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", + "license": "MIT", + "peer": true, + "engines": { + "node": ">= 8" + } + }, + "node_modules/micromark": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/micromark/-/micromark-4.0.1.tgz", + "integrity": "sha512-eBPdkcoCNvYcxQOAKAlceo5SNdzZWfF+FcSupREAzdAh9rRmE239CEQAiTwIgblwnoM8zzj35sZ5ZwvSEOF6Kw==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "peer": true, + "dependencies": { + "@types/debug": "^4.0.0", + "debug": "^4.0.0", + "decode-named-character-reference": "^1.0.0", + "devlop": "^1.0.0", + "micromark-core-commonmark": "^2.0.0", + "micromark-factory-space": "^2.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-chunked": "^2.0.0", + "micromark-util-combine-extensions": "^2.0.0", + "micromark-util-decode-numeric-character-reference": "^2.0.0", + "micromark-util-encode": "^2.0.0", + "micromark-util-normalize-identifier": "^2.0.0", + "micromark-util-resolve-all": "^2.0.0", + "micromark-util-sanitize-uri": "^2.0.0", + "micromark-util-subtokenize": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-core-commonmark": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/micromark-core-commonmark/-/micromark-core-commonmark-2.0.2.tgz", + "integrity": "sha512-FKjQKbxd1cibWMM1P9N+H8TwlgGgSkWZMmfuVucLCHaYqeSvJ0hFeHsIa65pA2nYbes0f8LDHPMrd9X7Ujxg9w==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "peer": true, + "dependencies": { + "decode-named-character-reference": "^1.0.0", + "devlop": "^1.0.0", + "micromark-factory-destination": "^2.0.0", + "micromark-factory-label": "^2.0.0", + "micromark-factory-space": "^2.0.0", + "micromark-factory-title": "^2.0.0", + "micromark-factory-whitespace": "^2.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-chunked": "^2.0.0", + "micromark-util-classify-character": "^2.0.0", + "micromark-util-html-tag-name": "^2.0.0", + "micromark-util-normalize-identifier": "^2.0.0", + "micromark-util-resolve-all": "^2.0.0", + "micromark-util-subtokenize": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-extension-gfm": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/micromark-extension-gfm/-/micromark-extension-gfm-3.0.0.tgz", + "integrity": "sha512-vsKArQsicm7t0z2GugkCKtZehqUm31oeGBV/KVSorWSy8ZlNAv7ytjFhvaryUiCUJYqs+NoE6AFhpQvBTM6Q4w==", + "license": "MIT", + "peer": true, + "dependencies": { + "micromark-extension-gfm-autolink-literal": "^2.0.0", + "micromark-extension-gfm-footnote": "^2.0.0", + "micromark-extension-gfm-strikethrough": "^2.0.0", + "micromark-extension-gfm-table": "^2.0.0", + "micromark-extension-gfm-tagfilter": "^2.0.0", + "micromark-extension-gfm-task-list-item": "^2.0.0", + "micromark-util-combine-extensions": "^2.0.0", + "micromark-util-types": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/micromark-extension-gfm-autolink-literal": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/micromark-extension-gfm-autolink-literal/-/micromark-extension-gfm-autolink-literal-2.1.0.tgz", + "integrity": "sha512-oOg7knzhicgQ3t4QCjCWgTmfNhvQbDDnJeVu9v81r7NltNCVmhPy1fJRX27pISafdjL+SVc4d3l48Gb6pbRypw==", + "license": "MIT", + "peer": true, + "dependencies": { + "micromark-util-character": "^2.0.0", + "micromark-util-sanitize-uri": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/micromark-extension-gfm-footnote": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/micromark-extension-gfm-footnote/-/micromark-extension-gfm-footnote-2.1.0.tgz", + "integrity": "sha512-/yPhxI1ntnDNsiHtzLKYnE3vf9JZ6cAisqVDauhp4CEHxlb4uoOTxOCJ+9s51bIB8U1N1FJ1RXOKTIlD5B/gqw==", + "license": "MIT", + "peer": true, + "dependencies": { + "devlop": "^1.0.0", + "micromark-core-commonmark": "^2.0.0", + "micromark-factory-space": "^2.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-normalize-identifier": "^2.0.0", + "micromark-util-sanitize-uri": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/micromark-extension-gfm-strikethrough": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/micromark-extension-gfm-strikethrough/-/micromark-extension-gfm-strikethrough-2.1.0.tgz", + "integrity": "sha512-ADVjpOOkjz1hhkZLlBiYA9cR2Anf8F4HqZUO6e5eDcPQd0Txw5fxLzzxnEkSkfnD0wziSGiv7sYhk/ktvbf1uw==", + "license": "MIT", + "peer": true, + "dependencies": { + "devlop": "^1.0.0", + "micromark-util-chunked": "^2.0.0", + "micromark-util-classify-character": "^2.0.0", + "micromark-util-resolve-all": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/micromark-extension-gfm-table": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/micromark-extension-gfm-table/-/micromark-extension-gfm-table-2.1.1.tgz", + "integrity": "sha512-t2OU/dXXioARrC6yWfJ4hqB7rct14e8f7m0cbI5hUmDyyIlwv5vEtooptH8INkbLzOatzKuVbQmAYcbWoyz6Dg==", + "license": "MIT", + "peer": true, + "dependencies": { + "devlop": "^1.0.0", + "micromark-factory-space": "^2.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/micromark-extension-gfm-tagfilter": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/micromark-extension-gfm-tagfilter/-/micromark-extension-gfm-tagfilter-2.0.0.tgz", + "integrity": "sha512-xHlTOmuCSotIA8TW1mDIM6X2O1SiX5P9IuDtqGonFhEK0qgRI4yeC6vMxEV2dgyr2TiD+2PQ10o+cOhdVAcwfg==", + "license": "MIT", + "peer": true, + "dependencies": { + "micromark-util-types": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/micromark-extension-gfm-task-list-item": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/micromark-extension-gfm-task-list-item/-/micromark-extension-gfm-task-list-item-2.1.0.tgz", + "integrity": "sha512-qIBZhqxqI6fjLDYFTBIa4eivDMnP+OZqsNwmQ3xNLE4Cxwc+zfQEfbs6tzAo2Hjq+bh6q5F+Z8/cksrLFYWQQw==", + "license": "MIT", + "peer": true, + "dependencies": { + "devlop": "^1.0.0", + "micromark-factory-space": "^2.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/micromark-factory-destination": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-factory-destination/-/micromark-factory-destination-2.0.1.tgz", + "integrity": "sha512-Xe6rDdJlkmbFRExpTOmRj9N3MaWmbAgdpSrBQvCFqhezUn4AHqJHbaEnfbVYYiexVSs//tqOdY/DxhjdCiJnIA==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "peer": true, + "dependencies": { + "micromark-util-character": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-factory-label": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-factory-label/-/micromark-factory-label-2.0.1.tgz", + "integrity": "sha512-VFMekyQExqIW7xIChcXn4ok29YE3rnuyveW3wZQWWqF4Nv9Wk5rgJ99KzPvHjkmPXF93FXIbBp6YdW3t71/7Vg==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "peer": true, + "dependencies": { + "devlop": "^1.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-factory-space": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-factory-space/-/micromark-factory-space-2.0.1.tgz", + "integrity": "sha512-zRkxjtBxxLd2Sc0d+fbnEunsTj46SWXgXciZmHq0kDYGnck/ZSGj9/wULTV95uoeYiK5hRXP2mJ98Uo4cq/LQg==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "peer": true, + "dependencies": { + "micromark-util-character": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-factory-title": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-factory-title/-/micromark-factory-title-2.0.1.tgz", + "integrity": "sha512-5bZ+3CjhAd9eChYTHsjy6TGxpOFSKgKKJPJxr293jTbfry2KDoWkhBb6TcPVB4NmzaPhMs1Frm9AZH7OD4Cjzw==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "peer": true, + "dependencies": { + "micromark-factory-space": "^2.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-factory-whitespace": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-factory-whitespace/-/micromark-factory-whitespace-2.0.1.tgz", + "integrity": "sha512-Ob0nuZ3PKt/n0hORHyvoD9uZhr+Za8sFoP+OnMcnWK5lngSzALgQYKMr9RJVOWLqQYuyn6ulqGWSXdwf6F80lQ==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "peer": true, + "dependencies": { + "micromark-factory-space": "^2.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-util-character": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/micromark-util-character/-/micromark-util-character-2.1.1.tgz", + "integrity": "sha512-wv8tdUTJ3thSFFFJKtpYKOYiGP2+v96Hvk4Tu8KpCAsTMs6yi+nVmGh1syvSCsaxz45J6Jbw+9DD6g97+NV67Q==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "peer": true, + "dependencies": { + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-util-chunked": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-util-chunked/-/micromark-util-chunked-2.0.1.tgz", + "integrity": "sha512-QUNFEOPELfmvv+4xiNg2sRYeS/P84pTW0TCgP5zc9FpXetHY0ab7SxKyAQCNCc1eK0459uoLI1y5oO5Vc1dbhA==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "peer": true, + "dependencies": { + "micromark-util-symbol": "^2.0.0" + } + }, + "node_modules/micromark-util-classify-character": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-util-classify-character/-/micromark-util-classify-character-2.0.1.tgz", + "integrity": "sha512-K0kHzM6afW/MbeWYWLjoHQv1sgg2Q9EccHEDzSkxiP/EaagNzCm7T/WMKZ3rjMbvIpvBiZgwR3dKMygtA4mG1Q==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "peer": true, + "dependencies": { + "micromark-util-character": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-util-combine-extensions": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-util-combine-extensions/-/micromark-util-combine-extensions-2.0.1.tgz", + "integrity": "sha512-OnAnH8Ujmy59JcyZw8JSbK9cGpdVY44NKgSM7E9Eh7DiLS2E9RNQf0dONaGDzEG9yjEl5hcqeIsj4hfRkLH/Bg==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "peer": true, + "dependencies": { + "micromark-util-chunked": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-util-decode-numeric-character-reference": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/micromark-util-decode-numeric-character-reference/-/micromark-util-decode-numeric-character-reference-2.0.2.tgz", + "integrity": "sha512-ccUbYk6CwVdkmCQMyr64dXz42EfHGkPQlBj5p7YVGzq8I7CtjXZJrubAYezf7Rp+bjPseiROqe7G6foFd+lEuw==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "peer": true, + "dependencies": { + "micromark-util-symbol": "^2.0.0" + } + }, + "node_modules/micromark-util-decode-string": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-util-decode-string/-/micromark-util-decode-string-2.0.1.tgz", + "integrity": "sha512-nDV/77Fj6eH1ynwscYTOsbK7rR//Uj0bZXBwJZRfaLEJ1iGBR6kIfNmlNqaqJf649EP0F3NWNdeJi03elllNUQ==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "peer": true, + "dependencies": { + "decode-named-character-reference": "^1.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-decode-numeric-character-reference": "^2.0.0", + "micromark-util-symbol": "^2.0.0" + } + }, + "node_modules/micromark-util-encode": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-util-encode/-/micromark-util-encode-2.0.1.tgz", + "integrity": "sha512-c3cVx2y4KqUnwopcO9b/SCdo2O67LwJJ/UyqGfbigahfegL9myoEFoDYZgkT7f36T0bLrM9hZTAaAyH+PCAXjw==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "peer": true + }, + "node_modules/micromark-util-html-tag-name": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-util-html-tag-name/-/micromark-util-html-tag-name-2.0.1.tgz", + "integrity": "sha512-2cNEiYDhCWKI+Gs9T0Tiysk136SnR13hhO8yW6BGNyhOC4qYFnwF1nKfD3HFAIXA5c45RrIG1ub11GiXeYd1xA==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "peer": true + }, + "node_modules/micromark-util-normalize-identifier": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-util-normalize-identifier/-/micromark-util-normalize-identifier-2.0.1.tgz", + "integrity": "sha512-sxPqmo70LyARJs0w2UclACPUUEqltCkJ6PhKdMIDuJ3gSf/Q+/GIe3WKl0Ijb/GyH9lOpUkRAO2wp0GVkLvS9Q==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "peer": true, + "dependencies": { + "micromark-util-symbol": "^2.0.0" + } + }, + "node_modules/micromark-util-resolve-all": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-util-resolve-all/-/micromark-util-resolve-all-2.0.1.tgz", + "integrity": "sha512-VdQyxFWFT2/FGJgwQnJYbe1jjQoNTS4RjglmSjTUlpUMa95Htx9NHeYW4rGDJzbjvCsl9eLjMQwGeElsqmzcHg==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "peer": true, + "dependencies": { + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-util-sanitize-uri": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-util-sanitize-uri/-/micromark-util-sanitize-uri-2.0.1.tgz", + "integrity": "sha512-9N9IomZ/YuGGZZmQec1MbgxtlgougxTodVwDzzEouPKo3qFWvymFHWcnDi2vzV1ff6kas9ucW+o3yzJK9YB1AQ==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "peer": true, + "dependencies": { + "micromark-util-character": "^2.0.0", + "micromark-util-encode": "^2.0.0", + "micromark-util-symbol": "^2.0.0" + } + }, + "node_modules/micromark-util-subtokenize": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/micromark-util-subtokenize/-/micromark-util-subtokenize-2.0.4.tgz", + "integrity": "sha512-N6hXjrin2GTJDe3MVjf5FuXpm12PGm80BrUAeub9XFXca8JZbP+oIwY4LJSVwFUCL1IPm/WwSVUN7goFHmSGGQ==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "peer": true, + "dependencies": { + "devlop": "^1.0.0", + "micromark-util-chunked": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-util-symbol": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-util-symbol/-/micromark-util-symbol-2.0.1.tgz", + "integrity": "sha512-vs5t8Apaud9N28kgCrRUdEed4UJ+wWNvicHLPxCa9ENlYuAY31M0ETy5y1vA33YoNPDFTghEbnh6efaE8h4x0Q==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "peer": true + }, + "node_modules/micromark-util-types": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-util-types/-/micromark-util-types-2.0.1.tgz", + "integrity": "sha512-534m2WhVTddrcKVepwmVEVnUAmtrx9bfIjNoQHRqfnvdaHQiFytEhJoTgpWJvDEXCO5gLTQh3wYC1PgOJA4NSQ==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "peer": true + }, + "node_modules/micromatch": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.8.tgz", + "integrity": "sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==", + "license": "MIT", + "peer": true, + "dependencies": { + "braces": "^3.0.3", + "picomatch": "^2.3.1" + }, + "engines": { + "node": ">=8.6" + } + }, + "node_modules/micromatch/node_modules/picomatch": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "license": "MIT", + "peer": true, + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/mime": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz", + "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==", + "license": "MIT", + "bin": { + "mime": "cli.js" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/mimic-response": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-3.1.0.tgz", + "integrity": "sha512-z0yWI+4FDrrweS8Zmt4Ej5HdJmky15+L2e6Wgn3+iK5fWzb6T3fhNFq2+MeTRb064c6Wr4N/wv0DzQTjNzHNGQ==", + "license": "MIT", + "optional": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/min-document": { + "version": "2.19.0", + "resolved": "https://registry.npmjs.org/min-document/-/min-document-2.19.0.tgz", + "integrity": "sha512-9Wy1B3m3f66bPPmU5hdA4DR4PB2OfDU/+GS3yAB7IQozE3tqXaVv2zOjgla7MEGSRv95+ILmOuvhLkOK6wJtCQ==", + "dependencies": { + "dom-walk": "^0.1.0" + } + }, + "node_modules/minimatch": { + "version": "9.0.5", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz", + "integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==", + "license": "ISC", + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/minimist": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", + "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==", + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/minipass": { + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.2.tgz", + "integrity": "sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw==", + "license": "ISC", + "engines": { + "node": ">=16 || 14 >=14.17" + } + }, + "node_modules/minipass-collect": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/minipass-collect/-/minipass-collect-2.0.1.tgz", + "integrity": "sha512-D7V8PO9oaz7PWGLbCACuI1qEOsq7UKfLotx/C0Aet43fCUB/wfQ7DYeq2oR/svFJGYDHPr38SHATeaj/ZoKHKw==", + "license": "ISC", + "dependencies": { + "minipass": "^7.0.3" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + } + }, + "node_modules/minipass-fetch": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/minipass-fetch/-/minipass-fetch-4.0.0.tgz", + "integrity": "sha512-2v6aXUXwLP1Epd/gc32HAMIWoczx+fZwEPRHm/VwtrJzRGwR1qGZXEYV3Zp8ZjjbwaZhMrM6uHV4KVkk+XCc2w==", + "license": "MIT", + "dependencies": { + "minipass": "^7.0.3", + "minipass-sized": "^1.0.3", + "minizlib": "^3.0.1" + }, + "engines": { + "node": "^18.17.0 || >=20.5.0" + }, + "optionalDependencies": { + "encoding": "^0.1.13" + } + }, + "node_modules/minipass-flush": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/minipass-flush/-/minipass-flush-1.0.5.tgz", + "integrity": "sha512-JmQSYYpPUqX5Jyn1mXaRwOda1uQ8HP5KAT/oDSLCzt1BYRhQU0/hDtsB1ufZfEEzMZ9aAVmsBw8+FWsIXlClWw==", + "license": "ISC", + "dependencies": { + "minipass": "^3.0.0" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/minipass-flush/node_modules/minipass": { + "version": "3.3.6", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.3.6.tgz", + "integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==", + "license": "ISC", + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/minipass-flush/node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "license": "ISC" + }, + "node_modules/minipass-pipeline": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/minipass-pipeline/-/minipass-pipeline-1.2.4.tgz", + "integrity": "sha512-xuIq7cIOt09RPRJ19gdi4b+RiNvDFYe5JH+ggNvBqGqpQXcru3PcRmOZuHBKWK1Txf9+cQ+HMVN4d6z46LZP7A==", + "license": "ISC", + "dependencies": { + "minipass": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/minipass-pipeline/node_modules/minipass": { + "version": "3.3.6", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.3.6.tgz", + "integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==", + "license": "ISC", + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/minipass-pipeline/node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "license": "ISC" + }, + "node_modules/minipass-sized": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/minipass-sized/-/minipass-sized-1.0.3.tgz", + "integrity": "sha512-MbkQQ2CTiBMlA2Dm/5cY+9SWFEN8pzzOXi6rlM5Xxq0Yqbda5ZQy9sU75a673FE9ZK0Zsbr6Y5iP6u9nktfg2g==", + "license": "ISC", + "dependencies": { + "minipass": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/minipass-sized/node_modules/minipass": { + "version": "3.3.6", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.3.6.tgz", + "integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==", + "license": "ISC", + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/minipass-sized/node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "license": "ISC" + }, + "node_modules/minizlib": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/minizlib/-/minizlib-3.0.1.tgz", + "integrity": "sha512-umcy022ILvb5/3Djuu8LWeqUa8D68JaBzlttKeMWen48SjabqS3iY5w/vzeMzMUNhLDifyhbOwKDSznB1vvrwg==", + "license": "MIT", + "dependencies": { + "minipass": "^7.0.4", + "rimraf": "^5.0.5" + }, + "engines": { + "node": ">= 18" + } + }, + "node_modules/mkdirp": { + "version": "0.5.6", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.6.tgz", + "integrity": "sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw==", + "license": "MIT", + "dependencies": { + "minimist": "^1.2.6" + }, + "bin": { + "mkdirp": "bin/cmd.js" + } + }, + "node_modules/mkdirp-classic": { + "version": "0.5.3", + "resolved": "https://registry.npmjs.org/mkdirp-classic/-/mkdirp-classic-0.5.3.tgz", + "integrity": "sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A==", + "license": "MIT", + "optional": true + }, + "node_modules/mrmime": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/mrmime/-/mrmime-2.0.0.tgz", + "integrity": "sha512-eu38+hdgojoyq63s+yTpN4XMBdt5l8HhMhc4VKLO9KM5caLIBvUm4thi7fFaxyTmCKeNnXZ5pAlBwCUnhA09uw==", + "license": "MIT", + "peer": true, + "engines": { + "node": ">=10" + } + }, + "node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "license": "MIT" + }, + "node_modules/nanoid": { + "version": "3.3.8", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.8.tgz", + "integrity": "sha512-WNLf5Sd8oZxOm+TzppcYk8gVOgP+l58xNy58D0nbUnOxOWRWvlcCV4kUF7ltmI6PsrLl/BgKEyS4mqsGChFN0w==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "bin": { + "nanoid": "bin/nanoid.cjs" + }, + "engines": { + "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" + } + }, + "node_modules/napi-build-utils": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/napi-build-utils/-/napi-build-utils-2.0.0.tgz", + "integrity": "sha512-GEbrYkbfF7MoNaoh2iGG84Mnf/WZfB0GdGEsM8wz7Expx/LlWf5U8t9nvJKXSp3qr5IsEbK04cBGhol/KwOsWA==", + "license": "MIT", + "optional": true + }, + "node_modules/negotiator": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-1.0.0.tgz", + "integrity": "sha512-8Ofs/AUQh8MaEcrlq5xOX0CQ9ypTF5dl78mjlMNfOK08fzpgTHQRQPBxcPlEtIw0yRpws+Zo/3r+5WRby7u3Gg==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/neotraverse": { + "version": "0.6.18", + "resolved": "https://registry.npmjs.org/neotraverse/-/neotraverse-0.6.18.tgz", + "integrity": "sha512-Z4SmBUweYa09+o6pG+eASabEpP6QkQ70yHj351pQoEXIs8uHbaU2DWVmzBANKgflPa47A50PtB2+NgRpQvr7vA==", + "license": "MIT", + "peer": true, + "engines": { + "node": ">= 10" + } + }, + "node_modules/nlcst-to-string": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/nlcst-to-string/-/nlcst-to-string-4.0.0.tgz", + "integrity": "sha512-YKLBCcUYKAg0FNlOBT6aI91qFmSiFKiluk655WzPF+DDMA02qIyy8uiRqI8QXtcFpEvll12LpL5MXqEmAZ+dcA==", + "license": "MIT", + "peer": true, + "dependencies": { + "@types/nlcst": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/node-abi": { + "version": "3.74.0", + "resolved": "https://registry.npmjs.org/node-abi/-/node-abi-3.74.0.tgz", + "integrity": "sha512-c5XK0MjkGBrQPGYG24GBADZud0NCbznxNx0ZkS+ebUTrmV1qTDxPxSL8zEAPURXSbLRWVexxmP4986BziahL5w==", + "license": "MIT", + "optional": true, + "dependencies": { + "semver": "^7.3.5" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/node-addon-api": { + "version": "8.3.0", + "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-8.3.0.tgz", + "integrity": "sha512-8VOpLHFrOQlAH+qA0ZzuGRlALRA6/LVh8QJldbrC4DY0hXoMP0l4Acq8TzFC018HztWiRqyCEj2aTWY2UvnJUg==", + "license": "MIT", + "engines": { + "node": "^18 || ^20 || >= 21" + } + }, + "node_modules/node-fetch-native": { + "version": "1.6.6", + "resolved": "https://registry.npmjs.org/node-fetch-native/-/node-fetch-native-1.6.6.tgz", + "integrity": "sha512-8Mc2HhqPdlIfedsuZoc3yioPuzp6b+L5jRCRY1QzuWZh2EGJVQrGppC6V6cF0bLdbW0+O2YpqCA25aF/1lvipQ==", + "license": "MIT", + "peer": true + }, + "node_modules/node-gyp": { + "version": "11.1.0", + "resolved": "https://registry.npmjs.org/node-gyp/-/node-gyp-11.1.0.tgz", + "integrity": "sha512-/+7TuHKnBpnMvUQnsYEb0JOozDZqarQbfNuSGLXIjhStMT0fbw7IdSqWgopOP5xhRZE+lsbIvAHcekddruPZgQ==", + "license": "MIT", + "dependencies": { + "env-paths": "^2.2.0", + "exponential-backoff": "^3.1.1", + "glob": "^10.3.10", + "graceful-fs": "^4.2.6", + "make-fetch-happen": "^14.0.3", + "nopt": "^8.0.0", + "proc-log": "^5.0.0", + "semver": "^7.3.5", + "tar": "^7.4.3", + "which": "^5.0.0" + }, + "bin": { + "node-gyp": "bin/node-gyp.js" + }, + "engines": { + "node": "^18.17.0 || >=20.5.0" + } + }, + "node_modules/node-mock-http": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/node-mock-http/-/node-mock-http-1.0.0.tgz", + "integrity": "sha512-0uGYQ1WQL1M5kKvGRXWQ3uZCHtLTO8hln3oBjIusM75WoesZ909uQJs/Hb946i2SS+Gsrhkaa6iAO17jRIv6DQ==", + "license": "MIT", + "peer": true + }, + "node_modules/nopt": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/nopt/-/nopt-8.1.0.tgz", + "integrity": "sha512-ieGu42u/Qsa4TFktmaKEwM6MQH0pOWnaB3htzh0JRtx84+Mebc0cbZYN5bC+6WTZ4+77xrL9Pn5m7CV6VIkV7A==", + "license": "ISC", + "dependencies": { + "abbrev": "^3.0.0" + }, + "bin": { + "nopt": "bin/nopt.js" + }, + "engines": { + "node": "^18.17.0 || >=20.5.0" + } + }, + "node_modules/normalize-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", + "license": "MIT", + "peer": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/object-hash": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/object-hash/-/object-hash-3.0.0.tgz", + "integrity": "sha512-RSn9F68PjH9HqtltsSnqYC1XXoWe9Bju5+213R98cNGttag9q9yAOTzdbsqvIa7aNm5WffBZFpWYr2aWrklWAw==", + "license": "MIT", + "engines": { + "node": ">= 6" + } + }, + "node_modules/ofetch": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/ofetch/-/ofetch-1.4.1.tgz", + "integrity": "sha512-QZj2DfGplQAr2oj9KzceK9Hwz6Whxazmn85yYeVuS3u9XTMOGMRx0kO95MQ+vLsj/S/NwBDMMLU5hpxvI6Tklw==", + "license": "MIT", + "peer": true, + "dependencies": { + "destr": "^2.0.3", + "node-fetch-native": "^1.6.4", + "ufo": "^1.5.4" + } + }, + "node_modules/ohash": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/ohash/-/ohash-1.1.4.tgz", + "integrity": "sha512-FlDryZAahJmEF3VR3w1KogSEdWX3WhA5GPakFx4J81kEAiHyLMpdLLElS8n8dfNadMgAne/MywcvmogzscVt4g==", + "license": "MIT", + "peer": true + }, + "node_modules/omggif": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/omggif/-/omggif-1.0.10.tgz", + "integrity": "sha512-LMJTtvgc/nugXj0Vcrrs68Mn2D1r0zf630VNtqtpI1FEO7e+O9FP4gqs9AcnBaSEeoHIPm28u6qgPR0oyEpGSw==", + "license": "MIT" + }, + "node_modules/once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "license": "ISC", + "optional": true, + "dependencies": { + "wrappy": "1" + } + }, + "node_modules/oniguruma-to-es": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/oniguruma-to-es/-/oniguruma-to-es-2.3.0.tgz", + "integrity": "sha512-bwALDxriqfKGfUufKGGepCzu9x7nJQuoRoAFp4AnwehhC2crqrDIAP/uN2qdlsAvSMpeRC3+Yzhqc7hLmle5+g==", + "license": "MIT", + "peer": true, + "dependencies": { + "emoji-regex-xs": "^1.0.0", + "regex": "^5.1.1", + "regex-recursion": "^5.1.1" + } + }, + "node_modules/p-limit": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-6.2.0.tgz", + "integrity": "sha512-kuUqqHNUqoIWp/c467RI4X6mmyuojY5jGutNU0wVTmEOOfcuwLqyMVoAi9MKi2Ak+5i9+nhmrK4ufZE8069kHA==", + "license": "MIT", + "peer": true, + "dependencies": { + "yocto-queue": "^1.1.1" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-locate": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-6.0.0.tgz", + "integrity": "sha512-wPrq66Llhl7/4AGC6I+cqxT07LhXvWL08LNXz1fENOw0Ap4sRZZ/gZpTTJ5jpurzzzfS2W/Ge9BY3LgLjCShcw==", + "license": "MIT", + "dependencies": { + "p-limit": "^4.0.0" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-locate/node_modules/p-limit": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-4.0.0.tgz", + "integrity": "sha512-5b0R4txpzjPWVw/cXXUResoD4hb6U/x9BH08L7nw+GN1sezDzPdxeRvpc9c433fZhBan/wusjbCsqwqm4EIBIQ==", + "license": "MIT", + "dependencies": { + "yocto-queue": "^1.0.0" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-map": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/p-map/-/p-map-7.0.3.tgz", + "integrity": "sha512-VkndIv2fIB99swvQoA65bm+fsmt6UNdGeIB0oxBs+WhAhdh08QA04JXpI7rbB9r08/nkbysKoya9rtDERYOYMA==", + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-queue": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/p-queue/-/p-queue-8.1.0.tgz", + "integrity": "sha512-mxLDbbGIBEXTJL0zEx8JIylaj3xQ7Z/7eEVjcF9fJX4DBiH9oqe+oahYnlKKxm0Ci9TlWTyhSHgygxMxjIB2jw==", + "license": "MIT", + "peer": true, + "dependencies": { + "eventemitter3": "^5.0.1", + "p-timeout": "^6.1.2" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-timeout": { + "version": "6.1.4", + "resolved": "https://registry.npmjs.org/p-timeout/-/p-timeout-6.1.4.tgz", + "integrity": "sha512-MyIV3ZA/PmyBN/ud8vV9XzwTrNtR4jFrObymZYnZqMmW0zA8Z17vnT0rBgFE/TlohB+YCHqXMgZzb3Csp49vqg==", + "license": "MIT", + "peer": true, + "engines": { + "node": ">=14.16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-try": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", + "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/package-json-from-dist": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/package-json-from-dist/-/package-json-from-dist-1.0.1.tgz", + "integrity": "sha512-UEZIS3/by4OC8vL3P2dTXRETpebLI2NiI5vIrjaD/5UtrkFX/tNbwjTSRAGC/+7CAo2pIcBaRgWmcBBHcsaCIw==", + "license": "BlueOak-1.0.0" + }, + "node_modules/pako": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/pako/-/pako-1.0.11.tgz", + "integrity": "sha512-4hLB8Py4zZce5s4yd9XzopqwVv/yGNhV1Bl8NTmCq1763HeK2+EwVTv+leGeL13Dnh2wfbqowVPXCIO0z4taYw==", + "license": "(MIT AND Zlib)" + }, + "node_modules/parse-bmfont-ascii": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/parse-bmfont-ascii/-/parse-bmfont-ascii-1.0.6.tgz", + "integrity": "sha512-U4RrVsUFCleIOBsIGYOMKjn9PavsGOXxbvYGtMOEfnId0SVNsgehXh1DxUdVPLoxd5mvcEtvmKs2Mmf0Mpa1ZA==", + "license": "MIT" + }, + "node_modules/parse-bmfont-binary": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/parse-bmfont-binary/-/parse-bmfont-binary-1.0.6.tgz", + "integrity": "sha512-GxmsRea0wdGdYthjuUeWTMWPqm2+FAd4GI8vCvhgJsFnoGhTrLhXDDupwTo7rXVAgaLIGoVHDZS9p/5XbSqeWA==", + "license": "MIT" + }, + "node_modules/parse-bmfont-xml": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/parse-bmfont-xml/-/parse-bmfont-xml-1.1.6.tgz", + "integrity": "sha512-0cEliVMZEhrFDwMh4SxIyVJpqYoOWDJ9P895tFuS+XuNzI5UBmBk5U5O4KuJdTnZpSBI4LFA2+ZiJaiwfSwlMA==", + "license": "MIT", + "dependencies": { + "xml-parse-from-string": "^1.0.0", + "xml2js": "^0.5.0" + } + }, + "node_modules/parse-headers": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/parse-headers/-/parse-headers-2.0.5.tgz", + "integrity": "sha512-ft3iAoLOB/MlwbNXgzy43SWGP6sQki2jQvAyBg/zDFAgr9bfNWZIUj42Kw2eJIl8kEi4PbgE6U1Zau/HwI75HA==", + "license": "MIT" + }, + "node_modules/parse-latin": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/parse-latin/-/parse-latin-7.0.0.tgz", + "integrity": "sha512-mhHgobPPua5kZ98EF4HWiH167JWBfl4pvAIXXdbaVohtK7a6YBOy56kvhCqduqyo/f3yrHFWmqmiMg/BkBkYYQ==", + "license": "MIT", + "peer": true, + "dependencies": { + "@types/nlcst": "^2.0.0", + "@types/unist": "^3.0.0", + "nlcst-to-string": "^4.0.0", + "unist-util-modify-children": "^4.0.0", + "unist-util-visit-children": "^3.0.0", + "vfile": "^6.0.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/parse5": { + "version": "7.2.1", + "resolved": "https://registry.npmjs.org/parse5/-/parse5-7.2.1.tgz", + "integrity": "sha512-BuBYQYlv1ckiPdQi/ohiivi9Sagc9JG+Ozs0r7b/0iK3sKmrb0b9FdWdBbOdx6hBCM/F9Ir82ofnBhtZOjCRPQ==", + "license": "MIT", + "peer": true, + "dependencies": { + "entities": "^4.5.0" + }, + "funding": { + "url": "https://github.com/inikulin/parse5?sponsor=1" + } + }, + "node_modules/path-exists": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-5.0.0.tgz", + "integrity": "sha512-RjhtfwJOxzcFmNOi6ltcbcu4Iu+FL3zEj83dk4kAS+fVpTxXLO1b38RvJgT/0QwvV/L3aY9TAnyv0EOqW4GoMQ==", + "license": "MIT", + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + } + }, + "node_modules/path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/path-parse": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", + "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", + "dev": true, + "license": "MIT" + }, + "node_modules/path-scurry": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-1.11.1.tgz", + "integrity": "sha512-Xa4Nw17FS9ApQFJ9umLiJS4orGjm7ZzwUrwamcGQuHSzDyth9boKDaycYdDcZDuqYATXw4HFXgaqWTctW/v1HA==", + "license": "BlueOak-1.0.0", + "dependencies": { + "lru-cache": "^10.2.0", + "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0" + }, + "engines": { + "node": ">=16 || 14 >=14.18" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/pathval": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/pathval/-/pathval-1.1.1.tgz", + "integrity": "sha512-Dp6zGqpTdETdR63lehJYPeIOqpiNBNtc7BpWSLrOje7UaIsE5aY92r/AunQA7rsXvet3lrJ3JnZX29UPTKXyKQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": "*" + } + }, + "node_modules/peek-readable": { + "version": "5.4.2", + "resolved": "https://registry.npmjs.org/peek-readable/-/peek-readable-5.4.2.tgz", + "integrity": "sha512-peBp3qZyuS6cNIJ2akRNG1uo1WJ1d0wTxg/fxMdZ0BqCVhx242bSFHM9eNqflfJVS9SsgkzgT/1UgnsurBOTMg==", + "license": "MIT", + "engines": { + "node": ">=14.16" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/Borewit" + } + }, + "node_modules/phin": { + "version": "2.9.3", + "resolved": "https://registry.npmjs.org/phin/-/phin-2.9.3.tgz", + "integrity": "sha512-CzFr90qM24ju5f88quFC/6qohjC144rehe5n6DH900lgXmUe86+xCKc10ev56gRKC4/BkHUoG4uSiQgBiIXwDA==", + "deprecated": "Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.", + "license": "MIT" + }, + "node_modules/picocolors": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", + "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==", + "license": "ISC" + }, + "node_modules/picomatch": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.2.tgz", + "integrity": "sha512-M7BAV6Rlcy5u+m6oPhAPFgJTzAioX/6B0DxyvDlo9l8+T3nLKbrczg2WLUyzd45L8RqfUMyGPzekbMvX2Ldkwg==", + "license": "MIT", + "peer": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/pify": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/pify/-/pify-4.0.1.tgz", + "integrity": "sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g==", + "license": "MIT", + "peer": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/pixelmatch": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/pixelmatch/-/pixelmatch-4.0.2.tgz", + "integrity": "sha512-J8B6xqiO37sU/gkcMglv6h5Jbd9xNER7aHzpfRdNmV4IbQBzBpe4l9XmbG+xPF/znacgu2jfEw+wHffaq/YkXA==", + "license": "ISC", + "dependencies": { + "pngjs": "^3.0.0" + }, + "bin": { + "pixelmatch": "bin/pixelmatch" + } + }, + "node_modules/pkg-dir": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-4.2.0.tgz", + "integrity": "sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==", + "license": "MIT", + "dependencies": { + "find-up": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/pkg-dir/node_modules/find-up": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", + "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", + "license": "MIT", + "dependencies": { + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/pkg-dir/node_modules/locate-path": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", + "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", + "license": "MIT", + "dependencies": { + "p-locate": "^4.1.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/pkg-dir/node_modules/p-limit": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", + "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "license": "MIT", + "dependencies": { + "p-try": "^2.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/pkg-dir/node_modules/p-locate": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", + "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", + "license": "MIT", + "dependencies": { + "p-limit": "^2.2.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/pkg-dir/node_modules/path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/pngjs": { + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/pngjs/-/pngjs-3.4.0.tgz", + "integrity": "sha512-NCrCHhWmnQklfH4MtJMRjZ2a8c80qXeMlQMv2uVp9ISJMTt562SbGd6n2oq0PaPgKm7Z6pL9E2UlLIhC+SHL3w==", + "license": "MIT", + "engines": { + "node": ">=4.0.0" + } + }, + "node_modules/postcss": { + "version": "8.5.2", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.2.tgz", + "integrity": "sha512-MjOadfU3Ys9KYoX0AdkBlFEF1Vx37uCCeN4ZHnmwm9FfpbsGWMZeBLMmmpY+6Ocqod7mkdZ0DT31OlbsFrLlkA==", + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/postcss" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "dependencies": { + "nanoid": "^3.3.8", + "picocolors": "^1.1.1", + "source-map-js": "^1.2.1" + }, + "engines": { + "node": "^10 || ^12 || >=14" + } + }, + "node_modules/potrace": { + "version": "2.1.8", + "resolved": "https://registry.npmjs.org/potrace/-/potrace-2.1.8.tgz", + "integrity": "sha512-V9hI7UMJyEhNZjM8CbZaP/804ZRLgzWkCS9OOYnEZkszzj3zKR/erRdj0uFMcN3pp6x4B+AIZebmkQgGRinG/g==", + "license": "GPL-2.0", + "dependencies": { + "jimp": "^0.14.0" + } + }, + "node_modules/prebuild-install": { + "version": "7.1.3", + "resolved": "https://registry.npmjs.org/prebuild-install/-/prebuild-install-7.1.3.tgz", + "integrity": "sha512-8Mf2cbV7x1cXPUILADGI3wuhfqWvtiLA1iclTDbFRZkgRQS0NqsPZphna9V+HyTEadheuPmjaJMsbzKQFOzLug==", + "license": "MIT", + "optional": true, + "dependencies": { + "detect-libc": "^2.0.0", + "expand-template": "^2.0.3", + "github-from-package": "0.0.0", + "minimist": "^1.2.3", + "mkdirp-classic": "^0.5.3", + "napi-build-utils": "^2.0.0", + "node-abi": "^3.3.0", + "pump": "^3.0.0", + "rc": "^1.2.7", + "simple-get": "^4.0.0", + "tar-fs": "^2.0.0", + "tunnel-agent": "^0.6.0" + }, + "bin": { + "prebuild-install": "bin.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/preferred-pm": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/preferred-pm/-/preferred-pm-4.1.1.tgz", + "integrity": "sha512-rU+ZAv1Ur9jAUZtGPebQVQPzdGhNzaEiQ7VL9+cjsAWPHFYOccNXPNiev1CCDSOg/2j7UujM7ojNhpkuILEVNQ==", + "license": "MIT", + "peer": true, + "dependencies": { + "find-up-simple": "^1.0.0", + "find-yarn-workspace-root2": "1.2.16", + "which-pm": "^3.0.1" + }, + "engines": { + "node": ">=18.12" + } + }, + "node_modules/prismjs": { + "version": "1.29.0", + "resolved": "https://registry.npmjs.org/prismjs/-/prismjs-1.29.0.tgz", + "integrity": "sha512-Kx/1w86q/epKcmte75LNrEoT+lX8pBpavuAbvJWRXar7Hz8jrtF+e3vY751p0R8H9HdArwaCTNDDzHg/ScJK1Q==", + "license": "MIT", + "peer": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/proc-log": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/proc-log/-/proc-log-5.0.0.tgz", + "integrity": "sha512-Azwzvl90HaF0aCz1JrDdXQykFakSSNPaPoiZ9fm5qJIMHioDZEi7OAdRwSm6rSoPtY3Qutnm3L7ogmg3dc+wbQ==", + "license": "ISC", + "engines": { + "node": "^18.17.0 || >=20.5.0" + } + }, + "node_modules/process": { + "version": "0.11.10", + "resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz", + "integrity": "sha512-cdGef/drWFoydD1JsMzuFf8100nZl+GT+yacc2bEced5f9Rjk4z+WtFUTBu9PhOi9j/jfmBPu0mMEY4wIdAF8A==", + "license": "MIT", + "engines": { + "node": ">= 0.6.0" + } + }, + "node_modules/promise-retry": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/promise-retry/-/promise-retry-2.0.1.tgz", + "integrity": "sha512-y+WKFlBR8BGXnsNlIHFGPZmyDf3DFMoLhaflAnyZgV6rG6xu+JwesTo2Q9R6XwYmtmwAFCkAk3e35jEdoeh/3g==", + "license": "MIT", + "dependencies": { + "err-code": "^2.0.2", + "retry": "^0.12.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/prompts": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/prompts/-/prompts-2.4.2.tgz", + "integrity": "sha512-NxNv/kLguCA7p3jE8oL2aEBsrJWgAakBpgmgK6lpPWV+WuOmY6r2/zbAVnP+T8bQlA0nzHXSJSJW0Hq7ylaD2Q==", + "license": "MIT", + "peer": true, + "dependencies": { + "kleur": "^3.0.3", + "sisteransi": "^1.0.5" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/prompts/node_modules/kleur": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/kleur/-/kleur-3.0.3.tgz", + "integrity": "sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w==", + "license": "MIT", + "peer": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/property-information": { + "version": "6.5.0", + "resolved": "https://registry.npmjs.org/property-information/-/property-information-6.5.0.tgz", + "integrity": "sha512-PgTgs/BlvHxOu8QuEN7wi5A0OmXaBcHpmCSTehcs6Uuu9IkDIEo13Hy7n898RHfrQ49vKCoGeWZSaAK01nwVig==", + "license": "MIT", + "peer": true, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/pump": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.2.tgz", + "integrity": "sha512-tUPXtzlGM8FE3P0ZL6DVs/3P58k9nk8/jZeQCurTJylQA8qFYzHFfhBJkuqyE0FifOsQ0uKWekiZ5g8wtr28cw==", + "license": "MIT", + "optional": true, + "dependencies": { + "end-of-stream": "^1.1.0", + "once": "^1.3.1" + } + }, + "node_modules/queue-microtask": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", + "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT", + "peer": true + }, + "node_modules/radix3": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/radix3/-/radix3-1.1.2.tgz", + "integrity": "sha512-b484I/7b8rDEdSDKckSSBA8knMpcdsXudlE/LNL639wFoHKwLbEkQFZHWEYwDC0wa0FKUcCY+GAF73Z7wxNVFA==", + "license": "MIT", + "peer": true + }, + "node_modules/rc": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/rc/-/rc-1.2.8.tgz", + "integrity": "sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw==", + "license": "(BSD-2-Clause OR MIT OR Apache-2.0)", + "optional": true, + "dependencies": { + "deep-extend": "^0.6.0", + "ini": "~1.3.0", + "minimist": "^1.2.0", + "strip-json-comments": "~2.0.1" + }, + "bin": { + "rc": "cli.js" + } + }, + "node_modules/readable-stream": { + "version": "4.7.0", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-4.7.0.tgz", + "integrity": "sha512-oIGGmcpTLwPga8Bn6/Z75SVaH1z5dUut2ibSyAMVhmUggWpmDn2dapB0n7f8nwaSiRtepAsfJyfXIO5DCVAODg==", + "license": "MIT", + "dependencies": { + "abort-controller": "^3.0.0", + "buffer": "^6.0.3", + "events": "^3.3.0", + "process": "^0.11.10", + "string_decoder": "^1.3.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + } + }, + "node_modules/readable-stream/node_modules/buffer": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", + "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT", + "dependencies": { + "base64-js": "^1.3.1", + "ieee754": "^1.2.1" + } + }, + "node_modules/readable-web-to-node-stream": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/readable-web-to-node-stream/-/readable-web-to-node-stream-3.0.3.tgz", + "integrity": "sha512-In3boYjBnbGVrLuuRu/Ath/H6h1jgk30nAsk/71tCare1dTVoe1oMBGRn5LGf0n3c1BcHwwAqpraxX4AUAP5KA==", + "license": "MIT", + "dependencies": { + "process": "^0.11.10", + "readable-stream": "^4.7.0" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/Borewit" + } + }, + "node_modules/readdirp": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", + "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", + "license": "MIT", + "peer": true, + "dependencies": { + "picomatch": "^2.2.1" + }, + "engines": { + "node": ">=8.10.0" + } + }, + "node_modules/readdirp/node_modules/picomatch": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "license": "MIT", + "peer": true, + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/regenerator-runtime": { + "version": "0.13.11", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.11.tgz", + "integrity": "sha512-kY1AZVr2Ra+t+piVaJ4gxaFaReZVH40AKNo7UCX6W+dEwBo/2oZJzqfuN1qLq1oL45o56cPaTXELwrTh8Fpggg==", + "license": "MIT" + }, + "node_modules/regex": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/regex/-/regex-5.1.1.tgz", + "integrity": "sha512-dN5I359AVGPnwzJm2jN1k0W9LPZ+ePvoOeVMMfqIMFz53sSwXkxaJoxr50ptnsC771lK95BnTrVSZxq0b9yCGw==", + "license": "MIT", + "peer": true, + "dependencies": { + "regex-utilities": "^2.3.0" + } + }, + "node_modules/regex-recursion": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/regex-recursion/-/regex-recursion-5.1.1.tgz", + "integrity": "sha512-ae7SBCbzVNrIjgSbh7wMznPcQel1DNlDtzensnFxpiNpXt1U2ju/bHugH422r+4LAVS1FpW1YCwilmnNsjum9w==", + "license": "MIT", + "peer": true, + "dependencies": { + "regex": "^5.1.1", + "regex-utilities": "^2.3.0" + } + }, + "node_modules/regex-utilities": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/regex-utilities/-/regex-utilities-2.3.0.tgz", + "integrity": "sha512-8VhliFJAWRaUiVvREIiW2NXXTmHs4vMNnSzuJVhscgmGav3g9VDxLrQndI3dZZVVdp0ZO/5v0xmX516/7M9cng==", + "license": "MIT", + "peer": true + }, + "node_modules/rehype": { + "version": "13.0.2", + "resolved": "https://registry.npmjs.org/rehype/-/rehype-13.0.2.tgz", + "integrity": "sha512-j31mdaRFrwFRUIlxGeuPXXKWQxet52RBQRvCmzl5eCefn/KGbomK5GMHNMsOJf55fgo3qw5tST5neDuarDYR2A==", + "license": "MIT", + "peer": true, + "dependencies": { + "@types/hast": "^3.0.0", + "rehype-parse": "^9.0.0", + "rehype-stringify": "^10.0.0", + "unified": "^11.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/rehype-parse": { + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/rehype-parse/-/rehype-parse-9.0.1.tgz", + "integrity": "sha512-ksCzCD0Fgfh7trPDxr2rSylbwq9iYDkSn8TCDmEJ49ljEUBxDVCzCHv7QNzZOfODanX4+bWQ4WZqLCRWYLfhag==", + "license": "MIT", + "peer": true, + "dependencies": { + "@types/hast": "^3.0.0", + "hast-util-from-html": "^2.0.0", + "unified": "^11.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/rehype-raw": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/rehype-raw/-/rehype-raw-7.0.0.tgz", + "integrity": "sha512-/aE8hCfKlQeA8LmyeyQvQF3eBiLRGNlfBJEvWH7ivp9sBqs7TNqBL5X3v157rM4IFETqDnIOO+z5M/biZbo9Ww==", + "license": "MIT", + "peer": true, + "dependencies": { + "@types/hast": "^3.0.0", + "hast-util-raw": "^9.0.0", + "vfile": "^6.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/rehype-stringify": { + "version": "10.0.1", + "resolved": "https://registry.npmjs.org/rehype-stringify/-/rehype-stringify-10.0.1.tgz", + "integrity": "sha512-k9ecfXHmIPuFVI61B9DeLPN0qFHfawM6RsuX48hoqlaKSF61RskNjSm1lI8PhBEM0MRdLxVVm4WmTqJQccH9mA==", + "license": "MIT", + "peer": true, + "dependencies": { + "@types/hast": "^3.0.0", + "hast-util-to-html": "^9.0.0", + "unified": "^11.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/remark-gfm": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/remark-gfm/-/remark-gfm-4.0.1.tgz", + "integrity": "sha512-1quofZ2RQ9EWdeN34S79+KExV1764+wCUGop5CPL1WGdD0ocPpu91lzPGbwWMECpEpd42kJGQwzRfyov9j4yNg==", + "license": "MIT", + "peer": true, + "dependencies": { + "@types/mdast": "^4.0.0", + "mdast-util-gfm": "^3.0.0", + "micromark-extension-gfm": "^3.0.0", + "remark-parse": "^11.0.0", + "remark-stringify": "^11.0.0", + "unified": "^11.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/remark-parse": { + "version": "11.0.0", + "resolved": "https://registry.npmjs.org/remark-parse/-/remark-parse-11.0.0.tgz", + "integrity": "sha512-FCxlKLNGknS5ba/1lmpYijMUzX2esxW5xQqjWxw2eHFfS2MSdaHVINFmhjo+qN1WhZhNimq0dZATN9pH0IDrpA==", + "license": "MIT", + "peer": true, + "dependencies": { + "@types/mdast": "^4.0.0", + "mdast-util-from-markdown": "^2.0.0", + "micromark-util-types": "^2.0.0", + "unified": "^11.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/remark-rehype": { + "version": "11.1.1", + "resolved": "https://registry.npmjs.org/remark-rehype/-/remark-rehype-11.1.1.tgz", + "integrity": "sha512-g/osARvjkBXb6Wo0XvAeXQohVta8i84ACbenPpoSsxTOQH/Ae0/RGP4WZgnMH5pMLpsj4FG7OHmcIcXxpza8eQ==", + "license": "MIT", + "peer": true, + "dependencies": { + "@types/hast": "^3.0.0", + "@types/mdast": "^4.0.0", + "mdast-util-to-hast": "^13.0.0", + "unified": "^11.0.0", + "vfile": "^6.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/remark-smartypants": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/remark-smartypants/-/remark-smartypants-3.0.2.tgz", + "integrity": "sha512-ILTWeOriIluwEvPjv67v7Blgrcx+LZOkAUVtKI3putuhlZm84FnqDORNXPPm+HY3NdZOMhyDwZ1E+eZB/Df5dA==", + "license": "MIT", + "peer": true, + "dependencies": { + "retext": "^9.0.0", + "retext-smartypants": "^6.0.0", + "unified": "^11.0.4", + "unist-util-visit": "^5.0.0" + }, + "engines": { + "node": ">=16.0.0" + } + }, + "node_modules/remark-stringify": { + "version": "11.0.0", + "resolved": "https://registry.npmjs.org/remark-stringify/-/remark-stringify-11.0.0.tgz", + "integrity": "sha512-1OSmLd3awB/t8qdoEOMazZkNsfVTeY4fTsgzcQFdXNq8ToTN4ZGwrMnlda4K6smTFKD+GRV6O48i6Z4iKgPPpw==", + "license": "MIT", + "peer": true, + "dependencies": { + "@types/mdast": "^4.0.0", + "mdast-util-to-markdown": "^2.0.0", + "unified": "^11.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/resolve": { + "version": "1.22.10", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.10.tgz", + "integrity": "sha512-NPRy+/ncIMeDlTAsuqwKIiferiawhefFJtkNSW0qZJEqMEb+qBt/77B/jGeeek+F0uOeN05CDa6HXbbIgtVX4w==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-core-module": "^2.16.0", + "path-parse": "^1.0.7", + "supports-preserve-symlinks-flag": "^1.0.0" + }, + "bin": { + "resolve": "bin/resolve" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/retext": { + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/retext/-/retext-9.0.0.tgz", + "integrity": "sha512-sbMDcpHCNjvlheSgMfEcVrZko3cDzdbe1x/e7G66dFp0Ff7Mldvi2uv6JkJQzdRcvLYE8CA8Oe8siQx8ZOgTcA==", + "license": "MIT", + "peer": true, + "dependencies": { + "@types/nlcst": "^2.0.0", + "retext-latin": "^4.0.0", + "retext-stringify": "^4.0.0", + "unified": "^11.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/retext-latin": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/retext-latin/-/retext-latin-4.0.0.tgz", + "integrity": "sha512-hv9woG7Fy0M9IlRQloq/N6atV82NxLGveq+3H2WOi79dtIYWN8OaxogDm77f8YnVXJL2VD3bbqowu5E3EMhBYA==", + "license": "MIT", + "peer": true, + "dependencies": { + "@types/nlcst": "^2.0.0", + "parse-latin": "^7.0.0", + "unified": "^11.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/retext-smartypants": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/retext-smartypants/-/retext-smartypants-6.2.0.tgz", + "integrity": "sha512-kk0jOU7+zGv//kfjXEBjdIryL1Acl4i9XNkHxtM7Tm5lFiCog576fjNC9hjoR7LTKQ0DsPWy09JummSsH1uqfQ==", + "license": "MIT", + "peer": true, + "dependencies": { + "@types/nlcst": "^2.0.0", + "nlcst-to-string": "^4.0.0", + "unist-util-visit": "^5.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/retext-stringify": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/retext-stringify/-/retext-stringify-4.0.0.tgz", + "integrity": "sha512-rtfN/0o8kL1e+78+uxPTqu1Klt0yPzKuQ2BfWwwfgIUSayyzxpM1PJzkKt4V8803uB9qSy32MvI7Xep9khTpiA==", + "license": "MIT", + "peer": true, + "dependencies": { + "@types/nlcst": "^2.0.0", + "nlcst-to-string": "^4.0.0", + "unified": "^11.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/retry": { + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/retry/-/retry-0.12.0.tgz", + "integrity": "sha512-9LkiTwjUh6rT555DtE9rTX+BKByPfrMzEAtnlEtdEwr3Nkffwiihqe2bWADg+OQRjt9gl6ICdmB/ZFDCGAtSow==", + "license": "MIT", + "engines": { + "node": ">= 4" + } + }, + "node_modules/reusify": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", + "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==", + "license": "MIT", + "peer": true, + "engines": { + "iojs": ">=1.0.0", + "node": ">=0.10.0" + } + }, + "node_modules/rimraf": { + "version": "5.0.10", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-5.0.10.tgz", + "integrity": "sha512-l0OE8wL34P4nJH/H2ffoaniAokM2qSmrtXHmlpvYr5AVVX8msAyW0l8NVJFDxlSK4u3Uh/f41cQheDVdnYijwQ==", + "license": "ISC", + "dependencies": { + "glob": "^10.3.7" + }, + "bin": { + "rimraf": "dist/esm/bin.mjs" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/rollup": { + "version": "4.34.7", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.34.7.tgz", + "integrity": "sha512-8qhyN0oZ4x0H6wmBgfKxJtxM7qS98YJ0k0kNh5ECVtuchIJ7z9IVVvzpmtQyT10PXKMtBxYr1wQ5Apg8RS8kXQ==", + "license": "MIT", + "peer": true, + "dependencies": { + "@types/estree": "1.0.6" + }, + "bin": { + "rollup": "dist/bin/rollup" + }, + "engines": { + "node": ">=18.0.0", + "npm": ">=8.0.0" + }, + "optionalDependencies": { + "@rollup/rollup-android-arm-eabi": "4.34.7", + "@rollup/rollup-android-arm64": "4.34.7", + "@rollup/rollup-darwin-arm64": "4.34.7", + "@rollup/rollup-darwin-x64": "4.34.7", + "@rollup/rollup-freebsd-arm64": "4.34.7", + "@rollup/rollup-freebsd-x64": "4.34.7", + "@rollup/rollup-linux-arm-gnueabihf": "4.34.7", + "@rollup/rollup-linux-arm-musleabihf": "4.34.7", + "@rollup/rollup-linux-arm64-gnu": "4.34.7", + "@rollup/rollup-linux-arm64-musl": "4.34.7", + "@rollup/rollup-linux-loongarch64-gnu": "4.34.7", + "@rollup/rollup-linux-powerpc64le-gnu": "4.34.7", + "@rollup/rollup-linux-riscv64-gnu": "4.34.7", + "@rollup/rollup-linux-s390x-gnu": "4.34.7", + "@rollup/rollup-linux-x64-gnu": "4.34.7", + "@rollup/rollup-linux-x64-musl": "4.34.7", + "@rollup/rollup-win32-arm64-msvc": "4.34.7", + "@rollup/rollup-win32-ia32-msvc": "4.34.7", + "@rollup/rollup-win32-x64-msvc": "4.34.7", + "fsevents": "~2.3.2" + } + }, + "node_modules/run-parallel": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", + "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT", + "peer": true, + "dependencies": { + "queue-microtask": "^1.2.2" + } + }, + "node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT" + }, + "node_modules/safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", + "license": "MIT", + "optional": true + }, + "node_modules/sax": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/sax/-/sax-1.4.1.tgz", + "integrity": "sha512-+aWOz7yVScEGoKNd4PA10LZ8sk0A/z5+nXQG5giUO5rprX9jgYsTdov9qCchZiPIZezbZH+jRut8nPodFAX4Jg==", + "license": "ISC" + }, + "node_modules/semver": { + "version": "7.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.1.tgz", + "integrity": "sha512-hlq8tAfn0m/61p4BVRcPzIGr6LKiMwo4VM6dGi6pt4qcRkmNzTcWq6eCEjEh+qXjkMDvPlOFFSGwQjoEa6gyMA==", + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/sharp": { + "version": "0.33.5", + "resolved": "https://registry.npmjs.org/sharp/-/sharp-0.33.5.tgz", + "integrity": "sha512-haPVm1EkS9pgvHrQ/F3Xy+hgcuMV0Wm9vfIBSiwZ05k+xgb0PkBQpGsAA/oWdDobNaZTH5ppvHtzCFbnSEwHVw==", + "hasInstallScript": true, + "license": "Apache-2.0", + "dependencies": { + "color": "^4.2.3", + "detect-libc": "^2.0.3", + "semver": "^7.6.3" + }, + "engines": { + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-darwin-arm64": "0.33.5", + "@img/sharp-darwin-x64": "0.33.5", + "@img/sharp-libvips-darwin-arm64": "1.0.4", + "@img/sharp-libvips-darwin-x64": "1.0.4", + "@img/sharp-libvips-linux-arm": "1.0.5", + "@img/sharp-libvips-linux-arm64": "1.0.4", + "@img/sharp-libvips-linux-s390x": "1.0.4", + "@img/sharp-libvips-linux-x64": "1.0.4", + "@img/sharp-libvips-linuxmusl-arm64": "1.0.4", + "@img/sharp-libvips-linuxmusl-x64": "1.0.4", + "@img/sharp-linux-arm": "0.33.5", + "@img/sharp-linux-arm64": "0.33.5", + "@img/sharp-linux-s390x": "0.33.5", + "@img/sharp-linux-x64": "0.33.5", + "@img/sharp-linuxmusl-arm64": "0.33.5", + "@img/sharp-linuxmusl-x64": "0.33.5", + "@img/sharp-wasm32": "0.33.5", + "@img/sharp-win32-ia32": "0.33.5", + "@img/sharp-win32-x64": "0.33.5" + } + }, + "node_modules/shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "license": "MIT", + "dependencies": { + "shebang-regex": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/shiki": { + "version": "1.29.2", + "resolved": "https://registry.npmjs.org/shiki/-/shiki-1.29.2.tgz", + "integrity": "sha512-njXuliz/cP+67jU2hukkxCNuH1yUi4QfdZZY+sMr5PPrIyXSu5iTb/qYC4BiWWB0vZ+7TbdvYUCeL23zpwCfbg==", + "license": "MIT", + "peer": true, + "dependencies": { + "@shikijs/core": "1.29.2", + "@shikijs/engine-javascript": "1.29.2", + "@shikijs/engine-oniguruma": "1.29.2", + "@shikijs/langs": "1.29.2", + "@shikijs/themes": "1.29.2", + "@shikijs/types": "1.29.2", + "@shikijs/vscode-textmate": "^10.0.1", + "@types/hast": "^3.0.4" + } + }, + "node_modules/signal-exit": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz", + "integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==", + "license": "ISC", + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/simple-concat": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/simple-concat/-/simple-concat-1.0.1.tgz", + "integrity": "sha512-cSFtAPtRhljv69IK0hTVZQ+OfE9nePi/rtJmw5UjHeVyVroEqJXP1sFztKUy1qU+xvz3u/sfYJLa947b7nAN2Q==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT", + "optional": true + }, + "node_modules/simple-get": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/simple-get/-/simple-get-4.0.1.tgz", + "integrity": "sha512-brv7p5WgH0jmQJr1ZDDfKDOSeWWg+OVypG99A/5vYGPqJ6pxiaHLy8nxtFjBA7oMa01ebA9gfh1uMCFqOuXxvA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT", + "optional": true, + "dependencies": { + "decompress-response": "^6.0.0", + "once": "^1.3.1", + "simple-concat": "^1.0.0" + } + }, + "node_modules/simple-swizzle": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/simple-swizzle/-/simple-swizzle-0.2.2.tgz", + "integrity": "sha512-JA//kQgZtbuY83m+xT+tXJkmJncGMTFT+C+g2h2R9uxkYIrE2yy9sgmcLhCnw57/WSD+Eh3J97FPEDFnbXnDUg==", + "license": "MIT", + "dependencies": { + "is-arrayish": "^0.3.1" + } + }, + "node_modules/sisteransi": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/sisteransi/-/sisteransi-1.0.5.tgz", + "integrity": "sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg==", + "license": "MIT", + "peer": true + }, + "node_modules/smart-buffer": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/smart-buffer/-/smart-buffer-4.2.0.tgz", + "integrity": "sha512-94hK0Hh8rPqQl2xXc3HsaBoOXKV20MToPkcXvwbISWLEs+64sBq5kFgn2kJDHb1Pry9yrP0dxrCI9RRci7RXKg==", + "license": "MIT", + "engines": { + "node": ">= 6.0.0", + "npm": ">= 3.0.0" + } + }, + "node_modules/smol-toml": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/smol-toml/-/smol-toml-1.3.1.tgz", + "integrity": "sha512-tEYNll18pPKHroYSmLLrksq233j021G0giwW7P3D24jC54pQ5W5BXMsQ/Mvw1OJCmEYDgY+lrzT+3nNUtoNfXQ==", + "license": "BSD-3-Clause", + "peer": true, + "engines": { + "node": ">= 18" + }, + "funding": { + "url": "https://github.com/sponsors/cyyynthia" + } + }, + "node_modules/socks": { + "version": "2.8.4", + "resolved": "https://registry.npmjs.org/socks/-/socks-2.8.4.tgz", + "integrity": "sha512-D3YaD0aRxR3mEcqnidIs7ReYJFVzWdd6fXJYUM8ixcQcJRGTka/b3saV0KflYhyVJXKhb947GndU35SxYNResQ==", + "license": "MIT", + "dependencies": { + "ip-address": "^9.0.5", + "smart-buffer": "^4.2.0" + }, + "engines": { + "node": ">= 10.0.0", + "npm": ">= 3.0.0" + } + }, + "node_modules/socks-proxy-agent": { + "version": "8.0.5", + "resolved": "https://registry.npmjs.org/socks-proxy-agent/-/socks-proxy-agent-8.0.5.tgz", + "integrity": "sha512-HehCEsotFqbPW9sJ8WVYB6UbmIMv7kUUORIF2Nncq4VQvBfNBLibW9YZR5dlYCSUhwcD628pRllm7n+E+YTzJw==", + "license": "MIT", + "dependencies": { + "agent-base": "^7.1.2", + "debug": "^4.3.4", + "socks": "^2.8.3" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/source-map-js": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz", + "integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==", + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/space-separated-tokens": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/space-separated-tokens/-/space-separated-tokens-2.0.2.tgz", + "integrity": "sha512-PEGlAwrG8yXGXRjW32fGbg66JAlOAwbObuqVoJpv/mRgoWDQfgH1wDPvtzWyUSNAXBGSk8h755YDbbcEy3SH2Q==", + "license": "MIT", + "peer": true, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/sprintf-js": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", + "integrity": "sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==", + "license": "BSD-3-Clause", + "peer": true + }, + "node_modules/ssri": { + "version": "12.0.0", + "resolved": "https://registry.npmjs.org/ssri/-/ssri-12.0.0.tgz", + "integrity": "sha512-S7iGNosepx9RadX82oimUkvr0Ct7IjJbEbs4mJcTxst8um95J3sDYU1RBEOvdu6oL1Wek2ODI5i4MAw+dZ6cAQ==", + "license": "ISC", + "dependencies": { + "minipass": "^7.0.3" + }, + "engines": { + "node": "^18.17.0 || >=20.5.0" + } + }, + "node_modules/string_decoder": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", + "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", + "license": "MIT", + "dependencies": { + "safe-buffer": "~5.2.0" + } + }, + "node_modules/string-width": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-7.2.0.tgz", + "integrity": "sha512-tsaTIkKW9b4N+AEj+SVA+WhJzV7/zMhcSu78mLKWSk7cXMOSHsBKFWUs0fWwq8QyK3MgJBQRX6Gbi4kYbdvGkQ==", + "license": "MIT", + "peer": true, + "dependencies": { + "emoji-regex": "^10.3.0", + "get-east-asian-width": "^1.0.0", + "strip-ansi": "^7.1.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/string-width-cjs": { + "name": "string-width", + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "license": "MIT", + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/string-width-cjs/node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/string-width-cjs/node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "license": "MIT" + }, + "node_modules/string-width-cjs/node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "license": "MIT", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/stringify-entities": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/stringify-entities/-/stringify-entities-4.0.4.tgz", + "integrity": "sha512-IwfBptatlO+QCJUo19AqvrPNqlVMpW9YEL2LIVY+Rpv2qsjCGxaDLNRgeGsQWJhfItebuJhsGSLjaBbNSQ+ieg==", + "license": "MIT", + "peer": true, + "dependencies": { + "character-entities-html4": "^2.0.0", + "character-entities-legacy": "^3.0.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/strip-ansi": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz", + "integrity": "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==", + "license": "MIT", + "dependencies": { + "ansi-regex": "^6.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/strip-ansi?sponsor=1" + } + }, + "node_modules/strip-ansi-cjs": { + "name": "strip-ansi", + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "license": "MIT", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-ansi-cjs/node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-bom": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", + "integrity": "sha512-vavAMRXOgBVNF6nyEEmL3DBK19iRpDcoIwW+swQ+CbGiu7lju6t+JklA1MHweoWtadgt4ISVUsXLyDq34ddcwA==", + "license": "MIT", + "peer": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/strip-json-comments": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", + "integrity": "sha512-4gB8na07fecVVkOI6Rs4e7T6NOTki5EmL7TUduTs6bu3EdnSycntVJ4re8kgZA+wx9IueI2Y11bfbgwtzuE0KQ==", + "license": "MIT", + "optional": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/strtok3": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/strtok3/-/strtok3-7.1.1.tgz", + "integrity": "sha512-mKX8HA/cdBqMKUr0MMZAFssCkIGoZeSCMXgnt79yKxNFguMLVFgRe6wB+fsL0NmoHDbeyZXczy7vEPSoo3rkzg==", + "license": "MIT", + "dependencies": { + "@tokenizer/token": "^0.3.0", + "peek-readable": "^5.1.3" + }, + "engines": { + "node": ">=16" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/Borewit" + } + }, + "node_modules/supports-preserve-symlinks-flag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", + "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/tar": { + "version": "7.4.3", + "resolved": "https://registry.npmjs.org/tar/-/tar-7.4.3.tgz", + "integrity": "sha512-5S7Va8hKfV7W5U6g3aYxXmlPoZVAwUMy9AOKyF2fVuZa2UD3qZjg578OrLRt8PcNN1PleVaL/5/yYATNL0ICUw==", + "license": "ISC", + "dependencies": { + "@isaacs/fs-minipass": "^4.0.0", + "chownr": "^3.0.0", + "minipass": "^7.1.2", + "minizlib": "^3.0.1", + "mkdirp": "^3.0.1", + "yallist": "^5.0.0" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/tar-fs": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/tar-fs/-/tar-fs-2.1.2.tgz", + "integrity": "sha512-EsaAXwxmx8UB7FRKqeozqEPop69DXcmYwTQwXvyAPF352HJsPdkVhvTaDPYqfNgruveJIJy3TA2l+2zj8LJIJA==", + "license": "MIT", + "optional": true, + "dependencies": { + "chownr": "^1.1.1", + "mkdirp-classic": "^0.5.2", + "pump": "^3.0.0", + "tar-stream": "^2.1.4" + } + }, + "node_modules/tar-stream": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-2.2.0.tgz", + "integrity": "sha512-ujeqbceABgwMZxEJnk2HDY2DlnUZ+9oEcb1KzTVfYHio0UE6dG71n60d8D2I4qNvleWrrXpmjpt7vZeF1LnMZQ==", + "license": "MIT", + "optional": true, + "dependencies": { + "bl": "^4.0.3", + "end-of-stream": "^1.4.1", + "fs-constants": "^1.0.0", + "inherits": "^2.0.3", + "readable-stream": "^3.1.1" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/tar-stream/node_modules/readable-stream": { + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", + "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", + "license": "MIT", + "optional": true, + "dependencies": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/tar/node_modules/chownr": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/chownr/-/chownr-3.0.0.tgz", + "integrity": "sha512-+IxzY9BZOQd/XuYPRmrvEVjF/nqj5kgT4kEq7VofrDoM1MxoRjEWkrCC3EtLi59TVawxTAn+orJwFQcrqEN1+g==", + "license": "BlueOak-1.0.0", + "engines": { + "node": ">=18" + } + }, + "node_modules/tar/node_modules/mkdirp": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-3.0.1.tgz", + "integrity": "sha512-+NsyUUAZDmo6YVHzL/stxSu3t9YS1iljliy3BSDrXJ/dkn1KYdmtZODGGjLcc9XLgVVpH4KshHB8XmZgMhaBXg==", + "license": "MIT", + "bin": { + "mkdirp": "dist/cjs/src/bin.js" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/timm": { + "version": "1.7.1", + "resolved": "https://registry.npmjs.org/timm/-/timm-1.7.1.tgz", + "integrity": "sha512-IjZc9KIotudix8bMaBW6QvMuq64BrJWFs1+4V0lXwWGQZwH+LnX87doAYhem4caOEusRP9/g6jVDQmZ8XOk1nw==", + "license": "MIT" + }, + "node_modules/tinycolor2": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/tinycolor2/-/tinycolor2-1.6.0.tgz", + "integrity": "sha512-XPaBkWQJdsf3pLKJV9p4qN/S+fm2Oj8AIPo1BTUhg5oxkvm9+SVEGFdhyOz7tTdUTfvxMiAs4sp6/eZO2Ew+pw==", + "license": "MIT" + }, + "node_modules/tinyexec": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/tinyexec/-/tinyexec-0.3.2.tgz", + "integrity": "sha512-KQQR9yN7R5+OSwaK0XQoj22pwHoTlgYqmUscPYoknOoWCWfj/5/ABTMRi69FrKU5ffPVh5QcFikpWJI/P1ocHA==", + "license": "MIT", + "peer": true + }, + "node_modules/tinypool": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/tinypool/-/tinypool-0.1.3.tgz", + "integrity": "sha512-2IfcQh7CP46XGWGGbdyO4pjcKqsmVqFAPcXfPxcPXmOWt9cYkTP9HcDmGgsfijYoAEc4z9qcpM/BaBz46Y9/CQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/tinyspy": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/tinyspy/-/tinyspy-0.3.3.tgz", + "integrity": "sha512-gRiUR8fuhUf0W9lzojPf1N1euJYA30ISebSfgca8z76FOvXtVXqd5ojEIaKLWbDQhAaC3ibxZIjqbyi4ybjcTw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "license": "MIT", + "peer": true, + "dependencies": { + "is-number": "^7.0.0" + }, + "engines": { + "node": ">=8.0" + } + }, + "node_modules/token-types": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/token-types/-/token-types-5.0.1.tgz", + "integrity": "sha512-Y2fmSnZjQdDb9W4w4r1tswlMHylzWIeOKpx0aZH9BgGtACHhrk3OkT52AzwcuqTRBZtvvnTjDBh8eynMulu8Vg==", + "license": "MIT", + "dependencies": { + "@tokenizer/token": "^0.3.0", + "ieee754": "^1.2.1" + }, + "engines": { + "node": ">=14.16" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/Borewit" + } + }, + "node_modules/trim-lines": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/trim-lines/-/trim-lines-3.0.1.tgz", + "integrity": "sha512-kRj8B+YHZCc9kQYdWfJB2/oUl9rA99qbowYYBtr4ui4mZyAQ2JpvVBd/6U2YloATfqBhBTSMhTpgBHtU0Mf3Rg==", + "license": "MIT", + "peer": true, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/trough": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/trough/-/trough-2.2.0.tgz", + "integrity": "sha512-tmMpK00BjZiUyVyvrBK7knerNgmgvcV/KLVyuma/SC+TQN167GrMRciANTz09+k3zW8L8t60jWO1GpfkZdjTaw==", + "license": "MIT", + "peer": true, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/tsconfck": { + "version": "3.1.5", + "resolved": "https://registry.npmjs.org/tsconfck/-/tsconfck-3.1.5.tgz", + "integrity": "sha512-CLDfGgUp7XPswWnezWwsCRxNmgQjhYq3VXHM0/XIRxhVrKw0M1if9agzryh1QS3nxjCROvV+xWxoJO1YctzzWg==", + "license": "MIT", + "peer": true, + "bin": { + "tsconfck": "bin/tsconfck.js" + }, + "engines": { + "node": "^18 || >=20" + }, + "peerDependencies": { + "typescript": "^5.0.0" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/tslib": { + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", + "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==", + "license": "0BSD", + "optional": true + }, + "node_modules/tunnel-agent": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", + "integrity": "sha512-McnNiV1l8RYeY8tBgEpuodCC1mLUdbSN+CYBL7kJsJNInOP8UjDDEwdk6Mw60vdLLrr5NHKZhMAOSrR2NZuQ+w==", + "license": "Apache-2.0", + "optional": true, + "dependencies": { + "safe-buffer": "^5.0.1" + }, + "engines": { + "node": "*" + } + }, + "node_modules/type-detect": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.1.0.tgz", + "integrity": "sha512-Acylog8/luQ8L7il+geoSxhEkazvkslg7PSNKOX59mbB9cOveP5aq9h74Y7YU8yDpJwetzQQrfIwtf4Wp4LKcw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/type-fest": { + "version": "4.34.1", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-4.34.1.tgz", + "integrity": "sha512-6kSc32kT0rbwxD6QL1CYe8IqdzN/J/ILMrNK+HMQCKH3insCDRY/3ITb0vcBss0a3t72fzh2YSzj8ko1HgwT3g==", + "license": "(MIT OR CC0-1.0)", + "peer": true, + "engines": { + "node": ">=16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/typescript": { + "version": "5.7.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.7.3.tgz", + "integrity": "sha512-84MVSjMEHP+FQRPy3pX9sTVV/INIex71s9TL2Gm5FG/WG1SqXeKyZ0k7/blY/4FdOzI12CBy1vGc4og/eus0fw==", + "license": "Apache-2.0", + "peer": true, + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + }, + "node_modules/ufo": { + "version": "1.5.4", + "resolved": "https://registry.npmjs.org/ufo/-/ufo-1.5.4.tgz", + "integrity": "sha512-UsUk3byDzKd04EyoZ7U4DOlxQaD14JUKQl6/P7wiX4FNvUfm3XL246n9W5AmqwW5RSFJ27NAuM0iLscAOYUiGQ==", + "license": "MIT", + "peer": true + }, + "node_modules/ultrahtml": { + "version": "1.5.3", + "resolved": "https://registry.npmjs.org/ultrahtml/-/ultrahtml-1.5.3.tgz", + "integrity": "sha512-GykOvZwgDWZlTQMtp5jrD4BVL+gNn2NVlVafjcFUJ7taY20tqYdwdoWBFy6GBJsNTZe1GkGPkSl5knQAjtgceg==", + "license": "MIT", + "peer": true + }, + "node_modules/uncrypto": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/uncrypto/-/uncrypto-0.1.3.tgz", + "integrity": "sha512-Ql87qFHB3s/De2ClA9e0gsnS6zXG27SkTiSJwjCc9MebbfapQfuPzumMIUMi38ezPZVNFcHI9sUIepeQfw8J8Q==", + "license": "MIT", + "peer": true + }, + "node_modules/undici-types": { + "version": "6.20.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.20.0.tgz", + "integrity": "sha512-Ny6QZ2Nju20vw1SRHe3d9jVu6gJ+4e3+MMpqu7pqE5HT6WsTSlce++GQmK5UXS8mzV8DSYHrQH+Xrf2jVcuKNg==", + "license": "MIT", + "optional": true, + "peer": true + }, + "node_modules/unified": { + "version": "11.0.5", + "resolved": "https://registry.npmjs.org/unified/-/unified-11.0.5.tgz", + "integrity": "sha512-xKvGhPWw3k84Qjh8bI3ZeJjqnyadK+GEFtazSfZv/rKeTkTjOJho6mFqh2SM96iIcZokxiOpg78GazTSg8+KHA==", + "license": "MIT", + "peer": true, + "dependencies": { + "@types/unist": "^3.0.0", + "bail": "^2.0.0", + "devlop": "^1.0.0", + "extend": "^3.0.0", + "is-plain-obj": "^4.0.0", + "trough": "^2.0.0", + "vfile": "^6.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/unique-filename": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/unique-filename/-/unique-filename-4.0.0.tgz", + "integrity": "sha512-XSnEewXmQ+veP7xX2dS5Q4yZAvO40cBN2MWkJ7D/6sW4Dg6wYBNwM1Vrnz1FhH5AdeLIlUXRI9e28z1YZi71NQ==", + "license": "ISC", + "dependencies": { + "unique-slug": "^5.0.0" + }, + "engines": { + "node": "^18.17.0 || >=20.5.0" + } + }, + "node_modules/unique-slug": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/unique-slug/-/unique-slug-5.0.0.tgz", + "integrity": "sha512-9OdaqO5kwqR+1kVgHAhsp5vPNU0hnxRa26rBFNfNgM7M6pNtgzeBn3s/xbyCQL3dcjzOatcef6UUHpB/6MaETg==", + "license": "ISC", + "dependencies": { + "imurmurhash": "^0.1.4" + }, + "engines": { + "node": "^18.17.0 || >=20.5.0" + } + }, + "node_modules/unist-util-find-after": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/unist-util-find-after/-/unist-util-find-after-5.0.0.tgz", + "integrity": "sha512-amQa0Ep2m6hE2g72AugUItjbuM8X8cGQnFoHk0pGfrFeT9GZhzN5SW8nRsiGKK7Aif4CrACPENkA6P/Lw6fHGQ==", + "license": "MIT", + "peer": true, + "dependencies": { + "@types/unist": "^3.0.0", + "unist-util-is": "^6.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/unist-util-is": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-6.0.0.tgz", + "integrity": "sha512-2qCTHimwdxLfz+YzdGfkqNlH0tLi9xjTnHddPmJwtIG9MGsdbutfTc4P+haPD7l7Cjxf/WZj+we5qfVPvvxfYw==", + "license": "MIT", + "peer": true, + "dependencies": { + "@types/unist": "^3.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/unist-util-modify-children": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/unist-util-modify-children/-/unist-util-modify-children-4.0.0.tgz", + "integrity": "sha512-+tdN5fGNddvsQdIzUF3Xx82CU9sMM+fA0dLgR9vOmT0oPT2jH+P1nd5lSqfCfXAw+93NhcXNY2qqvTUtE4cQkw==", + "license": "MIT", + "peer": true, + "dependencies": { + "@types/unist": "^3.0.0", + "array-iterate": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/unist-util-position": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/unist-util-position/-/unist-util-position-5.0.0.tgz", + "integrity": "sha512-fucsC7HjXvkB5R3kTCO7kUjRdrS0BJt3M/FPxmHMBOm8JQi2BsHAHFsy27E0EolP8rp0NzXsJ+jNPyDWvOJZPA==", + "license": "MIT", + "peer": true, + "dependencies": { + "@types/unist": "^3.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/unist-util-remove-position": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/unist-util-remove-position/-/unist-util-remove-position-5.0.0.tgz", + "integrity": "sha512-Hp5Kh3wLxv0PHj9m2yZhhLt58KzPtEYKQQ4yxfYFEO7EvHwzyDYnduhHnY1mDxoqr7VUwVuHXk9RXKIiYS1N8Q==", + "license": "MIT", + "peer": true, + "dependencies": { + "@types/unist": "^3.0.0", + "unist-util-visit": "^5.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/unist-util-stringify-position": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/unist-util-stringify-position/-/unist-util-stringify-position-4.0.0.tgz", + "integrity": "sha512-0ASV06AAoKCDkS2+xw5RXJywruurpbC4JZSm7nr7MOt1ojAzvyyaO+UxZf18j8FCF6kmzCZKcAgN/yu2gm2XgQ==", + "license": "MIT", + "peer": true, + "dependencies": { + "@types/unist": "^3.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/unist-util-visit": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-5.0.0.tgz", + "integrity": "sha512-MR04uvD+07cwl/yhVuVWAtw+3GOR/knlL55Nd/wAdblk27GCVt3lqpTivy/tkJcZoNPzTwS1Y+KMojlLDhoTzg==", + "license": "MIT", + "peer": true, + "dependencies": { + "@types/unist": "^3.0.0", + "unist-util-is": "^6.0.0", + "unist-util-visit-parents": "^6.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/unist-util-visit-children": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/unist-util-visit-children/-/unist-util-visit-children-3.0.0.tgz", + "integrity": "sha512-RgmdTfSBOg04sdPcpTSD1jzoNBjt9a80/ZCzp5cI9n1qPzLZWF9YdvWGN2zmTumP1HWhXKdUWexjy/Wy/lJ7tA==", + "license": "MIT", + "peer": true, + "dependencies": { + "@types/unist": "^3.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/unist-util-visit-parents": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-6.0.1.tgz", + "integrity": "sha512-L/PqWzfTP9lzzEa6CKs0k2nARxTdZduw3zyh8d2NVBnsyvHjSX4TWse388YrrQKbvI8w20fGjGlhgT96WwKykw==", + "license": "MIT", + "peer": true, + "dependencies": { + "@types/unist": "^3.0.0", + "unist-util-is": "^6.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/unstorage": { + "version": "1.14.4", + "resolved": "https://registry.npmjs.org/unstorage/-/unstorage-1.14.4.tgz", + "integrity": "sha512-1SYeamwuYeQJtJ/USE1x4l17LkmQBzg7deBJ+U9qOBoHo15d1cDxG4jM31zKRgF7pG0kirZy4wVMX6WL6Zoscg==", + "license": "MIT", + "peer": true, + "dependencies": { + "anymatch": "^3.1.3", + "chokidar": "^3.6.0", + "destr": "^2.0.3", + "h3": "^1.13.0", + "lru-cache": "^10.4.3", + "node-fetch-native": "^1.6.4", + "ofetch": "^1.4.1", + "ufo": "^1.5.4" + }, + "peerDependencies": { + "@azure/app-configuration": "^1.8.0", + "@azure/cosmos": "^4.2.0", + "@azure/data-tables": "^13.3.0", + "@azure/identity": "^4.5.0", + "@azure/keyvault-secrets": "^4.9.0", + "@azure/storage-blob": "^12.26.0", + "@capacitor/preferences": "^6.0.3", + "@deno/kv": ">=0.8.4", + "@netlify/blobs": "^6.5.0 || ^7.0.0 || ^8.1.0", + "@planetscale/database": "^1.19.0", + "@upstash/redis": "^1.34.3", + "@vercel/blob": ">=0.27.0", + "@vercel/kv": "^1.0.1", + "aws4fetch": "^1.0.20", + "db0": ">=0.2.1", + "idb-keyval": "^6.2.1", + "ioredis": "^5.4.2", + "uploadthing": "^7.4.1" + }, + "peerDependenciesMeta": { + "@azure/app-configuration": { + "optional": true + }, + "@azure/cosmos": { + "optional": true + }, + "@azure/data-tables": { + "optional": true + }, + "@azure/identity": { + "optional": true + }, + "@azure/keyvault-secrets": { + "optional": true + }, + "@azure/storage-blob": { + "optional": true + }, + "@capacitor/preferences": { + "optional": true + }, + "@deno/kv": { + "optional": true + }, + "@netlify/blobs": { + "optional": true + }, + "@planetscale/database": { + "optional": true + }, + "@upstash/redis": { + "optional": true + }, + "@vercel/blob": { + "optional": true + }, + "@vercel/kv": { + "optional": true + }, + "aws4fetch": { + "optional": true + }, + "db0": { + "optional": true + }, + "idb-keyval": { + "optional": true + }, + "ioredis": { + "optional": true + }, + "uploadthing": { + "optional": true + } + } + }, + "node_modules/utif": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/utif/-/utif-2.0.1.tgz", + "integrity": "sha512-Z/S1fNKCicQTf375lIP9G8Sa1H/phcysstNrrSdZKj1f9g58J4NMgb5IgiEZN9/nLMPDwF0W7hdOe9Qq2IYoLg==", + "license": "MIT", + "dependencies": { + "pako": "^1.0.5" + } + }, + "node_modules/util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==", + "license": "MIT", + "optional": true + }, + "node_modules/vfile": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/vfile/-/vfile-6.0.3.tgz", + "integrity": "sha512-KzIbH/9tXat2u30jf+smMwFCsno4wHVdNmzFyL+T/L3UGqqk6JKfVqOFOZEpZSHADH1k40ab6NUIXZq422ov3Q==", + "license": "MIT", + "peer": true, + "dependencies": { + "@types/unist": "^3.0.0", + "vfile-message": "^4.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/vfile-location": { + "version": "5.0.3", + "resolved": "https://registry.npmjs.org/vfile-location/-/vfile-location-5.0.3.tgz", + "integrity": "sha512-5yXvWDEgqeiYiBe1lbxYF7UMAIm/IcopxMHrMQDq3nvKcjPKIhZklUKL+AE7J7uApI4kwe2snsK+eI6UTj9EHg==", + "license": "MIT", + "peer": true, + "dependencies": { + "@types/unist": "^3.0.0", + "vfile": "^6.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/vfile-message": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/vfile-message/-/vfile-message-4.0.2.tgz", + "integrity": "sha512-jRDZ1IMLttGj41KcZvlrYAaI3CfqpLpfpf+Mfig13viT6NKvRzWZ+lXz0Y5D60w6uJIBAOGq9mSHf0gktF0duw==", + "license": "MIT", + "peer": true, + "dependencies": { + "@types/unist": "^3.0.0", + "unist-util-stringify-position": "^4.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/vite": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/vite/-/vite-6.1.0.tgz", + "integrity": "sha512-RjjMipCKVoR4hVfPY6GQTgveinjNuyLw+qruksLDvA5ktI1150VmcMBKmQaEWJhg/j6Uaf6dNCNA0AfdzUb/hQ==", + "license": "MIT", + "peer": true, + "dependencies": { + "esbuild": "^0.24.2", + "postcss": "^8.5.1", + "rollup": "^4.30.1" + }, + "bin": { + "vite": "bin/vite.js" + }, + "engines": { + "node": "^18.0.0 || ^20.0.0 || >=22.0.0" + }, + "funding": { + "url": "https://github.com/vitejs/vite?sponsor=1" + }, + "optionalDependencies": { + "fsevents": "~2.3.3" + }, + "peerDependencies": { + "@types/node": "^18.0.0 || ^20.0.0 || >=22.0.0", + "jiti": ">=1.21.0", + "less": "*", + "lightningcss": "^1.21.0", + "sass": "*", + "sass-embedded": "*", + "stylus": "*", + "sugarss": "*", + "terser": "^5.16.0", + "tsx": "^4.8.1", + "yaml": "^2.4.2" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + }, + "jiti": { + "optional": true + }, + "less": { + "optional": true + }, + "lightningcss": { + "optional": true + }, + "sass": { + "optional": true + }, + "sass-embedded": { + "optional": true + }, + "stylus": { + "optional": true + }, + "sugarss": { + "optional": true + }, + "terser": { + "optional": true + }, + "tsx": { + "optional": true + }, + "yaml": { + "optional": true + } + } + }, + "node_modules/vitefu": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/vitefu/-/vitefu-1.0.5.tgz", + "integrity": "sha512-h4Vflt9gxODPFNGPwp4zAMZRpZR7eslzwH2c5hn5kNZ5rhnKyRJ50U+yGCdc2IRaBs8O4haIgLNGrV5CrpMsCA==", + "license": "MIT", + "peer": true, + "workspaces": [ + "tests/deps/*", + "tests/projects/*" + ], + "peerDependencies": { + "vite": "^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0" + }, + "peerDependenciesMeta": { + "vite": { + "optional": true + } + } + }, + "node_modules/vitest": { + "version": "0.12.10", + "resolved": "https://registry.npmjs.org/vitest/-/vitest-0.12.10.tgz", + "integrity": "sha512-TVoI6fM7rZ1zIMDjcviY8Dg5XIaPqBwDweaI3oUwvWqUz68cbM49CIHNMkF+UVoSjl94wXiBRdNhsT4ekgWuGA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/chai": "^4.3.1", + "@types/chai-subset": "^1.3.3", + "chai": "^4.3.6", + "debug": "^4.3.4", + "local-pkg": "^0.4.1", + "tinypool": "^0.1.3", + "tinyspy": "^0.3.2", + "vite": "^2.9.9" + }, + "bin": { + "vitest": "vitest.mjs" + }, + "engines": { + "node": ">=v14.16.0" + }, + "funding": { + "url": "https://github.com/sponsors/antfu" + }, + "peerDependencies": { + "@vitest/ui": "*", + "c8": "*", + "happy-dom": "*", + "jsdom": "*" + }, + "peerDependenciesMeta": { + "@vitest/ui": { + "optional": true + }, + "c8": { + "optional": true + }, + "happy-dom": { + "optional": true + }, + "jsdom": { + "optional": true + } + } + }, + "node_modules/vitest/node_modules/@esbuild/linux-loong64": { + "version": "0.14.54", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.14.54.tgz", + "integrity": "sha512-bZBrLAIX1kpWelV0XemxBZllyRmM6vgFQQG2GdNb+r3Fkp0FOh1NJSvekXDs7jq70k4euu1cryLMfU+mTXlEpw==", + "cpu": [ + "loong64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/vitest/node_modules/esbuild": { + "version": "0.14.54", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.14.54.tgz", + "integrity": "sha512-Cy9llcy8DvET5uznocPyqL3BFRrFXSVqbgpMJ9Wz8oVjZlh/zUSNbPRbov0VX7VxN2JH1Oa0uNxZ7eLRb62pJA==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "bin": { + "esbuild": "bin/esbuild" + }, + "engines": { + "node": ">=12" + }, + "optionalDependencies": { + "@esbuild/linux-loong64": "0.14.54", + "esbuild-android-64": "0.14.54", + "esbuild-android-arm64": "0.14.54", + "esbuild-darwin-64": "0.14.54", + "esbuild-darwin-arm64": "0.14.54", + "esbuild-freebsd-64": "0.14.54", + "esbuild-freebsd-arm64": "0.14.54", + "esbuild-linux-32": "0.14.54", + "esbuild-linux-64": "0.14.54", + "esbuild-linux-arm": "0.14.54", + "esbuild-linux-arm64": "0.14.54", + "esbuild-linux-mips64le": "0.14.54", + "esbuild-linux-ppc64le": "0.14.54", + "esbuild-linux-riscv64": "0.14.54", + "esbuild-linux-s390x": "0.14.54", + "esbuild-netbsd-64": "0.14.54", + "esbuild-openbsd-64": "0.14.54", + "esbuild-sunos-64": "0.14.54", + "esbuild-windows-32": "0.14.54", + "esbuild-windows-64": "0.14.54", + "esbuild-windows-arm64": "0.14.54" + } + }, + "node_modules/vitest/node_modules/rollup": { + "version": "2.77.3", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.77.3.tgz", + "integrity": "sha512-/qxNTG7FbmefJWoeeYJFbHehJ2HNWnjkAFRKzWN/45eNBBF/r8lo992CwcJXEzyVxs5FmfId+vTSTQDb+bxA+g==", + "dev": true, + "license": "MIT", + "bin": { + "rollup": "dist/bin/rollup" + }, + "engines": { + "node": ">=10.0.0" + }, + "optionalDependencies": { + "fsevents": "~2.3.2" + } + }, + "node_modules/vitest/node_modules/vite": { + "version": "2.9.18", + "resolved": "https://registry.npmjs.org/vite/-/vite-2.9.18.tgz", + "integrity": "sha512-sAOqI5wNM9QvSEE70W3UGMdT8cyEn0+PmJMTFvTB8wB0YbYUWw3gUbY62AOyrXosGieF2htmeLATvNxpv/zNyQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "esbuild": "^0.14.27", + "postcss": "^8.4.13", + "resolve": "^1.22.0", + "rollup": ">=2.59.0 <2.78.0" + }, + "bin": { + "vite": "bin/vite.js" + }, + "engines": { + "node": ">=12.2.0" + }, + "optionalDependencies": { + "fsevents": "~2.3.2" + }, + "peerDependencies": { + "less": "*", + "sass": "*", + "stylus": "*" + }, + "peerDependenciesMeta": { + "less": { + "optional": true + }, + "sass": { + "optional": true + }, + "stylus": { + "optional": true + } + } + }, + "node_modules/web-namespaces": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/web-namespaces/-/web-namespaces-2.0.1.tgz", + "integrity": "sha512-bKr1DkiNa2krS7qxNtdrtHAmzuYGFQLiQ13TsorsdT6ULTkPLKuu5+GsFpDlg6JFjUTwX2DyhMPG2be8uPrqsQ==", + "license": "MIT", + "peer": true, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/which": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/which/-/which-5.0.0.tgz", + "integrity": "sha512-JEdGzHwwkrbWoGOlIHqQ5gtprKGOenpDHpxE9zVR1bWbOtYRyPPHMe9FaP6x61CmNaTThSkb0DAJte5jD+DmzQ==", + "license": "ISC", + "dependencies": { + "isexe": "^3.1.1" + }, + "bin": { + "node-which": "bin/which.js" + }, + "engines": { + "node": "^18.17.0 || >=20.5.0" + } + }, + "node_modules/which-pm": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/which-pm/-/which-pm-3.0.1.tgz", + "integrity": "sha512-v2JrMq0waAI4ju1xU5x3blsxBBMgdgZve580iYMN5frDaLGjbA24fok7wKCsya8KLVO19Ju4XDc5+zTZCJkQfg==", + "license": "MIT", + "peer": true, + "dependencies": { + "load-yaml-file": "^0.2.0" + }, + "engines": { + "node": ">=18.12" + } + }, + "node_modules/which-pm-runs": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/which-pm-runs/-/which-pm-runs-1.1.0.tgz", + "integrity": "sha512-n1brCuqClxfFfq/Rb0ICg9giSZqCS+pLtccdag6C2HyufBrh3fBOiy9nb6ggRMvWOVH5GrdJskj5iGTZNxd7SA==", + "license": "MIT", + "peer": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/widest-line": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/widest-line/-/widest-line-5.0.0.tgz", + "integrity": "sha512-c9bZp7b5YtRj2wOe6dlj32MK+Bx/M/d+9VB2SHM1OtsUHR0aV0tdP6DWh/iMt0kWi1t5g1Iudu6hQRNd1A4PVA==", + "license": "MIT", + "peer": true, + "dependencies": { + "string-width": "^7.0.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/wrap-ansi": { + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-9.0.0.tgz", + "integrity": "sha512-G8ura3S+3Z2G+mkgNRq8dqaFZAuxfsxpBB8OCTGRTCtp+l/v9nbFNmCUP1BZMts3G1142MsZfn6eeUKrr4PD1Q==", + "license": "MIT", + "peer": true, + "dependencies": { + "ansi-styles": "^6.2.1", + "string-width": "^7.0.0", + "strip-ansi": "^7.1.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/wrap-ansi-cjs": { + "name": "wrap-ansi", + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/wrap-ansi-cjs/node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/wrap-ansi-cjs/node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "license": "MIT", + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/wrap-ansi-cjs/node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "license": "MIT" + }, + "node_modules/wrap-ansi-cjs/node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "license": "MIT", + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/wrap-ansi-cjs/node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "license": "MIT", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", + "license": "ISC", + "optional": true + }, + "node_modules/xhr": { + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/xhr/-/xhr-2.6.0.tgz", + "integrity": "sha512-/eCGLb5rxjx5e3mF1A7s+pLlR6CGyqWN91fv1JgER5mVWg1MZmlhBvy9kjcsOdRk8RrIujotWyJamfyrp+WIcA==", + "license": "MIT", + "dependencies": { + "global": "~4.4.0", + "is-function": "^1.0.1", + "parse-headers": "^2.0.0", + "xtend": "^4.0.0" + } + }, + "node_modules/xml-parse-from-string": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/xml-parse-from-string/-/xml-parse-from-string-1.0.1.tgz", + "integrity": "sha512-ErcKwJTF54uRzzNMXq2X5sMIy88zJvfN2DmdoQvy7PAFJ+tPRU6ydWuOKNMyfmOjdyBQTFREi60s0Y0SyI0G0g==", + "license": "MIT" + }, + "node_modules/xml2js": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.5.0.tgz", + "integrity": "sha512-drPFnkQJik/O+uPKpqSgr22mpuFHqKdbS835iAQrUC73L2F5WkboIRd63ai/2Yg6I1jzifPFKH2NTK+cfglkIA==", + "license": "MIT", + "dependencies": { + "sax": ">=0.6.0", + "xmlbuilder": "~11.0.0" + }, + "engines": { + "node": ">=4.0.0" + } + }, + "node_modules/xmlbuilder": { + "version": "11.0.1", + "resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-11.0.1.tgz", + "integrity": "sha512-fDlsI/kFEx7gLvbecc0/ohLG50fugQp8ryHzMTuW9vSa1GJ0XYWKnhsUx7oie3G98+r56aTQIUB4kht42R3JvA==", + "license": "MIT", + "engines": { + "node": ">=4.0" + } + }, + "node_modules/xtend": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", + "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==", + "license": "MIT", + "engines": { + "node": ">=0.4" + } + }, + "node_modules/xxhash-wasm": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/xxhash-wasm/-/xxhash-wasm-1.1.0.tgz", + "integrity": "sha512-147y/6YNh+tlp6nd/2pWq38i9h6mz/EuQ6njIrmW8D1BS5nCqs0P6DG+m6zTGnNz5I+uhZ0SHxBs9BsPrwcKDA==", + "license": "MIT", + "peer": true + }, + "node_modules/yallist": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-5.0.0.tgz", + "integrity": "sha512-YgvUTfwqyc7UXVMrB+SImsVYSmTS8X/tSrtdNZMImM+n7+QTriRXyXim0mBrTXNeqzVF0KWGgHPeiyViFFrNDw==", + "license": "BlueOak-1.0.0", + "engines": { + "node": ">=18" + } + }, + "node_modules/yargs-parser": { + "version": "21.1.1", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz", + "integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==", + "license": "ISC", + "peer": true, + "engines": { + "node": ">=12" + } + }, + "node_modules/yocto-queue": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-1.1.1.tgz", + "integrity": "sha512-b4JR1PFR10y1mKjhHY9LaGo6tmrgjit7hxVIeAmyMw3jegXR4dhYqLaQF5zMXZxY7tLpMyJeLjr1C4rLmkVe8g==", + "license": "MIT", + "engines": { + "node": ">=12.20" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/yocto-spinner": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/yocto-spinner/-/yocto-spinner-0.2.0.tgz", + "integrity": "sha512-Qu6WAqNLGleB687CCGcmgHIo8l+J19MX/32UrSMfbf/4L8gLoxjpOYoiHT1asiWyqvjRZbgvOhLlvne6E5Tbdw==", + "license": "MIT", + "peer": true, + "dependencies": { + "yoctocolors": "^2.1.1" + }, + "engines": { + "node": ">=18.19" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/yoctocolors": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/yoctocolors/-/yoctocolors-2.1.1.tgz", + "integrity": "sha512-GQHQqAopRhwU8Kt1DDM8NjibDXHC8eoh1erhGAJPEyveY9qqVeXvVikNKrDz69sHowPMorbPUrH/mx8c50eiBQ==", + "license": "MIT", + "peer": true, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/zod": { + "version": "3.24.2", + "resolved": "https://registry.npmjs.org/zod/-/zod-3.24.2.tgz", + "integrity": "sha512-lY7CDW43ECgW9u1TcT3IoXHflywfVqDYze4waEz812jR/bZ8FHDsl7pFQoSZTz5N+2NqRXs8GBwnAwo3ZNxqhQ==", + "license": "MIT", + "peer": true, + "funding": { + "url": "https://github.com/sponsors/colinhacks" + } + }, + "node_modules/zod-to-json-schema": { + "version": "3.24.1", + "resolved": "https://registry.npmjs.org/zod-to-json-schema/-/zod-to-json-schema-3.24.1.tgz", + "integrity": "sha512-3h08nf3Vw3Wl3PK+q3ow/lIil81IT2Oa7YpQyUUDsEWbXveMesdfK1xBd2RhCkynwZndAxixji/7SYJJowr62w==", + "license": "ISC", + "peer": true, + "peerDependencies": { + "zod": "^3.24.1" + } + }, + "node_modules/zod-to-ts": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/zod-to-ts/-/zod-to-ts-1.2.0.tgz", + "integrity": "sha512-x30XE43V+InwGpvTySRNz9kB7qFU8DlyEy7BsSTCHPH1R0QasMmHWZDCzYm6bVXtj/9NNJAZF3jW8rzFvH5OFA==", + "peer": true, + "peerDependencies": { + "typescript": "^4.9.4 || ^5.0.2", + "zod": "^3" + } + }, + "node_modules/zwitch": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/zwitch/-/zwitch-2.0.4.tgz", + "integrity": "sha512-bXE4cR/kVZhKZX/RjPEflHaKVhUVl85noU3v6b8apfQEc1x4A+zBxjZ4lN8LqGd6WZ3dl98pY4o717VFmoPp+A==", + "license": "MIT", + "peer": true, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + } + } +} diff --git a/packages/imagetools/package.json b/packages/imagetools/package.json index 1ef0c22..75eeca8 100644 --- a/packages/imagetools/package.json +++ b/packages/imagetools/package.json @@ -1,66 +1,69 @@ -{ - "name": "imagetools", - "version": "0.9.0", - "description": "Image Optimization tools for the Astro JS framework", - "type": "module", - "types": "./types.d.ts", - "exports": { - ".": "./index.js", - "./ssr": "./ssr/index.js", - "./api": "./api/index.js", - "./config": "./config.mjs", - "./components": "./components/index.js" - }, - "scripts": { - "test:watch": "vitest", - "test": "vitest run" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/RafidMuhymin/astro-imagetools.git" - }, - "keywords": [ - "astro", - "astro-component", - "image", - "images", - "optimization", - "responsive-image", - "vite", - "vite-plugin", - "sharp", - "imagetools", - "codecs", - "astropub" - ], - "author": "Rafid Muhymin", - "license": "MIT", - "bugs": { - "url": "https://github.com/RafidMuhymin/astro-imagetools/issues" - }, - "homepage": "https://github.com/RafidMuhymin/astro-imagetools#readme", - "dependencies": { - "@astropub/codecs": "0.4.4", - "@polymech/cache": "file:../../../polymech-mono/packages/cache", - "@polymech/commons": "file:../../../polymech-mono/packages/commons", - "@polymech/fs": "file:../../../polymech-mono/packages/fs", - "file-type": "17.1.1", - "find-cache-dir": "3.3.2", - "find-up": "^6.3.0", - "object-hash": "3.0.0", - "p-map": "^7.0.3", - "potrace": "2.1.8" - }, - "optionalDependencies": { - "imagetools-core": "3.0.2" - }, - "peerDependencies": { - "astro": ">=0.26 || >=1.0.0-beta" - }, - "devDependencies": { - "vitest": "^0.12.4" - }, - "engines": { - "node": "^14.15.0 || >=16.0.0" - } -} +{ + "name": "imagetools", + "version": "0.9.0", + "description": "Image Optimization tools for the Astro JS framework", + "type": "module", + "types": "./types.d.ts", + "exports": { + ".": "./index.js", + "./ssr": "./ssr/index.js", + "./api": "./api/index.js", + "./config": "./config.mjs", + "./components": "./components/index.js" + }, + "scripts": { + "test:watch": "vitest", + "test": "vitest run" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/RafidMuhymin/astro-imagetools.git" + }, + "keywords": [ + "astro", + "astro-component", + "image", + "images", + "optimization", + "responsive-image", + "vite", + "vite-plugin", + "sharp", + "imagetools", + "codecs", + "astropub" + ], + "author": "Rafid Muhymin", + "license": "MIT", + "bugs": { + "url": "https://github.com/RafidMuhymin/astro-imagetools/issues" + }, + "homepage": "https://github.com/RafidMuhymin/astro-imagetools#readme", + "dependencies": { + "@astropub/codecs": "0.4.4", + "@polymech/cache": "file:../../../polymech-mono/packages/cache", + "@polymech/commons": "file:../../../polymech-mono/packages/commons", + "@polymech/log": "file:../../../polymech-mono/packages/log", + "@polymech/fs": "file:../../../polymech-mono/packages/fs", + "file-type": "17.1.1", + "find-cache-dir": "3.3.2", + "find-up": "^6.3.0", + "node-addon-api": "^8.3.0", + "node-gyp": "^11.1.0", + "object-hash": "3.0.0", + "potrace": "2.1.8", + "sharp": "^0.33.5" + }, + "optionalDependencies": { + "imagetools-core": "3.0.2" + }, + "peerDependencies": { + "astro": ">=0.26 || >=1.0.0-beta" + }, + "devDependencies": { + "vitest": "^0.12.4" + }, + "engines": { + "node": "^14.15.0 || >=16.0.0" + } +} diff --git a/packages/imagetools/plugin/hooks/config.js b/packages/imagetools/plugin/hooks/config.js index 0562971..2a0070f 100644 --- a/packages/imagetools/plugin/hooks/config.js +++ b/packages/imagetools/plugin/hooks/config.js @@ -1,19 +1,19 @@ -// @ts-check - -export default function config() { - return { - optimizeDeps: { - exclude: ["@astropub/codecs", "imagetools-core", "sharp"], - }, - ssr: { - external: [ - "sharp", - "potrace", - "file-type", - "object-hash", - "find-cache-dir", - "@astropub/codecs", - ], - }, - }; -} +// @ts-check + +export default function config() { + return { + optimizeDeps: { + exclude: ["@astropub/codecs", "imagetools-core", "sharp"], + }, + ssr: { + external: [ + "sharp", + "potrace", + "file-type", + "object-hash", + "find-cache-dir", + "@astropub/codecs", + ], + }, + }; +} diff --git a/packages/imagetools/plugin/hooks/load.js b/packages/imagetools/plugin/hooks/load.js index d19633f..635f788 100644 --- a/packages/imagetools/plugin/hooks/load.js +++ b/packages/imagetools/plugin/hooks/load.js @@ -1,195 +1,151 @@ -// @ts-check -import path from "node:path"; -import objectHash from "object-hash"; - -import { store } from "../index.js"; -import { getCachedBuffer } from "../utils/cache.js"; -import { getSrcPath } from "../../api/utils/getSrcPath.js"; -import { getAssetPath, getConfigOptions } from "../utils/shared.js"; -import { sharp, supportedImageTypes } from "../../utils/runtimeChecks.js"; -import { get_cached_object, set_cached_object } from '@polymech/cache'; - -const { getLoadedImage, getTransformedImage } = await (sharp - ? import("../utils/imagetools.js") - : import("../utils/codecs.js")); - -export default async function load(id) { - try { - var fileURL = new URL(`file://${id}`); - } catch (error) { - return null; - } - - const { search, searchParams } = fileURL; - - id = id.replace(search, ""); - - const ext = path.extname(id).slice(1); - - if (!supportedImageTypes.includes(ext)) return null; - - const { default: astroViteConfigs } = await import( - // @ts-ignore - "../../astroViteConfigs.js" - ); - - const { environment, projectBase, assetFileNames } = astroViteConfigs; - - const src = await getSrcPath(id); - - const rootRelativePosixSrc = path.posix.normalize( - path.relative("", src).split(path.sep).join(path.posix.sep) - ); - - const getHash = (width) => - objectHash( - { width, options, rootRelativePosixSrc }, - // @ts-ignore - { algorithm: "sha256" } - ); - - const base = - typeof arguments[1] === "string" - ? arguments[1] - : path.basename(src, path.extname(src)); - - const config = Object.fromEntries(searchParams); - - const { image: loadedImage, width: imageWidth } = - store.get(src) || store.set(src, await getLoadedImage(src, ext)).get(src); - - const { type, widths, options, extension, raw, inline } = getConfigOptions( - config, - ext, - imageWidth - ); - - if (raw) { - const testConfig = { ...config }; - - delete testConfig.raw; - delete testConfig.inline; - delete testConfig.base64; - - if (Object.keys(testConfig).length > 0) { - throw new Error( - "If raw is set, no other options can be set except inline and base64" - ); - } - } - - if (inline) { - if (widths.length > 1) { - throw new Error( - `The base64 or inline parameter can't be used with multiple widths` - ); - } - - const [width] = widths; - - const hash = getHash(width); - - if (store.has(hash)) { - return `export default "${store.get(hash)}"`; - } else { - const config = { width, ...options }; - - const { image, buffer } = raw - ? { - image: sharp ? loadedImage : null, - buffer: !sharp ? loadedImage.data : null, - } - : await getTransformedImage({ - src, - image: loadedImage, - config, - type, - }); - - const dataUri = `data:${type};base64,${( - buffer || (await getCachedBuffer(hash, image)) - ).toString("base64")}`; - - store.set(hash, dataUri); - - return `export default "${dataUri}"`; - } - } else { - const sources = await Promise.all( - widths.map(async (width) => { - const hash = getHash(width); - const assetPath = getAssetPath( - base, - assetFileNames, - extension, - width, - hash - ); - - if (!store.has(assetPath)) { - const config = { width, ...options }; - // Create cache key for this specific image transformation - const cacheKey = { - src: id, - width, - type, - extension, - options: objectHash(options) - }; - let imageObject = null; - // Only use cache in production builds - if (environment === "build") { - // imageObject = await get_cached_object(cacheKey, 'imagetools-plugin'); - if (imageObject) { - console.log(`[imagetools-cache] Cache hit for ${assetPath}`); - } - } - - // Process image if not cached - if (!imageObject) { - const { image, buffer } = raw - ? { - image: sharp && loadedImage, - buffer: !sharp && loadedImage.data, - } - : await getTransformedImage({ - src, - image: loadedImage, - config, - type, - }); - - imageObject = { hash, type, image, buffer }; - - // Cache the processed result in production - if (environment === "build") { - /* - await set_cached_object(cacheKey, 'imagetools-plugin', imageObject, { - src: id, - width, - type, - timestamp: Date.now() - }); - console.log(`[imagetools-cache] Cached ${assetPath}`); - */ - } - } - store.set(assetPath, imageObject); - } - const modulePath = - environment === "dev" ? assetPath : projectBase + assetPath; - - return { width, modulePath }; - }) - ); - - const srcset = - sources.length > 1 - ? sources - .map(({ width, modulePath }) => `${modulePath} ${width}w`) - .join(", ") - : sources[0].modulePath; - - return `export default "${srcset}"`; - } -} +// @ts-check +import path from "node:path"; +import objectHash from "object-hash"; + +import { store } from "../index.js"; +import { getCachedBuffer } from "../utils/cache.js"; +import { getSrcPath } from "../../api/utils/getSrcPath.js"; +import { getAssetPath, getConfigOptions } from "../utils/shared.js"; +import { sharp, supportedImageTypes } from "../../utils/runtimeChecks.js"; + +const { getLoadedImage, getTransformedImage } = await import("../utils/imagetools.js") + +export default async function load(id) { + try { + var fileURL = new URL(`file://${id}`); + } catch (error) { + return null; + } + + + const { search, searchParams } = fileURL; + + id = id.replace(search, ""); + + const ext = path.extname(id).slice(1); + + if (!supportedImageTypes.includes(ext)) return null; + + const { default: astroViteConfigs } = await import( + // @ts-ignore + "../../astroViteConfigs.js" + ); + + const { environment, projectBase, assetFileNames } = astroViteConfigs; + + const src = await getSrcPath(id); + + const rootRelativePosixSrc = path.posix.normalize( + path.relative("", src).split(path.sep).join(path.posix.sep) + ); + + const getHash = (width) => + objectHash( + { width, options, rootRelativePosixSrc }, + // @ts-ignore + { algorithm: "sha256" } + ); + + const base = + typeof arguments[1] === "string" + ? arguments[1] + : path.basename(src, path.extname(src)); + + const config = Object.fromEntries(searchParams); + + const { image: loadedImage, width: imageWidth } = + store.get(src) || store.set(src, await getLoadedImage(src, ext)).get(src); + + const { type, widths, options, extension, raw, inline } = getConfigOptions( + config, + ext, + imageWidth + ); + + if (raw) { + const testConfig = { ...config } + delete testConfig.raw + delete testConfig.inline + delete testConfig.base64 + + if (Object.keys(testConfig).length > 0) { + throw new Error( + "If raw is set, no other options can be set except inline and base64" + ); + } + } + + if (inline) { + if (widths.length > 1) { + throw new Error( + `The base64 or inline parameter can't be used with multiple widths` + ); + } + const [width] = widths + const hash = getHash(width) + if (store.has(hash)) { + return `export default "${store.get(hash)}"`; + } else { + const config = { width, ...options }; + + const { image, buffer } = raw + ? { + image: sharp ? loadedImage : null, + buffer: !sharp ? loadedImage.data : null, + } + : await getTransformedImage({ + src, + image: loadedImage, + config, + type, + }); + const dataUri = `data:${type};base64,${( + buffer || (await getCachedBuffer(hash, image)) + ).toString("base64")}` + + store.set(hash, dataUri) + return `export default "${dataUri}"`; + } + } else { + const sources = await Promise.all( + widths.map(async (width) => { + const hash = getHash(width) + const assetPath = getAssetPath( + base, + assetFileNames, + extension, + width, + hash + ) + if (!store.has(assetPath)) { + const config = { width, ...options } + const { image, buffer } = raw + ? { + image: sharp && loadedImage, + buffer: !sharp && loadedImage.data, + } + : await getTransformedImage({ + src, + image: loadedImage, + config, + type, + }); + + const imageObject = { hash, type, image, buffer } + store.set(assetPath, imageObject) + } + const modulePath = + environment === "dev" ? assetPath : projectBase + assetPath + return { width, modulePath } + }) + ) + const srcset = + sources.length > 1 + ? sources + .map(({ width, modulePath }) => `${modulePath} ${width}w`) + .join(", ") + : sources[0].modulePath + + return `export default "${srcset}"` + } +} diff --git a/packages/imagetools/plugin/hooks/transform.js b/packages/imagetools/plugin/hooks/transform.js index 5851419..4fde891 100644 --- a/packages/imagetools/plugin/hooks/transform.js +++ b/packages/imagetools/plugin/hooks/transform.js @@ -1,62 +1,63 @@ -// @ts-check -import path from "node:path"; -import crypto from "node:crypto"; -import MagicString from "magic-string"; -import { cwd } from "../../utils/runtimeChecks.js"; - -const regexTestPattern = - /]*>/; -const regexExecPattern = new RegExp(regexTestPattern, "gs"); -const regexRenderPattern = /\$\$render`(.*)`/gs; - -export default async function transform(code, id) { - if (id.endsWith(".md") && regexTestPattern.test(code)) { - const { default: astroViteConfigs } = await import( - // @ts-ignore - "../../astroViteConfigs.js" - ); - - const { sourcemap } = astroViteConfigs; - - // Extract the "$$render`" part of the markdown string - const [result] = [...code.matchAll(regexRenderPattern)]; - const [, renderString] = result; - const renderIndex = result.index + "$$render`".length; - - const matches = renderString.matchAll(regexExecPattern); - if (matches !== null) { - const s = new MagicString(code); - - const uuid = crypto.randomBytes(4).toString("hex"); - - const Picture = "Picture" + uuid; - - const renderComponent = "renderComponent" + uuid; - - s.prepend( - `import { Picture as ${Picture} } from "astro-imagetools/components";\nimport { renderComponent as ${renderComponent} } from "${ - cwd + "/node_modules/astro/dist/runtime/server/index.js" - }"\n;` - ); - - for (const match of matches) { - const [matchedText, rawSrc, alt] = match; - - const src = rawSrc.match("(http://|https://|data:image/).*") - ? rawSrc - : path.resolve(path.dirname(id), rawSrc).replace(cwd, ""); - - s.overwrite( - renderIndex + match.index, - renderIndex + match.index + matchedText.length, - `\${${renderComponent}($$result, "${Picture}", ${Picture}, { "src": "${src}", "alt": "${alt}" })}` - ); - } - - return { - code: s.toString(), - map: sourcemap ? s.generateMap({ hires: true }) : null, - }; - } - } -} +// @ts-check +import path from "node:path"; +import crypto from "node:crypto"; +import MagicString from "magic-string"; +import { cwd } from "../../utils/runtimeChecks.js"; + +const regexTestPattern = + /]*>/; +const regexExecPattern = new RegExp(regexTestPattern, "gs"); +const regexRenderPattern = /\$\$render`(.*)`/gs; + +export default async function transform(code, id) { + if (id.endsWith(".md") && regexTestPattern.test(code)) { + const { default: astroViteConfigs } = await import( + // @ts-ignore + "../../astroViteConfigs.js" + ); + + const { sourcemap } = astroViteConfigs; + + // Extract the "$$render`" part of the markdown string + const [result] = [...code.matchAll(regexRenderPattern)]; + const [, renderString] = result; + const renderIndex = result.index + "$$render`".length; + + const matches = renderString.matchAll(regexExecPattern); + if (matches !== null) { + const s = new MagicString(code); + + //@todo + const uuid = crypto.randomBytes(4).toString("hex"); + + const Picture = "Picture" + uuid; + + const renderComponent = "renderComponent" + uuid; + + s.prepend( + `import { Picture as ${Picture} } from "imagetools/components";\nimport { renderComponent as ${renderComponent} } from "${ + cwd + "/node_modules/astro/dist/runtime/server/index.js" + }"\n;` + ); + + for (const match of matches) { + const [matchedText, rawSrc, alt] = match; + + const src = rawSrc.match("(http://|https://|data:image/).*") + ? rawSrc + : path.resolve(path.dirname(id), rawSrc).replace(cwd, ""); + + s.overwrite( + renderIndex + match.index, + renderIndex + match.index + matchedText.length, + `\${${renderComponent}($$result, "${Picture}", ${Picture}, { "src": "${src}", "alt": "${alt}" })}` + ); + } + + return { + code: s.toString(), + map: sourcemap ? s.generateMap({ hires: true }) : null, + }; + } + } +} diff --git a/packages/imagetools/plugin/index.js b/packages/imagetools/plugin/index.js index f45f36f..2f1a028 100644 --- a/packages/imagetools/plugin/index.js +++ b/packages/imagetools/plugin/index.js @@ -1,88 +1,86 @@ -// @ts-check -import fs from "node:fs"; -import stream from "node:stream"; -import { fileURLToPath } from "node:url"; -import { posix as path, resolve } from "node:path"; - -import load from "./hooks/load.js"; -import config from "./hooks/config.js"; -import transform from "./hooks/transform.js"; -import { middleware } from "../ssr/index.js"; -import { GlobalConfigOptions } from "../utils/runtimeChecks.js"; - -if (!globalThis.astroImageToolsStore) - globalThis.astroImageToolsStore = new Map(); - -export const store = globalThis.astroImageToolsStore; - -const filename = fileURLToPath(import.meta.url); - -const astroViteConfigsPath = resolve(filename, "../../astroViteConfigs.js"); - -const vitePluginAstroImageTools = { - name: "vite-plugin-astro-imagetools", - enforce: "pre", - - config, - - async configResolved(config) { - const { mode } = config; - - const { outDir, sourcemap } = config.build; - - let inheritedPattern = - config.build.rollupOptions.output?.assetFileNames?.replace( - "[name]", - "[name]@[width]" - ); - - let assetFileNames = path.normalize( - GlobalConfigOptions.assetFileNames || - inheritedPattern || - `/_astro/[name]@[width].[hash][extname]` - ); - - const { dir: assetsDir } = path.posix.parse( - assetFileNames.replaceAll(path.sep, path.posix.sep) - ); - - if (!assetFileNames.startsWith("/")) - assetFileNames = path.join("/", assetFileNames); - - const astroViteConfigs = JSON.parse( - (await fs.promises.readFile(astroViteConfigsPath, "utf8")).slice(15) - ); - - const newAstroViteConfigs = { - ...astroViteConfigs, - mode, - outDir, - assetsDir, - sourcemap, - assetFileNames, - }; - - await fs.promises.writeFile( - astroViteConfigsPath, - `export default ${JSON.stringify(newAstroViteConfigs, null, 2)}` - ); - }, - - load, - - transform, - - configureServer(server) { - server.middlewares.use(async (request, response, next) => { - const buffer = await middleware(request, response); - - if (buffer) { - return stream.Readable.from(buffer).pipe(response); - } - - next(); - }); - }, -}; - -export default vitePluginAstroImageTools; +// @ts-check +import fs from "node:fs"; +import stream from "node:stream"; +import { fileURLToPath } from "node:url"; +import { posix as path, resolve } from "node:path"; + +import load from "./hooks/load.js"; +import config from "./hooks/config.js"; +import transform from "./hooks/transform.js"; +import { middleware } from "../ssr/index.js"; +import { GlobalConfigOptions } from "../utils/runtimeChecks.js"; + +if (!globalThis.astroImageToolsStore) + globalThis.astroImageToolsStore = new Map(); + +export const store = globalThis.astroImageToolsStore; + +const filename = fileURLToPath(import.meta.url); + +const astroViteConfigsPath = resolve(filename, "../../astroViteConfigs.js"); + +const vitePluginAstroImageTools = { + name: "vite-plugin-astro-imagetools", + enforce: "pre", + config, + async configResolved(config) { + const { mode } = config; + + const { outDir, sourcemap } = config.build; + + let inheritedPattern = + config.build.rollupOptions.output?.assetFileNames?.replace( + "[name]", + "[name]@[width]" + ); + + let assetFileNames = path.normalize( + GlobalConfigOptions.assetFileNames || + inheritedPattern || + `/_astro/[name]@[width].[hash][extname]` + ); + + const { dir: assetsDir } = path.posix.parse( + assetFileNames.replaceAll(path.sep, path.posix.sep) + ); + + if (!assetFileNames.startsWith("/")) + assetFileNames = path.join("/", assetFileNames); + + const astroViteConfigs = JSON.parse( + (await fs.promises.readFile(astroViteConfigsPath, "utf8")).slice(15) + ); + + const newAstroViteConfigs = { + ...astroViteConfigs, + mode, + outDir, + assetsDir, + sourcemap, + assetFileNames, + }; + + await fs.promises.writeFile( + astroViteConfigsPath, + `export default ${JSON.stringify(newAstroViteConfigs, null, 2)}` + ); + }, + + load, + + transform, + + configureServer(server) { + server.middlewares.use(async (request, response, next) => { + const buffer = await middleware(request, response); + + if (buffer) { + return stream.Readable.from(buffer).pipe(response); + } + + next(); + }); + }, +}; + +export default vitePluginAstroImageTools; diff --git a/packages/imagetools/plugin/utils/cache.js b/packages/imagetools/plugin/utils/cache.js index 1e0ff86..bc626db 100644 --- a/packages/imagetools/plugin/utils/cache.js +++ b/packages/imagetools/plugin/utils/cache.js @@ -1,19 +1,13 @@ -// @ts-check -import fs from "node:fs"; -import { fsCachePath } from "../../utils/runtimeChecks.js"; - -export async function getCachedBuffer(hash, image) { - const cacheFilePath = fsCachePath + hash; - - // console.log(`[imagetools-cache getCachedBuffer] Cache hit for ${cacheFilePath}`); - - if (fs.existsSync(cacheFilePath)) { - return fs.promises.readFile(cacheFilePath); - } - - const buffer = await image.clone().toBuffer(); - - await fs.promises.writeFile(cacheFilePath, buffer); - - return buffer; -} +// @ts-check +import fs from "node:fs"; +import { fsCachePath } from "../../utils/runtimeChecks.js"; + +export async function getCachedBuffer(hash, image) { + const cacheFilePath = fsCachePath + hash; + if (fs.existsSync(cacheFilePath)) { + return fs.promises.readFile(cacheFilePath); + } + const buffer = await image.clone().toBuffer(); + await fs.promises.writeFile(cacheFilePath, buffer); + return buffer; +} diff --git a/packages/imagetools/plugin/utils/codecs.js b/packages/imagetools/plugin/utils/codecs.js index 1476e94..fcac5e4 100644 --- a/packages/imagetools/plugin/utils/codecs.js +++ b/packages/imagetools/plugin/utils/codecs.js @@ -1,41 +1,41 @@ -// @ts-check -import fs from "node:fs"; -import * as codecs from "@astropub/codecs"; - -const resizedImages = new Map(); - -export const getLoadedImage = async (src, ext) => { - const buffer = fs.readFileSync(src); - - const image = await codecs[ext].decode(buffer); - - const { width } = image; - - const resizedImageKey = `${src}@${image.width}`; - - resizedImages.set(resizedImageKey, image); - - return { image, width }; -}; - -export const getTransformedImage = async ({ src, image, config, type }) => { - const { width, format, quality } = config; - - const resizedImageKey = `${src}@${width}`; - - const resizedImage = - resizedImages.get(resizedImageKey) || - resizedImages - .set(resizedImageKey, await image.resize({ width })) - .get(resizedImageKey); - - const encodedImage = quality - ? await codecs[format].encode(resizedImage, { - quality: parseInt(quality), - }) - : await resizedImage.encode(type); - - const buffer = Buffer.from(encodedImage.data); - - return { image, buffer }; -}; +// @ts-check +import fs from "node:fs"; +import * as codecs from "@astropub/codecs"; + +const resizedImages = new Map(); + +export const getLoadedImage = async (src, ext) => { + const buffer = fs.readFileSync(src); + + const image = await codecs[ext].decode(buffer); + + const { width } = image; + + const resizedImageKey = `${src}@${image.width}`; + + resizedImages.set(resizedImageKey, image); + + return { image, width }; +}; + +export const getTransformedImage = async ({ src, image, config, type }) => { + const { width, format, quality } = config; + + const resizedImageKey = `${src}@${width}`; + + const resizedImage = + resizedImages.get(resizedImageKey) || + resizedImages + .set(resizedImageKey, await image.resize({ width })) + .get(resizedImageKey); + + const encodedImage = quality + ? await codecs[format].encode(resizedImage, { + quality: parseInt(quality), + }) + : await resizedImage.encode(type); + + const buffer = Buffer.from(encodedImage.data); + + return { image, buffer }; +}; diff --git a/packages/imagetools/plugin/utils/imagetools.js b/packages/imagetools/plugin/utils/imagetools.js index f969207..172dffa 100644 --- a/packages/imagetools/plugin/utils/imagetools.js +++ b/packages/imagetools/plugin/utils/imagetools.js @@ -1,26 +1,26 @@ -// @ts-check -import { - builtins, - loadImage, - applyTransforms, - generateTransforms, -} from "imagetools-core"; - -export const getLoadedImage = async (src) => { - const image = loadImage(src); - - const { width } = await image.metadata(); - - return { image, width }; -}; - -export const getTransformedImage = async ({ image, config }) => { - const { transforms } = generateTransforms(config, builtins); - - const { image: encodedImage } = await applyTransforms( - transforms, - image.clone() - ); - - return { image: encodedImage, buffer: null }; -}; +// @ts-check +import { + builtins, + loadImage, + applyTransforms, + generateTransforms, +} from "imagetools-core"; + +export const getLoadedImage = async (src) => { + const image = loadImage(src); + + const { width } = await image.metadata(); + + return { image, width }; +}; + +export const getTransformedImage = async ({ image, config }) => { + const { transforms } = generateTransforms(config, builtins); + + const { image: encodedImage } = await applyTransforms( + transforms, + image.clone() + ); + + return { image: encodedImage, buffer: null }; +}; diff --git a/packages/imagetools/plugin/utils/shared.js b/packages/imagetools/plugin/utils/shared.js index bac7c05..ccecced 100644 --- a/packages/imagetools/plugin/utils/shared.js +++ b/packages/imagetools/plugin/utils/shared.js @@ -1,47 +1,47 @@ -// @ts-check - -export function getConfigOptions(config, ext, imageWidth) { - const { w, width = w, format = ext, base64, raw, inline, ...rest } = config; - - const imageFormat = format === "jpeg" ? "jpg" : format; - - const widths = width - ? width.split(";").map((w) => parseInt(w)) - : [imageWidth]; - - const extension = format === "jpg" ? "jpeg" : format; - const type = `image/${extension}`; - - const options = { - format: imageFormat, - ...rest, - }; - - return { - type, - widths, - options, - extension, - raw: typeof raw === "string", - inline: typeof base64 === "string" || typeof inline === "string", - }; -} - -export function getAssetPath(base, assetFileNames, ext, width, hash) { - const regexExecArray = /(?<=\[hash:)\d+(?=\])/g.exec(assetFileNames), - hashLength = regexExecArray ? regexExecArray[0] : 8, - extname = `.${ext}`, - name = base; - - width = width + "w"; - hash = hash.slice(0, hashLength); - - const assetPath = assetFileNames - .replace("[name]", name) - .replace("[width]", width) - .replace(regexExecArray ? `[hash:${hashLength}]` : "[hash]", hash) - .replace("[ext]", ext) - .replace("[extname]", extname); - - return assetPath; -} +// @ts-check + +export function getConfigOptions(config, ext, imageWidth) { + const { w, width = w, format = ext, base64, raw, inline, ...rest } = config; + + const imageFormat = format === "jpeg" ? "jpg" : format; + + const widths = width + ? width.split(";").map((w) => parseInt(w)) + : [imageWidth]; + + const extension = format === "jpg" ? "jpeg" : format; + const type = `image/${extension}`; + + const options = { + format: imageFormat, + ...rest, + }; + + return { + type, + widths, + options, + extension, + raw: typeof raw === "string", + inline: typeof base64 === "string" || typeof inline === "string", + }; +} + +export function getAssetPath(base, assetFileNames, ext, width, hash) { + const regexExecArray = /(?<=\[hash:)\d+(?=\])/g.exec(assetFileNames), + hashLength = regexExecArray ? regexExecArray[0] : 8, + extname = `.${ext}`, + name = base; + + width = width + "w"; + hash = hash.slice(0, hashLength); + + const assetPath = assetFileNames + .replace("[name]", name) + .replace("[width]", width) + .replace(regexExecArray ? `[hash:${hashLength}]` : "[hash]", hash) + .replace("[ext]", ext) + .replace("[extname]", extname); + + return assetPath; +} diff --git a/packages/imagetools/ssr/index.d.ts b/packages/imagetools/ssr/index.d.ts index 87ae242..f5786d1 100644 --- a/packages/imagetools/ssr/index.d.ts +++ b/packages/imagetools/ssr/index.d.ts @@ -1,6 +1,6 @@ -import type { IncomingMessage, ServerResponse } from "http"; - -export function middleware( - request: IncomingMessage, - response: ServerResponse -): Buffer; +import type { IncomingMessage, ServerResponse } from "http"; + +export function middleware( + request: IncomingMessage, + response: ServerResponse +): Buffer; diff --git a/packages/imagetools/ssr/index.js b/packages/imagetools/ssr/index.js index f25f02e..f76c2f2 100644 --- a/packages/imagetools/ssr/index.js +++ b/packages/imagetools/ssr/index.js @@ -1,27 +1,16 @@ -// @ts-check -import { store } from "../plugin/index.js"; -import { getCachedBuffer } from "../plugin/utils/cache.js"; - -export async function middleware(request, response) { - const url = request.url || request.path; - const imageObject = store.get(url); -/* - // Debug logging - if (url?.includes('_astro/') && url?.includes('.avif')) { - console.log(`[imagetools-debug] Looking for: ${url}`); - console.log(`[imagetools-debug] Store has ${store.size} entries`); - console.log(`[imagetools-debug] Found: ${!!imageObject}`); - if (!imageObject && store.size > 0) { - console.log(`[imagetools-debug] Available keys:`, [...store.keys()].slice(0, 5)); - } - }*/ - - if (imageObject) { - const { hash, type, image, buffer } = imageObject; - - response.setHeader("Content-Type", type); - response.setHeader("Cache-Control", "no-cache"); - - return buffer || (await getCachedBuffer(hash, image)); - } -} +// @ts-check +import { store } from "../plugin/index.js"; +import { getCachedBuffer } from "../plugin/utils/cache.js"; + +export async function middleware(request, response) { + const imageObject = store.get(request.url); + + if (imageObject) { + const { hash, type, image, buffer } = imageObject; + + response.setHeader("Content-Type", type); + response.setHeader("Cache-Control", "no-cache"); + + return buffer || (await getCachedBuffer(hash, image)); + } +} diff --git a/packages/imagetools/tmp.html b/packages/imagetools/tmp.html new file mode 100644 index 0000000..d2b5bfa --- /dev/null +++ b/packages/imagetools/tmp.html @@ -0,0 +1,14 @@ +Sheetpress Cassandra - EDC450 \ No newline at end of file diff --git a/packages/imagetools/types.d.ts b/packages/imagetools/types.d.ts index d44c18c..f062d91 100644 --- a/packages/imagetools/types.d.ts +++ b/packages/imagetools/types.d.ts @@ -1,268 +1,269 @@ -declare type format = - | "heic" - | "heif" - | "avif" - | "jpg" - | "jpeg" - | "png" - | "tiff" - | "webp" - | "gif"; - -declare type PotraceOptions = TraceOptions | PosterizeOptions; - -declare interface SharedTracingOptions { - turnPolicy?: "black" | "white" | "left" | "right" | "minority" | "majority"; - turdSize?: number; - alphaMax?: number; - optCurve?: boolean; - optTolerance?: number; - threshold?: number; - blackOnWhite?: boolean; - color?: "auto" | string; - background?: "transparent" | string; -} - -declare interface TraceOptions { - function?: "trace"; - options?: SharedTracingOptions; -} - -declare interface PosterizeOptions { - function?: "posterize"; - options?: SharedTracingOptions & { - fill?: "spread" | "dominant" | "median" | "mean"; - ranges?: "auto" | "equal"; - steps?: number | number[]; - }; -} - -declare interface FormatOptions { - formatOptions?: Partial> & { - tracedSVG?: PotraceOptions; - }; -} - -declare interface PictureFormatOptions extends FormatOptions { - format?: format | format[] | [] | null; - fallbackFormat?: format; - includeSourceFormat?: boolean; -} - -declare interface ImgFormatOptions extends FormatOptions { - format?: format; -} - -declare interface ImageToolsConfigs { - flip?: boolean; - flop?: boolean; - invert?: boolean; - flatten?: boolean; - normalize?: boolean; - grayscale?: boolean; - hue?: number; - saturation?: number; - brightness?: number; - w?: number; - h?: number; - ar?: number; - width?: number; - height?: number; - aspect?: number; - background?: string; - tint?: string; - blur?: number | boolean; - median?: number | boolean; - rotate?: number; - quality?: number; - fit?: "cover" | "contain" | "fill" | "inside" | "outside"; - kernel?: "nearest" | "cubic" | "mitchell" | "lanczos2" | "lanczos3"; - position?: - | "top" - | "right top" - | "right" - | "right bottom" - | "bottom" - | "left bottom" - | "left" - | "left top" - | "north" - | "northeast" - | "east" - | "southeast" - | "south" - | "southwest" - | "west" - | "northwest" - | "center" - | "centre" - | "cover" - | "entropy" - | "attention"; -} - -declare interface ObjectStyles { - objectPosition?: string; - objectFit?: "fill" | "contain" | "cover" | "none" | "scale-down"; -} - -declare interface BackgroundStyles { - backgroundPosition?: string; - backgroundSize?: "fill" | "contain" | "cover" | "none" | "scale-down"; -} - -declare interface ArtDirective - extends PrimaryProps, - ObjectStyles, - PictureFormatOptions, - ImageToolsConfigs { - media: string; -} - -declare interface BackgroundImageArtDirective - extends PrimaryProps, - BackgroundStyles, - PictureFormatOptions, - ImageToolsConfigs { - media: string; -} - -declare type sizesFunction = { - (breakpoints: number[]): string; -}; - -declare type breakpointsFunction = { - (imageWidth: number): number[]; -}; - -declare interface PrimaryProps { - src: string; - sizes?: string | sizesFunction; - placeholder?: "dominantColor" | "blurred" | "tracedSVG" | "none"; - breakpoints?: - | number[] - | breakpointsFunction - | { - count?: number; - minWidth?: number; - maxWidth?: number; - }; -} - -declare interface ConfigOptions extends PrimaryProps, ImageToolsConfigs { - alt: string; - preload?: format; - loading?: "lazy" | "eager" | "auto" | null; - decoding?: "async" | "sync" | "auto" | null; - layout?: "constrained" | "fixed" | "fullWidth" | "fill"; -} - -declare interface Attributes { - container?: Record; - picture?: Record; - style?: Record; - link?: Omit, "as" | "rel" | "imagesizes" | "imagesrcset">; - img?: Omit< - Record, - | "src" - | "alt" - | "srcset" - | "sizes" - | "width" - | "height" - | "loading" - | "decoding" - >; -} - -export interface PictureConfigOptions - extends ConfigOptions, - ObjectStyles, - PictureFormatOptions { - artDirectives?: ArtDirective[]; - attributes?: Omit; - fadeInTransition?: - | boolean - | { - delay?: string; - duration?: string; - timingFunction?: string; - }; -} - -export interface ImgConfigOptions - extends ConfigOptions, - ObjectStyles, - ImgFormatOptions { - attributes?: Omit; -} - -declare interface BackgroundProps { - tag?: string; - content?: string; -} - -export interface BackgroundImageConfigOptions - extends BackgroundProps, - BackgroundStyles, - Pick< - PictureConfigOptions, - Exclude< - keyof PictureConfigOptions, - | "alt" - | "sizes" - | "loading" - | "decoding" - | "layout" - | "objectFit" - | "objectPosition" - | "artDirective" - | "fadeInTransition" - > - > { - attributes?: Omit; - artDirectives?: BackgroundImageArtDirective[]; -} - -export interface BackgroundPictureConfigOptions - extends BackgroundProps, - Pick< - PictureConfigOptions, - Exclude - > { - attributes?: Attributes; -} - -export interface GlobalConfigOptions - extends BackgroundStyles, - Pick< - PictureConfigOptions, - Exclude - > { - tag?: string; - cacheDir?: string; - assetFileNames?: string; -} - -declare interface HTMLData { - link: string; - style: string; -} - -export interface ImageHTMLData extends HTMLData { - image: string; -} - -export interface PictureHTMLData extends HTMLData { - picture: string; -} - -export interface ImgHTMLData extends HTMLData { - img: string; -} - -export interface BackgroundImageHTMLData extends HTMLData { - htmlElement: string; -} - -export type BackgroundPictureHTMLData = BackgroundImageHTMLData; +declare type format = + | "heic" + | "heif" + | "avif" + | "jpg" + | "jpeg" + | "png" + | "tiff" + | "webp" + | "gif"; + +declare type PotraceOptions = TraceOptions | PosterizeOptions; + +declare interface SharedTracingOptions { + turnPolicy?: "black" | "white" | "left" | "right" | "minority" | "majority"; + turdSize?: number; + alphaMax?: number; + optCurve?: boolean; + optTolerance?: number; + threshold?: number; + blackOnWhite?: boolean; + color?: "auto" | string; + background?: "transparent" | string; +} + +declare interface TraceOptions { + function?: "trace"; + options?: SharedTracingOptions; +} + +declare interface PosterizeOptions { + function?: "posterize"; + options?: SharedTracingOptions & { + fill?: "spread" | "dominant" | "median" | "mean"; + ranges?: "auto" | "equal"; + steps?: number | number[]; + }; +} + +declare interface FormatOptions { + formatOptions?: Partial> & { + tracedSVG?: PotraceOptions; + }; +} + +declare interface PictureFormatOptions extends FormatOptions { + format?: format | format[] | [] | null; + fallbackFormat?: format; + includeSourceFormat?: boolean; +} + +declare interface ImgFormatOptions extends FormatOptions { + format?: format; +} + +declare interface ImageToolsConfigs { + flip?: boolean; + flop?: boolean; + invert?: boolean; + flatten?: boolean; + normalize?: boolean; + grayscale?: boolean; + hue?: number; + saturation?: number; + brightness?: number; + w?: number; + h?: number; + ar?: number; + width?: number; + height?: number; + aspect?: number; + background?: string; + tint?: string; + blur?: number | boolean; + median?: number | boolean; + rotate?: number; + quality?: number; + fit?: "cover" | "contain" | "fill" | "inside" | "outside"; + kernel?: "nearest" | "cubic" | "mitchell" | "lanczos2" | "lanczos3"; + position?: + | "top" + | "right top" + | "right" + | "right bottom" + | "bottom" + | "left bottom" + | "left" + | "left top" + | "north" + | "northeast" + | "east" + | "southeast" + | "south" + | "southwest" + | "west" + | "northwest" + | "center" + | "centre" + | "cover" + | "entropy" + | "attention"; +} + +declare interface ObjectStyles { + objectPosition?: string; + objectFit?: "fill" | "contain" | "cover" | "none" | "scale-down"; +} + +declare interface BackgroundStyles { + backgroundPosition?: string; + backgroundSize?: "fill" | "contain" | "cover" | "none" | "scale-down"; +} + +declare interface ArtDirective + extends PrimaryProps, + ObjectStyles, + PictureFormatOptions, + ImageToolsConfigs { + media: string; +} + +declare interface BackgroundImageArtDirective + extends PrimaryProps, + BackgroundStyles, + PictureFormatOptions, + ImageToolsConfigs { + media: string; +} + +declare type sizesFunction = { + (breakpoints: number[]): string; +}; + +declare type breakpointsFunction = { + (imageWidth: number): number[]; +}; + +declare interface PrimaryProps { + src: string; + sizes?: string | sizesFunction; + placeholder?: "dominantColor" | "blurred" | "tracedSVG" | "none"; + class: string; + breakpoints?: + | number[] + | breakpointsFunction + | { + count?: number; + minWidth?: number; + maxWidth?: number; + }; +} + +declare interface ConfigOptions extends PrimaryProps, ImageToolsConfigs { + alt: string; + preload?: format; + loading?: "lazy" | "eager" | "auto" | null; + decoding?: "async" | "sync" | "auto" | null; + layout?: "constrained" | "fixed" | "fullWidth" | "fill"; +} + +declare interface Attributes { + container?: Record; + picture?: Record; + style?: Record; + link?: Omit, "as" | "rel" | "imagesizes" | "imagesrcset">; + img?: Omit< + Record, + | "src" + | "alt" + | "srcset" + | "sizes" + | "width" + | "height" + | "loading" + | "decoding" + >; +} + +export interface PictureConfigOptions + extends ConfigOptions, + ObjectStyles, + PictureFormatOptions { + artDirectives?: ArtDirective[]; + attributes?: Omit; + fadeInTransition?: + | boolean + | { + delay?: string; + duration?: string; + timingFunction?: string; + }; +} + +export interface ImgConfigOptions + extends ConfigOptions, + ObjectStyles, + ImgFormatOptions { + attributes?: Omit; +} + +declare interface BackgroundProps { + tag?: string; + content?: string; +} + +export interface BackgroundImageConfigOptions + extends BackgroundProps, + BackgroundStyles, + Pick< + PictureConfigOptions, + Exclude< + keyof PictureConfigOptions, + | "alt" + | "sizes" + | "loading" + | "decoding" + | "layout" + | "objectFit" + | "objectPosition" + | "artDirective" + | "fadeInTransition" + > + > { + attributes?: Omit; + artDirectives?: BackgroundImageArtDirective[]; +} + +export interface BackgroundPictureConfigOptions + extends BackgroundProps, + Pick< + PictureConfigOptions, + Exclude + > { + attributes?: Attributes; +} + +export interface GlobalConfigOptions + extends BackgroundStyles, + Pick< + PictureConfigOptions, + Exclude + > { + tag?: string; + cacheDir?: string; + assetFileNames?: string; +} + +declare interface HTMLData { + link: string; + style: string; +} + +export interface ImageHTMLData extends HTMLData { + image: string; +} + +export interface PictureHTMLData extends HTMLData { + picture: string; +} + +export interface ImgHTMLData extends HTMLData { + img: string; +} + +export interface BackgroundImageHTMLData extends HTMLData { + htmlElement: string; +} + +export type BackgroundPictureHTMLData = BackgroundImageHTMLData; diff --git a/packages/imagetools/utils/filterConfigs.js b/packages/imagetools/utils/filterConfigs.js index 1fd64da..3766548 100644 --- a/packages/imagetools/utils/filterConfigs.js +++ b/packages/imagetools/utils/filterConfigs.js @@ -1,51 +1,49 @@ -// @ts-check -import printWarning from "./printWarning.js"; - -export default function filterConfigs( - type, - configs, - supportedConfigs, - { warn = true } = {} -) { - const clonedConfigs = { ...configs }; - - const requiredConfigs = []; - - type !== "Global" && requiredConfigs.push("src"); - - ["Img", "Picture"].includes(type) && requiredConfigs.push("alt"); - - requiredConfigs.forEach((key) => { - if (typeof clonedConfigs[key] === "undefined") { - throw new Error(`The "${key}" property is required by ${type}`); - } - }); - - Object.keys(clonedConfigs).forEach((key) => { - if (!supportedConfigs.includes(key)) { - if (warn) { - if (key !== "class") { - printWarning({ key, type }); - } else if (!onlyAstroClass(clonedConfigs[key])) { - /* - printWarning({ - message: `Do not provide a "class" directly to ${type}. Instead, use attributes: https://astro-imagetools-docs.vercel.app/en/components/${type}#attributes`, - }); - */ - } - } - - delete clonedConfigs[key]; - } - }); - - return clonedConfigs; -} - -/** - * Checks if the `class` attribute string is only an astro-generated scoped style class. - */ -function onlyAstroClass(classAttr) { - const astroClassPattern = /^astro-[0-9A-Z]{8}$/; - return astroClassPattern.test(classAttr); -} +// @ts-check +import printWarning from "./printWarning.js"; + +export default function filterConfigs( + type, + configs, + supportedConfigs, + { warn = true } = {} +) { + const clonedConfigs = { ...configs }; + + const requiredConfigs = []; + + type !== "Global" && requiredConfigs.push("src"); + + ["Img", "Picture"].includes(type) && requiredConfigs.push("alt"); + + requiredConfigs.forEach((key) => { + if (typeof clonedConfigs[key] === "undefined") { + throw new Error(`The "${key}" property is required by ${type}`); + } + }); + + Object.keys(clonedConfigs).forEach((key) => { + if (!supportedConfigs.includes(key)) { + if (warn) { + if (key !== "class") { + printWarning({ key, type }); + } else if (!onlyAstroClass(clonedConfigs[key])) { + printWarning({ + message: `Do not provide a "class" directly to ${type}. Instead, use attributes: https://astro-imagetools-docs.vercel.app/en/components/${type}#attributes`, + }); + } + } + + delete clonedConfigs[key]; + } + }); + + return clonedConfigs; +} + +/** + * Checks if the `class` attribute string is only an astro-generated scoped style class. + */ +function onlyAstroClass(classAttr) { + const astroClassPattern = /^astro-[0-9A-Z]{8}$/; + return astroClassPattern.test(classAttr); +} diff --git a/packages/imagetools/utils/filterConfigs.test.js b/packages/imagetools/utils/filterConfigs.test.js index d3d5100..c9e3124 100644 --- a/packages/imagetools/utils/filterConfigs.test.js +++ b/packages/imagetools/utils/filterConfigs.test.js @@ -1,100 +1,100 @@ -import { describe, expect, afterAll, it, vi, beforeEach } from "vitest"; -import { supportedConfigs } from "./runtimeChecks"; -import filterConfigs from "./filterConfigs"; -import printWarning from "./printWarning.js"; - -// Workaround for https://github.com/vitest-dev/vitest/issues/855 -vi.mock("./printWarning.js", async () => { - return { default: vi.fn() }; -}); - -const warningSpy = vi.mocked(printWarning); - -describe("filterConfigs", () => { - beforeEach(() => { - warningSpy.mockReset(); - }); - afterAll(() => { - vi.unmock("./printWarning.js"); - }); - - it("should require a `src` attribute for all components", () => { - expect(() => { - filterConfigs("Img", { alt: "" }, supportedConfigs); - }).toThrowError('The "src" property is required by Img'); - expect(() => { - filterConfigs("Picture", { alt: "" }, supportedConfigs); - }).toThrowError('The "src" property is required by Picture'); - expect(() => { - filterConfigs("BackgroundImage", {}, supportedConfigs); - }).toThrowError('The "src" property is required by BackgroundImage'); - expect(() => { - filterConfigs("BackgroundPicture", {}, supportedConfigs); - }).toThrowError('The "src" property is required by BackgroundPicture'); - expect(() => { - filterConfigs("Global", {}, supportedConfigs); - }).not.toThrowError(); - }); - - it("should require an `alt` attribute for Picture and Img, but not others", () => { - expect(() => { - filterConfigs("Img", { src: "src" }, supportedConfigs); - }).toThrowError('The "alt" property is required by Img'); - expect(() => { - filterConfigs("Picture", { src: "src" }, supportedConfigs); - }).toThrowError('The "alt" property is required by Picture'); - expect(() => { - filterConfigs("BackgroundImage", { src: "src" }, supportedConfigs); - }).not.toThrowError(); - expect(() => { - filterConfigs("BackgroundPicture", { src: "src" }, supportedConfigs); - }).not.toThrowError(); - expect(() => { - filterConfigs("Global", {}, supportedConfigs); - }).not.toThrowError(); - }); - - it("should remove unsupported configs", () => { - const filteredConfig = filterConfigs("Global", { foo: "foo" }, [], { - warn: false, - }); - const filteredConfigFooSupported = filterConfigs( - "Global", - { foo: "foo" }, - ["foo"], - { - warn: false, - } - ); - expect(filteredConfig).not.toContain({ foo: "foo" }); - expect(filteredConfigFooSupported).toContain({ foo: "foo" }); - }); - - it("should warn about unsupported configs", () => { - filterConfigs("Global", { foo: "foo" }, []); - expect(warningSpy).toHaveBeenCalledWith({ type: "Global", key: "foo" }); - }); - - it("should warn about unsupported 'class' config", () => { - filterConfigs( - "Img", - { class: "astro-ASDF1234 my-class", src: "src", alt: "" }, - supportedConfigs - ); - expect(warningSpy).toHaveBeenCalledWith({ - message: - 'Do not provide a "class" directly to Img. Instead, use attributes: https://astro-imagetools-docs.vercel.app/en/components/Img#attributes', - }); - }); - - it("should not warn about astro-generated 'class' config", () => { - const filteredConfig = filterConfigs( - "Img", - { class: "astro-ASDF1234", src: "src", alt: "" }, - supportedConfigs - ); - expect(warningSpy).not.toHaveBeenCalled(); - // class is still stripped out - expect(filteredConfig).not.toContain({ class: "astro-ASDF1234" }); - }); -}); +import { describe, expect, afterAll, it, vi, beforeEach } from "vitest"; +import { supportedConfigs } from "./runtimeChecks"; +import filterConfigs from "./filterConfigs"; +import printWarning from "./printWarning.js"; + +// Workaround for https://github.com/vitest-dev/vitest/issues/855 +vi.mock("./printWarning.js", async () => { + return { default: vi.fn() }; +}); + +const warningSpy = vi.mocked(printWarning); + +describe("filterConfigs", () => { + beforeEach(() => { + warningSpy.mockReset(); + }); + afterAll(() => { + vi.unmock("./printWarning.js"); + }); + + it("should require a `src` attribute for all components", () => { + expect(() => { + filterConfigs("Img", { alt: "" }, supportedConfigs); + }).toThrowError('The "src" property is required by Img'); + expect(() => { + filterConfigs("Picture", { alt: "" }, supportedConfigs); + }).toThrowError('The "src" property is required by Picture'); + expect(() => { + filterConfigs("BackgroundImage", {}, supportedConfigs); + }).toThrowError('The "src" property is required by BackgroundImage'); + expect(() => { + filterConfigs("BackgroundPicture", {}, supportedConfigs); + }).toThrowError('The "src" property is required by BackgroundPicture'); + expect(() => { + filterConfigs("Global", {}, supportedConfigs); + }).not.toThrowError(); + }); + + it("should require an `alt` attribute for Picture and Img, but not others", () => { + expect(() => { + filterConfigs("Img", { src: "src" }, supportedConfigs); + }).toThrowError('The "alt" property is required by Img'); + expect(() => { + filterConfigs("Picture", { src: "src" }, supportedConfigs); + }).toThrowError('The "alt" property is required by Picture'); + expect(() => { + filterConfigs("BackgroundImage", { src: "src" }, supportedConfigs); + }).not.toThrowError(); + expect(() => { + filterConfigs("BackgroundPicture", { src: "src" }, supportedConfigs); + }).not.toThrowError(); + expect(() => { + filterConfigs("Global", {}, supportedConfigs); + }).not.toThrowError(); + }); + + it("should remove unsupported configs", () => { + const filteredConfig = filterConfigs("Global", { foo: "foo" }, [], { + warn: false, + }); + const filteredConfigFooSupported = filterConfigs( + "Global", + { foo: "foo" }, + ["foo"], + { + warn: false, + } + ); + expect(filteredConfig).not.toContain({ foo: "foo" }); + expect(filteredConfigFooSupported).toContain({ foo: "foo" }); + }); + + it("should warn about unsupported configs", () => { + filterConfigs("Global", { foo: "foo" }, []); + expect(warningSpy).toHaveBeenCalledWith({ type: "Global", key: "foo" }); + }); + + it("should warn about unsupported 'class' config", () => { + filterConfigs( + "Img", + { class: "astro-ASDF1234 my-class", src: "src", alt: "" }, + supportedConfigs + ); + expect(warningSpy).toHaveBeenCalledWith({ + message: + 'Do not provide a "class" directly to Img. Instead, use attributes: https://astro-imagetools-docs.vercel.app/en/components/Img#attributes', + }); + }); + + it("should not warn about astro-generated 'class' config", () => { + const filteredConfig = filterConfigs( + "Img", + { class: "astro-ASDF1234", src: "src", alt: "" }, + supportedConfigs + ); + expect(warningSpy).not.toHaveBeenCalled(); + // class is still stripped out + expect(filteredConfig).not.toContain({ class: "astro-ASDF1234" }); + }); +}); diff --git a/packages/imagetools/utils/printWarning.js b/packages/imagetools/utils/printWarning.js index efeac3d..7a7944d 100644 --- a/packages/imagetools/utils/printWarning.js +++ b/packages/imagetools/utils/printWarning.js @@ -1,57 +1,57 @@ -// @ts-check - -const colours = { - reset: "\x1b[0m", - bright: "\x1b[1m", - dim: "\x1b[2m", - underscore: "\x1b[4m", - blink: "\x1b[5m", - reverse: "\x1b[7m", - hidden: "\x1b[8m", - - fg: { - black: "\x1b[30m", - red: "\x1b[31m", - green: "\x1b[32m", - yellow: "\x1b[33m", - blue: "\x1b[34m", - magenta: "\x1b[35m", - cyan: "\x1b[36m", - white: "\x1b[37m", - }, - - bg: { - black: "\x1b[40m", - red: "\x1b[41m", - green: "\x1b[42m", - yellow: "\x1b[43m", - blue: "\x1b[44m", - magenta: "\x1b[45m", - cyan: "\x1b[46m", - white: "\x1b[47m", - }, -}; - -export default function printWarning({ - key = "", - type = "", - message = "", - element = "", -}) { - const flag = - colours.bright + colours.fg.cyan + "[astro-imagetools]" + colours.reset; - - const keyLog = key - ? " " + colours.bg.yellow + ` ${key} ` + colours.reset - : ""; - - const messageLog = - colours.fg.yellow + - (message || - (!element - ? `is not a valid ${type} Config Option` - : `can't be defined inside attributes.${element}`)) + - colours.reset; - - // console.log(flag + keyLog, messageLog); -} +// @ts-check + +const colours = { + reset: "\x1b[0m", + bright: "\x1b[1m", + dim: "\x1b[2m", + underscore: "\x1b[4m", + blink: "\x1b[5m", + reverse: "\x1b[7m", + hidden: "\x1b[8m", + + fg: { + black: "\x1b[30m", + red: "\x1b[31m", + green: "\x1b[32m", + yellow: "\x1b[33m", + blue: "\x1b[34m", + magenta: "\x1b[35m", + cyan: "\x1b[36m", + white: "\x1b[37m", + }, + + bg: { + black: "\x1b[40m", + red: "\x1b[41m", + green: "\x1b[42m", + yellow: "\x1b[43m", + blue: "\x1b[44m", + magenta: "\x1b[45m", + cyan: "\x1b[46m", + white: "\x1b[47m", + }, +}; + +export default function printWarning({ + key = "", + type = "", + message = "", + element = "", +}) { + const flag = + colours.bright + colours.fg.cyan + "[astro-imagetools]" + colours.reset; + + const keyLog = key + ? " " + colours.bg.yellow + ` ${key} ` + colours.reset + : ""; + + const messageLog = + colours.fg.yellow + + (message || + (!element + ? `is not a valid ${type} Config Option` + : `can't be defined inside attributes.${element}`)) + + colours.reset; + + //console.log(flag + keyLog, messageLog); +} diff --git a/packages/imagetools/utils/runtimeChecks.js b/packages/imagetools/utils/runtimeChecks.js index a5e1b3d..e4f2271 100644 --- a/packages/imagetools/utils/runtimeChecks.js +++ b/packages/imagetools/utils/runtimeChecks.js @@ -1,80 +1,65 @@ -// @ts-check -import fs from "node:fs"; -import path from "node:path"; -import { pathToFileURL } from "node:url"; -import findCacheDir from "find-cache-dir"; -import filterConfigs from "./filterConfigs.js"; -import { findUpSync } from "find-up" - -// Sharp related checks -export const sharp = await (async () => { - try { - if (await import("sharp")) { - return true; - } - } catch (error) { - return false; - } -})(); - -export const supportedImageTypes = [ - "avif", - "jpeg", - "jpg", - "png", - "webp", - ...(sharp ? ["heic", "heif", "tiff", "gif"] : ["jxl", "wp2"]), -]; - -// prettier-ignore -export const supportedConfigs = [ - "src", "alt", "tag", "content", "sizes", "preload", "loading", "decoding", "attributes", - "layout", "placeholder", "breakpoints", "objectFit", "objectPosition", "backgroundSize", - "backgroundPosition", "format", "fallbackFormat", "includeSourceFormat", "formatOptions", - "fadeInTransition", "artDirectives", "flip", "flop", "invert", "flatten", "normalize", - "grayscale", "hue", "saturation", "brightness", "w", "h", "ar", "width", "height", "aspect", - "background", "tint", "blur", "median", "rotate", "quality", "fit", "kernel", "position", - "cacheDir", "assetFileNames", -]; - -const configFile = findUpSync([ - "astro-imagetools.config.js", - "astro-imagetools.config.mjs", -]); - -const configFunction = configFile - ? await import(/* @vite-ignore */ pathToFileURL(configFile).href) - : null; - -const rawGlobalConfigOptions = configFunction?.default ?? {}; - -const NonGlobalConfigOptions = ["src", "alt", "content"]; - -const GlobalConfigs = supportedConfigs.filter( - (key) => !NonGlobalConfigOptions.includes(key) -); - -const GlobalConfigOptions = filterConfigs( - "Global", - rawGlobalConfigOptions, - GlobalConfigs -); - -export { GlobalConfigOptions }; - -// CWD -export const cwd = process.cwd().split(path.sep).join(path.posix.sep); - -const { cacheDir } = GlobalConfigOptions; - -// FS Cache related checks -const fsCachePath = - (cacheDir - ? cwd + cacheDir - : findCacheDir({ - name: "astro-imagetools", - })) + "/"; - -fs.existsSync(fsCachePath) || fs.mkdirSync(fsCachePath, { recursive: true }); - -export { fsCachePath }; +import fs from "node:fs" +import path from "node:path" +import filterConfigs from "./filterConfigs.js" +import { cache_path } from "@polymech/cache" +import { sync as dir } from "@polymech/fs/dir" +export const sharp = await (async () => { + try { + if (await import("sharp")) { + return true; + } + } catch (error) { + return false; + } +})(); + +export const supportedImageTypes = [ + "avif", + "jpeg", + "jpg", + "png", + "webp", + ...(sharp ? ["heic", "heif", "tiff", "gif"] : ["jxl", "wp2"]), +]; + +// prettier-ignore +export const supportedConfigs = [ + "src", "alt", "tag", "content", "sizes", "preload", "loading", "decoding", "attributes", + "layout", "placeholder", "breakpoints", "objectFit", "objectPosition", "backgroundSize", + "backgroundPosition", "format", "fallbackFormat", "includeSourceFormat", "formatOptions", + "fadeInTransition", "artDirectives", "flip", "flop", "invert", "flatten", "normalize", + "grayscale", "hue", "saturation", "brightness", "w", "h", "ar", "width", "height", "aspect", + "background", "tint", "blur", "median", "rotate", "quality", "fit", "kernel", "position", + "cacheDir", "assetFileNames", +]; +/* +const configFile = await findUp([ + "astro-imagetools.config.js", + "astro-imagetools.config.mjs", +]); +*/ +/* +const configFunction = configFile + ? await import(configFile).catch(async () => await import("/" + configFile)) + : null; +*/ +const configFunction = null +//const rawGlobalConfigOptions = configFunction?.default ?? {}; +const rawGlobalConfigOptions = {} +const NonGlobalConfigOptions = ["src", "alt", "content"] + +const GlobalConfigs = supportedConfigs.filter( + (key) => !NonGlobalConfigOptions.includes(key) +) + +const GlobalConfigOptions = filterConfigs( + "Global", + rawGlobalConfigOptions, + GlobalConfigs +) +export { GlobalConfigOptions } +export const cwd = process.cwd().split(path.sep).join(path.posix.sep) + +let fsCachePath = `${cache_path('imagetools')}/` +dir(fsCachePath) +export { fsCachePath } diff --git a/packages/imagetools/utils/runtimeChecks.test.ts b/packages/imagetools/utils/runtimeChecks.test.ts index 622592e..055e347 100644 --- a/packages/imagetools/utils/runtimeChecks.test.ts +++ b/packages/imagetools/utils/runtimeChecks.test.ts @@ -1,36 +1,36 @@ -import { beforeEach, describe, expect, it, vi } from "vitest"; - -describe("GlobalConfigOptions", () => { - beforeEach(() => { - // Need to reset the modules so that we can change the mock implementation between tests - vi.resetModules(); - }); - - it("Should be an empty object by default, if a config file isn't found", async () => { - // Simulate not finding a config file - vi.doMock("find-up", () => { - return { - findUp: async () => undefined, - }; - }); - // Need to import this after the mocks are set up with `doMock`. - const { GlobalConfigOptions } = await import("./runtimeChecks"); - expect(GlobalConfigOptions).toEqual({}); - }); - - it("should return the configuration from a global config file", async () => { - // Find a config file, and mock the contents of that file - vi.doMock("find-up", () => { - return { - findUp: async () => "mockedConfigFile", - }; - }); - vi.doMock("mockedConfigFile", () => { - return { - default: { breakpoints: [800, 1200] }, - }; - }); - const { GlobalConfigOptions } = await import("./runtimeChecks"); - expect(GlobalConfigOptions).toEqual({ breakpoints: [800, 1200] }); - }); -}); +import { beforeEach, describe, expect, it, vi } from "vitest"; + +describe("GlobalConfigOptions", () => { + beforeEach(() => { + // Need to reset the modules so that we can change the mock implementation between tests + vi.resetModules(); + }); + + it("Should be an empty object by default, if a config file isn't found", async () => { + // Simulate not finding a config file + vi.doMock("find-up", () => { + return { + findUp: async () => undefined, + }; + }); + // Need to import this after the mocks are set up with `doMock`. + const { GlobalConfigOptions } = await import("./runtimeChecks"); + expect(GlobalConfigOptions).toEqual({}); + }); + + it("should return the configuration from a global config file", async () => { + // Find a config file, and mock the contents of that file + vi.doMock("find-up", () => { + return { + findUp: async () => "mockedConfigFile", + }; + }); + vi.doMock("mockedConfigFile", () => { + return { + default: { breakpoints: [800, 1200] }, + }; + }); + const { GlobalConfigOptions } = await import("./runtimeChecks"); + expect(GlobalConfigOptions).toEqual({ breakpoints: [800, 1200] }); + }); +}); diff --git a/packages/imagetools/vitest.config.ts b/packages/imagetools/vitest.config.ts index 29dc63d..19fb2a7 100644 --- a/packages/imagetools/vitest.config.ts +++ b/packages/imagetools/vitest.config.ts @@ -1,7 +1,7 @@ -import { defineConfig } from "vitest/config"; - -export default defineConfig({ - test: { - // https://vitest.dev/config/#configuration - }, -}); +import { defineConfig } from "vitest/config"; + +export default defineConfig({ + test: { + // https://vitest.dev/config/#configuration + }, +}); diff --git a/packages/imagetools/.eslintrc.js b/packages/imagetools_/.eslintrc.js similarity index 100% rename from packages/imagetools/.eslintrc.js rename to packages/imagetools_/.eslintrc.js diff --git a/packages/imagetools/.github/workflows/ci.yml b/packages/imagetools_/.github/workflows/ci.yml similarity index 100% rename from packages/imagetools/.github/workflows/ci.yml rename to packages/imagetools_/.github/workflows/ci.yml diff --git a/packages/imagetools/.gitignore b/packages/imagetools_/.gitignore similarity index 100% rename from packages/imagetools/.gitignore rename to packages/imagetools_/.gitignore diff --git a/packages/imagetools_/.npmignore b/packages/imagetools_/.npmignore new file mode 100644 index 0000000..4f257ea --- /dev/null +++ b/packages/imagetools_/.npmignore @@ -0,0 +1,4 @@ +*.test.ts +test-fixtures +astroViteConfigs.js +vitest.config.ts diff --git a/packages/imagetools/.npmrc b/packages/imagetools_/.npmrc similarity index 100% rename from packages/imagetools/.npmrc rename to packages/imagetools_/.npmrc diff --git a/packages/imagetools/.prettierignore b/packages/imagetools_/.prettierignore similarity index 100% rename from packages/imagetools/.prettierignore rename to packages/imagetools_/.prettierignore diff --git a/packages/imagetools/.prettierrc b/packages/imagetools_/.prettierrc similarity index 100% rename from packages/imagetools/.prettierrc rename to packages/imagetools_/.prettierrc diff --git a/packages/imagetools/LICENSE b/packages/imagetools_/LICENSE similarity index 100% rename from packages/imagetools/LICENSE rename to packages/imagetools_/LICENSE diff --git a/packages/imagetools_/README.md b/packages/imagetools_/README.md new file mode 100644 index 0000000..eda0dbe --- /dev/null +++ b/packages/imagetools_/README.md @@ -0,0 +1,39 @@ +# **Astro ImageTools** + +**Astro ImageTools** is a collection of tools for optimizing images, background images, and generating responsive images for the **Astro JS** framework. + +## Features + +Below is a short list of features that **Astro ImageTools** offers. For more information, please see component-specific or API-specific documentation. + +- ✅ **Regular Image Optimization** (`` and ``) +- ✅ **Background Image Optimization** +- ✅ **Responsive Images** +- ✅ **Simple and intuitive Art Direction API** +- ✅ **Lazy Loading** +- ✅ **Programmatic APIs** +- ✅ **Asynchronous Decoding** +- ✅ **Unique Breakpoints Calculation** +- ✅ **Preloading for urgent images** +- ✅ **SVG Tracing and Posterization** +- ✅ **100% Scoped CSS** +- ✅ **Four kind of Layouts: `constrained`, `fixed`, `fullWidth` & `fill`** +- ✅ **Three kind of Placeholder Images: `blurred`, `dominantColor` & `tracedSVG`** +- ✅ **Long list of supported Image Formats** +- ✅ **Long List of supported Configuration Options** +- ✅ **Supports Remote Images and Data URIs too** +- ✅ **Support for _`sharp`less_ Environments** +- ✅ **Both Memory-based and FS-based Caching for better Performance** +- ✅ **Respects to _Semantics of HTML_ as much as possible** + +## Getting Started + +To get started with **Astro ImageTools**, first check out the [Installation](https://astro-imagetools-docs.vercel.app/en/installation) documentation for instructions on how to install the `astro-imagetools` package. + +If you are looking for the available components and APIs, please check out the [Components and APIs](https://astro-imagetools-docs.vercel.app/en/components-and-apis) documentation. + +If you want to view live examples of the components, APIs, layouts, and placeholder images, check out the [Astro ImageTools Demo](https://astro-imagetools-demo.vercel.app/) website. + +If you want to report any issues or have found a missing feature, please report it on [GitHub](https://github.com/RafidMuhymin/astro-imagetools/)! + +Good luck out there, Astronaut. 🧑‍🚀 diff --git a/packages/imagetools_/api/importImage.d.ts b/packages/imagetools_/api/importImage.d.ts new file mode 100644 index 0000000..bb0bb97 --- /dev/null +++ b/packages/imagetools_/api/importImage.d.ts @@ -0,0 +1 @@ +export default function importImage(url: string): Promise; diff --git a/packages/imagetools_/api/importImage.js b/packages/imagetools_/api/importImage.js new file mode 100644 index 0000000..b22ca0b --- /dev/null +++ b/packages/imagetools_/api/importImage.js @@ -0,0 +1,23 @@ +import load from "../plugin/hooks/load.js"; +import { getSrcPath } from "./utils/getSrcPath.js"; +import getResolvedSrc from "./utils/getResolvedSrc.js"; + +export default async function importImage(path) { + try { + const { search, protocol, pathname } = new URL(path); + + const { src: id, base } = await getResolvedSrc( + protocol === "data:" ? protocol + pathname : path + ); + + const src = (await load(id + search, base)).slice(16, -1); + + return src; + } catch (error) { + const id = await getSrcPath(path); + + const src = (await load(id)).slice(16, -1); + + return src; + } +} diff --git a/packages/imagetools_/api/index.js b/packages/imagetools_/api/index.js new file mode 100644 index 0000000..062d6ad --- /dev/null +++ b/packages/imagetools_/api/index.js @@ -0,0 +1,6 @@ +export { default as renderImg } from "./renderImg.js"; +export { default as renderPicture } from "./renderPicture.js"; +export { default as renderBackgroundImage } from "./renderBackgroundImage.js"; +export { default as renderBackgroundPicture } from "./renderBackgroundPicture.js"; +export { default as importImage } from "./importImage.js"; +export { getImageDetails, loadImage } from "./utils/imagetools.js" \ No newline at end of file diff --git a/packages/imagetools_/api/renderBackgroundImage.d.ts b/packages/imagetools_/api/renderBackgroundImage.d.ts new file mode 100644 index 0000000..e7e601b --- /dev/null +++ b/packages/imagetools_/api/renderBackgroundImage.d.ts @@ -0,0 +1,8 @@ +import type { + BackgroundImageConfigOptions, + BackgroundImageHTMLData, +} from "../types"; + +export default function renderBackgroundImage( + config: BackgroundImageConfigOptions +): Promise; diff --git a/packages/imagetools_/api/renderBackgroundImage.js b/packages/imagetools_/api/renderBackgroundImage.js new file mode 100644 index 0000000..f56b308 --- /dev/null +++ b/packages/imagetools_/api/renderBackgroundImage.js @@ -0,0 +1,159 @@ +// @ts-check +import crypto from "node:crypto"; +import getImage from "./utils/getImage.js"; +import getLinkElement from "./utils/getLinkElement.js"; +import getStyleElement from "./utils/getStyleElement.js"; +import getFilteredProps from "./utils/getFilteredProps.js"; +import getContainerElement from "./utils/getContainerElement.js"; + +export default async function renderBackgroundImage(props) { + const type = "BackgroundImage"; + + const { filteredProps, transformConfigs } = getFilteredProps(type, props); + + const { + src, + tag, + content, + preload, + attributes, + placeholder, + breakpoints, + backgroundSize, + backgroundPosition, + format, + fallbackFormat, + includeSourceFormat, + formatOptions, + artDirectives, + } = filteredProps; + + const { + link: linkAttributes = {}, + style: styleAttributes = {}, + container: containerAttributes = {}, + } = attributes; + + const sizes = ""; + + const { uuid, images } = await getImage({ + src, + type, + sizes, + format, + breakpoints, + placeholder, + artDirectives, + fallbackFormat, + includeSourceFormat, + formatOptions, + transformConfigs, + }); + + const className = `astro-imagetools-background-image-${uuid}`; + + const { imagesizes } = images[images.length - 1]; + + const link = getLinkElement({ images, preload, imagesizes, linkAttributes }); + + const backgroundImageStylesArray = images.map(({ media, sources }) => { + const uuid = crypto.randomBytes(4).toString("hex").toUpperCase(); + + const fallbackUrlCustomVariable = `--astro-imagetools-background-image-fallback-url${uuid}`; + + const newSources = {}; + + sources.forEach(({ src, format, srcset }) => { + const sources = srcset + .split(", ") + .map((source) => [ + source.slice(0, source.lastIndexOf(" ")), + source.slice(source.lastIndexOf(" ") + 1, -1), + ]); + + sources.forEach(([path, width]) => { + if (!newSources[width]) { + newSources[width] = []; + } + + newSources[width].push({ src, format, path }); + }); + }); + + const widths = Object.keys(newSources) + .map((width) => parseInt(width)) + .reverse(); + + const maxWidth = Math.max(...widths); + + const styles = widths + .map((width) => { + const sources = newSources[width]; + + const styles = sources + .map( + ({ format, path }, i) => + ` + ${i !== sources.length - 1 ? `.${format} ` : ""}.${className} { + background-repeat: no-repeat; + background-image: url(${path}), + var(${fallbackUrlCustomVariable}); + background-size: ${backgroundSize}; + background-position: ${backgroundPosition}; + } + ` + ) + .reverse() + .join(""); + + return width === maxWidth + ? styles + : ` + @media screen and (max-width: ${width}px) { + ${styles} + } + `; + }) + .join(""); + + return { + fallbackUrlCustomVariable, + styles: media + ? ` + @media ${media} { + ${styles} + } + ` + : styles, + }; + }); + + const containerStyles = ` + .${className} { + position: relative; + ${images + .map(({ fallback }, i) => { + const fallbackUrlCustomVariable = + backgroundImageStylesArray[i].fallbackUrlCustomVariable; + + return `${fallbackUrlCustomVariable}: url("${encodeURI(fallback)}");`; + }) + .join("\n")} + } + `; + + const backgroundStyles = + backgroundImageStylesArray.map(({ styles }) => styles).join("\n") + + containerStyles; + + const style = getStyleElement({ styleAttributes, backgroundStyles }); + + const htmlElement = getContainerElement({ + tag, + content, + className, + containerAttributes, + }); + + return { link, style, htmlElement }; +} diff --git a/packages/imagetools_/api/renderBackgroundPicture.d.ts b/packages/imagetools_/api/renderBackgroundPicture.d.ts new file mode 100644 index 0000000..a566421 --- /dev/null +++ b/packages/imagetools_/api/renderBackgroundPicture.d.ts @@ -0,0 +1,8 @@ +import type { + BackgroundPictureConfigOptions, + BackgroundPictureHTMLData, +} from "../types"; + +export default function renderBackgroundPicture( + config: BackgroundPictureConfigOptions +): Promise; diff --git a/packages/imagetools_/api/renderBackgroundPicture.js b/packages/imagetools_/api/renderBackgroundPicture.js new file mode 100644 index 0000000..1eea4e1 --- /dev/null +++ b/packages/imagetools_/api/renderBackgroundPicture.js @@ -0,0 +1,127 @@ +// @ts-check +import getImage from "./utils/getImage.js"; +import getImgElement from "./utils/getImgElement.js"; +import getLinkElement from "./utils/getLinkElement.js"; +import getStyleElement from "./utils/getStyleElement.js"; +import getLayoutStyles from "./utils/getLayoutStyles.js"; +import getFilteredProps from "./utils/getFilteredProps.js"; +import getPictureElement from "./utils/getPictureElement.js"; +import getBackgroundStyles from "./utils/getBackgroundStyles.js"; +import getContainerElement from "./utils/getContainerElement.js"; + +export default async function renderBackgroundPicture(props) { + const type = "BackgroundPicture"; + + const { filteredProps, transformConfigs } = getFilteredProps(type, props); + + const { + src, + tag, + content, + sizes, + preload, + loading, + decoding, + attributes, + placeholder, + breakpoints, + objectFit, + objectPosition, + format, + fallbackFormat, + includeSourceFormat, + formatOptions, + fadeInTransition, + artDirectives, + } = filteredProps; + + const { + img: imgAttributes = {}, + link: linkAttributes = {}, + style: styleAttributes = {}, + picture: pictureAttributes = {}, + container: containerAttributes = {}, + } = attributes; + + const { uuid, images } = await getImage({ + src, + type, + sizes, + format, + breakpoints, + placeholder, + artDirectives, + fallbackFormat, + includeSourceFormat, + formatOptions, + transformConfigs, + }); + + const className = `astro-imagetools-picture-${uuid}`, + containerClassName = `astro-imagetools-background-picture-${uuid}`; + + const { imagesizes } = images[images.length - 1]; + + const backgroundStyles = getBackgroundStyles( + images, + className, + objectFit, + objectPosition, + fadeInTransition, + { isBackgroundPicture: true, containerClassName } + ); + + const style = getStyleElement({ styleAttributes, backgroundStyles }); + + const link = getLinkElement({ images, preload, imagesizes, linkAttributes }); + + const layoutStyles = getLayoutStyles({ isBackgroundImage: true }); + + // Background Images shouldn't convey important information + const alt = ""; + + const sources = images.flatMap(({ media, sources, sizes, imagesizes }) => + sources.map(({ format, src, srcset }) => + src + ? getImgElement({ + src, + alt, + sizes, + style, + srcset, + loading, + decoding, + imagesizes, + fadeInTransition, + layoutStyles, + imgAttributes, + }) + : `` + ) + ); + + const picture = getPictureElement({ + sources, + className, + layoutStyles, + pictureAttributes, + isBackgroundPicture: true, + }); + + const htmlElement = getContainerElement({ + tag, + content: picture + content, + containerAttributes, + isBackgroundPicture: true, + containerClassName, + }); + + return { link, style, htmlElement }; +} diff --git a/packages/imagetools_/api/renderImg.d.ts b/packages/imagetools_/api/renderImg.d.ts new file mode 100644 index 0000000..abbc304 --- /dev/null +++ b/packages/imagetools_/api/renderImg.d.ts @@ -0,0 +1,5 @@ +import type { ImgConfigOptions, ImgHTMLData } from "../types"; + +export default function renderImg( + config: ImgConfigOptions +): Promise; diff --git a/packages/imagetools_/api/renderImg.js b/packages/imagetools_/api/renderImg.js new file mode 100644 index 0000000..3bc2bf3 --- /dev/null +++ b/packages/imagetools_/api/renderImg.js @@ -0,0 +1,93 @@ +// @ts-check +import getImage from "./utils/getImage.js"; +import getImgElement from "./utils/getImgElement.js"; +import getLinkElement from "./utils/getLinkElement.js"; +import getStyleElement from "./utils/getStyleElement.js"; +import getLayoutStyles from "./utils/getLayoutStyles.js"; +import getFilteredProps from "./utils/getFilteredProps.js"; +import getBackgroundStyles from "./utils/getBackgroundStyles.js"; + +export default async function renderImg(props) { + const type = "Img"; + + const { filteredProps, transformConfigs } = getFilteredProps(type, props); + + const { + src, + alt, + sizes, + preload, + loading, + decoding, + attributes, + layout, + breakpoints, + placeholder, + objectFit, + objectPosition, + format, + formatOptions, + } = filteredProps; + + const artDirectives = [], + fallbackFormat = format, + fadeInTransition = false, + includeSourceFormat = false; + + const { + img: imgAttributes = {}, + link: linkAttributes = {}, + style: styleAttributes = {}, + } = attributes; + + const { uuid, images } = await getImage({ + src, + type, + sizes, + format, + breakpoints, + placeholder, + artDirectives, + fallbackFormat, + includeSourceFormat, + formatOptions, + transformConfigs, + }); + + const className = `astro-imagetools-img-${uuid}`; + + const { imagesizes } = images[images.length - 1]; + const backgroundStyles = getBackgroundStyles( + images, + className, + objectFit, + objectPosition, + fadeInTransition, + { isImg: true } + ); + const style = getStyleElement({ styleAttributes, backgroundStyles }) + const link = getLinkElement({ images, preload, imagesizes, linkAttributes }) + const layoutStyles = getLayoutStyles({ layout }) + + const sources = images.flatMap(({ sources, sizes, imagesizes }) => + sources.map(({ src, srcset }) => + getImgElement({ + src, + alt, + sizes, + style, + srcset, + loading, + decoding, + imagesizes, + fadeInTransition, + layoutStyles, + imgAttributes, + imgClassName: className, + }) + ) + ) + + const [img] = sources + return { link, style, img } +} diff --git a/packages/imagetools_/api/renderPicture.d.ts b/packages/imagetools_/api/renderPicture.d.ts new file mode 100644 index 0000000..54ccfe5 --- /dev/null +++ b/packages/imagetools_/api/renderPicture.d.ts @@ -0,0 +1,5 @@ +import type { PictureConfigOptions, PictureHTMLData } from "../types"; + +export default function renderPicture( + config: PictureConfigOptions +): Promise; diff --git a/packages/imagetools_/api/renderPicture.js b/packages/imagetools_/api/renderPicture.js new file mode 100644 index 0000000..8a98d1c --- /dev/null +++ b/packages/imagetools_/api/renderPicture.js @@ -0,0 +1,111 @@ +// @ts-check +import getImage from "./utils/getImage.js"; +import getImgElement from "./utils/getImgElement.js"; +import getLinkElement from "./utils/getLinkElement.js"; +import getStyleElement from "./utils/getStyleElement.js"; +import getLayoutStyles from "./utils/getLayoutStyles.js"; +import getFilteredProps from "./utils/getFilteredProps.js"; +import getPictureElement from "./utils/getPictureElement.js"; +import getBackgroundStyles from "./utils/getBackgroundStyles.js"; + +export default async function renderPicture(props) { + const type = "Picture"; + + const { filteredProps, transformConfigs } = getFilteredProps(type, props); + + const { + src, + alt, + sizes, + preload, + loading, + decoding, + attributes, + layout, + placeholder, + breakpoints, + objectFit, + objectPosition, + format, + fallbackFormat, + includeSourceFormat, + formatOptions, + fadeInTransition, + artDirectives, + } = filteredProps; + + const { + img: imgAttributes = {}, + link: linkAttributes = {}, + style: styleAttributes = {}, + picture: pictureAttributes = {}, + } = attributes; + + const { uuid, images } = await getImage({ + src, + type, + sizes, + format, + breakpoints, + placeholder, + fallbackFormat, + includeSourceFormat, + formatOptions, + artDirectives, + transformConfigs, + }); + + const className = `astro-imagetools-picture-${uuid}`; + + const { imagesizes } = images[images.length - 1]; + + const backgroundStyles = getBackgroundStyles( + images, + className, + objectFit, + objectPosition, + fadeInTransition + ); + + const style = getStyleElement({ styleAttributes, backgroundStyles }); + + const link = getLinkElement({ images, preload, imagesizes, linkAttributes }); + + const layoutStyles = getLayoutStyles({ layout }); + + const sources = images.flatMap(({ media, sources, sizes, imagesizes }) => + sources.map(({ format, src, srcset }) => + src + ? getImgElement({ + src, + alt, + sizes, + style, + srcset, + loading, + decoding, + imagesizes, + fadeInTransition, + layoutStyles, + imgAttributes, + }) + : `` + ) + ); + + const picture = getPictureElement({ + sources, + className, + layoutStyles, + pictureAttributes, + }); + + return { link, style, picture }; +} diff --git a/packages/imagetools_/api/utils/codecs.js b/packages/imagetools_/api/utils/codecs.js new file mode 100644 index 0000000..8f72571 --- /dev/null +++ b/packages/imagetools_/api/utils/codecs.js @@ -0,0 +1,38 @@ +// @ts-check +import fs from "node:fs"; +import { extname } from "node:path"; +import * as codecs from "@astropub/codecs"; + +export async function getImageDetails(path, width, height, aspect) { + const extension = extname(path).slice(1); + + const imageFormat = extension === "jpeg" ? "jpg" : extension; + + const buffer = fs.readFileSync(path); + const decodedImage = await codecs.jpg.decode(buffer); + + if (aspect && !width && !height) { + if (!width && !height) { + ({ width } = decodedImage); + } + + if (width) { + height = width / aspect; + } + + if (height) { + width = height * aspect; + } + } + + const image = await decodedImage.resize({ width, height }); + + const { width: imageWidth, height: imageHeight } = image; + + return { + image, + imageWidth, + imageHeight, + imageFormat, + }; +} diff --git a/packages/imagetools_/api/utils/getArtDirectedImages.js b/packages/imagetools_/api/utils/getArtDirectedImages.js new file mode 100644 index 0000000..1f7c073 --- /dev/null +++ b/packages/imagetools_/api/utils/getArtDirectedImages.js @@ -0,0 +1,137 @@ +// @ts-check +import getSrcset from "./getSrcset.js"; +import getConfigOptions from "./getConfigOptions.js"; +import getFallbackImage from "./getFallbackImage.js"; +import getProcessedImage from "./getProcessedImage.js"; + +export default async function getArtDirectedImages( + artDirectives = [], + placeholder, + format, + imagesizes, + breakpoints, + fallbackFormat, + includeSourceFormat, + formatOptions, + rest +) { + const images = await Promise.all( + artDirectives.map( + async ({ + src, + media, + sizes: directiveImagesizes, + placeholder: directivePlaceholder, + breakpoints: directiveBreakpoints, + objectFit, + objectPosition, + backgroundSize, + backgroundPosition, + format: directiveFormat, + fallbackFormat: directiveFallbackFormat, + includeSourceFormat: directiveIncludeSourceFormat, + formatOptions: directiveFormatOptions = {}, + ...configOptions + }) => { + const { + path, + base, + rest: rest2, + image, + imageWidth, + imageHeight, + imageFormat, + } = await getProcessedImage(src, configOptions); + + rest2.aspect = `${imageWidth / imageHeight}`; + + const calculatedConfigs = getConfigOptions( + imageWidth, + directiveImagesizes || imagesizes, + directiveBreakpoints || breakpoints, + directiveFormat || format, + imageFormat, + directiveFallbackFormat || fallbackFormat, + directiveIncludeSourceFormat || includeSourceFormat + ); + + const { formats, requiredBreakpoints } = calculatedConfigs; + + imagesizes = calculatedConfigs.imagesizes; + + const maxWidth = requiredBreakpoints[requiredBreakpoints.length - 1]; + + const sources = await Promise.all( + formats.map(async (format) => { + const srcset = await getSrcset( + path, + base, + requiredBreakpoints, + format, + { + ...rest, + ...rest2, + ...formatOptions[format], + ...directiveFormatOptions[format], + } + ); + + return { + format, + srcset, + }; + }) + ); + + const sizes = { + width: maxWidth, + height: Math.round(maxWidth / rest2.aspect), + }; + + const object = { + fit: objectFit, + position: objectPosition, + }; + + const background = { + size: backgroundSize, + position: backgroundPosition, + }; + + const fallback = await getFallbackImage( + path, + directivePlaceholder || placeholder, + image, + imageFormat, + { ...formatOptions, ...directiveFormatOptions }, + { ...rest, ...rest2 } + ); + + const returnValue = { + media, + sources, + sizes, + fallback, + imagesizes, + }; + + const isBackgroundImage = !!backgroundSize || !!backgroundPosition; + + isBackgroundImage + ? (returnValue.background = background) + : (returnValue.object = object); + + return { + media, + sources, + sizes, + object, + fallback, + imagesizes, + }; + } + ) + ); + + return images; +} diff --git a/packages/imagetools_/api/utils/getAttributesString.js b/packages/imagetools_/api/utils/getAttributesString.js new file mode 100644 index 0000000..e9bd1c1 --- /dev/null +++ b/packages/imagetools_/api/utils/getAttributesString.js @@ -0,0 +1,27 @@ +// @ts-check + +import printWarning from "../../utils/printWarning.js"; + +export default function getAttributesString({ + attributes, + element = "", + excludeArray = [], +}) { + const attributesString = Object.keys(attributes) + .filter((key) => { + if (excludeArray.includes(key)) { + printWarning({ + key, + element, + }); + + return false; + } + + return true; + }) + .map((key) => `${key}="${attributes[key]}"`) + .join(" "); + + return attributesString; +} diff --git a/packages/imagetools_/api/utils/getBackgroundStyles.js b/packages/imagetools_/api/utils/getBackgroundStyles.js new file mode 100644 index 0000000..111233c --- /dev/null +++ b/packages/imagetools_/api/utils/getBackgroundStyles.js @@ -0,0 +1,97 @@ +// @ts-check + +export default function getBackgroundStyles( + images, + className, + objectFit, + objectPosition, + fadeInTransition, + { isImg = false, isBackgroundPicture = false, containerClassName = "" } = {} +) { + const sourcesWithFallback = images.filter(({ fallback }) => fallback); + + if (sourcesWithFallback.length === 0) return ""; + + const staticStyles = !fadeInTransition + ? "" + : ` + ${ + isBackgroundPicture + ? ` + .${containerClassName} * { + z-index: 1; + position: relative; + } + ` + : "" + } + + .${className} { + --opacity: 1; + --z-index: 0; + } + + ${ + !isBackgroundPicture + ? ` + .${className} img { + z-index: 1; + position: relative; + } + ` + : "" + } + + .${className}::after { + inset: 0; + content: ""; + left: 0; + width: 100%; + height: 100%; + position: absolute; + pointer-events: none; + transition: opacity ${ + typeof fadeInTransition !== "object" + ? "1s" + : (() => { + const { + delay = "0s", + duration = "1s", + timingFunction = "ease", + } = fadeInTransition; + + return `${duration} ${timingFunction} ${delay}`; + })() + }; + opacity: var(--opacity); + z-index: var(--z-index); + } + `; + + const dynamicStyles = images + .map(({ media, fallback, object }) => { + const elementSelector = className + (!isImg ? " img" : ""), + backgroundElementSelector = + className + (fadeInTransition ? "::after" : ""); + + const style = ` + .${elementSelector} { + object-fit: ${object?.fit || objectFit}; + object-position: ${object?.position || objectPosition}; + } + + .${backgroundElementSelector} { + background-size: ${object?.fit || objectFit}; + background-image: url("${encodeURI(fallback)}"); + background-position: ${object?.position || objectPosition}; + } + `; + + return media ? `@media ${media} { ${style} }` : style; + }) + .reverse(); + + const backgroundStyles = [staticStyles, ...dynamicStyles].join(""); + + return backgroundStyles; +} diff --git a/packages/imagetools_/api/utils/getBreakpoints.js b/packages/imagetools_/api/utils/getBreakpoints.js new file mode 100644 index 0000000..02a098e --- /dev/null +++ b/packages/imagetools_/api/utils/getBreakpoints.js @@ -0,0 +1,77 @@ +// @ts-check +import printWarning from "../../utils/printWarning.js"; + +export default function getBreakpoints(breakpoints, imageWidth) { + if (Array.isArray(breakpoints)) { + return breakpoints.sort((a, b) => a - b); + } + + const { count, minWidth = 320 } = breakpoints || {}; + + const maxWidth = (() => { + if (breakpoints?.maxWidth) return breakpoints.maxWidth; + + if (imageWidth > 3840) { + printWarning({ + message: + "The width of the source image is greater than 3840px. The generated breakpoints will be capped at 3840px. If you need breakpoints larger than this, please pass the maxWidth option to the breakpoints property.", + }); + + return 3840; + } + + return imageWidth; + })(); + + const breakPoints = []; + + const diff = maxWidth - minWidth; + + const n = + count || + (maxWidth <= 400 + ? 1 + : maxWidth <= 640 + ? 2 + : maxWidth <= 800 + ? 3 + : maxWidth <= 1024 + ? 4 + : maxWidth <= 1280 + ? 5 + : maxWidth <= 1440 + ? 6 + : maxWidth <= 1920 + ? 7 + : maxWidth <= 2560 + ? 8 + : maxWidth <= 2880 + ? 9 + : maxWidth <= 3840 + ? 10 + : 11); + + let currentWidth = minWidth; + + n > 1 && breakPoints.push(currentWidth); + + let steps = 0; + + for (let i = 1; i < n; i++) { + steps += i; + } + + const pixelsPerStep = diff / steps; + + for (let i = 1; i < n - 1; i++) { + const next = pixelsPerStep * (n - i) + currentWidth; + + breakPoints.push(Math.round(next)); + + currentWidth = next; + } + + breakPoints.push(maxWidth); + + return [...new Set(breakPoints)]; +} diff --git a/packages/imagetools_/api/utils/getConfigOptions.js b/packages/imagetools_/api/utils/getConfigOptions.js new file mode 100644 index 0000000..3b3797d --- /dev/null +++ b/packages/imagetools_/api/utils/getConfigOptions.js @@ -0,0 +1,34 @@ +// @ts-check +import getBreakpoints from "./getBreakpoints.js"; + +export default function getConfigOptions( + imageWidth, + imagesizes, + breakpoints, + format, + imageFormat, + fallbackFormat, + includeSourceFormat +) { + const formats = [ + ...new Set( + [format, includeSourceFormat && imageFormat] + .flat() + .filter((f) => f && f !== fallbackFormat) + ), + fallbackFormat, + ]; + + const requiredBreakpoints = getBreakpoints(breakpoints, imageWidth); + + imagesizes = + typeof imagesizes === "string" + ? imagesizes + : imagesizes(requiredBreakpoints); + + return { + formats, + imagesizes, + requiredBreakpoints, + }; +} diff --git a/packages/imagetools_/api/utils/getContainerElement.js b/packages/imagetools_/api/utils/getContainerElement.js new file mode 100644 index 0000000..9c5b710 --- /dev/null +++ b/packages/imagetools_/api/utils/getContainerElement.js @@ -0,0 +1,48 @@ +// @ts-check +import getAttributesString from "./getAttributesString.js"; + +export default function getContainerElement({ + tag, + content, + className = "", + containerAttributes, + isBackgroundPicture = false, + containerClassName = "", +}) { + const { + class: customClasses = "", + style: customInlineStyles = "", + ...restContainerAttributes + } = containerAttributes; + + const attributesString = getAttributesString({ + attributes: restContainerAttributes, + }); + + const classAttribute = [ + isBackgroundPicture + ? "astro-imagetools-background-picture" + : "astro-imagetools-background-image", + isBackgroundPicture ? containerClassName : className, + customClasses, + ] + .join(" ") + .trim(); + + const styleAttribute = [ + isBackgroundPicture ? "position: relative;" : "", + customInlineStyles + (customInlineStyles.endsWith(";") ? "" : ";"), + ] + .join(" ") + .trim(); + + const containerElement = `<${tag} + ${attributesString} + class="${classAttribute}" + style="${styleAttribute}" + > + ${content} + `; + + return containerElement; +} diff --git a/packages/imagetools_/api/utils/getFallbackImage.js b/packages/imagetools_/api/utils/getFallbackImage.js new file mode 100644 index 0000000..b085286 --- /dev/null +++ b/packages/imagetools_/api/utils/getFallbackImage.js @@ -0,0 +1,58 @@ +// @ts-check + +import util from "node:util"; +import potrace from "potrace"; +import getSrcset from "./getSrcset.js"; +import { sharp } from "../../utils/runtimeChecks.js"; + +export default async function getFallbackImage( + src, + placeholder, + image, + format, + formatOptions, + rest +) { + const base = null; + + switch (placeholder) { + case "blurred": { + const dataUri = await getSrcset(src, base, [20], format, { + inline: true, + ...rest, + ...formatOptions[format], + }); + + return dataUri; + } + case "tracedSVG": { + const { function: fn, options } = formatOptions.tracedSVG; + + const traceSVG = util.promisify(potrace[fn]); + + const imageBuffer = sharp + ? await image.toBuffer() + : Buffer.from( + (await image.encode(`image/${format === "jpg" ? "jpeg" : format}`)) + .data + ); + + const tracedSVG = await traceSVG(imageBuffer, options); + + return `data:image/svg+xml;utf8,${tracedSVG}`; + } + case "dominantColor": { + if (sharp) { + var { r, g, b } = (await image.stats()).dominant; + } else { + [r, g, b] = image.color; + } + + const svg = ``; + + return `data:image/svg+xml;utf8,${svg}`; + } + default: + return null; + } +} diff --git a/packages/imagetools_/api/utils/getFilteredProps.js b/packages/imagetools_/api/utils/getFilteredProps.js new file mode 100644 index 0000000..9c791ba --- /dev/null +++ b/packages/imagetools_/api/utils/getFilteredProps.js @@ -0,0 +1,138 @@ +// @ts-check +import filterConfigs from "../../utils/filterConfigs.js"; +import { + supportedConfigs, + GlobalConfigOptions, +} from "../../utils/runtimeChecks.js"; + +const GlobalOnlyProperties = ["cacheDir", "assetFileNames"]; + +const NonGlobalSupportedConfigs = supportedConfigs.filter( + (key) => !GlobalOnlyProperties.includes(key) +); + +const NonProperties = { + Img: [ + "tag", + "content", + "backgroundSize", + "backgroundPosition", + "fallbackFormat", + "includeSourceFormat", + "fadeInTransition", + "artDirectives", + ], + Picture: ["tag", "content", "backgroundSize", "backgroundPosition"], + BackgroundImage: [ + "alt", + "loading", + "decoding", + "layout", + "objectFit", + "objectPosition", + "fadeInTransition", + ], + BackgroundPicture: ["alt", "backgroundSize", "backgroundPosition"], +}; + +const ImgProperties = NonGlobalSupportedConfigs.filter( + (key) => !NonProperties.Img.includes(key) + ), + PictureProperties = NonGlobalSupportedConfigs.filter( + (key) => !NonProperties.Picture.includes(key) + ), + BackgroundImageProperties = NonGlobalSupportedConfigs.filter( + (key) => !NonProperties.BackgroundImage.includes(key) + ), + BackgroundPictureProperties = NonGlobalSupportedConfigs.filter( + (key) => !NonProperties.BackgroundPicture.includes(key) + ); + +const SupportedProperties = { + Img: ImgProperties, + Picture: PictureProperties, + BackgroundImage: BackgroundImageProperties, + BackgroundPicture: BackgroundPictureProperties, +}; + +export default function getFilteredProps(type, props) { + const filteredGlobalConfigs = filterConfigs( + "Global", + GlobalConfigOptions, + SupportedProperties[type], + { warn: false } + ); + + const { search, searchParams } = new URL(props.src, "file://"); + + props.src = props.src.replace(search, ""); + + const paramOptions = Object.fromEntries(searchParams); + + const filteredLocalProps = filterConfigs( + type, + { + ...paramOptions, + ...props, + }, + SupportedProperties[type] + ); + + const resolvedProps = { + ...filteredGlobalConfigs, + ...filteredLocalProps, + }; + + const { + src, + alt, + tag = "section", + content = "", + sizes = function (breakpoints) { + const maxWidth = breakpoints[breakpoints.length - 1]; + return `(min-width: ${maxWidth}px) ${maxWidth}px, 100vw`; + }, + preload, + loading = preload ? "eager" : "lazy", + decoding = "async", + attributes = {}, + layout = "constrained", + placeholder = "blurred", + breakpoints, + objectFit = "cover", + objectPosition = "50% 50%", + backgroundSize = "cover", + backgroundPosition = "50% 50%", + format = type === "Img" ? undefined : ["avif", "webp"], + fallbackFormat, + includeSourceFormat = true, + formatOptions = { + tracedSVG: { + function: "trace", + }, + }, + fadeInTransition = true, + artDirectives, + ...transformConfigs + } = resolvedProps; + + // prettier-ignore + const allProps = { + src, alt, tag, content, sizes, preload, loading, decoding, attributes, layout, placeholder, + breakpoints, objectFit, objectPosition, backgroundSize, backgroundPosition, format, + fallbackFormat, includeSourceFormat, formatOptions, fadeInTransition, artDirectives, + ...transformConfigs, + }; + + const filteredProps = filterConfigs( + type, + allProps, + SupportedProperties[type], + { warn: false } + ); + + return { + filteredProps, + transformConfigs, + }; +} diff --git a/packages/imagetools_/api/utils/getFilteredProps.test.ts b/packages/imagetools_/api/utils/getFilteredProps.test.ts new file mode 100644 index 0000000..7b8f20c --- /dev/null +++ b/packages/imagetools_/api/utils/getFilteredProps.test.ts @@ -0,0 +1,49 @@ +import { describe, expect, it } from "vitest"; +import getFilteredProps from "./getFilteredProps"; + +describe("getFilteredProps", () => { + it("should should merge in default props", () => { + const result = getFilteredProps("Img", { src: "/img.jpeg", alt: "alt" }); + expect(result).toEqual({ + filteredProps: { + alt: "alt", + attributes: {}, + breakpoints: undefined, + decoding: "async", + format: undefined, + formatOptions: { + tracedSVG: { + function: "trace", + }, + }, + layout: "constrained", + loading: "lazy", + objectFit: "cover", + objectPosition: "50% 50%", + placeholder: "blurred", + preload: undefined, + sizes: expect.any(Function), + src: "/img.jpeg", + }, + transformConfigs: {}, + }); + }); + + it("should accept empty string for `alt` prop on Img", () => { + const result = getFilteredProps("Img", { src: "/img.jpeg", alt: "" }); + expect(result).toMatchObject({ + filteredProps: { + alt: "", + }, + }); + }); + + it("should accept empty string for `alt` prop on Picture", () => { + const result = getFilteredProps("Picture", { src: "/img.jpeg", alt: "" }); + expect(result).toMatchObject({ + filteredProps: { + alt: "", + }, + }); + }); +}); diff --git a/packages/imagetools_/api/utils/getImage.js b/packages/imagetools_/api/utils/getImage.js new file mode 100644 index 0000000..b2ad3c9 --- /dev/null +++ b/packages/imagetools_/api/utils/getImage.js @@ -0,0 +1,108 @@ +// @ts-check +import crypto from "node:crypto"; +import objectHash from "object-hash"; +import getImageSources from "./getImageSources.js"; +import getProcessedImage from "./getProcessedImage.js"; +import getArtDirectedImages from "./getArtDirectedImages.js"; +import pMap from "p-map"; +// Caching moved to plugin level for proper store population + +const imagesData = new Map(); + +const delay = (ms) => new Promise((resolve) => setTimeout(resolve, ms)); + +// Cache helpers moved to plugin level + +export default async function ({ + src, + type, + sizes: imagesizes, + format, + breakpoints, + placeholder, + fallbackFormat, + includeSourceFormat, + formatOptions, + artDirectives, + transformConfigs, +}) { + try { + const args = Array.from(arguments); + const hash = objectHash(args); + + // Check in-memory cache first + if (imagesData.has(hash)) { + return imagesData.get(hash); + } + + // Caching removed from this level to ensure proper Vite store population + // Cache is now handled at the plugin level where it can properly manage the store + const { path, base, rest, image, imageWidth, imageHeight, imageFormat } = + await getProcessedImage(src, transformConfigs); + + src = path; + + rest.aspect = `${imageWidth / imageHeight}`; + if (!fallbackFormat) { + fallbackFormat = imageFormat; + } + + // Fetch both image sources and art-directed images + const [mainImage, artDirectedImages] = await pMap( + [ + async () => + await getImageSources( + src, + base, + image, + format, + imageWidth, + imagesizes, + breakpoints, + placeholder, + imageFormat, + formatOptions, + fallbackFormat, + includeSourceFormat, + rest + ), + async () => { + return await getArtDirectedImages( + artDirectives, + placeholder, + format, + imagesizes, + breakpoints, + fallbackFormat, + includeSourceFormat, + formatOptions, + rest + ); + }, + ], + async (task) => await task(), + { concurrency: 1 } + ); + + // Ensure artDirectedImages is an array + const images = Array.isArray(artDirectedImages) ? [...artDirectedImages, mainImage] : [mainImage]; + + // Create deterministic UUID based on input hash for consistent caching + const uuid = crypto.createHash('md5').update(hash).digest("hex").slice(0, 8).toUpperCase(); + + const returnObject = { + uuid, + images, + }; + + // Cache only in memory at this level + imagesData.set(hash, returnObject); + + // Persistent caching moved to plugin level for proper store management + + return returnObject; + } catch (error) { + console.error(`Error processing images:: ${src}`, error, error.stack); + throw error; + } +} diff --git a/packages/imagetools_/api/utils/getImageSources.js b/packages/imagetools_/api/utils/getImageSources.js new file mode 100644 index 0000000..d0dca00 --- /dev/null +++ b/packages/imagetools_/api/utils/getImageSources.js @@ -0,0 +1,91 @@ +// @ts-check +import getSrcset from "./getSrcset.js"; +import getConfigOptions from "./getConfigOptions.js"; +import getFallbackImage from "./getFallbackImage.js"; +import pMap from "p-map"; + +function delay(ms) { + return new Promise((resolve) => setTimeout(resolve, ms)); +} + +export default async function getImageSources( + src, + base, + image, + format, + imageWidth, + imagesizes, + breakpoints, + placeholder, + imageFormat, + formatOptions, + fallbackFormat, + includeSourceFormat, + rest +) { + try { + const calculatedConfigs = getConfigOptions( + imageWidth, + imagesizes, + breakpoints, + format, + imageFormat, + fallbackFormat, + includeSourceFormat + ); + + const { formats, requiredBreakpoints } = calculatedConfigs; + imagesizes = calculatedConfigs.imagesizes; + const maxWidth = requiredBreakpoints[requiredBreakpoints.length - 1]; + const sliceLength = -(maxWidth.toString().length + 2); + + const sources = await pMap( + formats, + async (format) => { + try { + await delay(250); + const srcset = await getSrcset(src, base, requiredBreakpoints, format, { + ...rest, + ...formatOptions[format], + }); + + const srcsets = srcset.split(", "); + const srcObject = + format === fallbackFormat + ? { src: srcsets[srcsets.length - 1].slice(0, sliceLength) } + : {}; + + return { + ...srcObject, + format, + srcset, + }; + } catch (error) { + console.error(`Error processing format ${format}:`, error); + return null; + } + }, + { concurrency: 1 } + ); + + const filteredSources = sources.filter(Boolean); + + const sizes = { + width: maxWidth, + height: Math.round(maxWidth / rest.aspect), + }; + + const fallback = await getFallbackImage( + src, + placeholder, + image, + fallbackFormat, + formatOptions, + rest + ) + return { sources: filteredSources, sizes, fallback, imagesizes }; + } catch (error) { + console.error("Error in getImageSources:", error); + return { sources: [], sizes: {}, fallback: null, imagesizes: null }; + } +} diff --git a/packages/imagetools_/api/utils/getImgElement.js b/packages/imagetools_/api/utils/getImgElement.js new file mode 100644 index 0000000..fea4109 --- /dev/null +++ b/packages/imagetools_/api/utils/getImgElement.js @@ -0,0 +1,80 @@ +// @ts-check + +import getAttributesString from "./getAttributesString.js"; + +export default function getImgElement({ + src, + alt, + sizes, + style, + srcset, + loading, + decoding, + imagesizes, + fadeInTransition, + layoutStyles, + imgAttributes, + imgClassName = "", +}) { + const { + class: customClasses = "", + style: customInlineStyles = "", + onload: customOnload = "", + ...restImgAttributes + } = imgAttributes; + + const attributesString = getAttributesString({ + attributes: restImgAttributes, + element: "img", + excludeArray: [ + "src", + "alt", + "srcset", + "sizes", + "width", + "height", + "loading", + "decoding", + ], + }); + + const classAttribute = ["astro-imagetools-img", imgClassName, customClasses] + .join(" ") + .trim(); + + const styleAttribute = [ + "display: inline-block; overflow: hidden; vertical-align: middle;", + customInlineStyles + (customInlineStyles.endsWith(";") ? "" : ";"), + layoutStyles, + ] + .join(" ") + .trim(); + + const onloadAttribute = [ + !imgClassName && style + ? fadeInTransition + ? `parentElement.style.setProperty('--z-index', 1); parentElement.style.setProperty('--opacity', 0);` + : `parentElement.style.backgroundImage = 'unset';` + : "", + customOnload, + ] + .join(" ") + .trim(); + + const imgElement = `==`; + + return imgElement; +} diff --git a/packages/imagetools_/api/utils/getLayoutStyles.js b/packages/imagetools_/api/utils/getLayoutStyles.js new file mode 100644 index 0000000..efa6d96 --- /dev/null +++ b/packages/imagetools_/api/utils/getLayoutStyles.js @@ -0,0 +1,16 @@ +// @ts-check + +export default function getLayoutStyles({ + layout = null, + isBackgroundImage = false, +}) { + return isBackgroundImage + ? "width: 100%; height: 100%;" + : layout === "fill" + ? `width: 100%; height: 100%;` + : layout === "fullWidth" + ? `width: 100%; height: auto;` + : layout === "fixed" + ? "" + : "max-width: 100%; height: auto;"; +} diff --git a/packages/imagetools_/api/utils/getLinkElement.js b/packages/imagetools_/api/utils/getLinkElement.js new file mode 100644 index 0000000..2fcfb7a --- /dev/null +++ b/packages/imagetools_/api/utils/getLinkElement.js @@ -0,0 +1,34 @@ +// @ts-check +import getAttributesString from "./getAttributesString.js"; + +export default function getLinkElement({ + images = [], + preload = "", + imagesizes = "", + linkAttributes, +}) { + const imagesrcset = + preload && + images[images.length - 1]?.sources.find( + ({ format: fmt }) => fmt === preload + )?.srcset; + + const attributesString = getAttributesString({ + element: "link", + attributes: linkAttributes, + excludeArray: ["as", "rel", "imagesizes", "imagesrcset"], + }); + + const linkElement = + preload && images.length + ? `` + : ""; + + return linkElement; +} diff --git a/packages/imagetools_/api/utils/getLinkElement.test.ts b/packages/imagetools_/api/utils/getLinkElement.test.ts new file mode 100644 index 0000000..83d435a --- /dev/null +++ b/packages/imagetools_/api/utils/getLinkElement.test.ts @@ -0,0 +1,14 @@ +import { describe, expect, it } from "vitest"; +import getLinkElement from "./getLinkElement"; + +describe("getLinkElement", () => { + it("returns an empty string if preload is not set", () => { + const result = getLinkElement({ linkAttributes: {} }); + expect(result).toBe(""); + }); + + it("returns an empty string if no images are provided", () => { + const result = getLinkElement({ linkAttributes: {}, preload: "webp" }); + expect(result).toBe(""); + }); +}); diff --git a/packages/imagetools_/api/utils/getPictureElement.js b/packages/imagetools_/api/utils/getPictureElement.js new file mode 100644 index 0000000..b0d62c3 --- /dev/null +++ b/packages/imagetools_/api/utils/getPictureElement.js @@ -0,0 +1,43 @@ +// @ts-check +import getAttributesString from "./getAttributesString.js"; + +export default function getPictureElement({ + sources, + className, + layoutStyles, + pictureAttributes, + isBackgroundPicture = false, +}) { + const { + class: customClasses = "", + style: customInlineStyles = "", + ...restPictureAttributes + } = pictureAttributes; + + const attributesString = getAttributesString({ + attributes: restPictureAttributes, + }); + + const classAttribute = ["astro-imagetools-picture", className, customClasses] + .join(" ") + .trim(); + + const styleAttribute = [ + isBackgroundPicture + ? `position: absolute; z-index: 0; width: 100%; height: 100%; display: inline-block;` + : `position: relative; display: inline-block;`, + customInlineStyles + (customInlineStyles.endsWith(";") ? "" : ";"), + layoutStyles, + ] + .join(" ") + .trim(); + + const pictureElement = `${sources.join("\n")} + `; + + return pictureElement; +} diff --git a/packages/imagetools_/api/utils/getProcessedImage.js b/packages/imagetools_/api/utils/getProcessedImage.js new file mode 100644 index 0000000..98eae1d --- /dev/null +++ b/packages/imagetools_/api/utils/getProcessedImage.js @@ -0,0 +1,63 @@ +// @ts-check +import { fileURLToPath } from "node:url"; +import { extname, relative, resolve } from "node:path"; + +import { getSrcPath } from "./getSrcPath.js"; +import getResolvedSrc from "./getResolvedSrc.js"; +import { cwd, sharp } from "../../utils/runtimeChecks.js"; +import throwErrorIfUnsupported from "./throwErrorIfUnsupported.js"; + +const { getImageDetails } = await (sharp + ? import("./imagetools.js") + : import("./codecs.js")); + +export default async function getProcessedImage(src, transformConfigs) { + throwErrorIfUnsupported(src, extname(src).slice(1)); + + let base; + + if (src.match("(http://|https://|data:image/).*")) { + ({ src, base } = await getResolvedSrc(src)); + } else { + const { + default: { isSsrBuild }, + } = await import("../../astroViteConfigs.js"); + + if (isSsrBuild) { + const filename = fileURLToPath(import.meta.url); + + const assetPath = resolve(filename, "../../client") + src; + + src = "/" + relative(cwd, assetPath); + } + } + + const { + w, + h, + ar, + width = w, + height = h, + aspect = ar, + ...rest + } = transformConfigs; + + const path = src.replace(/\\/g, `/`); + + const { image, imageWidth, imageHeight, imageFormat } = await getImageDetails( + await getSrcPath(src), + width, + height, + aspect + ); + + return { + path, + base, + rest, + image, + imageWidth, + imageHeight, + imageFormat, + }; +} diff --git a/packages/imagetools_/api/utils/getResolvedSrc.js b/packages/imagetools_/api/utils/getResolvedSrc.js new file mode 100644 index 0000000..548a59c --- /dev/null +++ b/packages/imagetools_/api/utils/getResolvedSrc.js @@ -0,0 +1,87 @@ +// @ts-check +import fs from "node:fs"; +import crypto from "node:crypto"; +import { join, parse, relative } from "node:path"; +import throwErrorIfUnsupported from "./throwErrorIfUnsupported.js"; +import { + cwd, + fsCachePath, + supportedImageTypes, +} from "../../utils/runtimeChecks.js"; + +const { fileTypeFromBuffer } = await import("file-type"); + +// Retry mechanism with exponential backoff +async function retryWithBackoff(fn, retries = 3, baseDelay = 150) { + for (let i = 0; i < retries; i++) { + try { + return await fn(); + } catch (error) { + if (i === retries - 1) { + throw error; // Last attempt failed + } + + // Check if it's a file system error that we should retry + const isRetryableError = error.code === 'EBUSY' || + error.code === 'ENOENT' || + error.code === 'EPERM' || + error.errno === -4094 || // UNKNOWN error on Windows + error.message.includes('UNKNOWN: unknown error'); + + if (!isRetryableError) { + throw error; // Don't retry non-transient errors + } + + const delay = baseDelay * Math.pow(2, i); // Exponential backoff + console.warn(`Retry attempt ${i + 1}/${retries} for file operation after ${delay}ms delay:`, error.message); + await new Promise(resolve => setTimeout(resolve, delay)); + } + } +} + +export default async function getResolvedSrc(src) { + const token = crypto.createHash("md5").update(src).digest("hex"); + let filepath = fsCachePath + token; + + const fileExists = await retryWithBackoff(() => { + for (const type of supportedImageTypes) { + const fileExists = fs.existsSync(filepath + `.${type}`); + + if (fileExists) { + filepath += `.${type}`; + return true; + } + } + return false; + }); + + if (!fileExists) { + const buffer = Buffer.from(await (await fetch(src)).arrayBuffer()); + + const { ext } = (await fileTypeFromBuffer(buffer)) || {}; + + throwErrorIfUnsupported(src, ext); + + filepath += `.${ext}`; + + // Use retry mechanism for file write operations + await retryWithBackoff(() => { + return new Promise((resolve, reject) => { + try { + fs.writeFileSync(filepath, buffer); + resolve(undefined); + } catch (error) { + reject(error); + } + }); + }); + } + + const base = /^https?:/.test(src) + ? parse(new URL(src).pathname).name + : undefined; + + src = join("/", relative(cwd, filepath)); + + return { src, base }; +} diff --git a/packages/imagetools_/api/utils/getSrcPath.js b/packages/imagetools_/api/utils/getSrcPath.js new file mode 100644 index 0000000..3a7a7da --- /dev/null +++ b/packages/imagetools_/api/utils/getSrcPath.js @@ -0,0 +1,32 @@ +import fs from "node:fs"; +import path from "node:path"; + +// To strip off params when checking for file on disk. +const paramPattern = /\?.*/; + +/** + * getSrcPath allows the use of `src` attributes relative to either the public folder or project root. + * + * It first checks to see if the src is a file relative to the project root. + * If the file isn't found, it will look in the public folder. + * Finally, if it still can't be found, the original input will be returned. + */ +export async function getSrcPath(src) { + const { default: astroViteConfigs } = await import( + "../../astroViteConfigs.js" + ); + + // If this is already resolved to a file, return it. + if (fs.existsSync(src.replace(paramPattern, ""))) return src; + + const rootPath = path.join(astroViteConfigs.rootDir, src); + const rootTest = rootPath.replace(paramPattern, ""); + if (fs.existsSync(rootTest)) return rootPath; + + const publicPath = path.join(astroViteConfigs.publicDir, src); + const publicTest = publicPath.replace(paramPattern, ""); + if (fs.existsSync(publicTest)) return publicPath; + + // Fallback + return src; +} diff --git a/packages/imagetools_/api/utils/getSrcPath.test.ts b/packages/imagetools_/api/utils/getSrcPath.test.ts new file mode 100644 index 0000000..bb267dd --- /dev/null +++ b/packages/imagetools_/api/utils/getSrcPath.test.ts @@ -0,0 +1,67 @@ +import path from "node:path"; +import { describe, expect, it, afterAll, vi } from "vitest"; +import { getSrcPath } from "./getSrcPath"; + +vi.mock("../../astroViteConfigs.js", () => { + return { + default: { + rootDir: buildPath(), + // Custom publicDir + publicDir: buildPath("out"), + }, + }; +}); + +/** + * Build an absolute path to the target in the fixture directory + */ +function buildPath(target = "") { + return path.resolve(__dirname, "../../test-fixtures/getSrcPath", target); +} + +describe("getLinkElement", () => { + afterAll(() => { + vi.unmock("../../astroViteConfigs.js"); + }); + + it("finds a file in the root of the project", async () => { + const result = await getSrcPath("root.jpeg"); + expect(result).toBe(buildPath("root.jpeg")); + }); + + it("finds a file in the public folder", async () => { + const result = await getSrcPath("out.jpeg"); + expect(result).toBe(buildPath("out/out.jpeg")); + }); + + it("returns an absolute path unchanged, if it exists", async () => { + const result = await getSrcPath(buildPath("out/out.jpeg")); + expect(result).toBe(buildPath("out/out.jpeg")); + }); + + it("handles query parameters", async () => { + const result = await getSrcPath("root.jpeg?w=200"); + expect(result).toBe(buildPath("root.jpeg?w=200")); + }); + + it("handles query parameters for public-resolved files", async () => { + const result = await getSrcPath("out.jpeg?w=200"); + expect(result).toBe(buildPath("out/out.jpeg?w=200")); + }); + + it("returns the original input if the file is not found", async () => { + const result = await getSrcPath( + "https://cdn.nedis.com/images/products_high_res/TVRC2080BK_P30.JPG" + ); + expect(result).toBe( + "https://cdn.nedis.com/images/products_high_res/TVRC2080BK_P30.JPG" + ); + }); + + it("finds relative paths correctly", async () => { + const outResult = await getSrcPath("./out/out.jpeg"); + const rootResult = await getSrcPath("./root.jpeg"); + expect(outResult).toBe(buildPath("out/out.jpeg")); + expect(rootResult).toBe(buildPath("root.jpeg")); + }); +}); diff --git a/packages/imagetools_/api/utils/getSrcset.js b/packages/imagetools_/api/utils/getSrcset.js new file mode 100644 index 0000000..ac290a9 --- /dev/null +++ b/packages/imagetools_/api/utils/getSrcset.js @@ -0,0 +1,45 @@ +// @ts-check +import { getSrcPath } from "./getSrcPath.js"; + +export default async function getSrcset( + src, + base, + breakpoints, + format, + options +) { + options = { + format, + w: breakpoints, + ...options, + }; + + const keys = Object.keys(options); + + const params = keys.length + ? keys + .map((key) => + Array.isArray(options[key]) + ? `&${key}=${options[key].join(";")}` + : `&${key}=${options[key]}` + ) + .join("") + : ""; + + const id = `${src}?${params.slice(1)}`; + + const fullPath = await getSrcPath(id); + + const { default: load } = await import("../../plugin/hooks/load.js"); + + let srcset = null + + try { + srcset = (await load(fullPath, base))?.slice(16, -1); + } catch (error) { + console.error(`Error loading image from ${fullPath}:`, error); + srcset = ''; + } + + return srcset; +} diff --git a/packages/imagetools_/api/utils/getStyleElement.js b/packages/imagetools_/api/utils/getStyleElement.js new file mode 100644 index 0000000..30ad4d7 --- /dev/null +++ b/packages/imagetools_/api/utils/getStyleElement.js @@ -0,0 +1,15 @@ +// @ts-check +import getAttributesString from "./getAttributesString.js"; + +export default function getStyleElement({ + styleAttributes, + backgroundStyles = "", +}) { + const attributesString = getAttributesString({ + attributes: styleAttributes, + }); + + const styleElement = ``; + + return styleElement; +} diff --git a/packages/imagetools_/api/utils/imagetools.js b/packages/imagetools_/api/utils/imagetools.js new file mode 100644 index 0000000..530abd1 --- /dev/null +++ b/packages/imagetools_/api/utils/imagetools.js @@ -0,0 +1,40 @@ +// @ts-check +import { + builtins, + loadImage, + applyTransforms, + generateTransforms, +} from "imagetools-core"; +export { + loadImage +} from "imagetools-core"; +export async function getImageDetails(path, width, height, aspect) { + const loadedImage = loadImage(path); + + if (aspect && !width && !height) { + if (!width && !height) { + ({ width } = await loadedImage.metadata()); + } + + if (width) { + height = width / aspect; + } + + if (height) { + width = height * aspect; + } + } + + const { image, metadata } = await applyTransforms( + generateTransforms({ width, height }, builtins).transforms, + loadedImage + ); + + const { + width: imageWidth, + height: imageHeight, + format: imageFormat, + } = metadata; + + return { image, imageWidth, imageHeight, imageFormat }; +} diff --git a/packages/imagetools_/api/utils/throwErrorIfUnsupported.js b/packages/imagetools_/api/utils/throwErrorIfUnsupported.js new file mode 100644 index 0000000..581ca16 --- /dev/null +++ b/packages/imagetools_/api/utils/throwErrorIfUnsupported.js @@ -0,0 +1,14 @@ +// @ts-check +import { supportedImageTypes } from "../../utils/runtimeChecks.js"; + +export default function throwErrorIfUnsupported(src, ext) { + if (!ext && typeof ext !== "string") { + throw new Error(`Failed to load ${src}; Invalid image format`); + } + + if (ext && !supportedImageTypes.includes(ext.toLowerCase())) { + throw new Error( + `Failed to load ${src}; Invalid image format ${ext} or the format is not supported by astro-imagetools` + ); + } +} diff --git a/packages/imagetools_/astroViteConfigs.js b/packages/imagetools_/astroViteConfigs.js new file mode 100644 index 0000000..af59ac4 --- /dev/null +++ b/packages/imagetools_/astroViteConfigs.js @@ -0,0 +1,12 @@ +export default { + "environment": "build", + "isSsrBuild": false, + "projectBase": "", + "publicDir": "C:\\Users\\zx\\Desktop\\polymech\\site-min\\public\\", + "rootDir": "C:\\Users\\zx\\Desktop\\polymech\\site-min\\", + "mode": "production", + "outDir": "C:\\Users\\zx\\Desktop\\polymech\\site-min\\dist\\", + "assetsDir": "_astro", + "sourcemap": false, + "assetFileNames": "/_astro/[name]@[width].[hash][extname]" +} \ No newline at end of file diff --git a/packages/imagetools_/components/BackgroundImage.astro b/packages/imagetools_/components/BackgroundImage.astro new file mode 100644 index 0000000..47d2b44 --- /dev/null +++ b/packages/imagetools_/components/BackgroundImage.astro @@ -0,0 +1,46 @@ +--- +import renderBackgroundImage from "../api/renderBackgroundImage.js"; +import type { BackgroundImageConfigOptions } from "../types.d"; + +const content = await Astro.slots.render("default"); + +declare interface Props + extends Pick< + BackgroundImageConfigOptions, + Exclude + > {} + +const { link, style, htmlElement } = await renderBackgroundImage({ + content, + ...(Astro.props as Props), +}); +--- + + + + diff --git a/packages/imagetools_/components/BackgroundPicture.astro b/packages/imagetools_/components/BackgroundPicture.astro new file mode 100644 index 0000000..a53bab8 --- /dev/null +++ b/packages/imagetools_/components/BackgroundPicture.astro @@ -0,0 +1,19 @@ +--- +import renderBackgroundPicture from "../api/renderBackgroundPicture.js"; +import { BackgroundPictureConfigOptions } from "../types.d"; + +declare interface Props + extends Pick< + BackgroundPictureConfigOptions, + Exclude + > {} + +const content = await Astro.slots.render("default"); + +const { link, style, htmlElement } = await renderBackgroundPicture({ + content, + ...(Astro.props as Props), +}); +--- + + diff --git a/packages/imagetools_/components/Image.astro b/packages/imagetools_/components/Image.astro new file mode 100644 index 0000000..d2d547a --- /dev/null +++ b/packages/imagetools_/components/Image.astro @@ -0,0 +1,10 @@ +--- +import renderImage from "../api/renderImage.js"; +import type { PictureConfigOptions as ImageConfigOptions } from "../types.d"; + +const { link, style, image } = await renderImage( + Astro.props as ImageConfigOptions +); +--- + + diff --git a/packages/imagetools_/components/ImageSupportDetection.astro b/packages/imagetools_/components/ImageSupportDetection.astro new file mode 100644 index 0000000..9e62ae7 --- /dev/null +++ b/packages/imagetools_/components/ImageSupportDetection.astro @@ -0,0 +1,4 @@ + + diff --git a/packages/imagetools_/components/Img.astro b/packages/imagetools_/components/Img.astro new file mode 100644 index 0000000..4f3198d --- /dev/null +++ b/packages/imagetools_/components/Img.astro @@ -0,0 +1,7 @@ +--- +import renderImg from "../api/renderImg.js" +import type { ImgConfigOptions } from "../types.d" +declare interface Props extends ImgConfigOptions {} +const { link, style, img } = await renderImg(Astro.props as Props) +--- + diff --git a/packages/imagetools_/components/Picture.astro b/packages/imagetools_/components/Picture.astro new file mode 100644 index 0000000..737bd77 --- /dev/null +++ b/packages/imagetools_/components/Picture.astro @@ -0,0 +1,10 @@ +--- +import renderPicture from "../api/renderPicture.js"; +import type { PictureConfigOptions } from "../types.d"; + +declare interface Props extends PictureConfigOptions {} + +const { link, style, picture } = await renderPicture(Astro.props as Props); +--- + + diff --git a/packages/imagetools_/components/index.js b/packages/imagetools_/components/index.js new file mode 100644 index 0000000..a6c6389 --- /dev/null +++ b/packages/imagetools_/components/index.js @@ -0,0 +1,5 @@ +export { default as Img } from "./Img.astro"; +export { default as Picture } from "./Picture.astro"; +export { default as BackgroundImage } from "./BackgroundImage.astro"; +export { default as BackgroundPicture } from "./BackgroundPicture.astro"; +export { default as ImageSupportDetection } from "./ImageSupportDetection.astro"; diff --git a/packages/imagetools_/config.d.ts b/packages/imagetools_/config.d.ts new file mode 100644 index 0000000..8569ca9 --- /dev/null +++ b/packages/imagetools_/config.d.ts @@ -0,0 +1,3 @@ +import type { GlobalConfigOptions } from "./types"; + +export function defineConfig(config: GlobalConfigOptions): GlobalConfigOptions; diff --git a/packages/imagetools_/config.mjs b/packages/imagetools_/config.mjs new file mode 100644 index 0000000..64a4c49 --- /dev/null +++ b/packages/imagetools_/config.mjs @@ -0,0 +1,3 @@ +export function defineConfig(config) { + return config; +} diff --git a/packages/imagetools/demo/.npmrc b/packages/imagetools_/demo/.npmrc similarity index 100% rename from packages/imagetools/demo/.npmrc rename to packages/imagetools_/demo/.npmrc diff --git a/packages/imagetools/demo/.stackblitzrc b/packages/imagetools_/demo/.stackblitzrc similarity index 100% rename from packages/imagetools/demo/.stackblitzrc rename to packages/imagetools_/demo/.stackblitzrc diff --git a/packages/imagetools/demo/README.md b/packages/imagetools_/demo/README.md similarity index 100% rename from packages/imagetools/demo/README.md rename to packages/imagetools_/demo/README.md diff --git a/packages/imagetools/demo/astro-imagetools.config.mjs b/packages/imagetools_/demo/astro-imagetools.config.mjs similarity index 100% rename from packages/imagetools/demo/astro-imagetools.config.mjs rename to packages/imagetools_/demo/astro-imagetools.config.mjs diff --git a/packages/imagetools/demo/astro.config.mjs b/packages/imagetools_/demo/astro.config.mjs similarity index 100% rename from packages/imagetools/demo/astro.config.mjs rename to packages/imagetools_/demo/astro.config.mjs diff --git a/packages/imagetools/demo/package.json b/packages/imagetools_/demo/package.json similarity index 100% rename from packages/imagetools/demo/package.json rename to packages/imagetools_/demo/package.json diff --git a/packages/imagetools/demo/public/favicon.ico b/packages/imagetools_/demo/public/favicon.ico similarity index 100% rename from packages/imagetools/demo/public/favicon.ico rename to packages/imagetools_/demo/public/favicon.ico diff --git a/packages/imagetools/demo/public/images/public.jpeg b/packages/imagetools_/demo/public/images/public.jpeg similarity index 100% rename from packages/imagetools/demo/public/images/public.jpeg rename to packages/imagetools_/demo/public/images/public.jpeg diff --git a/packages/imagetools/demo/sandbox.config.json b/packages/imagetools_/demo/sandbox.config.json similarity index 100% rename from packages/imagetools/demo/sandbox.config.json rename to packages/imagetools_/demo/sandbox.config.json diff --git a/packages/imagetools/demo/src/env.d.ts b/packages/imagetools_/demo/src/env.d.ts similarity index 100% rename from packages/imagetools/demo/src/env.d.ts rename to packages/imagetools_/demo/src/env.d.ts diff --git a/packages/imagetools/demo/src/images/elva-480w-close-portrait.jpg b/packages/imagetools_/demo/src/images/elva-480w-close-portrait.jpg similarity index 100% rename from packages/imagetools/demo/src/images/elva-480w-close-portrait.jpg rename to packages/imagetools_/demo/src/images/elva-480w-close-portrait.jpg diff --git a/packages/imagetools/demo/src/images/elva-800w.jpg b/packages/imagetools_/demo/src/images/elva-800w.jpg similarity index 100% rename from packages/imagetools/demo/src/images/elva-800w.jpg rename to packages/imagetools_/demo/src/images/elva-800w.jpg diff --git a/packages/imagetools/demo/src/layouts/LayoutsLayout.astro b/packages/imagetools_/demo/src/layouts/LayoutsLayout.astro similarity index 100% rename from packages/imagetools/demo/src/layouts/LayoutsLayout.astro rename to packages/imagetools_/demo/src/layouts/LayoutsLayout.astro diff --git a/packages/imagetools/demo/src/layouts/MainLayout.astro b/packages/imagetools_/demo/src/layouts/MainLayout.astro similarity index 100% rename from packages/imagetools/demo/src/layouts/MainLayout.astro rename to packages/imagetools_/demo/src/layouts/MainLayout.astro diff --git a/packages/imagetools/demo/src/layouts/PlaceholderLayout.astro b/packages/imagetools_/demo/src/layouts/PlaceholderLayout.astro similarity index 100% rename from packages/imagetools/demo/src/layouts/PlaceholderLayout.astro rename to packages/imagetools_/demo/src/layouts/PlaceholderLayout.astro diff --git a/packages/imagetools/demo/src/pages/api/renderBackgroundImage.astro b/packages/imagetools_/demo/src/pages/api/renderBackgroundImage.astro similarity index 100% rename from packages/imagetools/demo/src/pages/api/renderBackgroundImage.astro rename to packages/imagetools_/demo/src/pages/api/renderBackgroundImage.astro diff --git a/packages/imagetools/demo/src/pages/api/renderBackgroundPicture.astro b/packages/imagetools_/demo/src/pages/api/renderBackgroundPicture.astro similarity index 100% rename from packages/imagetools/demo/src/pages/api/renderBackgroundPicture.astro rename to packages/imagetools_/demo/src/pages/api/renderBackgroundPicture.astro diff --git a/packages/imagetools/demo/src/pages/api/renderImg.astro b/packages/imagetools_/demo/src/pages/api/renderImg.astro similarity index 100% rename from packages/imagetools/demo/src/pages/api/renderImg.astro rename to packages/imagetools_/demo/src/pages/api/renderImg.astro diff --git a/packages/imagetools/demo/src/pages/api/renderPicture.astro b/packages/imagetools_/demo/src/pages/api/renderPicture.astro similarity index 100% rename from packages/imagetools/demo/src/pages/api/renderPicture.astro rename to packages/imagetools_/demo/src/pages/api/renderPicture.astro diff --git a/packages/imagetools/demo/src/pages/components/BackgroundImage.astro b/packages/imagetools_/demo/src/pages/components/BackgroundImage.astro similarity index 100% rename from packages/imagetools/demo/src/pages/components/BackgroundImage.astro rename to packages/imagetools_/demo/src/pages/components/BackgroundImage.astro diff --git a/packages/imagetools/demo/src/pages/components/BackgroundPicture.astro b/packages/imagetools_/demo/src/pages/components/BackgroundPicture.astro similarity index 100% rename from packages/imagetools/demo/src/pages/components/BackgroundPicture.astro rename to packages/imagetools_/demo/src/pages/components/BackgroundPicture.astro diff --git a/packages/imagetools/demo/src/pages/components/Img.astro b/packages/imagetools_/demo/src/pages/components/Img.astro similarity index 100% rename from packages/imagetools/demo/src/pages/components/Img.astro rename to packages/imagetools_/demo/src/pages/components/Img.astro diff --git a/packages/imagetools/demo/src/pages/components/Picture.astro b/packages/imagetools_/demo/src/pages/components/Picture.astro similarity index 100% rename from packages/imagetools/demo/src/pages/components/Picture.astro rename to packages/imagetools_/demo/src/pages/components/Picture.astro diff --git a/packages/imagetools/demo/src/pages/index.md b/packages/imagetools_/demo/src/pages/index.md similarity index 100% rename from packages/imagetools/demo/src/pages/index.md rename to packages/imagetools_/demo/src/pages/index.md diff --git a/packages/imagetools/demo/src/pages/layout/constrained.astro b/packages/imagetools_/demo/src/pages/layout/constrained.astro similarity index 100% rename from packages/imagetools/demo/src/pages/layout/constrained.astro rename to packages/imagetools_/demo/src/pages/layout/constrained.astro diff --git a/packages/imagetools/demo/src/pages/layout/fill.astro b/packages/imagetools_/demo/src/pages/layout/fill.astro similarity index 100% rename from packages/imagetools/demo/src/pages/layout/fill.astro rename to packages/imagetools_/demo/src/pages/layout/fill.astro diff --git a/packages/imagetools/demo/src/pages/layout/fixed.astro b/packages/imagetools_/demo/src/pages/layout/fixed.astro similarity index 100% rename from packages/imagetools/demo/src/pages/layout/fixed.astro rename to packages/imagetools_/demo/src/pages/layout/fixed.astro diff --git a/packages/imagetools/demo/src/pages/layout/fullWidth.astro b/packages/imagetools_/demo/src/pages/layout/fullWidth.astro similarity index 100% rename from packages/imagetools/demo/src/pages/layout/fullWidth.astro rename to packages/imagetools_/demo/src/pages/layout/fullWidth.astro diff --git a/packages/imagetools/demo/src/pages/placeholder/blurred.astro b/packages/imagetools_/demo/src/pages/placeholder/blurred.astro similarity index 100% rename from packages/imagetools/demo/src/pages/placeholder/blurred.astro rename to packages/imagetools_/demo/src/pages/placeholder/blurred.astro diff --git a/packages/imagetools/demo/src/pages/placeholder/dominantColor.astro b/packages/imagetools_/demo/src/pages/placeholder/dominantColor.astro similarity index 100% rename from packages/imagetools/demo/src/pages/placeholder/dominantColor.astro rename to packages/imagetools_/demo/src/pages/placeholder/dominantColor.astro diff --git a/packages/imagetools/demo/src/pages/placeholder/none.astro b/packages/imagetools_/demo/src/pages/placeholder/none.astro similarity index 100% rename from packages/imagetools/demo/src/pages/placeholder/none.astro rename to packages/imagetools_/demo/src/pages/placeholder/none.astro diff --git a/packages/imagetools/demo/src/pages/placeholder/tracedSVG.astro b/packages/imagetools_/demo/src/pages/placeholder/tracedSVG.astro similarity index 100% rename from packages/imagetools/demo/src/pages/placeholder/tracedSVG.astro rename to packages/imagetools_/demo/src/pages/placeholder/tracedSVG.astro diff --git a/packages/imagetools/demo/src/styles/index.css b/packages/imagetools_/demo/src/styles/index.css similarity index 100% rename from packages/imagetools/demo/src/styles/index.css rename to packages/imagetools_/demo/src/styles/index.css diff --git a/packages/imagetools/docs/.npmrc b/packages/imagetools_/docs/.npmrc similarity index 100% rename from packages/imagetools/docs/.npmrc rename to packages/imagetools_/docs/.npmrc diff --git a/packages/imagetools/docs/.stackblitzrc b/packages/imagetools_/docs/.stackblitzrc similarity index 100% rename from packages/imagetools/docs/.stackblitzrc rename to packages/imagetools_/docs/.stackblitzrc diff --git a/packages/imagetools/docs/README.md b/packages/imagetools_/docs/README.md similarity index 100% rename from packages/imagetools/docs/README.md rename to packages/imagetools_/docs/README.md diff --git a/packages/imagetools/docs/astro.config.mjs b/packages/imagetools_/docs/astro.config.mjs similarity index 100% rename from packages/imagetools/docs/astro.config.mjs rename to packages/imagetools_/docs/astro.config.mjs diff --git a/packages/imagetools/docs/auto-imports.d.ts b/packages/imagetools_/docs/auto-imports.d.ts similarity index 100% rename from packages/imagetools/docs/auto-imports.d.ts rename to packages/imagetools_/docs/auto-imports.d.ts diff --git a/packages/imagetools/docs/package.json b/packages/imagetools_/docs/package.json similarity index 100% rename from packages/imagetools/docs/package.json rename to packages/imagetools_/docs/package.json diff --git a/packages/imagetools/docs/public/default-og-image.png b/packages/imagetools_/docs/public/default-og-image.png similarity index 100% rename from packages/imagetools/docs/public/default-og-image.png rename to packages/imagetools_/docs/public/default-og-image.png diff --git a/packages/imagetools/docs/public/favicon.ico b/packages/imagetools_/docs/public/favicon.ico similarity index 100% rename from packages/imagetools/docs/public/favicon.ico rename to packages/imagetools_/docs/public/favicon.ico diff --git a/packages/imagetools/docs/public/make-scrollable-code-focusable.js b/packages/imagetools_/docs/public/make-scrollable-code-focusable.js similarity index 100% rename from packages/imagetools/docs/public/make-scrollable-code-focusable.js rename to packages/imagetools_/docs/public/make-scrollable-code-focusable.js diff --git a/packages/imagetools/docs/sandbox.config.json b/packages/imagetools_/docs/sandbox.config.json similarity index 100% rename from packages/imagetools/docs/sandbox.config.json rename to packages/imagetools_/docs/sandbox.config.json diff --git a/packages/imagetools/docs/src/components/CodeExample.astro b/packages/imagetools_/docs/src/components/CodeExample.astro similarity index 100% rename from packages/imagetools/docs/src/components/CodeExample.astro rename to packages/imagetools_/docs/src/components/CodeExample.astro diff --git a/packages/imagetools/docs/src/components/ConfigOptions.astro b/packages/imagetools_/docs/src/components/ConfigOptions.astro similarity index 100% rename from packages/imagetools/docs/src/components/ConfigOptions.astro rename to packages/imagetools_/docs/src/components/ConfigOptions.astro diff --git a/packages/imagetools/docs/src/components/ConfigOptions/alt.astro b/packages/imagetools_/docs/src/components/ConfigOptions/alt.astro similarity index 100% rename from packages/imagetools/docs/src/components/ConfigOptions/alt.astro rename to packages/imagetools_/docs/src/components/ConfigOptions/alt.astro diff --git a/packages/imagetools/docs/src/components/ConfigOptions/artDirectives.astro b/packages/imagetools_/docs/src/components/ConfigOptions/artDirectives.astro similarity index 100% rename from packages/imagetools/docs/src/components/ConfigOptions/artDirectives.astro rename to packages/imagetools_/docs/src/components/ConfigOptions/artDirectives.astro diff --git a/packages/imagetools/docs/src/components/ConfigOptions/aspect.astro b/packages/imagetools_/docs/src/components/ConfigOptions/aspect.astro similarity index 100% rename from packages/imagetools/docs/src/components/ConfigOptions/aspect.astro rename to packages/imagetools_/docs/src/components/ConfigOptions/aspect.astro diff --git a/packages/imagetools/docs/src/components/ConfigOptions/assetFileNames.astro b/packages/imagetools_/docs/src/components/ConfigOptions/assetFileNames.astro similarity index 100% rename from packages/imagetools/docs/src/components/ConfigOptions/assetFileNames.astro rename to packages/imagetools_/docs/src/components/ConfigOptions/assetFileNames.astro diff --git a/packages/imagetools/docs/src/components/ConfigOptions/attributes.astro b/packages/imagetools_/docs/src/components/ConfigOptions/attributes.astro similarity index 100% rename from packages/imagetools/docs/src/components/ConfigOptions/attributes.astro rename to packages/imagetools_/docs/src/components/ConfigOptions/attributes.astro diff --git a/packages/imagetools/docs/src/components/ConfigOptions/background.astro b/packages/imagetools_/docs/src/components/ConfigOptions/background.astro similarity index 100% rename from packages/imagetools/docs/src/components/ConfigOptions/background.astro rename to packages/imagetools_/docs/src/components/ConfigOptions/background.astro diff --git a/packages/imagetools/docs/src/components/ConfigOptions/backgroundPosition.astro b/packages/imagetools_/docs/src/components/ConfigOptions/backgroundPosition.astro similarity index 100% rename from packages/imagetools/docs/src/components/ConfigOptions/backgroundPosition.astro rename to packages/imagetools_/docs/src/components/ConfigOptions/backgroundPosition.astro diff --git a/packages/imagetools/docs/src/components/ConfigOptions/backgroundSize.astro b/packages/imagetools_/docs/src/components/ConfigOptions/backgroundSize.astro similarity index 100% rename from packages/imagetools/docs/src/components/ConfigOptions/backgroundSize.astro rename to packages/imagetools_/docs/src/components/ConfigOptions/backgroundSize.astro diff --git a/packages/imagetools/docs/src/components/ConfigOptions/blur.astro b/packages/imagetools_/docs/src/components/ConfigOptions/blur.astro similarity index 100% rename from packages/imagetools/docs/src/components/ConfigOptions/blur.astro rename to packages/imagetools_/docs/src/components/ConfigOptions/blur.astro diff --git a/packages/imagetools/docs/src/components/ConfigOptions/breakpoints.astro b/packages/imagetools_/docs/src/components/ConfigOptions/breakpoints.astro similarity index 100% rename from packages/imagetools/docs/src/components/ConfigOptions/breakpoints.astro rename to packages/imagetools_/docs/src/components/ConfigOptions/breakpoints.astro diff --git a/packages/imagetools/docs/src/components/ConfigOptions/brightness.astro b/packages/imagetools_/docs/src/components/ConfigOptions/brightness.astro similarity index 100% rename from packages/imagetools/docs/src/components/ConfigOptions/brightness.astro rename to packages/imagetools_/docs/src/components/ConfigOptions/brightness.astro diff --git a/packages/imagetools/docs/src/components/ConfigOptions/cacheDir.astro b/packages/imagetools_/docs/src/components/ConfigOptions/cacheDir.astro similarity index 100% rename from packages/imagetools/docs/src/components/ConfigOptions/cacheDir.astro rename to packages/imagetools_/docs/src/components/ConfigOptions/cacheDir.astro diff --git a/packages/imagetools/docs/src/components/ConfigOptions/content.astro b/packages/imagetools_/docs/src/components/ConfigOptions/content.astro similarity index 100% rename from packages/imagetools/docs/src/components/ConfigOptions/content.astro rename to packages/imagetools_/docs/src/components/ConfigOptions/content.astro diff --git a/packages/imagetools/docs/src/components/ConfigOptions/decoding.astro b/packages/imagetools_/docs/src/components/ConfigOptions/decoding.astro similarity index 100% rename from packages/imagetools/docs/src/components/ConfigOptions/decoding.astro rename to packages/imagetools_/docs/src/components/ConfigOptions/decoding.astro diff --git a/packages/imagetools/docs/src/components/ConfigOptions/fadeInTransition.astro b/packages/imagetools_/docs/src/components/ConfigOptions/fadeInTransition.astro similarity index 100% rename from packages/imagetools/docs/src/components/ConfigOptions/fadeInTransition.astro rename to packages/imagetools_/docs/src/components/ConfigOptions/fadeInTransition.astro diff --git a/packages/imagetools/docs/src/components/ConfigOptions/fallbackFormat.astro b/packages/imagetools_/docs/src/components/ConfigOptions/fallbackFormat.astro similarity index 100% rename from packages/imagetools/docs/src/components/ConfigOptions/fallbackFormat.astro rename to packages/imagetools_/docs/src/components/ConfigOptions/fallbackFormat.astro diff --git a/packages/imagetools/docs/src/components/ConfigOptions/fit.astro b/packages/imagetools_/docs/src/components/ConfigOptions/fit.astro similarity index 100% rename from packages/imagetools/docs/src/components/ConfigOptions/fit.astro rename to packages/imagetools_/docs/src/components/ConfigOptions/fit.astro diff --git a/packages/imagetools/docs/src/components/ConfigOptions/flatten.astro b/packages/imagetools_/docs/src/components/ConfigOptions/flatten.astro similarity index 100% rename from packages/imagetools/docs/src/components/ConfigOptions/flatten.astro rename to packages/imagetools_/docs/src/components/ConfigOptions/flatten.astro diff --git a/packages/imagetools/docs/src/components/ConfigOptions/flip.astro b/packages/imagetools_/docs/src/components/ConfigOptions/flip.astro similarity index 100% rename from packages/imagetools/docs/src/components/ConfigOptions/flip.astro rename to packages/imagetools_/docs/src/components/ConfigOptions/flip.astro diff --git a/packages/imagetools/docs/src/components/ConfigOptions/flop.astro b/packages/imagetools_/docs/src/components/ConfigOptions/flop.astro similarity index 100% rename from packages/imagetools/docs/src/components/ConfigOptions/flop.astro rename to packages/imagetools_/docs/src/components/ConfigOptions/flop.astro diff --git a/packages/imagetools/docs/src/components/ConfigOptions/format.astro b/packages/imagetools_/docs/src/components/ConfigOptions/format.astro similarity index 100% rename from packages/imagetools/docs/src/components/ConfigOptions/format.astro rename to packages/imagetools_/docs/src/components/ConfigOptions/format.astro diff --git a/packages/imagetools/docs/src/components/ConfigOptions/formatOptions.astro b/packages/imagetools_/docs/src/components/ConfigOptions/formatOptions.astro similarity index 100% rename from packages/imagetools/docs/src/components/ConfigOptions/formatOptions.astro rename to packages/imagetools_/docs/src/components/ConfigOptions/formatOptions.astro diff --git a/packages/imagetools/docs/src/components/ConfigOptions/grayscale.astro b/packages/imagetools_/docs/src/components/ConfigOptions/grayscale.astro similarity index 100% rename from packages/imagetools/docs/src/components/ConfigOptions/grayscale.astro rename to packages/imagetools_/docs/src/components/ConfigOptions/grayscale.astro diff --git a/packages/imagetools/docs/src/components/ConfigOptions/height.astro b/packages/imagetools_/docs/src/components/ConfigOptions/height.astro similarity index 100% rename from packages/imagetools/docs/src/components/ConfigOptions/height.astro rename to packages/imagetools_/docs/src/components/ConfigOptions/height.astro diff --git a/packages/imagetools/docs/src/components/ConfigOptions/hue.astro b/packages/imagetools_/docs/src/components/ConfigOptions/hue.astro similarity index 100% rename from packages/imagetools/docs/src/components/ConfigOptions/hue.astro rename to packages/imagetools_/docs/src/components/ConfigOptions/hue.astro diff --git a/packages/imagetools/docs/src/components/ConfigOptions/includeSourceFormat.astro b/packages/imagetools_/docs/src/components/ConfigOptions/includeSourceFormat.astro similarity index 100% rename from packages/imagetools/docs/src/components/ConfigOptions/includeSourceFormat.astro rename to packages/imagetools_/docs/src/components/ConfigOptions/includeSourceFormat.astro diff --git a/packages/imagetools/docs/src/components/ConfigOptions/invert.astro b/packages/imagetools_/docs/src/components/ConfigOptions/invert.astro similarity index 100% rename from packages/imagetools/docs/src/components/ConfigOptions/invert.astro rename to packages/imagetools_/docs/src/components/ConfigOptions/invert.astro diff --git a/packages/imagetools/docs/src/components/ConfigOptions/kernel.astro b/packages/imagetools_/docs/src/components/ConfigOptions/kernel.astro similarity index 100% rename from packages/imagetools/docs/src/components/ConfigOptions/kernel.astro rename to packages/imagetools_/docs/src/components/ConfigOptions/kernel.astro diff --git a/packages/imagetools/docs/src/components/ConfigOptions/layout.astro b/packages/imagetools_/docs/src/components/ConfigOptions/layout.astro similarity index 100% rename from packages/imagetools/docs/src/components/ConfigOptions/layout.astro rename to packages/imagetools_/docs/src/components/ConfigOptions/layout.astro diff --git a/packages/imagetools/docs/src/components/ConfigOptions/loading.astro b/packages/imagetools_/docs/src/components/ConfigOptions/loading.astro similarity index 100% rename from packages/imagetools/docs/src/components/ConfigOptions/loading.astro rename to packages/imagetools_/docs/src/components/ConfigOptions/loading.astro diff --git a/packages/imagetools/docs/src/components/ConfigOptions/median.astro b/packages/imagetools_/docs/src/components/ConfigOptions/median.astro similarity index 100% rename from packages/imagetools/docs/src/components/ConfigOptions/median.astro rename to packages/imagetools_/docs/src/components/ConfigOptions/median.astro diff --git a/packages/imagetools/docs/src/components/ConfigOptions/normalize.astro b/packages/imagetools_/docs/src/components/ConfigOptions/normalize.astro similarity index 100% rename from packages/imagetools/docs/src/components/ConfigOptions/normalize.astro rename to packages/imagetools_/docs/src/components/ConfigOptions/normalize.astro diff --git a/packages/imagetools/docs/src/components/ConfigOptions/objectFit.astro b/packages/imagetools_/docs/src/components/ConfigOptions/objectFit.astro similarity index 100% rename from packages/imagetools/docs/src/components/ConfigOptions/objectFit.astro rename to packages/imagetools_/docs/src/components/ConfigOptions/objectFit.astro diff --git a/packages/imagetools/docs/src/components/ConfigOptions/objectPosition.astro b/packages/imagetools_/docs/src/components/ConfigOptions/objectPosition.astro similarity index 100% rename from packages/imagetools/docs/src/components/ConfigOptions/objectPosition.astro rename to packages/imagetools_/docs/src/components/ConfigOptions/objectPosition.astro diff --git a/packages/imagetools/docs/src/components/ConfigOptions/placeholder.astro b/packages/imagetools_/docs/src/components/ConfigOptions/placeholder.astro similarity index 100% rename from packages/imagetools/docs/src/components/ConfigOptions/placeholder.astro rename to packages/imagetools_/docs/src/components/ConfigOptions/placeholder.astro diff --git a/packages/imagetools/docs/src/components/ConfigOptions/position.astro b/packages/imagetools_/docs/src/components/ConfigOptions/position.astro similarity index 100% rename from packages/imagetools/docs/src/components/ConfigOptions/position.astro rename to packages/imagetools_/docs/src/components/ConfigOptions/position.astro diff --git a/packages/imagetools/docs/src/components/ConfigOptions/preload.astro b/packages/imagetools_/docs/src/components/ConfigOptions/preload.astro similarity index 100% rename from packages/imagetools/docs/src/components/ConfigOptions/preload.astro rename to packages/imagetools_/docs/src/components/ConfigOptions/preload.astro diff --git a/packages/imagetools/docs/src/components/ConfigOptions/quality.astro b/packages/imagetools_/docs/src/components/ConfigOptions/quality.astro similarity index 100% rename from packages/imagetools/docs/src/components/ConfigOptions/quality.astro rename to packages/imagetools_/docs/src/components/ConfigOptions/quality.astro diff --git a/packages/imagetools/docs/src/components/ConfigOptions/rotate.astro b/packages/imagetools_/docs/src/components/ConfigOptions/rotate.astro similarity index 100% rename from packages/imagetools/docs/src/components/ConfigOptions/rotate.astro rename to packages/imagetools_/docs/src/components/ConfigOptions/rotate.astro diff --git a/packages/imagetools/docs/src/components/ConfigOptions/saturation.astro b/packages/imagetools_/docs/src/components/ConfigOptions/saturation.astro similarity index 100% rename from packages/imagetools/docs/src/components/ConfigOptions/saturation.astro rename to packages/imagetools_/docs/src/components/ConfigOptions/saturation.astro diff --git a/packages/imagetools/docs/src/components/ConfigOptions/sizes.astro b/packages/imagetools_/docs/src/components/ConfigOptions/sizes.astro similarity index 100% rename from packages/imagetools/docs/src/components/ConfigOptions/sizes.astro rename to packages/imagetools_/docs/src/components/ConfigOptions/sizes.astro diff --git a/packages/imagetools/docs/src/components/ConfigOptions/src.astro b/packages/imagetools_/docs/src/components/ConfigOptions/src.astro similarity index 100% rename from packages/imagetools/docs/src/components/ConfigOptions/src.astro rename to packages/imagetools_/docs/src/components/ConfigOptions/src.astro diff --git a/packages/imagetools/docs/src/components/ConfigOptions/tag.astro b/packages/imagetools_/docs/src/components/ConfigOptions/tag.astro similarity index 100% rename from packages/imagetools/docs/src/components/ConfigOptions/tag.astro rename to packages/imagetools_/docs/src/components/ConfigOptions/tag.astro diff --git a/packages/imagetools/docs/src/components/ConfigOptions/tint.astro b/packages/imagetools_/docs/src/components/ConfigOptions/tint.astro similarity index 100% rename from packages/imagetools/docs/src/components/ConfigOptions/tint.astro rename to packages/imagetools_/docs/src/components/ConfigOptions/tint.astro diff --git a/packages/imagetools/docs/src/components/ConfigOptions/width.astro b/packages/imagetools_/docs/src/components/ConfigOptions/width.astro similarity index 100% rename from packages/imagetools/docs/src/components/ConfigOptions/width.astro rename to packages/imagetools_/docs/src/components/ConfigOptions/width.astro diff --git a/packages/imagetools/docs/src/components/Footer/AvatarList.astro b/packages/imagetools_/docs/src/components/Footer/AvatarList.astro similarity index 100% rename from packages/imagetools/docs/src/components/Footer/AvatarList.astro rename to packages/imagetools_/docs/src/components/Footer/AvatarList.astro diff --git a/packages/imagetools/docs/src/components/Footer/Footer.astro b/packages/imagetools_/docs/src/components/Footer/Footer.astro similarity index 100% rename from packages/imagetools/docs/src/components/Footer/Footer.astro rename to packages/imagetools_/docs/src/components/Footer/Footer.astro diff --git a/packages/imagetools/docs/src/components/HeadCommon.astro b/packages/imagetools_/docs/src/components/HeadCommon.astro similarity index 100% rename from packages/imagetools/docs/src/components/HeadCommon.astro rename to packages/imagetools_/docs/src/components/HeadCommon.astro diff --git a/packages/imagetools/docs/src/components/HeadSEO.astro b/packages/imagetools_/docs/src/components/HeadSEO.astro similarity index 100% rename from packages/imagetools/docs/src/components/HeadSEO.astro rename to packages/imagetools_/docs/src/components/HeadSEO.astro diff --git a/packages/imagetools/docs/src/components/Header/AstroLogo.astro b/packages/imagetools_/docs/src/components/Header/AstroLogo.astro similarity index 100% rename from packages/imagetools/docs/src/components/Header/AstroLogo.astro rename to packages/imagetools_/docs/src/components/Header/AstroLogo.astro diff --git a/packages/imagetools/docs/src/components/Header/Header.astro b/packages/imagetools_/docs/src/components/Header/Header.astro similarity index 100% rename from packages/imagetools/docs/src/components/Header/Header.astro rename to packages/imagetools_/docs/src/components/Header/Header.astro diff --git a/packages/imagetools/docs/src/components/Header/LanguageSelect.css b/packages/imagetools_/docs/src/components/Header/LanguageSelect.css similarity index 100% rename from packages/imagetools/docs/src/components/Header/LanguageSelect.css rename to packages/imagetools_/docs/src/components/Header/LanguageSelect.css diff --git a/packages/imagetools/docs/src/components/Header/LanguageSelect.tsx b/packages/imagetools_/docs/src/components/Header/LanguageSelect.tsx similarity index 100% rename from packages/imagetools/docs/src/components/Header/LanguageSelect.tsx rename to packages/imagetools_/docs/src/components/Header/LanguageSelect.tsx diff --git a/packages/imagetools/docs/src/components/Header/Search.css b/packages/imagetools_/docs/src/components/Header/Search.css similarity index 100% rename from packages/imagetools/docs/src/components/Header/Search.css rename to packages/imagetools_/docs/src/components/Header/Search.css diff --git a/packages/imagetools/docs/src/components/Header/Search.tsx b/packages/imagetools_/docs/src/components/Header/Search.tsx similarity index 100% rename from packages/imagetools/docs/src/components/Header/Search.tsx rename to packages/imagetools_/docs/src/components/Header/Search.tsx diff --git a/packages/imagetools/docs/src/components/Header/SidebarToggle.tsx b/packages/imagetools_/docs/src/components/Header/SidebarToggle.tsx similarity index 100% rename from packages/imagetools/docs/src/components/Header/SidebarToggle.tsx rename to packages/imagetools_/docs/src/components/Header/SidebarToggle.tsx diff --git a/packages/imagetools/docs/src/components/Header/SkipToContent.astro b/packages/imagetools_/docs/src/components/Header/SkipToContent.astro similarity index 100% rename from packages/imagetools/docs/src/components/Header/SkipToContent.astro rename to packages/imagetools_/docs/src/components/Header/SkipToContent.astro diff --git a/packages/imagetools/docs/src/components/LeftSidebar/LeftSidebar.astro b/packages/imagetools_/docs/src/components/LeftSidebar/LeftSidebar.astro similarity index 100% rename from packages/imagetools/docs/src/components/LeftSidebar/LeftSidebar.astro rename to packages/imagetools_/docs/src/components/LeftSidebar/LeftSidebar.astro diff --git a/packages/imagetools/docs/src/components/PageContent/PageContent.astro b/packages/imagetools_/docs/src/components/PageContent/PageContent.astro similarity index 100% rename from packages/imagetools/docs/src/components/PageContent/PageContent.astro rename to packages/imagetools_/docs/src/components/PageContent/PageContent.astro diff --git a/packages/imagetools/docs/src/components/RightSidebar/MoreMenu.astro b/packages/imagetools_/docs/src/components/RightSidebar/MoreMenu.astro similarity index 100% rename from packages/imagetools/docs/src/components/RightSidebar/MoreMenu.astro rename to packages/imagetools_/docs/src/components/RightSidebar/MoreMenu.astro diff --git a/packages/imagetools/docs/src/components/RightSidebar/RightSidebar.astro b/packages/imagetools_/docs/src/components/RightSidebar/RightSidebar.astro similarity index 100% rename from packages/imagetools/docs/src/components/RightSidebar/RightSidebar.astro rename to packages/imagetools_/docs/src/components/RightSidebar/RightSidebar.astro diff --git a/packages/imagetools/docs/src/components/RightSidebar/TableOfContents.tsx b/packages/imagetools_/docs/src/components/RightSidebar/TableOfContents.tsx similarity index 100% rename from packages/imagetools/docs/src/components/RightSidebar/TableOfContents.tsx rename to packages/imagetools_/docs/src/components/RightSidebar/TableOfContents.tsx diff --git a/packages/imagetools/docs/src/components/RightSidebar/ThemeToggleButton.css b/packages/imagetools_/docs/src/components/RightSidebar/ThemeToggleButton.css similarity index 100% rename from packages/imagetools/docs/src/components/RightSidebar/ThemeToggleButton.css rename to packages/imagetools_/docs/src/components/RightSidebar/ThemeToggleButton.css diff --git a/packages/imagetools/docs/src/components/RightSidebar/ThemeToggleButton.tsx b/packages/imagetools_/docs/src/components/RightSidebar/ThemeToggleButton.tsx similarity index 100% rename from packages/imagetools/docs/src/components/RightSidebar/ThemeToggleButton.tsx rename to packages/imagetools_/docs/src/components/RightSidebar/ThemeToggleButton.tsx diff --git a/packages/imagetools/docs/src/config.ts b/packages/imagetools_/docs/src/config.ts similarity index 100% rename from packages/imagetools/docs/src/config.ts rename to packages/imagetools_/docs/src/config.ts diff --git a/packages/imagetools/docs/src/languages.ts b/packages/imagetools_/docs/src/languages.ts similarity index 100% rename from packages/imagetools/docs/src/languages.ts rename to packages/imagetools_/docs/src/languages.ts diff --git a/packages/imagetools/docs/src/layouts/MainLayout.astro b/packages/imagetools_/docs/src/layouts/MainLayout.astro similarity index 100% rename from packages/imagetools/docs/src/layouts/MainLayout.astro rename to packages/imagetools_/docs/src/layouts/MainLayout.astro diff --git a/packages/imagetools/docs/src/pages/en/acknowledgements.md b/packages/imagetools_/docs/src/pages/en/acknowledgements.md similarity index 100% rename from packages/imagetools/docs/src/pages/en/acknowledgements.md rename to packages/imagetools_/docs/src/pages/en/acknowledgements.md diff --git a/packages/imagetools/docs/src/pages/en/api/importImage.mdx b/packages/imagetools_/docs/src/pages/en/api/importImage.mdx similarity index 100% rename from packages/imagetools/docs/src/pages/en/api/importImage.mdx rename to packages/imagetools_/docs/src/pages/en/api/importImage.mdx diff --git a/packages/imagetools/docs/src/pages/en/api/renderBackgroundImage.mdx b/packages/imagetools_/docs/src/pages/en/api/renderBackgroundImage.mdx similarity index 100% rename from packages/imagetools/docs/src/pages/en/api/renderBackgroundImage.mdx rename to packages/imagetools_/docs/src/pages/en/api/renderBackgroundImage.mdx diff --git a/packages/imagetools/docs/src/pages/en/api/renderBackgroundPicture.mdx b/packages/imagetools_/docs/src/pages/en/api/renderBackgroundPicture.mdx similarity index 100% rename from packages/imagetools/docs/src/pages/en/api/renderBackgroundPicture.mdx rename to packages/imagetools_/docs/src/pages/en/api/renderBackgroundPicture.mdx diff --git a/packages/imagetools/docs/src/pages/en/api/renderImg.mdx b/packages/imagetools_/docs/src/pages/en/api/renderImg.mdx similarity index 100% rename from packages/imagetools/docs/src/pages/en/api/renderImg.mdx rename to packages/imagetools_/docs/src/pages/en/api/renderImg.mdx diff --git a/packages/imagetools/docs/src/pages/en/api/renderPicture.mdx b/packages/imagetools_/docs/src/pages/en/api/renderPicture.mdx similarity index 100% rename from packages/imagetools/docs/src/pages/en/api/renderPicture.mdx rename to packages/imagetools_/docs/src/pages/en/api/renderPicture.mdx diff --git a/packages/imagetools/docs/src/pages/en/components-and-apis.mdx b/packages/imagetools_/docs/src/pages/en/components-and-apis.mdx similarity index 100% rename from packages/imagetools/docs/src/pages/en/components-and-apis.mdx rename to packages/imagetools_/docs/src/pages/en/components-and-apis.mdx diff --git a/packages/imagetools/docs/src/pages/en/components/BackgroundImage.mdx b/packages/imagetools_/docs/src/pages/en/components/BackgroundImage.mdx similarity index 100% rename from packages/imagetools/docs/src/pages/en/components/BackgroundImage.mdx rename to packages/imagetools_/docs/src/pages/en/components/BackgroundImage.mdx diff --git a/packages/imagetools/docs/src/pages/en/components/BackgroundPicture.mdx b/packages/imagetools_/docs/src/pages/en/components/BackgroundPicture.mdx similarity index 100% rename from packages/imagetools/docs/src/pages/en/components/BackgroundPicture.mdx rename to packages/imagetools_/docs/src/pages/en/components/BackgroundPicture.mdx diff --git a/packages/imagetools/docs/src/pages/en/components/Img.mdx b/packages/imagetools_/docs/src/pages/en/components/Img.mdx similarity index 100% rename from packages/imagetools/docs/src/pages/en/components/Img.mdx rename to packages/imagetools_/docs/src/pages/en/components/Img.mdx diff --git a/packages/imagetools/docs/src/pages/en/components/Picture.mdx b/packages/imagetools_/docs/src/pages/en/components/Picture.mdx similarity index 100% rename from packages/imagetools/docs/src/pages/en/components/Picture.mdx rename to packages/imagetools_/docs/src/pages/en/components/Picture.mdx diff --git a/packages/imagetools/docs/src/pages/en/deprecations.mdx b/packages/imagetools_/docs/src/pages/en/deprecations.mdx similarity index 100% rename from packages/imagetools/docs/src/pages/en/deprecations.mdx rename to packages/imagetools_/docs/src/pages/en/deprecations.mdx diff --git a/packages/imagetools/docs/src/pages/en/global-config-options.mdx b/packages/imagetools_/docs/src/pages/en/global-config-options.mdx similarity index 100% rename from packages/imagetools/docs/src/pages/en/global-config-options.mdx rename to packages/imagetools_/docs/src/pages/en/global-config-options.mdx diff --git a/packages/imagetools/docs/src/pages/en/installation.mdx b/packages/imagetools_/docs/src/pages/en/installation.mdx similarity index 100% rename from packages/imagetools/docs/src/pages/en/installation.mdx rename to packages/imagetools_/docs/src/pages/en/installation.mdx diff --git a/packages/imagetools/docs/src/pages/en/introduction.mdx b/packages/imagetools_/docs/src/pages/en/introduction.mdx similarity index 100% rename from packages/imagetools/docs/src/pages/en/introduction.mdx rename to packages/imagetools_/docs/src/pages/en/introduction.mdx diff --git a/packages/imagetools/docs/src/pages/en/markdown-images.mdx b/packages/imagetools_/docs/src/pages/en/markdown-images.mdx similarity index 100% rename from packages/imagetools/docs/src/pages/en/markdown-images.mdx rename to packages/imagetools_/docs/src/pages/en/markdown-images.mdx diff --git a/packages/imagetools/docs/src/pages/en/ssr.mdx b/packages/imagetools_/docs/src/pages/en/ssr.mdx similarity index 100% rename from packages/imagetools/docs/src/pages/en/ssr.mdx rename to packages/imagetools_/docs/src/pages/en/ssr.mdx diff --git a/packages/imagetools/docs/src/pages/en/usage.mdx b/packages/imagetools_/docs/src/pages/en/usage.mdx similarity index 100% rename from packages/imagetools/docs/src/pages/en/usage.mdx rename to packages/imagetools_/docs/src/pages/en/usage.mdx diff --git a/packages/imagetools/docs/src/pages/index.astro b/packages/imagetools_/docs/src/pages/index.astro similarity index 100% rename from packages/imagetools/docs/src/pages/index.astro rename to packages/imagetools_/docs/src/pages/index.astro diff --git a/packages/imagetools/docs/src/styles/index.css b/packages/imagetools_/docs/src/styles/index.css similarity index 100% rename from packages/imagetools/docs/src/styles/index.css rename to packages/imagetools_/docs/src/styles/index.css diff --git a/packages/imagetools/docs/src/styles/theme.css b/packages/imagetools_/docs/src/styles/theme.css similarity index 100% rename from packages/imagetools/docs/src/styles/theme.css rename to packages/imagetools_/docs/src/styles/theme.css diff --git a/packages/imagetools/docs/tsconfig.json b/packages/imagetools_/docs/tsconfig.json similarity index 100% rename from packages/imagetools/docs/tsconfig.json rename to packages/imagetools_/docs/tsconfig.json diff --git a/packages/imagetools_/index.js b/packages/imagetools_/index.js new file mode 100644 index 0000000..b5e1b78 --- /dev/null +++ b/packages/imagetools_/index.js @@ -0,0 +1,3 @@ +import astroImageTools from "./integration/index.js"; + +export { astroImageTools as imagetools } diff --git a/packages/imagetools_/integration/index.js b/packages/imagetools_/integration/index.js new file mode 100644 index 0000000..1fbe997 --- /dev/null +++ b/packages/imagetools_/integration/index.js @@ -0,0 +1,120 @@ +// @ts-check +import fs from "node:fs" +import { fileURLToPath } from "node:url" +import { posix as path, resolve } from "node:path" +import { saveAndCopyAsset } from "./utils/saveAndCopyAsset.js" +import vitePluginAstroImageTools, { store } from "../plugin/index.js" +import pMap from "p-map" + +const filename = fileURLToPath(import.meta.url); +const astroViteConfigsPath = resolve(filename, "../../astroViteConfigs.js"); + +export default { + name: "imagetools", + hooks: { + "astro:config:setup": async function ({ config, command, updateConfig }) { + const environment = command; + const isSsrBuild = + command === "build" && !!config.adapter && config.output === "server"; + + let projectBase = path.normalize(config.base); + if (projectBase.startsWith("./")) projectBase = projectBase.slice(1); + if (!projectBase.startsWith("/")) projectBase = "/" + projectBase; + if (projectBase.endsWith("/")) projectBase = projectBase.slice(0, -1); + + + const astroViteConfigs = { + environment, + isSsrBuild, + projectBase, + publicDir: fileURLToPath(config.publicDir.href), + rootDir: fileURLToPath(config.root.href), + }; + + await fs.promises.writeFile( + astroViteConfigsPath, + `export default ${JSON.stringify(astroViteConfigs)}` + ); + + updateConfig({ + vite: { + plugins: [vitePluginAstroImageTools], + }, + }); + }, + + "astro:build:done": async function closeBundle() { + const { default: astroViteConfigs } = await import( + "../astroViteConfigs.js" + ); + const { mode, outDir, assetsDir, isSsrBuild } = astroViteConfigs; + console.log(`[imagetools] mode: ${mode}`); + debugger; + if (mode === "production") { + const allEntries = [...store.entries()]; + const assetPaths = allEntries.filter( + ([, { hash = null } = {}]) => hash + ); + await pMap( + assetPaths, + async ([assetPath, { hash, image, buffer }]) => { + console.log(`[imagetools] Saving and copying asset ${assetPath}`); + // Retry mechanism with exponential backoff for image processing + /* + const retryWithBackoff = async (fn, retries = 3, baseDelay = 10) => { + for (let i = 0; i < retries; i++) { + try { + return await fn(); + } catch (error) { + if (i === retries - 1) { + throw error; // Last attempt failed + } + + // Check if it's a vips/sharp related error that we should retry + const isRetryableError = error.message.includes('vips') || + error.message.includes('sharp') || + error.message.includes('UNKNOWN: unknown error') || + error.code === 'EBUSY' || + error.code === 'ENOENT' || + error.errno === -4094; + + if (!isRetryableError) { + throw error; // Don't retry non-transient errors + } + + const delay = baseDelay * Math.pow(2, i); // Exponential backoff + console.warn(`Retry attempt ${i + 1}/${retries} for image ${assetPath} after ${delay}ms delay:`, error.message); + await new Promise(resolve => setTimeout(resolve, delay)); + } + } + }; + */ + + try { + // await retryWithBackoff(async () => { + console.log(`[imagetools] Saving and copying asset ${assetPath}`); + await saveAndCopyAsset( + hash, + image, + buffer, + outDir, + assetsDir, + assetPath, + isSsrBuild + ); + + console.log(`[imagetools] Saved and copied asset ${assetPath}`); + + // }); + } catch (error) { + console.error(`Failed to process image ${assetPath} after retries:`, error); + // Continue processing other images even if one fails + } + }, + // higher concurrency causes sharp/vips errors as well + { concurrency: 1 } + ); + } + }, + }, +}; diff --git a/packages/imagetools_/integration/utils/saveAndCopyAsset.js b/packages/imagetools_/integration/utils/saveAndCopyAsset.js new file mode 100644 index 0000000..f075377 --- /dev/null +++ b/packages/imagetools_/integration/utils/saveAndCopyAsset.js @@ -0,0 +1,46 @@ +import fs from "node:fs/promises"; +import { posix as path } from "node:path"; +import { fsCachePath } from "../../utils/runtimeChecks.js"; + +const copied = []; +let assetsDirExists; + +export async function saveAndCopyAsset( + hash, + image, + buffer, + outDir, + assetsDir, + assetPath, + isSsrBuild +) { + const src = fsCachePath + hash; + + const dest = path.join(outDir, isSsrBuild ? "/client" : "", assetPath); + + assetsDir = path.join(outDir, isSsrBuild ? "/client" : "/", assetsDir); + + if (copied.includes(assetPath)) return; + + if (!assetsDirExists) { + await fs.mkdir(assetsDir, { + recursive: true, + }); + + assetsDirExists = true; + } + + await fs.copyFile(src, dest).catch(async (error) => { + if (error.code === "ENOENT") { + const imageBuffer = buffer || (await image.toBuffer()); + + await Promise.all( + [src, dest].map(async (dir) => { + await fs.writeFile(dir, imageBuffer); + }) + ); + } else throw error; + }); + + copied.push(assetPath); +} diff --git a/packages/imagetools_/package.json b/packages/imagetools_/package.json new file mode 100644 index 0000000..1ef0c22 --- /dev/null +++ b/packages/imagetools_/package.json @@ -0,0 +1,66 @@ +{ + "name": "imagetools", + "version": "0.9.0", + "description": "Image Optimization tools for the Astro JS framework", + "type": "module", + "types": "./types.d.ts", + "exports": { + ".": "./index.js", + "./ssr": "./ssr/index.js", + "./api": "./api/index.js", + "./config": "./config.mjs", + "./components": "./components/index.js" + }, + "scripts": { + "test:watch": "vitest", + "test": "vitest run" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/RafidMuhymin/astro-imagetools.git" + }, + "keywords": [ + "astro", + "astro-component", + "image", + "images", + "optimization", + "responsive-image", + "vite", + "vite-plugin", + "sharp", + "imagetools", + "codecs", + "astropub" + ], + "author": "Rafid Muhymin", + "license": "MIT", + "bugs": { + "url": "https://github.com/RafidMuhymin/astro-imagetools/issues" + }, + "homepage": "https://github.com/RafidMuhymin/astro-imagetools#readme", + "dependencies": { + "@astropub/codecs": "0.4.4", + "@polymech/cache": "file:../../../polymech-mono/packages/cache", + "@polymech/commons": "file:../../../polymech-mono/packages/commons", + "@polymech/fs": "file:../../../polymech-mono/packages/fs", + "file-type": "17.1.1", + "find-cache-dir": "3.3.2", + "find-up": "^6.3.0", + "object-hash": "3.0.0", + "p-map": "^7.0.3", + "potrace": "2.1.8" + }, + "optionalDependencies": { + "imagetools-core": "3.0.2" + }, + "peerDependencies": { + "astro": ">=0.26 || >=1.0.0-beta" + }, + "devDependencies": { + "vitest": "^0.12.4" + }, + "engines": { + "node": "^14.15.0 || >=16.0.0" + } +} diff --git a/packages/imagetools_/plugin/hooks/config.js b/packages/imagetools_/plugin/hooks/config.js new file mode 100644 index 0000000..0562971 --- /dev/null +++ b/packages/imagetools_/plugin/hooks/config.js @@ -0,0 +1,19 @@ +// @ts-check + +export default function config() { + return { + optimizeDeps: { + exclude: ["@astropub/codecs", "imagetools-core", "sharp"], + }, + ssr: { + external: [ + "sharp", + "potrace", + "file-type", + "object-hash", + "find-cache-dir", + "@astropub/codecs", + ], + }, + }; +} diff --git a/packages/imagetools_/plugin/hooks/load.js b/packages/imagetools_/plugin/hooks/load.js new file mode 100644 index 0000000..105f3d8 --- /dev/null +++ b/packages/imagetools_/plugin/hooks/load.js @@ -0,0 +1,198 @@ +// @ts-check +import path from "node:path"; +import objectHash from "object-hash"; + +import { store } from "../index.js"; +import { getCachedBuffer } from "../utils/cache.js"; +import { getSrcPath } from "../../api/utils/getSrcPath.js"; +import { getAssetPath, getConfigOptions } from "../utils/shared.js"; +import { sharp, supportedImageTypes } from "../../utils/runtimeChecks.js"; +import { get_cached_object, set_cached_object } from '@polymech/cache'; + +const { getLoadedImage, getTransformedImage } = await (sharp + ? import("../utils/imagetools.js") + : import("../utils/codecs.js")); + +export default async function load(id) { + try { + var fileURL = new URL(`file://${id}`); + } catch (error) { + return null; + } + + const { search, searchParams } = fileURL; + + + id = id.replace(search, ""); + + const ext = path.extname(id).slice(1); + + + if (!supportedImageTypes.includes(ext)) return null; + + const { default: astroViteConfigs } = await import( + // @ts-ignore + "../../astroViteConfigs.js" + ); + + const { environment, projectBase, assetFileNames } = astroViteConfigs; + + const src = await getSrcPath(id); + + const rootRelativePosixSrc = path.posix.normalize( + path.relative("", src).split(path.sep).join(path.posix.sep) + ); + + const getHash = (width) => + objectHash( + { width, options, rootRelativePosixSrc }, + // @ts-ignore + { algorithm: "sha256" } + ); + + const base = + typeof arguments[1] === "string" + ? arguments[1] + : path.basename(src, path.extname(src)); + + const config = Object.fromEntries(searchParams); + + const { image: loadedImage, width: imageWidth } = + store.get(src) || store.set(src, await getLoadedImage(src, ext)).get(src); + + const { type, widths, options, extension, raw, inline } = getConfigOptions( + config, + ext, + imageWidth + ); + + if (raw) { + const testConfig = { ...config }; + + delete testConfig.raw; + delete testConfig.inline; + delete testConfig.base64; + + if (Object.keys(testConfig).length > 0) { + throw new Error( + "If raw is set, no other options can be set except inline and base64" + ); + } + } + + if (inline) { + if (widths.length > 1) { + throw new Error( + `The base64 or inline parameter can't be used with multiple widths` + ); + } + + const [width] = widths; + + const hash = getHash(width); + + if (store.has(hash)) { + return `export default "${store.get(hash)}"`; + } else { + const config = { width, ...options }; + + const { image, buffer } = raw + ? { + image: sharp ? loadedImage : null, + buffer: !sharp ? loadedImage.data : null, + } + : await getTransformedImage({ + src, + image: loadedImage, + config, + type, + }); + + const dataUri = `data:${type};base64,${( + buffer || (await getCachedBuffer(hash, image)) + ).toString("base64")}`; + + store.set(hash, dataUri); + + return `export default "${dataUri}"`; + } + } else { + + const sources = await Promise.all( + widths.map(async (width) => { + const hash = getHash(width); + const assetPath = getAssetPath( + base, + assetFileNames, + extension, + width, + hash + ); + + if (!store.has(assetPath)) { + const config = { width, ...options }; + // Create cache key for this specific image transformation + const cacheKey = { + src: id, + width, + type, + extension, + options: objectHash(options) + }; + let imageObject = null; + // Only use cache in production builds + if (environment === "build") { + // imageObject = await get_cached_object(cacheKey, 'imagetools-plugin'); + if (imageObject) { + console.log(`[imagetools-cache] Cache hit for ${assetPath}`); + } + } + + // Process image if not cached + if (!imageObject) { + const { image, buffer } = raw + ? { + image: sharp && loadedImage, + buffer: !sharp && loadedImage.data, + } + : await getTransformedImage({ + src, + image: loadedImage, + config, + type, + }); + + imageObject = { hash, type, image, buffer }; + + // Cache the processed result in production + if (environment === "build") { + /* + await set_cached_object(cacheKey, 'imagetools-plugin', imageObject, { + src: id, + width, + type, + timestamp: Date.now() + }); + console.log(`[imagetools-cache] Cached ${assetPath}`); + */ + } + } + store.set(assetPath, imageObject); + } + const modulePath = + environment === "dev" ? assetPath : projectBase + assetPath; + + return { width, modulePath }; + }) + ); + + const srcset = + sources.length > 1 + ? sources + .map(({ width, modulePath }) => `${modulePath} ${width}w`) + .join(", ") + : sources[0].modulePath; + + return `export default "${srcset}"`; + } +} diff --git a/packages/imagetools_/plugin/hooks/transform.js b/packages/imagetools_/plugin/hooks/transform.js new file mode 100644 index 0000000..5851419 --- /dev/null +++ b/packages/imagetools_/plugin/hooks/transform.js @@ -0,0 +1,62 @@ +// @ts-check +import path from "node:path"; +import crypto from "node:crypto"; +import MagicString from "magic-string"; +import { cwd } from "../../utils/runtimeChecks.js"; + +const regexTestPattern = + /]*>/; +const regexExecPattern = new RegExp(regexTestPattern, "gs"); +const regexRenderPattern = /\$\$render`(.*)`/gs; + +export default async function transform(code, id) { + if (id.endsWith(".md") && regexTestPattern.test(code)) { + const { default: astroViteConfigs } = await import( + // @ts-ignore + "../../astroViteConfigs.js" + ); + + const { sourcemap } = astroViteConfigs; + + // Extract the "$$render`" part of the markdown string + const [result] = [...code.matchAll(regexRenderPattern)]; + const [, renderString] = result; + const renderIndex = result.index + "$$render`".length; + + const matches = renderString.matchAll(regexExecPattern); + if (matches !== null) { + const s = new MagicString(code); + + const uuid = crypto.randomBytes(4).toString("hex"); + + const Picture = "Picture" + uuid; + + const renderComponent = "renderComponent" + uuid; + + s.prepend( + `import { Picture as ${Picture} } from "astro-imagetools/components";\nimport { renderComponent as ${renderComponent} } from "${ + cwd + "/node_modules/astro/dist/runtime/server/index.js" + }"\n;` + ); + + for (const match of matches) { + const [matchedText, rawSrc, alt] = match; + + const src = rawSrc.match("(http://|https://|data:image/).*") + ? rawSrc + : path.resolve(path.dirname(id), rawSrc).replace(cwd, ""); + + s.overwrite( + renderIndex + match.index, + renderIndex + match.index + matchedText.length, + `\${${renderComponent}($$result, "${Picture}", ${Picture}, { "src": "${src}", "alt": "${alt}" })}` + ); + } + + return { + code: s.toString(), + map: sourcemap ? s.generateMap({ hires: true }) : null, + }; + } + } +} diff --git a/packages/imagetools_/plugin/index.js b/packages/imagetools_/plugin/index.js new file mode 100644 index 0000000..f45f36f --- /dev/null +++ b/packages/imagetools_/plugin/index.js @@ -0,0 +1,88 @@ +// @ts-check +import fs from "node:fs"; +import stream from "node:stream"; +import { fileURLToPath } from "node:url"; +import { posix as path, resolve } from "node:path"; + +import load from "./hooks/load.js"; +import config from "./hooks/config.js"; +import transform from "./hooks/transform.js"; +import { middleware } from "../ssr/index.js"; +import { GlobalConfigOptions } from "../utils/runtimeChecks.js"; + +if (!globalThis.astroImageToolsStore) + globalThis.astroImageToolsStore = new Map(); + +export const store = globalThis.astroImageToolsStore; + +const filename = fileURLToPath(import.meta.url); + +const astroViteConfigsPath = resolve(filename, "../../astroViteConfigs.js"); + +const vitePluginAstroImageTools = { + name: "vite-plugin-astro-imagetools", + enforce: "pre", + + config, + + async configResolved(config) { + const { mode } = config; + + const { outDir, sourcemap } = config.build; + + let inheritedPattern = + config.build.rollupOptions.output?.assetFileNames?.replace( + "[name]", + "[name]@[width]" + ); + + let assetFileNames = path.normalize( + GlobalConfigOptions.assetFileNames || + inheritedPattern || + `/_astro/[name]@[width].[hash][extname]` + ); + + const { dir: assetsDir } = path.posix.parse( + assetFileNames.replaceAll(path.sep, path.posix.sep) + ); + + if (!assetFileNames.startsWith("/")) + assetFileNames = path.join("/", assetFileNames); + + const astroViteConfigs = JSON.parse( + (await fs.promises.readFile(astroViteConfigsPath, "utf8")).slice(15) + ); + + const newAstroViteConfigs = { + ...astroViteConfigs, + mode, + outDir, + assetsDir, + sourcemap, + assetFileNames, + }; + + await fs.promises.writeFile( + astroViteConfigsPath, + `export default ${JSON.stringify(newAstroViteConfigs, null, 2)}` + ); + }, + + load, + + transform, + + configureServer(server) { + server.middlewares.use(async (request, response, next) => { + const buffer = await middleware(request, response); + + if (buffer) { + return stream.Readable.from(buffer).pipe(response); + } + + next(); + }); + }, +}; + +export default vitePluginAstroImageTools; diff --git a/packages/imagetools_/plugin/utils/cache.js b/packages/imagetools_/plugin/utils/cache.js new file mode 100644 index 0000000..1e0ff86 --- /dev/null +++ b/packages/imagetools_/plugin/utils/cache.js @@ -0,0 +1,19 @@ +// @ts-check +import fs from "node:fs"; +import { fsCachePath } from "../../utils/runtimeChecks.js"; + +export async function getCachedBuffer(hash, image) { + const cacheFilePath = fsCachePath + hash; + + // console.log(`[imagetools-cache getCachedBuffer] Cache hit for ${cacheFilePath}`); + + if (fs.existsSync(cacheFilePath)) { + return fs.promises.readFile(cacheFilePath); + } + + const buffer = await image.clone().toBuffer(); + + await fs.promises.writeFile(cacheFilePath, buffer); + + return buffer; +} diff --git a/packages/imagetools_/plugin/utils/codecs.js b/packages/imagetools_/plugin/utils/codecs.js new file mode 100644 index 0000000..1476e94 --- /dev/null +++ b/packages/imagetools_/plugin/utils/codecs.js @@ -0,0 +1,41 @@ +// @ts-check +import fs from "node:fs"; +import * as codecs from "@astropub/codecs"; + +const resizedImages = new Map(); + +export const getLoadedImage = async (src, ext) => { + const buffer = fs.readFileSync(src); + + const image = await codecs[ext].decode(buffer); + + const { width } = image; + + const resizedImageKey = `${src}@${image.width}`; + + resizedImages.set(resizedImageKey, image); + + return { image, width }; +}; + +export const getTransformedImage = async ({ src, image, config, type }) => { + const { width, format, quality } = config; + + const resizedImageKey = `${src}@${width}`; + + const resizedImage = + resizedImages.get(resizedImageKey) || + resizedImages + .set(resizedImageKey, await image.resize({ width })) + .get(resizedImageKey); + + const encodedImage = quality + ? await codecs[format].encode(resizedImage, { + quality: parseInt(quality), + }) + : await resizedImage.encode(type); + + const buffer = Buffer.from(encodedImage.data); + + return { image, buffer }; +}; diff --git a/packages/imagetools_/plugin/utils/imagetools.js b/packages/imagetools_/plugin/utils/imagetools.js new file mode 100644 index 0000000..f969207 --- /dev/null +++ b/packages/imagetools_/plugin/utils/imagetools.js @@ -0,0 +1,26 @@ +// @ts-check +import { + builtins, + loadImage, + applyTransforms, + generateTransforms, +} from "imagetools-core"; + +export const getLoadedImage = async (src) => { + const image = loadImage(src); + + const { width } = await image.metadata(); + + return { image, width }; +}; + +export const getTransformedImage = async ({ image, config }) => { + const { transforms } = generateTransforms(config, builtins); + + const { image: encodedImage } = await applyTransforms( + transforms, + image.clone() + ); + + return { image: encodedImage, buffer: null }; +}; diff --git a/packages/imagetools_/plugin/utils/shared.js b/packages/imagetools_/plugin/utils/shared.js new file mode 100644 index 0000000..bac7c05 --- /dev/null +++ b/packages/imagetools_/plugin/utils/shared.js @@ -0,0 +1,47 @@ +// @ts-check + +export function getConfigOptions(config, ext, imageWidth) { + const { w, width = w, format = ext, base64, raw, inline, ...rest } = config; + + const imageFormat = format === "jpeg" ? "jpg" : format; + + const widths = width + ? width.split(";").map((w) => parseInt(w)) + : [imageWidth]; + + const extension = format === "jpg" ? "jpeg" : format; + const type = `image/${extension}`; + + const options = { + format: imageFormat, + ...rest, + }; + + return { + type, + widths, + options, + extension, + raw: typeof raw === "string", + inline: typeof base64 === "string" || typeof inline === "string", + }; +} + +export function getAssetPath(base, assetFileNames, ext, width, hash) { + const regexExecArray = /(?<=\[hash:)\d+(?=\])/g.exec(assetFileNames), + hashLength = regexExecArray ? regexExecArray[0] : 8, + extname = `.${ext}`, + name = base; + + width = width + "w"; + hash = hash.slice(0, hashLength); + + const assetPath = assetFileNames + .replace("[name]", name) + .replace("[width]", width) + .replace(regexExecArray ? `[hash:${hashLength}]` : "[hash]", hash) + .replace("[ext]", ext) + .replace("[extname]", extname); + + return assetPath; +} diff --git a/packages/imagetools/pnpm-lock.yaml b/packages/imagetools_/pnpm-lock.yaml similarity index 100% rename from packages/imagetools/pnpm-lock.yaml rename to packages/imagetools_/pnpm-lock.yaml diff --git a/packages/imagetools/pnpm-workspace.yaml b/packages/imagetools_/pnpm-workspace.yaml similarity index 100% rename from packages/imagetools/pnpm-workspace.yaml rename to packages/imagetools_/pnpm-workspace.yaml diff --git a/packages/imagetools_/ssr/index.d.ts b/packages/imagetools_/ssr/index.d.ts new file mode 100644 index 0000000..87ae242 --- /dev/null +++ b/packages/imagetools_/ssr/index.d.ts @@ -0,0 +1,6 @@ +import type { IncomingMessage, ServerResponse } from "http"; + +export function middleware( + request: IncomingMessage, + response: ServerResponse +): Buffer; diff --git a/packages/imagetools_/ssr/index.js b/packages/imagetools_/ssr/index.js new file mode 100644 index 0000000..f25f02e --- /dev/null +++ b/packages/imagetools_/ssr/index.js @@ -0,0 +1,27 @@ +// @ts-check +import { store } from "../plugin/index.js"; +import { getCachedBuffer } from "../plugin/utils/cache.js"; + +export async function middleware(request, response) { + const url = request.url || request.path; + const imageObject = store.get(url); +/* + // Debug logging + if (url?.includes('_astro/') && url?.includes('.avif')) { + console.log(`[imagetools-debug] Looking for: ${url}`); + console.log(`[imagetools-debug] Store has ${store.size} entries`); + console.log(`[imagetools-debug] Found: ${!!imageObject}`); + if (!imageObject && store.size > 0) { + console.log(`[imagetools-debug] Available keys:`, [...store.keys()].slice(0, 5)); + } + }*/ + + if (imageObject) { + const { hash, type, image, buffer } = imageObject; + + response.setHeader("Content-Type", type); + response.setHeader("Cache-Control", "no-cache"); + + return buffer || (await getCachedBuffer(hash, image)); + } +} diff --git a/packages/imagetools_/test-fixtures/getSrcPath/out/out.jpeg b/packages/imagetools_/test-fixtures/getSrcPath/out/out.jpeg new file mode 100644 index 0000000..c8b7e65 Binary files /dev/null and b/packages/imagetools_/test-fixtures/getSrcPath/out/out.jpeg differ diff --git a/packages/imagetools_/test-fixtures/getSrcPath/root.jpeg b/packages/imagetools_/test-fixtures/getSrcPath/root.jpeg new file mode 100644 index 0000000..87f9f0c Binary files /dev/null and b/packages/imagetools_/test-fixtures/getSrcPath/root.jpeg differ diff --git a/packages/imagetools_/types.d.ts b/packages/imagetools_/types.d.ts new file mode 100644 index 0000000..d44c18c --- /dev/null +++ b/packages/imagetools_/types.d.ts @@ -0,0 +1,268 @@ +declare type format = + | "heic" + | "heif" + | "avif" + | "jpg" + | "jpeg" + | "png" + | "tiff" + | "webp" + | "gif"; + +declare type PotraceOptions = TraceOptions | PosterizeOptions; + +declare interface SharedTracingOptions { + turnPolicy?: "black" | "white" | "left" | "right" | "minority" | "majority"; + turdSize?: number; + alphaMax?: number; + optCurve?: boolean; + optTolerance?: number; + threshold?: number; + blackOnWhite?: boolean; + color?: "auto" | string; + background?: "transparent" | string; +} + +declare interface TraceOptions { + function?: "trace"; + options?: SharedTracingOptions; +} + +declare interface PosterizeOptions { + function?: "posterize"; + options?: SharedTracingOptions & { + fill?: "spread" | "dominant" | "median" | "mean"; + ranges?: "auto" | "equal"; + steps?: number | number[]; + }; +} + +declare interface FormatOptions { + formatOptions?: Partial> & { + tracedSVG?: PotraceOptions; + }; +} + +declare interface PictureFormatOptions extends FormatOptions { + format?: format | format[] | [] | null; + fallbackFormat?: format; + includeSourceFormat?: boolean; +} + +declare interface ImgFormatOptions extends FormatOptions { + format?: format; +} + +declare interface ImageToolsConfigs { + flip?: boolean; + flop?: boolean; + invert?: boolean; + flatten?: boolean; + normalize?: boolean; + grayscale?: boolean; + hue?: number; + saturation?: number; + brightness?: number; + w?: number; + h?: number; + ar?: number; + width?: number; + height?: number; + aspect?: number; + background?: string; + tint?: string; + blur?: number | boolean; + median?: number | boolean; + rotate?: number; + quality?: number; + fit?: "cover" | "contain" | "fill" | "inside" | "outside"; + kernel?: "nearest" | "cubic" | "mitchell" | "lanczos2" | "lanczos3"; + position?: + | "top" + | "right top" + | "right" + | "right bottom" + | "bottom" + | "left bottom" + | "left" + | "left top" + | "north" + | "northeast" + | "east" + | "southeast" + | "south" + | "southwest" + | "west" + | "northwest" + | "center" + | "centre" + | "cover" + | "entropy" + | "attention"; +} + +declare interface ObjectStyles { + objectPosition?: string; + objectFit?: "fill" | "contain" | "cover" | "none" | "scale-down"; +} + +declare interface BackgroundStyles { + backgroundPosition?: string; + backgroundSize?: "fill" | "contain" | "cover" | "none" | "scale-down"; +} + +declare interface ArtDirective + extends PrimaryProps, + ObjectStyles, + PictureFormatOptions, + ImageToolsConfigs { + media: string; +} + +declare interface BackgroundImageArtDirective + extends PrimaryProps, + BackgroundStyles, + PictureFormatOptions, + ImageToolsConfigs { + media: string; +} + +declare type sizesFunction = { + (breakpoints: number[]): string; +}; + +declare type breakpointsFunction = { + (imageWidth: number): number[]; +}; + +declare interface PrimaryProps { + src: string; + sizes?: string | sizesFunction; + placeholder?: "dominantColor" | "blurred" | "tracedSVG" | "none"; + breakpoints?: + | number[] + | breakpointsFunction + | { + count?: number; + minWidth?: number; + maxWidth?: number; + }; +} + +declare interface ConfigOptions extends PrimaryProps, ImageToolsConfigs { + alt: string; + preload?: format; + loading?: "lazy" | "eager" | "auto" | null; + decoding?: "async" | "sync" | "auto" | null; + layout?: "constrained" | "fixed" | "fullWidth" | "fill"; +} + +declare interface Attributes { + container?: Record; + picture?: Record; + style?: Record; + link?: Omit, "as" | "rel" | "imagesizes" | "imagesrcset">; + img?: Omit< + Record, + | "src" + | "alt" + | "srcset" + | "sizes" + | "width" + | "height" + | "loading" + | "decoding" + >; +} + +export interface PictureConfigOptions + extends ConfigOptions, + ObjectStyles, + PictureFormatOptions { + artDirectives?: ArtDirective[]; + attributes?: Omit; + fadeInTransition?: + | boolean + | { + delay?: string; + duration?: string; + timingFunction?: string; + }; +} + +export interface ImgConfigOptions + extends ConfigOptions, + ObjectStyles, + ImgFormatOptions { + attributes?: Omit; +} + +declare interface BackgroundProps { + tag?: string; + content?: string; +} + +export interface BackgroundImageConfigOptions + extends BackgroundProps, + BackgroundStyles, + Pick< + PictureConfigOptions, + Exclude< + keyof PictureConfigOptions, + | "alt" + | "sizes" + | "loading" + | "decoding" + | "layout" + | "objectFit" + | "objectPosition" + | "artDirective" + | "fadeInTransition" + > + > { + attributes?: Omit; + artDirectives?: BackgroundImageArtDirective[]; +} + +export interface BackgroundPictureConfigOptions + extends BackgroundProps, + Pick< + PictureConfigOptions, + Exclude + > { + attributes?: Attributes; +} + +export interface GlobalConfigOptions + extends BackgroundStyles, + Pick< + PictureConfigOptions, + Exclude + > { + tag?: string; + cacheDir?: string; + assetFileNames?: string; +} + +declare interface HTMLData { + link: string; + style: string; +} + +export interface ImageHTMLData extends HTMLData { + image: string; +} + +export interface PictureHTMLData extends HTMLData { + picture: string; +} + +export interface ImgHTMLData extends HTMLData { + img: string; +} + +export interface BackgroundImageHTMLData extends HTMLData { + htmlElement: string; +} + +export type BackgroundPictureHTMLData = BackgroundImageHTMLData; diff --git a/packages/imagetools_/utils/filterConfigs.js b/packages/imagetools_/utils/filterConfigs.js new file mode 100644 index 0000000..1fd64da --- /dev/null +++ b/packages/imagetools_/utils/filterConfigs.js @@ -0,0 +1,51 @@ +// @ts-check +import printWarning from "./printWarning.js"; + +export default function filterConfigs( + type, + configs, + supportedConfigs, + { warn = true } = {} +) { + const clonedConfigs = { ...configs }; + + const requiredConfigs = []; + + type !== "Global" && requiredConfigs.push("src"); + + ["Img", "Picture"].includes(type) && requiredConfigs.push("alt"); + + requiredConfigs.forEach((key) => { + if (typeof clonedConfigs[key] === "undefined") { + throw new Error(`The "${key}" property is required by ${type}`); + } + }); + + Object.keys(clonedConfigs).forEach((key) => { + if (!supportedConfigs.includes(key)) { + if (warn) { + if (key !== "class") { + printWarning({ key, type }); + } else if (!onlyAstroClass(clonedConfigs[key])) { + /* + printWarning({ + message: `Do not provide a "class" directly to ${type}. Instead, use attributes: https://astro-imagetools-docs.vercel.app/en/components/${type}#attributes`, + }); + */ + } + } + + delete clonedConfigs[key]; + } + }); + + return clonedConfigs; +} + +/** + * Checks if the `class` attribute string is only an astro-generated scoped style class. + */ +function onlyAstroClass(classAttr) { + const astroClassPattern = /^astro-[0-9A-Z]{8}$/; + return astroClassPattern.test(classAttr); +} diff --git a/packages/imagetools_/utils/filterConfigs.test.js b/packages/imagetools_/utils/filterConfigs.test.js new file mode 100644 index 0000000..d3d5100 --- /dev/null +++ b/packages/imagetools_/utils/filterConfigs.test.js @@ -0,0 +1,100 @@ +import { describe, expect, afterAll, it, vi, beforeEach } from "vitest"; +import { supportedConfigs } from "./runtimeChecks"; +import filterConfigs from "./filterConfigs"; +import printWarning from "./printWarning.js"; + +// Workaround for https://github.com/vitest-dev/vitest/issues/855 +vi.mock("./printWarning.js", async () => { + return { default: vi.fn() }; +}); + +const warningSpy = vi.mocked(printWarning); + +describe("filterConfigs", () => { + beforeEach(() => { + warningSpy.mockReset(); + }); + afterAll(() => { + vi.unmock("./printWarning.js"); + }); + + it("should require a `src` attribute for all components", () => { + expect(() => { + filterConfigs("Img", { alt: "" }, supportedConfigs); + }).toThrowError('The "src" property is required by Img'); + expect(() => { + filterConfigs("Picture", { alt: "" }, supportedConfigs); + }).toThrowError('The "src" property is required by Picture'); + expect(() => { + filterConfigs("BackgroundImage", {}, supportedConfigs); + }).toThrowError('The "src" property is required by BackgroundImage'); + expect(() => { + filterConfigs("BackgroundPicture", {}, supportedConfigs); + }).toThrowError('The "src" property is required by BackgroundPicture'); + expect(() => { + filterConfigs("Global", {}, supportedConfigs); + }).not.toThrowError(); + }); + + it("should require an `alt` attribute for Picture and Img, but not others", () => { + expect(() => { + filterConfigs("Img", { src: "src" }, supportedConfigs); + }).toThrowError('The "alt" property is required by Img'); + expect(() => { + filterConfigs("Picture", { src: "src" }, supportedConfigs); + }).toThrowError('The "alt" property is required by Picture'); + expect(() => { + filterConfigs("BackgroundImage", { src: "src" }, supportedConfigs); + }).not.toThrowError(); + expect(() => { + filterConfigs("BackgroundPicture", { src: "src" }, supportedConfigs); + }).not.toThrowError(); + expect(() => { + filterConfigs("Global", {}, supportedConfigs); + }).not.toThrowError(); + }); + + it("should remove unsupported configs", () => { + const filteredConfig = filterConfigs("Global", { foo: "foo" }, [], { + warn: false, + }); + const filteredConfigFooSupported = filterConfigs( + "Global", + { foo: "foo" }, + ["foo"], + { + warn: false, + } + ); + expect(filteredConfig).not.toContain({ foo: "foo" }); + expect(filteredConfigFooSupported).toContain({ foo: "foo" }); + }); + + it("should warn about unsupported configs", () => { + filterConfigs("Global", { foo: "foo" }, []); + expect(warningSpy).toHaveBeenCalledWith({ type: "Global", key: "foo" }); + }); + + it("should warn about unsupported 'class' config", () => { + filterConfigs( + "Img", + { class: "astro-ASDF1234 my-class", src: "src", alt: "" }, + supportedConfigs + ); + expect(warningSpy).toHaveBeenCalledWith({ + message: + 'Do not provide a "class" directly to Img. Instead, use attributes: https://astro-imagetools-docs.vercel.app/en/components/Img#attributes', + }); + }); + + it("should not warn about astro-generated 'class' config", () => { + const filteredConfig = filterConfigs( + "Img", + { class: "astro-ASDF1234", src: "src", alt: "" }, + supportedConfigs + ); + expect(warningSpy).not.toHaveBeenCalled(); + // class is still stripped out + expect(filteredConfig).not.toContain({ class: "astro-ASDF1234" }); + }); +}); diff --git a/packages/imagetools_/utils/printWarning.js b/packages/imagetools_/utils/printWarning.js new file mode 100644 index 0000000..efeac3d --- /dev/null +++ b/packages/imagetools_/utils/printWarning.js @@ -0,0 +1,57 @@ +// @ts-check + +const colours = { + reset: "\x1b[0m", + bright: "\x1b[1m", + dim: "\x1b[2m", + underscore: "\x1b[4m", + blink: "\x1b[5m", + reverse: "\x1b[7m", + hidden: "\x1b[8m", + + fg: { + black: "\x1b[30m", + red: "\x1b[31m", + green: "\x1b[32m", + yellow: "\x1b[33m", + blue: "\x1b[34m", + magenta: "\x1b[35m", + cyan: "\x1b[36m", + white: "\x1b[37m", + }, + + bg: { + black: "\x1b[40m", + red: "\x1b[41m", + green: "\x1b[42m", + yellow: "\x1b[43m", + blue: "\x1b[44m", + magenta: "\x1b[45m", + cyan: "\x1b[46m", + white: "\x1b[47m", + }, +}; + +export default function printWarning({ + key = "", + type = "", + message = "", + element = "", +}) { + const flag = + colours.bright + colours.fg.cyan + "[astro-imagetools]" + colours.reset; + + const keyLog = key + ? " " + colours.bg.yellow + ` ${key} ` + colours.reset + : ""; + + const messageLog = + colours.fg.yellow + + (message || + (!element + ? `is not a valid ${type} Config Option` + : `can't be defined inside attributes.${element}`)) + + colours.reset; + + // console.log(flag + keyLog, messageLog); +} diff --git a/packages/imagetools_/utils/runtimeChecks.js b/packages/imagetools_/utils/runtimeChecks.js new file mode 100644 index 0000000..a5e1b3d --- /dev/null +++ b/packages/imagetools_/utils/runtimeChecks.js @@ -0,0 +1,80 @@ +// @ts-check +import fs from "node:fs"; +import path from "node:path"; +import { pathToFileURL } from "node:url"; +import findCacheDir from "find-cache-dir"; +import filterConfigs from "./filterConfigs.js"; +import { findUpSync } from "find-up" + +// Sharp related checks +export const sharp = await (async () => { + try { + if (await import("sharp")) { + return true; + } + } catch (error) { + return false; + } +})(); + +export const supportedImageTypes = [ + "avif", + "jpeg", + "jpg", + "png", + "webp", + ...(sharp ? ["heic", "heif", "tiff", "gif"] : ["jxl", "wp2"]), +]; + +// prettier-ignore +export const supportedConfigs = [ + "src", "alt", "tag", "content", "sizes", "preload", "loading", "decoding", "attributes", + "layout", "placeholder", "breakpoints", "objectFit", "objectPosition", "backgroundSize", + "backgroundPosition", "format", "fallbackFormat", "includeSourceFormat", "formatOptions", + "fadeInTransition", "artDirectives", "flip", "flop", "invert", "flatten", "normalize", + "grayscale", "hue", "saturation", "brightness", "w", "h", "ar", "width", "height", "aspect", + "background", "tint", "blur", "median", "rotate", "quality", "fit", "kernel", "position", + "cacheDir", "assetFileNames", +]; + +const configFile = findUpSync([ + "astro-imagetools.config.js", + "astro-imagetools.config.mjs", +]); + +const configFunction = configFile + ? await import(/* @vite-ignore */ pathToFileURL(configFile).href) + : null; + +const rawGlobalConfigOptions = configFunction?.default ?? {}; + +const NonGlobalConfigOptions = ["src", "alt", "content"]; + +const GlobalConfigs = supportedConfigs.filter( + (key) => !NonGlobalConfigOptions.includes(key) +); + +const GlobalConfigOptions = filterConfigs( + "Global", + rawGlobalConfigOptions, + GlobalConfigs +); + +export { GlobalConfigOptions }; + +// CWD +export const cwd = process.cwd().split(path.sep).join(path.posix.sep); + +const { cacheDir } = GlobalConfigOptions; + +// FS Cache related checks +const fsCachePath = + (cacheDir + ? cwd + cacheDir + : findCacheDir({ + name: "astro-imagetools", + })) + "/"; + +fs.existsSync(fsCachePath) || fs.mkdirSync(fsCachePath, { recursive: true }); + +export { fsCachePath }; diff --git a/packages/imagetools_/utils/runtimeChecks.test.ts b/packages/imagetools_/utils/runtimeChecks.test.ts new file mode 100644 index 0000000..622592e --- /dev/null +++ b/packages/imagetools_/utils/runtimeChecks.test.ts @@ -0,0 +1,36 @@ +import { beforeEach, describe, expect, it, vi } from "vitest"; + +describe("GlobalConfigOptions", () => { + beforeEach(() => { + // Need to reset the modules so that we can change the mock implementation between tests + vi.resetModules(); + }); + + it("Should be an empty object by default, if a config file isn't found", async () => { + // Simulate not finding a config file + vi.doMock("find-up", () => { + return { + findUp: async () => undefined, + }; + }); + // Need to import this after the mocks are set up with `doMock`. + const { GlobalConfigOptions } = await import("./runtimeChecks"); + expect(GlobalConfigOptions).toEqual({}); + }); + + it("should return the configuration from a global config file", async () => { + // Find a config file, and mock the contents of that file + vi.doMock("find-up", () => { + return { + findUp: async () => "mockedConfigFile", + }; + }); + vi.doMock("mockedConfigFile", () => { + return { + default: { breakpoints: [800, 1200] }, + }; + }); + const { GlobalConfigOptions } = await import("./runtimeChecks"); + expect(GlobalConfigOptions).toEqual({ breakpoints: [800, 1200] }); + }); +}); diff --git a/packages/imagetools_/vitest.config.ts b/packages/imagetools_/vitest.config.ts new file mode 100644 index 0000000..29dc63d --- /dev/null +++ b/packages/imagetools_/vitest.config.ts @@ -0,0 +1,7 @@ +import { defineConfig } from "vitest/config"; + +export default defineConfig({ + test: { + // https://vitest.dev/config/#configuration + }, +}); diff --git a/packages/imagetools_3/.eslintrc.js b/packages/imagetools_3/.eslintrc.js new file mode 100644 index 0000000..404d101 --- /dev/null +++ b/packages/imagetools_3/.eslintrc.js @@ -0,0 +1,17 @@ +module.exports = { + root: true, + env: { + node: true, + browser: true, + es2020: true, + }, + parserOptions: { + ecmaVersion: 2022, + sourceType: "module", + }, + plugins: ["unicorn"], + extends: ["eslint:recommended"], + rules: { + "unicorn/prefer-node-protocol": "error", + }, +}; diff --git a/packages/imagetools_3/.github/workflows/ci.yml b/packages/imagetools_3/.github/workflows/ci.yml new file mode 100644 index 0000000..8037912 --- /dev/null +++ b/packages/imagetools_3/.github/workflows/ci.yml @@ -0,0 +1,65 @@ +name: CI +on: + pull_request: + push: + branches: + - main +jobs: + lint: + env: + ASTRO_TELEMETRY_DISABLED: true + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Setup PNPM + uses: pnpm/action-setup@v2.2.1 + + - name: Setup node + uses: actions/setup-node@v3 + with: + node-version: 16 + cache: "pnpm" + + - name: Install dependencies + run: pnpm install + + - name: Prettier + run: pnpm run format:check + + - name: ESLint + run: pnpm run lint + + test: + name: "Test: ${{ matrix.os }} (node@${{ matrix.node_version }})" + env: + ASTRO_TELEMETRY_DISABLED: true + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest] + node_version: [14, 16] + include: + - os: windows-latest + node_version: 16 + - os: macos-latest + node_version: 16 + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Setup PNPM + uses: pnpm/action-setup@v2.2.1 + + - name: Setup node@${{ matrix.node_version }} + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node_version }} + cache: "pnpm" + - name: Install dependencies + run: pnpm install + + - name: Test + run: pnpm --filter astro-imagetools run test diff --git a/packages/imagetools_3/.gitignore b/packages/imagetools_3/.gitignore new file mode 100644 index 0000000..7ce5e2f --- /dev/null +++ b/packages/imagetools_3/.gitignore @@ -0,0 +1,20 @@ +# dependencies +node_modules/ + +# build output +dist/ + +# logs +*.log + +# npm +package-lock.json + +# macOS-specific files +.DS_Store + +# env +*.env + +# astro-imagetools +packages/astro-imagetools/astroViteConfigs.js diff --git a/packages/imagetools_3/.npmignore b/packages/imagetools_3/.npmignore new file mode 100644 index 0000000..4f257ea --- /dev/null +++ b/packages/imagetools_3/.npmignore @@ -0,0 +1,4 @@ +*.test.ts +test-fixtures +astroViteConfigs.js +vitest.config.ts diff --git a/packages/imagetools_3/.npmrc b/packages/imagetools_3/.npmrc new file mode 100644 index 0000000..0cc653b --- /dev/null +++ b/packages/imagetools_3/.npmrc @@ -0,0 +1,2 @@ +## force pnpm to hoist +shamefully-hoist = true \ No newline at end of file diff --git a/packages/imagetools_3/.prettierignore b/packages/imagetools_3/.prettierignore new file mode 100644 index 0000000..2a056f3 --- /dev/null +++ b/packages/imagetools_3/.prettierignore @@ -0,0 +1,2 @@ +pnpm-lock.yaml +demo/dist diff --git a/packages/imagetools_3/.prettierrc b/packages/imagetools_3/.prettierrc new file mode 100644 index 0000000..8008794 --- /dev/null +++ b/packages/imagetools_3/.prettierrc @@ -0,0 +1,9 @@ +{ + "overrides": [ + { + "files": "**/*.astro", + "options": { "parser": "astro" } + } + ], + "plugins": ["prettier-plugin-astro"] +} diff --git a/packages/imagetools_3/LICENSE b/packages/imagetools_3/LICENSE new file mode 100644 index 0000000..a4be0c4 --- /dev/null +++ b/packages/imagetools_3/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2022 Rafid Muhymin Wafi + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/packages/imagetools_3/README.md b/packages/imagetools_3/README.md new file mode 100644 index 0000000..eda0dbe --- /dev/null +++ b/packages/imagetools_3/README.md @@ -0,0 +1,39 @@ +# **Astro ImageTools** + +**Astro ImageTools** is a collection of tools for optimizing images, background images, and generating responsive images for the **Astro JS** framework. + +## Features + +Below is a short list of features that **Astro ImageTools** offers. For more information, please see component-specific or API-specific documentation. + +- ✅ **Regular Image Optimization** (`` and ``) +- ✅ **Background Image Optimization** +- ✅ **Responsive Images** +- ✅ **Simple and intuitive Art Direction API** +- ✅ **Lazy Loading** +- ✅ **Programmatic APIs** +- ✅ **Asynchronous Decoding** +- ✅ **Unique Breakpoints Calculation** +- ✅ **Preloading for urgent images** +- ✅ **SVG Tracing and Posterization** +- ✅ **100% Scoped CSS** +- ✅ **Four kind of Layouts: `constrained`, `fixed`, `fullWidth` & `fill`** +- ✅ **Three kind of Placeholder Images: `blurred`, `dominantColor` & `tracedSVG`** +- ✅ **Long list of supported Image Formats** +- ✅ **Long List of supported Configuration Options** +- ✅ **Supports Remote Images and Data URIs too** +- ✅ **Support for _`sharp`less_ Environments** +- ✅ **Both Memory-based and FS-based Caching for better Performance** +- ✅ **Respects to _Semantics of HTML_ as much as possible** + +## Getting Started + +To get started with **Astro ImageTools**, first check out the [Installation](https://astro-imagetools-docs.vercel.app/en/installation) documentation for instructions on how to install the `astro-imagetools` package. + +If you are looking for the available components and APIs, please check out the [Components and APIs](https://astro-imagetools-docs.vercel.app/en/components-and-apis) documentation. + +If you want to view live examples of the components, APIs, layouts, and placeholder images, check out the [Astro ImageTools Demo](https://astro-imagetools-demo.vercel.app/) website. + +If you want to report any issues or have found a missing feature, please report it on [GitHub](https://github.com/RafidMuhymin/astro-imagetools/)! + +Good luck out there, Astronaut. 🧑‍🚀 diff --git a/packages/imagetools_3/api/importImage.d.ts b/packages/imagetools_3/api/importImage.d.ts new file mode 100644 index 0000000..bb0bb97 --- /dev/null +++ b/packages/imagetools_3/api/importImage.d.ts @@ -0,0 +1 @@ +export default function importImage(url: string): Promise; diff --git a/packages/imagetools_3/api/importImage.js b/packages/imagetools_3/api/importImage.js new file mode 100644 index 0000000..b22ca0b --- /dev/null +++ b/packages/imagetools_3/api/importImage.js @@ -0,0 +1,23 @@ +import load from "../plugin/hooks/load.js"; +import { getSrcPath } from "./utils/getSrcPath.js"; +import getResolvedSrc from "./utils/getResolvedSrc.js"; + +export default async function importImage(path) { + try { + const { search, protocol, pathname } = new URL(path); + + const { src: id, base } = await getResolvedSrc( + protocol === "data:" ? protocol + pathname : path + ); + + const src = (await load(id + search, base)).slice(16, -1); + + return src; + } catch (error) { + const id = await getSrcPath(path); + + const src = (await load(id)).slice(16, -1); + + return src; + } +} diff --git a/packages/imagetools_3/api/index.js b/packages/imagetools_3/api/index.js new file mode 100644 index 0000000..062d6ad --- /dev/null +++ b/packages/imagetools_3/api/index.js @@ -0,0 +1,6 @@ +export { default as renderImg } from "./renderImg.js"; +export { default as renderPicture } from "./renderPicture.js"; +export { default as renderBackgroundImage } from "./renderBackgroundImage.js"; +export { default as renderBackgroundPicture } from "./renderBackgroundPicture.js"; +export { default as importImage } from "./importImage.js"; +export { getImageDetails, loadImage } from "./utils/imagetools.js" \ No newline at end of file diff --git a/packages/imagetools_3/api/renderBackgroundImage.d.ts b/packages/imagetools_3/api/renderBackgroundImage.d.ts new file mode 100644 index 0000000..e7e601b --- /dev/null +++ b/packages/imagetools_3/api/renderBackgroundImage.d.ts @@ -0,0 +1,8 @@ +import type { + BackgroundImageConfigOptions, + BackgroundImageHTMLData, +} from "../types"; + +export default function renderBackgroundImage( + config: BackgroundImageConfigOptions +): Promise; diff --git a/packages/imagetools_3/api/renderBackgroundImage.js b/packages/imagetools_3/api/renderBackgroundImage.js new file mode 100644 index 0000000..f56b308 --- /dev/null +++ b/packages/imagetools_3/api/renderBackgroundImage.js @@ -0,0 +1,159 @@ +// @ts-check +import crypto from "node:crypto"; +import getImage from "./utils/getImage.js"; +import getLinkElement from "./utils/getLinkElement.js"; +import getStyleElement from "./utils/getStyleElement.js"; +import getFilteredProps from "./utils/getFilteredProps.js"; +import getContainerElement from "./utils/getContainerElement.js"; + +export default async function renderBackgroundImage(props) { + const type = "BackgroundImage"; + + const { filteredProps, transformConfigs } = getFilteredProps(type, props); + + const { + src, + tag, + content, + preload, + attributes, + placeholder, + breakpoints, + backgroundSize, + backgroundPosition, + format, + fallbackFormat, + includeSourceFormat, + formatOptions, + artDirectives, + } = filteredProps; + + const { + link: linkAttributes = {}, + style: styleAttributes = {}, + container: containerAttributes = {}, + } = attributes; + + const sizes = ""; + + const { uuid, images } = await getImage({ + src, + type, + sizes, + format, + breakpoints, + placeholder, + artDirectives, + fallbackFormat, + includeSourceFormat, + formatOptions, + transformConfigs, + }); + + const className = `astro-imagetools-background-image-${uuid}`; + + const { imagesizes } = images[images.length - 1]; + + const link = getLinkElement({ images, preload, imagesizes, linkAttributes }); + + const backgroundImageStylesArray = images.map(({ media, sources }) => { + const uuid = crypto.randomBytes(4).toString("hex").toUpperCase(); + + const fallbackUrlCustomVariable = `--astro-imagetools-background-image-fallback-url${uuid}`; + + const newSources = {}; + + sources.forEach(({ src, format, srcset }) => { + const sources = srcset + .split(", ") + .map((source) => [ + source.slice(0, source.lastIndexOf(" ")), + source.slice(source.lastIndexOf(" ") + 1, -1), + ]); + + sources.forEach(([path, width]) => { + if (!newSources[width]) { + newSources[width] = []; + } + + newSources[width].push({ src, format, path }); + }); + }); + + const widths = Object.keys(newSources) + .map((width) => parseInt(width)) + .reverse(); + + const maxWidth = Math.max(...widths); + + const styles = widths + .map((width) => { + const sources = newSources[width]; + + const styles = sources + .map( + ({ format, path }, i) => + ` + ${i !== sources.length - 1 ? `.${format} ` : ""}.${className} { + background-repeat: no-repeat; + background-image: url(${path}), + var(${fallbackUrlCustomVariable}); + background-size: ${backgroundSize}; + background-position: ${backgroundPosition}; + } + ` + ) + .reverse() + .join(""); + + return width === maxWidth + ? styles + : ` + @media screen and (max-width: ${width}px) { + ${styles} + } + `; + }) + .join(""); + + return { + fallbackUrlCustomVariable, + styles: media + ? ` + @media ${media} { + ${styles} + } + ` + : styles, + }; + }); + + const containerStyles = ` + .${className} { + position: relative; + ${images + .map(({ fallback }, i) => { + const fallbackUrlCustomVariable = + backgroundImageStylesArray[i].fallbackUrlCustomVariable; + + return `${fallbackUrlCustomVariable}: url("${encodeURI(fallback)}");`; + }) + .join("\n")} + } + `; + + const backgroundStyles = + backgroundImageStylesArray.map(({ styles }) => styles).join("\n") + + containerStyles; + + const style = getStyleElement({ styleAttributes, backgroundStyles }); + + const htmlElement = getContainerElement({ + tag, + content, + className, + containerAttributes, + }); + + return { link, style, htmlElement }; +} diff --git a/packages/imagetools_3/api/renderBackgroundPicture.d.ts b/packages/imagetools_3/api/renderBackgroundPicture.d.ts new file mode 100644 index 0000000..a566421 --- /dev/null +++ b/packages/imagetools_3/api/renderBackgroundPicture.d.ts @@ -0,0 +1,8 @@ +import type { + BackgroundPictureConfigOptions, + BackgroundPictureHTMLData, +} from "../types"; + +export default function renderBackgroundPicture( + config: BackgroundPictureConfigOptions +): Promise; diff --git a/packages/imagetools_3/api/renderBackgroundPicture.js b/packages/imagetools_3/api/renderBackgroundPicture.js new file mode 100644 index 0000000..1eea4e1 --- /dev/null +++ b/packages/imagetools_3/api/renderBackgroundPicture.js @@ -0,0 +1,127 @@ +// @ts-check +import getImage from "./utils/getImage.js"; +import getImgElement from "./utils/getImgElement.js"; +import getLinkElement from "./utils/getLinkElement.js"; +import getStyleElement from "./utils/getStyleElement.js"; +import getLayoutStyles from "./utils/getLayoutStyles.js"; +import getFilteredProps from "./utils/getFilteredProps.js"; +import getPictureElement from "./utils/getPictureElement.js"; +import getBackgroundStyles from "./utils/getBackgroundStyles.js"; +import getContainerElement from "./utils/getContainerElement.js"; + +export default async function renderBackgroundPicture(props) { + const type = "BackgroundPicture"; + + const { filteredProps, transformConfigs } = getFilteredProps(type, props); + + const { + src, + tag, + content, + sizes, + preload, + loading, + decoding, + attributes, + placeholder, + breakpoints, + objectFit, + objectPosition, + format, + fallbackFormat, + includeSourceFormat, + formatOptions, + fadeInTransition, + artDirectives, + } = filteredProps; + + const { + img: imgAttributes = {}, + link: linkAttributes = {}, + style: styleAttributes = {}, + picture: pictureAttributes = {}, + container: containerAttributes = {}, + } = attributes; + + const { uuid, images } = await getImage({ + src, + type, + sizes, + format, + breakpoints, + placeholder, + artDirectives, + fallbackFormat, + includeSourceFormat, + formatOptions, + transformConfigs, + }); + + const className = `astro-imagetools-picture-${uuid}`, + containerClassName = `astro-imagetools-background-picture-${uuid}`; + + const { imagesizes } = images[images.length - 1]; + + const backgroundStyles = getBackgroundStyles( + images, + className, + objectFit, + objectPosition, + fadeInTransition, + { isBackgroundPicture: true, containerClassName } + ); + + const style = getStyleElement({ styleAttributes, backgroundStyles }); + + const link = getLinkElement({ images, preload, imagesizes, linkAttributes }); + + const layoutStyles = getLayoutStyles({ isBackgroundImage: true }); + + // Background Images shouldn't convey important information + const alt = ""; + + const sources = images.flatMap(({ media, sources, sizes, imagesizes }) => + sources.map(({ format, src, srcset }) => + src + ? getImgElement({ + src, + alt, + sizes, + style, + srcset, + loading, + decoding, + imagesizes, + fadeInTransition, + layoutStyles, + imgAttributes, + }) + : `` + ) + ); + + const picture = getPictureElement({ + sources, + className, + layoutStyles, + pictureAttributes, + isBackgroundPicture: true, + }); + + const htmlElement = getContainerElement({ + tag, + content: picture + content, + containerAttributes, + isBackgroundPicture: true, + containerClassName, + }); + + return { link, style, htmlElement }; +} diff --git a/packages/imagetools_3/api/renderImg.d.ts b/packages/imagetools_3/api/renderImg.d.ts new file mode 100644 index 0000000..abbc304 --- /dev/null +++ b/packages/imagetools_3/api/renderImg.d.ts @@ -0,0 +1,5 @@ +import type { ImgConfigOptions, ImgHTMLData } from "../types"; + +export default function renderImg( + config: ImgConfigOptions +): Promise; diff --git a/packages/imagetools_3/api/renderImg.js b/packages/imagetools_3/api/renderImg.js new file mode 100644 index 0000000..3bc2bf3 --- /dev/null +++ b/packages/imagetools_3/api/renderImg.js @@ -0,0 +1,93 @@ +// @ts-check +import getImage from "./utils/getImage.js"; +import getImgElement from "./utils/getImgElement.js"; +import getLinkElement from "./utils/getLinkElement.js"; +import getStyleElement from "./utils/getStyleElement.js"; +import getLayoutStyles from "./utils/getLayoutStyles.js"; +import getFilteredProps from "./utils/getFilteredProps.js"; +import getBackgroundStyles from "./utils/getBackgroundStyles.js"; + +export default async function renderImg(props) { + const type = "Img"; + + const { filteredProps, transformConfigs } = getFilteredProps(type, props); + + const { + src, + alt, + sizes, + preload, + loading, + decoding, + attributes, + layout, + breakpoints, + placeholder, + objectFit, + objectPosition, + format, + formatOptions, + } = filteredProps; + + const artDirectives = [], + fallbackFormat = format, + fadeInTransition = false, + includeSourceFormat = false; + + const { + img: imgAttributes = {}, + link: linkAttributes = {}, + style: styleAttributes = {}, + } = attributes; + + const { uuid, images } = await getImage({ + src, + type, + sizes, + format, + breakpoints, + placeholder, + artDirectives, + fallbackFormat, + includeSourceFormat, + formatOptions, + transformConfigs, + }); + + const className = `astro-imagetools-img-${uuid}`; + + const { imagesizes } = images[images.length - 1]; + const backgroundStyles = getBackgroundStyles( + images, + className, + objectFit, + objectPosition, + fadeInTransition, + { isImg: true } + ); + const style = getStyleElement({ styleAttributes, backgroundStyles }) + const link = getLinkElement({ images, preload, imagesizes, linkAttributes }) + const layoutStyles = getLayoutStyles({ layout }) + + const sources = images.flatMap(({ sources, sizes, imagesizes }) => + sources.map(({ src, srcset }) => + getImgElement({ + src, + alt, + sizes, + style, + srcset, + loading, + decoding, + imagesizes, + fadeInTransition, + layoutStyles, + imgAttributes, + imgClassName: className, + }) + ) + ) + + const [img] = sources + return { link, style, img } +} diff --git a/packages/imagetools_3/api/renderPicture.d.ts b/packages/imagetools_3/api/renderPicture.d.ts new file mode 100644 index 0000000..54ccfe5 --- /dev/null +++ b/packages/imagetools_3/api/renderPicture.d.ts @@ -0,0 +1,5 @@ +import type { PictureConfigOptions, PictureHTMLData } from "../types"; + +export default function renderPicture( + config: PictureConfigOptions +): Promise; diff --git a/packages/imagetools_3/api/renderPicture.js b/packages/imagetools_3/api/renderPicture.js new file mode 100644 index 0000000..8a98d1c --- /dev/null +++ b/packages/imagetools_3/api/renderPicture.js @@ -0,0 +1,111 @@ +// @ts-check +import getImage from "./utils/getImage.js"; +import getImgElement from "./utils/getImgElement.js"; +import getLinkElement from "./utils/getLinkElement.js"; +import getStyleElement from "./utils/getStyleElement.js"; +import getLayoutStyles from "./utils/getLayoutStyles.js"; +import getFilteredProps from "./utils/getFilteredProps.js"; +import getPictureElement from "./utils/getPictureElement.js"; +import getBackgroundStyles from "./utils/getBackgroundStyles.js"; + +export default async function renderPicture(props) { + const type = "Picture"; + + const { filteredProps, transformConfigs } = getFilteredProps(type, props); + + const { + src, + alt, + sizes, + preload, + loading, + decoding, + attributes, + layout, + placeholder, + breakpoints, + objectFit, + objectPosition, + format, + fallbackFormat, + includeSourceFormat, + formatOptions, + fadeInTransition, + artDirectives, + } = filteredProps; + + const { + img: imgAttributes = {}, + link: linkAttributes = {}, + style: styleAttributes = {}, + picture: pictureAttributes = {}, + } = attributes; + + const { uuid, images } = await getImage({ + src, + type, + sizes, + format, + breakpoints, + placeholder, + fallbackFormat, + includeSourceFormat, + formatOptions, + artDirectives, + transformConfigs, + }); + + const className = `astro-imagetools-picture-${uuid}`; + + const { imagesizes } = images[images.length - 1]; + + const backgroundStyles = getBackgroundStyles( + images, + className, + objectFit, + objectPosition, + fadeInTransition + ); + + const style = getStyleElement({ styleAttributes, backgroundStyles }); + + const link = getLinkElement({ images, preload, imagesizes, linkAttributes }); + + const layoutStyles = getLayoutStyles({ layout }); + + const sources = images.flatMap(({ media, sources, sizes, imagesizes }) => + sources.map(({ format, src, srcset }) => + src + ? getImgElement({ + src, + alt, + sizes, + style, + srcset, + loading, + decoding, + imagesizes, + fadeInTransition, + layoutStyles, + imgAttributes, + }) + : `` + ) + ); + + const picture = getPictureElement({ + sources, + className, + layoutStyles, + pictureAttributes, + }); + + return { link, style, picture }; +} diff --git a/packages/imagetools_3/api/utils/codecs.js b/packages/imagetools_3/api/utils/codecs.js new file mode 100644 index 0000000..8f72571 --- /dev/null +++ b/packages/imagetools_3/api/utils/codecs.js @@ -0,0 +1,38 @@ +// @ts-check +import fs from "node:fs"; +import { extname } from "node:path"; +import * as codecs from "@astropub/codecs"; + +export async function getImageDetails(path, width, height, aspect) { + const extension = extname(path).slice(1); + + const imageFormat = extension === "jpeg" ? "jpg" : extension; + + const buffer = fs.readFileSync(path); + const decodedImage = await codecs.jpg.decode(buffer); + + if (aspect && !width && !height) { + if (!width && !height) { + ({ width } = decodedImage); + } + + if (width) { + height = width / aspect; + } + + if (height) { + width = height * aspect; + } + } + + const image = await decodedImage.resize({ width, height }); + + const { width: imageWidth, height: imageHeight } = image; + + return { + image, + imageWidth, + imageHeight, + imageFormat, + }; +} diff --git a/packages/imagetools_3/api/utils/getArtDirectedImages.js b/packages/imagetools_3/api/utils/getArtDirectedImages.js new file mode 100644 index 0000000..1f7c073 --- /dev/null +++ b/packages/imagetools_3/api/utils/getArtDirectedImages.js @@ -0,0 +1,137 @@ +// @ts-check +import getSrcset from "./getSrcset.js"; +import getConfigOptions from "./getConfigOptions.js"; +import getFallbackImage from "./getFallbackImage.js"; +import getProcessedImage from "./getProcessedImage.js"; + +export default async function getArtDirectedImages( + artDirectives = [], + placeholder, + format, + imagesizes, + breakpoints, + fallbackFormat, + includeSourceFormat, + formatOptions, + rest +) { + const images = await Promise.all( + artDirectives.map( + async ({ + src, + media, + sizes: directiveImagesizes, + placeholder: directivePlaceholder, + breakpoints: directiveBreakpoints, + objectFit, + objectPosition, + backgroundSize, + backgroundPosition, + format: directiveFormat, + fallbackFormat: directiveFallbackFormat, + includeSourceFormat: directiveIncludeSourceFormat, + formatOptions: directiveFormatOptions = {}, + ...configOptions + }) => { + const { + path, + base, + rest: rest2, + image, + imageWidth, + imageHeight, + imageFormat, + } = await getProcessedImage(src, configOptions); + + rest2.aspect = `${imageWidth / imageHeight}`; + + const calculatedConfigs = getConfigOptions( + imageWidth, + directiveImagesizes || imagesizes, + directiveBreakpoints || breakpoints, + directiveFormat || format, + imageFormat, + directiveFallbackFormat || fallbackFormat, + directiveIncludeSourceFormat || includeSourceFormat + ); + + const { formats, requiredBreakpoints } = calculatedConfigs; + + imagesizes = calculatedConfigs.imagesizes; + + const maxWidth = requiredBreakpoints[requiredBreakpoints.length - 1]; + + const sources = await Promise.all( + formats.map(async (format) => { + const srcset = await getSrcset( + path, + base, + requiredBreakpoints, + format, + { + ...rest, + ...rest2, + ...formatOptions[format], + ...directiveFormatOptions[format], + } + ); + + return { + format, + srcset, + }; + }) + ); + + const sizes = { + width: maxWidth, + height: Math.round(maxWidth / rest2.aspect), + }; + + const object = { + fit: objectFit, + position: objectPosition, + }; + + const background = { + size: backgroundSize, + position: backgroundPosition, + }; + + const fallback = await getFallbackImage( + path, + directivePlaceholder || placeholder, + image, + imageFormat, + { ...formatOptions, ...directiveFormatOptions }, + { ...rest, ...rest2 } + ); + + const returnValue = { + media, + sources, + sizes, + fallback, + imagesizes, + }; + + const isBackgroundImage = !!backgroundSize || !!backgroundPosition; + + isBackgroundImage + ? (returnValue.background = background) + : (returnValue.object = object); + + return { + media, + sources, + sizes, + object, + fallback, + imagesizes, + }; + } + ) + ); + + return images; +} diff --git a/packages/imagetools_3/api/utils/getAttributesString.js b/packages/imagetools_3/api/utils/getAttributesString.js new file mode 100644 index 0000000..e9bd1c1 --- /dev/null +++ b/packages/imagetools_3/api/utils/getAttributesString.js @@ -0,0 +1,27 @@ +// @ts-check + +import printWarning from "../../utils/printWarning.js"; + +export default function getAttributesString({ + attributes, + element = "", + excludeArray = [], +}) { + const attributesString = Object.keys(attributes) + .filter((key) => { + if (excludeArray.includes(key)) { + printWarning({ + key, + element, + }); + + return false; + } + + return true; + }) + .map((key) => `${key}="${attributes[key]}"`) + .join(" "); + + return attributesString; +} diff --git a/packages/imagetools_3/api/utils/getBackgroundStyles.js b/packages/imagetools_3/api/utils/getBackgroundStyles.js new file mode 100644 index 0000000..111233c --- /dev/null +++ b/packages/imagetools_3/api/utils/getBackgroundStyles.js @@ -0,0 +1,97 @@ +// @ts-check + +export default function getBackgroundStyles( + images, + className, + objectFit, + objectPosition, + fadeInTransition, + { isImg = false, isBackgroundPicture = false, containerClassName = "" } = {} +) { + const sourcesWithFallback = images.filter(({ fallback }) => fallback); + + if (sourcesWithFallback.length === 0) return ""; + + const staticStyles = !fadeInTransition + ? "" + : ` + ${ + isBackgroundPicture + ? ` + .${containerClassName} * { + z-index: 1; + position: relative; + } + ` + : "" + } + + .${className} { + --opacity: 1; + --z-index: 0; + } + + ${ + !isBackgroundPicture + ? ` + .${className} img { + z-index: 1; + position: relative; + } + ` + : "" + } + + .${className}::after { + inset: 0; + content: ""; + left: 0; + width: 100%; + height: 100%; + position: absolute; + pointer-events: none; + transition: opacity ${ + typeof fadeInTransition !== "object" + ? "1s" + : (() => { + const { + delay = "0s", + duration = "1s", + timingFunction = "ease", + } = fadeInTransition; + + return `${duration} ${timingFunction} ${delay}`; + })() + }; + opacity: var(--opacity); + z-index: var(--z-index); + } + `; + + const dynamicStyles = images + .map(({ media, fallback, object }) => { + const elementSelector = className + (!isImg ? " img" : ""), + backgroundElementSelector = + className + (fadeInTransition ? "::after" : ""); + + const style = ` + .${elementSelector} { + object-fit: ${object?.fit || objectFit}; + object-position: ${object?.position || objectPosition}; + } + + .${backgroundElementSelector} { + background-size: ${object?.fit || objectFit}; + background-image: url("${encodeURI(fallback)}"); + background-position: ${object?.position || objectPosition}; + } + `; + + return media ? `@media ${media} { ${style} }` : style; + }) + .reverse(); + + const backgroundStyles = [staticStyles, ...dynamicStyles].join(""); + + return backgroundStyles; +} diff --git a/packages/imagetools_3/api/utils/getBreakpoints.js b/packages/imagetools_3/api/utils/getBreakpoints.js new file mode 100644 index 0000000..02a098e --- /dev/null +++ b/packages/imagetools_3/api/utils/getBreakpoints.js @@ -0,0 +1,77 @@ +// @ts-check +import printWarning from "../../utils/printWarning.js"; + +export default function getBreakpoints(breakpoints, imageWidth) { + if (Array.isArray(breakpoints)) { + return breakpoints.sort((a, b) => a - b); + } + + const { count, minWidth = 320 } = breakpoints || {}; + + const maxWidth = (() => { + if (breakpoints?.maxWidth) return breakpoints.maxWidth; + + if (imageWidth > 3840) { + printWarning({ + message: + "The width of the source image is greater than 3840px. The generated breakpoints will be capped at 3840px. If you need breakpoints larger than this, please pass the maxWidth option to the breakpoints property.", + }); + + return 3840; + } + + return imageWidth; + })(); + + const breakPoints = []; + + const diff = maxWidth - minWidth; + + const n = + count || + (maxWidth <= 400 + ? 1 + : maxWidth <= 640 + ? 2 + : maxWidth <= 800 + ? 3 + : maxWidth <= 1024 + ? 4 + : maxWidth <= 1280 + ? 5 + : maxWidth <= 1440 + ? 6 + : maxWidth <= 1920 + ? 7 + : maxWidth <= 2560 + ? 8 + : maxWidth <= 2880 + ? 9 + : maxWidth <= 3840 + ? 10 + : 11); + + let currentWidth = minWidth; + + n > 1 && breakPoints.push(currentWidth); + + let steps = 0; + + for (let i = 1; i < n; i++) { + steps += i; + } + + const pixelsPerStep = diff / steps; + + for (let i = 1; i < n - 1; i++) { + const next = pixelsPerStep * (n - i) + currentWidth; + + breakPoints.push(Math.round(next)); + + currentWidth = next; + } + + breakPoints.push(maxWidth); + + return [...new Set(breakPoints)]; +} diff --git a/packages/imagetools_3/api/utils/getConfigOptions.js b/packages/imagetools_3/api/utils/getConfigOptions.js new file mode 100644 index 0000000..3b3797d --- /dev/null +++ b/packages/imagetools_3/api/utils/getConfigOptions.js @@ -0,0 +1,34 @@ +// @ts-check +import getBreakpoints from "./getBreakpoints.js"; + +export default function getConfigOptions( + imageWidth, + imagesizes, + breakpoints, + format, + imageFormat, + fallbackFormat, + includeSourceFormat +) { + const formats = [ + ...new Set( + [format, includeSourceFormat && imageFormat] + .flat() + .filter((f) => f && f !== fallbackFormat) + ), + fallbackFormat, + ]; + + const requiredBreakpoints = getBreakpoints(breakpoints, imageWidth); + + imagesizes = + typeof imagesizes === "string" + ? imagesizes + : imagesizes(requiredBreakpoints); + + return { + formats, + imagesizes, + requiredBreakpoints, + }; +} diff --git a/packages/imagetools_3/api/utils/getContainerElement.js b/packages/imagetools_3/api/utils/getContainerElement.js new file mode 100644 index 0000000..9c5b710 --- /dev/null +++ b/packages/imagetools_3/api/utils/getContainerElement.js @@ -0,0 +1,48 @@ +// @ts-check +import getAttributesString from "./getAttributesString.js"; + +export default function getContainerElement({ + tag, + content, + className = "", + containerAttributes, + isBackgroundPicture = false, + containerClassName = "", +}) { + const { + class: customClasses = "", + style: customInlineStyles = "", + ...restContainerAttributes + } = containerAttributes; + + const attributesString = getAttributesString({ + attributes: restContainerAttributes, + }); + + const classAttribute = [ + isBackgroundPicture + ? "astro-imagetools-background-picture" + : "astro-imagetools-background-image", + isBackgroundPicture ? containerClassName : className, + customClasses, + ] + .join(" ") + .trim(); + + const styleAttribute = [ + isBackgroundPicture ? "position: relative;" : "", + customInlineStyles + (customInlineStyles.endsWith(";") ? "" : ";"), + ] + .join(" ") + .trim(); + + const containerElement = `<${tag} + ${attributesString} + class="${classAttribute}" + style="${styleAttribute}" + > + ${content} + `; + + return containerElement; +} diff --git a/packages/imagetools_3/api/utils/getFallbackImage.js b/packages/imagetools_3/api/utils/getFallbackImage.js new file mode 100644 index 0000000..b085286 --- /dev/null +++ b/packages/imagetools_3/api/utils/getFallbackImage.js @@ -0,0 +1,58 @@ +// @ts-check + +import util from "node:util"; +import potrace from "potrace"; +import getSrcset from "./getSrcset.js"; +import { sharp } from "../../utils/runtimeChecks.js"; + +export default async function getFallbackImage( + src, + placeholder, + image, + format, + formatOptions, + rest +) { + const base = null; + + switch (placeholder) { + case "blurred": { + const dataUri = await getSrcset(src, base, [20], format, { + inline: true, + ...rest, + ...formatOptions[format], + }); + + return dataUri; + } + case "tracedSVG": { + const { function: fn, options } = formatOptions.tracedSVG; + + const traceSVG = util.promisify(potrace[fn]); + + const imageBuffer = sharp + ? await image.toBuffer() + : Buffer.from( + (await image.encode(`image/${format === "jpg" ? "jpeg" : format}`)) + .data + ); + + const tracedSVG = await traceSVG(imageBuffer, options); + + return `data:image/svg+xml;utf8,${tracedSVG}`; + } + case "dominantColor": { + if (sharp) { + var { r, g, b } = (await image.stats()).dominant; + } else { + [r, g, b] = image.color; + } + + const svg = ``; + + return `data:image/svg+xml;utf8,${svg}`; + } + default: + return null; + } +} diff --git a/packages/imagetools_3/api/utils/getFilteredProps.js b/packages/imagetools_3/api/utils/getFilteredProps.js new file mode 100644 index 0000000..9c791ba --- /dev/null +++ b/packages/imagetools_3/api/utils/getFilteredProps.js @@ -0,0 +1,138 @@ +// @ts-check +import filterConfigs from "../../utils/filterConfigs.js"; +import { + supportedConfigs, + GlobalConfigOptions, +} from "../../utils/runtimeChecks.js"; + +const GlobalOnlyProperties = ["cacheDir", "assetFileNames"]; + +const NonGlobalSupportedConfigs = supportedConfigs.filter( + (key) => !GlobalOnlyProperties.includes(key) +); + +const NonProperties = { + Img: [ + "tag", + "content", + "backgroundSize", + "backgroundPosition", + "fallbackFormat", + "includeSourceFormat", + "fadeInTransition", + "artDirectives", + ], + Picture: ["tag", "content", "backgroundSize", "backgroundPosition"], + BackgroundImage: [ + "alt", + "loading", + "decoding", + "layout", + "objectFit", + "objectPosition", + "fadeInTransition", + ], + BackgroundPicture: ["alt", "backgroundSize", "backgroundPosition"], +}; + +const ImgProperties = NonGlobalSupportedConfigs.filter( + (key) => !NonProperties.Img.includes(key) + ), + PictureProperties = NonGlobalSupportedConfigs.filter( + (key) => !NonProperties.Picture.includes(key) + ), + BackgroundImageProperties = NonGlobalSupportedConfigs.filter( + (key) => !NonProperties.BackgroundImage.includes(key) + ), + BackgroundPictureProperties = NonGlobalSupportedConfigs.filter( + (key) => !NonProperties.BackgroundPicture.includes(key) + ); + +const SupportedProperties = { + Img: ImgProperties, + Picture: PictureProperties, + BackgroundImage: BackgroundImageProperties, + BackgroundPicture: BackgroundPictureProperties, +}; + +export default function getFilteredProps(type, props) { + const filteredGlobalConfigs = filterConfigs( + "Global", + GlobalConfigOptions, + SupportedProperties[type], + { warn: false } + ); + + const { search, searchParams } = new URL(props.src, "file://"); + + props.src = props.src.replace(search, ""); + + const paramOptions = Object.fromEntries(searchParams); + + const filteredLocalProps = filterConfigs( + type, + { + ...paramOptions, + ...props, + }, + SupportedProperties[type] + ); + + const resolvedProps = { + ...filteredGlobalConfigs, + ...filteredLocalProps, + }; + + const { + src, + alt, + tag = "section", + content = "", + sizes = function (breakpoints) { + const maxWidth = breakpoints[breakpoints.length - 1]; + return `(min-width: ${maxWidth}px) ${maxWidth}px, 100vw`; + }, + preload, + loading = preload ? "eager" : "lazy", + decoding = "async", + attributes = {}, + layout = "constrained", + placeholder = "blurred", + breakpoints, + objectFit = "cover", + objectPosition = "50% 50%", + backgroundSize = "cover", + backgroundPosition = "50% 50%", + format = type === "Img" ? undefined : ["avif", "webp"], + fallbackFormat, + includeSourceFormat = true, + formatOptions = { + tracedSVG: { + function: "trace", + }, + }, + fadeInTransition = true, + artDirectives, + ...transformConfigs + } = resolvedProps; + + // prettier-ignore + const allProps = { + src, alt, tag, content, sizes, preload, loading, decoding, attributes, layout, placeholder, + breakpoints, objectFit, objectPosition, backgroundSize, backgroundPosition, format, + fallbackFormat, includeSourceFormat, formatOptions, fadeInTransition, artDirectives, + ...transformConfigs, + }; + + const filteredProps = filterConfigs( + type, + allProps, + SupportedProperties[type], + { warn: false } + ); + + return { + filteredProps, + transformConfigs, + }; +} diff --git a/packages/imagetools_3/api/utils/getFilteredProps.test.ts b/packages/imagetools_3/api/utils/getFilteredProps.test.ts new file mode 100644 index 0000000..7b8f20c --- /dev/null +++ b/packages/imagetools_3/api/utils/getFilteredProps.test.ts @@ -0,0 +1,49 @@ +import { describe, expect, it } from "vitest"; +import getFilteredProps from "./getFilteredProps"; + +describe("getFilteredProps", () => { + it("should should merge in default props", () => { + const result = getFilteredProps("Img", { src: "/img.jpeg", alt: "alt" }); + expect(result).toEqual({ + filteredProps: { + alt: "alt", + attributes: {}, + breakpoints: undefined, + decoding: "async", + format: undefined, + formatOptions: { + tracedSVG: { + function: "trace", + }, + }, + layout: "constrained", + loading: "lazy", + objectFit: "cover", + objectPosition: "50% 50%", + placeholder: "blurred", + preload: undefined, + sizes: expect.any(Function), + src: "/img.jpeg", + }, + transformConfigs: {}, + }); + }); + + it("should accept empty string for `alt` prop on Img", () => { + const result = getFilteredProps("Img", { src: "/img.jpeg", alt: "" }); + expect(result).toMatchObject({ + filteredProps: { + alt: "", + }, + }); + }); + + it("should accept empty string for `alt` prop on Picture", () => { + const result = getFilteredProps("Picture", { src: "/img.jpeg", alt: "" }); + expect(result).toMatchObject({ + filteredProps: { + alt: "", + }, + }); + }); +}); diff --git a/packages/imagetools_3/api/utils/getImage.js b/packages/imagetools_3/api/utils/getImage.js new file mode 100644 index 0000000..e385ba1 --- /dev/null +++ b/packages/imagetools_3/api/utils/getImage.js @@ -0,0 +1,111 @@ +// @ts-check +import crypto from "node:crypto"; +import objectHash from "object-hash"; +import getImageSources from "./getImageSources.js"; +import getProcessedImage from "./getProcessedImage.js"; +import getArtDirectedImages from "./getArtDirectedImages.js"; +import pMap from "p-map"; +// Caching moved to plugin level for proper store population + +const imagesData = new Map(); + +const delay = (ms) => new Promise((resolve) => setTimeout(resolve, ms)); + +// Cache helpers moved to plugin level + +export default async function ({ + src, + type, + sizes: imagesizes, + format, + breakpoints, + placeholder, + fallbackFormat, + includeSourceFormat, + formatOptions, + artDirectives, + transformConfigs, +}) { + try { + const args = Array.from(arguments); + const hash = objectHash(args); + + // Check in-memory cache first + if (imagesData.has(hash)) { + return imagesData.get(hash); + } + + // Caching removed from this level to ensure proper Vite store population + // Cache is now handled at the plugin level where it can properly manage the store + + const start = performance.now(); + + const { path, base, rest, image, imageWidth, imageHeight, imageFormat } = + await getProcessedImage(src, transformConfigs); + + src = path; + + rest.aspect = `${imageWidth / imageHeight}`; + if (!fallbackFormat) { + fallbackFormat = imageFormat; + } + + // Fetch both image sources and art-directed images + const [mainImage, artDirectedImages] = await pMap( + [ + async () => + await getImageSources( + src, + base, + image, + format, + imageWidth, + imagesizes, + breakpoints, + placeholder, + imageFormat, + formatOptions, + fallbackFormat, + includeSourceFormat, + rest + ), + async () => { + return await getArtDirectedImages( + artDirectives, + placeholder, + format, + imagesizes, + breakpoints, + fallbackFormat, + includeSourceFormat, + formatOptions, + rest + ); + }, + ], + async (task) => await task(), + { concurrency: 1 } + ); + + // Ensure artDirectedImages is an array + const images = Array.isArray(artDirectedImages) ? [...artDirectedImages, mainImage] : [mainImage]; + + // Create deterministic UUID based on input hash for consistent caching + const uuid = crypto.createHash('md5').update(hash).digest("hex").slice(0, 8).toUpperCase(); + + const returnObject = { + uuid, + images, + }; + + // Cache only in memory at this level + imagesData.set(hash, returnObject); + + // Persistent caching moved to plugin level for proper store management + + return returnObject; + } catch (error) { + console.error(`Error processing images:: ${src}`, error, error.stack); + throw error; + } +} diff --git a/packages/imagetools_3/api/utils/getImageSources.js b/packages/imagetools_3/api/utils/getImageSources.js new file mode 100644 index 0000000..d0dca00 --- /dev/null +++ b/packages/imagetools_3/api/utils/getImageSources.js @@ -0,0 +1,91 @@ +// @ts-check +import getSrcset from "./getSrcset.js"; +import getConfigOptions from "./getConfigOptions.js"; +import getFallbackImage from "./getFallbackImage.js"; +import pMap from "p-map"; + +function delay(ms) { + return new Promise((resolve) => setTimeout(resolve, ms)); +} + +export default async function getImageSources( + src, + base, + image, + format, + imageWidth, + imagesizes, + breakpoints, + placeholder, + imageFormat, + formatOptions, + fallbackFormat, + includeSourceFormat, + rest +) { + try { + const calculatedConfigs = getConfigOptions( + imageWidth, + imagesizes, + breakpoints, + format, + imageFormat, + fallbackFormat, + includeSourceFormat + ); + + const { formats, requiredBreakpoints } = calculatedConfigs; + imagesizes = calculatedConfigs.imagesizes; + const maxWidth = requiredBreakpoints[requiredBreakpoints.length - 1]; + const sliceLength = -(maxWidth.toString().length + 2); + + const sources = await pMap( + formats, + async (format) => { + try { + await delay(250); + const srcset = await getSrcset(src, base, requiredBreakpoints, format, { + ...rest, + ...formatOptions[format], + }); + + const srcsets = srcset.split(", "); + const srcObject = + format === fallbackFormat + ? { src: srcsets[srcsets.length - 1].slice(0, sliceLength) } + : {}; + + return { + ...srcObject, + format, + srcset, + }; + } catch (error) { + console.error(`Error processing format ${format}:`, error); + return null; + } + }, + { concurrency: 1 } + ); + + const filteredSources = sources.filter(Boolean); + + const sizes = { + width: maxWidth, + height: Math.round(maxWidth / rest.aspect), + }; + + const fallback = await getFallbackImage( + src, + placeholder, + image, + fallbackFormat, + formatOptions, + rest + ) + return { sources: filteredSources, sizes, fallback, imagesizes }; + } catch (error) { + console.error("Error in getImageSources:", error); + return { sources: [], sizes: {}, fallback: null, imagesizes: null }; + } +} diff --git a/packages/imagetools_3/api/utils/getImgElement.js b/packages/imagetools_3/api/utils/getImgElement.js new file mode 100644 index 0000000..fea4109 --- /dev/null +++ b/packages/imagetools_3/api/utils/getImgElement.js @@ -0,0 +1,80 @@ +// @ts-check + +import getAttributesString from "./getAttributesString.js"; + +export default function getImgElement({ + src, + alt, + sizes, + style, + srcset, + loading, + decoding, + imagesizes, + fadeInTransition, + layoutStyles, + imgAttributes, + imgClassName = "", +}) { + const { + class: customClasses = "", + style: customInlineStyles = "", + onload: customOnload = "", + ...restImgAttributes + } = imgAttributes; + + const attributesString = getAttributesString({ + attributes: restImgAttributes, + element: "img", + excludeArray: [ + "src", + "alt", + "srcset", + "sizes", + "width", + "height", + "loading", + "decoding", + ], + }); + + const classAttribute = ["astro-imagetools-img", imgClassName, customClasses] + .join(" ") + .trim(); + + const styleAttribute = [ + "display: inline-block; overflow: hidden; vertical-align: middle;", + customInlineStyles + (customInlineStyles.endsWith(";") ? "" : ";"), + layoutStyles, + ] + .join(" ") + .trim(); + + const onloadAttribute = [ + !imgClassName && style + ? fadeInTransition + ? `parentElement.style.setProperty('--z-index', 1); parentElement.style.setProperty('--opacity', 0);` + : `parentElement.style.backgroundImage = 'unset';` + : "", + customOnload, + ] + .join(" ") + .trim(); + + const imgElement = `==`; + + return imgElement; +} diff --git a/packages/imagetools_3/api/utils/getLayoutStyles.js b/packages/imagetools_3/api/utils/getLayoutStyles.js new file mode 100644 index 0000000..efa6d96 --- /dev/null +++ b/packages/imagetools_3/api/utils/getLayoutStyles.js @@ -0,0 +1,16 @@ +// @ts-check + +export default function getLayoutStyles({ + layout = null, + isBackgroundImage = false, +}) { + return isBackgroundImage + ? "width: 100%; height: 100%;" + : layout === "fill" + ? `width: 100%; height: 100%;` + : layout === "fullWidth" + ? `width: 100%; height: auto;` + : layout === "fixed" + ? "" + : "max-width: 100%; height: auto;"; +} diff --git a/packages/imagetools_3/api/utils/getLinkElement.js b/packages/imagetools_3/api/utils/getLinkElement.js new file mode 100644 index 0000000..2fcfb7a --- /dev/null +++ b/packages/imagetools_3/api/utils/getLinkElement.js @@ -0,0 +1,34 @@ +// @ts-check +import getAttributesString from "./getAttributesString.js"; + +export default function getLinkElement({ + images = [], + preload = "", + imagesizes = "", + linkAttributes, +}) { + const imagesrcset = + preload && + images[images.length - 1]?.sources.find( + ({ format: fmt }) => fmt === preload + )?.srcset; + + const attributesString = getAttributesString({ + element: "link", + attributes: linkAttributes, + excludeArray: ["as", "rel", "imagesizes", "imagesrcset"], + }); + + const linkElement = + preload && images.length + ? `` + : ""; + + return linkElement; +} diff --git a/packages/imagetools_3/api/utils/getLinkElement.test.ts b/packages/imagetools_3/api/utils/getLinkElement.test.ts new file mode 100644 index 0000000..83d435a --- /dev/null +++ b/packages/imagetools_3/api/utils/getLinkElement.test.ts @@ -0,0 +1,14 @@ +import { describe, expect, it } from "vitest"; +import getLinkElement from "./getLinkElement"; + +describe("getLinkElement", () => { + it("returns an empty string if preload is not set", () => { + const result = getLinkElement({ linkAttributes: {} }); + expect(result).toBe(""); + }); + + it("returns an empty string if no images are provided", () => { + const result = getLinkElement({ linkAttributes: {}, preload: "webp" }); + expect(result).toBe(""); + }); +}); diff --git a/packages/imagetools_3/api/utils/getPictureElement.js b/packages/imagetools_3/api/utils/getPictureElement.js new file mode 100644 index 0000000..b0d62c3 --- /dev/null +++ b/packages/imagetools_3/api/utils/getPictureElement.js @@ -0,0 +1,43 @@ +// @ts-check +import getAttributesString from "./getAttributesString.js"; + +export default function getPictureElement({ + sources, + className, + layoutStyles, + pictureAttributes, + isBackgroundPicture = false, +}) { + const { + class: customClasses = "", + style: customInlineStyles = "", + ...restPictureAttributes + } = pictureAttributes; + + const attributesString = getAttributesString({ + attributes: restPictureAttributes, + }); + + const classAttribute = ["astro-imagetools-picture", className, customClasses] + .join(" ") + .trim(); + + const styleAttribute = [ + isBackgroundPicture + ? `position: absolute; z-index: 0; width: 100%; height: 100%; display: inline-block;` + : `position: relative; display: inline-block;`, + customInlineStyles + (customInlineStyles.endsWith(";") ? "" : ";"), + layoutStyles, + ] + .join(" ") + .trim(); + + const pictureElement = `${sources.join("\n")} + `; + + return pictureElement; +} diff --git a/packages/imagetools_3/api/utils/getProcessedImage.js b/packages/imagetools_3/api/utils/getProcessedImage.js new file mode 100644 index 0000000..0823eb6 --- /dev/null +++ b/packages/imagetools_3/api/utils/getProcessedImage.js @@ -0,0 +1,65 @@ +// @ts-check +import { fileURLToPath } from "node:url"; +import { extname, relative, resolve } from "node:path"; + +import { getSrcPath } from "./getSrcPath.js"; +import getResolvedSrc from "./getResolvedSrc.js"; +import { cwd, sharp } from "../../utils/runtimeChecks.js"; +import throwErrorIfUnsupported from "./throwErrorIfUnsupported.js"; + +const { getImageDetails } = await (sharp + ? import("./imagetools.js") + : import("./codecs.js")); + +export default async function getProcessedImage(src, transformConfigs) { + throwErrorIfUnsupported(src, extname(src).slice(1)); + + if(src.includes('nature')) { + // debugger + } + let base; + + if (src.match("(http://|https://|data:image/).*")) { + ({ src, base } = await getResolvedSrc(src)); + } else { + const { + default: { isSsrBuild }, + } = await import("../../astroViteConfigs.js"); + + if (isSsrBuild) { + const filename = fileURLToPath(import.meta.url); + const assetPath = resolve(filename, "../../client") + src; + + src = "/" + relative(cwd, assetPath); + } + } + + const { + w, + h, + ar, + width = w, + height = h, + aspect = ar, + ...rest + } = transformConfigs; + + const path = src.replace(/\\/g, `/`); + + const { image, imageWidth, imageHeight, imageFormat } = await getImageDetails( + await getSrcPath(src), + width, + height, + aspect + ); + + return { + path, + base, + rest, + image, + imageWidth, + imageHeight, + imageFormat, + }; +} diff --git a/packages/imagetools_3/api/utils/getResolvedSrc.js b/packages/imagetools_3/api/utils/getResolvedSrc.js new file mode 100644 index 0000000..b712da7 --- /dev/null +++ b/packages/imagetools_3/api/utils/getResolvedSrc.js @@ -0,0 +1,210 @@ +// @ts-check +import fs from "node:fs"; +import crypto from "node:crypto"; +import http from "node:http"; +import https from "node:https"; +import pTimeout from "p-timeout"; +import { join, parse, relative } from "node:path"; +import throwErrorIfUnsupported from "./throwErrorIfUnsupported.js"; + +function getDefaultImage() { + const filepath = join(cwd, "public", "images", "default.png"); + const src = join("/", relative(cwd, filepath)); + return { src, base: "default" }; +} +import { + cwd, + fsCachePath, + supportedImageTypes, +} from "../../utils/runtimeChecks.js"; + +const { fileTypeFromBuffer } = await import("file-type"); + +const defaults = { + maxRedirects: 10, + retries: 2, + baseDelay: 100, + maxTotalTime: 5000, + devTimeout: 20000, +}; + +class NetworkError extends Error { + code; + + constructor(message, code) { + super(message); + this.code = code; + } +} + +function fetchWithRedirects(urlString, options, currentRedirects = 0) { + return new Promise((resolve, reject) => { + if (currentRedirects > options.maxRedirects) { + return reject(new Error("Too many redirects")); + } + + const url = new URL(urlString); + const get = url.protocol === "https:" ? https.get : http.get; + + const req = get(url, (response) => { + if ( + response.statusCode && + response.statusCode >= 300 && + response.statusCode < 400 && + response.headers.location + ) { + response.resume(); // consume data to free up memory + const redirectUrl = new URL(response.headers.location, url).toString(); + fetchWithRedirects(redirectUrl, options, currentRedirects + 1) + .then(resolve) + .catch(reject); + } else { + if (response.statusCode && response.statusCode >= 400) { + response.resume(); // consume data to free up memory + return reject( + new NetworkError( + `Server responded with status code ${response.statusCode}`, + "EHTTP" + ) + ); + } + + const contentType = response.headers["content-type"]; + if (!contentType || !contentType.startsWith("image/")) { + response.resume(); // consume data to free up memory + return reject( + new NetworkError( + `Invalid content type: ${contentType}. Expected an image.`, + "EINVALIDCONTENT" + ) + ); + } + + // Mimic Fetch API's Response object + resolve({ + arrayBuffer: () => + new Promise((resolveBody, rejectBody) => { + const chunks = []; + response.on("data", (chunk) => chunks.push(chunk)); + response.on("end", () => resolveBody(Buffer.concat(chunks))); + response.on("error", (err) => rejectBody(err)); + }), + }); + } + }); + + req.on("error", (err) => { + reject(err); + }); + }); +} + +// Retry mechanism with exponential backoff +async function retryWithBackoff(fn, options) { + const isDev = process.env.NODE_ENV === "development"; + const timeout = isDev ? options.devTimeout : options.maxTotalTime; + + const promise = (async () => { + for (let i = 0; i < options.retries; i++) { + try { + return await fn(); + } catch (error) { + if (i === options.retries - 1) { + throw error; // Last attempt failed + } + // Check if it's a file system error that we should retry + const isRetryableError = + error.code === "EBUSY" || + error.code === "ENOENT" || + error.code === "EPERM" || + error.errno === -4094 || // UNKNOWN error on Windows + error.message.includes("UNKNOWN: unknown error"); + + if (!isRetryableError) { + throw error; // Don't retry non-transient errors + } + + const delay = options.baseDelay * Math.pow(2, i); // Exponential backoff + console.warn( + `Retry attempt ${ + i + 1 + }/${options.retries} for file operation after ${delay}ms delay:`, + error.message + ); + await new Promise((res) => setTimeout(res, delay)); + } + } + })(); + + return pTimeout(promise, { milliseconds: timeout }); +} + +export default async function getResolvedSrc(src, options = {}) { + const mergedOptions = { ...defaults, ...options }; + + try { + const token = crypto.createHash("md5").update(src).digest("hex"); + let filepath = fsCachePath + token; + + const fileExists = await retryWithBackoff(() => { + for (const type of supportedImageTypes) { + const fileExists = fs.existsSync(filepath + `.${type}`); + + if (fileExists) { + filepath += `.${type}`; + return true; + } + } + return false; + }, mergedOptions); + + if (!fileExists) { + const buffer = Buffer.from( + await (await fetchWithRedirects(src, mergedOptions)).arrayBuffer() + ); + + let { ext } = (await fileTypeFromBuffer(buffer)) || {}; + + if (!ext) { + const url = new URL(src); + ext = url.pathname.split(".").pop(); + } + + throwErrorIfUnsupported(src, ext); + + filepath += `.${ext}`; + + // Use retry mechanism for file write operations + await retryWithBackoff(() => { + return new Promise((resolve, reject) => { + try { + fs.writeFileSync(filepath, buffer); + resolve(undefined); + } catch (error) { + reject(error); + } + }); + }, mergedOptions); + } + + const base = /^https?:/.test(src) + ? parse(new URL(src).pathname).name + : undefined; + + const resolvedSrc = join("/", relative(cwd, filepath)); + + return { src: resolvedSrc, base }; + } catch (error) { + if ( + error.code === "ENOTFOUND" || + error.code === "EHTTP" || + error.code === "EINVALIDCONTENT" + ) { + console.error( + `Failed to fetch ${src}: ${error.message}. Using default image.` + ); + return getDefaultImage(); + } + throw error; + } +} diff --git a/packages/imagetools_3/api/utils/getSrcPath.js b/packages/imagetools_3/api/utils/getSrcPath.js new file mode 100644 index 0000000..3a7a7da --- /dev/null +++ b/packages/imagetools_3/api/utils/getSrcPath.js @@ -0,0 +1,32 @@ +import fs from "node:fs"; +import path from "node:path"; + +// To strip off params when checking for file on disk. +const paramPattern = /\?.*/; + +/** + * getSrcPath allows the use of `src` attributes relative to either the public folder or project root. + * + * It first checks to see if the src is a file relative to the project root. + * If the file isn't found, it will look in the public folder. + * Finally, if it still can't be found, the original input will be returned. + */ +export async function getSrcPath(src) { + const { default: astroViteConfigs } = await import( + "../../astroViteConfigs.js" + ); + + // If this is already resolved to a file, return it. + if (fs.existsSync(src.replace(paramPattern, ""))) return src; + + const rootPath = path.join(astroViteConfigs.rootDir, src); + const rootTest = rootPath.replace(paramPattern, ""); + if (fs.existsSync(rootTest)) return rootPath; + + const publicPath = path.join(astroViteConfigs.publicDir, src); + const publicTest = publicPath.replace(paramPattern, ""); + if (fs.existsSync(publicTest)) return publicPath; + + // Fallback + return src; +} diff --git a/packages/imagetools_3/api/utils/getSrcPath.test.ts b/packages/imagetools_3/api/utils/getSrcPath.test.ts new file mode 100644 index 0000000..bb267dd --- /dev/null +++ b/packages/imagetools_3/api/utils/getSrcPath.test.ts @@ -0,0 +1,67 @@ +import path from "node:path"; +import { describe, expect, it, afterAll, vi } from "vitest"; +import { getSrcPath } from "./getSrcPath"; + +vi.mock("../../astroViteConfigs.js", () => { + return { + default: { + rootDir: buildPath(), + // Custom publicDir + publicDir: buildPath("out"), + }, + }; +}); + +/** + * Build an absolute path to the target in the fixture directory + */ +function buildPath(target = "") { + return path.resolve(__dirname, "../../test-fixtures/getSrcPath", target); +} + +describe("getLinkElement", () => { + afterAll(() => { + vi.unmock("../../astroViteConfigs.js"); + }); + + it("finds a file in the root of the project", async () => { + const result = await getSrcPath("root.jpeg"); + expect(result).toBe(buildPath("root.jpeg")); + }); + + it("finds a file in the public folder", async () => { + const result = await getSrcPath("out.jpeg"); + expect(result).toBe(buildPath("out/out.jpeg")); + }); + + it("returns an absolute path unchanged, if it exists", async () => { + const result = await getSrcPath(buildPath("out/out.jpeg")); + expect(result).toBe(buildPath("out/out.jpeg")); + }); + + it("handles query parameters", async () => { + const result = await getSrcPath("root.jpeg?w=200"); + expect(result).toBe(buildPath("root.jpeg?w=200")); + }); + + it("handles query parameters for public-resolved files", async () => { + const result = await getSrcPath("out.jpeg?w=200"); + expect(result).toBe(buildPath("out/out.jpeg?w=200")); + }); + + it("returns the original input if the file is not found", async () => { + const result = await getSrcPath( + "https://cdn.nedis.com/images/products_high_res/TVRC2080BK_P30.JPG" + ); + expect(result).toBe( + "https://cdn.nedis.com/images/products_high_res/TVRC2080BK_P30.JPG" + ); + }); + + it("finds relative paths correctly", async () => { + const outResult = await getSrcPath("./out/out.jpeg"); + const rootResult = await getSrcPath("./root.jpeg"); + expect(outResult).toBe(buildPath("out/out.jpeg")); + expect(rootResult).toBe(buildPath("root.jpeg")); + }); +}); diff --git a/packages/imagetools_3/api/utils/getSrcset.js b/packages/imagetools_3/api/utils/getSrcset.js new file mode 100644 index 0000000..cbd2990 --- /dev/null +++ b/packages/imagetools_3/api/utils/getSrcset.js @@ -0,0 +1,39 @@ +// @ts-check +import { getSrcPath } from "./getSrcPath.js"; + +export default async function getSrcset( + src, + base, + breakpoints, + format, + options +) { + options = { + format, + w: breakpoints, + ...options, + }; + + const keys = Object.keys(options); + + const params = keys.length + ? keys + .map((key) => + Array.isArray(options[key]) + ? `&${key}=${options[key].join(";")}` + : `&${key}=${options[key]}` + ) + .join("") + : ""; + + const id = `${src}?${params.slice(1)}`; + + const fullPath = await getSrcPath(id); + + const { default: load } = await import("../../plugin/hooks/load.js"); + + // @ts-ignore + const srcset = (await load(fullPath, base)).slice(16, -1); + + return srcset; +} diff --git a/packages/imagetools_3/api/utils/getStyleElement.js b/packages/imagetools_3/api/utils/getStyleElement.js new file mode 100644 index 0000000..30ad4d7 --- /dev/null +++ b/packages/imagetools_3/api/utils/getStyleElement.js @@ -0,0 +1,15 @@ +// @ts-check +import getAttributesString from "./getAttributesString.js"; + +export default function getStyleElement({ + styleAttributes, + backgroundStyles = "", +}) { + const attributesString = getAttributesString({ + attributes: styleAttributes, + }); + + const styleElement = ``; + + return styleElement; +} diff --git a/packages/imagetools_3/api/utils/imagetools.js b/packages/imagetools_3/api/utils/imagetools.js new file mode 100644 index 0000000..530abd1 --- /dev/null +++ b/packages/imagetools_3/api/utils/imagetools.js @@ -0,0 +1,40 @@ +// @ts-check +import { + builtins, + loadImage, + applyTransforms, + generateTransforms, +} from "imagetools-core"; +export { + loadImage +} from "imagetools-core"; +export async function getImageDetails(path, width, height, aspect) { + const loadedImage = loadImage(path); + + if (aspect && !width && !height) { + if (!width && !height) { + ({ width } = await loadedImage.metadata()); + } + + if (width) { + height = width / aspect; + } + + if (height) { + width = height * aspect; + } + } + + const { image, metadata } = await applyTransforms( + generateTransforms({ width, height }, builtins).transforms, + loadedImage + ); + + const { + width: imageWidth, + height: imageHeight, + format: imageFormat, + } = metadata; + + return { image, imageWidth, imageHeight, imageFormat }; +} diff --git a/packages/imagetools_3/api/utils/throwErrorIfUnsupported.js b/packages/imagetools_3/api/utils/throwErrorIfUnsupported.js new file mode 100644 index 0000000..581ca16 --- /dev/null +++ b/packages/imagetools_3/api/utils/throwErrorIfUnsupported.js @@ -0,0 +1,14 @@ +// @ts-check +import { supportedImageTypes } from "../../utils/runtimeChecks.js"; + +export default function throwErrorIfUnsupported(src, ext) { + if (!ext && typeof ext !== "string") { + throw new Error(`Failed to load ${src}; Invalid image format`); + } + + if (ext && !supportedImageTypes.includes(ext.toLowerCase())) { + throw new Error( + `Failed to load ${src}; Invalid image format ${ext} or the format is not supported by astro-imagetools` + ); + } +} diff --git a/packages/imagetools_3/astroViteConfigs.js b/packages/imagetools_3/astroViteConfigs.js new file mode 100644 index 0000000..7bc05a5 --- /dev/null +++ b/packages/imagetools_3/astroViteConfigs.js @@ -0,0 +1,12 @@ +export default { + "environment": "dev", + "isSsrBuild": false, + "projectBase": "", + "publicDir": "C:\\Users\\zx\\Desktop\\polymech\\site-min\\public\\", + "rootDir": "C:\\Users\\zx\\Desktop\\polymech\\site-min\\", + "mode": "dev", + "outDir": "dist", + "assetsDir": "/_astro", + "sourcemap": false, + "assetFileNames": "/_astro/[name]@[width].[hash][extname]" +} \ No newline at end of file diff --git a/packages/imagetools_3/components/BackgroundImage.astro b/packages/imagetools_3/components/BackgroundImage.astro new file mode 100644 index 0000000..47d2b44 --- /dev/null +++ b/packages/imagetools_3/components/BackgroundImage.astro @@ -0,0 +1,46 @@ +--- +import renderBackgroundImage from "../api/renderBackgroundImage.js"; +import type { BackgroundImageConfigOptions } from "../types.d"; + +const content = await Astro.slots.render("default"); + +declare interface Props + extends Pick< + BackgroundImageConfigOptions, + Exclude + > {} + +const { link, style, htmlElement } = await renderBackgroundImage({ + content, + ...(Astro.props as Props), +}); +--- + + + + diff --git a/packages/imagetools_3/components/BackgroundPicture.astro b/packages/imagetools_3/components/BackgroundPicture.astro new file mode 100644 index 0000000..a53bab8 --- /dev/null +++ b/packages/imagetools_3/components/BackgroundPicture.astro @@ -0,0 +1,19 @@ +--- +import renderBackgroundPicture from "../api/renderBackgroundPicture.js"; +import { BackgroundPictureConfigOptions } from "../types.d"; + +declare interface Props + extends Pick< + BackgroundPictureConfigOptions, + Exclude + > {} + +const content = await Astro.slots.render("default"); + +const { link, style, htmlElement } = await renderBackgroundPicture({ + content, + ...(Astro.props as Props), +}); +--- + + diff --git a/packages/imagetools_3/components/Image.astro b/packages/imagetools_3/components/Image.astro new file mode 100644 index 0000000..d2d547a --- /dev/null +++ b/packages/imagetools_3/components/Image.astro @@ -0,0 +1,10 @@ +--- +import renderImage from "../api/renderImage.js"; +import type { PictureConfigOptions as ImageConfigOptions } from "../types.d"; + +const { link, style, image } = await renderImage( + Astro.props as ImageConfigOptions +); +--- + + diff --git a/packages/imagetools_3/components/ImageSupportDetection.astro b/packages/imagetools_3/components/ImageSupportDetection.astro new file mode 100644 index 0000000..9e62ae7 --- /dev/null +++ b/packages/imagetools_3/components/ImageSupportDetection.astro @@ -0,0 +1,4 @@ + + diff --git a/packages/imagetools_3/components/Img.astro b/packages/imagetools_3/components/Img.astro new file mode 100644 index 0000000..36c03ab --- /dev/null +++ b/packages/imagetools_3/components/Img.astro @@ -0,0 +1,10 @@ +--- +import renderImg from "../api/renderImg.js"; +import type { ImgConfigOptions } from "../types.d"; + +declare interface Props extends ImgConfigOptions {} + +const { link, style, img } = await renderImg(Astro.props as Props); +--- + + diff --git a/packages/imagetools_3/components/Picture.astro b/packages/imagetools_3/components/Picture.astro new file mode 100644 index 0000000..737bd77 --- /dev/null +++ b/packages/imagetools_3/components/Picture.astro @@ -0,0 +1,10 @@ +--- +import renderPicture from "../api/renderPicture.js"; +import type { PictureConfigOptions } from "../types.d"; + +declare interface Props extends PictureConfigOptions {} + +const { link, style, picture } = await renderPicture(Astro.props as Props); +--- + + diff --git a/packages/imagetools_3/components/index.js b/packages/imagetools_3/components/index.js new file mode 100644 index 0000000..a6c6389 --- /dev/null +++ b/packages/imagetools_3/components/index.js @@ -0,0 +1,5 @@ +export { default as Img } from "./Img.astro"; +export { default as Picture } from "./Picture.astro"; +export { default as BackgroundImage } from "./BackgroundImage.astro"; +export { default as BackgroundPicture } from "./BackgroundPicture.astro"; +export { default as ImageSupportDetection } from "./ImageSupportDetection.astro"; diff --git a/packages/imagetools_3/config.d.ts b/packages/imagetools_3/config.d.ts new file mode 100644 index 0000000..8569ca9 --- /dev/null +++ b/packages/imagetools_3/config.d.ts @@ -0,0 +1,3 @@ +import type { GlobalConfigOptions } from "./types"; + +export function defineConfig(config: GlobalConfigOptions): GlobalConfigOptions; diff --git a/packages/imagetools_3/config.mjs b/packages/imagetools_3/config.mjs new file mode 100644 index 0000000..64a4c49 --- /dev/null +++ b/packages/imagetools_3/config.mjs @@ -0,0 +1,3 @@ +export function defineConfig(config) { + return config; +} diff --git a/packages/imagetools_3/demo/.npmrc b/packages/imagetools_3/demo/.npmrc new file mode 100644 index 0000000..0cc653b --- /dev/null +++ b/packages/imagetools_3/demo/.npmrc @@ -0,0 +1,2 @@ +## force pnpm to hoist +shamefully-hoist = true \ No newline at end of file diff --git a/packages/imagetools_3/demo/.stackblitzrc b/packages/imagetools_3/demo/.stackblitzrc new file mode 100644 index 0000000..0dfa8f1 --- /dev/null +++ b/packages/imagetools_3/demo/.stackblitzrc @@ -0,0 +1,6 @@ +{ + "startCommand": "npm start", + "env": { + "ENABLE_CJS_IMPORTS": true + } +} diff --git a/packages/imagetools_3/demo/README.md b/packages/imagetools_3/demo/README.md new file mode 100644 index 0000000..777dd8e --- /dev/null +++ b/packages/imagetools_3/demo/README.md @@ -0,0 +1,5 @@ +# Astro ImageTools Live Examples + +This repository contains source code for the [**Astro ImageTools Demo**](https://astro-imagetools-demo.vercel.app) website. + +The demo displays live examples of the components and APIs provided by the [**Astro ImageTools**](https://npmjs.com/package/astro-imagetools) library and the **Layouts** and **Placeholders** supported by the library. diff --git a/packages/imagetools_3/demo/astro-imagetools.config.mjs b/packages/imagetools_3/demo/astro-imagetools.config.mjs new file mode 100644 index 0000000..b48b079 --- /dev/null +++ b/packages/imagetools_3/demo/astro-imagetools.config.mjs @@ -0,0 +1,3 @@ +import { defineConfig } from "astro-imagetools/config"; + +export default defineConfig({}); diff --git a/packages/imagetools_3/demo/astro.config.mjs b/packages/imagetools_3/demo/astro.config.mjs new file mode 100644 index 0000000..c46819e --- /dev/null +++ b/packages/imagetools_3/demo/astro.config.mjs @@ -0,0 +1,23 @@ +import { defineConfig } from "astro/config"; +import { astroImageTools } from "astro-imagetools"; + +// https://astro.build/config +export default defineConfig({ + vite: { + plugins: [ + { + name: "import.meta.url-transformer", + transform: (code, id) => { + if (id.endsWith(".astro")) + return code.replace(/import.meta.url/g, `"${id}"`); + }, + }, + ], + }, + + experimental: { + integrations: true, + }, + + integrations: [astroImageTools], +}); diff --git a/packages/imagetools_3/demo/package.json b/packages/imagetools_3/demo/package.json new file mode 100644 index 0000000..2a25773 --- /dev/null +++ b/packages/imagetools_3/demo/package.json @@ -0,0 +1,23 @@ +{ + "scripts": { + "dev": "astro dev", + "start": "astro dev", + "build": "astro build", + "preview": "astro preview" + }, + "dependencies": { + "astro-spa": "^1.3.9", + "react": "^18.2.0", + "react-dom": "^18.2.0" + }, + "devDependencies": { + "@astrojs/lit": "^1.1.2", + "@astrojs/preact": "^2.0.2", + "@astrojs/react": "^2.0.2", + "@astrojs/solid-js": "^2.0.2", + "@astrojs/svelte": "^2.0.1", + "@astrojs/vue": "^2.0.1", + "astro": "^2.0.6", + "astro-imagetools": "workspace:^0.9.0" + } +} diff --git a/packages/imagetools_3/demo/public/favicon.ico b/packages/imagetools_3/demo/public/favicon.ico new file mode 100644 index 0000000..578ad45 Binary files /dev/null and b/packages/imagetools_3/demo/public/favicon.ico differ diff --git a/packages/imagetools_3/demo/public/images/public.jpeg b/packages/imagetools_3/demo/public/images/public.jpeg new file mode 100644 index 0000000..d5b648a Binary files /dev/null and b/packages/imagetools_3/demo/public/images/public.jpeg differ diff --git a/packages/imagetools_3/demo/sandbox.config.json b/packages/imagetools_3/demo/sandbox.config.json new file mode 100644 index 0000000..b12019e --- /dev/null +++ b/packages/imagetools_3/demo/sandbox.config.json @@ -0,0 +1,11 @@ +{ + "infiniteLoopProtection": true, + "hardReloadOnChange": false, + "view": "browser", + "template": "node", + "container": { + "port": 3000, + "startScript": "start", + "node": "16" + } +} diff --git a/packages/imagetools_3/demo/src/env.d.ts b/packages/imagetools_3/demo/src/env.d.ts new file mode 100644 index 0000000..f964fe0 --- /dev/null +++ b/packages/imagetools_3/demo/src/env.d.ts @@ -0,0 +1 @@ +/// diff --git a/packages/imagetools_3/demo/src/images/elva-480w-close-portrait.jpg b/packages/imagetools_3/demo/src/images/elva-480w-close-portrait.jpg new file mode 100644 index 0000000..0ea3a05 Binary files /dev/null and b/packages/imagetools_3/demo/src/images/elva-480w-close-portrait.jpg differ diff --git a/packages/imagetools_3/demo/src/images/elva-800w.jpg b/packages/imagetools_3/demo/src/images/elva-800w.jpg new file mode 100644 index 0000000..d2f052e Binary files /dev/null and b/packages/imagetools_3/demo/src/images/elva-800w.jpg differ diff --git a/packages/imagetools_3/demo/src/layouts/LayoutsLayout.astro b/packages/imagetools_3/demo/src/layouts/LayoutsLayout.astro new file mode 100644 index 0000000..c2d0000 --- /dev/null +++ b/packages/imagetools_3/demo/src/layouts/LayoutsLayout.astro @@ -0,0 +1,15 @@ +--- +import { Picture } from "astro-imagetools/components"; +import MainLayout from "./MainLayout.astro"; + +const { layout, importMetaUrl } = Astro.props; +--- + + +

{layout} Layout Example

+ +
+ + +
diff --git a/packages/imagetools_3/demo/src/layouts/MainLayout.astro b/packages/imagetools_3/demo/src/layouts/MainLayout.astro new file mode 100644 index 0000000..3012534 --- /dev/null +++ b/packages/imagetools_3/demo/src/layouts/MainLayout.astro @@ -0,0 +1,57 @@ +--- +import { Spa } from "astro-spa"; +import "../styles/index.css"; + +const { importMetaUrl } = Astro.props as { importMetaUrl: string }; + +const path = + Astro.props.content?.path || + importMetaUrl?.slice(importMetaUrl.indexOf("/pages/") + 7); + +const GitHubURL = `https://github.com/RafidMuhymin/astro-imagetools/tree/main/demo/src/pages/${path}`; +--- + + + + + + + + + + +
+ + + + + + + + + +
+ + + + diff --git a/packages/imagetools_3/demo/src/layouts/PlaceholderLayout.astro b/packages/imagetools_3/demo/src/layouts/PlaceholderLayout.astro new file mode 100644 index 0000000..809c2f4 --- /dev/null +++ b/packages/imagetools_3/demo/src/layouts/PlaceholderLayout.astro @@ -0,0 +1,18 @@ +--- +import { Picture } from "astro-imagetools/components"; +import MainLayout from "./MainLayout.astro"; + +const { placeholder, importMetaUrl } = Astro.props; +--- + + +

{placeholder} Placeholder Example

+ +
+ + +
diff --git a/packages/imagetools_3/demo/src/pages/api/renderBackgroundImage.astro b/packages/imagetools_3/demo/src/pages/api/renderBackgroundImage.astro new file mode 100644 index 0000000..93cf23c --- /dev/null +++ b/packages/imagetools_3/demo/src/pages/api/renderBackgroundImage.astro @@ -0,0 +1,48 @@ +--- +import { ImageSupportDetection } from "astro-imagetools/components"; +import { renderBackgroundImage } from "astro-imagetools/api"; +import MainLayout from "../../layouts/MainLayout.astro"; + +const { link, style, htmlElement } = await renderBackgroundImage({ + src: "https://picsum.photos/1024/768/", + content: `

+ Lorem ipsum dolor sit amet, consectetur adipisicing elit. Eveniet, nisi! + Commodi, dolor hic omnis debitis natus eaque nisi magni corrupti earum + aliquam at quidem dolorum? +

+ +

+ Eos facere amet nesciunt! Vero, culpa eaque quasi ullam atque alias + repudiandae facere placeat ipsam recusandae quam minus nemo officia + reiciendis dicta quaerat maiores omnis. +

+ +

+ Pariatur doloribus, facilis enim accusamus velit, amet ducimus dolorum + unde numquam doloremque eveniet eum et error, quod quas fugit commodi + suscipit sequi. At, deleniti nihil. +

+ +

+ Laborum voluptate maxime dicta alias minus nam, doloribus accusantium + veritatis perferendis, expedita eaque. Deleniti deserunt, iure dolorum + itaque fugiat assumenda ullam amet asperiores soluta ipsam! +

+ +

+ Veniam qui ad, illo fuga autem voluptatibus iusto cum reprehenderit error. + Nemo nisi laborum blanditiis, accusamus dolores harum labore perspiciatis. + Nesciunt, repellat mollitia. Rem, labore? +

`, +}); +--- + + + + +

Astro ImageTools {"renderBackgroundImage"} API Example

+ +
+ + +
diff --git a/packages/imagetools_3/demo/src/pages/api/renderBackgroundPicture.astro b/packages/imagetools_3/demo/src/pages/api/renderBackgroundPicture.astro new file mode 100644 index 0000000..1324eb3 --- /dev/null +++ b/packages/imagetools_3/demo/src/pages/api/renderBackgroundPicture.astro @@ -0,0 +1,45 @@ +--- +import { renderBackgroundPicture } from "astro-imagetools/api"; +import MainLayout from "../../layouts/MainLayout.astro"; + +const { link, style, htmlElement } = await renderBackgroundPicture({ + src: "https://picsum.photos/1024/768/", + content: `

+ Lorem ipsum dolor sit amet, consectetur adipisicing elit. Eveniet, nisi! + Commodi, dolor hic omnis debitis natus eaque nisi magni corrupti earum + aliquam at quidem dolorum? +

+ +

+ Eos facere amet nesciunt! Vero, culpa eaque quasi ullam atque alias + repudiandae facere placeat ipsam recusandae quam minus nemo officia + reiciendis dicta quaerat maiores omnis. +

+ +

+ Pariatur doloribus, facilis enim accusamus velit, amet ducimus dolorum + unde numquam doloremque eveniet eum et error, quod quas fugit commodi + suscipit sequi. At, deleniti nihil. +

+ +

+ Laborum voluptate maxime dicta alias minus nam, doloribus accusantium + veritatis perferendis, expedita eaque. Deleniti deserunt, iure dolorum + itaque fugiat assumenda ullam amet asperiores soluta ipsam! +

+ +

+ Veniam qui ad, illo fuga autem voluptatibus iusto cum reprehenderit error. + Nemo nisi laborum blanditiis, accusamus dolores harum labore perspiciatis. + Nesciunt, repellat mollitia. Rem, labore? +

`, +}); +--- + + +

Astro ImageTools {"renderBackgroundPicture"} API Example

+ +
+ + +
diff --git a/packages/imagetools_3/demo/src/pages/api/renderImg.astro b/packages/imagetools_3/demo/src/pages/api/renderImg.astro new file mode 100644 index 0000000..313f18d --- /dev/null +++ b/packages/imagetools_3/demo/src/pages/api/renderImg.astro @@ -0,0 +1,17 @@ +--- +import { renderImg } from "astro-imagetools/api"; +import MainLayout from "../../layouts/MainLayout.astro"; + +const { link, style, img } = await renderImg({ + src: "https://picsum.photos/1024/768/", + alt: "A random image", +}); +--- + + +

Astro ImageTools {"renderImg"} API Example

+ +
+ + +
diff --git a/packages/imagetools_3/demo/src/pages/api/renderPicture.astro b/packages/imagetools_3/demo/src/pages/api/renderPicture.astro new file mode 100644 index 0000000..fe8abdf --- /dev/null +++ b/packages/imagetools_3/demo/src/pages/api/renderPicture.astro @@ -0,0 +1,17 @@ +--- +import { renderPicture } from "astro-imagetools/api"; +import MainLayout from "../../layouts/MainLayout.astro"; + +const { link, style, picture } = await renderPicture({ + src: "https://picsum.photos/1024/768/", + alt: "A random image", +}); +--- + + +

Astro ImageTools {"renderPicture"} API Example

+ +
+ + +
diff --git a/packages/imagetools_3/demo/src/pages/components/BackgroundImage.astro b/packages/imagetools_3/demo/src/pages/components/BackgroundImage.astro new file mode 100644 index 0000000..aef8bdf --- /dev/null +++ b/packages/imagetools_3/demo/src/pages/components/BackgroundImage.astro @@ -0,0 +1,45 @@ +--- +import { + BackgroundImage, + ImageSupportDetection, +} from "astro-imagetools/components"; +import MainLayout from "../../layouts/MainLayout.astro"; +--- + + + + +

+ Astro ImageTools {""} Component Example +

+ +
+ + +

+ Lorem ipsum dolor sit amet, consectetur adipisicing elit. Eveniet, nisi! + Commodi, dolor hic omnis debitis natus eaque nisi magni corrupti earum + aliquam at quidem dolorum? +

+

+ Eos facere amet nesciunt! Vero, culpa eaque quasi ullam atque alias + repudiandae facere placeat ipsam recusandae quam minus nemo officia + reiciendis dicta quaerat maiores omnis. +

+

+ Pariatur doloribus, facilis enim accusamus velit, amet ducimus dolorum + unde numquam doloremque eveniet eum et error, quod quas fugit commodi + suscipit sequi. At, deleniti nihil. +

+

+ Laborum voluptate maxime dicta alias minus nam, doloribus accusantium + veritatis perferendis, expedita eaque. Deleniti deserunt, iure dolorum + itaque fugiat assumenda ullam amet asperiores soluta ipsam! +

+

+ Veniam qui ad, illo fuga autem voluptatibus iusto cum reprehenderit error. + Nemo nisi laborum blanditiis, accusamus dolores harum labore perspiciatis. + Nesciunt, repellat mollitia. Rem, labore? +

+
+
diff --git a/packages/imagetools_3/demo/src/pages/components/BackgroundPicture.astro b/packages/imagetools_3/demo/src/pages/components/BackgroundPicture.astro new file mode 100644 index 0000000..871d97c --- /dev/null +++ b/packages/imagetools_3/demo/src/pages/components/BackgroundPicture.astro @@ -0,0 +1,40 @@ +--- +import { BackgroundPicture } from "astro-imagetools/components"; +import MainLayout from "../../layouts/MainLayout.astro"; +--- + + +

+ Astro ImageTools {""} Component Example +

+ +
+ + +

+ Lorem ipsum dolor sit amet, consectetur adipisicing elit. Eveniet, nisi! + Commodi, dolor hic omnis debitis natus eaque nisi magni corrupti earum + aliquam at quidem dolorum? +

+

+ Eos facere amet nesciunt! Vero, culpa eaque quasi ullam atque alias + repudiandae facere placeat ipsam recusandae quam minus nemo officia + reiciendis dicta quaerat maiores omnis. +

+

+ Pariatur doloribus, facilis enim accusamus velit, amet ducimus dolorum + unde numquam doloremque eveniet eum et error, quod quas fugit commodi + suscipit sequi. At, deleniti nihil. +

+

+ Laborum voluptate maxime dicta alias minus nam, doloribus accusantium + veritatis perferendis, expedita eaque. Deleniti deserunt, iure dolorum + itaque fugiat assumenda ullam amet asperiores soluta ipsam! +

+

+ Veniam qui ad, illo fuga autem voluptatibus iusto cum reprehenderit error. + Nemo nisi laborum blanditiis, accusamus dolores harum labore perspiciatis. + Nesciunt, repellat mollitia. Rem, labore? +

+
+
diff --git a/packages/imagetools_3/demo/src/pages/components/Img.astro b/packages/imagetools_3/demo/src/pages/components/Img.astro new file mode 100644 index 0000000..3f6eb9b --- /dev/null +++ b/packages/imagetools_3/demo/src/pages/components/Img.astro @@ -0,0 +1,12 @@ +--- +import { Img } from "astro-imagetools/components"; +import MainLayout from "../../layouts/MainLayout.astro"; +--- + + +

Astro ImageTools {""} Component Example

+ +
+ + A random image +
diff --git a/packages/imagetools_3/demo/src/pages/components/Picture.astro b/packages/imagetools_3/demo/src/pages/components/Picture.astro new file mode 100644 index 0000000..b617e39 --- /dev/null +++ b/packages/imagetools_3/demo/src/pages/components/Picture.astro @@ -0,0 +1,12 @@ +--- +import { Picture } from "astro-imagetools/components"; +import MainLayout from "../../layouts/MainLayout.astro"; +--- + + +

Astro ImageTools {""} Component Example

+ +
+ + +
diff --git a/packages/imagetools_3/demo/src/pages/index.md b/packages/imagetools_3/demo/src/pages/index.md new file mode 100644 index 0000000..66d5df0 --- /dev/null +++ b/packages/imagetools_3/demo/src/pages/index.md @@ -0,0 +1,78 @@ +--- +path: index.md +layout: ../layouts/MainLayout.astro +--- + +# Image Optimization in Astro with Astro ImageTools + +This page demonstrates the usage of the [astro-imagetools](https://www.npmjs.com/package/astro-imagetools) library with live examples. + +
+ +## Components + +- [`` Component](/components/Img) +- [`` Component](/components/Picture) +- [`` Component](/components/BackgroundImage) +- [`` Component](/components/BackgroundPicture) + +## APIs + +- [`renderImg` API](/api/renderImg) +- [`renderPicture` API](/api/renderPicture) +- [`renderBackgroundImage` API](/api/renderBackgroundImage) +- [`renderBackgroundPicture` API](/api/renderBackgroundPicture) + +## Layout + +The `layout` property tells the image to respond differently depending on the device size or the container size. + +Select a layout below and try resizing the window or rotating your device to see how the image reacts. + +- [Constrained Layout](/layout/constrained) +- [Fixed Layout](/layout/fixed) +- [Full Width Layout](/layout/fullWidth) +- [Fill Layout](/layout/fill) + +
+ +## Placeholder + +The `placeholder` property tells the image what to show while loading. + +- [Blurred Placeholder](/placeholder/blurred) +- [Dominant Color Placeholder](/placeholder/dominantColor) +- [Traced SVG Placeholder](/placeholder/tracedSVG) +- [No Placeholder](/placeholder/none) + +
+ +## Internal Image + +The following is an example of a reference to an internal image in the `src` directory (`../images/elva-800w.jpg`). + +![A father holding his beloved daughter in his arms](../images/elva-800w.jpg) + +
+ +## External Image + +The following is an example of a reference to an external image (`https://picsum.photos/1024/768`). + +![A random image](https://picsum.photos/1024/768) + +
+ +## Image in /public + +This image is in the public directory (`/images/public.jpeg`). + +![A random image](/images/public.jpeg) + +
+ +## Learn More + +You can optionally configure many more things! + +Checkout the [Astro ImageTools](https://astro-imagetools-docs.vercel.app/) documentation to learn more. diff --git a/packages/imagetools_3/demo/src/pages/layout/constrained.astro b/packages/imagetools_3/demo/src/pages/layout/constrained.astro new file mode 100644 index 0000000..669994d --- /dev/null +++ b/packages/imagetools_3/demo/src/pages/layout/constrained.astro @@ -0,0 +1,5 @@ +--- +import LayoutsLayout from "../../layouts/LayoutsLayout.astro"; +--- + + diff --git a/packages/imagetools_3/demo/src/pages/layout/fill.astro b/packages/imagetools_3/demo/src/pages/layout/fill.astro new file mode 100644 index 0000000..01d5e0f --- /dev/null +++ b/packages/imagetools_3/demo/src/pages/layout/fill.astro @@ -0,0 +1,5 @@ +--- +import LayoutsLayout from "../../layouts/LayoutsLayout.astro"; +--- + + diff --git a/packages/imagetools_3/demo/src/pages/layout/fixed.astro b/packages/imagetools_3/demo/src/pages/layout/fixed.astro new file mode 100644 index 0000000..65e626c --- /dev/null +++ b/packages/imagetools_3/demo/src/pages/layout/fixed.astro @@ -0,0 +1,5 @@ +--- +import LayoutsLayout from "../../layouts/LayoutsLayout.astro"; +--- + + diff --git a/packages/imagetools_3/demo/src/pages/layout/fullWidth.astro b/packages/imagetools_3/demo/src/pages/layout/fullWidth.astro new file mode 100644 index 0000000..b822c52 --- /dev/null +++ b/packages/imagetools_3/demo/src/pages/layout/fullWidth.astro @@ -0,0 +1,5 @@ +--- +import LayoutsLayout from "../../layouts/LayoutsLayout.astro"; +--- + + diff --git a/packages/imagetools_3/demo/src/pages/placeholder/blurred.astro b/packages/imagetools_3/demo/src/pages/placeholder/blurred.astro new file mode 100644 index 0000000..1fee26c --- /dev/null +++ b/packages/imagetools_3/demo/src/pages/placeholder/blurred.astro @@ -0,0 +1,5 @@ +--- +import PlaceholderLayout from "../../layouts/PlaceholderLayout.astro"; +--- + + diff --git a/packages/imagetools_3/demo/src/pages/placeholder/dominantColor.astro b/packages/imagetools_3/demo/src/pages/placeholder/dominantColor.astro new file mode 100644 index 0000000..5a9b6c9 --- /dev/null +++ b/packages/imagetools_3/demo/src/pages/placeholder/dominantColor.astro @@ -0,0 +1,5 @@ +--- +import PlaceholderLayout from "../../layouts/PlaceholderLayout.astro"; +--- + + diff --git a/packages/imagetools_3/demo/src/pages/placeholder/none.astro b/packages/imagetools_3/demo/src/pages/placeholder/none.astro new file mode 100644 index 0000000..293dc79 --- /dev/null +++ b/packages/imagetools_3/demo/src/pages/placeholder/none.astro @@ -0,0 +1,5 @@ +--- +import PlaceholderLayout from "../../layouts/PlaceholderLayout.astro"; +--- + + diff --git a/packages/imagetools_3/demo/src/pages/placeholder/tracedSVG.astro b/packages/imagetools_3/demo/src/pages/placeholder/tracedSVG.astro new file mode 100644 index 0000000..9e3393a --- /dev/null +++ b/packages/imagetools_3/demo/src/pages/placeholder/tracedSVG.astro @@ -0,0 +1,5 @@ +--- +import PlaceholderLayout from "../../layouts/PlaceholderLayout.astro"; +--- + + diff --git a/packages/imagetools_3/demo/src/styles/index.css b/packages/imagetools_3/demo/src/styles/index.css new file mode 100644 index 0000000..518e741 --- /dev/null +++ b/packages/imagetools_3/demo/src/styles/index.css @@ -0,0 +1,19 @@ +main { + padding: 1.5rem; + background-color: black; + color: white; +} + +code::before { + content: "`"; +} + +code::after { + content: "`"; +} + +.view-source { + position: fixed; + top: 0; + right: 0; +} diff --git a/packages/imagetools_3/docs/.npmrc b/packages/imagetools_3/docs/.npmrc new file mode 100644 index 0000000..ef83021 --- /dev/null +++ b/packages/imagetools_3/docs/.npmrc @@ -0,0 +1,2 @@ +# Expose Astro dependencies for `pnpm` users +shamefully-hoist=true diff --git a/packages/imagetools_3/docs/.stackblitzrc b/packages/imagetools_3/docs/.stackblitzrc new file mode 100644 index 0000000..43798ec --- /dev/null +++ b/packages/imagetools_3/docs/.stackblitzrc @@ -0,0 +1,6 @@ +{ + "startCommand": "npm start", + "env": { + "ENABLE_CJS_IMPORTS": true + } +} \ No newline at end of file diff --git a/packages/imagetools_3/docs/README.md b/packages/imagetools_3/docs/README.md new file mode 100644 index 0000000..984e496 --- /dev/null +++ b/packages/imagetools_3/docs/README.md @@ -0,0 +1,97 @@ +# Astro ImageTools Docs Astro logo + +To all who come to this happy place: welcome. + +This is the repo for [https://astro-imagetools-docs.vercel.app/](https://astro-imagetools-docs.vercel.app/). +This repo contains all the source code to build the docs site. + +## We are Astro + +Astro is a site builder for the web platform. +We want everyone to be successful building sites, and that means helping everyone understand how Astro works. + +## You are Awesome + +You can also help make the docs awesome. +Your feedback is welcome. +Your writing, editing, translating, designing, and developing skills are welcome. +You being a part of our community is welcome. + +## Chat with Us + +You can learn more about Astro, get support, and meet other devs in [our Discord community](https://astro.build/chat). + +## Raise an Issue + +Is something missing? +Is something wrong? +Could something be better? +Issues are a quick way for you to offer us feedback about the docs. + +Before you share, please [see if your issue has already been reported](https://github.com/RafidMuhymin/astro-imagetools/issues). + +## Edit a Page + +Every page on [https://astro-imagetools-docs.vercel.app/](https://astro-imagetools-docs.vercel.app/) has an **Edit this page** button in the sidebar. +You can click that button to edit the source code for that page in **GitHub**. + +After you make your changes, click **Commit changes**. +This will automatically create a [fork](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/about-forks) of the docs in your GitHub account with the changes. + +Once your edits are ready in GitHub, follow the prompts to **create a pull request** and submit your changes for review. + +## Develop + +To begin developing locally, checkout this project from your machine. + +```shell +git clone git@github.com:RafidMuhymin/astro-imagetools.git +``` + +You can install and run the project locally using [pnpm](https://pnpm.io/). Head to [the pnpm installation guide](https://pnpm.io/installation) to get that set up. Then, run the following from your terminal: + +```shell +pnpm install + +pnpm dev +``` + +If you’re copying these instructions, remember to [configure this project as a fork](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/configuring-a-remote-for-a-fork). + +```shell +git remote add upstream git@github.com:RafidMuhymin/astro-imagetools.git +``` + +At any point, create a branch for your contribution. +We are not strict about branch names. + +```shell +git checkout -b add/klingon-language +``` + +That’s it. +As you [open a pull request](https://github.com/withastro/astro/compare), please include a clear title and description. + +```markdown +# Add Klingon language to Getting Started page + +This adds the Klingon language and also updates the sidebar and language selection components. +``` + +Thank you for helping make the docs awesome. +And please, [come chat with us](https://astro.build/chat) if you have any questions. + +## Deploy + +Every pull request generates a preview using **Vercel** for anyone to see. + +Use the **Deploy Preview** of your pull request to review and share your changes. + +The docs site will be automatically updated whenever pull requests are merged. + +## Next Steps + +- [Read the docs](https://astro-imagetools-docs.vercel.app/) +- [Fork the project](https://github.com/RafidMuhymin/astro-imagetools/fork) +- [Raise an issue](https://github.com/RafidMuhymin/astro-imagetools/issues/new) +- [Discuss the docs](https://discord.gg/cZDZU3hJHc) diff --git a/packages/imagetools_3/docs/astro.config.mjs b/packages/imagetools_3/docs/astro.config.mjs new file mode 100644 index 0000000..1cb4233 --- /dev/null +++ b/packages/imagetools_3/docs/astro.config.mjs @@ -0,0 +1,25 @@ +import mdx from "@astrojs/mdx"; +import react from "@astrojs/react"; +import preact from "@astrojs/preact"; +import { defineConfig } from "astro/config"; +import AutoImport from "unplugin-auto-import/vite"; + +// https://astro.build/config +export default defineConfig({ + site: "https://astro-imagetools-docs.vercel.app/", + integrations: [preact(), react(), mdx()], + vite: { + plugins: [ + AutoImport({ + include: [/\.astro$/, /\.mdx$/], + imports: [ + { + "@astrojs/markdown-component": [["default", "Markdown"]], + "/src/components/CodeExample.astro": [["default", "CodeExample"]], + }, + ], + dts: "./auto-imports.d.ts", + }), + ], + }, +}); diff --git a/packages/imagetools_3/docs/auto-imports.d.ts b/packages/imagetools_3/docs/auto-imports.d.ts new file mode 100644 index 0000000..4ca0671 --- /dev/null +++ b/packages/imagetools_3/docs/auto-imports.d.ts @@ -0,0 +1,7 @@ +// Generated by 'unplugin-auto-import' +export {}; + +declare global { + const CodeExample: typeof import("../../../src/components/CodeExample.astro")["default"]; + const Markdown: typeof import("@astrojs/markdown-component")["default"]; +} diff --git a/packages/imagetools_3/docs/package.json b/packages/imagetools_3/docs/package.json new file mode 100644 index 0000000..44f0b83 --- /dev/null +++ b/packages/imagetools_3/docs/package.json @@ -0,0 +1,28 @@ +{ + "name": "@example/docs", + "version": "0.0.1", + "private": true, + "scripts": { + "dev": "astro dev", + "start": "astro dev", + "build": "astro build", + "preview": "astro preview" + }, + "dependencies": { + "@algolia/client-search": "^4.14.3", + "@astrojs/markdown-component": "^1.0.2", + "@astrojs/mdx": "^0.14.0", + "@docsearch/css": "^3.3.2", + "@docsearch/react": "^3.3.2", + "@types/react": "^18.0.26", + "preact": "^10.11.3", + "react": "^18.2.0", + "react-dom": "^18.2.0", + "unplugin-auto-import": "^0.9.5" + }, + "devDependencies": { + "@astrojs/preact": "^0.2.0", + "@astrojs/react": "^0.2.1", + "astro": "^1.9.2" + } +} diff --git a/packages/imagetools_3/docs/public/default-og-image.png b/packages/imagetools_3/docs/public/default-og-image.png new file mode 100644 index 0000000..9790320 Binary files /dev/null and b/packages/imagetools_3/docs/public/default-og-image.png differ diff --git a/packages/imagetools_3/docs/public/favicon.ico b/packages/imagetools_3/docs/public/favicon.ico new file mode 100644 index 0000000..578ad45 Binary files /dev/null and b/packages/imagetools_3/docs/public/favicon.ico differ diff --git a/packages/imagetools_3/docs/public/make-scrollable-code-focusable.js b/packages/imagetools_3/docs/public/make-scrollable-code-focusable.js new file mode 100644 index 0000000..6fbf1ee --- /dev/null +++ b/packages/imagetools_3/docs/public/make-scrollable-code-focusable.js @@ -0,0 +1,3 @@ +Array.from(document.getElementsByTagName("pre")).forEach((element) => { + element.setAttribute("tabindex", "0"); +}); diff --git a/packages/imagetools_3/docs/sandbox.config.json b/packages/imagetools_3/docs/sandbox.config.json new file mode 100644 index 0000000..9178af7 --- /dev/null +++ b/packages/imagetools_3/docs/sandbox.config.json @@ -0,0 +1,11 @@ +{ + "infiniteLoopProtection": true, + "hardReloadOnChange": false, + "view": "browser", + "template": "node", + "container": { + "port": 3000, + "startScript": "start", + "node": "14" + } +} diff --git a/packages/imagetools_3/docs/src/components/CodeExample.astro b/packages/imagetools_3/docs/src/components/CodeExample.astro new file mode 100644 index 0000000..92ae1f5 --- /dev/null +++ b/packages/imagetools_3/docs/src/components/CodeExample.astro @@ -0,0 +1,83 @@ +--- +import { Code } from "astro/components"; + +const { values, global, api, component } = Astro.props; + +const isJS = component ? false : true; + +const isGlobal = global; + +const comment = (text) => (isJS ? `// ${text}` : ``) + "\n"; + +function formatValue(value) { + let formattedValue = ["number", "boolean", "function"].includes(typeof value) + ? `${value}` + : Array.isArray(value) + ? `${value[0]}` + : typeof value === "string" && + (value.startsWith("{") || value.startsWith("[")) + ? value + : `"${value}"`; + + if (typeof value === "function") { + formattedValue = formattedValue.replaceAll(/\n\s+/g, "\n "); + + formattedValue = formattedValue.replace(/\n\s+\}$/, "\n }"); + } + + if (component) { + (formattedValue.startsWith("{") || + formattedValue.startsWith("[") || + ["number", "boolean", "function"].includes(typeof value) || + Array.isArray(value)) && + (formattedValue = `{${formattedValue}}`); + } + + return formattedValue; +} + +function code(props, { api, component }) { + const builtProps = Object.keys(props) + .filter((key) => + isGlobal + ? ["src", "alt", "tag", "content", "artDirectives"].includes(key) + ? false + : true + : true + ) + .map((key) => + key === "comment" + ? `/* ${props[key]} */` + : key + (isJS ? ": " : "=") + `${formatValue(props[key])}` + ) + .join(`${isJS ? "," : ""}\n `); + + return ( + `${ + isJS + ? isGlobal + ? `export default defineConfig({` + : `const renderedHTML = await ${api}({` + : `<${component}` + } + ${builtProps}${isJS ? "," : ""} +${isJS ? `});` : `/>`}` + "\n" + ); +} + +const codeBlock = values + .map((value) => + value === "" + ? "\n" + : typeof value === "string" + ? comment(value) + : Array.isArray(value) + ? isJS + ? value.filter((value) => value !== "---").join("\n") + "\n" + : value.join("\n") + "\n" + : code(value, { api, component }) + ) + .join(""); +--- + + diff --git a/packages/imagetools_3/docs/src/components/ConfigOptions.astro b/packages/imagetools_3/docs/src/components/ConfigOptions.astro new file mode 100644 index 0000000..bc7ed80 --- /dev/null +++ b/packages/imagetools_3/docs/src/components/ConfigOptions.astro @@ -0,0 +1,107 @@ +--- +import Src from "@config/src.astro"; +import Alt from "@config/alt.astro"; +import Tag from "@config/tag.astro"; +import Content from "@config/content.astro"; +import Sizes from "@config/sizes.astro"; +import Preload from "@config/preload.astro"; +import Loading from "@config/loading.astro"; +import Decoding from "@config/decoding.astro"; +import Attributes from "@config/attributes.astro"; +import Layout from "@config/layout.astro"; +import Placeholder from "@config/placeholder.astro"; +import BreakPoints from "@config/breakpoints.astro"; +import ObjectFit from "@config/objectFit.astro"; +import ObjectPosition from "@config/objectPosition.astro"; +import BackgroundSize from "@config/backgroundSize.astro"; +import BackgroundPosition from "@config/backgroundPosition.astro"; +import Format from "@config/format.astro"; +import FallbackFormat from "@config/fallbackFormat.astro"; +import IncludeSourceFormat from "@config/includeSourceFormat.astro"; +import FormatOptions from "@config/formatOptions.astro"; +import FadeInTransition from "@config/fadeInTransition.astro"; +import ArtDirectives from "@config/artDirectives.astro"; +import CacheDir from "@config/cacheDir.astro"; +import AssetFileNames from "@config/assetFileNames.astro"; +import Flip from "@config/flip.astro"; +import Flop from "@config/flop.astro"; +import Invert from "@config/invert.astro"; +import Flatten from "@config/flatten.astro"; +import Normalize from "@config/normalize.astro"; +import Grayscale from "@config/grayscale.astro"; +import Hue from "@config/hue.astro"; +import Saturation from "@config/saturation.astro"; +import Brightness from "@config/brightness.astro"; +import Width from "@config/width.astro"; +import Height from "@config/height.astro"; +import Aspect from "@config/aspect.astro"; +import Background from "@config/background.astro"; +import Tint from "@config/tint.astro"; +import Blur from "@config/blur.astro"; +import Median from "@config/median.astro"; +import Rotate from "@config/rotate.astro"; +import Quality from "@config/quality.astro"; +import Fit from "@config/fit.astro"; +import Kernel from "@config/kernel.astro"; +import Position from "@config/position.astro"; + +const { props } = Astro; + +const isGlobal = props.global; + +const { api, component } = props; + +const isBackground = + component?.startsWith("Background") || api?.startsWith("renderBackground"); + +const isBackgroundImage = + component === "BackgroundImage" || api === "renderBackgroundImage"; + +const isNotImg = component !== "Img" && api !== "renderImg"; +--- + +{!isGlobal && } +{!isGlobal && !isBackground && } +{!isGlobal && isBackground && } +{!isGlobal && api && isBackground && } +{!isBackgroundImage && } + +{!isBackgroundImage && } +{!isBackgroundImage && } + +{!isBackground && } + + +{!isBackgroundImage && } +{!isBackgroundImage && } +{isBackgroundImage && } +{isBackgroundImage && } + +{isNotImg && } +{isNotImg && } + +{isNotImg && !isBackgroundImage && } +{!isGlobal && isNotImg && } +{isGlobal && } +{isGlobal && } + + + + + + + + + + + + + + + + + + + + + diff --git a/packages/imagetools_3/docs/src/components/ConfigOptions/alt.astro b/packages/imagetools_3/docs/src/components/ConfigOptions/alt.astro new file mode 100644 index 0000000..a3db1d0 --- /dev/null +++ b/packages/imagetools_3/docs/src/components/ConfigOptions/alt.astro @@ -0,0 +1,22 @@ + + + ### `alt` + + **Type:** `string` + + **Default:** `undefined` + + The alternative text to display if the image fails to load. + + **Code example:** + + + diff --git a/packages/imagetools_3/docs/src/components/ConfigOptions/artDirectives.astro b/packages/imagetools_3/docs/src/components/ConfigOptions/artDirectives.astro new file mode 100644 index 0000000..98dcb75 --- /dev/null +++ b/packages/imagetools_3/docs/src/components/ConfigOptions/artDirectives.astro @@ -0,0 +1,115 @@ +--- +const { api, component } = Astro.props; + +const dynamicText = component + ? `${"`"}<${component} />${"`"} component` + : `${"`"}render${api}${"`"} API`; + +const isPicture = + Astro.props.component === "Picture" || Astro.props.api === "renderPicture"; + +const isBackgroundImage = + Astro.props.component === "BackgroundImage" || + Astro.props.api === "renderBackgroundImage"; +--- + + + + ### `artDirectives` + + **Type:** `ArtDirective[]` + + + +{isPicture ? ( + + *An `ArtDirective` object can take all the props supported by the{" "} + {} except `alt`, `preload`, `loading`, + `decoding`, `attributes`, `layout`, and `fadeInTransition`. The only + addition is `media`. Only the [`src`](#src) and [`media`](#media) properties + are required.* + +) : isBackgroundImage ? ( + + *An `ArtDirective` object can take all the props supported by the{" "} + {} except `attributes`. The only addition + is `media`. Only the [`src`](#src) and [`media`](#media) properties are + required.* + +) : ( + + *An `ArtDirective` object can take all the props supported by the{" "} + {} except `preload`, `loading`, + `decoding`, `attributes`, and `fadeInTransition`. The only addition is + `media`. Only the [`src`](#src) and [`media`](#media) properties are + required.* + +)} + + + **Default:** `undefined` + + The list of art directions to be applied to the generated picture. + + **Code Example:** + + + + + + + #### `media` + + **Type:** `string` + + **Default:** `undefined` + + The CSS media query to use to define the art direction. + + **Code Example:** + + + diff --git a/packages/imagetools_3/docs/src/components/ConfigOptions/aspect.astro b/packages/imagetools_3/docs/src/components/ConfigOptions/aspect.astro new file mode 100644 index 0000000..53a54a8 --- /dev/null +++ b/packages/imagetools_3/docs/src/components/ConfigOptions/aspect.astro @@ -0,0 +1,23 @@ + + + ### `aspect` | `ar` + + **Type:** `number` + + **Default:** _The aspect ratio of the source image_ + + Resizes the image to be the specified aspect ratio. If `height` and `width` are both provided, this will be ignored. If `height` is provided, the `height` will be scaled accordingly. If `width` is provided, the height will be scaled accordingly. If neither height nor width are provided, the image will be cropped to the given `aspect` ratio. + + **Code example:** + + + diff --git a/packages/imagetools_3/docs/src/components/ConfigOptions/assetFileNames.astro b/packages/imagetools_3/docs/src/components/ConfigOptions/assetFileNames.astro new file mode 100644 index 0000000..60a4211 --- /dev/null +++ b/packages/imagetools_3/docs/src/components/ConfigOptions/assetFileNames.astro @@ -0,0 +1,26 @@ + + ### `assetFileNames` + + **Type:** `string` + + **Default:** `_astro/[name]@[width].[hash][extname]` + + The file name pattern for the image assets generated. This config can be used as an alternative to `vite.build.rollupOptions.output.assetFileNames` so that the pattern only applies to assets generated by `astro-imagetools`. Patterns support the following placeholders: + + - `[name]` - the name of the asset (basename of the source file unless the source was a data URI, in which case it's the hash of the data) + - `[width]` - the width descriptor of the image asset + - `[hash]` - the hash of the asset path. A specific length can be specified by appending a colon and the desired length, e.g. `[hash:8]` + - `[ext]` - the extension of the asset (without the leading `.`) + - `[extname]` - the extension of the asset (with the leading `.`) + + > **Note:** Currently, the hash is generated from the asset path, not the asset content. This means that if you change the asset content, the hash will not change. It will be fixed in a future release. + + + diff --git a/packages/imagetools_3/docs/src/components/ConfigOptions/attributes.astro b/packages/imagetools_3/docs/src/components/ConfigOptions/attributes.astro new file mode 100644 index 0000000..570a9f7 --- /dev/null +++ b/packages/imagetools_3/docs/src/components/ConfigOptions/attributes.astro @@ -0,0 +1,116 @@ +--- +const isImg = + Astro.props.component === "Img" || Astro.props.api === "renderImg"; + +const isPicture = + Astro.props.component === "Picture" || Astro.props.api === "renderPicture"; + +const isBackgroundImage = + Astro.props.component === "BackgroundImage" || + Astro.props.api === "renderBackgroundImage"; +--- + + + ### `attributes` + + **Type:** + + + +{isImg ? ( + + ```ts + declare interface Attributes { + style?: Record; + link?: Omit, "as" | "rel" | "imagesizes" | "imagesrcset">; + img?: Omit< + Record, + | "src" + | "alt" + | "srcset" + | "sizes" + | "width" + | "height" + | "loading" + | "decoding" + >; + } + ``` + +) : isPicture ? ( + + ```ts + declare interface Attributes { + picture?: Record; + style?: Record; + link?: Omit, "as" | "rel" | "imagesizes" | "imagesrcset">; + img?: Omit< + Record, + | "src" + | "alt" + | "srcset" + | "sizes" + | "width" + | "height" + | "loading" + | "decoding" + >; + } + ``` + +) : isBackgroundImage ? ( + + ```ts + declare interface Attributes { + container?: Record; + style?: Record; + link?: Omit, "as" | "rel" | "imagesizes" | "imagesrcset">; + } + ``` + +) : ( + + ```ts + declare interface Attributes { + container?: Record; + picture?: Record; + style?: Record; + link?: Omit, "as" | "rel" | "imagesizes" | "imagesrcset">; + img?: Omit< + Record, + | "src" + | "alt" + | "srcset" + | "sizes" + | "width" + | "height" + | "loading" + | "decoding" + >; + } + ``` + +)} + + + **Default:** `{}` + + The HTML attributes to add to the generate elements. If the `class`, `style`, and `onload` attributes are present, the values passed via this config will be merged. + + **Code Example:** + + + diff --git a/packages/imagetools_3/docs/src/components/ConfigOptions/background.astro b/packages/imagetools_3/docs/src/components/ConfigOptions/background.astro new file mode 100644 index 0000000..1f25259 --- /dev/null +++ b/packages/imagetools_3/docs/src/components/ConfigOptions/background.astro @@ -0,0 +1,52 @@ + + + ### `background` + + **Type:** `string` + + **Default:** `undefined` + + This instructs various props (e.g. [`rotate`](#rotate)) to use the specified color when filling empty spots in the image. + + > **Note:** This prop does nothing on it's own, it has to be used in conjunction with another prop. + + **Code example:** + + The below example demonstrates all the posible cases when the `background` prop is used. + + + diff --git a/packages/imagetools_3/docs/src/components/ConfigOptions/backgroundPosition.astro b/packages/imagetools_3/docs/src/components/ConfigOptions/backgroundPosition.astro new file mode 100644 index 0000000..6e29581 --- /dev/null +++ b/packages/imagetools_3/docs/src/components/ConfigOptions/backgroundPosition.astro @@ -0,0 +1,22 @@ + + + ### `backgroundPosition` + + **Type:** `string` + + **Default:** `50% 50%` + + The value of the `background-position` CSS property of the generated background image sets. + + **Code Example:** + + + diff --git a/packages/imagetools_3/docs/src/components/ConfigOptions/backgroundSize.astro b/packages/imagetools_3/docs/src/components/ConfigOptions/backgroundSize.astro new file mode 100644 index 0000000..98e5bb5 --- /dev/null +++ b/packages/imagetools_3/docs/src/components/ConfigOptions/backgroundSize.astro @@ -0,0 +1,22 @@ + + + ### `backgroundSize` + + **Type:** `"fill" | "contain" | "cover" | "none" | "scale-down"` + + **Default:** `cover` + + The value of the `background-size` CSS property of the generated background image sets. + + **Code Example:** + + + diff --git a/packages/imagetools_3/docs/src/components/ConfigOptions/blur.astro b/packages/imagetools_3/docs/src/components/ConfigOptions/blur.astro new file mode 100644 index 0000000..9627c6f --- /dev/null +++ b/packages/imagetools_3/docs/src/components/ConfigOptions/blur.astro @@ -0,0 +1,39 @@ + + + ### `blur` + + **Type:** `string` + + **Default:** `undefined` + + Blurs the image. If the value is `true`, it performs a _fast blur_. When a `number` between `0.3` and `1000` is provided, it performs a more accurate _gaussian blur_. + + **Code example:** + + + diff --git a/packages/imagetools_3/docs/src/components/ConfigOptions/breakpoints.astro b/packages/imagetools_3/docs/src/components/ConfigOptions/breakpoints.astro new file mode 100644 index 0000000..dc04a1a --- /dev/null +++ b/packages/imagetools_3/docs/src/components/ConfigOptions/breakpoints.astro @@ -0,0 +1,44 @@ + + + ### `breakpoints` + + **Type:** `number[] | { count?: number; minWidth?: number; maxWidth?: number }` + + **Default:** `undefined` + + An array of widths in pixels to generate image sets for. If not provided, the breakpoints + will be calculated automatically. + + If an object is passed then the breakpoints will be calculated automatically based + on the values of the `count`, + `minWidth`, and `maxWidth` properties. The `count` property is to specify the number + of breakpoints to generate. The `minWidth` and `maxWidth` properties are to specify + the widths to generate in the range between their values. + + When an object is passed or the `breakpoints` prop is not provided, the breakpoints + are calculated using a simple formula/algorithm. Instead of explaining the complete + algorithm here, I am linking to the [code](https://github.com/RafidMuhymin/astro-imagetools/blob/main/packages/astro-imagetools/utils/getBreakpoints.js). + + **Code example:** + + + diff --git a/packages/imagetools_3/docs/src/components/ConfigOptions/brightness.astro b/packages/imagetools_3/docs/src/components/ConfigOptions/brightness.astro new file mode 100644 index 0000000..ea856a0 --- /dev/null +++ b/packages/imagetools_3/docs/src/components/ConfigOptions/brightness.astro @@ -0,0 +1,23 @@ + + + ### `brightness` + + **Type:** `number` + + **Default:** `undefined` + + Adjusts the images `brightness` with the given brightness multiplier. Commonly used together with [`hue`](#hue) and [`saturation`](#saturation). + + **Code example:** + + + diff --git a/packages/imagetools_3/docs/src/components/ConfigOptions/cacheDir.astro b/packages/imagetools_3/docs/src/components/ConfigOptions/cacheDir.astro new file mode 100644 index 0000000..13b94c7 --- /dev/null +++ b/packages/imagetools_3/docs/src/components/ConfigOptions/cacheDir.astro @@ -0,0 +1,21 @@ + + + ### `cacheDir` + + **Type:** `string` + + **Default:** `./node_modules/.cache/astro-imagetools` (most of the time) + + Where the cached images will be saved to. If not passed the default cache directory will be located using the [`find-cache-dir`](https://www.npmjs.com/package/find-cache-dir) library. + + **Code example:** + + + diff --git a/packages/imagetools_3/docs/src/components/ConfigOptions/content.astro b/packages/imagetools_3/docs/src/components/ConfigOptions/content.astro new file mode 100644 index 0000000..20d9129 --- /dev/null +++ b/packages/imagetools_3/docs/src/components/ConfigOptions/content.astro @@ -0,0 +1,22 @@ + + + ### `content` + + **Type:** `string` + + **Default:** `undefined` + + The content of the html element to apply the generated background image sets to. + + **Code Example:** + + + r.text())`], + }, + ]} +/> diff --git a/packages/imagetools_3/docs/src/components/ConfigOptions/decoding.astro b/packages/imagetools_3/docs/src/components/ConfigOptions/decoding.astro new file mode 100644 index 0000000..a1c5515 --- /dev/null +++ b/packages/imagetools_3/docs/src/components/ConfigOptions/decoding.astro @@ -0,0 +1,24 @@ + + + ### `decoding` + + **Type:** `"async" | "sync" | "auto" | null` + + **Default:** `"async"` + + The value of the `decoding` attribute of the generated `` element. If `null` + is provided, the `decoding` attribute will be omitted. + + **Code example:** + + + diff --git a/packages/imagetools_3/docs/src/components/ConfigOptions/fadeInTransition.astro b/packages/imagetools_3/docs/src/components/ConfigOptions/fadeInTransition.astro new file mode 100644 index 0000000..55c8daa --- /dev/null +++ b/packages/imagetools_3/docs/src/components/ConfigOptions/fadeInTransition.astro @@ -0,0 +1,45 @@ + + + ### `fadeInTransition` + + **Type:** `boolean | { delay?: string; duration?: string; timingFunction?: string; }` + + **Default:** `true | { delay: "0s"; duration?: "1s"; timingFunction: "ease"; }` + + Whether or not to fade in the image when it is loaded. If an object is passed with the `delay`, `duration`, and `timingFunction` properties, the values will be used as values for the [`transition-delay`](https://developer.mozilla.org/en-US/docs/Web/CSS/transition-delay), [`transition-duration`](https://developer.mozilla.org/en-US/docs/Web/CSS/transition-duration), and [`transition-timing-function`](https://developer.mozilla.org/en-US/docs/Web/CSS/transition-timing-function) CSS properties, respectively. + + > **Note:** This prop is only available when the `placeholder` prop of at least one source is not `"none"`. + + **Code Example:** + + + diff --git a/packages/imagetools_3/docs/src/components/ConfigOptions/fallbackFormat.astro b/packages/imagetools_3/docs/src/components/ConfigOptions/fallbackFormat.astro new file mode 100644 index 0000000..5419eec --- /dev/null +++ b/packages/imagetools_3/docs/src/components/ConfigOptions/fallbackFormat.astro @@ -0,0 +1,24 @@ + + + ### `fallbackFormat` + + **Type:** `format` + + **Default:** _The format of the source image_ + + The format the browser will fallback to if the other formats are not supported. + + **Code example:** + + + diff --git a/packages/imagetools_3/docs/src/components/ConfigOptions/fit.astro b/packages/imagetools_3/docs/src/components/ConfigOptions/fit.astro new file mode 100644 index 0000000..0dc2078 --- /dev/null +++ b/packages/imagetools_3/docs/src/components/ConfigOptions/fit.astro @@ -0,0 +1,27 @@ + + + ### `fit` + + **Type:** `"cover" | "contain" | "fill" | "inside" | "outside"` + + **Default:** `undefined` + + When both `width` and `height` are provided, this directive can be used to specify the method by which the image should fit. + + > **Note:** The empty parts are filled with the color specified in the [`background`](#background) prop. + + **Code example:** + + + diff --git a/packages/imagetools_3/docs/src/components/ConfigOptions/flatten.astro b/packages/imagetools_3/docs/src/components/ConfigOptions/flatten.astro new file mode 100644 index 0000000..96df725 --- /dev/null +++ b/packages/imagetools_3/docs/src/components/ConfigOptions/flatten.astro @@ -0,0 +1,23 @@ + + + ### `flatten` + + **Type:** `boolean` + + **Default:** `undefined` + + Whether to remove the alpha channel of the image or not, reducing filesize. Transparent pixels will be merged with the color set by [`background`](#background). + + **Code example:** + + + diff --git a/packages/imagetools_3/docs/src/components/ConfigOptions/flip.astro b/packages/imagetools_3/docs/src/components/ConfigOptions/flip.astro new file mode 100644 index 0000000..ffea04e --- /dev/null +++ b/packages/imagetools_3/docs/src/components/ConfigOptions/flip.astro @@ -0,0 +1,23 @@ + + + ### `flip` + + **Type:** `boolean` + + **Default:** `undefined` + + Flip the image about the vertical axis. This step is always performed **after** any rotation. + + **Code example:** + + + diff --git a/packages/imagetools_3/docs/src/components/ConfigOptions/flop.astro b/packages/imagetools_3/docs/src/components/ConfigOptions/flop.astro new file mode 100644 index 0000000..16bb49e --- /dev/null +++ b/packages/imagetools_3/docs/src/components/ConfigOptions/flop.astro @@ -0,0 +1,23 @@ + + + ### `flop` + + **Type:** `boolean` + + **Default:** `undefined` + + Flop the image about the vertical axis. This step is always performed **after** any rotation. + + **Code example:** + + + diff --git a/packages/imagetools_3/docs/src/components/ConfigOptions/format.astro b/packages/imagetools_3/docs/src/components/ConfigOptions/format.astro new file mode 100644 index 0000000..4427eb2 --- /dev/null +++ b/packages/imagetools_3/docs/src/components/ConfigOptions/format.astro @@ -0,0 +1,44 @@ +--- +const isImg = + Astro.props.component === "Img" || Astro.props.api === "renderImg"; +--- + + + ### `format` + + + +{isImg ? ( + + **Type:** `"heic" | "heif" | "avif" | "jpg" | "jpeg" | "png" | "tiff" | + "webp" | "gif"` **Default:** _The format of the source image_ The format to + generate image sets for. + +) : ( + + **Type:** `format | format[] | [] | null` **`format`:** `"heic" | "heif" | + "avif" | "jpg" | "jpeg" | "png" | "tiff" | "webp" | "gif"` **Default:** + `["avif", "webp"]` The image format or formats to generate image sets for. + If `format` is set to `null` or `[]`, no _additional_ image set will be + generated. > **Note:** Passing `[]` or `null` does not necessarily mean that + no image sets will be generated. Image sets will still be generated for the + source format if `includeSourceFormat` is set to `true` (which is the + default value) and for the format specified in the `fallbackFormat` prop + (the default value is the source format). + +)} + + + **Code Example:** + + + diff --git a/packages/imagetools_3/docs/src/components/ConfigOptions/formatOptions.astro b/packages/imagetools_3/docs/src/components/ConfigOptions/formatOptions.astro new file mode 100644 index 0000000..22fa0e5 --- /dev/null +++ b/packages/imagetools_3/docs/src/components/ConfigOptions/formatOptions.astro @@ -0,0 +1,274 @@ +--- +const { api, component } = Astro.props; + +const isImg = api === "renderImg" || component === "Img"; + +const dynamicText = component + ? `${"`"}<${component} />${"`"} component` + : `${"`"}render${api}${"`"} API`; + +declare interface ConfigOptions { + src: string; + alt: string; + placeholder: string; + format: string | string[]; + fallbackFormat?: string; + includeSourceFormat?: boolean; + formatOptions: string; +} + +const configOptions = { + src: "https://picsum.photos/1024/768", + alt: "A random image", + placeholder: "tracedSVG", +} as ConfigOptions; + +configOptions.format = isImg ? "webp" : [`["webp", "jpg"]`]; +isImg || (configOptions.fallbackFormat = "png"); +isImg || (configOptions.includeSourceFormat = false); +configOptions.formatOptions = isImg + ? `{ + webp: quality: 50, + }` + : `{ + jpg: { + quality: 80, + }, + png: { + quality: 80, + }, + webp: { + quality: 50, + }, + tracedSVG: { + options: { + background: "#fff", + color: "#000", + turnPolicy: "black", + turdSize: 1, + alphaMax: 1, + optCurve: true, + threshold: 100, + blackOnWhite: false, + }, + }, + }`; +--- + + + + ### `formatOptions` + +

Type

+ + _`formatOptions` is an object that takes config options for all the supported formats: `heic`, `heif`, `avif`, `jpg`, `jpeg`, `png`, `tiff`, `webp`, `gif`, and `tracedSVG`._ + + _The supported config options of all the formats except `tracedSVG` are: [`flip`](#flop), [`flop`](#flip), [`invert`](#invert), [`flatten`](#flatten), [`normalize`](#normalize), [`grayscale`](#grayscale), [`hue`](#hue), [`saturation`](#saturation), [`brightness`](#brightness), [`width`](#width), [`height`](#height), [`aspect`](#aspect), [`background`](#background), [`tint`](#tint), [`blur`](#blur), [`median`](#median), [`rotate`](#rotate), [`quality`](#quality), [`fit`](#fit), [`kernel`](#kernel), [`position`](#position)._ + + _The config options supported by the [`tracedSVG`](#tracedSVG) format are listed below._ + + **Default:** _The default values for the all the formats except `tracedSVG` are inherited from the direct configs of the {}. And for more information on the `tracedSVG` property, see the [`PotraceOptions`](#potraceoptions) interface._ + + The configuration options for the different formats. These configuration options will be respected when generating image sets for different formats. + + The `tracedSVG` config object is used only when the `placeholder` prop is set to `"tracedSVG"`. + + **Code example:** +
+ + + + + + #### `tracedSVG` + + All the properties of the `tracedSVG` property are the configuration options supported by the [`node-potrace`](https://npmjs.com/package/node-potrace) library. These options are used to generate traced SVGs when the `placeholder` prop is set to `"tracedSVG"`. All the properties defined below are optional. + + > **Note:** Most of the below _jargons_ are taken from the [`potrace`](https://npmjs.com/package/potrace) documentation. I have tried my best to simplify the config options and make the documentation as simple and clear as possible. + > + > If you want to go deeper into this, check the [Technical documentation](http://potrace.sourceforge.net/#technical) of the original C [`potrace`](http://potrace.sourceforge.net/) library. + > + > If you have a good knowledge on the `potrace` library and about bitmap tracing and posterizing, please consider contributing to update the documentation of this section. + + ##### `function` + + **Type:** `"trace" | "posterize"` + + **Default:** `"trace"` + + Which method of the `node-potrace` library to use. The `posterize` method is basically _tracing_ the image multiple times to produce a more accurate result. See this [example](https://www.npmjs.com/package/potrace#example-and-demo) for more information. + + ##### `options` + + ###### `turnPolicy` + + **Type:** `"black" | "white" | "left" | "right" | "minority" | "majority"` + + **Default:** `"minority"` + + How to resolve ambiguities in path decomposition. Refer to the [**potrace-algorithm**](http://potrace.sourceforge.net/potrace.pdf) documentaion (PDF, page 4) for more information. + + ###### `turdSize` + + **Type:** `number` + + **Default:** `2` + + Suppress speckles of up to this size. + + ###### `alphaMax` + + **Type:** `number` + + **Default:** `1` + + Corner threshold parameter. + + ###### `optCurve` + + **Type:** `boolean` + + **Default:** `true` + + Curve optimization. + + ###### `optTolerance` + + **Type:** `number` + + **Default:** `0.2` + + Curve optimization tolerance. + + ###### `threshold` + + **Type:** `number` + + **Default:** `-1` + + _When `function` is `"trace"` :_ + + Threshold below which color is considered black. Should be a number between 0 and 255 or `-1` in which case threshold will be selected automatically using [Algorithm For Multilevel Thresholding](http://www.iis.sinica.edu.tw/page/jise/2001/200109_01.pdf). + + _When `function` is `"posterize"` :_ + + Breaks image into foreground and background (and only foreground being broken into desired number of layers). Basically when provided it becomes a threshold for last (least opaque) layer and then `steps - 1` intermediate thresholds calculated. If **steps** is an array of thresholds and every value from the array is lower (or larger if **blackOnWhite** parameter set to `false`) than threshold - threshold will be added to the array, otherwise just ignored. + + ###### `blackOnWhite` + + **Type:** `boolean` + + **Default:** `true` + + Specifies colors by which side from threshold should be turned into vector shape. + + ###### `color` + + **Type:** `"auto" | string` + + **Default:** `"auto"` + + Fill color for the traced image. If `"auto"` is provided, the color will be black or white depending on the `blackOnWhite` property. + +
background
+ + **Type:** `"transparent" | string` + + **Default:** `"transparent"` + + Background color of the traced image. If `"transparent"` is provided, no background will be present. + + ###### `fill` + + **Type:** `"spread" | "dominant" | "median" | "mean"` + + Determines how fill color for each layer should be selected. + + - `dominant` - Most frequent color in range (used by default), + - `mean` - Arithmetic mean (average), + - `median` - Median color, + - `spread` - Ignores color information of the image and just spreads colors equally in range between 0 and `threshold` (or `threshold` and ..255 if `blackOnWhite` is set to `false`). + + > **Note:** This option is available only when `function` is `"posterize"`. + + ###### `ranges` + + **Type:** `"auto" | "equal"` + + How color stops for each layer should be selected. Ignored if `steps` is an array. Possible values are: + + - `auto` - Performs automatic thresholding (using [Algorithm For Multilevel Thresholding](http://www.iis.sinica.edu.tw/page/jise/2001/200109_01.pdf)). Preferable method for already posterized sources, but takes long time to calculate 5 or more thresholds (exponential time complexity) _(used by default)_ + - `equal` - Ignores color information of the image and breaks available color space into equal chunks + + > **Note:** This option is available only when `function` is `"posterize"`. + + ###### `steps` + + **Type:** `number | number[]` + + Specifies desired number of layers in resulting image. If a number provided - thresholds for each layer will be automatically calculated according to `ranges` property. If an array provided it expected to be an array with precomputed thresholds for each layer (in range between 0 and 255). + + > **Note:** This option is available only when `function` is `"posterize"`. + + **Code example:** +
+ + diff --git a/packages/imagetools_3/docs/src/components/ConfigOptions/grayscale.astro b/packages/imagetools_3/docs/src/components/ConfigOptions/grayscale.astro new file mode 100644 index 0000000..0583c8f --- /dev/null +++ b/packages/imagetools_3/docs/src/components/ConfigOptions/grayscale.astro @@ -0,0 +1,25 @@ + + + ### `grayscale` + + **Type:** `boolean` + + **Default:** `undefined` + + Converts the image to an 8-bit grayscale image. + + > **Note:** If `true` the image will be converted to the `b-w` colorspace, meaning the resulting image will only have one channel. + + **Code example:** + + + diff --git a/packages/imagetools_3/docs/src/components/ConfigOptions/height.astro b/packages/imagetools_3/docs/src/components/ConfigOptions/height.astro new file mode 100644 index 0000000..5bb39a0 --- /dev/null +++ b/packages/imagetools_3/docs/src/components/ConfigOptions/height.astro @@ -0,0 +1,25 @@ + + + ### `height` | `h` + + **Type:** `number` + + **Default:** _The height of the source image_ + + Resizes the image to be the specified amount of pixels tall. If not given the `width` will be scaled accordingly. + + > **Note:** The specified `height` will be used to resize the source image when loading it. The final heights of the image will be based on the final calculated [`breakpoints`](#breakpoints). + + **Code example:** + + + diff --git a/packages/imagetools_3/docs/src/components/ConfigOptions/hue.astro b/packages/imagetools_3/docs/src/components/ConfigOptions/hue.astro new file mode 100644 index 0000000..3741ae5 --- /dev/null +++ b/packages/imagetools_3/docs/src/components/ConfigOptions/hue.astro @@ -0,0 +1,23 @@ + + + ### `hue` + + **Type:** `number` + + **Default:** `undefined` + + Adjusts the images `hue` rotation by the given number of degrees. Commonly used together with [`saturation`](#saturation) and [`brightness`](#brightness). + + **Code example:** + + + diff --git a/packages/imagetools_3/docs/src/components/ConfigOptions/includeSourceFormat.astro b/packages/imagetools_3/docs/src/components/ConfigOptions/includeSourceFormat.astro new file mode 100644 index 0000000..484cbff --- /dev/null +++ b/packages/imagetools_3/docs/src/components/ConfigOptions/includeSourceFormat.astro @@ -0,0 +1,24 @@ + + + ### `includeSourceFormat` + + **Type:** `boolean` + + **Default:** `true` + + Whether to generate image set for the source format or not. + + **Code example:** + + + diff --git a/packages/imagetools_3/docs/src/components/ConfigOptions/invert.astro b/packages/imagetools_3/docs/src/components/ConfigOptions/invert.astro new file mode 100644 index 0000000..f23e86f --- /dev/null +++ b/packages/imagetools_3/docs/src/components/ConfigOptions/invert.astro @@ -0,0 +1,23 @@ + + + ### `invert` + + **Type:** `boolean` + + **Default:** `undefined` + + Produces a **negative** of the image. + + **Code example:** + + + diff --git a/packages/imagetools_3/docs/src/components/ConfigOptions/kernel.astro b/packages/imagetools_3/docs/src/components/ConfigOptions/kernel.astro new file mode 100644 index 0000000..d2d2d59 --- /dev/null +++ b/packages/imagetools_3/docs/src/components/ConfigOptions/kernel.astro @@ -0,0 +1,23 @@ + + + ### `kernel` + + **Type:** `"nearest" | "cubic" | "mitchell" | "lanczos2" | "lanczos3"` + + **Default:** `undefined` + + The interpolation kernel to use when resizing the images. + + **Code example:** + + + diff --git a/packages/imagetools_3/docs/src/components/ConfigOptions/layout.astro b/packages/imagetools_3/docs/src/components/ConfigOptions/layout.astro new file mode 100644 index 0000000..7d79be7 --- /dev/null +++ b/packages/imagetools_3/docs/src/components/ConfigOptions/layout.astro @@ -0,0 +1,40 @@ + + + ### `layout` + + **Type:** `"constrained" | "fixed" | "fullWidth" | "fill"` + + **Default:** `"constrained"` + + The layout mode to determine the resizing behavior of the image in the + browser. + + In `constrained` mode, the image will occupy full width of the container + with `max-width` set to 100% its width. The height of the image will be calculated + based on the aspect ratio of the image. The image will be scaled down to fit the + container but won't be enlarged. + + In `fixed` mode, the image will have a fixed width + and height. The `width` and `height` props will be used to set the width and height + of the image. The image won't be scaled down nor enlarged. + + In `fullWidth` mode, + the image will be scaled up or down to occupy the full width of the container. + The height of the image will be calculated based on the aspect ratio of the image. + + In `fill` mode, the image will be scaled up or down to fill the entire width and + height of the container. + + **Code example:** + + + diff --git a/packages/imagetools_3/docs/src/components/ConfigOptions/loading.astro b/packages/imagetools_3/docs/src/components/ConfigOptions/loading.astro new file mode 100644 index 0000000..ff3116f --- /dev/null +++ b/packages/imagetools_3/docs/src/components/ConfigOptions/loading.astro @@ -0,0 +1,24 @@ + + + ### `loading` + + **Type:** `"lazy" | "eager" | "auto" | null` + + **Default:** `preload ? "eager" : "lazy"` + + The value of the `loading` attribute of the generated `` element. If `null` + is provided, the `loading` attribute will be omitted. + + **Code Example:** + + + diff --git a/packages/imagetools_3/docs/src/components/ConfigOptions/median.astro b/packages/imagetools_3/docs/src/components/ConfigOptions/median.astro new file mode 100644 index 0000000..b399412 --- /dev/null +++ b/packages/imagetools_3/docs/src/components/ConfigOptions/median.astro @@ -0,0 +1,39 @@ + + + ### `median` + + **Type:** `number | boolean` + + **Default:** `undefined` + + Applies a median filter. This is commonly used to remove noise from images. + + **Code example:** + + + diff --git a/packages/imagetools_3/docs/src/components/ConfigOptions/normalize.astro b/packages/imagetools_3/docs/src/components/ConfigOptions/normalize.astro new file mode 100644 index 0000000..8ffd1eb --- /dev/null +++ b/packages/imagetools_3/docs/src/components/ConfigOptions/normalize.astro @@ -0,0 +1,23 @@ + + + ### `normalize` + + **Type:** `boolean` + + **Default:** `undefined` + + **Normalizes** the image by stretching its luminance to cover the full dynamic range. This Enhances the output image contrast. + + **Code example:** + + + diff --git a/packages/imagetools_3/docs/src/components/ConfigOptions/objectFit.astro b/packages/imagetools_3/docs/src/components/ConfigOptions/objectFit.astro new file mode 100644 index 0000000..2b645a2 --- /dev/null +++ b/packages/imagetools_3/docs/src/components/ConfigOptions/objectFit.astro @@ -0,0 +1,23 @@ + + + ### `objectFit` + + **Type:** `"fill" | "contain" | "cover" | "none" | "scale-down"` + + **Default:** `cover` + + The value of the `object-fit` CSS property of the generated `` element. + + **Code example:** + + + diff --git a/packages/imagetools_3/docs/src/components/ConfigOptions/objectPosition.astro b/packages/imagetools_3/docs/src/components/ConfigOptions/objectPosition.astro new file mode 100644 index 0000000..3d55ca1 --- /dev/null +++ b/packages/imagetools_3/docs/src/components/ConfigOptions/objectPosition.astro @@ -0,0 +1,23 @@ + + + ### `objectPosition` + + **Type:** `string` + + **Default:** `50% 50%` + + The value of the `object-position` CSS property of the generated `` element. + + **Code example:** + + + diff --git a/packages/imagetools_3/docs/src/components/ConfigOptions/placeholder.astro b/packages/imagetools_3/docs/src/components/ConfigOptions/placeholder.astro new file mode 100644 index 0000000..e4fb27d --- /dev/null +++ b/packages/imagetools_3/docs/src/components/ConfigOptions/placeholder.astro @@ -0,0 +1,35 @@ + + + ### `placeholder` + + **Type:** `"dominantColor" | "blurred" | "tracedSVG" | "none"` + + **Default:** `"blurred"` + + The placeholder to be displayed while the image is loading. + + If `placeholder` is set to `"dominantColor"`, the dominant color of the source + image will be used as the placeholder. + + If the value is set to `"blurred"`, a very low-resolution version of the + provided image will be enlarged and used as the placeholder. + + If the value is set to `"tracedSVG"`, a traced SVG of the image will be used + as the placeholder. If the value is set to `"none"`, no placeholder will be + displayed. + + > **Note:** If the value is set to `"tracedSVG"`, the placeholder can be customized to be a **Posterized SVG** too. See the [**formatOptions**](#formatOptions) prop for more details. + + **Code example:** + + + diff --git a/packages/imagetools_3/docs/src/components/ConfigOptions/position.astro b/packages/imagetools_3/docs/src/components/ConfigOptions/position.astro new file mode 100644 index 0000000..3fb4aa3 --- /dev/null +++ b/packages/imagetools_3/docs/src/components/ConfigOptions/position.astro @@ -0,0 +1,28 @@ + + + ### `position` + + **Type:** `"top" | "right top" | "right" | "right bottom" | "bottom" | "left bottom" | "left" | "left top" | "north" | "northeast" | "east" | "southeast" | "south" | "southwest" | "west" | "northwest" | "center" | "centre" | "cover" | "entropy" | "attention"` + + **Default:** `undefined` + + When both `width` and `height` are provided **AND** `fit` is is set to `cover` or `contain`, this directive can be used to set the position of the image. + + > See `sharp`'s [resize options](https://sharp.pixelplumbing.com/api-resize#resize) for more information. + + **Code example:** + + + diff --git a/packages/imagetools_3/docs/src/components/ConfigOptions/preload.astro b/packages/imagetools_3/docs/src/components/ConfigOptions/preload.astro new file mode 100644 index 0000000..b48b33c --- /dev/null +++ b/packages/imagetools_3/docs/src/components/ConfigOptions/preload.astro @@ -0,0 +1,25 @@ + + + ### `preload` + + **Type:** `"heic" | "heif" | "avif" | "jpg" | "jpeg" | "png" | "tiff" | "webp" | "gif"` + + **Default:** `undefined` + + Which format of image set to preload. + + > **Note:** It's not reasonable to preload multiple formats of the same image. And due to the factors like file size and browser support, it's not possible to pick the best format automatically. + + **Code example:** + + + diff --git a/packages/imagetools_3/docs/src/components/ConfigOptions/quality.astro b/packages/imagetools_3/docs/src/components/ConfigOptions/quality.astro new file mode 100644 index 0000000..5107d8c --- /dev/null +++ b/packages/imagetools_3/docs/src/components/ConfigOptions/quality.astro @@ -0,0 +1,27 @@ + + + ### `quality` + + **Type:** `number` + + **Default:** `undefined` + + All formats (except `gif`) allow the quality to be adjusted by setting this directive. + + The argument must be a number between `0` and `100`. + + > See sharps [Output options](https://sharp.pixelplumbing.com/api-output) for default quality values. + + **Code example:** + + + diff --git a/packages/imagetools_3/docs/src/components/ConfigOptions/rotate.astro b/packages/imagetools_3/docs/src/components/ConfigOptions/rotate.astro new file mode 100644 index 0000000..e7c7d2e --- /dev/null +++ b/packages/imagetools_3/docs/src/components/ConfigOptions/rotate.astro @@ -0,0 +1,25 @@ + + + ### `rotate` + + **Type:** `number` + + **Default:** `undefined` + + Rotate the image by the specified number of degrees. + + > **Note:** The empty parts are filled with the color specified in the [`background`](#background) prop. + + **Code example:** + + + diff --git a/packages/imagetools_3/docs/src/components/ConfigOptions/saturation.astro b/packages/imagetools_3/docs/src/components/ConfigOptions/saturation.astro new file mode 100644 index 0000000..a9d5a23 --- /dev/null +++ b/packages/imagetools_3/docs/src/components/ConfigOptions/saturation.astro @@ -0,0 +1,23 @@ + + + ### `saturation` + + **Type:** `number` + + **Default:** `undefined` + + Adjusts the images `saturation` with the given saturation multiplier. Commonly used together with [`hue`](#hue) and [`brightness`](#brightness). + + **Code example:** + + + diff --git a/packages/imagetools_3/docs/src/components/ConfigOptions/sizes.astro b/packages/imagetools_3/docs/src/components/ConfigOptions/sizes.astro new file mode 100644 index 0000000..281e477 --- /dev/null +++ b/packages/imagetools_3/docs/src/components/ConfigOptions/sizes.astro @@ -0,0 +1,36 @@ + + + ### `sizes` + + **Type:** `string` or `(breakpoints: number[]) => string` + + **Default:** `` (breakpoints) => `(min-width: ${breakpoints[breakpopints.length - 1]}px) ${breakpoints[breakpopints.length - 1]}px, 100vw `` + + A string or function that returns a string suitable for the value of the `sizes` + attribute of the generated `` element. The final calculated breakpoints + are passed to the function as a parameter. + + **Code example:** + + + { + const maxWidth = breakpoints[breakpoints.length - 1]; + return `(min-width: ${maxWidth}px) ${maxWidth}px, 100vw`; + }, + }, + ]} +/> diff --git a/packages/imagetools_3/docs/src/components/ConfigOptions/src.astro b/packages/imagetools_3/docs/src/components/ConfigOptions/src.astro new file mode 100644 index 0000000..ca03553 --- /dev/null +++ b/packages/imagetools_3/docs/src/components/ConfigOptions/src.astro @@ -0,0 +1,53 @@ + + + ### `src` + + **Type:** `string` + + **Default:** `undefined` + + The path to the source image. If local, the path must be relative to the project root. Remote URLs and Data URIs are also supported. + + **Code example:** + + + + + + #### SSR Usage + + In `SSR` mode, if you are using local images, you have to generate assets for them first and then you have to pass the path to the assets to the `src` property. + + + + + + > The `raw` query parameter has been used to tell the internal Vite plugin to emit the asset from the source image unchanged. + diff --git a/packages/imagetools_3/docs/src/components/ConfigOptions/tag.astro b/packages/imagetools_3/docs/src/components/ConfigOptions/tag.astro new file mode 100644 index 0000000..34269f6 --- /dev/null +++ b/packages/imagetools_3/docs/src/components/ConfigOptions/tag.astro @@ -0,0 +1,22 @@ + + + ### `tag` + + **Type:** `string` + + **Default:** `section` + + Which html tag to use for the html element to apply the generated background image sets to. + + **Code Example:** + + + diff --git a/packages/imagetools_3/docs/src/components/ConfigOptions/tint.astro b/packages/imagetools_3/docs/src/components/ConfigOptions/tint.astro new file mode 100644 index 0000000..0640a21 --- /dev/null +++ b/packages/imagetools_3/docs/src/components/ConfigOptions/tint.astro @@ -0,0 +1,23 @@ + + + ### `tint` + + **Type:** `string` + + **Default:** `undefined` + + Tints the image using the provided chroma while preserving the image luminance. If the image has an alpha channel it will be untouched. + + **Code example:** + + + diff --git a/packages/imagetools_3/docs/src/components/ConfigOptions/width.astro b/packages/imagetools_3/docs/src/components/ConfigOptions/width.astro new file mode 100644 index 0000000..c9ba92f --- /dev/null +++ b/packages/imagetools_3/docs/src/components/ConfigOptions/width.astro @@ -0,0 +1,25 @@ + + + ### `width` | `w` + + **Type:** `number` + + **Default:** _The width of the source image_ + + Resizes the image to be the specified amount of pixels wide. If not given the `height` will be scaled accordingly. + + > **Note:** The specified `width` will be used to resize the source image when loading it. The final widths of the image will be based on the final calculated [`breakpoints`](#breakpoints). + + **Code example:** + + + diff --git a/packages/imagetools_3/docs/src/components/Footer/AvatarList.astro b/packages/imagetools_3/docs/src/components/Footer/AvatarList.astro new file mode 100644 index 0000000..1804608 --- /dev/null +++ b/packages/imagetools_3/docs/src/components/Footer/AvatarList.astro @@ -0,0 +1,176 @@ +--- +// fetch all commits for just this page's path +const path = "docs/" + Astro.props.path; +const url = `https://api.github.com/repos/withastro/astro/commits?path=${path}`; +const commitsURL = `https://github.com/withastro/astro/commits/main/${path}`; + +async function getCommits(url) { + try { + const token: string = import.meta.env.SNOWPACK_PUBLIC_GITHUB_TOKEN; + + if (!token) { + throw new Error( + 'Cannot find "SNOWPACK_PUBLIC_GITHUB_TOKEN" used for escaping rate-limiting.' + ); + } + + const auth = `Basic ${Buffer.from(token, "binary").toString("base64")}`; + + const res = await fetch(url, { + method: "GET", + headers: { + Authorization: auth, + "User-Agent": "astro-docs/1.0", + }, + }); + + const data = await res.json(); + + if (!res.ok) { + throw new Error( + `Request to fetch commits failed. Reason: ${res.statusText} + Message: ${data.message}` + ); + } + + return data; + } catch (e) { + console.warn(`[error] /src/components/AvatarList.astro + ${e?.message ?? e}`); + + return new Array(); + } +} + +function removeDups(arr) { + if (!arr) { + return new Array(); + } + + let map = new Map(); + + for (let item of arr) { + let author = item.author; + + // Deduplicate based on author.id + map.set(author.id, { login: author.login, id: author.id }); + } + + return Array.from(map.values()); +} + +const data = await getCommits(url); +const unique = removeDups(data); +const recentContributors = unique.slice(0, 3); // only show avatars for the 3 most recent contributors +const additionalContributors = unique.length - recentContributors.length; // list the rest of them as # of extra contributors +--- + + +
+
    + {recentContributors.map((item) => ( +
  • + + {`Contributor + +
  • + ))} +
+ + {additionalContributors > 0 && ( + + {`and ${additionalContributors} additional contributor${ + additionalContributors > 1 ? "s" : "" + }.`} + + )} + + {unique.length === 0 && Contributors} +
+ + diff --git a/packages/imagetools_3/docs/src/components/Footer/Footer.astro b/packages/imagetools_3/docs/src/components/Footer/Footer.astro new file mode 100644 index 0000000..21c56d8 --- /dev/null +++ b/packages/imagetools_3/docs/src/components/Footer/Footer.astro @@ -0,0 +1,16 @@ +--- +import AvatarList from "./AvatarList.astro"; +const { path } = Astro.props; +--- + +
+ +
+ + diff --git a/packages/imagetools_3/docs/src/components/HeadCommon.astro b/packages/imagetools_3/docs/src/components/HeadCommon.astro new file mode 100644 index 0000000..addcd1c --- /dev/null +++ b/packages/imagetools_3/docs/src/components/HeadCommon.astro @@ -0,0 +1,47 @@ +--- +import "../styles/theme.css"; +import "../styles/index.css"; +--- + + + + + + + + + + + + + + + + + + + + + + + diff --git a/packages/imagetools_3/docs/src/components/HeadSEO.astro b/packages/imagetools_3/docs/src/components/HeadSEO.astro new file mode 100644 index 0000000..a31c4e7 --- /dev/null +++ b/packages/imagetools_3/docs/src/components/HeadSEO.astro @@ -0,0 +1,52 @@ +--- +import { SITE, OPEN_GRAPH } from "../config.ts"; + +export interface Props { + content: any; + site: any; + canonicalURL: URL | string; +} + +const { content = {}, canonicalURL } = Astro.props; +const formattedContentTitle = content.title + ? `${content.title} 🚀 ${SITE.title}` + : SITE.title; +const imageSrc = content?.image?.src ?? OPEN_GRAPH.image.src; +const canonicalImageSrc = new URL(imageSrc, Astro.site); +const imageAlt = content?.image?.alt ?? OPEN_GRAPH.image.alt; +--- + + + + + + + + + + + + + + + + + + + + + + + diff --git a/packages/imagetools_3/docs/src/components/Header/AstroLogo.astro b/packages/imagetools_3/docs/src/components/Header/AstroLogo.astro new file mode 100644 index 0000000..14eb5bc --- /dev/null +++ b/packages/imagetools_3/docs/src/components/Header/AstroLogo.astro @@ -0,0 +1,37 @@ +--- +const { size } = Astro.props; +--- + + diff --git a/packages/imagetools_3/docs/src/components/Header/Header.astro b/packages/imagetools_3/docs/src/components/Header/Header.astro new file mode 100644 index 0000000..653664f --- /dev/null +++ b/packages/imagetools_3/docs/src/components/Header/Header.astro @@ -0,0 +1,144 @@ +--- +import { getLanguageFromURL, KNOWN_LANGUAGE_CODES } from "../../languages.ts"; +import * as CONFIG from "../../config.ts"; +import AstroLogo from "./AstroLogo.astro"; +import SkipToContent from "./SkipToContent.astro"; +import SidebarToggle from "./SidebarToggle.tsx"; +import LanguageSelect from "./LanguageSelect.tsx"; +import Search from "./Search.tsx"; + +const { currentPage } = Astro.props; +const lang = currentPage && getLanguageFromURL(currentPage); +--- + +
+ + + +
+ + diff --git a/packages/imagetools_3/docs/src/components/Header/LanguageSelect.css b/packages/imagetools_3/docs/src/components/Header/LanguageSelect.css new file mode 100644 index 0000000..8d73ace --- /dev/null +++ b/packages/imagetools_3/docs/src/components/Header/LanguageSelect.css @@ -0,0 +1,50 @@ +.language-select { + flex-grow: 1; + width: 48px; + box-sizing: border-box; + margin: 0; + padding: 0.33em 0.5em; + overflow: visible; + font-weight: 500; + font-size: 1rem; + font-family: inherit; + line-height: inherit; + background-color: var(--theme-bg); + border-color: var(--theme-text-lighter); + color: var(--theme-text-light); + border-style: solid; + border-width: 1px; + border-radius: 0.25rem; + outline: 0; + cursor: pointer; + transition-timing-function: ease-out; + transition-duration: 0.2s; + transition-property: border-color, color; + -webkit-font-smoothing: antialiased; + padding-left: 30px; + padding-right: 1rem; +} + +.language-select-wrapper .language-select:hover, +.language-select-wrapper .language-select:focus { + color: var(--theme-text); + border-color: var(--theme-text-light); +} + +.language-select-wrapper { + color: var(--theme-text-light); + position: relative; +} + +.language-select-wrapper > svg { + position: absolute; + top: 7px; + left: 10px; + pointer-events: none; +} + +@media (min-width: 50em) { + .language-select { + width: 100%; + } +} diff --git a/packages/imagetools_3/docs/src/components/Header/LanguageSelect.tsx b/packages/imagetools_3/docs/src/components/Header/LanguageSelect.tsx new file mode 100644 index 0000000..6e9ce5c --- /dev/null +++ b/packages/imagetools_3/docs/src/components/Header/LanguageSelect.tsx @@ -0,0 +1,50 @@ +import type { FunctionalComponent } from "preact"; +import { h } from "preact"; +import "./LanguageSelect.css"; +import { KNOWN_LANGUAGES, langPathRegex } from "../../languages"; + +const LanguageSelect: FunctionalComponent<{ lang: string }> = ({ lang }) => { + return ( +
+ + + +
+ ); +}; + +export default LanguageSelect; diff --git a/packages/imagetools_3/docs/src/components/Header/Search.css b/packages/imagetools_3/docs/src/components/Header/Search.css new file mode 100644 index 0000000..5d8a2e7 --- /dev/null +++ b/packages/imagetools_3/docs/src/components/Header/Search.css @@ -0,0 +1,81 @@ +/** Style Algolia */ +:root { + --docsearch-primary-color: var(--theme-accent); + --docsearch-logo-color: var(--theme-text); +} + +.search-input { + flex-grow: 1; + box-sizing: border-box; + width: 100%; + margin: 0; + padding: 0.33em 0.5em; + overflow: visible; + font-weight: 500; + font-size: 1rem; + font-family: inherit; + line-height: inherit; + background-color: var(--theme-divider); + border-color: var(--theme-divider); + color: var(--theme-text-light); + border-style: solid; + border-width: 1px; + border-radius: 0.25rem; + outline: 0; + cursor: pointer; + transition-timing-function: ease-out; + transition-duration: 0.2s; + transition-property: border-color, color; + -webkit-font-smoothing: antialiased; +} + +.search-input:hover, +.search-input:focus { + color: var(--theme-text); + border-color: var(--theme-text-light); +} + +.search-input:hover::placeholder, +.search-input:focus::placeholder { + color: var(--theme-text-light); +} + +.search-input::placeholder { + color: var(--theme-text-light); +} + +.search-hint { + position: absolute; + top: 7px; + right: 19px; + padding: 3px 5px; + display: none; + display: none; + align-items: center; + justify-content: center; + letter-spacing: 0.125em; + font-size: 13px; + font-family: var(--font-mono); + pointer-events: none; + border-color: var(--theme-text-lighter); + color: var(--theme-text-light); + border-style: solid; + border-width: 1px; + border-radius: 0.25rem; + line-height: 14px; +} + +@media (min-width: 50em) { + .search-hint { + display: flex; + } +} + +/* ------------------------------------------------------------ *\ + DocSearch (Algolia) +\* ------------------------------------------------------------ */ + +.DocSearch-Modal .DocSearch-Hit a { + box-shadow: none; + border: 1px solid var(--theme-accent); +} diff --git a/packages/imagetools_3/docs/src/components/Header/Search.tsx b/packages/imagetools_3/docs/src/components/Header/Search.tsx new file mode 100644 index 0000000..5b1056d --- /dev/null +++ b/packages/imagetools_3/docs/src/components/Header/Search.tsx @@ -0,0 +1,104 @@ +/* jsxImportSource: react */ +import { useState, useCallback, useRef } from "react"; +import * as CONFIG from "../../config"; +import "@docsearch/css/dist/style.css"; +import "./Search.css"; + +// @ts-ignore +import * as docSearchReact from "@docsearch/react"; +// @ts-ignore +import { createPortal } from "react-dom"; + +export default function Search() { + const DocSearchModal = + docSearchReact.DocSearchModal || docSearchReact.default.DocSearchModal; + + const useDocSearchKeyboardEvents = + docSearchReact.useDocSearchKeyboardEvents || + docSearchReact.default.useDocSearchKeyboardEvents; + + const [isOpen, setIsOpen] = useState(false); + const searchButtonRef = useRef(); + const [initialQuery, setInitialQuery] = useState(null); + + const onOpen = useCallback(() => { + setIsOpen(true); + }, [setIsOpen]); + + const onClose = useCallback(() => { + setIsOpen(false); + }, [setIsOpen]); + + const onInput = useCallback( + (e) => { + setIsOpen(true); + setInitialQuery(e.key); + }, + [setIsOpen, setInitialQuery] + ); + + useDocSearchKeyboardEvents({ + isOpen, + onOpen, + onClose, + onInput, + searchButtonRef, + }); + + return ( + <> + + + {isOpen && + createPortal( + { + return items.map((item) => { + // We transform the absolute URL into a relative URL to + // work better on localhost, preview URLS. + const a = document.createElement("a"); + a.href = item.url; + const hash = a.hash === "#overview" ? "" : a.hash; + return { + ...item, + url: `${a.pathname}${hash}`, + }; + }); + }} + />, + document.body + )} + + ); +} diff --git a/packages/imagetools_3/docs/src/components/Header/SidebarToggle.tsx b/packages/imagetools_3/docs/src/components/Header/SidebarToggle.tsx new file mode 100644 index 0000000..6ff4a6d --- /dev/null +++ b/packages/imagetools_3/docs/src/components/Header/SidebarToggle.tsx @@ -0,0 +1,45 @@ +import type { FunctionalComponent } from "preact"; +import { h, Fragment } from "preact"; +import { useState, useEffect } from "preact/hooks"; + +const MenuToggle: FunctionalComponent = () => { + const [sidebarShown, setSidebarShown] = useState(false); + + useEffect(() => { + const body = document.getElementsByTagName("body")[0]; + if (sidebarShown) { + body.classList.add("mobile-sidebar-toggle"); + } else { + body.classList.remove("mobile-sidebar-toggle"); + } + }, [sidebarShown]); + + return ( + + ); +}; + +export default MenuToggle; diff --git a/packages/imagetools_3/docs/src/components/Header/SkipToContent.astro b/packages/imagetools_3/docs/src/components/Header/SkipToContent.astro new file mode 100644 index 0000000..b2b542f --- /dev/null +++ b/packages/imagetools_3/docs/src/components/Header/SkipToContent.astro @@ -0,0 +1,24 @@ + + + diff --git a/packages/imagetools_3/docs/src/components/LeftSidebar/LeftSidebar.astro b/packages/imagetools_3/docs/src/components/LeftSidebar/LeftSidebar.astro new file mode 100644 index 0000000..afa61a7 --- /dev/null +++ b/packages/imagetools_3/docs/src/components/LeftSidebar/LeftSidebar.astro @@ -0,0 +1,130 @@ +--- +import { getLanguageFromURL } from "../../languages.ts"; +import { SIDEBAR } from "../../config.ts"; + +const { currentPage } = Astro.props; +const currentPageMatch = currentPage.slice(1); +const langCode = getLanguageFromURL(currentPage); + +// SIDEBAR is a flat array. Group it by sections to properly render. +const sidebarSections = SIDEBAR[langCode].reduce((col, item, i) => { + // If the first item is not a section header, create a new container section. + if (i === 0) { + if (!item.header) { + const pesudoSection = { text: "" }; + col.push({ ...pesudoSection, children: [] }); + } + } + + if (item.header) { + col.push({ ...item, children: [] }); + } else { + col[col.length - 1].children.push(item); + } + + return col; +}, []); +--- + + + + + + diff --git a/packages/imagetools_3/docs/src/components/PageContent/PageContent.astro b/packages/imagetools_3/docs/src/components/PageContent/PageContent.astro new file mode 100644 index 0000000..d306afd --- /dev/null +++ b/packages/imagetools_3/docs/src/components/PageContent/PageContent.astro @@ -0,0 +1,49 @@ +--- +import MoreMenu from "../RightSidebar/MoreMenu.astro"; +import TableOfContents from "../RightSidebar/TableOfContents.tsx"; + +const { content, githubEditUrl } = Astro.props; +const title = content.title; +const headers = content.astro.headers; +--- + +
+
+

{title}

+ + + + +
+ + +
+ + diff --git a/packages/imagetools_3/docs/src/components/RightSidebar/MoreMenu.astro b/packages/imagetools_3/docs/src/components/RightSidebar/MoreMenu.astro new file mode 100644 index 0000000..54446ca --- /dev/null +++ b/packages/imagetools_3/docs/src/components/RightSidebar/MoreMenu.astro @@ -0,0 +1,74 @@ +--- +import ThemeToggleButton from "./ThemeToggleButton.tsx"; +import * as CONFIG from "../../config"; + +const { editHref } = Astro.props; +const showMoreSection = CONFIG.COMMUNITY_INVITE_URL || editHref; +--- + +{showMoreSection &&

More

} + + +
+ +
+ + diff --git a/packages/imagetools_3/docs/src/components/RightSidebar/RightSidebar.astro b/packages/imagetools_3/docs/src/components/RightSidebar/RightSidebar.astro new file mode 100644 index 0000000..fca7ca1 --- /dev/null +++ b/packages/imagetools_3/docs/src/components/RightSidebar/RightSidebar.astro @@ -0,0 +1,29 @@ +--- +import TableOfContents from "./TableOfContents.tsx"; +import MoreMenu from "./MoreMenu.astro"; + +const { content, githubEditUrl } = Astro.props; +const headers = content.astro.headers; +--- + + + + diff --git a/packages/imagetools_3/docs/src/components/RightSidebar/TableOfContents.tsx b/packages/imagetools_3/docs/src/components/RightSidebar/TableOfContents.tsx new file mode 100644 index 0000000..84de46f --- /dev/null +++ b/packages/imagetools_3/docs/src/components/RightSidebar/TableOfContents.tsx @@ -0,0 +1,51 @@ +import type { FunctionalComponent } from "preact"; +import { useState, useEffect } from "preact/hooks"; + +declare interface Header { + depth: number; + slug: string; + text: string; +} + +const TableOfContents: FunctionalComponent<{ headers: Header[] }> = ({ + headers = [], +}) => { + const [renderedHeaders, setRenderedHeaders] = useState(undefined); + + useEffect(() => { + const titles = document.querySelectorAll("article :is(h1, h2, h3, h4)"); + + const newRenderedHeaders = [...titles] + .map((title) => { + const depth = parseInt(title.tagName.substring(1)); + const slug = title.id; + const text = title.textContent; + return { depth, slug, text }; + }) + .filter(({ slug }) => slug !== ""); + + setRenderedHeaders(newRenderedHeaders); + }, []); + + return ( + <> +

On this page

+ +
    + + + {(renderedHeaders || headers) + .filter(({ depth }) => depth > 1 && depth < 4) + .map(({ depth, slug, text }) => ( + + ))} +
+ + ); +}; + +export default TableOfContents; diff --git a/packages/imagetools_3/docs/src/components/RightSidebar/ThemeToggleButton.css b/packages/imagetools_3/docs/src/components/RightSidebar/ThemeToggleButton.css new file mode 100644 index 0000000..9a41946 --- /dev/null +++ b/packages/imagetools_3/docs/src/components/RightSidebar/ThemeToggleButton.css @@ -0,0 +1,37 @@ +.theme-toggle { + display: inline-flex; + align-items: center; + gap: 0.25em; + padding: 0.33em 0.67em; + border-radius: 99em; + background-color: var(--theme-code-inline-bg); +} + +.theme-toggle > label:focus-within { + outline: 2px solid transparent; + box-shadow: 0 0 0 0.08em var(--theme-accent), 0 0 0 0.12em white; +} + +.theme-toggle > label { + color: var(--theme-code-inline-text); + position: relative; + display: flex; + align-items: center; + justify-content: center; + opacity: 0.5; +} + +.theme-toggle .checked { + color: var(--theme-accent); + opacity: 1; +} + +input[name="theme-toggle"] { + position: absolute; + opacity: 0; + top: 0; + right: 0; + bottom: 0; + left: 0; + z-index: -1; +} diff --git a/packages/imagetools_3/docs/src/components/RightSidebar/ThemeToggleButton.tsx b/packages/imagetools_3/docs/src/components/RightSidebar/ThemeToggleButton.tsx new file mode 100644 index 0000000..400c0e9 --- /dev/null +++ b/packages/imagetools_3/docs/src/components/RightSidebar/ThemeToggleButton.tsx @@ -0,0 +1,89 @@ +import type { FunctionalComponent } from "preact"; +import { h, Fragment } from "preact"; +import { useState, useEffect } from "preact/hooks"; +import "./ThemeToggleButton.css"; + +const themes = ["light", "dark"]; + +const icons = [ + + + , + + + + , +]; + +const ThemeToggle: FunctionalComponent = () => { + const [theme, setTheme] = useState(() => { + if (import.meta.env.SSR) { + return undefined; + } + + if (typeof localStorage !== "undefined" && localStorage.getItem("theme")) { + return localStorage.getItem("theme"); + } + + if (window.matchMedia("(prefers-color-scheme: dark)").matches) { + return "dark"; + } + + return "light"; + }); + + useEffect(() => { + const root = document.documentElement; + + if (theme === "light") { + root.classList.remove("theme-dark"); + } else { + root.classList.add("theme-dark"); + } + }, [theme]); + + return ( +
+ {themes.map((t, i) => { + const icon = icons[i]; + const checked = t === theme; + + return ( + + ); + })} +
+ ); +}; + +export default ThemeToggle; diff --git a/packages/imagetools_3/docs/src/config.ts b/packages/imagetools_3/docs/src/config.ts new file mode 100644 index 0000000..143eb2b --- /dev/null +++ b/packages/imagetools_3/docs/src/config.ts @@ -0,0 +1,62 @@ +export const SITE = { + title: "Astro ImageTools Documentation", + description: "Documentation for the Astro ImageTools project", + defaultLanguage: "en_US", +}; + +export const OPEN_GRAPH = { + image: { + src: "https://github.com/withastro/astro/blob/main/assets/social/banner.jpg?raw=true", + alt: + "astro logo on a starry expanse of space," + + " with a purple saturn-like planet floating in the right foreground", + }, + twitter: "astrodotbuild", +}; + +export const KNOWN_LANGUAGES = { + English: "en", +}; + +export const GITHUB_EDIT_URL = `https://github.com/RafidMuhymin/astro-imagetools/blob/main/docs/`; + +export const COMMUNITY_INVITE_URL = `https://astro.build/chat`; + +// See "Algolia" section of the README for more information. +export const ALGOLIA = { + appId: "SZQLV18K73", + indexName: "astro-imagetools", + apiKey: "5da19c05f194060063e0e73a50b21b8e", +}; + +export const SIDEBAR = { + en: [ + { text: "GETTING_STARTED", header: true }, + { text: "Introduction", link: "en/introduction" }, + { text: "Installation", link: "en/installation" }, + { text: "Usage", link: "en/usage" }, + + { text: "BASICS", header: true }, + { text: "Components and APIs", link: "en/components-and-apis" }, + { text: "SSR", link: "en/ssr" }, + { text: "Markdown Images", link: "en/markdown-images" }, + { text: "Global Config Options", link: "en/global-config-options" }, + + { text: "COMPONENTS", header: true }, + { text: "", link: "en/components/Img" }, + { text: "", link: "en/components/Picture" }, + { text: "", link: "en/components/BackgroundImage" }, + { text: "", link: "en/components/BackgroundPicture" }, + + { text: "API", header: true }, + { text: "renderImg", link: "en/api/renderImg" }, + { text: "renderPicture", link: "en/api/renderPicture" }, + { text: "renderBackgroundImage", link: "en/api/renderBackgroundImage" }, + { text: "renderBackgroundPicture", link: "en/api/renderBackgroundPicture" }, + { text: "importImage", link: "en/api/importImage" }, + + { text: "MISCELLANEOUS", header: true }, + { text: "Deprecations", link: "en/deprecations" }, + { text: "Acknowledgements", link: "en/acknowledgements" }, + ], +}; diff --git a/packages/imagetools_3/docs/src/languages.ts b/packages/imagetools_3/docs/src/languages.ts new file mode 100644 index 0000000..acfe7ae --- /dev/null +++ b/packages/imagetools_3/docs/src/languages.ts @@ -0,0 +1,10 @@ +import { KNOWN_LANGUAGES } from "./config"; + +export { KNOWN_LANGUAGES }; +export const KNOWN_LANGUAGE_CODES = Object.values(KNOWN_LANGUAGES); +export const langPathRegex = /\/([a-z]{2}-?[A-Z]{0,2})\//; + +export function getLanguageFromURL(pathname: string) { + const langCodeMatch = pathname.match(langPathRegex); + return langCodeMatch ? langCodeMatch[1] : "en"; +} diff --git a/packages/imagetools_3/docs/src/layouts/MainLayout.astro b/packages/imagetools_3/docs/src/layouts/MainLayout.astro new file mode 100644 index 0000000..fe951d7 --- /dev/null +++ b/packages/imagetools_3/docs/src/layouts/MainLayout.astro @@ -0,0 +1,147 @@ +--- +import HeadCommon from "../components/HeadCommon.astro"; +import HeadSEO from "../components/HeadSEO.astro"; +import Header from "../components/Header/Header.astro"; +import PageContent from "../components/PageContent/PageContent.astro"; +import LeftSidebar from "../components/LeftSidebar/LeftSidebar.astro"; +import RightSidebar from "../components/RightSidebar/RightSidebar.astro"; +import * as CONFIG from "../config"; + +const { content = {} } = Astro.props; +const currentPage = new URL(Astro.request.url).pathname; +const currentFile = `src/pages${currentPage.replace(/\/$/, "")}.md`; +const githubEditUrl = + CONFIG.GITHUB_EDIT_URL && CONFIG.GITHUB_EDIT_URL + currentFile; +--- + + + + + + + + + + + +
+ +
+ + +
+ + + +
+ + +
+ + + + diff --git a/packages/imagetools_3/docs/src/pages/en/acknowledgements.md b/packages/imagetools_3/docs/src/pages/en/acknowledgements.md new file mode 100644 index 0000000..4d6991b --- /dev/null +++ b/packages/imagetools_3/docs/src/pages/en/acknowledgements.md @@ -0,0 +1,47 @@ +--- +title: Acknowledgements +description: Acknowledgements +layout: ../../layouts/MainLayout.astro +--- + + + +## The people for whom this project has become possible + +[Jonathan Neal](https://github.com/jonathantneal) for being extremely helpful and for the [`@astropub/codecs`](https://github.com/astro-community/codecs) library. + +[Jonas Kruckenberg](https://github.com/JonasKruckenberg) for the [`imagetools-core`](https://github.com/JonasKruckenberg/imagetools/tree/main/packages/core) and [`vite-imagetools`](https://github.com/JonasKruckenberg/imagetools/tree/main/packages/vite) libraries. + +[Lovell Fuller](https://github.com/lovell) for the awesome [`sharp`](https://sharp.pixelplumbing.com/) library. + +[Matt Mc](https://github.com/tooolbox) for the [`potrace`](https://github.com/tooolbox/node-potrace) library. + +[Zade Viggers](https://github.com/zadeviggers) for his code contributions. + +[Peter Singh](https://github.com/aFuzzyBear) for documentation support and suggestions. + +_...and many more people for their help and inspiration. And, thanks to the [Astro JS](https://astro.build/) community for their support and encouragement. And, thanks to the people behind the [Vite JS](https://vitejs.dev/) project too._ + +## The resouces that have helped me understand Responsive Images and Image Optimization + +[Responsive Images 101](https://cloudfour.com/thinks/responsive-images-101-definitions/) by [Cloud Four](https://cloudfour.com/). + +[Responsive images](https://developer.mozilla.org/en-US/docs/Learn/HTML/Multimedia_and_embedding/Responsive_images) by [MDN](https://developer.mozilla.org/en-US/). + +[A Guide to the Responsive Images Syntax in HTML](https://css-tricks.com/a-guide-to-the-responsive-images-syntax-in-html/) by [CSS-Tricks](https://css-tricks.com/). + +[Responsive Images](https://developers.google.com/web/fundamentals/design-and-ux/responsive/images) by [Google Developers](https://developers.google.com/web/). + +[Optimising for high-density displays](https://jakearchibald.com/2021/serving-sharp-images-to-high-density-screens/) by [Jake Archibald](https://jakearchibald.com/). + +[Responsive Images, The sizes Attribute, and Unexpected Image Sizes](https://medium.com/@MRWwebDesign/responsive-images-the-sizes-attribute-and-unexpected-image-sizes-882a2eadb6db) by [Mark Root-Wiley](https://github.com/mrwweb/). + +[Fluid Images: Art Direction](https://www.learnhowtoprogram.com/user-interfaces/responsive-design-development-environments/fluid-images-art-direction) by [Learn How To Program](https://www.learnhowtoprogram.com/). + +[Responsive images and art direction](https://web.dev/patterns/web-vitals-patterns/images/responsive-images/) by [Web.dev](https://web.dev/). + +_...and many more articles and resources that have helped me to understand Responsive Images and Image Optimization._ diff --git a/packages/imagetools_3/docs/src/pages/en/api/importImage.mdx b/packages/imagetools_3/docs/src/pages/en/api/importImage.mdx new file mode 100644 index 0000000..ddc0302 --- /dev/null +++ b/packages/imagetools_3/docs/src/pages/en/api/importImage.mdx @@ -0,0 +1,63 @@ +--- +title: importImage +description: The importImage API Documentation +layout: ../../../layouts/MainLayout.astro +--- + +The `importImage` API is a function which acts similar to the ESM `import()` function but for `astro-imagetools`. It returns a `Promise` which resolves to the `src/srcset` of the generated _asset_/_assets_. The provided path should follow the same format as the [`src`](/en/api/renderPicture/#src) attribute. + +## Why? + +- It supports dynamic paths +- It supports remote URLs (data URIs are also supported) + +**Note:** The `importImage` API doesn't support relative local paths. + +## Code Example + +```js +import React from "react"; +import { importImage } from "astro-imagetools/api"; + +const src = await importImage("https://picsum.photos/1024/768"); + +export default function ReactImage() { + return ; +} +``` + +You can pass configuration options via query parameters just like regular ESM imports. + +```js +import { importImage } from "astro-imagetools/api"; + +const src = await importImage( + "https://picsum.photos/1024/768?w=200&h=200&format=avif&q=80" +); +``` + +If you want the function to return a `srcset` instead of a `src`, pass multiple values to the `w` or `width` query parameter. + +```js +import { importImage } from "astro-imagetools/api"; + +const srcset = await importImage( + "https://picsum.photos/1024/768?w=200;400;800" +); +``` + +Dynamic paths are also supported. + +```astro +--- +import { importImage } from "astro-imagetools/api"; + +const { imagePath } = Astro.props; // imagePath = "/public/images/image.jpeg" + +const src = await importImage(imagePath); +--- +``` + +## Return Value + +**Type:** `Promise` diff --git a/packages/imagetools_3/docs/src/pages/en/api/renderBackgroundImage.mdx b/packages/imagetools_3/docs/src/pages/en/api/renderBackgroundImage.mdx new file mode 100644 index 0000000..c77dc3f --- /dev/null +++ b/packages/imagetools_3/docs/src/pages/en/api/renderBackgroundImage.mdx @@ -0,0 +1,59 @@ +--- +title: renderBackgroundImage +description: The renderPicture API Documentation +layout: ../../../layouts/MainLayout.astro +--- + +import ConfigOptions from "../../../components/ConfigOptions.astro"; + +The `renderBackgroundImage` API is a function for rendering an optimized and responsive **Background Images**. The CSS `background-image` property will be used to display the generated background images. + +Similar to the [``](/en/components/BackgroundImage) component, the `renderBackgroundImage` API lacks the **Lazy Loading**, **Asynchronous Decoding**, the `sizes` attribute, and the **onload fade-in transition** features. And it too depends on the [``](/en/components-and-apis#imagesupportdetection) component to work. + +## Code Example + +```astro +--- +import { renderBackgroundImage } from "astro-imagetools/api"; +import { ImageSupportDetection } from "astro-imagetools/components"; + +const content = await fetch(import.meta.env.CONTENT_URL).then((r) => r.text()); + +const { link, style, htmlElement } = await renderBackgroundImage({ + src: "https://picsum.photos/1024/768", + content, + artDirectives: [ + { + src: "https://picsum.photos/1024/768?image=1", + media: "(orientation: potrait)", + }, + ], +}); +--- + + + + + + + + + + +``` + +## Return Value + +**Type:** `{ link: string; style: string; htmlElement: string }` + +If the [`preload`](#preload) config option is set, then the `link` property will contain the `outerHTML` of the generated `` element to preload the image set of the asked format. Otherwise, `link` will be an empty string. + +If the [`placeholder`](#placeholder) config option is not set to `"none"`, then the `style` property will contain the `outerHTML` of the generated `