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

lite-monaco

v0.3.0

Published

Lightweight Monaco-style code editor — self-written CM7 core + Shiki. Zero @codemirror runtime dependency.

Readme

lite-monaco

轻量 Monaco 向代码编辑器 —— 观感接近 VS Code / Monaco,体积与依赖更小。

| | | |---|---| | npm | lite-monaco 0.3.0 | | 内核 | 自研 CM7(from-scratch,零 @codemirror 运行时依赖) | | 高亮 | Shiki(peer,懒加载 / 可 SSR) | | 智能 | TS/JS LanguageService(typescript 可选 peer) |

状态:0.3 嵌入场景可替代 Monaco(见 ENDPOINT.md)。 不是 drop-in,也不是 VS Code 平台。
仓库目录仍叫 litcode;安装名是 lite-monaco。

安装

npm i lite-monaco shiki
# TS/JS 补全 · hover · 诊断 · 跳转:
npm i typescript

| 产物 | 约 | |---|---| | npm tarball | ~0.5 MB(不内嵌 typescript / shiki) | | dist/index.js | ~700 KB 未 gzip |

API 稳定面

| 符号 | 稳定性 | 说明 | |---|---|---| | litcodeCM7 / litcodeThemeCSS | stable | 产品主入口 | | DiffEditor / diffEditorCSS | stable | 并排 Diff | | core 命名空间(EditorView/State 等) | stable | 内核;少数字段仍可能扩展 | | lite-monaco/monaco-shim | experimental | 迁移薄层,API 子集 | | TS 高级(getTSService 等) | stable-ish | 依赖 optional peer |

快速接入

import { createHighlighter } from 'shiki'
import { litcodeCM7, core } from 'lite-monaco'

const hl = await createHighlighter({ themes: ['dark-plus'], langs: ['typescript'] })
const cfg = litcodeCM7(hl, {
  lang: 'typescript',
  theme: 'dark-plus',
  // features: { minimap: false, lineWrapping: true },
  // tsFiles: { '/utils.ts': 'export const x = 1' },
})

document.head.appendChild(Object.assign(document.createElement('style'), {
  textContent: cfg.themeCSS,
}))

const view = new core.EditorView({
  state: core.EditorState.create({
    doc: 'const hello = "world"\n',
    extensions: cfg.extensions,
  }),
  parent: document.getElementById('editor')!,
  decorationProviders: cfg.decorationProviders,
  keymap: cfg.keymap,
  drawSelection: cfg.drawSelection,
  lineNumbers: cfg.lineNumbers,
  lineWrapping: cfg.lineWrapping,
})
for (const attach of cfg.overlays) attach(view)

LitCodeFeatures(默认全开,传 false 关)

lineNumbers · foldGutter · activeLine · multiCursor · bracketMatch · closeBrackets · indentOnInput · bracketColors · overviewRuler · minimap · selectionMatch · indentGuide · search · autocomplete · hover · history · tabIndent · hScrollbar · vScrollbar · contextMenu · signatureHelp · tsDiagnostics · lineWrapping(默认关)· stickyScroll · codeActions · a11y

DiffEditor

import { DiffEditor, diffEditorCSS } from 'lite-monaco'

document.head.appendChild(Object.assign(document.createElement('style'), {
  textContent: diffEditorCSS(true),
}))

const diff = new DiffEditor({
  parent,
  original: oldText,
  modified: newText,
  dark: true,
  enableSplitViewResizing: true,
  renderMarginRevertIcon: true,
  renderOverviewRuler: true,
  renderIndicators: true,       // gutter ±(行号右侧)
  originalEditable: false,
  ignoreTrimWhitespace: true,
  find: true,                   // ⌘F
  onModifiedChange: (text) => { /* 保存 */ },
})

本地:npm run dev → http://localhost:5199 (主路径零 Monaco)· /diff.html 左右对照。

从 Monaco 迁移

见 MIGRATION.md。可选:

import { create, createDiffEditor } from 'lite-monaco/monaco-shim'

React 示例:examples/react-basic.tsx。

已有 / 未做

| 有 | 说明 | |---|---| | 编辑核心 | rope/state/view/输入/命令/虚拟视口 | | Monaco 向 UI | 行号、折叠、minimap、滚动条、find、命令面板 | | 语言 | Shiki;TS/JS 补全/hover/诊断/peek/fix | | Diff | side-by-side + 查找 + revert + 稳定 fill | | a11y | role/textbox、live region |

| 不做 | 说明 | |---|---| | Monaco API 全集 | shim 仅迁移子集 | | contribution / worker 平台 | 永久不做 | | multi-tab model 服务 | 宿主自管 | | inline / moved-block Diff | 未做 |

开发

npm run dev    # :5199
npm test
npm run build

| 文档 | | |---|---| | ROADMAP.md | 迭代 TODO | | MIGRATION.md | Monaco 迁移 | | PERF.md | 大文档预算 | | CAPABILITIES.md | 能力表 | | src/ARCHITECTURE.md | 源码分层 | | CHANGELOG.md | 版本 |

License

MIT