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

@ridit/editor-services

v0.2.0

Published

Your editor, in minutes.

Downloads

726

Readme

@ridit/editor-services

Core services for @ridit/editor. Provides everything needed to build a Monaco-based editor — filesystem abstraction, tab management, theming, LSP integration, and a full workbench orchestrator.

Installation

npm install @ridit/editor-services

Preset API (recommended)

The fastest way to get started. Workbench presets wire all services together with sensible defaults.

import editor_worker from "monaco-editor/esm/vs/editor/editor.worker?worker";
import json_worker from "monaco-editor/esm/vs/language/json/json.worker?worker";
import css_worker from "monaco-editor/esm/vs/language/css/css.worker?worker";
import html_worker from "monaco-editor/esm/vs/language/html/html.worker?worker";
import ts_worker from "monaco-editor/esm/vs/language/typescript/ts.worker?worker";

import { Workbench } from "@ridit/editor-services/workbench";

// Electron
const workbench = await Workbench.createElectron({
  rootPath: "/path/to/project",
  lsp: { disableInBuiltTypescriptWorker: true },
  config: { fontSize: 16, fontFamily: "monospace" },
  editorConfig: { fontSize: 15 },
  theme: "Dark", // 'Dark' | 'Light'
  storeName: "my-app", // optional, for tab persistence,
  workerFactories: {
    editor: editor_worker,
    css: css_worker,
    html: html_worker,
    json: json_worker,
    typescript: ts_worker,
  },
});
await workbench.mount(document, window);

// Web (virtual filesystem)
const workbench = await Workbench.createWeb({
  rootPath: "/my-project",
  virtualFsName: "my-project-fs",
  config: { fontSize: 16 },
  theme: "Light",
});
await workbench.mount(document, window);

Manual Composition

For full control, compose services individually.

import editor_worker from "monaco-editor/esm/vs/editor/editor.worker?worker";
import json_worker from "monaco-editor/esm/vs/language/json/json.worker?worker";
import css_worker from "monaco-editor/esm/vs/language/css/css.worker?worker";
import html_worker from "monaco-editor/esm/vs/language/html/html.worker?worker";
import ts_worker from "monaco-editor/esm/vs/language/typescript/ts.worker?worker";

import {
  EventEmitter,
  FileSystemService,
  ExplorerService,
  EditorService,
  WorkbenchService,
  StorageService,
  ThemeService,
  LspService,
} from "@ridit/editor-services/browser";

const eventEmitter = new EventEmitter();

const storageService = new StorageService(window, "electron", "my-store");
await storageService.start();

const fileSystem = new FileSystemService(eventEmitter, window, {
  mode: "real",
});

const explorerService = new ExplorerService(eventEmitter, {
  services: { fileSystem },
  rootPath: "/path/to/project",
});

const themeService = new ThemeService(eventEmitter);

const editorService = new EditorService(eventEmitter, {
  services: { fileSystem, explorerService, themeService, storageService },
  theme: "Dark",
  editorConfig: { fontSize: 15 },
  workerFactories: {
    editor: editor_worker,
    css: css_worker,
    html: html_worker,
    json: json_worker,
    typescript: ts_worker,
  },
});

const workbench = new WorkbenchService(eventEmitter, {
  services: { editorService, explorerService, storageService, themeService },
  config: { fontSize: 16, fontFamily: "monospace" },
});

await workbench.mount(document, window);

Services

FileSystemService

Unified filesystem API that works over both the real filesystem (Electron IPC) and an in-memory virtual filesystem.

const fs = new FileSystemService(eventEmitter, window, {
  mode: "real", // 'real' | 'virtual'
  name: "my-vfs", // required when mode is 'virtual'
});

await fs.readFile("/src/index.ts");
await fs.writeFile("/src/index.ts", "content");
await fs.mkdir("/src/utils");
await fs.rm("/src/old.ts");
await fs.rename("/src/old.ts", "/src/new.ts");
await fs.exists("/src/index.ts");
await fs.readdir("/src");

EditorService

Manages Monaco editor instances and file opening.

// Open a file programmatically
await editorService.open("/src/index.ts");

// Register a custom editor
editorService.register(myCustomEditor);

ExplorerService

Renders the file tree and responds to file selection events.

const tree = await explorerService.render(document);
document.body.appendChild(tree.el);

ThemeService

Applies a theme as CSS variables on the document.

import { DarkTheme } from "@ridit/editor-services/browser";

themeService.setTheme(DarkTheme, document);

StorageService

Persistent key-value storage backed by the platform (Electron store or localStorage).

await storageService.set("my-key", { foo: "bar" }, "my-store");
const value = await storageService.get("my-key", "my-store");

WorkbenchService

Orchestrates the full editor UI — titlebar, activity bar, sidebar, editor area, tabs, and statusbar.

// Override a built-in component before mounting
workbench.overrideComponent("titlebar", (classes) => myTitlebar(classes));

await workbench.mount(document, window);

Events

Services communicate via EventEmitter. You can subscribe to any event:

eventEmitter.on('editor:openFile', (path: string) => { ... })
eventEmitter.on('tab:openTab', (path: string) => { ... })
eventEmitter.on('tab:removeTab', (id: string) => { ... })

Theming

Themes are plain objects mapped to CSS variables on :root. Pass a custom theme to WorkbenchService or ThemeService:

import type { ITheme } from "@ridit/editor-services/browser";

const myTheme: ITheme = {
  colors: {
    bg: "#1a1a2e",
    fg: "#e0e0e0",
    // ...
  },
  tokens: {
    keyword: "c792ea",
    // ...
  },
};

const workbench = new WorkbenchService(eventEmitter, {
  customTheme: myTheme,
  // ...
});

License

MIT