teptris 0.3.21 → 0.3.22
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 +1 -0
- package/dist/teptris.wasm +0 -0
- package/package.json +1 -1
- package/src/index.d.ts +29 -0
package/README.md
CHANGED
|
@@ -16,6 +16,7 @@ const teptris = await init();
|
|
|
16
16
|
teptris.loads('a = 1'); // → { a: 1 }
|
|
17
17
|
teptris.dump(obj); // → canonical TOML string
|
|
18
18
|
teptris.dumpJson(obj); // → natural JSON string
|
|
19
|
+
teptris.edit(src, "serve.port", "9090"); // → the file with ONE value rewritten
|
|
19
20
|
teptris.engineVersion(); // → the libteptris inside
|
|
20
21
|
```
|
|
21
22
|
|
package/dist/teptris.wasm
CHANGED
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "teptris",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.22",
|
|
4
4
|
"description": "TOML for JavaScript/TypeScript at libteptris speed (WebAssembly, no fallback) - version tracks the engine ({engine}.{iteration}; npm semver is 3-part)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.js",
|
package/src/index.d.ts
CHANGED
|
@@ -61,6 +61,28 @@ export interface TeptrisApi {
|
|
|
61
61
|
/** The libteptris engine version inside this build. */
|
|
62
62
|
engineVersion(): string;
|
|
63
63
|
|
|
64
|
+
/** Parse TOML into a retained engine document (no host objects):
|
|
65
|
+
* the LOSSLESS round-trip surface. JS numbers cannot carry TOML's
|
|
66
|
+
* int/float distinction (loads' documented floor) - doc handles
|
|
67
|
+
* can: dumpDoc(loadsDoc(s)) re-emits the parsed tree exactly, at
|
|
68
|
+
* C speed with nothing materialized in JS. Single slot: a later
|
|
69
|
+
* loadsDoc replaces the held document. */
|
|
70
|
+
loadsDoc(toml: string): TeptrisDoc;
|
|
71
|
+
|
|
72
|
+
/** Emit a loadsDoc() document back to canonical TOML — the
|
|
73
|
+
* lossless half of the doc round-trip. */
|
|
74
|
+
dumpDoc(doc: TeptrisDoc): string;
|
|
75
|
+
|
|
76
|
+
/** Format-preserving edit: rewrite exactly the value bytes of one
|
|
77
|
+
* key = value line; every other byte of the source survives
|
|
78
|
+
* (comments, blank lines, formatting, CRLF endings). keyPath may
|
|
79
|
+
* carry a [table] prefix ("t.x" edits x inside [t]); a dotted key
|
|
80
|
+
* line may continue the open section. replacement is the value's
|
|
81
|
+
* TEXT, validated by the engine; multiline strings and inline
|
|
82
|
+
* collections splice (parse-verified). Throws Error on an absent
|
|
83
|
+
* key or a malformed span/replacement. */
|
|
84
|
+
edit(source: string, keyPath: string, replacement: string): string;
|
|
85
|
+
|
|
64
86
|
/** Compile a descriptor plan (once) — materialize only the planned
|
|
65
87
|
* keys of any document via planWalk. Rows: a string name is a
|
|
66
88
|
* scalar; kind "collection" walks an array; kind "raw" takes the
|
|
@@ -76,6 +98,13 @@ export interface TeptrisApi {
|
|
|
76
98
|
planFree(plan: number): void;
|
|
77
99
|
}
|
|
78
100
|
|
|
101
|
+
/** An opaque retained-document handle from {@link TeptrisApi.loadsDoc}
|
|
102
|
+
* (single slot: a later loadsDoc replaces the held document). */
|
|
103
|
+
export interface TeptrisDoc {
|
|
104
|
+
/** Renders "[teptris doc]". */
|
|
105
|
+
toString(): string;
|
|
106
|
+
}
|
|
107
|
+
|
|
79
108
|
/** One planned key of a {@link PlanRowSpec} tree. */
|
|
80
109
|
export interface PlanRowSpec {
|
|
81
110
|
name: string;
|