Open-Source Wikis

/

Deno

/

Packages

denoland/deno

Packages

The libs/ directory contains 24 reusable Rust crates that are also published to crates.io and used outside the Deno binary itself. The CLI in cli/ and the runtime in runtime/ consume them; so do downstream projects like Deno Deploy, the eszip CLI, and third-party tools that need a piece of Deno's machinery without the full runtime.

This page is the index. The most important crates have a few sentences each; the smaller ones are listed in a table.

The big four

libs/coredeno_core

The base layer. Wraps V8 + Tokio and provides:

  • JsRuntime — the V8 isolate handle plus event loop integration
  • ModuleLoader trait — what cli/module_loader.rs implements
  • extension! macro — declares ops + JS for an extension
  • op2 macro — annotates Rust functions to be callable from JS
  • Resource / OpState — typed key-value store passed to every op
  • serde_v8 integration — automatic conversion between Rust types and V8 values
  • Snapshots — RuntimeOptions::startup_snapshot
  • Source maps — applied to JS errors

Everything in this repo (and most of the Deno ecosystem) depends on deno_core. Sub-directories: libs/core/src/, libs/core/examples/snapshot/ for a minimal embed example, libs/core_testing/ for test helpers.

libs/resolverdeno_resolver

The shared module-resolution algorithm used by the CLI, the LSP, and downstream consumers. Handles:

  • import "X" resolution across all schemes (file:, http(s):, npm:, jsr:, node:, data:)
  • Workspace and import-map application
  • BYONM mode

Both cli/module_loader.rs and cli/lsp/resolver.rs are thin wrappers over deno_resolver. The CLI wrapper adds runtime concerns (transpilation, source maps); the LSP wrapper adds editor-latency caching.

libs/node_resolvernode_resolver

Implements Node.js's CJS/ESM resolution algorithm — package.json exports/imports, conditional exports (browser, node, import, require), node_modules walking, .cjs/.mjs extension semantics, the works. Used by:

  • The CLI's npm resolution (cli/npm.rs, libs/npm)
  • ext/node (so require() inside node:* modules and npm packages works)
  • The LSP

libs/npm + friends — the npm client

Three sibling crates:

  • libs/npm — the npm registry client and package version solver. The dependency-graph implementation in libs/npm/resolution/graph.rs is 9,478 lines — npm's version-resolution semantics aren't simple.
  • libs/npm_cache — on-disk caching of registry responses and package tarballs.
  • libs/npm_installer — actual installation: tarball extraction, optional dep resolution, scripts handling (postinstall, etc., gated behind --allow-scripts or deno install --allow-scripts=...).
  • libs/npmrc — parser for .npmrc configuration (registry URLs, scope-specific registries, auth tokens).

For a deeper look at how npm fits into Deno, see Features → npm support.

Other notable crates

libs/eszip

Module-graph archive format used by deno compile and by Deno Deploy for fast cold starts. libs/eszip/v2.rs (4,018 lines) is the current format; older versions are kept for backward compat. An eszip is a single binary blob containing every module in a graph (already transpiled), suitable for embedding into the deno binary.

libs/lockfile

Parser/writer for deno.lock. Tracks resolved npm/jsr/HTTPS dependencies with their integrity hashes. Versioned format; the crate handles backwards-compat upgrades.

libs/config

Parser for deno.json / deno.jsonc, including workspace support. libs/config/workspace/mod.rs (6,815 lines) is the workspace resolution logic — walking up to find the root, merging imports/compilerOptions/tasks, applying overrides.

libs/serde_v8

The serde <-> V8 bridge. Lets ops declare arguments as #[serde] foo: SomeStruct and have V8 ↔ Rust conversion happen automatically. Used everywhere ops cross the JS/Rust boundary.

libs/cache_dir

Resolves the per-platform cache directory (DENO_DIR) and the layout of subdirectories within it (deps/, npm/, gen/, check/, bench/, …).

libs/inspector_server

The Chrome DevTools Protocol server that backs --inspect/--inspect-brk. Handles the WebSocket framing and CDP message routing.

libs/typescript_go_client

IPC client for the new TypeScript-Go (tsgo) compiler. Used by cli/type_checker.rs when tsgo is selected. See Type checking.

libs/ops

The proc-macro crate that implements #[op2]. Edit this if you need to extend op signatures (new argument annotations, new return-type conversions, etc.). Sibling: libs/ops/compile_test_runner — tests for the macro's compile-error messages.

libs/dotenv

.env file parser. Used by the CLI's --env-file flag and by Deno.env defaults.

libs/package_json

package.json parser, used by both libs/node_resolver and cli/factory.rs for npm package metadata.

libs/node_shim

The wrapper that lets deno --node script.js accept Node-style CLI args. lib.rs is 5,006 lines because Node has accumulated many flags over the years and Deno tries to honor most of them.

libs/npm_cache and libs/npmrc

See above under "the npm client".

libs/maybe_sync

A small utility crate for "optionally sync" structures — types that are Send + Sync when a feature flag is set, and not otherwise. Lets crates be used in both single-threaded (typical Deno CLI) and multi-threaded (Deno Deploy) contexts without code duplication.

libs/dcore

A minimal binary that builds on deno_core. Used as a smoke test that deno_core is usable as a standalone embedding target.

libs/crypto

Cryptography provider crate, used by ext/crypto. Splits crypto out so the algorithms can be swapped in different builds.

libs/napi_sys

NAPI FFI bindings used by the NAPI test suite (tests/napi/).

Full enumeration

Crate Description
libs/cache_dir DENO_DIR path resolution and layout
libs/config deno.json(c) parser, workspace resolution
libs/core deno_core — V8 + Tokio runtime
libs/core_testing Test helpers for deno_core
libs/crypto Cryptography provider
libs/dcore Minimal deno_core embedder binary
libs/dotenv .env parser
libs/eszip Module-graph archive format
libs/inspector_server Chrome DevTools Protocol server
libs/lockfile deno.lock parser/writer
libs/maybe_sync "Optionally sync" structures
libs/napi_sys NAPI FFI bindings
libs/node_resolver Node.js module resolution algorithm
libs/node_shim deno --node CLI translator
libs/npm npm registry client + dep solver
libs/npm_cache npm tarball/registry response cache
libs/npm_installer npm package installation
libs/npmrc .npmrc parser
libs/ops #[op2] proc-macro implementation
libs/package_json package.json parser
libs/resolver Unified module resolver
libs/serde_v8 Rust ↔ V8 serialization
libs/typescript_go_client tsgo IPC client

For per-feature deep dives, see the Features section. For the systems perspective on how these crates interact, see Architecture.

Built by Factory AutoWiki from public repository content. It is a generated preview for codebase exploration, not source-maintained documentation.

Packages – Deno wiki | Factory