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

@scriba-editor/plugin-revisions

v0.1.1

Published

Version history for the Scriba editor: list the saved versions, compare one with the current document, restore it.

Readme

@scriba-editor/plugin-revisions

Cronologia delle versioni, come "Revision History" di TinyMCE: elenco delle versioni salvate, anteprima, confronto con il documento attuale (aggiunto in verde, tolto barrato in rosso) e ripristino con un solo passo annullabile.

pnpm add @scriba-editor/plugin-revisions

Uso

Le versioni le conserva il tuo server: il plugin chiede solo l'elenco e, quando l'utente ne sceglie una, il contenuto.

import { revisionsToolbarItem, type RevisionOptions } from '@scriba-editor/plugin-revisions'

const revisionOptions: RevisionOptions = {
  locale: 'it',
  revisions: () => fetch('/api/versioni').then((r) => r.json()), // più recente per prima
  content: (revision) => fetch(`/api/versioni/${revision.id}`).then((r) => r.text()), // HTML o JSON
}

// nel menu File o nella toolbar:
revisionsToolbarItem(t, revisionOptions)

Una Revision ha la forma { id, createdAt, author?, label? } (createdAt può essere Date, stringa ISO o timestamp).

Esportazioni

| Nome | Cosa fa | | --------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------ | | revisionsToolbarItem(t, options) | Pulsante "Cronologia versioni…"; disponibile anche in sola lettura (si può guardare e confrontare, "Ripristina" è disattivato) | | openRevisionDialog(view, t, options) | Apre il dialogo da codice e restituisce l'handle | | RevisionOptions | revisions(), content(revision), locale? (predefinito: quello del browser) | | Revision | Tipo di una versione | | parseRevision(schema, source) | Legge il contenuto di una versione attraverso lo schema; lancia errore se lo schema la rifiuta | | MAX_REVISION_LENGTH | 5 000 000 caratteri: un HTML più grande viene rifiutato, non tagliato | | formatRevisionDate(value, locale?) | Data breve (stringa vuota se non valida) | | diffDocs(old, new), diffSequence, slideEdits, MAX_COMPARISONS, DocDiff, Change, ChangeKind, Highlight | Il confronto tra documenti, riusabile da solo |

Come si usa il dialogo

Le versioni sono un gruppo di radio (frecce per muoversi); quella scelta si carica in un'anteprima di sola lettura. "Evidenzia le differenze con il documento attuale" mostra cosa è stato aggiunto o tolto dopo quella versione, con "Differenza precedente/successiva" per scorrerle. "Ripristina questa versione" sostituisce il documento con un solo passo di undo.

Accessibilità

Il dialogo ha focus trap e restituisce il focus all'editor. Caricamenti, errori e conteggio delle differenze sono in regioni role="status" / role="alert"; ogni differenza raggiunta con Precedente/Successiva è letta ("Differenza 2 di 5, aggiunto dopo: «...»", testo tagliato a 120 caratteri); dopo il ripristino un messaggio "Versione ripristinata" è annunciato.

Sicurezza

  • Il contenuto delle versioni arriva dal server ed è input non fidato: l'HTML è letto in un documento inerte e passa dal parser dello schema, il JSON è validato dallo schema (deve essere un documento intero); oltre MAX_REVISION_LENGTH viene rifiutato. Una versione illeggibile mostra un errore, non rompe l'editor.
  • Autore ed etichetta sono mostrati come testo, mai come HTML.
  • Una risposta lenta per una versione non più selezionata viene ignorata.
  • Chi salva versioni deve comunque sanificarle sul server con @scriba-editor/sanitize-server.

Vedi sicurezza, accessibilità e plugin. Si abbina bene a @scriba-editor/plugin-save.