noderuntimepack

package
v0.7.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 5, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package noderuntimepack stores the embedded Node runtime as a few solid zstd blocks. The runtime's package copies repeat one another (an SDK bundle contains the modules it was built from), and a block compresses those repeats away, which a per-file archive cannot. Blocks decode independently, so extraction runs them in parallel.

Index

Constants

This section is empty.

Variables

View Source
var ErrTruncated = errors.New("noderuntimepack: truncated archive")

ErrTruncated reports an archive whose block lengths run past its end.

Functions

func Extract

func Extract(archive string, visit func(name string, data []byte) error) error

Extract decodes every block of archive and calls visit for each file. Blocks run in parallel, so visit must be safe for concurrent use; data is valid only during the call. The first error stops further blocks.

func Pack

func Pack(files []File) ([]byte, error)

Pack returns the blocks for files, in an order that keeps each package directory's files adjacent (a directory walk does). The output depends only on the names and contents.

func UnreadAtRuntime

func UnreadAtRuntime(relative string) bool

UnreadAtRuntime reports whether nothing reads a file of the runtime tree while the runtime runs, so the embedded archive and the extracted runtime omit it (the generator skips it, and the tests that compare the archive with the source tree skip it too). The files stay in the source tree: the vendoring scripts and the provenance tests check them there.

  • Source maps (*.map): Node reads one only under --enable-source-maps, which the host never passes; without the file the option is a no-op.
  • Declaration files (*.d.ts): they are type information for a TypeScript compiler. Extensions load through jiti, which strips types and checks none, and the host runs no tsc.
  • shims/vendor-manifest.json: the provenance record the vendoring tests compare with the source tree; no runtime code opens it.
  • shims/pi-dist/pi-coding-agent/docs/images/: the screenshots the package docs embed. The documentation Pi's system prompt advertises is its Markdown (docs/*.md, README.md and examples/), which stays; PiG's own documentation bundle (internal/pigdocs) carries no images either.
  • shims/pi-dist/pi-coding-agent/modes/interactive/assets/clankolas.png: the announcement image of Pi's Node InteractiveMode, which PiG never runs (its own copy is embedded by internal/codingagent); the loader reads it in a try/catch and shows the announcement without the picture when it is missing.
  • shims/undici/docs/: undici's API documentation (Markdown) that its npm package ships. undici's code never opens it, and no Pi documentation links to it.
  • any README.md outside shims/pi-dist (shims/<package>/README.md, and nested ones such as shims/undici/types/README.md): the package page npm shows, which no code opens. pi-dist's own READMEs stay: Pi's getReadmePath reads shims/pi-dist/pi-coding-agent/README.md, and the documentation Pi's system prompt advertises includes the others.

Types

type File

type File struct {
	Name string
	Data []byte
}

File is one runtime file; Name is a slash-separated path.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL