Gathering detailed insights and metrics for gatsby-core-utils
Gathering detailed insights and metrics for gatsby-core-utils
Gathering detailed insights and metrics for gatsby-core-utils
Gathering detailed insights and metrics for gatsby-core-utils
The best React-based framework with performance, scalability and security built in.
npm install gatsby-core-utils
Typescript
Module System
Min. Node Version
Node Version
NPM Version
58.6
Supply Chain
98
Quality
87.8
Maintenance
100
Vulnerability
98.9
License
v5.14.0
Published on 06 Nov 2024
gatsby-source-shopify@8.13.2
Published on 28 Oct 2024
gatsby-source-wordpress@7.13.5 and 6 more...
Published on 28 Oct 2024
v5.13.7
Published on 28 Oct 2024
v5.13.6
Published on 28 Oct 2024
v5.13.5
Published on 28 Oct 2024
JavaScript (59.01%)
TypeScript (38.61%)
CSS (1.05%)
HTML (0.69%)
MDX (0.45%)
Shell (0.12%)
Dockerfile (0.03%)
PHP (0.02%)
EJS (0.01%)
Total Downloads
162,408,592
Last Day
45,192
Last Week
410,671
Last Month
2,086,666
Last Year
27,727,686
55,308 Stars
21,714 Commits
10,307 Forks
727 Watching
468 Branches
3,988 Contributors
Latest Version
4.14.0
Package Id
gatsby-core-utils@4.14.0
Unpacked Size
170.42 kB
Size
45.79 kB
File Count
97
NPM Version
lerna/3.22.1/node@v20.11.1+arm64 (darwin)
Node Version
20.11.1
Publised On
06 Nov 2024
Cumulative downloads
Total Downloads
Last day
-49%
45,192
Compared to previous day
Last week
-15.7%
410,671
Compared to previous week
Last month
1%
2,086,666
Compared to previous month
Last year
-13.7%
27,727,686
Compared to previous year
gatsby-core-utils
Utilities used in multiple Gatsby packages.
1npm install gatsby-core-utils
Encrypts an input using md5 hash of hexadecimal digest.
1const { createContentDigest } = require("gatsby-core-utils") 2 3const options = { 4 key: "value", 5 foo: "bar", 6} 7 8const digest = createContentDigest(options) 9// ...
Calculate the number of CPU cores on the current machine
This function can be controlled by an env variable GATSBY_CPU_COUNT
setting the first argument to true.
value | description |
---|---|
Counts amount of real cores by running a shell command | |
logical_cores | require("os").cpus() to count all virtual cores |
any number | Sets cpu count to that specific number |
1const { cpuCoreCount } = require("gatsby-core-utils") 2 3const coreCount = cpuCoreCount(false) 4// ...
1const { cpuCoreCount } = require("gatsby-core-utils") 2process.env.GATSBY_CPU_COUNT = "logical_cores" 3 4const coreCount = cpuCoreCount() 5// ...
A utility that joins paths with a /
on windows and unix-type platforms. This can also be used for URL concatenation.
1const { joinPath } = require("gatsby-core-utils") 2 3const BASEPATH = "/mybase/" 4const pathname = "./gatsby/is/awesome" 5const url = joinPath(BASEPATH, pathname) 6// ...
A utility that enhances isCI
from 'ci-info` with support for Vercel and Heroku detection
1const { isCI } = require("gatsby-core-utils") 2 3if (isCI()) { 4 // execute CI-specific code 5} 6// ...
A utility that returns the name of the current CI environment if available, null
otherwise
1const { getCIName } = require("gatsby-core-utils") 2 3const CI_NAME = getCIName() 4console.log({ CI_NAME }) 5// {CI_NAME: null}, or 6// {CI_NAME: "Vercel"} 7// ...
A cross-version polyfill for Node's Module.createRequire
.
1const { createRequireFromPath } = require("gatsby-core-utils") 2 3const requireUtil = createRequireFromPath("../src/utils/") 4 5// Require `../src/utils/some-tool` 6requireUtil("./some-tool") 7// ...
When working inside workers or async operations you want some kind of concurrency control that a specific work load can only concurrent one at a time. This is what a Mutex does.
By implementing the following code, the code is only executed one at a time and the other threads/async workloads are awaited until the current one is done. This is handy when writing to the same file to disk.
1const { createMutex } = require("gatsby-core-utils/mutex") 2 3const mutex = createMutex("my-custom-mutex-key") 4await mutex.acquire() 5 6await fs.writeFile("pathToFile", "my custom content") 7 8await mutex.release()
Parts of hash-wasm
are re-exported from gatsby-core-utils
or used in custom functions. When working on hashing where you'd normally use crypto
from Node.js, you can use these functions instead. They especially show their advantage on large inputs so don't feel obliged to always use them. Refer to hash-wasm
's documentation for more details on usage for the re-exported functions.
1const { md5File, md5, createMD5, sha256, sha1 } = require("gatsby-core-utils") 2 3// For md5, createMD5, sha256, sha1 refer to hash-wasm 4await md5(`some-string`) 5 6// md5File gives you the MD5 hex hash for a given filepath 7await md5File(`package.json`)
No vulnerabilities found.
Reason
GitHub workflow tokens follow principle of least privilege
Details
Reason
30 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 10
Reason
security policy file detected
Details
Reason
no dangerous workflow patterns detected
Reason
license file detected
Details
Reason
no binaries found in the repo
Reason
Found 11/13 approved changesets -- score normalized to 8
Reason
SAST tool is not run on all commits -- score normalized to 8
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
84 existing vulnerabilities detected
Details
Score
Last Scanned on 2024-12-23
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More