gatsby-source-notion-churnotion 1.0.22 → 1.0.24

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.
@@ -125,7 +125,14 @@ const getPages = async ({ databaseId, reporter, getCache, actions, createNode, c
125
125
  }
126
126
  const bookId = page.properties?.book?.relation?.[0]?.id || null;
127
127
  const markdownContent = await connector_1.n2m.pageToMarkdown(page.id);
128
- const thumbnailUrl = await (0, imageProcessor_1.processBlocks)(markdownContent, actions, getCache, createNodeId, reporter);
128
+ const imageBlock = await (0, imageProcessor_1.processBlocks)(markdownContent, actions, getCache, createNodeId, reporter);
129
+ const gatsbyImageData = {
130
+ childImageSharp: {
131
+ gatsbyImageData: imageBlock
132
+ ? `childImageSharp___NODE___${imageBlock}`
133
+ : null,
134
+ },
135
+ };
129
136
  const postNode = {
130
137
  id: nodeId,
131
138
  category: parentCategoryId,
@@ -150,7 +157,8 @@ const getPages = async ({ databaseId, reporter, getCache, actions, createNode, c
150
157
  tags: tagIds,
151
158
  parent: null,
152
159
  url: `${constants_1.COMMON_URI}/${constants_1.POST_URI}${categoryUrl}/${slug}`,
153
- thumbnailUrl: thumbnailUrl,
160
+ thumbnailUrl: imageBlock,
161
+ ...gatsbyImageData,
154
162
  };
155
163
  await createNode(postNode);
156
164
  // book과 post 부모-자식 관계 설정
@@ -11,7 +11,7 @@ const processBlocks = async (blocks, actions, getCache, createNodeId, reporter)
11
11
  block.parent.includes(`http`)) {
12
12
  const match = block.parent.match(/\((https?:\/\/.*?)\)/);
13
13
  if (match) {
14
- const imageUrl = match[1].slice(1, match[1].length - 1);
14
+ const imageUrl = match[1];
15
15
  reporter.info(`[Image] got image > ${imageUrl}`);
16
16
  try {
17
17
  const fileNode = await (0, gatsby_source_filesystem_1.createRemoteFileNode)({
@@ -22,9 +22,10 @@ const processBlocks = async (blocks, actions, getCache, createNodeId, reporter)
22
22
  createNodeId,
23
23
  });
24
24
  if (fileNode) {
25
- const publicUrl = fileNode.publicURL;
26
- block.parent = block.parent.replace(/\(https?:\/\/.*?\)/, `(${publicUrl || fileNode.relativePath})`);
27
- reporter.info(`[SUCCESS] Image processed: ${publicUrl}`);
25
+ block.parent = fileNode.id;
26
+ if (thumbnailUrl.length === 0)
27
+ thumbnailUrl = fileNode.id;
28
+ reporter.info(`[SUCCESS] Image processed: ${fileNode.publicURL}`);
28
29
  }
29
30
  }
30
31
  catch (error) {
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.22",
4
+ "version": "1.0.24",
5
5
  "skipLibCheck": true,
6
6
  "license": "0BSD",
7
7
  "main": "./dist/gatsby-node.js",