@codama/spec 1.6.0-rc.2 → 1.6.0-rc.3
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/dist/api.browser.cjs +305 -0
- package/dist/api.browser.cjs.map +1 -0
- package/dist/api.browser.mjs +267 -0
- package/dist/api.browser.mjs.map +1 -0
- package/dist/api.node.cjs +305 -0
- package/dist/api.node.cjs.map +1 -0
- package/dist/api.node.mjs +267 -0
- package/dist/api.node.mjs.map +1 -0
- package/dist/api.react-native.mjs +267 -0
- package/dist/api.react-native.mjs.map +1 -0
- package/dist/index.browser.cjs +1 -1
- package/dist/index.browser.cjs.map +1 -1
- package/dist/index.browser.mjs +1 -1
- package/dist/index.browser.mjs.map +1 -1
- package/dist/index.node.cjs +1 -1
- package/dist/index.node.cjs.map +1 -1
- package/dist/index.node.mjs +1 -1
- package/dist/index.node.mjs.map +1 -1
- package/dist/index.react-native.mjs +1 -1
- package/dist/index.react-native.mjs.map +1 -1
- package/dist/types/api/primitives.d.ts.map +1 -1
- package/dist/types/api/semanticAliases.d.ts +17 -7
- package/dist/types/api/semanticAliases.d.ts.map +1 -1
- package/dist/types/api/types.d.ts +15 -3
- package/dist/types/api/types.d.ts.map +1 -1
- package/dist/types/api/validate.d.ts +3 -0
- package/dist/types/api/validate.d.ts.map +1 -1
- package/dist/v1.browser.cjs +1 -1
- package/dist/v1.browser.cjs.map +1 -1
- package/dist/v1.browser.mjs +1 -1
- package/dist/v1.browser.mjs.map +1 -1
- package/dist/v1.node.cjs +1 -1
- package/dist/v1.node.cjs.map +1 -1
- package/dist/v1.node.mjs +1 -1
- package/dist/v1.node.mjs.map +1 -1
- package/dist/v1.react-native.mjs +1 -1
- package/dist/v1.react-native.mjs.map +1 -1
- package/package.json +13 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"primitives.d.ts","sourceRoot":"","sources":["../../../src/api/primitives.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH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,EAAE,GAAG,QAAQ,CAYhE;AAID,yEAAyE;AACzE,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,QAAQ,CAElD;AAED,2DAA2D;AAC3D,wBAAgB,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,QAAQ,CAE3C;AAED,6DAA6D;AAC7D,wBAAgB,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,QAAQ,CAE5C;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,QAAQ,CAErD;AAGD,YAAY,EAAE,UAAU,EAAE,YAAY,EAAE,YAAY,EAAE,gBAAgB,EAAE,QAAQ,EAAE,CAAC"}
|
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Author-side semantic aliases
|
|
3
|
-
* time so the encoded spec only ever shows the underlying primitive (e.g.
|
|
4
|
-
* `{ kind: "integer", width: "u64" }` for both `u64()` and `byteSize()`).
|
|
2
|
+
* Author-side semantic aliases.
|
|
5
3
|
*
|
|
6
|
-
*
|
|
7
|
-
* (e.g.
|
|
8
|
-
*
|
|
4
|
+
* Most aliases desugar at call time so the encoded spec only ever shows
|
|
5
|
+
* the underlying primitive (e.g. `{ kind: "integer", width: "u64" }` for
|
|
6
|
+
* both `u64()` and `byteSize()`). Each language's codegen may further
|
|
7
|
+
* specialise rendering for these widths (e.g. Rust may render `u64` as
|
|
8
|
+
* `usize` for byte-size fields if it wants). Those are codegen policies
|
|
9
|
+
* — not spec content.
|
|
10
|
+
*
|
|
11
|
+
* `docs()` is the exception: it returns its own `'docs'` `TypeExpr` kind
|
|
12
|
+
* so the documentation intent survives in the encoded spec rather than
|
|
13
|
+
* collapsing to `array(string())`.
|
|
9
14
|
*/
|
|
10
15
|
import type { TypeExpr } from './types';
|
|
11
16
|
/** Number of bytes; non-negative. Encoded as `u64`. */
|
|
@@ -14,6 +19,11 @@ export declare function byteSize(): TypeExpr;
|
|
|
14
19
|
export declare function byteOffset(): TypeExpr;
|
|
15
20
|
/** Count of items in a collection; non-negative. Encoded as `u32`. */
|
|
16
21
|
export declare function count(): TypeExpr;
|
|
17
|
-
/**
|
|
22
|
+
/**
|
|
23
|
+
* Documentation for a node — semantically a list of paragraph strings,
|
|
24
|
+
* but rendered per language at codegen time (e.g. `Array<string>` in
|
|
25
|
+
* TypeScript, `Vec<String>` in Rust). Returns its own `'docs'` kind so
|
|
26
|
+
* the intent isn't lost in the encoded spec.
|
|
27
|
+
*/
|
|
18
28
|
export declare function docs(): TypeExpr;
|
|
19
29
|
//# sourceMappingURL=semanticAliases.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"semanticAliases.d.ts","sourceRoot":"","sources":["../../../src/api/semanticAliases.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"semanticAliases.d.ts","sourceRoot":"","sources":["../../../src/api/semanticAliases.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAGH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAExC,uDAAuD;AACvD,wBAAgB,QAAQ,IAAI,QAAQ,CAEnC;AAED,4CAA4C;AAC5C,wBAAgB,UAAU,IAAI,QAAQ,CAErC;AAED,sEAAsE;AACtE,wBAAgB,KAAK,IAAI,QAAQ,CAEhC;AAED;;;;;GAKG;AACH,wBAAgB,IAAI,IAAI,QAAQ,CAE/B"}
|
|
@@ -3,7 +3,9 @@
|
|
|
3
3
|
*
|
|
4
4
|
* These types are version-agnostic — the same shape describes a Codama v1
|
|
5
5
|
* spec, a v2 spec, etc. Versioned content (concrete nodes, enumerations,
|
|
6
|
-
* unions) lives under `spec/src/v<n>/`.
|
|
6
|
+
* unions) lives under `spec/src/v<n>/`. The first half of this file
|
|
7
|
+
* declares the type-expression vocabulary; the second half declares the
|
|
8
|
+
* spec-content shape (attributes, nodes, unions, enumerations).
|
|
7
9
|
*/
|
|
8
10
|
export type IntegerWidth = 'i8' | 'i16' | 'i32' | 'i64' | 'i128' | 'u8' | 'u16' | 'u32' | 'u64' | 'u128';
|
|
9
11
|
export type FloatWidth = 'f32' | 'f64';
|
|
@@ -21,8 +23,8 @@ export type LiteralValue = boolean | number | string;
|
|
|
21
23
|
* Constituents are listed alphabetically by `kind` to satisfy the lint
|
|
22
24
|
* rule; logical grouping lives in the doc comments below.
|
|
23
25
|
*
|
|
24
|
-
* Leaf primitives: boolean, float, integer, literal, literalUnion, string.
|
|
25
|
-
* Named references: enumeration, nestedTypeNode, node, union.
|
|
26
|
+
* Leaf primitives: boolean, docs, float, integer, literal, literalUnion, string.
|
|
27
|
+
* Named references: codamaVersion, enumeration, nestedTypeNode, node, union.
|
|
26
28
|
* Compounds: array, tuple.
|
|
27
29
|
*/
|
|
28
30
|
export type TypeExpr = {
|
|
@@ -38,6 +40,16 @@ export type TypeExpr = {
|
|
|
38
40
|
*/
|
|
39
41
|
| {
|
|
40
42
|
readonly kind: 'codamaVersion';
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Documentation for a node — semantically a list of paragraph strings,
|
|
46
|
+
* but rendered per language at codegen time (e.g. `Array<string>` in
|
|
47
|
+
* TypeScript, `Vec<String>` in Rust). Carrying the intent as its own
|
|
48
|
+
* kind preserves "this is documentation" through the encoded spec
|
|
49
|
+
* rather than collapsing to `array(string())`.
|
|
50
|
+
*/
|
|
51
|
+
| {
|
|
52
|
+
readonly kind: 'docs';
|
|
41
53
|
} | {
|
|
42
54
|
readonly kind: 'enumeration';
|
|
43
55
|
readonly name: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/api/types.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/api/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,MAAM,MAAM,YAAY,GAAG,IAAI,GAAG,KAAK,GAAG,KAAK,GAAG,KAA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,MAAM,WAAW,SAAS;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,SAAS,WAAW,EAAE,CAAC;IACzC,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,0CAA0C;AAC1C,MAAM,WAAW,sBAAsB;IACnC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,4DAA4D;AAC5D,MAAM,WAAW,eAAe;IAC5B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,QAAQ,EAAE,SAAS,sBAAsB,EAAE,CAAC;IACrD,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,8DAA8D;AAC9D,MAAM,WAAW,IAAI;IACjB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,YAAY,EAAE,SAAS,eAAe,EAAE,CAAC;IAClD,QAAQ,CAAC,KAAK,EAAE,SAAS,QAAQ,EAAE,CAAC;IACpC,QAAQ,CAAC,MAAM,EAAE,SAAS,SAAS,EAAE,CAAC;IACtC;;;;;OAKG;IACH,QAAQ,CAAC,sBAAsB,EAAE,SAAS,MAAM,EAAE,CAAC;CACtD"}
|
|
@@ -8,6 +8,9 @@
|
|
|
8
8
|
import type { Spec, TypeExpr } from './types';
|
|
9
9
|
export declare function validate(spec: Spec): string[];
|
|
10
10
|
/**
|
|
11
|
+
* Child-detection helper used by codegen, docs, and visitor-table
|
|
12
|
+
* generators.
|
|
13
|
+
*
|
|
11
14
|
* A "child" attribute is one whose value contains another node. Specifically,
|
|
12
15
|
* any attribute whose type tree includes a `node`, `nestedTypeNode`, or
|
|
13
16
|
* `union` is treated as a child. Optionality (the `optional` flag on the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../../src/api/validate.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAI9C,wBAAgB,QAAQ,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../../src/api/validate.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAI9C,wBAAgB,QAAQ,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,EAAE,CAwE7C;AAyDD;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,QAAQ,GAAG,OAAO,CAaxD"}
|