gatsby-source-filesystem 2.9.0 → 2.10.0

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/CHANGELOG.md CHANGED
@@ -3,7 +3,17 @@
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.9.0](https://github.com/gatsbyjs/gatsby/compare/gatsby-source-filesystem@2.9.0-next.2...gatsby-source-filesystem@2.9.0) (2021-01-05)
6
+ # [2.10.0](https://github.com/gatsbyjs/gatsby/compare/gatsby-source-filesystem@2.10.0-next.1...gatsby-source-filesystem@2.10.0) (2021-01-19)
7
+
8
+ **Note:** Version bump only for package gatsby-source-filesystem
9
+
10
+ # [2.10.0-next.1](https://github.com/gatsbyjs/gatsby/compare/gatsby-source-filesystem@2.10.0-next.0...gatsby-source-filesystem@2.10.0-next.1) (2021-01-12)
11
+
12
+ ### Bug Fixes
13
+
14
+ - **gatsby-source-filesystem:** fix broken stream with gzipped files ([#28913](https://github.com/gatsbyjs/gatsby/issues/28913)) ([a8b516f](https://github.com/gatsbyjs/gatsby/commit/a8b516fc59987a50dc8ccfa0aafbc6415414b009))
15
+
16
+ # [2.10.0-next.0](https://github.com/gatsbyjs/gatsby/compare/gatsby-source-filesystem@2.9.0-next.2...gatsby-source-filesystem@2.10.0-next.0) (2020-12-29)
7
17
 
8
18
  **Note:** Version bump only for package gatsby-source-filesystem
9
19
 
package/README.md CHANGED
@@ -235,7 +235,7 @@ exports.downloadMediaFiles = ({
235
235
  }
236
236
  ```
237
237
 
238
- The file node can then be queried using GraphQL. See an example of this in the [gatsby-source-wordpress README](/packages/gatsby-source-wordpress/#image-processing) where downloaded images are queried using [gatsby-transformer-sharp](/packages/gatsby-transformer-sharp/) to use in the component [gatsby-image](/packages/gatsby-image/).
238
+ The file node can then be queried using GraphQL. See an example of this in the [gatsby-source-wordpress README](/plugins/gatsby-source-wordpress/#image-processing) where downloaded images are queried using [gatsby-transformer-sharp](/plugins/gatsby-transformer-sharp/) to use in the component [gatsby-image](/plugins/gatsby-image/).
239
239
 
240
240
  #### Retrieving the remote file name and extension
241
241
 
@@ -176,6 +176,12 @@ const requestRemoteNode = (url, headers, tmpFilename, httpOpts, attempt = 1) =>
176
176
  },
177
177
  ...httpOpts
178
178
  });
179
+ let haveAllBytesBeenWritten = false;
180
+ responseStream.on(`downloadProgress`, progress => {
181
+ if (progress.transferred === progress.total || progress.total === null) {
182
+ haveAllBytesBeenWritten = true;
183
+ }
184
+ });
179
185
  const fsWriteStream = fs.createWriteStream(tmpFilename);
180
186
  responseStream.pipe(fsWriteStream); // If there's a 400/500 response or other error.
181
187
 
@@ -196,10 +202,10 @@ const requestRemoteNode = (url, headers, tmpFilename, httpOpts, attempt = 1) =>
196
202
  });
197
203
  responseStream.on(`response`, response => {
198
204
  resetTimeout();
199
- const contentLength = response.headers && Number(response.headers[`content-length`]);
200
205
  fsWriteStream.on(`finish`, () => {
201
- // We have an incomplete download
202
- if (contentLength && contentLength !== fsWriteStream.bytesWritten) {
206
+ fsWriteStream.close(); // We have an incomplete download
207
+
208
+ if (!haveAllBytesBeenWritten) {
203
209
  fs.removeSync(tmpFilename);
204
210
 
205
211
  if (attempt < INCOMPLETE_RETRY_LIMIT) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "gatsby-source-filesystem",
3
3
  "description": "Gatsby source plugin for building websites from local data. Markdown, JSON, images, YAML, CSV, and dozens of other data types supported.",
4
- "version": "2.9.0",
4
+ "version": "2.10.0",
5
5
  "author": "Kyle Mathews <mathews.kyle@gmail.com>",
6
6
  "bugs": {
7
7
  "url": "https://github.com/gatsbyjs/gatsby/issues"
@@ -12,7 +12,7 @@
12
12
  "chokidar": "^3.4.3",
13
13
  "file-type": "^16.0.0",
14
14
  "fs-extra": "^8.1.0",
15
- "gatsby-core-utils": "^1.8.0",
15
+ "gatsby-core-utils": "^1.9.0",
16
16
  "got": "^9.6.0",
17
17
  "md5-file": "^5.0.0",
18
18
  "mime": "^2.4.6",
@@ -24,8 +24,9 @@
24
24
  "devDependencies": {
25
25
  "@babel/cli": "^7.12.1",
26
26
  "@babel/core": "^7.12.3",
27
- "babel-preset-gatsby-package": "^0.10.0",
28
- "cross-env": "^7.0.3"
27
+ "babel-preset-gatsby-package": "^0.11.0",
28
+ "cross-env": "^7.0.3",
29
+ "msw": "^0.25.0"
29
30
  },
30
31
  "homepage": "https://github.com/gatsbyjs/gatsby/tree/master/packages/gatsby-source-filesystem#readme",
31
32
  "keywords": [
@@ -50,5 +51,5 @@
50
51
  "engines": {
51
52
  "node": ">=10.13.0"
52
53
  },
53
- "gitHead": "f8cc2a3f02f621f20af9b60dda6f1980fbd37a05"
54
+ "gitHead": "fbc58933c6a6d5d8837e36104fdb74a0cb02163d"
54
55
  }