quicktype 18.0.6 → 19.0.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.
Files changed (174) hide show
  1. package/README.md +1 -1
  2. package/dist/{cli/CompressedJSONFromStream.d.ts → CompressedJSONFromStream.d.ts} +1 -1
  3. package/dist/{cli/CompressedJSONFromStream.js → CompressedJSONFromStream.js} +2 -2
  4. package/dist/{cli/GraphQLIntrospection.d.ts → GraphQLIntrospection.d.ts} +0 -0
  5. package/dist/{cli/GraphQLIntrospection.js → GraphQLIntrospection.js} +1 -1
  6. package/dist/{cli/TypeSource.d.ts → TypeSource.d.ts} +2 -2
  7. package/dist/{cli/TypeSource.js → TypeSource.js} +0 -0
  8. package/dist/{cli/URLGrammar.d.ts → URLGrammar.d.ts} +0 -0
  9. package/dist/{cli/URLGrammar.js → URLGrammar.js} +1 -1
  10. package/dist/{cli/index.d.ts → index.d.ts} +1 -1
  11. package/dist/{cli/index.js → index.js} +4 -5
  12. package/package.json +61 -77
  13. package/dist/quicktype-core/Annotation.d.ts +0 -8
  14. package/dist/quicktype-core/Annotation.js +0 -16
  15. package/dist/quicktype-core/ConvenienceRenderer.d.ts +0 -138
  16. package/dist/quicktype-core/ConvenienceRenderer.js +0 -668
  17. package/dist/quicktype-core/DateTime.d.ts +0 -10
  18. package/dist/quicktype-core/DateTime.js +0 -57
  19. package/dist/quicktype-core/DeclarationIR.d.ts +0 -14
  20. package/dist/quicktype-core/DeclarationIR.js +0 -167
  21. package/dist/quicktype-core/EncodedMarkovChain.d.ts +0 -1
  22. package/dist/quicktype-core/EncodedMarkovChain.js +0 -4
  23. package/dist/quicktype-core/GatherNames.d.ts +0 -2
  24. package/dist/quicktype-core/GatherNames.js +0 -333
  25. package/dist/quicktype-core/Graph.d.ts +0 -12
  26. package/dist/quicktype-core/Graph.js +0 -220
  27. package/dist/quicktype-core/GraphRewriting.d.ts +0 -87
  28. package/dist/quicktype-core/GraphRewriting.js +0 -421
  29. package/dist/quicktype-core/MakeTransformations.d.ts +0 -4
  30. package/dist/quicktype-core/MakeTransformations.js +0 -193
  31. package/dist/quicktype-core/MarkovChain.d.ts +0 -15
  32. package/dist/quicktype-core/MarkovChain.js +0 -154
  33. package/dist/quicktype-core/Messages.d.ts +0 -294
  34. package/dist/quicktype-core/Messages.js +0 -105
  35. package/dist/quicktype-core/Naming.d.ts +0 -64
  36. package/dist/quicktype-core/Naming.js +0 -356
  37. package/dist/quicktype-core/Renderer.d.ts +0 -50
  38. package/dist/quicktype-core/Renderer.js +0 -274
  39. package/dist/quicktype-core/RendererOptions.d.ts +0 -71
  40. package/dist/quicktype-core/RendererOptions.js +0 -141
  41. package/dist/quicktype-core/Run.d.ts +0 -174
  42. package/dist/quicktype-core/Run.js +0 -393
  43. package/dist/quicktype-core/Source.d.ts +0 -65
  44. package/dist/quicktype-core/Source.js +0 -204
  45. package/dist/quicktype-core/TargetLanguage.d.ts +0 -34
  46. package/dist/quicktype-core/TargetLanguage.js +0 -66
  47. package/dist/quicktype-core/Transformers.d.ts +0 -209
  48. package/dist/quicktype-core/Transformers.js +0 -836
  49. package/dist/quicktype-core/Type.d.ts +0 -206
  50. package/dist/quicktype-core/Type.js +0 -716
  51. package/dist/quicktype-core/TypeBuilder.d.ts +0 -61
  52. package/dist/quicktype-core/TypeBuilder.js +0 -324
  53. package/dist/quicktype-core/TypeGraph.d.ts +0 -75
  54. package/dist/quicktype-core/TypeGraph.js +0 -420
  55. package/dist/quicktype-core/TypeUtils.d.ts +0 -33
  56. package/dist/quicktype-core/TypeUtils.js +0 -230
  57. package/dist/quicktype-core/UnifyClasses.d.ts +0 -16
  58. package/dist/quicktype-core/UnifyClasses.js +0 -159
  59. package/dist/quicktype-core/UnionBuilder.d.ts +0 -49
  60. package/dist/quicktype-core/UnionBuilder.js +0 -282
  61. package/dist/quicktype-core/attributes/AccessorNames.d.ts +0 -18
  62. package/dist/quicktype-core/attributes/AccessorNames.js +0 -182
  63. package/dist/quicktype-core/attributes/Constraints.d.ts +0 -38
  64. package/dist/quicktype-core/attributes/Constraints.js +0 -172
  65. package/dist/quicktype-core/attributes/Description.d.ts +0 -9
  66. package/dist/quicktype-core/attributes/Description.js +0 -97
  67. package/dist/quicktype-core/attributes/EnumValues.d.ts +0 -8
  68. package/dist/quicktype-core/attributes/EnumValues.js +0 -31
  69. package/dist/quicktype-core/attributes/StringTypes.d.ts +0 -28
  70. package/dist/quicktype-core/attributes/StringTypes.js +0 -189
  71. package/dist/quicktype-core/attributes/TypeAttributes.d.ts +0 -34
  72. package/dist/quicktype-core/attributes/TypeAttributes.js +0 -119
  73. package/dist/quicktype-core/attributes/TypeNames.d.ts +0 -46
  74. package/dist/quicktype-core/attributes/TypeNames.js +0 -274
  75. package/dist/quicktype-core/attributes/URIAttributes.d.ts +0 -8
  76. package/dist/quicktype-core/attributes/URIAttributes.js +0 -85
  77. package/dist/quicktype-core/index.d.ts +0 -48
  78. package/dist/quicktype-core/index.js +0 -180
  79. package/dist/quicktype-core/input/CompressedJSON.d.ts +0 -69
  80. package/dist/quicktype-core/input/CompressedJSON.js +0 -276
  81. package/dist/quicktype-core/input/FetchingJSONSchemaStore.d.ts +0 -6
  82. package/dist/quicktype-core/input/FetchingJSONSchemaStore.js +0 -18
  83. package/dist/quicktype-core/input/Inference.d.ts +0 -22
  84. package/dist/quicktype-core/input/Inference.js +0 -240
  85. package/dist/quicktype-core/input/Inputs.d.ts +0 -48
  86. package/dist/quicktype-core/input/Inputs.js +0 -145
  87. package/dist/quicktype-core/input/JSONSchemaInput.d.ts +0 -91
  88. package/dist/quicktype-core/input/JSONSchemaInput.js +0 -1041
  89. package/dist/quicktype-core/input/JSONSchemaStore.d.ts +0 -8
  90. package/dist/quicktype-core/input/JSONSchemaStore.js +0 -36
  91. package/dist/quicktype-core/input/PostmanCollection.d.ts +0 -5
  92. package/dist/quicktype-core/input/PostmanCollection.js +0 -60
  93. package/dist/quicktype-core/input/io/NodeIO.d.ts +0 -3
  94. package/dist/quicktype-core/input/io/NodeIO.js +0 -87
  95. package/dist/quicktype-core/input/io/get-stream/buffer-stream.d.ts +0 -2
  96. package/dist/quicktype-core/input/io/get-stream/buffer-stream.js +0 -45
  97. package/dist/quicktype-core/input/io/get-stream/index.d.ts +0 -9
  98. package/dist/quicktype-core/input/io/get-stream/index.js +0 -52
  99. package/dist/quicktype-core/language/All.d.ts +0 -3
  100. package/dist/quicktype-core/language/All.js +0 -57
  101. package/dist/quicktype-core/language/CPlusPlus.d.ts +0 -241
  102. package/dist/quicktype-core/language/CPlusPlus.js +0 -1847
  103. package/dist/quicktype-core/language/CSharp.d.ts +0 -201
  104. package/dist/quicktype-core/language/CSharp.js +0 -1850
  105. package/dist/quicktype-core/language/Crystal.d.ts +0 -37
  106. package/dist/quicktype-core/language/Crystal.js +0 -337
  107. package/dist/quicktype-core/language/Dart.d.ts +0 -66
  108. package/dist/quicktype-core/language/Dart.js +0 -576
  109. package/dist/quicktype-core/language/Elm.d.ts +0 -58
  110. package/dist/quicktype-core/language/Elm.js +0 -522
  111. package/dist/quicktype-core/language/Golang.d.ts +0 -51
  112. package/dist/quicktype-core/language/Golang.js +0 -460
  113. package/dist/quicktype-core/language/Haskell.d.ts +0 -56
  114. package/dist/quicktype-core/language/Haskell.js +0 -411
  115. package/dist/quicktype-core/language/JSONSchema.d.ts +0 -31
  116. package/dist/quicktype-core/language/JSONSchema.js +0 -169
  117. package/dist/quicktype-core/language/Java.d.ts +0 -125
  118. package/dist/quicktype-core/language/Java.js +0 -1081
  119. package/dist/quicktype-core/language/JavaScript.d.ts +0 -68
  120. package/dist/quicktype-core/language/JavaScript.js +0 -435
  121. package/dist/quicktype-core/language/JavaScriptPropTypes.d.ts +0 -40
  122. package/dist/quicktype-core/language/JavaScriptPropTypes.js +0 -213
  123. package/dist/quicktype-core/language/JavaScriptUnicodeMaps.d.ts +0 -2
  124. package/dist/quicktype-core/language/JavaScriptUnicodeMaps.js +0 -134
  125. package/dist/quicktype-core/language/Kotlin.d.ts +0 -109
  126. package/dist/quicktype-core/language/Kotlin.js +0 -832
  127. package/dist/quicktype-core/language/Objective-C.d.ts +0 -79
  128. package/dist/quicktype-core/language/Objective-C.js +0 -777
  129. package/dist/quicktype-core/language/Php.d.ts +0 -80
  130. package/dist/quicktype-core/language/Php.js +0 -702
  131. package/dist/quicktype-core/language/Pike.d.ts +0 -37
  132. package/dist/quicktype-core/language/Pike.js +0 -276
  133. package/dist/quicktype-core/language/Python.d.ts +0 -107
  134. package/dist/quicktype-core/language/Python.js +0 -969
  135. package/dist/quicktype-core/language/Rust.d.ts +0 -56
  136. package/dist/quicktype-core/language/Rust.js +0 -309
  137. package/dist/quicktype-core/language/Swift.d.ts +0 -96
  138. package/dist/quicktype-core/language/Swift.js +0 -1211
  139. package/dist/quicktype-core/language/TypeScriptFlow.d.ts +0 -77
  140. package/dist/quicktype-core/language/TypeScriptFlow.js +0 -286
  141. package/dist/quicktype-core/language/ruby/index.d.ts +0 -52
  142. package/dist/quicktype-core/language/ruby/index.js +0 -557
  143. package/dist/quicktype-core/language/ruby/keywords.d.ts +0 -3
  144. package/dist/quicktype-core/language/ruby/keywords.js +0 -358
  145. package/dist/quicktype-core/rewrites/CombineClasses.d.ts +0 -3
  146. package/dist/quicktype-core/rewrites/CombineClasses.js +0 -125
  147. package/dist/quicktype-core/rewrites/ExpandStrings.d.ts +0 -4
  148. package/dist/quicktype-core/rewrites/ExpandStrings.js +0 -143
  149. package/dist/quicktype-core/rewrites/FlattenStrings.d.ts +0 -3
  150. package/dist/quicktype-core/rewrites/FlattenStrings.js +0 -45
  151. package/dist/quicktype-core/rewrites/FlattenUnions.d.ts +0 -3
  152. package/dist/quicktype-core/rewrites/FlattenUnions.js +0 -47
  153. package/dist/quicktype-core/rewrites/InferMaps.d.ts +0 -3
  154. package/dist/quicktype-core/rewrites/InferMaps.js +0 -117
  155. package/dist/quicktype-core/rewrites/ReplaceObjectType.d.ts +0 -3
  156. package/dist/quicktype-core/rewrites/ReplaceObjectType.js +0 -60
  157. package/dist/quicktype-core/rewrites/ResolveIntersections.d.ts +0 -3
  158. package/dist/quicktype-core/rewrites/ResolveIntersections.js +0 -244
  159. package/dist/quicktype-core/support/Acronyms.d.ts +0 -10
  160. package/dist/quicktype-core/support/Acronyms.js +0 -1128
  161. package/dist/quicktype-core/support/Chance.d.ts +0 -38
  162. package/dist/quicktype-core/support/Chance.js +0 -2146
  163. package/dist/quicktype-core/support/Converters.d.ts +0 -6
  164. package/dist/quicktype-core/support/Converters.js +0 -16
  165. package/dist/quicktype-core/support/Strings.d.ts +0 -44
  166. package/dist/quicktype-core/support/Strings.js +0 -525
  167. package/dist/quicktype-core/support/Support.d.ts +0 -29
  168. package/dist/quicktype-core/support/Support.js +0 -162
  169. package/dist/quicktype-graphql-input/GraphQLSchema.d.ts +0 -645
  170. package/dist/quicktype-graphql-input/GraphQLSchema.js +0 -39
  171. package/dist/quicktype-graphql-input/index.d.ts +0 -17
  172. package/dist/quicktype-graphql-input/index.js +0 -407
  173. package/dist/quicktype-typescript-input/index.d.ts +0 -2
  174. package/dist/quicktype-typescript-input/index.js +0 -98
@@ -1,213 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.JavaScriptPropTypesRenderer = exports.JavaScriptPropTypesTargetLanguage = exports.javaScriptPropTypesOptions = void 0;
4
- const TargetLanguage_1 = require("../TargetLanguage");
5
- const RendererOptions_1 = require("../RendererOptions");
6
- const ConvenienceRenderer_1 = require("../ConvenienceRenderer");
7
- const Naming_1 = require("../Naming");
8
- const Acronyms_1 = require("../support/Acronyms");
9
- const __1 = require("..");
10
- const Strings_1 = require("../support/Strings");
11
- const JavaScriptUnicodeMaps_1 = require("./JavaScriptUnicodeMaps");
12
- const JavaScript_1 = require("./JavaScript");
13
- const Converters_1 = require("../support/Converters");
14
- const TypeUtils_1 = require("../TypeUtils");
15
- const collection_utils_1 = require("collection-utils");
16
- const Type_1 = require("../Type");
17
- exports.javaScriptPropTypesOptions = {
18
- acronymStyle: (0, Acronyms_1.acronymOption)(Acronyms_1.AcronymStyleOptions.Pascal),
19
- converters: (0, Converters_1.convertersOption)(),
20
- moduleSystem: new RendererOptions_1.EnumOption("module-system", "Which module system to use", [
21
- ["common-js", false],
22
- ["es6", true]
23
- ], "es6")
24
- };
25
- class JavaScriptPropTypesTargetLanguage extends TargetLanguage_1.TargetLanguage {
26
- getOptions() {
27
- return [exports.javaScriptPropTypesOptions.acronymStyle, exports.javaScriptPropTypesOptions.converters];
28
- }
29
- constructor(displayName = "JavaScript PropTypes", names = ["javascript-prop-types"], extension = "js") {
30
- super(displayName, names, extension);
31
- }
32
- makeRenderer(renderContext, untypedOptionValues) {
33
- return new JavaScriptPropTypesRenderer(this, renderContext, (0, RendererOptions_1.getOptionValues)(exports.javaScriptPropTypesOptions, untypedOptionValues));
34
- }
35
- }
36
- exports.JavaScriptPropTypesTargetLanguage = JavaScriptPropTypesTargetLanguage;
37
- const identityNamingFunction = (0, Naming_1.funPrefixNamer)("properties", s => s);
38
- class JavaScriptPropTypesRenderer extends ConvenienceRenderer_1.ConvenienceRenderer {
39
- _jsOptions;
40
- constructor(targetLanguage, renderContext, _jsOptions) {
41
- super(targetLanguage, renderContext);
42
- this._jsOptions = _jsOptions;
43
- }
44
- nameStyle(original, upper) {
45
- const acronyms = (0, Acronyms_1.acronymStyle)(this._jsOptions.acronymStyle);
46
- const words = (0, __1.splitIntoWords)(original);
47
- return (0, __1.combineWords)(words, JavaScript_1.legalizeName, upper ? __1.firstUpperWordStyle : Strings_1.allLowerWordStyle, __1.firstUpperWordStyle, upper ? s => (0, __1.capitalize)(acronyms(s)) : Strings_1.allLowerWordStyle, acronyms, "", JavaScriptUnicodeMaps_1.isES3IdentifierStart);
48
- }
49
- makeNamedTypeNamer() {
50
- return (0, Naming_1.funPrefixNamer)("types", s => this.nameStyle(s, true));
51
- }
52
- namerForObjectProperty() {
53
- return identityNamingFunction;
54
- }
55
- makeUnionMemberNamer() {
56
- return null;
57
- }
58
- makeEnumCaseNamer() {
59
- return (0, Naming_1.funPrefixNamer)("enum-cases", s => this.nameStyle(s, false));
60
- }
61
- namedTypeToNameForTopLevel(type) {
62
- return (0, TypeUtils_1.directlyReachableSingleNamedType)(type);
63
- }
64
- makeNameForProperty(c, className, p, jsonName, _assignedName) {
65
- // Ignore the assigned name
66
- return super.makeNameForProperty(c, className, p, jsonName, undefined);
67
- }
68
- typeMapTypeFor(t, required = true) {
69
- if (["class", "object", "enum"].indexOf(t.kind) >= 0) {
70
- return ["_", this.nameForNamedType(t)];
71
- }
72
- const match = (0, __1.matchType)(t, _anyType => "PropTypes.any", _nullType => "PropTypes.any", _boolType => "PropTypes.bool", _integerType => "PropTypes.number", _doubleType => "PropTypes.number", _stringType => "PropTypes.string", arrayType => ["PropTypes.arrayOf(", this.typeMapTypeFor(arrayType.items, false), ")"], _classType => (0, __1.panic)("Should already be handled."), _mapType => "PropTypes.object", _enumType => (0, __1.panic)("Should already be handled."), unionType => {
73
- const children = Array.from(unionType.getChildren()).map((type) => this.typeMapTypeFor(type, false));
74
- return ["PropTypes.oneOfType([", ...(0, collection_utils_1.arrayIntercalate)(", ", children), "])"];
75
- }, _transformedStringType => {
76
- return "PropTypes.string";
77
- });
78
- if (required) {
79
- return [match];
80
- }
81
- return match;
82
- }
83
- typeMapTypeForProperty(p) {
84
- return this.typeMapTypeFor(p.type);
85
- }
86
- importStatement(lhs, moduleName) {
87
- if (this._jsOptions.moduleSystem) {
88
- return ["import ", lhs, " from ", moduleName, ";"];
89
- }
90
- else {
91
- return ["const ", lhs, " = require(", moduleName, ");"];
92
- }
93
- }
94
- emitUsageComments() {
95
- // FIXME: Use the correct type name
96
- this.emitCommentLines([
97
- "Example usage:",
98
- "",
99
- this.importStatement("{ MyShape }", "./myShape.js"),
100
- "",
101
- "class MyComponent extends React.Component {",
102
- " //",
103
- "}",
104
- "",
105
- "MyComponent.propTypes = {",
106
- " input: MyShape",
107
- "};"
108
- ], "// ");
109
- }
110
- emitBlock(source, end, emit) {
111
- this.emitLine(source, "{");
112
- this.indent(emit);
113
- this.emitLine("}", end);
114
- }
115
- emitImports() {
116
- this.ensureBlankLine();
117
- this.emitLine(this.importStatement("PropTypes", '"prop-types"'));
118
- }
119
- emitExport(name, value) {
120
- if (this._jsOptions.moduleSystem) {
121
- this.emitLine("export const ", name, " = ", value, ";");
122
- }
123
- else {
124
- this.emitLine("module.exports = exports = { ", name, ": ", value, " };");
125
- }
126
- }
127
- emitTypes() {
128
- this.ensureBlankLine();
129
- this.forEachObject("none", (_type, name) => {
130
- this.emitLine("let _", name, ";");
131
- });
132
- this.forEachEnum("none", (enumType, enumName) => {
133
- const options = [];
134
- this.forEachEnumCase(enumType, "none", (name, _jsonName, _position) => {
135
- options.push("'");
136
- options.push(name);
137
- options.push("'");
138
- options.push(", ");
139
- });
140
- options.pop();
141
- this.emitLine(["const _", enumName, " = PropTypes.oneOfType([", ...options, "]);"]);
142
- });
143
- const order = [];
144
- const mapKey = [];
145
- const mapValue = [];
146
- this.forEachObject("none", (type, name) => {
147
- mapKey.push(name);
148
- mapValue.push(this.gatherSource(() => this.emitObject(name, type)));
149
- });
150
- // order these
151
- mapKey.forEach((_, index) => {
152
- // assume first
153
- let ordinal = 0;
154
- // pull out all names
155
- const source = mapValue[index];
156
- const names = source.filter(value => value);
157
- // must be behind all these names
158
- for (let i = 0; i < names.length; i++) {
159
- const depName = names[i];
160
- // find this name's ordinal, if it has already been added
161
- for (let j = 0; j < order.length; j++) {
162
- const depIndex = order[j];
163
- if (mapKey[depIndex] === depName) {
164
- // this is the index of the dependency, so make sure we come after it
165
- ordinal = Math.max(ordinal, depIndex + 1);
166
- }
167
- }
168
- }
169
- // insert index
170
- order.splice(ordinal, 0, index);
171
- });
172
- // now emit ordered source
173
- order.forEach(i => this.emitGatheredSource(mapValue[i]));
174
- // now emit top levels
175
- this.forEachTopLevel("none", (type, name) => {
176
- if (type instanceof Type_1.PrimitiveType) {
177
- this.ensureBlankLine();
178
- this.emitExport(name, this.typeMapTypeFor(type));
179
- }
180
- else {
181
- if (type.kind === "array") {
182
- this.ensureBlankLine();
183
- this.emitExport(name, ["PropTypes.arrayOf(", this.typeMapTypeFor(type.items), ")"]);
184
- }
185
- else {
186
- this.ensureBlankLine();
187
- this.emitExport(name, ["_", name]);
188
- }
189
- }
190
- });
191
- }
192
- emitObject(name, t) {
193
- this.ensureBlankLine();
194
- this.emitLine("_", name, " = PropTypes.shape({");
195
- this.indent(() => {
196
- this.forEachClassProperty(t, "none", (_, jsonName, property) => {
197
- this.emitLine(`"${(0, Strings_1.utf16StringEscape)(jsonName)}"`, ": ", this.typeMapTypeForProperty(property), ",");
198
- });
199
- });
200
- this.emitLine("});");
201
- }
202
- emitSourceStructure() {
203
- if (this.leadingComments !== undefined) {
204
- this.emitCommentLines(this.leadingComments);
205
- }
206
- else {
207
- this.emitUsageComments();
208
- }
209
- this.emitImports();
210
- this.emitTypes();
211
- }
212
- }
213
- exports.JavaScriptPropTypesRenderer = JavaScriptPropTypesRenderer;
@@ -1,2 +0,0 @@
1
- export declare function isES3IdentifierStart(ch: number): boolean;
2
- export declare function isES3IdentifierPart(ch: number): boolean;
@@ -1,134 +0,0 @@
1
- "use strict";
2
- // Taken from https://github.com/Microsoft/TypeScript
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.isES3IdentifierPart = exports.isES3IdentifierStart = void 0;
5
- function lookupInUnicodeMap(code, map) {
6
- // Bail out quickly if it couldn't possibly be in the map.
7
- if (code < map[0]) {
8
- return false;
9
- }
10
- // Perform binary search in one of the Unicode range maps
11
- let lo = 0;
12
- let hi = map.length;
13
- let mid;
14
- while (lo + 1 < hi) {
15
- mid = lo + (hi - lo) / 2;
16
- // mid has to be even to catch a range's beginning
17
- mid -= mid % 2;
18
- if (map[mid] <= code && code <= map[mid + 1]) {
19
- return true;
20
- }
21
- if (code < map[mid]) {
22
- hi = mid;
23
- }
24
- else {
25
- lo = mid + 2;
26
- }
27
- }
28
- return false;
29
- }
30
- function isES3IdentifierStart(ch) {
31
- return ((ch >= 65 /* CharacterCodes.A */ && ch <= 90 /* CharacterCodes.Z */) ||
32
- (ch >= 97 /* CharacterCodes.a */ && ch <= 122 /* CharacterCodes.z */) ||
33
- ch === 36 /* CharacterCodes.$ */ ||
34
- ch === 95 /* CharacterCodes._ */ ||
35
- (ch > 127 /* CharacterCodes.maxAsciiCharacter */ && lookupInUnicodeMap(ch, unicodeES3IdentifierStart)));
36
- }
37
- exports.isES3IdentifierStart = isES3IdentifierStart;
38
- function isES3IdentifierPart(ch) {
39
- return ((ch >= 65 /* CharacterCodes.A */ && ch <= 90 /* CharacterCodes.Z */) ||
40
- (ch >= 97 /* CharacterCodes.a */ && ch <= 122 /* CharacterCodes.z */) ||
41
- (ch >= 48 /* CharacterCodes._0 */ && ch <= 57 /* CharacterCodes._9 */) ||
42
- ch === 36 /* CharacterCodes.$ */ ||
43
- ch === 95 /* CharacterCodes._ */ ||
44
- (ch > 127 /* CharacterCodes.maxAsciiCharacter */ && lookupInUnicodeMap(ch, unicodeES3IdentifierPart)));
45
- }
46
- exports.isES3IdentifierPart = isES3IdentifierPart;
47
- /*
48
- As per ECMAScript Language Specification 3th Edition, Section 7.6: Identifiers
49
- IdentifierStart ::
50
- Can contain Unicode 3.0.0 categories:
51
- Uppercase letter (Lu),
52
- Lowercase letter (Ll),
53
- Titlecase letter (Lt),
54
- Modifier letter (Lm),
55
- Other letter (Lo), or
56
- Letter number (Nl).
57
- IdentifierPart :: =
58
- Can contain IdentifierStart + Unicode 3.0.0 categories:
59
- Non-spacing mark (Mn),
60
- Combining spacing mark (Mc),
61
- Decimal number (Nd), or
62
- Connector punctuation (Pc).
63
- Codepoint ranges for ES3 Identifiers are extracted from the Unicode 3.0.0 specification at:
64
- http://www.unicode.org/Public/3.0-Update/UnicodeData-3.0.0.txt
65
- */
66
- const unicodeES3IdentifierStart = [
67
- 170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 543, 546, 563, 592, 685, 688, 696, 699, 705, 720, 721, 736,
68
- 740, 750, 750, 890, 890, 902, 902, 904, 906, 908, 908, 910, 929, 931, 974, 976, 983, 986, 1011, 1024, 1153, 1164,
69
- 1220, 1223, 1224, 1227, 1228, 1232, 1269, 1272, 1273, 1329, 1366, 1369, 1369, 1377, 1415, 1488, 1514, 1520, 1522,
70
- 1569, 1594, 1600, 1610, 1649, 1747, 1749, 1749, 1765, 1766, 1786, 1788, 1808, 1808, 1810, 1836, 1920, 1957, 2309,
71
- 2361, 2365, 2365, 2384, 2384, 2392, 2401, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489,
72
- 2524, 2525, 2527, 2529, 2544, 2545, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616,
73
- 2617, 2649, 2652, 2654, 2654, 2674, 2676, 2693, 2699, 2701, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739,
74
- 2741, 2745, 2749, 2749, 2768, 2768, 2784, 2784, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2870,
75
- 2873, 2877, 2877, 2908, 2909, 2911, 2913, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975,
76
- 2979, 2980, 2984, 2986, 2990, 2997, 2999, 3001, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3168,
77
- 3169, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3294, 3294, 3296, 3297, 3333, 3340, 3342, 3344,
78
- 3346, 3368, 3370, 3385, 3424, 3425, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3585, 3632, 3634,
79
- 3635, 3648, 3654, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747,
80
- 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3760, 3762, 3763, 3773, 3773, 3776, 3780, 3782, 3782, 3804, 3805, 3840,
81
- 3840, 3904, 3911, 3913, 3946, 3976, 3979, 4096, 4129, 4131, 4135, 4137, 4138, 4176, 4181, 4256, 4293, 4304, 4342,
82
- 4352, 4441, 4447, 4514, 4520, 4601, 4608, 4614, 4616, 4678, 4680, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698,
83
- 4701, 4704, 4742, 4744, 4744, 4746, 4749, 4752, 4782, 4784, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805,
84
- 4808, 4814, 4816, 4822, 4824, 4846, 4848, 4878, 4880, 4880, 4882, 4885, 4888, 4894, 4896, 4934, 4936, 4954, 5024,
85
- 5108, 5121, 5740, 5743, 5750, 5761, 5786, 5792, 5866, 6016, 6067, 6176, 6263, 6272, 6312, 7680, 7835, 7840, 7929,
86
- 7936, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064,
87
- 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188,
88
- 8319, 8319, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490,
89
- 8493, 8495, 8497, 8499, 8505, 8544, 8579, 12293, 12295, 12321, 12329, 12337, 12341, 12344, 12346, 12353, 12436,
90
- 12445, 12446, 12449, 12538, 12540, 12542, 12549, 12588, 12593, 12686, 12704, 12727, 13312, 19893, 19968, 40869,
91
- 40960, 42124, 44032, 55203, 63744, 64045, 64256, 64262, 64275, 64279, 64285, 64285, 64287, 64296, 64298, 64310,
92
- 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967,
93
- 65008, 65019, 65136, 65138, 65140, 65140, 65142, 65276, 65313, 65338, 65345, 65370, 65382, 65470, 65474, 65479,
94
- 65482, 65487, 65490, 65495, 65498, 65500
95
- ];
96
- const unicodeES3IdentifierPart = [
97
- 170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 543, 546, 563, 592, 685, 688, 696, 699, 705, 720, 721, 736,
98
- 740, 750, 750, 768, 846, 864, 866, 890, 890, 902, 902, 904, 906, 908, 908, 910, 929, 931, 974, 976, 983, 986, 1011,
99
- 1024, 1153, 1155, 1158, 1164, 1220, 1223, 1224, 1227, 1228, 1232, 1269, 1272, 1273, 1329, 1366, 1369, 1369, 1377,
100
- 1415, 1425, 1441, 1443, 1465, 1467, 1469, 1471, 1471, 1473, 1474, 1476, 1476, 1488, 1514, 1520, 1522, 1569, 1594,
101
- 1600, 1621, 1632, 1641, 1648, 1747, 1749, 1756, 1759, 1768, 1770, 1773, 1776, 1788, 1808, 1836, 1840, 1866, 1920,
102
- 1968, 2305, 2307, 2309, 2361, 2364, 2381, 2384, 2388, 2392, 2403, 2406, 2415, 2433, 2435, 2437, 2444, 2447, 2448,
103
- 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2492, 2492, 2494, 2500, 2503, 2504, 2507, 2509, 2519, 2519, 2524,
104
- 2525, 2527, 2531, 2534, 2545, 2562, 2562, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614,
105
- 2616, 2617, 2620, 2620, 2622, 2626, 2631, 2632, 2635, 2637, 2649, 2652, 2654, 2654, 2662, 2676, 2689, 2691, 2693,
106
- 2699, 2701, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2748, 2757, 2759, 2761, 2763, 2765,
107
- 2768, 2768, 2784, 2784, 2790, 2799, 2817, 2819, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2870,
108
- 2873, 2876, 2883, 2887, 2888, 2891, 2893, 2902, 2903, 2908, 2909, 2911, 2913, 2918, 2927, 2946, 2947, 2949, 2954,
109
- 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 2997, 2999, 3001, 3006,
110
- 3010, 3014, 3016, 3018, 3021, 3031, 3031, 3047, 3055, 3073, 3075, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123,
111
- 3125, 3129, 3134, 3140, 3142, 3144, 3146, 3149, 3157, 3158, 3168, 3169, 3174, 3183, 3202, 3203, 3205, 3212, 3214,
112
- 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3262, 3268, 3270, 3272, 3274, 3277, 3285, 3286, 3294, 3294, 3296, 3297,
113
- 3302, 3311, 3330, 3331, 3333, 3340, 3342, 3344, 3346, 3368, 3370, 3385, 3390, 3395, 3398, 3400, 3402, 3405, 3415,
114
- 3415, 3424, 3425, 3430, 3439, 3458, 3459, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3530, 3530,
115
- 3535, 3540, 3542, 3542, 3544, 3551, 3570, 3571, 3585, 3642, 3648, 3662, 3664, 3673, 3713, 3714, 3716, 3716, 3719,
116
- 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3769,
117
- 3771, 3773, 3776, 3780, 3782, 3782, 3784, 3789, 3792, 3801, 3804, 3805, 3840, 3840, 3864, 3865, 3872, 3881, 3893,
118
- 3893, 3895, 3895, 3897, 3897, 3902, 3911, 3913, 3946, 3953, 3972, 3974, 3979, 3984, 3991, 3993, 4028, 4038, 4038,
119
- 4096, 4129, 4131, 4135, 4137, 4138, 4140, 4146, 4150, 4153, 4160, 4169, 4176, 4185, 4256, 4293, 4304, 4342, 4352,
120
- 4441, 4447, 4514, 4520, 4601, 4608, 4614, 4616, 4678, 4680, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701,
121
- 4704, 4742, 4744, 4744, 4746, 4749, 4752, 4782, 4784, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808,
122
- 4814, 4816, 4822, 4824, 4846, 4848, 4878, 4880, 4880, 4882, 4885, 4888, 4894, 4896, 4934, 4936, 4954, 4969, 4977,
123
- 5024, 5108, 5121, 5740, 5743, 5750, 5761, 5786, 5792, 5866, 6016, 6099, 6112, 6121, 6160, 6169, 6176, 6263, 6272,
124
- 6313, 7680, 7835, 7840, 7929, 7936, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027,
125
- 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160,
126
- 8172, 8178, 8180, 8182, 8188, 8255, 8256, 8319, 8319, 8400, 8412, 8417, 8417, 8450, 8450, 8455, 8455, 8458, 8467,
127
- 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8497, 8499, 8505, 8544, 8579, 12293,
128
- 12295, 12321, 12335, 12337, 12341, 12344, 12346, 12353, 12436, 12441, 12442, 12445, 12446, 12449, 12542, 12549,
129
- 12588, 12593, 12686, 12704, 12727, 13312, 19893, 19968, 40869, 40960, 42124, 44032, 55203, 63744, 64045, 64256,
130
- 64262, 64275, 64279, 64285, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326,
131
- 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65056, 65059, 65075, 65076, 65101, 65103, 65136,
132
- 65138, 65140, 65140, 65142, 65276, 65296, 65305, 65313, 65338, 65343, 65343, 65345, 65370, 65381, 65470, 65474,
133
- 65479, 65482, 65487, 65490, 65495, 65498, 65500
134
- ];
@@ -1,109 +0,0 @@
1
- import { ConvenienceRenderer, ForbiddenWordsInfo } from "../ConvenienceRenderer";
2
- import { Name, Namer } from "../Naming";
3
- import { EnumOption, Option, StringOption, OptionValues } from "../RendererOptions";
4
- import { Sourcelike } from "../Source";
5
- import { TargetLanguage } from "../TargetLanguage";
6
- import { ArrayType, ClassType, EnumType, MapType, ObjectType, PrimitiveType, Type, UnionType } from "../Type";
7
- import { RenderContext } from "../Renderer";
8
- import { AcronymStyleOptions } from "../support/Acronyms";
9
- export declare enum Framework {
10
- None = 0,
11
- Jackson = 1,
12
- Klaxon = 2,
13
- KotlinX = 3
14
- }
15
- export declare const kotlinOptions: {
16
- framework: EnumOption<Framework>;
17
- acronymStyle: EnumOption<AcronymStyleOptions>;
18
- packageName: StringOption;
19
- };
20
- export declare class KotlinTargetLanguage extends TargetLanguage {
21
- constructor();
22
- protected getOptions(): Option<any>[];
23
- get supportsOptionalClassProperties(): boolean;
24
- get supportsUnionsWithBothNumberTypes(): boolean;
25
- protected makeRenderer(renderContext: RenderContext, untypedOptionValues: {
26
- [name: string]: any;
27
- }): ConvenienceRenderer;
28
- }
29
- export declare class KotlinRenderer extends ConvenienceRenderer {
30
- protected readonly _kotlinOptions: OptionValues<typeof kotlinOptions>;
31
- constructor(targetLanguage: TargetLanguage, renderContext: RenderContext, _kotlinOptions: OptionValues<typeof kotlinOptions>);
32
- protected forbiddenNamesForGlobalNamespace(): string[];
33
- protected forbiddenForObjectProperties(_o: ObjectType, _classNamed: Name): ForbiddenWordsInfo;
34
- protected forbiddenForEnumCases(_e: EnumType, _enumName: Name): ForbiddenWordsInfo;
35
- protected forbiddenForUnionMembers(_u: UnionType, _unionName: Name): ForbiddenWordsInfo;
36
- protected topLevelNameStyle(rawName: string): string;
37
- protected makeNamedTypeNamer(): Namer;
38
- protected namerForObjectProperty(): Namer;
39
- protected makeUnionMemberNamer(): Namer;
40
- protected makeEnumCaseNamer(): Namer;
41
- protected emitDescriptionBlock(lines: Sourcelike[]): void;
42
- protected emitBlock(line: Sourcelike, f: () => void, delimiter?: "curly" | "paren" | "lambda"): void;
43
- protected anySourceType(optional: string): Sourcelike;
44
- protected arrayType(arrayType: ArrayType, withIssues?: boolean, _noOptional?: boolean): Sourcelike;
45
- protected mapType(mapType: MapType, withIssues?: boolean, _noOptional?: boolean): Sourcelike;
46
- protected kotlinType(t: Type, withIssues?: boolean, noOptional?: boolean): Sourcelike;
47
- protected emitUsageHeader(): void;
48
- protected emitHeader(): void;
49
- protected emitTopLevelArray(t: ArrayType, name: Name): void;
50
- protected emitTopLevelMap(t: MapType, name: Name): void;
51
- protected emitEmptyClassDefinition(c: ClassType, className: Name): void;
52
- protected emitClassDefinition(c: ClassType, className: Name): void;
53
- protected emitClassDefinitionMethods(_c: ClassType, _className: Name): void;
54
- protected emitClassAnnotations(_c: Type, _className: Name): void;
55
- protected renameAttribute(_name: Name, _jsonName: string, _required: boolean, _meta: Array<() => void>): void;
56
- protected emitEnumDefinition(e: EnumType, enumName: Name): void;
57
- protected emitUnionDefinition(u: UnionType, unionName: Name): void;
58
- protected emitUnionDefinitionMethods(_u: UnionType, _nonNulls: ReadonlySet<Type>, _maybeNull: PrimitiveType | null, _unionName: Name): void;
59
- protected emitSourceStructure(): void;
60
- }
61
- export declare class KotlinKlaxonRenderer extends KotlinRenderer {
62
- constructor(targetLanguage: TargetLanguage, renderContext: RenderContext, _kotlinOptions: OptionValues<typeof kotlinOptions>);
63
- private unionMemberFromJsonValue;
64
- private unionMemberJsonValueGuard;
65
- protected emitUsageHeader(): void;
66
- protected emitHeader(): void;
67
- protected emitTopLevelArray(t: ArrayType, name: Name): void;
68
- protected emitTopLevelMap(t: MapType, name: Name): void;
69
- private klaxonRenameAttribute;
70
- protected emitEmptyClassDefinition(c: ClassType, className: Name): void;
71
- protected emitClassDefinitionMethods(c: ClassType, className: Name): void;
72
- protected renameAttribute(name: Name, jsonName: string, _required: boolean, meta: Array<() => void>): void;
73
- protected emitEnumDefinition(e: EnumType, enumName: Name): void;
74
- private emitGenericConverter;
75
- protected emitUnionDefinitionMethods(u: UnionType, nonNulls: ReadonlySet<Type>, maybeNull: PrimitiveType | null, unionName: Name): void;
76
- }
77
- export declare class KotlinJacksonRenderer extends KotlinRenderer {
78
- constructor(targetLanguage: TargetLanguage, renderContext: RenderContext, _kotlinOptions: OptionValues<typeof kotlinOptions>);
79
- private unionMemberJsonValueGuard;
80
- protected emitUsageHeader(): void;
81
- protected emitHeader(): void;
82
- protected emitTopLevelArray(t: ArrayType, name: Name): void;
83
- protected emitTopLevelMap(t: MapType, name: Name): void;
84
- private jacksonRenameAttribute;
85
- protected emitEmptyClassDefinition(c: ClassType, className: Name): void;
86
- protected emitClassDefinitionMethods(c: ClassType, className: Name): void;
87
- protected renameAttribute(name: Name, jsonName: string, required: boolean, meta: Array<() => void>): void;
88
- protected emitEnumDefinition(e: EnumType, enumName: Name): void;
89
- private emitGenericConverter;
90
- protected emitUnionDefinitionMethods(u: UnionType, nonNulls: ReadonlySet<Type>, maybeNull: PrimitiveType | null, unionName: Name): void;
91
- }
92
- /**
93
- * Currently supports simple classes, enums, and TS string unions (which are also enums).
94
- * TODO: Union, Any, Top Level Array, Top Level Map
95
- */
96
- export declare class KotlinXRenderer extends KotlinRenderer {
97
- constructor(targetLanguage: TargetLanguage, renderContext: RenderContext, _kotlinOptions: OptionValues<typeof kotlinOptions>);
98
- protected anySourceType(optional: string): Sourcelike;
99
- protected arrayType(arrayType: ArrayType, withIssues?: boolean, noOptional?: boolean): Sourcelike;
100
- protected mapType(mapType: MapType, withIssues?: boolean, noOptional?: boolean): Sourcelike;
101
- protected emitTopLevelMap(t: MapType, name: Name): void;
102
- protected emitTopLevelArray(t: ArrayType, name: Name): void;
103
- protected emitUsageHeader(): void;
104
- protected emitHeader(): void;
105
- protected emitClassAnnotations(_c: Type, _className: Name): void;
106
- protected renameAttribute(name: Name, jsonName: string, _required: boolean, meta: Array<() => void>): void;
107
- private _rename;
108
- protected emitEnumDefinition(e: EnumType, enumName: Name): void;
109
- }