gatsby-source-notion-churnotion 1.0.47 → 1.0.49
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/util/imageProcessor.js +27 -21
- package/package.json +1 -1
@@ -10,29 +10,35 @@ const processBlocks = async (blocks, actions, getCache, createNodeId, reporter)
|
|
10
10
|
const { createNode } = actions;
|
11
11
|
let thumbnail = null;
|
12
12
|
for (const block of blocks) {
|
13
|
-
if (isImageBlock(block)
|
14
|
-
const
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
13
|
+
if (isImageBlock(block)) {
|
14
|
+
const imageSourceType = block.image.type;
|
15
|
+
const imageUrl = imageSourceType === `external`
|
16
|
+
? block.image.external?.url
|
17
|
+
: block.image?.file?.url;
|
18
|
+
if (!imageUrl)
|
19
|
+
continue;
|
20
|
+
reporter.info(`[Image] got image > ${imageUrl}`);
|
21
|
+
try {
|
22
|
+
const fileNode = await (0, gatsby_source_filesystem_1.createRemoteFileNode)({
|
23
|
+
url: imageUrl,
|
24
|
+
parentNodeId: block.id,
|
25
|
+
getCache,
|
26
|
+
createNode,
|
27
|
+
createNodeId,
|
28
|
+
});
|
29
|
+
if (fileNode) {
|
30
|
+
block.image = {
|
31
|
+
id: fileNode.id,
|
32
|
+
caption: block.image.caption,
|
33
|
+
};
|
34
|
+
if (!thumbnail)
|
35
|
+
thumbnail = fileNode.id;
|
36
|
+
reporter.info(`[SUCCESS] Image processed: ${fileNode.id}`);
|
34
37
|
}
|
35
38
|
}
|
39
|
+
catch (error) {
|
40
|
+
reporter.warn(`[WARNING] Failed to download image: ${imageUrl}`);
|
41
|
+
}
|
36
42
|
}
|
37
43
|
}
|
38
44
|
return thumbnail;
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "gatsby-source-notion-churnotion",
|
3
3
|
"description": "Gatsby plugin that can connect with One Notion Database RECURSIVELY using official API",
|
4
|
-
"version": "1.0.
|
4
|
+
"version": "1.0.49",
|
5
5
|
"skipLibCheck": true,
|
6
6
|
"license": "0BSD",
|
7
7
|
"main": "./dist/gatsby-node.js",
|