@coral-viz/language 0.2.3 → 0.2.4
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 +18 -0
- package/dist/diagnostics.d.ts +9 -0
- package/dist/diagnostics.d.ts.map +1 -1
- package/dist/diagnostics.js +4 -0
- package/dist/diagnostics.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/parser/index.d.ts.map +1 -1
- package/dist/parser/index.js +403 -38
- package/dist/parser/index.js.map +1 -1
- package/dist/printer/index.d.ts.map +1 -1
- package/dist/printer/index.js +177 -104
- package/dist/printer/index.js.map +1 -1
- package/dist/strings.d.ts.map +1 -1
- package/dist/strings.js +13 -6
- package/dist/strings.js.map +1 -1
- package/dist/structured.d.ts +5 -0
- package/dist/structured.d.ts.map +1 -0
- package/dist/structured.js +67 -0
- package/dist/structured.js.map +1 -0
- package/package.json +1 -1
package/dist/strings.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"strings.js","sourceRoot":"","sources":["../src/strings.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,iFAAiF;AACjF,MAAM,UAAU,YAAY,CAAC,GAAW;IACtC,OAAO,GAAG
|
|
1
|
+
{"version":3,"file":"strings.js","sourceRoot":"","sources":["../src/strings.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,iFAAiF;AACjF,MAAM,UAAU,YAAY,CAAC,GAAW;IACtC,OAAO,GAAG,CAAC,OAAO,CAAC,cAAc,EAAE,CAAC,IAAI,EAAE,EAAE;QAC1C,IAAI,IAAI,KAAK,IAAI;YAAE,OAAO,MAAM,CAAC;QACjC,IAAI,IAAI,KAAK,GAAG;YAAE,OAAO,KAAK,CAAC;QAC/B,IAAI,IAAI,KAAK,IAAI;YAAE,OAAO,KAAK,CAAC;QAChC,IAAI,IAAI,KAAK,I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 @@
|
|
|
1
|
+
/** Internal JSON-value boundary for the additive structured DSL clauses. */
|
|
2
|
+
export declare function isJsonSafe(value: unknown, ancestors?: Set<object>): boolean;
|
|
3
|
+
export declare function stableJson(value: unknown): string;
|
|
4
|
+
export declare function isPlainObject(value: unknown): value is Record<string, unknown>;
|
|
5
|
+
//# sourceMappingURL=structured.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"structured.d.ts","sourceRoot":"","sources":["../src/structured.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAE5E,wBAAgB,UAAU,CAAC,KAAK,EAAE,OAAO,EAAE,SAAS,cAAoB,GAAG,OAAO,CAkCjF;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CASjD;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAI9E"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/** Internal JSON-value boundary for the additive structured DSL clauses. */
|
|
2
|
+
export function isJsonSafe(value, ancestors = new Set()) {
|
|
3
|
+
if (value === null || typeof value === 'string' || typeof value === 'boolean')
|
|
4
|
+
return true;
|
|
5
|
+
if (typeof value === 'number')
|
|
6
|
+
return Number.isFinite(value);
|
|
7
|
+
if (typeof value !== 'object')
|
|
8
|
+
return false;
|
|
9
|
+
if (ancestors.has(value))
|
|
10
|
+
return false;
|
|
11
|
+
ancestors.add(value);
|
|
12
|
+
try {
|
|
13
|
+
if (Array.isArray(value)) {
|
|
14
|
+
const keys = Reflect.ownKeys(value);
|
|
15
|
+
if (keys.some((key) => typeof key !== 'string'))
|
|
16
|
+
return false;
|
|
17
|
+
if (keys.length !== value.length + 1 || !keys.includes('length'))
|
|
18
|
+
return false;
|
|
19
|
+
const descriptors = Object.getOwnPropertyDescriptors(value);
|
|
20
|
+
for (let index = 0; index < value.length; index++) {
|
|
21
|
+
const descriptor = descriptors[String(index)];
|
|
22
|
+
if (!descriptor?.enumerable || !('value' in descriptor) || !isJsonSafe(descriptor.value, ancestors))
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
25
|
+
return true;
|
|
26
|
+
}
|
|
27
|
+
const prototype = Object.getPrototypeOf(value);
|
|
28
|
+
if (prototype !== Object.prototype && prototype !== null)
|
|
29
|
+
return false;
|
|
30
|
+
const descriptors = Object.getOwnPropertyDescriptors(value);
|
|
31
|
+
if (Reflect.ownKeys(value).some((key) => typeof key !== 'string'))
|
|
32
|
+
return false;
|
|
33
|
+
for (const [key, descriptor] of Object.entries(descriptors)) {
|
|
34
|
+
if (!descriptor.enumerable || !('value' in descriptor) || !isJsonSafe(descriptor.value, ancestors))
|
|
35
|
+
return false;
|
|
36
|
+
if (!Object.prototype.propertyIsEnumerable.call(value, key))
|
|
37
|
+
return false;
|
|
38
|
+
}
|
|
39
|
+
return true;
|
|
40
|
+
}
|
|
41
|
+
catch {
|
|
42
|
+
return false;
|
|
43
|
+
}
|
|
44
|
+
finally {
|
|
45
|
+
ancestors.delete(value);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
export function stableJson(value) {
|
|
49
|
+
if (!isJsonSafe(value))
|
|
50
|
+
throw new TypeError('Value is not JSON-safe');
|
|
51
|
+
if (value === null)
|
|
52
|
+
return 'null';
|
|
53
|
+
if (typeof value === 'string' || typeof value === 'boolean')
|
|
54
|
+
return JSON.stringify(value);
|
|
55
|
+
if (typeof value === 'number')
|
|
56
|
+
return Object.is(value, -0) ? '-0' : String(value);
|
|
57
|
+
if (Array.isArray(value))
|
|
58
|
+
return `[${Array.from(value, stableJson).join(',')}]`;
|
|
59
|
+
return `{${Object.keys(value).sort().map((key) => `${JSON.stringify(key)}:${stableJson(value[key])}`).join(',')}}`;
|
|
60
|
+
}
|
|
61
|
+
export function isPlainObject(value) {
|
|
62
|
+
if (value === null || typeof value !== 'object' || Array.isArray(value))
|
|
63
|
+
return false;
|
|
64
|
+
const prototype = Object.getPrototypeOf(value);
|
|
65
|
+
return prototype === Object.prototype || prototype === null;
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=structured.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"structured.js","sourceRoot":"","sources":["../src/structured.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAE5E,MAAM,UAAU,UAAU,CAAC,KAAc,EAAE,YAAY,IAAI,GAAG,EAAU;IACtE,IAAI,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,OAAO,KAAK,KAAK,SAAS;QAAE,OAAO,IAAI,CAAC;IAC3F,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC7D,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IAE5C,IAAI,SAAS,CAAC,GAAG,CAAC,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC;IACvC,SAAS,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IACrB,IAAI,CAAC;QACH,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;YACzB,MAAM,IAAI,GAAG,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;YACpC,IAAI,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,OAAO,GAAG,KAAK,QAAQ,CAAC;gBAAE,OAAO,KAAK,CAAC;YAC9D,IAAI,IAAI,CAAC,MAAM,KAAK,KAAK,CAAC,MAAM,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC;gBAAE,OAAO,KAAK,CAAC;YAC/E,MAAM,WAAW,GAAG,MAAM,CAAC,yBAAyB,CAAC,KAAK,CAAC,CAAC;YAC5D,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,KAAK,CAAC,MAAM,EAAE,KAAK,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