Go to file
Mihaela Mihaljevic 36065fe572 fix: align browser WASI shim handling
Use the known-good browser_wasi_shim stdout helper and let the smoke executable finish normally so the Pages browser test can observe the JSON result.
2026-06-06 22:11:50 +02:00
.github/workflows feat: publish WASM streaming smoke site 2026-06-06 22:06:38 +02:00
docs feat: scaffold PureYAML streaming incubator 2026-06-06 21:23:21 +02:00
scripts feat: publish WASM streaming smoke site 2026-06-06 22:06:38 +02:00
Sources fix: align browser WASI shim handling 2026-06-06 22:11:50 +02:00
Tests/PureYAMLStreamingTests feat: publish WASM streaming smoke site 2026-06-06 22:06:38 +02:00
WasmSite fix: align browser WASI shim handling 2026-06-06 22:11:50 +02:00
.gitignore feat: publish WASM streaming smoke site 2026-06-06 22:06:38 +02:00
LICENSE feat: scaffold PureYAML streaming incubator 2026-06-06 21:23:21 +02:00
Package.resolved feat: scaffold PureYAML streaming incubator 2026-06-06 21:23:21 +02:00
Package.swift feat: publish WASM streaming smoke site 2026-06-06 22:06:38 +02:00
README.md feat: publish WASM streaming smoke site 2026-06-06 22:06:38 +02:00

PureYAMLStreaming

macOS Linux Windows WASM WASM Site

Experimental full-streaming incubator for PureYAML.

This package is intentionally separate from PureYAML while the chunked input, document streaming, and eventual event streaming APIs settle. It depends on PureYAML for the stable model and parser semantics, then adds streaming input adapters around that stable core.

Status

Prototype.

The current implementation streams YAML input in chunks, detects document-boundary candidates, and emits one parsed PureYAML.Stream.Document at a time. That gives bounded memory for multi-document streams where each document fits in memory.

It is not yet a token-level YAML scanner. A future milestone will replace the document-boundary scanner with a resumable token scanner that can feed event-level consumers directly.

Memory Contract

  • parseDocuments is bounded by the largest current document plus parser state.
  • collectDocuments is a convenience helper and retains all returned documents.
  • Anchors, aliases, merge keys, and PureYAML.Model.Value construction can require retaining semantic state until the current document is complete.
  • Future event-level APIs should be lower memory than document-level APIs, but they still cannot promise constant memory for every YAML feature.

Example

import Foundation
import PureYAMLStreaming

let url = URL(fileURLWithPath: "stream.yaml")
let parser = PureYAMLStreaming.Parser()

try parser.parseDocuments(from: url) { document in
    print("document", document.index, document.value)
}

WASM Browser Smoke Site

Live site:

https://mihaelamj.github.io/PureYAMLStreaming/

Build the Swift WASI smoke executable and copy it into the static test site:

bash scripts/build-wasm-site.sh

Serve the site locally:

bash scripts/serve-wasm-site.sh

Then open http://localhost:8080 and click Run WASM Test. The page loads pureyaml-streaming-wasm-smoke.wasm, runs a chunked document-stream parse in the browser through a WASI shim, captures stdout, and renders pass/fail.

Relationship To PureYAML

PureYAML remains the dependency-free core package. This package is the incubator for file, byte, and async streaming APIs. Stable pieces can move back into PureYAML later once the API and memory behavior are proven.