Skip to content

Commit b6935a4

Browse files
gatsbybotpieh
andauthored
chore(gatsby-source-contentful): upgrade is-online (#38862) (#38970)
* chore(gatsby-source-contentful): upgrade is-online * test: update esm packages for jest config (cherry picked from commit 89cb129) Co-authored-by: Michal Piechowiak <misiek.piechowiak@gmail.com>
1 parent 8f0f7c5 commit b6935a4

File tree

5 files changed

+178
-186
lines changed

5 files changed

+178
-186
lines changed

jest.config.js

+85-65
Original file line numberDiff line numberDiff line change
@@ -22,90 +22,110 @@ const useJestUnit = !!process.env.GENERATE_JEST_REPORT
2222

2323
// list to add ESM to ignore
2424
const esModules = [
25-
`rehype`,
26-
`unified`,
27-
`bail`,
28-
`is-plain-obj`,
2925
`@mdx-js/mdx`,
30-
`trough`,
31-
`vfile`,
32-
`unist-util-stringify-position`,
26+
`@sindresorhus/is`,
27+
`@szmarczak/http-timer`,
28+
`aggregate-error`,
29+
`bail`,
30+
`cacheable-lookup`,
31+
`cacheable-request`,
32+
`ccount`,
33+
`character-entities`,
34+
`character-entities-html4`,
35+
`character-entities-legacy`,
36+
`character-reference-invalid`,
37+
`clean-stack`,
38+
`comma-separated-tokens`,
39+
`decode-named-character-reference`,
40+
`escape-string-regexp`,
41+
`estree-util-attach-comments`,
42+
`estree-util-build-jsx`,
43+
`estree-util-is-identifier-name`,
44+
`estree-util-to-js`,
45+
`estree-util-visit`,
46+
`estree-walker`,
47+
`form-data-encoder`,
48+
`github-slugger`,
49+
`got`,
3350
`hast-util-from-parse5`,
34-
`hastscript`,
35-
`property-information`,
51+
`hast-util-is-element`,
3652
`hast-util-parse-selector`,
37-
`space-separated-tokens`,
38-
`comma-separated-tokens`,
39-
`web-namespaces`,
53+
`hast-util-to-estree`,
4054
`hast-util-to-html`,
41-
`html-void-elements`,
42-
`hast-util-is-element`,
43-
`unist-util-is`,
4455
`hast-util-whitespace`,
45-
`stringify-entities`,
46-
`character-entities-legacy`,
47-
`character-entities-html4`,
48-
`ccount`,
49-
`remark-mdx`,
50-
`micromark-extension-mdxjs`,
51-
`micromark-util-combine-extensions`,
52-
`micromark-util-chunked`,
56+
`hastscript`,
57+
`html-void-elements`,
58+
`indent-string`,
59+
`is-alphabetical`,
60+
`is-alphanumerical`,
61+
`is-decimal`,
62+
`is-hexadecimal`,
63+
`is-online`,
64+
`is-plain-obj`,
65+
`is-reference`,
66+
`longest-streak`,
67+
`lowercase-keys`,
68+
`mdast-util-definitions`,
69+
`mdast-util-from-markdown`,
70+
`mdast-util-mdx`,
71+
`mdast-util-to-hast`,
72+
`mdast-util-to-markdown`,
73+
`mdast-util-to-string`,
74+
`mdast-util-toc`,
75+
`micromark`,
76+
`micromark-core-commonmark`,
5377
`micromark-extension-mdx-expression`,
54-
`micromark-factory-mdx-expression`,
55-
`micromark-util-character`,
56-
`micromark-factory-space`,
57-
`unist-util-position-from-estree`,
58-
`micromark-util-events-to-acorn`,
59-
`estree-util-visit`,
6078
`micromark-extension-mdx-jsx`,
61-
`estree-util-is-identifier-name`,
6279
`micromark-extension-mdx-md`,
63-
`micromark-core-commonmark`,
64-
`micromark-util-classify-character`,
65-
`micromark-util-resolve-all`,
66-
`decode-named-character-reference`,
67-
`character-entities`,
68-
`micromark-util-subtokenize`,
80+
`micromark-extension-mdxjs`,
6981
`micromark-factory-destination`,
70-
`micromark-util-character`,
7182
`micromark-factory-label`,
83+
`micromark-factory-mdx-expression`,
84+
`micromark-factory-space`,
7285
`micromark-factory-title`,
7386
`micromark-factory-whitespace`,
74-
`micromark-util-normalize-identifier`,
87+
`micromark-util-character`,
88+
`micromark-util-character`,
89+
`micromark-util-chunked`,
90+
`micromark-util-classify-character`,
91+
`micromark-util-combine-extensions`,
92+
`micromark-util-events-to-acorn`,
7593
`micromark-util-html-tag-name`,
76-
`mdast-util-mdx`,
94+
`micromark-util-normalize-identifier`,
95+
`micromark-util-resolve-all`,
96+
`micromark-util-subtokenize`,
97+
`mimic-response`,
98+
`normalize-url`,
99+
`p-any`,
100+
`p-cancelable`,
101+
`p-some`,
102+
`p-timeout`,
77103
`parse-entities`,
78-
`character-reference-invalid`,
79-
`is-decimal`,
80-
`is-hexadecimal`,
81-
`is-alphanumerical`,
82-
`is-alphabetical`,
83-
`mdast-util-to-markdown`,
104+
`periscopic`,
105+
`property-information`,
106+
`public-ip`,
107+
`rehype`,
108+
`remark-mdx`,
109+
`remark-parse`,
84110
`remark-parse`,
85-
`mdast-util-from-markdown`,
86-
`mdast-util-to-string`,
87-
`micromark`,
88111
`remark-rehype`,
89-
`mdast-util-to-hast`,
112+
`remark-stringify`,
113+
`responselike`,
114+
`space-separated-tokens`,
115+
`stringify-entities`,
116+
`trim-lines`,
117+
`trough`,
118+
`unified`,
90119
`unist-builder`,
91-
`unist-util-visit`,
92-
`unist-util-position`,
93120
`unist-util-generated`,
94-
`mdast-util-definitions`,
95-
`estree-util-build-jsx`,
96-
`mdast-util-toc`,
97-
`remark-stringify`,
98-
`remark-parse`,
121+
`unist-util-is`,
122+
`unist-util-position`,
123+
`unist-util-position-from-estree`,
124+
`unist-util-stringify-position`,
125+
`unist-util-visit`,
126+
`vfile`,
127+
`web-namespaces`,
99128
`zwitch`,
100-
`longest-streak`,
101-
`estree-walker`,
102-
`periscopic`,
103-
`hast-util-to-estree`,
104-
`estree-util-attach-comments`,
105-
`trim-lines`,
106-
`estree-util-to-js`,
107-
`is-reference`,
108-
`github-slugger`,
109129
].join(`|`)
110130

111131
/** @type {import('jest').Config} */
+8-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
11
{
2-
"presets": [["babel-preset-gatsby-package"]]
2+
"presets": [
3+
[
4+
"babel-preset-gatsby-package",
5+
{
6+
"keepDynamicImports": ["./src/source-nodes.js"]
7+
}
8+
]
9+
]
310
}

packages/gatsby-source-contentful/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"gatsby-core-utils": "^4.13.1",
2020
"gatsby-plugin-utils": "^4.13.1",
2121
"gatsby-source-filesystem": "^5.13.1",
22-
"is-online": "^9.0.1",
22+
"is-online": "^10.0.0",
2323
"json-stringify-safe": "^5.0.1",
2424
"lodash": "^4.17.21",
2525
"node-fetch": "^2.6.12",

packages/gatsby-source-contentful/src/source-nodes.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
// @ts-check
2-
import isOnline from "is-online"
32
import _ from "lodash"
43
import {
54
addNodeToExistingNodesCache,
@@ -36,6 +35,10 @@ const restrictedNodeFields = [
3635

3736
const CONTENT_DIGEST_COUNTER_SEPARATOR = `_COUNT_`
3837

38+
async function isOnline() {
39+
return (await import(`is-online`)).default()
40+
}
41+
3942
/***
4043
* Localization algorithm
4144
*

0 commit comments

Comments
 (0)