@sebastienrousseau/noyalib-wasm 0.0.32 → 0.0.34

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -26,6 +26,7 @@
26
26
  ## Contents
27
27
 
28
28
  - [Install](#install) — npm, build from source
29
+ - [Requirements](#requirements) — toolchain floor, platforms, the core pin
29
30
  - [Quick Start](#quick-start) — parse, edit, validate
30
31
  - [Why this approach?](#why-this-approach) — vs `js-yaml`
31
32
  - [Surface](#surface) — exported APIs
@@ -68,6 +69,20 @@ wasm-pack build --release --target bundler
68
69
 
69
70
  ---
70
71
 
72
+ ## Requirements
73
+
74
+ - **Rust 1.86.0 or newer** to build from source: `rust-version` in
75
+ the manifest, enforced by the `msrv-core` CI job on every push.
76
+ - **Any tier-1 platform.** CI runs the tests on Linux, macOS, and
77
+ Windows with the stable, beta, and nightly toolchains; stable is the
78
+ gate, beta and nightly are early warning.
79
+ - **The matching core.** This crate pins `noyalib` at the identical
80
+ `=0.0.X` and releases in lockstep with it; Cargo resolves that pin
81
+ for you.
82
+ - **For the bundle**: `wasm-pack` and a JavaScript runtime that loads
83
+ WebAssembly (browsers, Node.js 18+, Deno, Bun, Cloudflare Workers).
84
+ `cargo test` needs neither; the pure-Rust core is tested natively.
85
+
71
86
  ## Quick Start
72
87
 
73
88
  ```js
@@ -323,7 +338,7 @@ consume the `bundler` target.
323
338
 
324
339
  The four entry points, identical across every repo in the family:
325
340
 
326
- - **[User Manual](https://sebastienrousseau.github.io/noyalib/manual/)** — the rendered book: user guide, migrations, architecture, policies, ADRs
341
+ - **[User Manual](https://sebastienrousseau.github.io/noyalib-wasm/manual/)** — this crate's rendered book: its guides, architecture, and release notes; the family manual for the core library is at [https://sebastienrousseau.github.io/noyalib/manual/](https://sebastienrousseau.github.io/noyalib/manual/)
327
342
  - **[API reference](https://docs.rs/noyalib-wasm)** — rustdoc on docs.rs
328
343
  - **[Developer docs](DEVELOPMENT.md)** — this repo's dev entry point, pointing at the family guide
329
344
  - **[Ecosystem map](https://github.com/sebastienrousseau/noyalib/blob/main/docs/ECOSYSTEM.md)** — the six crates, the lockstep model, the scorecard
@@ -333,9 +348,9 @@ The four entry points, identical across every repo in the family:
333
348
  - **Security policy**:
334
349
  [`SECURITY.md`](https://github.com/sebastienrousseau/noyalib/blob/main/SECURITY.md)
335
350
  - **JS API reference**:
336
- [`docs/js-api.md`](https://github.com/sebastienrousseau/noyalib/blob/main/crates/noyalib-wasm/doc/js-api.md)
351
+ [`docs/js-api.md`](docs/js-api.md)
337
352
  - **Bundling (Vite, Webpack, Next.js, Cloudflare Workers, Deno, Bun)**:
338
- [`docs/bundling.md`](https://github.com/sebastienrousseau/noyalib/blob/main/crates/noyalib-wasm/doc/bundling.md)
353
+ [`docs/bundling.md`](docs/bundling.md)
339
354
  - **npm package**:
340
355
  <https://www.npmjs.com/package/@sebastienrousseau/noyalib-wasm>
341
356
  - **API reference (rustdoc)**: <https://docs.rs/noyalib-wasm>
package/noyalib_wasm.d.ts CHANGED
@@ -85,6 +85,14 @@ export function merge(base_yaml: string, override_yaml: string): string;
85
85
  */
86
86
  export function parse(yaml: string): any;
87
87
 
88
+ /**
89
+ * Parse YAML and return the JSON data model: like [`parse`], but every
90
+ * tag is stripped recursively, so the result is exactly what the YAML
91
+ * test suite's expected JSON is and what a JSON consumer expects.
92
+ * `parse` keeps tags as `{"!tag": value}` for callers that need them.
93
+ */
94
+ export function parseJson(yaml: string): any;
95
+
88
96
  /**
89
97
  * Serialize a JS object to a YAML string.
90
98
  */
package/noyalib_wasm.js CHANGED
@@ -5,5 +5,5 @@ import { __wbg_set_wasm } from "./noyalib_wasm_bg.js";
5
5
  __wbg_set_wasm(wasm);
6
6
  wasm.__wbindgen_start();
7
7
  export {
8
- WasmDocument, getPath, merge, parse, stringify, validateJson
8
+ WasmDocument, getPath, merge, parse, parseJson, stringify, validateJson
9
9
  } from "./noyalib_wasm_bg.js";
@@ -228,6 +228,24 @@ export function parse(yaml) {
228
228
  return takeFromExternrefTable0(ret[0]);
229
229
  }
230
230
 
231
+ /**
232
+ * Parse YAML and return the JSON data model: like [`parse`], but every
233
+ * tag is stripped recursively, so the result is exactly what the YAML
234
+ * test suite's expected JSON is and what a JSON consumer expects.
235
+ * `parse` keeps tags as `{"!tag": value}` for callers that need them.
236
+ * @param {string} yaml
237
+ * @returns {any}
238
+ */
239
+ export function parseJson(yaml) {
240
+ const ptr0 = passStringToWasm0(yaml, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
241
+ const len0 = WASM_VECTOR_LEN;
242
+ const ret = wasm.parseJson(ptr0, len0);
243
+ if (ret[2]) {
244
+ throw takeFromExternrefTable0(ret[1]);
245
+ }
246
+ return takeFromExternrefTable0(ret[0]);
247
+ }
248
+
231
249
  /**
232
250
  * Serialize a JS object to a YAML string.
233
251
  * @param {any} value
Binary file
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "Sebastien Rousseau <sebastian.rousseau@gmail.com>"
6
6
  ],
7
7
  "description": "WebAssembly (wasm-bindgen) bindings for the noyalib YAML library — browser-ready parse / serialise / lossless edit",
8
- "version": "0.0.32",
8
+ "version": "0.0.34",
9
9
  "license": "MIT OR Apache-2.0",
10
10
  "repository": {
11
11
  "type": "git",