gatsby-source-filesystem 4.4.0-next.0 → 4.5.0-next.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/CHANGELOG.md +15 -0
- package/README.md +2 -0
- package/create-file-node-from-buffer.js +1 -4
- package/create-remote-file-node.js +5 -4
- package/package.json +5 -5
- package/utils.js +10 -16
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,21 @@
|
|
|
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
|
+
## [4.4.0](https://github.com/gatsbyjs/gatsby/commits/gatsby-source-filesystem@4.4.0/packages/gatsby-source-filesystem) (2021-12-14)
|
|
7
|
+
|
|
8
|
+
[🧾 Release notes](https://www.gatsbyjs.com/docs/reference/release-notes/v4.4)
|
|
9
|
+
|
|
10
|
+
#### Bug Fixes
|
|
11
|
+
|
|
12
|
+
- Ensure fastq concurrency parameter of the correct type [#34186](https://github.com/gatsbyjs/gatsby/issues/34186) ([cada108](https://github.com/gatsbyjs/gatsby/commit/cada108ce0fb6cdb3344e37403194439e50f6492))
|
|
13
|
+
- update dependency xstate to ^4.26.1 for gatsby-source-filesystem [#34134](https://github.com/gatsbyjs/gatsby/issues/34134) ([c3e9fd9](https://github.com/gatsbyjs/gatsby/commit/c3e9fd90f5ec515f9fe8e67608bc025693880922))
|
|
14
|
+
|
|
15
|
+
## [4.3.0](https://github.com/gatsbyjs/gatsby/commits/gatsby-source-filesystem@4.3.0/packages/gatsby-source-filesystem) (2021-12-01)
|
|
16
|
+
|
|
17
|
+
[🧾 Release notes](https://www.gatsbyjs.com/docs/reference/release-notes/v4.3)
|
|
18
|
+
|
|
19
|
+
**Note:** Version bump only for package gatsby-source-filesystem
|
|
20
|
+
|
|
6
21
|
## [4.2.0](https://github.com/gatsbyjs/gatsby/commits/gatsby-source-filesystem@4.2.0/packages/gatsby-source-filesystem) (2021-11-16)
|
|
7
22
|
|
|
8
23
|
[🧾 Release notes](https://www.gatsbyjs.com/docs/reference/release-notes/v4.2)
|
package/README.md
CHANGED
|
@@ -162,6 +162,8 @@ When building source plugins for remote data sources such as headless CMSs, thei
|
|
|
162
162
|
|
|
163
163
|
The `createRemoteFileNode` helper makes it easy to download remote files and add them to your site's GraphQL schema.
|
|
164
164
|
|
|
165
|
+
While downloading the assets, special characters (regex: `/:|\/|\*|\?|"|<|>|\||\\/g`) in filenames are replaced with a hyphen "-". When special characters are found a file hash is added to keep files unique e.g `a:file.jpg` becomes `a-file-73hd.jpg` (as otherwise `a:file.jpg` and `a*file.jpg` would overwrite themselves).
|
|
166
|
+
|
|
165
167
|
```javascript
|
|
166
168
|
createRemoteFileNode({
|
|
167
169
|
// The source url of the remote file
|
|
@@ -11,11 +11,8 @@ const {
|
|
|
11
11
|
} = require(`./create-file-node`);
|
|
12
12
|
|
|
13
13
|
const {
|
|
14
|
+
createContentDigest,
|
|
14
15
|
createFilePath
|
|
15
|
-
} = require(`./utils`);
|
|
16
|
-
|
|
17
|
-
const {
|
|
18
|
-
createContentDigest
|
|
19
16
|
} = require(`gatsby-core-utils`);
|
|
20
17
|
|
|
21
18
|
const cacheId = hash => `create-file-node-from-buffer-${hash}`;
|
|
@@ -4,7 +4,8 @@ const fs = require(`fs-extra`);
|
|
|
4
4
|
|
|
5
5
|
const {
|
|
6
6
|
createContentDigest,
|
|
7
|
-
fetchRemoteFile
|
|
7
|
+
fetchRemoteFile,
|
|
8
|
+
createFilePath
|
|
8
9
|
} = require(`gatsby-core-utils`);
|
|
9
10
|
|
|
10
11
|
const path = require(`path`);
|
|
@@ -20,8 +21,7 @@ const {
|
|
|
20
21
|
} = require(`./create-file-node`);
|
|
21
22
|
|
|
22
23
|
const {
|
|
23
|
-
getRemoteFileExtension
|
|
24
|
-
createFilePath
|
|
24
|
+
getRemoteFileExtension
|
|
25
25
|
} = require(`./utils`);
|
|
26
26
|
|
|
27
27
|
let showFlagWarning = !!process.env.GATSBY_EXPERIMENTAL_REMOTE_FILE_PLACEHOLDER;
|
|
@@ -63,7 +63,8 @@ let showFlagWarning = !!process.env.GATSBY_EXPERIMENTAL_REMOTE_FILE_PLACEHOLDER;
|
|
|
63
63
|
* Queue Management *
|
|
64
64
|
********************/
|
|
65
65
|
|
|
66
|
-
const
|
|
66
|
+
const GATSBY_CONCURRENT_DOWNLOAD = process.env.GATSBY_CONCURRENT_DOWNLOAD ? parseInt(process.env.GATSBY_CONCURRENT_DOWNLOAD, 10) || 0 : 200;
|
|
67
|
+
const queue = Queue(pushToQueue, GATSBY_CONCURRENT_DOWNLOAD);
|
|
67
68
|
/**
|
|
68
69
|
* @callback {Queue~queueCallback}
|
|
69
70
|
* @param {*} error
|
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": "4.
|
|
4
|
+
"version": "4.5.0-next.1",
|
|
5
5
|
"author": "Kyle Mathews <mathews.kyle@gmail.com>",
|
|
6
6
|
"bugs": {
|
|
7
7
|
"url": "https://github.com/gatsbyjs/gatsby/issues"
|
|
@@ -12,19 +12,19 @@
|
|
|
12
12
|
"fastq": "^1.13.0",
|
|
13
13
|
"file-type": "^16.5.3",
|
|
14
14
|
"fs-extra": "^10.0.0",
|
|
15
|
-
"gatsby-core-utils": "^3.
|
|
15
|
+
"gatsby-core-utils": "^3.5.0-next.1",
|
|
16
16
|
"got": "^9.6.0",
|
|
17
17
|
"md5-file": "^5.0.0",
|
|
18
18
|
"mime": "^2.5.2",
|
|
19
19
|
"pretty-bytes": "^5.4.1",
|
|
20
20
|
"progress": "^2.0.3",
|
|
21
21
|
"valid-url": "^1.0.9",
|
|
22
|
-
"xstate": "^4.
|
|
22
|
+
"xstate": "^4.26.1"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
25
|
"@babel/cli": "^7.15.4",
|
|
26
26
|
"@babel/core": "^7.15.5",
|
|
27
|
-
"babel-preset-gatsby-package": "^2.
|
|
27
|
+
"babel-preset-gatsby-package": "^2.5.0-next.0",
|
|
28
28
|
"cross-env": "^7.0.3"
|
|
29
29
|
},
|
|
30
30
|
"homepage": "https://github.com/gatsbyjs/gatsby/tree/master/packages/gatsby-source-filesystem#readme",
|
|
@@ -50,5 +50,5 @@
|
|
|
50
50
|
"engines": {
|
|
51
51
|
"node": ">=14.15.0"
|
|
52
52
|
},
|
|
53
|
-
"gitHead": "
|
|
53
|
+
"gitHead": "bf5fc96ddb64c7416bd4c84c6bef6f8cbc27d496"
|
|
54
54
|
}
|
package/utils.js
CHANGED
|
@@ -3,11 +3,15 @@
|
|
|
3
3
|
exports.__esModule = true;
|
|
4
4
|
exports.getRemoteFileExtension = getRemoteFileExtension;
|
|
5
5
|
exports.getRemoteFileName = getRemoteFileName;
|
|
6
|
-
exports.createFilePath =
|
|
6
|
+
exports.createFilePath = void 0;
|
|
7
7
|
|
|
8
8
|
const path = require(`path`);
|
|
9
9
|
|
|
10
10
|
const Url = require(`url`);
|
|
11
|
+
|
|
12
|
+
const {
|
|
13
|
+
createFilePath
|
|
14
|
+
} = require(`gatsby-core-utils`);
|
|
11
15
|
/**
|
|
12
16
|
* getParsedPath
|
|
13
17
|
* --
|
|
@@ -19,6 +23,8 @@ const Url = require(`url`);
|
|
|
19
23
|
*/
|
|
20
24
|
|
|
21
25
|
|
|
26
|
+
exports.createFilePath = createFilePath;
|
|
27
|
+
|
|
22
28
|
function getParsedPath(url) {
|
|
23
29
|
return path.parse(Url.parse(url).pathname);
|
|
24
30
|
}
|
|
@@ -49,18 +55,6 @@ function getRemoteFileExtension(url) {
|
|
|
49
55
|
|
|
50
56
|
function getRemoteFileName(url) {
|
|
51
57
|
return getParsedPath(url).name;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
* --
|
|
56
|
-
*
|
|
57
|
-
* @param {String} directory
|
|
58
|
-
* @param {String} filename
|
|
59
|
-
* @param {String} ext
|
|
60
|
-
* @return {String}
|
|
61
|
-
*/
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
function createFilePath(directory, filename, ext) {
|
|
65
|
-
return path.join(directory, `${filename}${ext}`);
|
|
66
|
-
}
|
|
58
|
+
} // createFilePath should be imported from `gatsby-core-utils`
|
|
59
|
+
// but some plugins already do import it from `gatsby-source-filesystem/utils`
|
|
60
|
+
// so just keeping re-export here for backward compatibility
|