npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@econverse/faststore-blog-plugin

v0.1.12

Published

Rotas /blog e /blog/[slug] para lojas FastStore, com listagem e post individual alimentados pela REST API do WordPress (SEO via Yoast).

Readme

@econverse/faststore-blog-plugin

Plugin de rotas do FastStore que adiciona /blog (listagem) e /blog/[slug] (post) a uma storefront, buscando o conteúdo na REST API de um WordPress via wp-json/wp/v2 e usando o yoast_head_json para SEO.

Instalação

yarn add @econverse/faststore-blog-plugin

Configuração

1. discovery.config.js

module.exports = {
  // ...
  plugins: ['@econverse/faststore-blog-plugin'],
  experimental: {
    // ...
    transpilePackages: ['@econverse/faststore-blog-plugin'],
  },
}

transpilePackages é obrigatório: o pacote distribui TypeScript/TSX fonte (não compilado), e o Next.js por padrão não transpila código dentro de node_modules.

2. Variável de ambiente

WORDPRESS_API_URL=https://seublog.com/wp-json/wp/v2

Sem ela, qualquer chamada ao WordPress lança erro explícito em vez de silenciosamente falhar. Não é segredo — é só o endpoint público da REST API — então pode ir em vtex.env (WebOps) ou .env.local (dev).

3. Resolver GraphQL

O core do FastStore importa src/graphql/thirdParty/resolvers/index.ts por caminho fixo — esse arquivo não pode viver dentro do pacote. Ele fica no projeto consumidor e reexporta a lógica do pacote:

// src/graphql/thirdParty/resolvers/index.ts
import { getBlogPost, getBlogPosts } from '@econverse/faststore-blog-plugin/wordpress/service'
import type { BlogPost, BlogPostsResponse } from '@econverse/faststore-blog-plugin/wordpress/types'

const resolvers = {
  Query: {
    blogPosts: (_root: unknown, args: { page?: number | null; perPage?: number | null }): Promise<BlogPostsResponse> =>
      getBlogPosts(args),
    blogPost: (_root: unknown, { slug }: { slug: string }): Promise<BlogPost | null> =>
      getBlogPost(slug),
  },
}

export default resolvers

O typeDef GraphQL (BlogPost, BlogPostsResponse, Query.blogPosts/blogPost) também fica no projeto consumidor, em src/graphql/thirdParty/typeDefs/blog.graphql — é a definição do schema da loja, não faz parte do pacote.

O que o pacote resolve sozinho

  • Fetch com timeout e cache TTL de 5 min por listagem/post (src/wordpress/client.ts)
  • Normalização do post do WordPress pro formato exposto no GraphQL, incluindo SEO do Yoast (src/wordpress/mapPost.ts)
  • Sanitização por allowlist do HTML do post antes de qualquer dangerouslySetInnerHTML (src/utils/sanitizeBlogHtml.ts) — o WordPress é uma aplicação externa à storefront, então o conteúdo nunca chega cru ao cliente
  • Componentes de listagem (com paginação) e post individual, com SEO via next-seo (src/components/BlogList, src/components/BlogPost)
  • Camada única de acesso (src/wordpress/service.ts) compartilhada pelo resolver GraphQL e pelo SSR das páginas — evita dois caminhos de dados com comportamentos diferentes

Limitações conhecidas

  • Cache em memória do processo (Map), não distribuído — em ambientes com múltiplas instâncias cada uma tem seu próprio cache de 5 min.
  • Sanitização de HTML é por allowlist fixa de tags/atributos (ver src/utils/sanitizeBlogHtml.ts) — conteúdo do WordPress usando tags fora da lista é desembrulhado (a tag some, o texto fica).
  • Espera que o WordPress tenha o plugin Yoast SEO instalado para os campos de SEO; sem ele, seo vem null e o componente cai nos fallbacks (title/excerpt do próprio post).