@3leaps/yamlprims 0.1.0 → 0.2.0
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 +4 -2
- package/dist/index.d.ts +59 -0
- package/dist/index.js +2522 -437
- package/dist/wasm.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -4,14 +4,16 @@ YAML 1.2.2 Core Schema value loader, strict wire decoder and canonical encoder
|
|
|
4
4
|
(`yamlprims-value/1`): a binding over the Rust `yamlprims` crate, compiled to
|
|
5
5
|
one WebAssembly module with no imports. Zero runtime dependencies.
|
|
6
6
|
|
|
7
|
-
> **Status:** Under qualification against the `yamlprims` v1.
|
|
7
|
+
> **Status:** Under qualification against the `yamlprims` v1.5 specification
|
|
8
8
|
> and pinned `3leaps/structcorpus` conformance vectors.
|
|
9
9
|
|
|
10
10
|
```ts
|
|
11
|
-
import { load, loadAll, toPlain, encode, decodeWire } from "@3leaps/yamlprims";
|
|
11
|
+
import { load, loadAll, dump, loadIjson, toPlain, encode, decodeWire } from "@3leaps/yamlprims";
|
|
12
12
|
|
|
13
13
|
const doc = load("port: 8080\nenabled: true\n");
|
|
14
14
|
const plain = toPlain(doc.root);
|
|
15
|
+
const yamlOut = dump(plain);
|
|
16
|
+
const ijsonBytes = loadIjson(yamlOut);
|
|
15
17
|
const wire = encode([doc]);
|
|
16
18
|
const decoded = decodeWire(wire);
|
|
17
19
|
```
|
package/dist/index.d.ts
CHANGED
|
@@ -5,11 +5,52 @@ export declare const MAX_WASM_MEMORY_BYTES: number;
|
|
|
5
5
|
export declare const MAX_WASM_MEMORY_PAGES = 2048;
|
|
6
6
|
export declare const WASM_HIGH_WATER_RECYCLE_BYTES: number;
|
|
7
7
|
export declare const MAX_SAFE_METADATA_INT = 9007199254740991;
|
|
8
|
+
export declare const DEFAULT_IJSON_MAX_OUTPUT_BYTES: number;
|
|
9
|
+
export declare const DEFAULT_EMIT_MAX_TAG_BYTES = 1024;
|
|
10
|
+
export declare const DEFAULT_EMIT_MAX_OUTPUT_BYTES: number;
|
|
8
11
|
export declare const I128_MIN = -170141183460469231731687303715884105728n;
|
|
9
12
|
export declare const I128_MAX = 170141183460469231731687303715884105727n;
|
|
10
13
|
export declare const U128_MAX = 340282366920938463463374607431768211455n;
|
|
11
14
|
export type MergeKeys = "reject" | "apply" | "as_key" | "as-key";
|
|
12
15
|
export type UnknownTags = "preserve" | "reject";
|
|
16
|
+
export type CompatQuoting = "yaml11_safe" | "core_only" | "yaml11-safe" | "core-only";
|
|
17
|
+
export interface EmitLimits {
|
|
18
|
+
maxDepth: number;
|
|
19
|
+
maxNodes: number;
|
|
20
|
+
maxScalarBytes: number;
|
|
21
|
+
maxKeyBytes: number;
|
|
22
|
+
maxMappingEntries: number;
|
|
23
|
+
maxTagBytes: number;
|
|
24
|
+
maxDocuments: number;
|
|
25
|
+
maxOutputBytes: number;
|
|
26
|
+
}
|
|
27
|
+
export interface EmitLimitsInput {
|
|
28
|
+
maxDepth?: number;
|
|
29
|
+
maxNodes?: number;
|
|
30
|
+
maxScalarBytes?: number;
|
|
31
|
+
maxKeyBytes?: number;
|
|
32
|
+
maxMappingEntries?: number;
|
|
33
|
+
maxTagBytes?: number;
|
|
34
|
+
maxDocuments?: number;
|
|
35
|
+
maxOutputBytes?: number;
|
|
36
|
+
max_depth?: number;
|
|
37
|
+
max_nodes?: number;
|
|
38
|
+
max_scalar_bytes?: number;
|
|
39
|
+
max_key_bytes?: number;
|
|
40
|
+
max_mapping_entries?: number;
|
|
41
|
+
max_tag_bytes?: number;
|
|
42
|
+
max_documents?: number;
|
|
43
|
+
max_output_bytes?: number;
|
|
44
|
+
}
|
|
45
|
+
export interface EmitOptions {
|
|
46
|
+
compatQuoting: "yaml11_safe" | "core_only";
|
|
47
|
+
limits: EmitLimits;
|
|
48
|
+
}
|
|
49
|
+
export interface EmitOptionsInput {
|
|
50
|
+
compatQuoting?: CompatQuoting;
|
|
51
|
+
compat_quoting?: CompatQuoting;
|
|
52
|
+
limits?: EmitLimitsInput;
|
|
53
|
+
}
|
|
13
54
|
export interface Limits {
|
|
14
55
|
maxInputBytes: number;
|
|
15
56
|
maxDepth: number;
|
|
@@ -200,8 +241,22 @@ export declare class YamlprimsError extends Error {
|
|
|
200
241
|
export declare function defaultLimits(): Limits;
|
|
201
242
|
export declare function defaultOptions(): Options;
|
|
202
243
|
export declare function validateOptions(options?: OptionsInput): Options;
|
|
244
|
+
export declare function defaultIjsonOptions(): Options;
|
|
245
|
+
export declare function validateIjsonOptions(options?: OptionsInput): Options;
|
|
246
|
+
export declare function defaultEmitLimits(): EmitLimits;
|
|
247
|
+
export declare function defaultEmitOptions(): EmitOptions;
|
|
248
|
+
export declare function validateEmitOptions(options?: EmitOptionsInput): EmitOptions;
|
|
203
249
|
export declare function floatToBits(f: number): string;
|
|
204
250
|
export declare function containsNan(node: Node): boolean;
|
|
251
|
+
export declare function createTag(uri: string, handle?: string, suffix?: string): Tag;
|
|
252
|
+
export declare function createTaggedNode(tag: Tag | string, value: Node, metadata?: Partial<NodeMetadata>): TaggedNode;
|
|
253
|
+
export declare function createDocument(root: Node, yamlVersion?: [number, number] | null, explicitStart?: boolean): Document;
|
|
254
|
+
export declare class Mapping {
|
|
255
|
+
readonly entries: Array<[Node, Node]>;
|
|
256
|
+
constructor(entries?: ReadonlyArray<[Node, Node]>);
|
|
257
|
+
get size(): number;
|
|
258
|
+
get(key: string | Node): Node | undefined;
|
|
259
|
+
}
|
|
205
260
|
export declare function keyEq(a: Node, b: Node): boolean;
|
|
206
261
|
export declare function mappingGet(mapping: MappingNode | ReadonlyArray<[Node, Node]>, key: string | Node): Node | undefined;
|
|
207
262
|
export declare function decodeWire(wireJson: string, options?: OptionsInput, sourceInput?: string | Uint8Array): {
|
|
@@ -228,3 +283,7 @@ export declare function load(input: string | Uint8Array, options?: OptionsInput)
|
|
|
228
283
|
export declare function loadBytes(input: Uint8Array, options?: OptionsInput): Document;
|
|
229
284
|
export declare function loadAllBytes(input: Uint8Array, options?: OptionsInput): Document[];
|
|
230
285
|
export declare function loadPlain(input: string | Uint8Array, options?: OptionsInput): string;
|
|
286
|
+
export declare function loadIjson(input: string | Uint8Array, options?: OptionsInput): string;
|
|
287
|
+
export declare function fromPlain(value: unknown, options?: EmitOptionsInput): Node;
|
|
288
|
+
export declare function dumpAll(documents: readonly unknown[], options?: EmitOptionsInput): string;
|
|
289
|
+
export declare function dump(value: unknown, options?: EmitOptionsInput): string;
|