Skip to content

Commit

Permalink
Merge branch 'DefinitelyTyped:master' into eventbusjs
Browse files Browse the repository at this point in the history
  • Loading branch information
Longqin88888 authored Mar 20, 2024
2 parents 2f9fe06 + a21bbc6 commit 242f325
Show file tree
Hide file tree
Showing 168 changed files with 3,178 additions and 1,054 deletions.
8 changes: 5 additions & 3 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,7 @@
/types/array-rearrange/ @BendingBender
/types/array-same/ @BendingBender
/types/array-sort/ @DanielMSchmidt
/types/array-to-sentence/ @e6nlaq
/types/array-unique/ @CSLTech
/types/array.from/ @ExE-Boss
/types/array.prototype.every/ @ljharb
Expand Down Expand Up @@ -3286,6 +3287,7 @@
/types/http-terminator/ @sripberger
/types/httperr/ @yortus
/types/httpsnippet/ @marcelltoth
/types/httptoolkit__esm/ @nktnet1 @pimterry
/types/hubot/ @dirk @KeesCBakker @eeemil @jphenow
/types/hubspot-pace/ @borislavjivkov
/types/human-crypto-keys/ @jackHedaya
Expand Down Expand Up @@ -4693,6 +4695,7 @@
/types/lyricist/ @DadUndead
/types/lz4/ @bendingbender
/types/lzbase62/ @ArthurKa
/types/lzma/ @Goldsmith42
/types/lzma-native/ @leshow
/types/macaca-circular-json/ @jpevarnek
/types/macrotask/ @BendingBender
Expand Down Expand Up @@ -6739,7 +6742,6 @@
/types/react-sticky-el/ @jbraithwaite
/types/react-stickynode/ @tstirrat @ksocha @mciastek @yanickdi
/types/react-stonecutter/ @jzipfler @Iswenzz
/types/react-stripe-elements/ @dan-j @santiagodoldan @sonnysangha @9y5 @thchia @yhnavein @virzak @remotealex @bombek92 @hirochachacha @paustint @mastacheata
/types/react-svg-inline/ @kiyopikko
/types/react-svg-map/ @nickglazer
/types/react-svg-morph/ @hmajid2301
Expand Down Expand Up @@ -7743,9 +7745,7 @@
/types/strip-bom-string/ @pwall2222
/types/strip-color/ @BendingBender
/types/strip-comments/ @peterblazejewicz
/types/stripe-checkout/ @cgwrench
/types/stripe-v2/ @ejsmith @amritk @adamcmiel @jleider @galuszkak
/types/stripe-v3/ @ejsmith @amritk @adamcmiel @jleider @galuszkak @slangeder @marlosin @ttmarek @kimehrenpohl @KrishnaPravin @hirochachacha @paustint @ksol @matsuby @kaznovac @hartleyrobertson @qqilihq
/types/stripejs/ @RobinvanTienhoven @mattferderer
/types/strman/ @adambrgmn
/types/strong-cluster-control/ @shuntksh
Expand Down Expand Up @@ -8018,6 +8018,7 @@
/types/tiny-async-pool/v1/ @krlwlfrt
/types/tiny-human-time/ @jimmycuadra
/types/tiny-json-http/ @levibostian
/types/tiny-segmenter/ @e6nlaq
/types/tiny-slider-react/ @screendriver
/types/tiny-templater/ @jimmycuadra
/types/tinycolor2/ @M-Zuber @geertjansen @nvh
Expand Down Expand Up @@ -8438,6 +8439,7 @@
/types/vue-tel-input/ @suryadana
/types/vue-template-es2015-compiler/ @iam-medvedev
/types/vue-the-mask/ @domschmidt
/types/vue-writer/ @BekYahia
/types/vue2-datepicker/ @ChristianStornowski
/types/vue2-editor/ @suryadana
/types/vue2-hammer/ @ptandler
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
matrix: ${{ steps.matrix.outputs.matrix }}

steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
with:
# Need this to be able to inquire about origin/master
filter: blob:none # https://github.blog/2020-12-21-get-up-to-speed-with-partial-clone-and-shallow-clone/
Expand Down Expand Up @@ -62,7 +62,7 @@ jobs:
fail-fast: false

steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
with:
# Need this to be able to inquire about origin/master
filter: blob:none # https://github.blog/2020-12-21-get-up-to-speed-with-partial-clone-and-shallow-clone/
Expand Down Expand Up @@ -131,7 +131,7 @@ jobs:
- test

steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
- uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
with:
node-version: '20'
Expand Down Expand Up @@ -168,7 +168,7 @@ jobs:
if: github.repository == 'DefinitelyTyped/DefinitelyTyped'

steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
- uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
with:
node-version: '20'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/UpdateCodeowners.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
if: github.repository == 'DefinitelyTyped/DefinitelyTyped'

steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
with:
fetch-depth: 0

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/format-and-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
runs-on: ubuntu-latest
if: github.repository == 'DefinitelyTyped/DefinitelyTyped'
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
with:
# Use the bot token so that CI triggers on pushes; we want to know if formatting broke something.
token: ${{ secrets.GH_DT_MERGEBOT_TOKEN }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ghostbuster.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
if: github.repository == 'DefinitelyTyped/DefinitelyTyped'

steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2

- uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
with:
Expand Down Expand Up @@ -51,7 +51,7 @@ jobs:
fi
- if: ${{ inputs.skipPR != 'true' }}
uses: peter-evans/create-pull-request@a4f52f8033a6168103c2538976c07b467e8163bc # v6.0.1
uses: peter-evans/create-pull-request@70a41aba780001da0a30141984ae2a0c95d8704e # v6.0.2
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: 'Remove contributors with deleted accounts #no-publishing-comment'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lint-md.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
runs-on: ubuntu-latest
if: github.repository == 'DefinitelyTyped/DefinitelyTyped'
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
- uses: pnpm/action-setup@a3252b78c470c02df07e9d59298aecedc3ccdd6d # v3.0.0
with:
run_install: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pnpm-cache.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
create-cache:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
- uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
with:
node-version: '20'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/support-window.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
if: github.repository == 'DefinitelyTyped/DefinitelyTyped'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2

- uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
with:
Expand Down
25 changes: 24 additions & 1 deletion types/11ty__eleventy-img/11ty__eleventy-img-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ function isImg<T>(
formats: ["avif", "webp", "svg", null],
urlPath: "/img/",
outputDir: "./img/",
svgShortCircuit: true,
svgShortCircuit: "size",
svgAllowUpscale: false,
svgCompressionSize: "br",
cacheOptions: {
duration: "1d",
directory: ".cache",
Expand All @@ -38,6 +39,8 @@ function isImg<T>(
height: 300,
},
hashLength: 8,
fixOrientation: true,
minimumThreshold: 2,
});

stats = Image.statsSync(url, {
Expand All @@ -58,6 +61,26 @@ function isImg<T>(
}
}

Image.eleventyImagePlugin({});

Image.eleventyImagePlugin({}, {
formats: ["webp", "jpeg"],
urlPath: "/img/",
defaultAttributes: {
loading: "lazy",
decoding: "async",
},
});

Image.eleventyImageTransformPlugin({}, {
extensions: "html",
formats: ["webp", "jpeg"],
defaultAttributes: {
loading: "lazy",
decoding: "async",
},
});

return Image.generateHTML(
stats,
{
Expand Down
110 changes: 109 additions & 1 deletion types/11ty__eleventy-img/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,12 @@ declare namespace EleventyImage {
* If using SVG output (the input format is SVG and svg is added to your formats array),
* we will skip all of the raster formats even if they’re in formats.
* This may be useful in a CMS-driven workflow when the input could be vector or raster.
*
* Use "size" to skip raster formats only if they are larger than the SVG input.
*
* @default false
*/
svgShortCircuit?: boolean;
svgShortCircuit?: boolean | "size";
/**
* Allow SVG to upscale
*
Expand All @@ -92,6 +95,11 @@ declare namespace EleventyImage {
* @default true
*/
svgAllowUpscale?: boolean;
/**
* "br" to report SVG `size` property in metadata as Brotli compressed
* @default ""
*/
svgCompressionSize?: "" | "br";

/** options passed to the Sharp constructor */
sharpOptions?: sharp.SharpOptions;
Expand Down Expand Up @@ -212,6 +220,18 @@ declare namespace EleventyImage {
* @default true
*/
useCacheValidityInHash?: true;

/**
* Rotate images to ensure correct orientation.
* @default false
*/
fixOrientation?: boolean;

/**
* Ensures original size is included if smaller than largest specified width by threshold amount.
* @default 1.25
*/
minimumThreshold?: number;
}

interface StatsOnlyImageOptions extends BaseImageOptions {
Expand All @@ -226,6 +246,16 @@ declare namespace EleventyImage {

type ImageOptions = StatsOnlyImageOptions | BaseImageOptions;

interface PluginOptions extends BaseImageOptions {
packages?: {
image: (
src: ImageSource,
opts?: ImageOptions,
) => Promise<EleventyImage.Metadata>;
};
defaultAttributes?: Partial<Record<string, unknown>>;
}

interface Stats {
format: ImageFormat;
width: number;
Expand Down Expand Up @@ -359,6 +389,84 @@ declare namespace EleventyImage {

const generateHTML: typeof generateImageHTML;
const generateObject: typeof generateImageHTML.generateObject;

/**
* Pass to `eleventyConfig.addPlugin`
* @example
* const eleventyWebcPlugin = require("@11ty/eleventy-plugin-webc");
* const { eleventyImagePlugin } = require("@11ty/eleventy-img");
*
* // Only one module.exports per configuration file, please!
* module.exports = function(eleventyConfig) {
*
* // WebC
* eleventyConfig.addPlugin(eleventyWebcPlugin, {
* components: [
* // …
* // Add as a global WebC component
* "npm:@11ty/eleventy-img/*.webc",
* ]
* });
*
* // Image plugin
* eleventyConfig.addPlugin(eleventyImagePlugin, {
* // Set global default options
* formats: ["webp", "jpeg"],
* urlPath: "/img/",
*
* // Notably `outputDir` is resolved automatically
* // to the project output directory
*
* defaultAttributes: {
* loading: "lazy",
* decoding: "async"
* }
* });
* };
*/
function eleventyImagePlugin(
eleventyConfig: object,
options?: PluginOptions,
): void;

/**
* A plugin to transform html output. Pass to `eleventyConfig.addPlugin`
* @see {@link https://www.11ty.dev/docs/plugins/image/#eleventy-transform}
* @example
* const { eleventyImageTransformPlugin } = require("@11ty/eleventy-img");
*
* module.exports = function(eleventyConfig) {
* eleventyConfig.addPlugin(eleventyImageTransformPlugin, {
* // which file extensions to process
* extensions: "html",
*
* // Add any other Image utility options here:
*
* // optional, output image formats
* formats: ["webp", "jpeg"],
* // formats: ["auto"],
*
* // optional, output image widths
* // widths: ["auto"],
*
* // optional, attributes assigned on <img> override these values.
* defaultAttributes: {
* loading: "lazy",
* decoding: "async"
* }
* });
* };
*/
function eleventyImageTransformPlugin(
eleventyConfig: object,
options?: PluginOptions & {
/**
* Which file extensions to process (comma separated list).
* @default "html"
*/
extensions?: string;
},
): void;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion types/11ty__eleventy-img/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"private": true,
"name": "@types/11ty__eleventy-img",
"version": "2.0.9999",
"version": "4.0.9999",
"projects": [
"https://github.com/11ty/eleventy-img"
],
Expand Down
Loading

0 comments on commit 242f325

Please sign in to comment.