Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
150 changes: 85 additions & 65 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,90 +22,110 @@ const useJestUnit = !!process.env.GENERATE_JEST_REPORT

// list to add ESM to ignore
const esModules = [
`rehype`,
`unified`,
`bail`,
`is-plain-obj`,
`@mdx-js/mdx`,
`trough`,
`vfile`,
`unist-util-stringify-position`,
`@sindresorhus/is`,
`@szmarczak/http-timer`,
`aggregate-error`,
`bail`,
`cacheable-lookup`,
`cacheable-request`,
`ccount`,
`character-entities`,
`character-entities-html4`,
`character-entities-legacy`,
`character-reference-invalid`,
`clean-stack`,
`comma-separated-tokens`,
`decode-named-character-reference`,
`escape-string-regexp`,
`estree-util-attach-comments`,
`estree-util-build-jsx`,
`estree-util-is-identifier-name`,
`estree-util-to-js`,
`estree-util-visit`,
`estree-walker`,
`form-data-encoder`,
`github-slugger`,
`got`,
`hast-util-from-parse5`,
`hastscript`,
`property-information`,
`hast-util-is-element`,
`hast-util-parse-selector`,
`space-separated-tokens`,
`comma-separated-tokens`,
`web-namespaces`,
`hast-util-to-estree`,
`hast-util-to-html`,
`html-void-elements`,
`hast-util-is-element`,
`unist-util-is`,
`hast-util-whitespace`,
`stringify-entities`,
`character-entities-legacy`,
`character-entities-html4`,
`ccount`,
`remark-mdx`,
`micromark-extension-mdxjs`,
`micromark-util-combine-extensions`,
`micromark-util-chunked`,
`hastscript`,
`html-void-elements`,
`indent-string`,
`is-alphabetical`,
`is-alphanumerical`,
`is-decimal`,
`is-hexadecimal`,
`is-online`,
`is-plain-obj`,
`is-reference`,
`longest-streak`,
`lowercase-keys`,
`mdast-util-definitions`,
`mdast-util-from-markdown`,
`mdast-util-mdx`,
`mdast-util-to-hast`,
`mdast-util-to-markdown`,
`mdast-util-to-string`,
`mdast-util-toc`,
`micromark`,
`micromark-core-commonmark`,
`micromark-extension-mdx-expression`,
`micromark-factory-mdx-expression`,
`micromark-util-character`,
`micromark-factory-space`,
`unist-util-position-from-estree`,
`micromark-util-events-to-acorn`,
`estree-util-visit`,
`micromark-extension-mdx-jsx`,
`estree-util-is-identifier-name`,
`micromark-extension-mdx-md`,
`micromark-core-commonmark`,
`micromark-util-classify-character`,
`micromark-util-resolve-all`,
`decode-named-character-reference`,
`character-entities`,
`micromark-util-subtokenize`,
`micromark-extension-mdxjs`,
`micromark-factory-destination`,
`micromark-util-character`,
`micromark-factory-label`,
`micromark-factory-mdx-expression`,
`micromark-factory-space`,
`micromark-factory-title`,
`micromark-factory-whitespace`,
`micromark-util-normalize-identifier`,
`micromark-util-character`,
`micromark-util-character`,
`micromark-util-chunked`,
`micromark-util-classify-character`,
`micromark-util-combine-extensions`,
`micromark-util-events-to-acorn`,
`micromark-util-html-tag-name`,
`mdast-util-mdx`,
`micromark-util-normalize-identifier`,
`micromark-util-resolve-all`,
`micromark-util-subtokenize`,
`mimic-response`,
`normalize-url`,
`p-any`,
`p-cancelable`,
`p-some`,
`p-timeout`,
`parse-entities`,
`character-reference-invalid`,
`is-decimal`,
`is-hexadecimal`,
`is-alphanumerical`,
`is-alphabetical`,
`mdast-util-to-markdown`,
`periscopic`,
`property-information`,
`public-ip`,
`rehype`,
`remark-mdx`,
`remark-parse`,
`remark-parse`,
`mdast-util-from-markdown`,
`mdast-util-to-string`,
`micromark`,
`remark-rehype`,
`mdast-util-to-hast`,
`remark-stringify`,
`responselike`,
`space-separated-tokens`,
`stringify-entities`,
`trim-lines`,
`trough`,
`unified`,
`unist-builder`,
`unist-util-visit`,
`unist-util-position`,
`unist-util-generated`,
`mdast-util-definitions`,
`estree-util-build-jsx`,
`mdast-util-toc`,
`remark-stringify`,
`remark-parse`,
`unist-util-is`,
`unist-util-position`,
`unist-util-position-from-estree`,
`unist-util-stringify-position`,
`unist-util-visit`,
`vfile`,
`web-namespaces`,
`zwitch`,
`longest-streak`,
`estree-walker`,
`periscopic`,
`hast-util-to-estree`,
`estree-util-attach-comments`,
`trim-lines`,
`estree-util-to-js`,
`is-reference`,
`github-slugger`,
].join(`|`)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this list was getting messy, so I did sort it lexigraphically


/** @type {import('jest').Config} */
Expand Down
9 changes: 8 additions & 1 deletion packages/gatsby-source-contentful/.babelrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
{
"presets": [["babel-preset-gatsby-package"]]
"presets": [
[
"babel-preset-gatsby-package",
{
"keepDynamicImports": ["./src/source-nodes.js"]
}
]
]
}
2 changes: 1 addition & 1 deletion packages/gatsby-source-contentful/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"gatsby-core-utils": "^4.14.0-next.2",
"gatsby-plugin-utils": "^4.14.0-next.2",
"gatsby-source-filesystem": "^5.14.0-next.2",
"is-online": "^9.0.1",
"is-online": "^10.0.0",
"json-stringify-safe": "^5.0.1",
"lodash": "^4.17.21",
"node-fetch": "^2.6.12",
Expand Down
5 changes: 4 additions & 1 deletion packages/gatsby-source-contentful/src/source-nodes.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// @ts-check
import isOnline from "is-online"
import _ from "lodash"
import {
addNodeToExistingNodesCache,
Expand Down Expand Up @@ -36,6 +35,10 @@ const restrictedNodeFields = [

const CONTENT_DIGEST_COUNTER_SEPARATOR = `_COUNT_`

async function isOnline() {
return (await import(`is-online`)).default()
}

Comment on lines +38 to +41
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed version is ESM-only, hence await import trick

/***
* Localization algorithm
*
Expand Down
Loading