@powerlines/deepkit 0.5.2 → 0.5.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.
Files changed (45) hide show
  1. package/dist/capnp.cjs +49 -48
  2. package/dist/capnp.js +4 -3
  3. package/dist/{chunk-C7BRLIIA.js → chunk-35PNVYKI.js} +4 -4
  4. package/dist/chunk-3GQAWCBQ.js +10 -0
  5. package/dist/{chunk-QABG54Y3.cjs → chunk-3GRTJOID.cjs} +9 -9
  6. package/dist/{chunk-6QPIKQMO.cjs → chunk-3PKIT7K2.cjs} +4 -4
  7. package/dist/{chunk-MEMIQ5AA.js → chunk-47WBQTA6.js} +1 -1
  8. package/dist/chunk-4UQ4UDET.cjs +19685 -0
  9. package/dist/chunk-5NPGWGPO.cjs +109 -0
  10. package/dist/{chunk-VMRRVNO2.cjs → chunk-B47NLUDW.cjs} +2 -2
  11. package/dist/chunk-BGYQAVKQ.cjs +13 -0
  12. package/dist/chunk-F5QUFY7D.cjs +135 -0
  13. package/dist/{chunk-2ODODKQQ.js → chunk-GVS5O43Z.js} +2 -2
  14. package/dist/{chunk-LPLPOVLC.js → chunk-JSH5MVQG.js} +2 -2
  15. package/dist/{chunk-EKHXI2JI.cjs → chunk-KDKCOXXC.cjs} +5 -5
  16. package/dist/chunk-KWUXT6EF.js +127 -0
  17. package/dist/{chunk-J2FVIV7W.cjs → chunk-MSO7PT57.cjs} +126 -126
  18. package/dist/chunk-O2LKJ62Q.cjs +2863 -0
  19. package/dist/chunk-U7WEV6HK.js +19678 -0
  20. package/dist/chunk-W423FBJ2.js +2854 -0
  21. package/dist/{chunk-I5CVIT7W.js → chunk-XI47ZADG.js} +42 -42
  22. package/dist/chunk-XU55W26B.js +109 -0
  23. package/dist/esbuild-plugin.cjs +6 -5
  24. package/dist/esbuild-plugin.js +5 -4
  25. package/dist/index.cjs +68 -67
  26. package/dist/index.js +10 -9
  27. package/dist/reflect-type.cjs +8 -7
  28. package/dist/reflect-type.js +7 -6
  29. package/dist/resolve-reflections.cjs +3 -3
  30. package/dist/resolve-reflections.js +2 -2
  31. package/dist/transformer.cjs +5 -4
  32. package/dist/transformer.js +3 -2
  33. package/dist/transpile.cjs +5 -4
  34. package/dist/transpile.js +4 -3
  35. package/dist/utilities.cjs +11 -10
  36. package/dist/utilities.js +4 -3
  37. package/package.json +4 -4
  38. package/dist/chunk-7J3ZDT6O.cjs +0 -30
  39. package/dist/chunk-GRNJVY7I.cjs +0 -19
  40. package/dist/chunk-IRPJW6HH.js +0 -16
  41. package/dist/chunk-J4SVRFV4.js +0 -127
  42. package/dist/chunk-MNUBEEIW.js +0 -41
  43. package/dist/chunk-QLKLDV3V.cjs +0 -135
  44. package/dist/chunk-VXZTOOL6.cjs +0 -69
  45. package/dist/chunk-XGQQM64U.js +0 -8
@@ -0,0 +1,109 @@
1
+ 'use strict';
2
+
3
+ // ../../node_modules/.pnpm/@deepkit+type-spec@1.0.1_patch_hash=f3c3a4fd486751022d78f17d39a5a79f493bca20b185964ca1aba41fbfc93244/node_modules/@deepkit/type-spec/dist/esm/src/type.js
4
+ exports.TypeNumberBrand = void 0;
5
+ (function(TypeNumberBrand2) {
6
+ TypeNumberBrand2[TypeNumberBrand2["integer"] = 0] = "integer";
7
+ TypeNumberBrand2[TypeNumberBrand2["int8"] = 1] = "int8";
8
+ TypeNumberBrand2[TypeNumberBrand2["int16"] = 2] = "int16";
9
+ TypeNumberBrand2[TypeNumberBrand2["int32"] = 3] = "int32";
10
+ TypeNumberBrand2[TypeNumberBrand2["uint8"] = 4] = "uint8";
11
+ TypeNumberBrand2[TypeNumberBrand2["uint16"] = 5] = "uint16";
12
+ TypeNumberBrand2[TypeNumberBrand2["uint32"] = 6] = "uint32";
13
+ TypeNumberBrand2[TypeNumberBrand2["float"] = 7] = "float";
14
+ TypeNumberBrand2[TypeNumberBrand2["float32"] = 8] = "float32";
15
+ TypeNumberBrand2[TypeNumberBrand2["float64"] = 9] = "float64";
16
+ })(exports.TypeNumberBrand || (exports.TypeNumberBrand = {}));
17
+ exports.ReflectionOp = void 0;
18
+ (function(ReflectionOp2) {
19
+ ReflectionOp2[ReflectionOp2["never"] = 0] = "never";
20
+ ReflectionOp2[ReflectionOp2["any"] = 1] = "any";
21
+ ReflectionOp2[ReflectionOp2["unknown"] = 2] = "unknown";
22
+ ReflectionOp2[ReflectionOp2["void"] = 3] = "void";
23
+ ReflectionOp2[ReflectionOp2["object"] = 4] = "object";
24
+ ReflectionOp2[ReflectionOp2["string"] = 5] = "string";
25
+ ReflectionOp2[ReflectionOp2["number"] = 6] = "number";
26
+ ReflectionOp2[ReflectionOp2["numberBrand"] = 7] = "numberBrand";
27
+ ReflectionOp2[ReflectionOp2["boolean"] = 8] = "boolean";
28
+ ReflectionOp2[ReflectionOp2["bigint"] = 9] = "bigint";
29
+ ReflectionOp2[ReflectionOp2["symbol"] = 10] = "symbol";
30
+ ReflectionOp2[ReflectionOp2["null"] = 11] = "null";
31
+ ReflectionOp2[ReflectionOp2["undefined"] = 12] = "undefined";
32
+ ReflectionOp2[ReflectionOp2["literal"] = 13] = "literal";
33
+ ReflectionOp2[ReflectionOp2["function"] = 14] = "function";
34
+ ReflectionOp2[ReflectionOp2["method"] = 15] = "method";
35
+ ReflectionOp2[ReflectionOp2["methodSignature"] = 16] = "methodSignature";
36
+ ReflectionOp2[ReflectionOp2["parameter"] = 17] = "parameter";
37
+ ReflectionOp2[ReflectionOp2["property"] = 18] = "property";
38
+ ReflectionOp2[ReflectionOp2["propertySignature"] = 19] = "propertySignature";
39
+ ReflectionOp2[ReflectionOp2["class"] = 20] = "class";
40
+ ReflectionOp2[ReflectionOp2["classExtends"] = 21] = "classExtends";
41
+ ReflectionOp2[ReflectionOp2["classReference"] = 22] = "classReference";
42
+ ReflectionOp2[ReflectionOp2["optional"] = 23] = "optional";
43
+ ReflectionOp2[ReflectionOp2["readonly"] = 24] = "readonly";
44
+ ReflectionOp2[ReflectionOp2["public"] = 25] = "public";
45
+ ReflectionOp2[ReflectionOp2["private"] = 26] = "private";
46
+ ReflectionOp2[ReflectionOp2["protected"] = 27] = "protected";
47
+ ReflectionOp2[ReflectionOp2["abstract"] = 28] = "abstract";
48
+ ReflectionOp2[ReflectionOp2["defaultValue"] = 29] = "defaultValue";
49
+ ReflectionOp2[ReflectionOp2["description"] = 30] = "description";
50
+ ReflectionOp2[ReflectionOp2["rest"] = 31] = "rest";
51
+ ReflectionOp2[ReflectionOp2["regexp"] = 32] = "regexp";
52
+ ReflectionOp2[ReflectionOp2["enum"] = 33] = "enum";
53
+ ReflectionOp2[ReflectionOp2["enumMember"] = 34] = "enumMember";
54
+ ReflectionOp2[ReflectionOp2["set"] = 35] = "set";
55
+ ReflectionOp2[ReflectionOp2["map"] = 36] = "map";
56
+ ReflectionOp2[ReflectionOp2["array"] = 37] = "array";
57
+ ReflectionOp2[ReflectionOp2["tuple"] = 38] = "tuple";
58
+ ReflectionOp2[ReflectionOp2["tupleMember"] = 39] = "tupleMember";
59
+ ReflectionOp2[ReflectionOp2["namedTupleMember"] = 40] = "namedTupleMember";
60
+ ReflectionOp2[ReflectionOp2["union"] = 41] = "union";
61
+ ReflectionOp2[ReflectionOp2["intersection"] = 42] = "intersection";
62
+ ReflectionOp2[ReflectionOp2["indexSignature"] = 43] = "indexSignature";
63
+ ReflectionOp2[ReflectionOp2["objectLiteral"] = 44] = "objectLiteral";
64
+ ReflectionOp2[ReflectionOp2["mappedType"] = 45] = "mappedType";
65
+ ReflectionOp2[ReflectionOp2["in"] = 46] = "in";
66
+ ReflectionOp2[ReflectionOp2["frame"] = 47] = "frame";
67
+ ReflectionOp2[ReflectionOp2["moveFrame"] = 48] = "moveFrame";
68
+ ReflectionOp2[ReflectionOp2["return"] = 49] = "return";
69
+ ReflectionOp2[ReflectionOp2["templateLiteral"] = 50] = "templateLiteral";
70
+ ReflectionOp2[ReflectionOp2["date"] = 51] = "date";
71
+ ReflectionOp2[ReflectionOp2["int8Array"] = 52] = "int8Array";
72
+ ReflectionOp2[ReflectionOp2["uint8ClampedArray"] = 53] = "uint8ClampedArray";
73
+ ReflectionOp2[ReflectionOp2["uint8Array"] = 54] = "uint8Array";
74
+ ReflectionOp2[ReflectionOp2["int16Array"] = 55] = "int16Array";
75
+ ReflectionOp2[ReflectionOp2["uint16Array"] = 56] = "uint16Array";
76
+ ReflectionOp2[ReflectionOp2["int32Array"] = 57] = "int32Array";
77
+ ReflectionOp2[ReflectionOp2["uint32Array"] = 58] = "uint32Array";
78
+ ReflectionOp2[ReflectionOp2["float32Array"] = 59] = "float32Array";
79
+ ReflectionOp2[ReflectionOp2["float64Array"] = 60] = "float64Array";
80
+ ReflectionOp2[ReflectionOp2["bigInt64Array"] = 61] = "bigInt64Array";
81
+ ReflectionOp2[ReflectionOp2["arrayBuffer"] = 62] = "arrayBuffer";
82
+ ReflectionOp2[ReflectionOp2["promise"] = 63] = "promise";
83
+ ReflectionOp2[ReflectionOp2["arg"] = 64] = "arg";
84
+ ReflectionOp2[ReflectionOp2["typeParameter"] = 65] = "typeParameter";
85
+ ReflectionOp2[ReflectionOp2["typeParameterDefault"] = 66] = "typeParameterDefault";
86
+ ReflectionOp2[ReflectionOp2["var"] = 67] = "var";
87
+ ReflectionOp2[ReflectionOp2["loads"] = 68] = "loads";
88
+ ReflectionOp2[ReflectionOp2["indexAccess"] = 69] = "indexAccess";
89
+ ReflectionOp2[ReflectionOp2["keyof"] = 70] = "keyof";
90
+ ReflectionOp2[ReflectionOp2["infer"] = 71] = "infer";
91
+ ReflectionOp2[ReflectionOp2["typeof"] = 72] = "typeof";
92
+ ReflectionOp2[ReflectionOp2["condition"] = 73] = "condition";
93
+ ReflectionOp2[ReflectionOp2["jumpCondition"] = 74] = "jumpCondition";
94
+ ReflectionOp2[ReflectionOp2["jump"] = 75] = "jump";
95
+ ReflectionOp2[ReflectionOp2["call"] = 76] = "call";
96
+ ReflectionOp2[ReflectionOp2["inline"] = 77] = "inline";
97
+ ReflectionOp2[ReflectionOp2["inlineCall"] = 78] = "inlineCall";
98
+ ReflectionOp2[ReflectionOp2["distribute"] = 79] = "distribute";
99
+ ReflectionOp2[ReflectionOp2["extends"] = 80] = "extends";
100
+ ReflectionOp2[ReflectionOp2["widen"] = 81] = "widen";
101
+ ReflectionOp2[ReflectionOp2["static"] = 82] = "static";
102
+ ReflectionOp2[ReflectionOp2["mappedType2"] = 83] = "mappedType2";
103
+ ReflectionOp2[ReflectionOp2["functionReference"] = 84] = "functionReference";
104
+ ReflectionOp2[ReflectionOp2["callSignature"] = 85] = "callSignature";
105
+ ReflectionOp2[ReflectionOp2["typeName"] = 86] = "typeName";
106
+ ReflectionOp2[ReflectionOp2["implements"] = 87] = "implements";
107
+ ReflectionOp2[ReflectionOp2["nominal"] = 88] = "nominal";
108
+ ReflectionOp2[ReflectionOp2["tags"] = 89] = "tags";
109
+ })(exports.ReflectionOp || (exports.ReflectionOp = {}));
@@ -1,11 +1,11 @@
1
1
  'use strict';
2
2
 
3
- var chunkGRNJVY7I_cjs = require('./chunk-GRNJVY7I.cjs');
3
+ var chunkBGYQAVKQ_cjs = require('./chunk-BGYQAVKQ.cjs');
4
4
  var joinPaths = require('@stryke/path/join-paths');
5
5
 
6
6
  function getReflectionsPath(context) {
7
7
  return joinPaths.joinPaths(context.dataPath, "reflections");
8
8
  }
9
- chunkGRNJVY7I_cjs.__name(getReflectionsPath, "getReflectionsPath");
9
+ chunkBGYQAVKQ_cjs.__name(getReflectionsPath, "getReflectionsPath");
10
10
 
11
11
  exports.getReflectionsPath = getReflectionsPath;
@@ -0,0 +1,13 @@
1
+ 'use strict';
2
+
3
+ var __defProp = Object.defineProperty;
4
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
5
+ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
6
+ get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
7
+ }) : x)(function(x) {
8
+ if (typeof require !== "undefined") return require.apply(this, arguments);
9
+ throw Error('Dynamic require of "' + x + '" is not supported');
10
+ });
11
+
12
+ exports.__name = __name;
13
+ exports.__require = __require;
@@ -0,0 +1,135 @@
1
+ 'use strict';
2
+
3
+ var chunk4UQ4UDET_cjs = require('./chunk-4UQ4UDET.cjs');
4
+ var chunkBGYQAVKQ_cjs = require('./chunk-BGYQAVKQ.cjs');
5
+ var getUnique = require('@stryke/helpers/get-unique');
6
+ var stormJson = require('@stryke/json/storm-json');
7
+ var isNull = require('@stryke/type-checks/is-null');
8
+ var isString = require('@stryke/type-checks/is-string');
9
+ var isUndefined = require('@stryke/type-checks/is-undefined');
10
+
11
+ function stringifyDefaultValue(property, value) {
12
+ return stringifyValue(property.type, value ?? property.getDefaultValue());
13
+ }
14
+ chunkBGYQAVKQ_cjs.__name(stringifyDefaultValue, "stringifyDefaultValue");
15
+ function stringifyStringValue(value) {
16
+ return `"${String(value).replaceAll('"', '\\"')}"`;
17
+ }
18
+ chunkBGYQAVKQ_cjs.__name(stringifyStringValue, "stringifyStringValue");
19
+ function stringifyValue(type, value) {
20
+ return isUndefined.isUndefined(value) ? "undefined" : isNull.isNull(value) ? "null" : type.kind === chunk4UQ4UDET_cjs.ReflectionKind.boolean ? String(value).trim().toLowerCase() === "true" ? "true" : "false" : type.kind === chunk4UQ4UDET_cjs.ReflectionKind.string || type.kind === chunk4UQ4UDET_cjs.ReflectionKind.literal && isString.isString(type.literal) ? stringifyStringValue(value) : type.kind === chunk4UQ4UDET_cjs.ReflectionKind.enum ? getEnumReflectionType(type).kind === chunk4UQ4UDET_cjs.ReflectionKind.string ? stringifyStringValue(value) : `${String(value)}` : type.kind === chunk4UQ4UDET_cjs.ReflectionKind.union ? isStringUnion(type) ? stringifyStringValue(value) : `${String(value)}` : type.kind === chunk4UQ4UDET_cjs.ReflectionKind.array ? stringifyStringValue(stormJson.StormJSON.stringify(value)) : type.kind === chunk4UQ4UDET_cjs.ReflectionKind.object || type.kind === chunk4UQ4UDET_cjs.ReflectionKind.objectLiteral ? stormJson.StormJSON.stringify(value) : type.kind === chunk4UQ4UDET_cjs.ReflectionKind.property || type.kind === chunk4UQ4UDET_cjs.ReflectionKind.parameter ? stringifyValue(type.type, value) : String(value);
21
+ }
22
+ chunkBGYQAVKQ_cjs.__name(stringifyValue, "stringifyValue");
23
+ function getEnumReflectionType(type) {
24
+ if (type.kind !== chunk4UQ4UDET_cjs.ReflectionKind.enum) {
25
+ throw new Error(`Expected a TypeEnum, but received ${type.kind}.`);
26
+ }
27
+ const unique = getUnique.getUniqueBy(type.values.filter((value) => value !== void 0 && value !== null), (enumMember) => isString.isString(enumMember) ? {
28
+ kind: chunk4UQ4UDET_cjs.ReflectionKind.string
29
+ } : {
30
+ kind: chunk4UQ4UDET_cjs.ReflectionKind.number
31
+ });
32
+ if (unique.length === 0) {
33
+ throw new Error(`No valid enum members could be found.`);
34
+ }
35
+ return unique[0] && isString.isString(unique[0]) ? {
36
+ kind: chunk4UQ4UDET_cjs.ReflectionKind.string
37
+ } : {
38
+ kind: chunk4UQ4UDET_cjs.ReflectionKind.number
39
+ };
40
+ }
41
+ chunkBGYQAVKQ_cjs.__name(getEnumReflectionType, "getEnumReflectionType");
42
+ function getUnionTypes(type) {
43
+ if (type.kind === chunk4UQ4UDET_cjs.ReflectionKind.union && type.types.length > 0) {
44
+ return getUnique.getUniqueBy(type.types, (member) => member.kind);
45
+ }
46
+ throw new Error(`Expected a TypeUnion, but received ${type.kind}.`);
47
+ }
48
+ chunkBGYQAVKQ_cjs.__name(getUnionTypes, "getUnionTypes");
49
+ function isStringUnion(type) {
50
+ return getUnionTypes(type).some((member) => member.kind === chunk4UQ4UDET_cjs.ReflectionKind.string || member.kind === chunk4UQ4UDET_cjs.ReflectionKind.literal && isString.isString(member.literal));
51
+ }
52
+ chunkBGYQAVKQ_cjs.__name(isStringUnion, "isStringUnion");
53
+ function kindToName(kind) {
54
+ if (kind === chunk4UQ4UDET_cjs.ReflectionKind.void) {
55
+ return "void";
56
+ } else if (kind === chunk4UQ4UDET_cjs.ReflectionKind.never) {
57
+ return "never";
58
+ } else if (kind === chunk4UQ4UDET_cjs.ReflectionKind.null) {
59
+ return "null";
60
+ } else if (kind === chunk4UQ4UDET_cjs.ReflectionKind.undefined) {
61
+ return "undefined";
62
+ } else if (kind === chunk4UQ4UDET_cjs.ReflectionKind.symbol) {
63
+ return "symbol";
64
+ } else if (kind === chunk4UQ4UDET_cjs.ReflectionKind.bigint) {
65
+ return "bigint";
66
+ } else if (kind === chunk4UQ4UDET_cjs.ReflectionKind.number) {
67
+ return "number";
68
+ } else if (kind === chunk4UQ4UDET_cjs.ReflectionKind.string) {
69
+ return "string";
70
+ } else if (kind === chunk4UQ4UDET_cjs.ReflectionKind.boolean) {
71
+ return "boolean";
72
+ } else if (kind === chunk4UQ4UDET_cjs.ReflectionKind.literal) {
73
+ return "literal";
74
+ } else if (kind === chunk4UQ4UDET_cjs.ReflectionKind.class) {
75
+ return "class";
76
+ } else if (kind === chunk4UQ4UDET_cjs.ReflectionKind.array) {
77
+ return "array";
78
+ } else if (kind === chunk4UQ4UDET_cjs.ReflectionKind.object) {
79
+ return "object";
80
+ } else if (kind === chunk4UQ4UDET_cjs.ReflectionKind.objectLiteral) {
81
+ return "objectLiteral";
82
+ } else if (kind === chunk4UQ4UDET_cjs.ReflectionKind.union) {
83
+ return "union";
84
+ } else if (kind === chunk4UQ4UDET_cjs.ReflectionKind.enum) {
85
+ return "enum";
86
+ } else if (kind === chunk4UQ4UDET_cjs.ReflectionKind.regexp) {
87
+ return "regexp";
88
+ } else if (kind === chunk4UQ4UDET_cjs.ReflectionKind.templateLiteral) {
89
+ return "templateLiteral";
90
+ } else if (kind === chunk4UQ4UDET_cjs.ReflectionKind.property) {
91
+ return "property";
92
+ } else if (kind === chunk4UQ4UDET_cjs.ReflectionKind.method) {
93
+ return "method";
94
+ } else if (kind === chunk4UQ4UDET_cjs.ReflectionKind.function) {
95
+ return "function";
96
+ } else if (kind === chunk4UQ4UDET_cjs.ReflectionKind.parameter) {
97
+ return "parameter";
98
+ } else if (kind === chunk4UQ4UDET_cjs.ReflectionKind.promise) {
99
+ return "promise";
100
+ } else if (kind === chunk4UQ4UDET_cjs.ReflectionKind.typeParameter) {
101
+ return "typeParameter";
102
+ } else if (kind === chunk4UQ4UDET_cjs.ReflectionKind.tuple) {
103
+ return "tuple";
104
+ } else if (kind === chunk4UQ4UDET_cjs.ReflectionKind.tupleMember) {
105
+ return "tupleMember";
106
+ } else if (kind === chunk4UQ4UDET_cjs.ReflectionKind.enumMember) {
107
+ return "enumMember";
108
+ } else if (kind === chunk4UQ4UDET_cjs.ReflectionKind.rest) {
109
+ return "rest";
110
+ } else if (kind === chunk4UQ4UDET_cjs.ReflectionKind.indexSignature) {
111
+ return "indexSignature";
112
+ } else if (kind === chunk4UQ4UDET_cjs.ReflectionKind.propertySignature) {
113
+ return "propertySignature";
114
+ } else if (kind === chunk4UQ4UDET_cjs.ReflectionKind.methodSignature) {
115
+ return "methodSignature";
116
+ } else if (kind === chunk4UQ4UDET_cjs.ReflectionKind.infer) {
117
+ return "infer";
118
+ } else if (kind === chunk4UQ4UDET_cjs.ReflectionKind.callSignature) {
119
+ return "callSignature";
120
+ } else if (kind === chunk4UQ4UDET_cjs.ReflectionKind.any) {
121
+ return "any";
122
+ } else if (kind === chunk4UQ4UDET_cjs.ReflectionKind.intersection) {
123
+ return "intersection";
124
+ }
125
+ return "unknown";
126
+ }
127
+ chunkBGYQAVKQ_cjs.__name(kindToName, "kindToName");
128
+
129
+ exports.getEnumReflectionType = getEnumReflectionType;
130
+ exports.getUnionTypes = getUnionTypes;
131
+ exports.isStringUnion = isStringUnion;
132
+ exports.kindToName = kindToName;
133
+ exports.stringifyDefaultValue = stringifyDefaultValue;
134
+ exports.stringifyStringValue = stringifyStringValue;
135
+ exports.stringifyValue = stringifyValue;
@@ -1,5 +1,5 @@
1
- import { transpile } from './chunk-LPLPOVLC.js';
2
- import { __name } from './chunk-IRPJW6HH.js';
1
+ import { transpile } from './chunk-JSH5MVQG.js';
2
+ import { __name } from './chunk-3GQAWCBQ.js';
3
3
  import { isString } from '@stryke/type-checks';
4
4
  import { DiagnosticCategory } from 'typescript';
5
5
 
@@ -1,5 +1,5 @@
1
- import { createTransformer, createDeclarationTransformer } from './chunk-MNUBEEIW.js';
2
- import { __name } from './chunk-IRPJW6HH.js';
1
+ import { createTransformer, createDeclarationTransformer } from './chunk-W423FBJ2.js';
2
+ import { __name } from './chunk-3GQAWCBQ.js';
3
3
  import ts from 'typescript';
4
4
 
5
5
  function transpile(context, code, id) {
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- var chunkVXZTOOL6_cjs = require('./chunk-VXZTOOL6.cjs');
4
- var chunkGRNJVY7I_cjs = require('./chunk-GRNJVY7I.cjs');
3
+ var chunkO2LKJ62Q_cjs = require('./chunk-O2LKJ62Q.cjs');
4
+ var chunkBGYQAVKQ_cjs = require('./chunk-BGYQAVKQ.cjs');
5
5
  var ts = require('typescript');
6
6
 
7
7
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
@@ -9,8 +9,8 @@ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
9
9
  var ts__default = /*#__PURE__*/_interopDefault(ts);
10
10
 
11
11
  function transpile(context, code, id) {
12
- const transformer = chunkVXZTOOL6_cjs.createTransformer(context);
13
- const declarationTransformer = chunkVXZTOOL6_cjs.createDeclarationTransformer(context);
12
+ const transformer = chunkO2LKJ62Q_cjs.createTransformer(context);
13
+ const declarationTransformer = chunkO2LKJ62Q_cjs.createDeclarationTransformer(context);
14
14
  return ts__default.default.transpileModule(code, {
15
15
  compilerOptions: {
16
16
  ...context.tsconfig.options
@@ -26,6 +26,6 @@ function transpile(context, code, id) {
26
26
  }
27
27
  });
28
28
  }
29
- chunkGRNJVY7I_cjs.__name(transpile, "transpile");
29
+ chunkBGYQAVKQ_cjs.__name(transpile, "transpile");
30
30
 
31
31
  exports.transpile = transpile;
@@ -0,0 +1,127 @@
1
+ import { ReflectionKind } from './chunk-U7WEV6HK.js';
2
+ import { __name } from './chunk-3GQAWCBQ.js';
3
+ import { getUniqueBy } from '@stryke/helpers/get-unique';
4
+ import { StormJSON } from '@stryke/json/storm-json';
5
+ import { isNull } from '@stryke/type-checks/is-null';
6
+ import { isString } from '@stryke/type-checks/is-string';
7
+ import { isUndefined } from '@stryke/type-checks/is-undefined';
8
+
9
+ function stringifyDefaultValue(property, value) {
10
+ return stringifyValue(property.type, value ?? property.getDefaultValue());
11
+ }
12
+ __name(stringifyDefaultValue, "stringifyDefaultValue");
13
+ function stringifyStringValue(value) {
14
+ return `"${String(value).replaceAll('"', '\\"')}"`;
15
+ }
16
+ __name(stringifyStringValue, "stringifyStringValue");
17
+ function stringifyValue(type, value) {
18
+ return isUndefined(value) ? "undefined" : isNull(value) ? "null" : type.kind === ReflectionKind.boolean ? String(value).trim().toLowerCase() === "true" ? "true" : "false" : type.kind === ReflectionKind.string || type.kind === ReflectionKind.literal && isString(type.literal) ? stringifyStringValue(value) : type.kind === ReflectionKind.enum ? getEnumReflectionType(type).kind === ReflectionKind.string ? stringifyStringValue(value) : `${String(value)}` : type.kind === ReflectionKind.union ? isStringUnion(type) ? stringifyStringValue(value) : `${String(value)}` : type.kind === ReflectionKind.array ? stringifyStringValue(StormJSON.stringify(value)) : type.kind === ReflectionKind.object || type.kind === ReflectionKind.objectLiteral ? StormJSON.stringify(value) : type.kind === ReflectionKind.property || type.kind === ReflectionKind.parameter ? stringifyValue(type.type, value) : String(value);
19
+ }
20
+ __name(stringifyValue, "stringifyValue");
21
+ function getEnumReflectionType(type) {
22
+ if (type.kind !== ReflectionKind.enum) {
23
+ throw new Error(`Expected a TypeEnum, but received ${type.kind}.`);
24
+ }
25
+ const unique = getUniqueBy(type.values.filter((value) => value !== void 0 && value !== null), (enumMember) => isString(enumMember) ? {
26
+ kind: ReflectionKind.string
27
+ } : {
28
+ kind: ReflectionKind.number
29
+ });
30
+ if (unique.length === 0) {
31
+ throw new Error(`No valid enum members could be found.`);
32
+ }
33
+ return unique[0] && isString(unique[0]) ? {
34
+ kind: ReflectionKind.string
35
+ } : {
36
+ kind: ReflectionKind.number
37
+ };
38
+ }
39
+ __name(getEnumReflectionType, "getEnumReflectionType");
40
+ function getUnionTypes(type) {
41
+ if (type.kind === ReflectionKind.union && type.types.length > 0) {
42
+ return getUniqueBy(type.types, (member) => member.kind);
43
+ }
44
+ throw new Error(`Expected a TypeUnion, but received ${type.kind}.`);
45
+ }
46
+ __name(getUnionTypes, "getUnionTypes");
47
+ function isStringUnion(type) {
48
+ return getUnionTypes(type).some((member) => member.kind === ReflectionKind.string || member.kind === ReflectionKind.literal && isString(member.literal));
49
+ }
50
+ __name(isStringUnion, "isStringUnion");
51
+ function kindToName(kind) {
52
+ if (kind === ReflectionKind.void) {
53
+ return "void";
54
+ } else if (kind === ReflectionKind.never) {
55
+ return "never";
56
+ } else if (kind === ReflectionKind.null) {
57
+ return "null";
58
+ } else if (kind === ReflectionKind.undefined) {
59
+ return "undefined";
60
+ } else if (kind === ReflectionKind.symbol) {
61
+ return "symbol";
62
+ } else if (kind === ReflectionKind.bigint) {
63
+ return "bigint";
64
+ } else if (kind === ReflectionKind.number) {
65
+ return "number";
66
+ } else if (kind === ReflectionKind.string) {
67
+ return "string";
68
+ } else if (kind === ReflectionKind.boolean) {
69
+ return "boolean";
70
+ } else if (kind === ReflectionKind.literal) {
71
+ return "literal";
72
+ } else if (kind === ReflectionKind.class) {
73
+ return "class";
74
+ } else if (kind === ReflectionKind.array) {
75
+ return "array";
76
+ } else if (kind === ReflectionKind.object) {
77
+ return "object";
78
+ } else if (kind === ReflectionKind.objectLiteral) {
79
+ return "objectLiteral";
80
+ } else if (kind === ReflectionKind.union) {
81
+ return "union";
82
+ } else if (kind === ReflectionKind.enum) {
83
+ return "enum";
84
+ } else if (kind === ReflectionKind.regexp) {
85
+ return "regexp";
86
+ } else if (kind === ReflectionKind.templateLiteral) {
87
+ return "templateLiteral";
88
+ } else if (kind === ReflectionKind.property) {
89
+ return "property";
90
+ } else if (kind === ReflectionKind.method) {
91
+ return "method";
92
+ } else if (kind === ReflectionKind.function) {
93
+ return "function";
94
+ } else if (kind === ReflectionKind.parameter) {
95
+ return "parameter";
96
+ } else if (kind === ReflectionKind.promise) {
97
+ return "promise";
98
+ } else if (kind === ReflectionKind.typeParameter) {
99
+ return "typeParameter";
100
+ } else if (kind === ReflectionKind.tuple) {
101
+ return "tuple";
102
+ } else if (kind === ReflectionKind.tupleMember) {
103
+ return "tupleMember";
104
+ } else if (kind === ReflectionKind.enumMember) {
105
+ return "enumMember";
106
+ } else if (kind === ReflectionKind.rest) {
107
+ return "rest";
108
+ } else if (kind === ReflectionKind.indexSignature) {
109
+ return "indexSignature";
110
+ } else if (kind === ReflectionKind.propertySignature) {
111
+ return "propertySignature";
112
+ } else if (kind === ReflectionKind.methodSignature) {
113
+ return "methodSignature";
114
+ } else if (kind === ReflectionKind.infer) {
115
+ return "infer";
116
+ } else if (kind === ReflectionKind.callSignature) {
117
+ return "callSignature";
118
+ } else if (kind === ReflectionKind.any) {
119
+ return "any";
120
+ } else if (kind === ReflectionKind.intersection) {
121
+ return "intersection";
122
+ }
123
+ return "unknown";
124
+ }
125
+ __name(kindToName, "kindToName");
126
+
127
+ export { getEnumReflectionType, getUnionTypes, isStringUnion, kindToName, stringifyDefaultValue, stringifyStringValue, stringifyValue };