
Research
/Security News
Weaponizing Discord for Command and Control Across npm, PyPI, and RubyGems.org
Socket researchers uncover how threat actors weaponize Discord across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.
gatsby-page-utils
Advanced tools
npm install gatsby-page-utils
const {
createPath,
ignorePath,
validatePath,
watchDirectory,
} = require(`gatsby-page-utils`)
// ...
const pagesDirectory = "/pages"
watchDirectory(
pagesDirectory,
"**/*.{js, jsx}",
addedPath => {
// Filter out special components that shouldn't be made into
// pages.
if (!validatePath(addedPath)) {
return
}
// Filter out anything matching the given ignore patterns and options
if (ignorePath(addedPath, "*/connexion")) {
return
}
// Create page object
const createdPath = createPath(addedPath)
const page = {
path: createdPath,
component: systemPath.join(pagesDirectory, addedPath),
}
// Add page
createPage(page)
},
removedPath => {
// Delete the page for the now deleted component.
const componentPath = systemPath.join(pagesDirectory, removedPath)
store.getState().pages.forEach(page => {
if (page.component === componentPath) {
deletePage({
path: createPath(removedPath),
component: componentPath,
})
}
})
}
)
Watch activity on a directory and call functions each time a file is added or removed
property | description | type |
---|---|---|
path | Directory path in which pages are stored | String |
glob | A glob that select files to watch | String |
onNewFile | A function called each time a new file is added | Function |
onRemovedFile | A function called each time a file is removed | Function |
Create a page path from a file path. It returns the page path.
property | description | type |
---|---|---|
path | File path | String |
Validate a file path. It verifies that the path doesn't contain specific characters or strings. It returns true
if the path is valid otherwise it returns false
.
property | description | type |
---|---|---|
path | File path | String |
Determines if path should be ignored regarding of a ignore pattern passed as parameter. It returns true
if the passed path should be ignored otherwise it returns false
.
property | description | type |
---|---|---|
path | File path | String |
ignore | A pattern to match with file path | (Object | String | Array) |
FAQs
Gatsby library that helps creating pages
The npm package gatsby-page-utils receives a total of 297,439 weekly downloads. As such, gatsby-page-utils popularity was classified as popular.
We found that gatsby-page-utils demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 5 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
/Security News
Socket researchers uncover how threat actors weaponize Discord across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.
Security News
Socket now integrates with Bun 1.3’s Security Scanner API to block risky packages at install time and enforce your organization’s policies in local dev and CI.
Research
The Socket Threat Research Team is tracking weekly intrusions into the npm registry that follow a repeatable adversarial playbook used by North Korean state-sponsored actors.