gatsby-plugin-image 2.10.1 → 2.11.0-alpha-luda.46

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.
Files changed (96) hide show
  1. package/CHANGELOG.md +61 -1
  2. package/dist/babel-helpers.js +66 -66
  3. package/dist/babel-plugin-parse-static-images.js +80 -80
  4. package/dist/components/gatsby-image.browser.js +170 -247
  5. package/dist/components/gatsby-image.server.js +106 -112
  6. package/dist/components/hooks.js +250 -399
  7. package/dist/components/intersection-observer.js +53 -55
  8. package/dist/components/layout-wrapper.js +95 -94
  9. package/dist/components/lazy-hydrate.js +218 -75
  10. package/dist/components/main-image.js +28 -43
  11. package/dist/components/picture.js +103 -96
  12. package/dist/components/placeholder.js +78 -74
  13. package/dist/components/static-image.server.js +111 -111
  14. package/dist/gatsby-image.browser.js +1 -1
  15. package/dist/gatsby-image.browser.modern.js +1 -1
  16. package/dist/gatsby-image.js +1 -1
  17. package/dist/gatsby-image.js.map +1 -1
  18. package/dist/gatsby-image.module.js +1 -1
  19. package/dist/gatsby-image.module.js.map +1 -1
  20. package/dist/gatsby-node.js +58 -54
  21. package/dist/global.js +2 -0
  22. package/dist/image-utils.js +442 -449
  23. package/dist/index.browser-bd6b0c0c.js +2 -0
  24. package/dist/index.browser-bd6b0c0c.js.map +1 -0
  25. package/dist/index.browser-cdba1a30.js +2 -0
  26. package/dist/index.browser-cdba1a30.js.map +1 -0
  27. package/dist/index.js +32 -27
  28. package/dist/lazy-hydrate-21b90201.js +2 -0
  29. package/dist/lazy-hydrate-21b90201.js.map +1 -0
  30. package/dist/lazy-hydrate-2ea962de.js +2 -0
  31. package/dist/lazy-hydrate-2ea962de.js.map +1 -0
  32. package/dist/node-apis/image-processing.js +278 -278
  33. package/dist/node-apis/node-utils.js +11 -11
  34. package/dist/node-apis/parser.js +98 -98
  35. package/dist/node-apis/preprocess-source.js +118 -118
  36. package/dist/node-apis/watcher.js +129 -129
  37. package/dist/resolver-utils.js +119 -119
  38. package/dist/src/babel-helpers.d.ts +6 -6
  39. package/dist/src/babel-plugin-parse-static-images.d.ts +10 -10
  40. package/dist/src/components/gatsby-image.browser.d.ts +9 -7
  41. package/dist/src/components/gatsby-image.browser.d.ts.map +1 -1
  42. package/dist/src/components/gatsby-image.server.d.ts +3 -7
  43. package/dist/src/components/gatsby-image.server.d.ts.map +1 -1
  44. package/dist/src/components/hooks.d.ts +10 -15
  45. package/dist/src/components/hooks.d.ts.map +1 -1
  46. package/dist/src/components/intersection-observer.d.ts +1 -2
  47. package/dist/src/components/intersection-observer.d.ts.map +1 -1
  48. package/dist/src/components/layout-wrapper.d.ts +0 -1
  49. package/dist/src/components/layout-wrapper.d.ts.map +1 -1
  50. package/dist/src/components/lazy-hydrate.d.ts +4 -5
  51. package/dist/src/components/lazy-hydrate.d.ts.map +1 -1
  52. package/dist/src/components/main-image.d.ts +1 -8
  53. package/dist/src/components/main-image.d.ts.map +1 -1
  54. package/dist/src/components/picture.d.ts +1 -6
  55. package/dist/src/components/picture.d.ts.map +1 -1
  56. package/dist/src/gatsby-node.d.ts +5 -5
  57. package/dist/src/gatsby-ssr.d.ts.map +1 -1
  58. package/dist/src/global.d.ts +6 -0
  59. package/dist/src/global.d.ts.map +1 -0
  60. package/dist/src/image-utils.d.ts +1 -1
  61. package/dist/src/image-utils.d.ts.map +1 -1
  62. package/dist/src/index.browser.d.ts +1 -1
  63. package/dist/src/index.browser.d.ts.map +1 -1
  64. package/dist/src/index.d.ts +1 -0
  65. package/dist/src/index.d.ts.map +1 -1
  66. package/dist/src/node-apis/image-processing.d.ts +30 -30
  67. package/dist/src/node-apis/node-utils.d.ts +1 -1
  68. package/dist/src/node-apis/parser.d.ts +11 -11
  69. package/dist/src/node-apis/preprocess-source.d.ts +2 -2
  70. package/dist/src/node-apis/watcher.d.ts +12 -12
  71. package/dist/src/resolver-utils.d.ts +21 -21
  72. package/gatsby-ssr.js +1 -1
  73. package/package.json +16 -16
  74. package/dist/gatsby-image.browser.module.js +0 -2
  75. package/dist/gatsby-image.browser.module.js.map +0 -1
  76. package/dist/index.browser-157b940d.js +0 -2
  77. package/dist/index.browser-157b940d.js.map +0 -1
  78. package/dist/index.browser-44f85d35.js +0 -2
  79. package/dist/index.browser-44f85d35.js.map +0 -1
  80. package/dist/index.browser-aa98ba4b.js +0 -3
  81. package/dist/index.browser-aa98ba4b.js.map +0 -1
  82. package/dist/intersection-observer-1b2d7fcb.js +0 -2
  83. package/dist/intersection-observer-1b2d7fcb.js.map +0 -1
  84. package/dist/intersection-observer-3d807f12.js +0 -2
  85. package/dist/intersection-observer-3d807f12.js.map +0 -1
  86. package/dist/intersection-observer-6b794dd8.js +0 -2
  87. package/dist/intersection-observer-6b794dd8.js.map +0 -1
  88. package/dist/lazy-hydrate-20d22952.js +0 -2
  89. package/dist/lazy-hydrate-20d22952.js.map +0 -1
  90. package/dist/lazy-hydrate-5afd23f7.js +0 -2
  91. package/dist/lazy-hydrate-5afd23f7.js.map +0 -1
  92. package/dist/lazy-hydrate-5c228ac8.js +0 -2
  93. package/dist/lazy-hydrate-5c228ac8.js.map +0 -1
  94. package/dist/src/components/later-hydrator.d.ts +0 -3
  95. package/dist/src/components/later-hydrator.d.ts.map +0 -1
  96. package/gatsby-browser.js +0 -6
package/CHANGELOG.md CHANGED
@@ -3,7 +3,67 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
- ## [2.10.0](https://github.com/gatsbyjs/gatsby/commits/HEAD/packages/gatsby-plugin-image) (2022-03-16)
6
+ ## [2.14.0](https://github.com/gatsbyjs/gatsby/commits/gatsby-plugin-image@2.14.0/packages/gatsby-plugin-image) (2022-05-10)
7
+
8
+ [🧾 Release notes](https://www.gatsbyjs.com/docs/reference/release-notes/v4.14)
9
+
10
+ #### Features
11
+
12
+ - add check for node.gatsbyImage in the getImage helper [#35507](https://github.com/gatsbyjs/gatsby/issues/35507) ([abc6dca](https://github.com/gatsbyjs/gatsby/commit/abc6dca7a24bd1fcf8946ce23e09d50c914ac589))
13
+
14
+ #### Bug Fixes
15
+
16
+ - fix image flickers fix [#35226](https://github.com/gatsbyjs/gatsby/issues/35226) ([9a91295](https://github.com/gatsbyjs/gatsby/commit/9a912956a5ea66be7281f6263928b64f20ff1d53))
17
+ - update dependency fs-extra to ^10.1.0 [#34976](https://github.com/gatsbyjs/gatsby/issues/34976) ([10752ed](https://github.com/gatsbyjs/gatsby/commit/10752ed325ac0ebc2655b994862f66abe072e09f))
18
+ - update dependency semver to ^7.3.7 [#35543](https://github.com/gatsbyjs/gatsby/issues/35543) ([f593e00](https://github.com/gatsbyjs/gatsby/commit/f593e005e4561b423a297e967205d833451a2f55))
19
+
20
+ #### Chores
21
+
22
+ - update dependency typescript to ^4.6.4 [#34984](https://github.com/gatsbyjs/gatsby/issues/34984) ([71eb414](https://github.com/gatsbyjs/gatsby/commit/71eb414ad5abf1c835a2c243f01ac98ea5ee7e37))
23
+
24
+ ## [2.13.0](https://github.com/gatsbyjs/gatsby/commits/gatsby-plugin-image@2.13.0/packages/gatsby-plugin-image) (2022-04-26)
25
+
26
+ [🧾 Release notes](https://www.gatsbyjs.com/docs/reference/release-notes/v4.13)
27
+
28
+ **Note:** Version bump only for package gatsby-plugin-image
29
+
30
+ ### [2.12.1](https://github.com/gatsbyjs/gatsby/commits/gatsby-plugin-image@2.12.1/packages/gatsby-plugin-image) (2022-04-13)
31
+
32
+ **Note:** Version bump only for package gatsby-plugin-image
33
+
34
+ ## [2.12.0](https://github.com/gatsbyjs/gatsby/commits/gatsby-plugin-image@2.12.0/packages/gatsby-plugin-image) (2022-04-12)
35
+
36
+ [🧾 Release notes](https://www.gatsbyjs.com/docs/reference/release-notes/v4.12)
37
+
38
+ #### Bug Fixes
39
+
40
+ - update dependency prop-types to ^15.8.1 for gatsby-plugin-image [#35292](https://github.com/gatsbyjs/gatsby/issues/35292) ([c662a39](https://github.com/gatsbyjs/gatsby/commit/c662a3931dc38bd819e75539e52b1346fbb95b70))
41
+
42
+ #### Chores
43
+
44
+ - update dependency semver to ^7.3.5 [#35279](https://github.com/gatsbyjs/gatsby/issues/35279) ([1d5d4a6](https://github.com/gatsbyjs/gatsby/commit/1d5d4a6ff6e376476b2a7db6dd2f5f7ce61f4483))
45
+
46
+ ### [2.11.1](https://github.com/gatsbyjs/gatsby/commits/gatsby-plugin-image@2.11.1/packages/gatsby-plugin-image) (2022-03-31)
47
+
48
+ **Note:** Version bump only for package gatsby-plugin-image
49
+
50
+ ## [2.11.0](https://github.com/gatsbyjs/gatsby/commits/gatsby-plugin-image@2.11.0/packages/gatsby-plugin-image) (2022-03-29)
51
+
52
+ [🧾 Release notes](https://www.gatsbyjs.com/docs/reference/release-notes/v4.11)
53
+
54
+ #### Bug Fixes
55
+
56
+ - compatibility with react rc 2 [#35108](https://github.com/gatsbyjs/gatsby/issues/35108) ([0c61265](https://github.com/gatsbyjs/gatsby/commit/0c6126574d203c0e6fef173b76859cdcab2f13aa))
57
+
58
+ #### Refactoring
59
+
60
+ - replace deprecated String.prototype.substr() [#35205](https://github.com/gatsbyjs/gatsby/issues/35205) ([21f7c65](https://github.com/gatsbyjs/gatsby/commit/21f7c654da647a949c83efb2e17b473eab4db3ed))
61
+
62
+ ### [2.10.1](https://github.com/gatsbyjs/gatsby/commits/gatsby-plugin-image@2.10.1/packages/gatsby-plugin-image) (2022-03-23)
63
+
64
+ **Note:** Version bump only for package gatsby-plugin-image
65
+
66
+ ## [2.10.0](https://github.com/gatsbyjs/gatsby/commits/gatsby-plugin-image@2.10.0/packages/gatsby-plugin-image) (2022-03-16)
7
67
 
8
68
  [🧾 Release notes](https://www.gatsbyjs.com/docs/reference/release-notes/v4.10)
9
69
 
@@ -1,66 +1,66 @@
1
- "use strict";
2
- var __assign = (this && this.__assign) || function () {
3
- __assign = Object.assign || function(t) {
4
- for (var s, i = 1, n = arguments.length; i < n; i++) {
5
- s = arguments[i];
6
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
- t[p] = s[p];
8
- }
9
- return t;
10
- };
11
- return __assign.apply(this, arguments);
12
- };
13
- var __importDefault = (this && this.__importDefault) || function (mod) {
14
- return (mod && mod.__esModule) ? mod : { "default": mod };
15
- };
16
- exports.__esModule = true;
17
- exports.hashOptions = exports.evaluateImageAttributes = exports.normalizeProps = exports.SHARP_ATTRIBUTES = void 0;
18
- var murmur_1 = require("babel-plugin-remove-graphql-queries/murmur");
19
- var babel_jsx_utils_1 = require("babel-jsx-utils");
20
- var camelcase_1 = __importDefault(require("camelcase"));
21
- exports.SHARP_ATTRIBUTES = new Set([
22
- "src",
23
- "layout",
24
- "formats",
25
- "aspectRatio",
26
- "quality",
27
- "avifOptions",
28
- "jpgOptions",
29
- "pngOptions",
30
- "webpOptions",
31
- "blurredOptions",
32
- "transformOptions",
33
- "width",
34
- "height",
35
- "placeholder",
36
- "tracedSVGOptions",
37
- "sizes",
38
- "backgroundColor",
39
- "breakpoints",
40
- ]);
41
- function normalizeProps(props) {
42
- var out = __assign({}, props);
43
- if (out.layout) {
44
- out.layout = (0, camelcase_1["default"])(out.layout);
45
- }
46
- if (out.placeholder) {
47
- out.placeholder = (0, camelcase_1["default"])(out.placeholder);
48
- if (out.placeholder === "tracedSvg") {
49
- out.placeholder = "tracedSVG";
50
- }
51
- }
52
- if (Array.isArray(out.formats)) {
53
- out.formats = out.formats.map(function (format) { return format.toLowerCase(); });
54
- }
55
- return out;
56
- }
57
- exports.normalizeProps = normalizeProps;
58
- function evaluateImageAttributes(nodePath, onError) {
59
- // Only get attributes that we need for generating the images
60
- return normalizeProps((0, babel_jsx_utils_1.getAttributeValues)(nodePath, onError, exports.SHARP_ATTRIBUTES));
61
- }
62
- exports.evaluateImageAttributes = evaluateImageAttributes;
63
- function hashOptions(options) {
64
- return "".concat((0, murmur_1.murmurhash)(JSON.stringify(options)));
65
- }
66
- exports.hashOptions = hashOptions;
1
+ "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ var __importDefault = (this && this.__importDefault) || function (mod) {
14
+ return (mod && mod.__esModule) ? mod : { "default": mod };
15
+ };
16
+ exports.__esModule = true;
17
+ exports.hashOptions = exports.evaluateImageAttributes = exports.normalizeProps = exports.SHARP_ATTRIBUTES = void 0;
18
+ var murmur_1 = require("babel-plugin-remove-graphql-queries/murmur");
19
+ var babel_jsx_utils_1 = require("babel-jsx-utils");
20
+ var camelcase_1 = __importDefault(require("camelcase"));
21
+ exports.SHARP_ATTRIBUTES = new Set([
22
+ "src",
23
+ "layout",
24
+ "formats",
25
+ "aspectRatio",
26
+ "quality",
27
+ "avifOptions",
28
+ "jpgOptions",
29
+ "pngOptions",
30
+ "webpOptions",
31
+ "blurredOptions",
32
+ "transformOptions",
33
+ "width",
34
+ "height",
35
+ "placeholder",
36
+ "tracedSVGOptions",
37
+ "sizes",
38
+ "backgroundColor",
39
+ "breakpoints",
40
+ ]);
41
+ function normalizeProps(props) {
42
+ var out = __assign({}, props);
43
+ if (out.layout) {
44
+ out.layout = (0, camelcase_1["default"])(out.layout);
45
+ }
46
+ if (out.placeholder) {
47
+ out.placeholder = (0, camelcase_1["default"])(out.placeholder);
48
+ if (out.placeholder === "tracedSvg") {
49
+ out.placeholder = "tracedSVG";
50
+ }
51
+ }
52
+ if (Array.isArray(out.formats)) {
53
+ out.formats = out.formats.map(function (format) { return format.toLowerCase(); });
54
+ }
55
+ return out;
56
+ }
57
+ exports.normalizeProps = normalizeProps;
58
+ function evaluateImageAttributes(nodePath, onError) {
59
+ // Only get attributes that we need for generating the images
60
+ return normalizeProps((0, babel_jsx_utils_1.getAttributeValues)(nodePath, onError, exports.SHARP_ATTRIBUTES));
61
+ }
62
+ exports.evaluateImageAttributes = evaluateImageAttributes;
63
+ function hashOptions(options) {
64
+ return "".concat((0, murmur_1.murmurhash)(JSON.stringify(options)));
65
+ }
66
+ exports.hashOptions = hashOptions;
@@ -1,80 +1,80 @@
1
- "use strict";
2
- var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
3
- if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
4
- return cooked;
5
- };
6
- var __importDefault = (this && this.__importDefault) || function (mod) {
7
- return (mod && mod.__esModule) ? mod : { "default": mod };
8
- };
9
- exports.__esModule = true;
10
- var babel_helpers_1 = require("./babel-helpers");
11
- var fs_extra_1 = __importDefault(require("fs-extra"));
12
- var path_1 = __importDefault(require("path"));
13
- var gatsby_core_utils_1 = require("gatsby-core-utils");
14
- var common_tags_1 = require("common-tags");
15
- /**
16
- * This is a plugin that finds StaticImage components and injects the image props into the component.
17
- * These props contain the image URLs etc, and were created earlier in the build process
18
- */
19
- function attrs(_a) {
20
- var t = _a.types, template = _a.template;
21
- return {
22
- visitor: {
23
- JSXOpeningElement: function (nodePath) {
24
- var _a;
25
- if (!nodePath
26
- .get("name")
27
- .referencesImport("gatsby-plugin-image", "StaticImage")) {
28
- return;
29
- }
30
- var unresolvedProps = [];
31
- var props = (0, babel_helpers_1.evaluateImageAttributes)(nodePath, function (prop) {
32
- unresolvedProps.push(prop);
33
- });
34
- var error;
35
- if (unresolvedProps.length) {
36
- // TODO: Add a shortlink to docs on the plugin
37
- error = "Could not find values for the following props at build time: ".concat(unresolvedProps.join(", "));
38
- console.warn("[gatsby-plugin-image] ".concat(error));
39
- }
40
- var hash = (0, babel_helpers_1.hashOptions)(props);
41
- var cacheDir = (_a = this.opts) === null || _a === void 0 ? void 0 : _a.cacheDir;
42
- if (!cacheDir) {
43
- console.warn("[gatsby-plugin-image] Couldn't find image data cache file");
44
- }
45
- var filename = path_1["default"].join(cacheDir, "".concat(hash, ".json"));
46
- var data;
47
- // If there's no src prop there's no point in checking if it exists
48
- if (!unresolvedProps.includes("src")) {
49
- try {
50
- data = fs_extra_1["default"].readJSONSync(filename);
51
- }
52
- catch (e) {
53
- // TODO add info about minimum Gatsby version once this is merged
54
- var msg = (0, common_tags_1.stripIndent)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n Could not read image data file \"", "\". \n This may mean that the images in \"", "\" were not processed.\n Please ensure that your gatsby version is at least 2.24.78."], ["\n Could not read image data file \"", "\". \n This may mean that the images in \"", "\" were not processed.\n Please ensure that your gatsby version is at least 2.24.78."])), filename, this.filename);
55
- error += msg;
56
- console.warn("[gatsby-plugin-image] ".concat(msg));
57
- }
58
- }
59
- if (!data) {
60
- console.warn("[gatsby-plugin-image] No data found for image \"".concat(props.src, "\""));
61
- // Add the error message to the component so we can show it in the browser
62
- var newProp_1 = t.jsxAttribute(t.jsxIdentifier("__error"), t.jsxExpressionContainer(t.stringLiteral("No data found for image \"".concat(props.src, "\"\n ").concat(error || ""))));
63
- nodePath.node.attributes.push(newProp_1);
64
- return;
65
- }
66
- if (error) {
67
- // Add the error message to the component so we can show it in the browser
68
- var newProp_2 = t.jsxAttribute(t.jsxIdentifier("__error"), t.stringLiteral(error));
69
- nodePath.node.attributes.push(newProp_2);
70
- }
71
- // `require()` the image data into a component prop
72
- var makeRequire = template.expression("require(\"".concat((0, gatsby_core_utils_1.slash)(filename), "\")"));
73
- var newProp = t.jsxAttribute(t.jsxIdentifier("__imageData"), t.jsxExpressionContainer(makeRequire()));
74
- nodePath.node.attributes.push(newProp);
75
- }
76
- }
77
- };
78
- }
79
- exports["default"] = attrs;
80
- var templateObject_1;
1
+ "use strict";
2
+ var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
3
+ if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
4
+ return cooked;
5
+ };
6
+ var __importDefault = (this && this.__importDefault) || function (mod) {
7
+ return (mod && mod.__esModule) ? mod : { "default": mod };
8
+ };
9
+ exports.__esModule = true;
10
+ var babel_helpers_1 = require("./babel-helpers");
11
+ var fs_extra_1 = __importDefault(require("fs-extra"));
12
+ var path_1 = __importDefault(require("path"));
13
+ var gatsby_core_utils_1 = require("gatsby-core-utils");
14
+ var common_tags_1 = require("common-tags");
15
+ /**
16
+ * This is a plugin that finds StaticImage components and injects the image props into the component.
17
+ * These props contain the image URLs etc, and were created earlier in the build process
18
+ */
19
+ function attrs(_a) {
20
+ var t = _a.types, template = _a.template;
21
+ return {
22
+ visitor: {
23
+ JSXOpeningElement: function (nodePath) {
24
+ var _a;
25
+ if (!nodePath
26
+ .get("name")
27
+ .referencesImport("gatsby-plugin-image", "StaticImage")) {
28
+ return;
29
+ }
30
+ var unresolvedProps = [];
31
+ var props = (0, babel_helpers_1.evaluateImageAttributes)(nodePath, function (prop) {
32
+ unresolvedProps.push(prop);
33
+ });
34
+ var error;
35
+ if (unresolvedProps.length) {
36
+ // TODO: Add a shortlink to docs on the plugin
37
+ error = "Could not find values for the following props at build time: ".concat(unresolvedProps.join(", "));
38
+ console.warn("[gatsby-plugin-image] ".concat(error));
39
+ }
40
+ var hash = (0, babel_helpers_1.hashOptions)(props);
41
+ var cacheDir = (_a = this.opts) === null || _a === void 0 ? void 0 : _a.cacheDir;
42
+ if (!cacheDir) {
43
+ console.warn("[gatsby-plugin-image] Couldn't find image data cache file");
44
+ }
45
+ var filename = path_1["default"].join(cacheDir, "".concat(hash, ".json"));
46
+ var data;
47
+ // If there's no src prop there's no point in checking if it exists
48
+ if (!unresolvedProps.includes("src")) {
49
+ try {
50
+ data = fs_extra_1["default"].readJSONSync(filename);
51
+ }
52
+ catch (e) {
53
+ // TODO add info about minimum Gatsby version once this is merged
54
+ var msg = (0, common_tags_1.stripIndent)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n Could not read image data file \"", "\". \n This may mean that the images in \"", "\" were not processed.\n Please ensure that your gatsby version is at least 2.24.78."], ["\n Could not read image data file \"", "\". \n This may mean that the images in \"", "\" were not processed.\n Please ensure that your gatsby version is at least 2.24.78."])), filename, this.filename);
55
+ error += msg;
56
+ console.warn("[gatsby-plugin-image] ".concat(msg));
57
+ }
58
+ }
59
+ if (!data) {
60
+ console.warn("[gatsby-plugin-image] No data found for image \"".concat(props.src, "\""));
61
+ // Add the error message to the component so we can show it in the browser
62
+ var newProp_1 = t.jsxAttribute(t.jsxIdentifier("__error"), t.jsxExpressionContainer(t.stringLiteral("No data found for image \"".concat(props.src, "\"\n ").concat(error || ""))));
63
+ nodePath.node.attributes.push(newProp_1);
64
+ return;
65
+ }
66
+ if (error) {
67
+ // Add the error message to the component so we can show it in the browser
68
+ var newProp_2 = t.jsxAttribute(t.jsxIdentifier("__error"), t.stringLiteral(error));
69
+ nodePath.node.attributes.push(newProp_2);
70
+ }
71
+ // `require()` the image data into a component prop
72
+ var makeRequire = template.expression("require(\"".concat((0, gatsby_core_utils_1.slash)(filename), "\")"));
73
+ var newProp = t.jsxAttribute(t.jsxIdentifier("__imageData"), t.jsxExpressionContainer(makeRequire()));
74
+ nodePath.node.attributes.push(newProp);
75
+ }
76
+ }
77
+ };
78
+ }
79
+ exports["default"] = attrs;
80
+ var templateObject_1;