Skip to content

wasi: reorganize — internal/ machinery, no cycles, no deprecated baggage - #146

Merged
lannbot merged 1 commit into
mainfrom
wasi-reorg
Aug 15, 2026
Merged

lannbot merged 1 commit into
mainfrom
wasi-reorg

Conversation

@lannbot

@lannbot lannbot commented Aug 15, 2026

Copy link
Copy Markdown
Collaborator

Reorganizes the wasi package with no compatibility baggage. The public subpath surface (./cli, ./cli-stdio, ./clocks, ./filesystem{,-node,-web}, ./http, ./io, ./random, ./sockets) stays exactly as designed — the reorganization is everything behind it.

Structure

wasi/src/
  mod.ts                      .            batteries only: wasi() + its option/handle types
  io.ts                       ./io         the parking kernel + stream vocabulary (unchanged home)
  cli.ts / cli_stdio.ts       ./cli, ./cli-stdio
  clocks.ts / random.ts / http.ts
  filesystem{,_node,_web}.ts  ./filesystem{,-node,-web}
  sockets.ts                  ./sockets    fragment factory + docs + vocabulary re-exports
  internal/                   (never exported)
    cli_shared.ts             ExitError, terminal resources, track types
    fs_provider.ts            the filesystem backend seam + track classes
    sockets_shared.ts         WIT types, address codec, validation, error mapping
    sockets_03.ts             the @0.3 track classes
    sockets_02.ts             the @0.2 poll-shaped track
    sockets_platform.ts       the node-builtins backend seam
  • The sockets import cycle is gone: sockets.ts ↔ sockets_02.ts (the "cyclic on purpose, hoisting makes it safe" arrangement) is replaced by both tracks importing sockets_shared.ts; nothing imports a sibling.
  • cli-stdio no longer imports the capture impl: the shared vocabulary moved to internal/cli_shared.ts; ./cli remains its public home.

Baggage deleted

Verified first: every external consumer (polymorph family, wosh) pins the old @deltic/wasi-shims package at old commit SHAs — nothing consumes the current package's deprecated names.

  • wasiShims / WasiShims / WasiShimsOptions (mod.ts, release-bundle entry, header transition note)
  • cli-stdio's StdinStream / StdoutStream / STDIO_HIGH_WATER aliases (superseded by ./io's FedInputStream / SinkOutputStream / STREAM_HIGH_WATER)
  • mod.ts's wholesale re-export of every fragment's surface — the root now exports the batteries API only (wasi, WasiOptions, WasiImports, CliCaptured + option types, ExitError); everything else at its subpath.

Verification

No behavior change intended. wasi suite 179 green; full just gates pass — notably publish-check (the JSR surface over the new layout), test-bundle (trimmed entry), browsers + OPFS smoke, and the consumer smokes (smoke-tls consumes mod.ts directly).

The package's public subpath surface stays exactly as designed (one
subpath per impl); the reorganization is everything behind it.

STRUCTURE. Non-fragment machinery moves to src/internal/ (never
exported): fs_provider, sockets_platform, and the sockets tracks. The
sockets module becomes four cleanly-layered files — sockets_shared.ts
(WIT types, address codec, wasmtime-parity validation, platform error
mapping), sockets_03.ts and sockets_02.ts (the tracks), and the public
sockets.ts (fragment factory + docs + vocabulary re-exports). This
deletes the deliberate sockets.ts <-> sockets_02.ts import cycle: both
tracks now import the shared vocabulary, nothing imports a sibling.
Same cut for cli: internal/cli_shared.ts (ExitError, terminal
resources, track types) severs cli_stdio's import of the capture impl;
./cli remains the vocabulary's public home.

BAGGAGE DELETED (external consumers all pin the OLD @deltic/wasi-shims
package at old SHAs — verified — so nothing consumes these):
* wasiShims / WasiShims / WasiShimsOptions (mod.ts + the release
  bundle's re-exports + the header's rename-transition note),
* cli-stdio's StdinStream / StdoutStream / STDIO_HIGH_WATER aliases
  (superseded by io.ts's FedInputStream / SinkOutputStream /
  STREAM_HIGH_WATER when the classes moved in #141).

ROOT MODULE TRIMMED to the batteries surface: wasi(), the option
types, CliCaptured, and ExitError (thrown through throwOnExit, so
batteries embedders classify it). Everything else lives at its
subpath; the composition doc's fragment-dependency notes updated to
match (io.ts is the package-wide vocabulary; internal/ is the
machinery layer).

No behavior change intended; wasi suite 179 green, full gates pass
(publish-check covers the JSR surface of the new layout, the bundle
builds with the trimmed entry, browser + OPFS lanes green).
@lannbot
lannbot enabled auto-merge August 15, 2026 03:54
@lannbot
lannbot merged commit 5670575 into main Aug 15, 2026
4 checks passed
@lannbot
lannbot deleted the wasi-reorg branch August 23, 2026 16:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants