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

skir-codemirror-plugin

v1.0.2

Published

This library provides a CodeMirror-based JSON editor for Skir values. It helps users edit Skir request/response payloads in a human-readable JSON form while preserving schema-aware guidance and validation.

Readme

skir-codemirror-plugin

This library provides a CodeMirror-based JSON editor for Skir values. It helps users edit Skir request/response payloads in a human-readable JSON form while preserving schema-aware guidance and validation.

Demo: npx skir-studio-demo

What It Provides

  • A ready-to-use createEditorState(...) factory for CodeMirror.
  • Schema-driven JSON template generation (when no JSON value is provided).
  • JSON validation and lint diagnostics.
  • In-editor hints and completions informed by the Skir type schema.
  • Read-only mode support for response viewing.
  • Built-in theme support:
    • tokyo-night
    • tokyo-night-day
    • custom theme object

Install

npm install skir-codemirror-plugin

Public API

The package root exports:

  • createEditorState
  • ensureJsonState
  • toJson
  • CreateEditorStateParams (type)
  • CustomTheme (type)
  • JsonState (type)
  • all types from ./json/types

Usage

import { EditorView } from "@codemirror/view";
import {
	createEditorState,
	type CreateEditorStateParams,
} from "skir-codemirror-plugin";

const params: CreateEditorStateParams = {
	schema: {
		type: { kind: "primitive", value: "string" },
		records: [],
	},
	// Optional:
	// readOnly: true,
	// json: "hello",
	// theme: "tokyo-night-day",
};

const state = createEditorState(params);

new EditorView({
	state,
	parent: document.getElementById("editor")!,
});

Read Current JSON Value

Use ensureJsonState(view, schema) to force parse/validation against the current document and retrieve the latest state. Then call toJson(...) on parseResult.value when it exists.

import { EditorView } from "@codemirror/view";
import {
	createEditorState,
	ensureJsonState,
	toJson,
	type TypeDefinition,
} from "skir-codemirror-plugin";

const schema: TypeDefinition = {
	type: { kind: "primitive", value: "string" },
	records: [],
};

const view = new EditorView({
	state: createEditorState({ schema }),
	parent: document.getElementById("editor")!,
});

const jsonState = ensureJsonState(view, schema);

if (jsonState.parseResult.value) {
	const jsonValue = toJson(jsonState.parseResult.value);
	console.log("Current JSON value:", jsonValue);
} else {
	console.log("Cannot convert to JSON:", jsonState.parseResult.errors);
}

createEditorState Parameters

{
	schema: TypeDefinition,
	readOnly?: true,
	json?: Json,
	theme?: "tokyo-night" | "tokyo-night-day" | CustomTheme,
}

Behavior:

  • schema is required and drives validation/completion.
  • If json is omitted, a JSON template is generated from the schema.
  • readOnly: true enables non-editable mode.
  • theme defaults to tokyo-night.

Local Dev Flow

This repository includes a minimal local dev page for previewing the editor state produced by createEditorState.

Run It

npm run dev

This does three things:

  1. Builds TypeScript sources into dist/.
  2. Builds the dev entry point from dev/main.ts into dev-dist/main.js.
  3. Starts web-dev-server and opens /dev/index.html.

Dev URL:

http://localhost:8080/dev/index.html

Dev Files

  • dev/index.html: minimal host page containing only #editor and module import.
  • dev/main.ts: creates EditorView with createEditorState(...).
  • dev-dist/main.js: generated browser output from dev/main.ts.

To try your own schema/JSON inputs, edit dev/main.ts and change the params object.

Auto Rebuild and Reload

npm run dev watches both:

  • src/**/*.ts -> rebuilds the library into dist/
  • dev/**/*.ts -> rebuilds the dev entry into dev-dist/

web-dev-server --watch reloads the page when served files change.

Dev-Only Note

This flow is for local development only.

  • Dev sources are in dev/.
  • Dev compiled output is in dev-dist/.
  • Package distribution uses dist/ as the runtime entrypoint.