
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
@fulldigits-dev/faustwp-blocks
Advanced tools
@faustwp/blocks provides conventional connector components for rendering WordPress blocks.
Make sure you have completed the initial setup for Faust at Getting Started.
Install the blocks package:
npm i @faustwp/blocks
Install the peer dependencies:
npm i @wordpress/style-engine
Open _app.js and import the WordPressBlocksProvider:
import { WordPressBlocksProvider } from '@faustwp/blocks';
<FaustProvider pageProps={pageProps}>
<WordPressBlocksProvider
config={{
blocks,
}}>
<Component {...pageProps} key={router.asPath} />
</WordPressBlocksProvider>
</FaustProvider>
Then, inside your templates you need to pass on the editorBlocks data in your WordPressBlocksViewer.
The helper function flatListToHierarchical is imported from @faustwp/core:
import { flatListToHierarchical } from '@faustwp/core';
import { WordPressBlocksViewer } from '@faustwp/blocks';
import blocks from '../wp-blocks';
const { editorBlocks } = props.data.post;
const blocks = flatListToHierarchical(editorBlocks, {childrenKey: 'innerBlocks'});
return <WordPressBlocksViewer blocks={blocks}/>
By default the API brings all the nodes back in one array instead of a bunch of separate nodes with their own arrays. Therefore we use the flatListToHierarchical to convert the list back to the hierarchical tree type.
Example editorBlocks GraphQL query fragment:
${components.CoreParagraph.fragments.entry}
editorBlocks {
__typename
name
renderedHtml
id: clientId
parentClientId
...${components.CoreParagraph.fragments.key}
}
This is a simple block called CoreParagraph. The block is a p tag that sets its content to attributes.content which is passed in from the props.
CoreParagraph.fragments does a WPGraphQL query for the content and cssClassName and sets it as the fragment CoreParagraphFragment.
import { gql } from '@apollo/client';
import React from 'react';
export default function CoreParagraph(props) {
const attributes = props.attributes;
return (
<p
className={attributes?.cssClassName}
dangerouslySetInnerHTML={{ __html: attributes.content }}></p>
);
}
CoreParagraph.fragments = {
entry: gql`
fragment CoreParagraphFragment on CoreParagraph {
attributes {
content
cssClassName
}
}
`,
key: `CoreParagraphFragment`,
};
Use a default barrel export of the CoreParagraph Block in index.js:
import CoreParagraph from './CoreParagraph';
export default {
'CoreParagraph': CoreParagraph,
};
By doing so the framework will match the name of the export CoreParagraph with the __typename
or name fields in the query response. If it finds a match it will resolve the Component associated with that name.
More details on the WordPressBlocksProvider.
More details on the WordPressBlocksViewer.
Continue learning about the project structure, how to change styles, layout, etc. by referencing the Example Project Walkthrough Structure.
Please see https://faustjs.org/docs/gutenberg/getting-started for the Getting Started Guide for Gutenberg Blocks.
FAQs
Faust Blocks
We found that @fulldigits-dev/faustwp-blocks demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 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.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.