gatsby-plugin-image 1.14.0 → 1.14.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/gatsby-node.js +11 -1
- package/dist/resolver-utils.js +24 -25
- package/dist/src/gatsby-node.d.ts +1 -0
- package/dist/src/resolver-utils.d.ts +10 -6
- package/package.json +2 -2
package/dist/gatsby-node.js
CHANGED
|
@@ -10,9 +10,19 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
10
10
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
11
|
};
|
|
12
12
|
exports.__esModule = true;
|
|
13
|
-
exports.onCreateWebpackConfig = exports.onCreateBabelConfig = void 0;
|
|
13
|
+
exports.onCreateWebpackConfig = exports.onCreateBabelConfig = exports.createSchemaCustomization = void 0;
|
|
14
14
|
var node_utils_1 = require("./node-apis/node-utils");
|
|
15
|
+
var resolver_utils_1 = require("./resolver-utils");
|
|
15
16
|
__exportStar(require("./node-apis/preprocess-source"), exports);
|
|
17
|
+
var createSchemaCustomization = function (_a) {
|
|
18
|
+
var actions = _a.actions, schema = _a.schema;
|
|
19
|
+
actions.createTypes([
|
|
20
|
+
schema.buildEnumType(resolver_utils_1.ImageFormatType),
|
|
21
|
+
schema.buildEnumType(resolver_utils_1.ImageLayoutType),
|
|
22
|
+
schema.buildEnumType(resolver_utils_1.ImagePlaceholderType),
|
|
23
|
+
]);
|
|
24
|
+
};
|
|
25
|
+
exports.createSchemaCustomization = createSchemaCustomization;
|
|
16
26
|
var onCreateBabelConfig = function (_a) {
|
|
17
27
|
var actions = _a.actions, store = _a.store;
|
|
18
28
|
var root = store.getState().program.directory;
|
package/dist/resolver-utils.js
CHANGED
|
@@ -16,9 +16,8 @@ var __assign = (this && this.__assign) || function () {
|
|
|
16
16
|
};
|
|
17
17
|
exports.__esModule = true;
|
|
18
18
|
exports.getGatsbyImageFieldConfig = exports.getGatsbyImageResolver = exports.ImagePlaceholderType = exports.ImageLayoutType = exports.ImageFormatType = void 0;
|
|
19
|
-
var graphql_1 = require("gatsby/graphql");
|
|
20
19
|
var common_tags_1 = require("common-tags");
|
|
21
|
-
exports.ImageFormatType =
|
|
20
|
+
exports.ImageFormatType = {
|
|
22
21
|
name: "GatsbyImageFormat",
|
|
23
22
|
values: {
|
|
24
23
|
NO_CHANGE: { value: "" },
|
|
@@ -28,16 +27,16 @@ exports.ImageFormatType = new graphql_1.GraphQLEnumType({
|
|
|
28
27
|
WEBP: { value: "webp" },
|
|
29
28
|
AVIF: { value: "avif" }
|
|
30
29
|
}
|
|
31
|
-
}
|
|
32
|
-
exports.ImageLayoutType =
|
|
30
|
+
};
|
|
31
|
+
exports.ImageLayoutType = {
|
|
33
32
|
name: "GatsbyImageLayout",
|
|
34
33
|
values: {
|
|
35
34
|
FIXED: { value: "fixed" },
|
|
36
35
|
FULL_WIDTH: { value: "fullWidth" },
|
|
37
36
|
CONSTRAINED: { value: "constrained" }
|
|
38
37
|
}
|
|
39
|
-
}
|
|
40
|
-
exports.ImagePlaceholderType =
|
|
38
|
+
};
|
|
39
|
+
exports.ImagePlaceholderType = {
|
|
41
40
|
name: "GatsbyImagePlaceholder",
|
|
42
41
|
values: {
|
|
43
42
|
DOMINANT_COLOR: { value: "dominantColor" },
|
|
@@ -45,25 +44,25 @@ exports.ImagePlaceholderType = new graphql_1.GraphQLEnumType({
|
|
|
45
44
|
BLURRED: { value: "blurred" },
|
|
46
45
|
NONE: { value: "none" }
|
|
47
46
|
}
|
|
48
|
-
}
|
|
47
|
+
};
|
|
49
48
|
function getGatsbyImageResolver(resolve, extraArgs) {
|
|
50
49
|
return {
|
|
51
50
|
type: "JSON!",
|
|
52
51
|
args: __assign({ layout: {
|
|
53
|
-
type:
|
|
54
|
-
description: common_tags_1.stripIndent(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n The layout for the image.\n FIXED: A static image sized, that does not resize according to the screen width\n FULL_WIDTH: The image resizes to fit its container. Pass a \"sizes\" option if it isn't going to be the full width of the screen
|
|
52
|
+
type: exports.ImageLayoutType.name,
|
|
53
|
+
description: common_tags_1.stripIndent(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n The layout for the image.\n FIXED: A static image sized, that does not resize according to the screen width\n FULL_WIDTH: The image resizes to fit its container. Pass a \"sizes\" option if it isn't going to be the full width of the screen.\n CONSTRAINED: Resizes to fit its container, up to a maximum width, at which point it will remain fixed in size.\n "], ["\n The layout for the image.\n FIXED: A static image sized, that does not resize according to the screen width\n FULL_WIDTH: The image resizes to fit its container. Pass a \"sizes\" option if it isn't going to be the full width of the screen.\n CONSTRAINED: Resizes to fit its container, up to a maximum width, at which point it will remain fixed in size.\n "])))
|
|
55
54
|
}, width: {
|
|
56
55
|
type: "Int",
|
|
57
|
-
description: common_tags_1.stripIndent(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n The display width of the generated image for layout = FIXED, and the display width of the largest image for layout = CONSTRAINED
|
|
56
|
+
description: common_tags_1.stripIndent(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n The display width of the generated image for layout = FIXED, and the display width of the largest image for layout = CONSTRAINED.\n The actual largest image resolution will be this value multiplied by the largest value in outputPixelDensities\n Ignored if layout = FULL_WIDTH.\n "], ["\n The display width of the generated image for layout = FIXED, and the display width of the largest image for layout = CONSTRAINED.\n The actual largest image resolution will be this value multiplied by the largest value in outputPixelDensities\n Ignored if layout = FULL_WIDTH.\n "])))
|
|
58
57
|
}, height: {
|
|
59
58
|
type: "Int",
|
|
60
59
|
description: common_tags_1.stripIndent(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n If set, the height of the generated image. If omitted, it is calculated from the supplied width, matching the aspect ratio of the source image."], ["\n If set, the height of the generated image. If omitted, it is calculated from the supplied width, matching the aspect ratio of the source image."])))
|
|
61
60
|
}, aspectRatio: {
|
|
62
61
|
type: "Float",
|
|
63
|
-
description: common_tags_1.stripIndent(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n If set along with width or height, this will set the value of the other dimension to match the provided aspect ratio, cropping the image if needed
|
|
62
|
+
description: common_tags_1.stripIndent(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n If set along with width or height, this will set the value of the other dimension to match the provided aspect ratio, cropping the image if needed.\n If neither width or height is provided, height will be set based on the intrinsic width of the source image.\n "], ["\n If set along with width or height, this will set the value of the other dimension to match the provided aspect ratio, cropping the image if needed.\n If neither width or height is provided, height will be set based on the intrinsic width of the source image.\n "])))
|
|
64
63
|
}, sizes: {
|
|
65
64
|
type: "String",
|
|
66
|
-
description: common_tags_1.stripIndent(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n The \"sizes\" property, passed to the img tag. This describes the display size of the image
|
|
65
|
+
description: common_tags_1.stripIndent(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n The \"sizes\" property, passed to the img tag. This describes the display size of the image.\n This does not affect the generated images, but is used by the browser to decide which images to download. You can leave this blank for fixed images, or if the responsive image\n container will be the full width of the screen. In these cases we will generate an appropriate value.\n "], ["\n The \"sizes\" property, passed to the img tag. This describes the display size of the image.\n This does not affect the generated images, but is used by the browser to decide which images to download. You can leave this blank for fixed images, or if the responsive image\n container will be the full width of the screen. In these cases we will generate an appropriate value.\n "])))
|
|
67
66
|
}, outputPixelDensities: {
|
|
68
67
|
type: "[Float]",
|
|
69
68
|
description: common_tags_1.stripIndent(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n A list of image pixel densities to generate for FIXED and CONSTRAINED images. You should rarely need to change this. It will never generate images larger than the source, and will always include a 1x image.\n Default is [ 1, 2 ] for fixed images, meaning 1x, 2x, 3x, and [0.25, 0.5, 1, 2] for fluid. In this case, an image with a fluid layout and width = 400 would generate images at 100, 200, 400 and 800px wide.\n Ignored for FULL_WIDTH, which uses breakpoints instead.\n "], ["\n A list of image pixel densities to generate for FIXED and CONSTRAINED images. You should rarely need to change this. It will never generate images larger than the source, and will always include a 1x image.\n Default is [ 1, 2 ] for fixed images, meaning 1x, 2x, 3x, and [0.25, 0.5, 1, 2] for fluid. In this case, an image with a fluid layout and width = 400 would generate images at 100, 200, 400 and 800px wide.\n Ignored for FULL_WIDTH, which uses breakpoints instead.\n "])))
|
|
@@ -80,37 +79,37 @@ function getGatsbyImageResolver(resolve, extraArgs) {
|
|
|
80
79
|
exports.getGatsbyImageResolver = getGatsbyImageResolver;
|
|
81
80
|
function getGatsbyImageFieldConfig(resolve, extraArgs) {
|
|
82
81
|
return {
|
|
83
|
-
type:
|
|
82
|
+
type: "JSON!",
|
|
84
83
|
args: __assign({ layout: {
|
|
85
|
-
type: exports.ImageLayoutType,
|
|
84
|
+
type: exports.ImageLayoutType.name,
|
|
86
85
|
description: common_tags_1.stripIndent(templateObject_8 || (templateObject_8 = __makeTemplateObject(["\n The layout for the image.\n FIXED: A static image sized, that does not resize according to the screen width\n FULL_WIDTH: The image resizes to fit its container. Pass a \"sizes\" option if it isn't going to be the full width of the screen.\n CONSTRAINED: Resizes to fit its container, up to a maximum width, at which point it will remain fixed in size.\n "], ["\n The layout for the image.\n FIXED: A static image sized, that does not resize according to the screen width\n FULL_WIDTH: The image resizes to fit its container. Pass a \"sizes\" option if it isn't going to be the full width of the screen.\n CONSTRAINED: Resizes to fit its container, up to a maximum width, at which point it will remain fixed in size.\n "])))
|
|
87
86
|
}, width: {
|
|
88
|
-
type:
|
|
87
|
+
type: "Int",
|
|
89
88
|
description: common_tags_1.stripIndent(templateObject_9 || (templateObject_9 = __makeTemplateObject(["\n The display width of the generated image for layout = FIXED, and the display width of the largest image for layout = CONSTRAINED.\n The actual largest image resolution will be this value multiplied by the largest value in outputPixelDensities\n Ignored if layout = FLUID.\n "], ["\n The display width of the generated image for layout = FIXED, and the display width of the largest image for layout = CONSTRAINED.\n The actual largest image resolution will be this value multiplied by the largest value in outputPixelDensities\n Ignored if layout = FLUID.\n "])))
|
|
90
89
|
}, height: {
|
|
91
|
-
type:
|
|
90
|
+
type: "Int",
|
|
92
91
|
description: common_tags_1.stripIndent(templateObject_10 || (templateObject_10 = __makeTemplateObject(["\n If set, the height of the generated image. If omitted, it is calculated from the supplied width, matching the aspect ratio of the source image."], ["\n If set, the height of the generated image. If omitted, it is calculated from the supplied width, matching the aspect ratio of the source image."])))
|
|
93
92
|
}, aspectRatio: {
|
|
94
|
-
type:
|
|
95
|
-
description: common_tags_1.stripIndent(templateObject_11 || (templateObject_11 = __makeTemplateObject(["\n If set along with width or height, this will set the value of the other dimension to match the provided aspect ratio, cropping the image if needed
|
|
93
|
+
type: "Float",
|
|
94
|
+
description: common_tags_1.stripIndent(templateObject_11 || (templateObject_11 = __makeTemplateObject(["\n If set along with width or height, this will set the value of the other dimension to match the provided aspect ratio, cropping the image if needed.\n If neither width or height is provided, height will be set based on the intrinsic width of the source image.\n "], ["\n If set along with width or height, this will set the value of the other dimension to match the provided aspect ratio, cropping the image if needed.\n If neither width or height is provided, height will be set based on the intrinsic width of the source image.\n "])))
|
|
96
95
|
}, placeholder: {
|
|
97
|
-
type: exports.ImagePlaceholderType,
|
|
96
|
+
type: exports.ImagePlaceholderType.name,
|
|
98
97
|
description: common_tags_1.stripIndent(templateObject_12 || (templateObject_12 = __makeTemplateObject(["\n Format of generated placeholder image, displayed while the main image loads.\n BLURRED: a blurred, low resolution image, encoded as a base64 data URI (default)\n DOMINANT_COLOR: a solid color, calculated from the dominant color of the image.\n TRACED_SVG: a low-resolution traced SVG of the image.\n NONE: no placeholder. Set the argument \"backgroundColor\" to use a fixed background color."], ["\n Format of generated placeholder image, displayed while the main image loads.\n BLURRED: a blurred, low resolution image, encoded as a base64 data URI (default)\n DOMINANT_COLOR: a solid color, calculated from the dominant color of the image.\n TRACED_SVG: a low-resolution traced SVG of the image.\n NONE: no placeholder. Set the argument \"backgroundColor\" to use a fixed background color."])))
|
|
99
98
|
}, formats: {
|
|
100
|
-
type:
|
|
101
|
-
description: common_tags_1.stripIndent(templateObject_13 || (templateObject_13 = __makeTemplateObject(["\n The image formats to generate. Valid values are AUTO (meaning the same format as the source image), JPG, PNG, WEBP and AVIF.\n The default value is [AUTO, WEBP], and you should rarely need to change this. Take care if you specify JPG or PNG when you do\n not know the formats of the source images, as this could lead to unwanted results such as converting JPEGs to PNGs. Specifying\n both PNG and JPG is not supported and will be ignored
|
|
99
|
+
type: "[" + exports.ImageFormatType.name + "]",
|
|
100
|
+
description: common_tags_1.stripIndent(templateObject_13 || (templateObject_13 = __makeTemplateObject(["\n The image formats to generate. Valid values are AUTO (meaning the same format as the source image), JPG, PNG, WEBP and AVIF.\n The default value is [AUTO, WEBP], and you should rarely need to change this. Take care if you specify JPG or PNG when you do\n not know the formats of the source images, as this could lead to unwanted results such as converting JPEGs to PNGs. Specifying\n both PNG and JPG is not supported and will be ignored.\n "], ["\n The image formats to generate. Valid values are AUTO (meaning the same format as the source image), JPG, PNG, WEBP and AVIF.\n The default value is [AUTO, WEBP], and you should rarely need to change this. Take care if you specify JPG or PNG when you do\n not know the formats of the source images, as this could lead to unwanted results such as converting JPEGs to PNGs. Specifying\n both PNG and JPG is not supported and will be ignored.\n "]))),
|
|
102
101
|
defaultValue: ["", "webp"]
|
|
103
102
|
}, outputPixelDensities: {
|
|
104
|
-
type:
|
|
103
|
+
type: "[Float]",
|
|
105
104
|
description: common_tags_1.stripIndent(templateObject_14 || (templateObject_14 = __makeTemplateObject(["\n A list of image pixel densities to generate for FIXED and CONSTRAINED images. You should rarely need to change this. It will never generate images larger than the source, and will always include a 1x image.\n Default is [ 1, 2 ] for fixed images, meaning 1x, 2x, 3x, and [0.25, 0.5, 1, 2] for fluid. In this case, an image with a fluid layout and width = 400 would generate images at 100, 200, 400 and 800px wide.\n "], ["\n A list of image pixel densities to generate for FIXED and CONSTRAINED images. You should rarely need to change this. It will never generate images larger than the source, and will always include a 1x image.\n Default is [ 1, 2 ] for fixed images, meaning 1x, 2x, 3x, and [0.25, 0.5, 1, 2] for fluid. In this case, an image with a fluid layout and width = 400 would generate images at 100, 200, 400 and 800px wide.\n "])))
|
|
106
105
|
}, breakpoints: {
|
|
107
|
-
type:
|
|
106
|
+
type: "[Int]",
|
|
108
107
|
description: common_tags_1.stripIndent(templateObject_15 || (templateObject_15 = __makeTemplateObject(["\n Specifies the image widths to generate. You should rarely need to change this. For FIXED and CONSTRAINED images it is better to allow these to be determined automatically,\n based on the image size. For FULL_WIDTH images this can be used to override the default, which is [750, 1080, 1366, 1920].\n It will never generate any images larger than the source.\n "], ["\n Specifies the image widths to generate. You should rarely need to change this. For FIXED and CONSTRAINED images it is better to allow these to be determined automatically,\n based on the image size. For FULL_WIDTH images this can be used to override the default, which is [750, 1080, 1366, 1920].\n It will never generate any images larger than the source.\n "])))
|
|
109
108
|
}, sizes: {
|
|
110
|
-
type:
|
|
109
|
+
type: "String",
|
|
111
110
|
description: common_tags_1.stripIndent(templateObject_16 || (templateObject_16 = __makeTemplateObject(["\n The \"sizes\" property, passed to the img tag. This describes the display size of the image.\n This does not affect the generated images, but is used by the browser to decide which images to download. You can leave this blank for fixed images, or if the responsive image\n container will be the full width of the screen. In these cases we will generate an appropriate value.\n "], ["\n The \"sizes\" property, passed to the img tag. This describes the display size of the image.\n This does not affect the generated images, but is used by the browser to decide which images to download. You can leave this blank for fixed images, or if the responsive image\n container will be the full width of the screen. In these cases we will generate an appropriate value.\n "])))
|
|
112
111
|
}, backgroundColor: {
|
|
113
|
-
type:
|
|
112
|
+
type: "String",
|
|
114
113
|
description: "Background color applied to the wrapper, or when \"letterboxing\" an image to another aspect ratio."
|
|
115
114
|
} }, extraArgs),
|
|
116
115
|
resolve: resolve
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { GatsbyNode } from "gatsby";
|
|
2
2
|
export * from "./node-apis/preprocess-source";
|
|
3
|
+
export declare const createSchemaCustomization: GatsbyNode["createSchemaCustomization"];
|
|
3
4
|
export declare const onCreateBabelConfig: GatsbyNode["onCreateBabelConfig"];
|
|
4
5
|
export declare const onCreateWebpackConfig: GatsbyNode["onCreateWebpackConfig"];
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export declare const
|
|
1
|
+
import { GraphQLFieldResolver } from "gatsby/graphql";
|
|
2
|
+
import { EnumTypeComposerAsObjectDefinition, ObjectTypeComposerFieldConfigAsObjectDefinition, ObjectTypeComposerArgumentConfigMapDefinition } from "graphql-compose";
|
|
3
|
+
import { ISharpGatsbyImageArgs, IImageSizeArgs } from "./image-utils";
|
|
4
|
+
export declare const ImageFormatType: EnumTypeComposerAsObjectDefinition;
|
|
5
|
+
export declare const ImageLayoutType: EnumTypeComposerAsObjectDefinition;
|
|
6
|
+
export declare const ImagePlaceholderType: EnumTypeComposerAsObjectDefinition;
|
|
5
7
|
export interface IGatsbyGraphQLFieldConfig<TSource, TContext, TArgs> {
|
|
6
8
|
description?: string;
|
|
7
9
|
type: string;
|
|
@@ -13,5 +15,7 @@ export interface IGatsbyGraphQLResolverArgumentConfig<TValue = any> {
|
|
|
13
15
|
type: string | Array<string>;
|
|
14
16
|
defaultValue?: TValue;
|
|
15
17
|
}
|
|
16
|
-
export declare
|
|
17
|
-
export declare function
|
|
18
|
+
export declare type IGatsbyImageResolverArgs = Pick<ISharpGatsbyImageArgs & IImageSizeArgs, "aspectRatio" | "backgroundColor" | "breakpoints" | "height" | "layout" | "outputPixelDensities" | "sizes" | "width">;
|
|
19
|
+
export declare function getGatsbyImageResolver<TSource, TContext, TArgs>(resolve: GraphQLFieldResolver<TSource, TContext, IGatsbyImageResolverArgs & TArgs>, extraArgs?: ObjectTypeComposerArgumentConfigMapDefinition<TArgs>): ObjectTypeComposerFieldConfigAsObjectDefinition<TSource, TContext, IGatsbyImageResolverArgs & TArgs>;
|
|
20
|
+
export declare type IGatsbyImageFieldArgs = Pick<ISharpGatsbyImageArgs & IImageSizeArgs, "aspectRatio" | "backgroundColor" | "breakpoints" | "formats" | "height" | "layout" | "outputPixelDensities" | "placeholder" | "sizes" | "width">;
|
|
21
|
+
export declare function getGatsbyImageFieldConfig<TSource, TContext, TArgs>(resolve: GraphQLFieldResolver<TSource, TContext, IGatsbyImageFieldArgs & TArgs>, extraArgs?: ObjectTypeComposerArgumentConfigMapDefinition<TArgs>): ObjectTypeComposerFieldConfigAsObjectDefinition<TSource, TContext, IGatsbyImageFieldArgs & TArgs>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gatsby-plugin-image",
|
|
3
|
-
"version": "1.14.
|
|
3
|
+
"version": "1.14.1",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"build": "npm-run-all -s clean -p build:*",
|
|
6
6
|
"build:gatsby-node": "tsc --jsx react --downlevelIteration true --skipLibCheck true --esModuleInterop true --outDir dist/ src/gatsby-node.ts src/babel-plugin-parse-static-images.ts src/resolver-utils.ts src/types.d.ts -d --declarationDir dist/src",
|
|
@@ -93,5 +93,5 @@
|
|
|
93
93
|
},
|
|
94
94
|
"author": "Matt Kane <matt@gatsbyjs.com>",
|
|
95
95
|
"license": "MIT",
|
|
96
|
-
"gitHead": "
|
|
96
|
+
"gitHead": "ea4fb54301b2cc5b5f52ef27ebe39cd70fffef33"
|
|
97
97
|
}
|