Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
gatsby-islands
Advanced tools
npm i gatsby-islands
AstroJS lacks the source-plugin ecosystem of Gatsby - and its built-in React renderer doesn't account for many niceties we're used to with Gatsby - like SPA navigation, Context, responding to props, etc. But Gatsby projects can quickly get gigantic in bundle size - and that doesn't improve much even when using Loadable Components. Gatsby-Islands doesn't try to completely adhere to a strict Islands architecture - instead it assumes you'll likely want full-app context and state, while minimising the size and interactivity of your individual pages. It's lightweight and lets you work with Gatsby the way you're used to.
Gatsby-Islands lets you load components as Islands or Oceans - independent of the rest of your Gatsby app. This means you can have interactive headers, footers, and transitions - but mostly dumb pages - perfect for most website projects.
Any component loaded only through an Island or Ocean will be excluded from your main Gatsby bundles. Islands will hydrate when the page is loaded, or on some other command (by using the deferUntil prop). Oceans will not hydrate and will only show server-rendered content (thus excluding the component completely from your user runtime*** (see pitfalls)).
As opposed to AstroJS's implementation of Islands in React, it does not create individual bundles - instead only using component-based chunking - so that the existing Gatsby Webpack implementation (which you may have customised with extra plugins etc) remains in tact.
Function/Component | API | Description |
---|---|---|
IslandsProvider | This enables Islands to work inside your app. This should be place in your layout (it needs to observe route changes to function correctly) and is responsible for creating persistent IDs for your components | |
Island | name: Path to Component; deferUntil: Idle/Visible; clientOnly: boolean; context: React Context instance, ...props: any | A component that will separate the component specified by name prop into a separate chunk, and load when the page is visited (or deferred via deferUntil prop). You can provide props to your component by adding them to Island, and provide Context to your component by passing it in via the context prop. Your island will respond to context and prop updates, and will also render them initially in SSR. |
Ocean | name: Path to Component, context: Context instance, ...props: any | A component that will not server-render only. Subsequent page changes will load your component as an island. You may provide an initial props and context for SSR, but your component will not respond to updates. |
useIslandContext | context: Context Instance | If you need to consume a React Context within your Island or Ocean, use this hook instead of React's useContext. This hook allows useContext to SSR correctly. |
FAQs
An islands-style architecture for GatsbyJS.
The npm package gatsby-islands receives a total of 0 weekly downloads. As such, gatsby-islands popularity was classified as not popular.
We found that gatsby-islands demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.