skir 0.0.1

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 (141) hide show
  1. package/README.md +447 -0
  2. package/dist/casing.d.ts +8 -0
  3. package/dist/casing.d.ts.map +1 -0
  4. package/dist/casing.js +49 -0
  5. package/dist/casing.js.map +1 -0
  6. package/dist/casing.test.d.ts +2 -0
  7. package/dist/casing.test.d.ts.map +1 -0
  8. package/dist/casing.test.js +134 -0
  9. package/dist/casing.test.js.map +1 -0
  10. package/dist/command_line_parser.d.ts +33 -0
  11. package/dist/command_line_parser.d.ts.map +1 -0
  12. package/dist/command_line_parser.js +171 -0
  13. package/dist/command_line_parser.js.map +1 -0
  14. package/dist/command_line_parser.test.d.ts +2 -0
  15. package/dist/command_line_parser.test.d.ts.map +1 -0
  16. package/dist/command_line_parser.test.js +302 -0
  17. package/dist/command_line_parser.test.js.map +1 -0
  18. package/dist/compatibility_checker.d.ts +68 -0
  19. package/dist/compatibility_checker.d.ts.map +1 -0
  20. package/dist/compatibility_checker.js +328 -0
  21. package/dist/compatibility_checker.js.map +1 -0
  22. package/dist/compatibility_checker.test.d.ts +2 -0
  23. package/dist/compatibility_checker.test.d.ts.map +1 -0
  24. package/dist/compatibility_checker.test.js +528 -0
  25. package/dist/compatibility_checker.test.js.map +1 -0
  26. package/dist/compiler.d.ts +3 -0
  27. package/dist/compiler.d.ts.map +1 -0
  28. package/dist/compiler.js +358 -0
  29. package/dist/compiler.js.map +1 -0
  30. package/dist/config.d.ts +47 -0
  31. package/dist/config.d.ts.map +1 -0
  32. package/dist/config.js +23 -0
  33. package/dist/config.js.map +1 -0
  34. package/dist/definition_finder.d.ts +12 -0
  35. package/dist/definition_finder.d.ts.map +1 -0
  36. package/dist/definition_finder.js +180 -0
  37. package/dist/definition_finder.js.map +1 -0
  38. package/dist/definition_finder.test.d.ts +2 -0
  39. package/dist/definition_finder.test.d.ts.map +1 -0
  40. package/dist/definition_finder.test.js +164 -0
  41. package/dist/definition_finder.test.js.map +1 -0
  42. package/dist/encoding.d.ts +2 -0
  43. package/dist/encoding.d.ts.map +1 -0
  44. package/dist/encoding.js +38 -0
  45. package/dist/encoding.js.map +1 -0
  46. package/dist/encoding.test.d.ts +2 -0
  47. package/dist/encoding.test.d.ts.map +1 -0
  48. package/dist/encoding.test.js +23 -0
  49. package/dist/encoding.test.js.map +1 -0
  50. package/dist/error_renderer.d.ts +10 -0
  51. package/dist/error_renderer.d.ts.map +1 -0
  52. package/dist/error_renderer.js +247 -0
  53. package/dist/error_renderer.js.map +1 -0
  54. package/dist/formatter.d.ts +3 -0
  55. package/dist/formatter.d.ts.map +1 -0
  56. package/dist/formatter.js +263 -0
  57. package/dist/formatter.js.map +1 -0
  58. package/dist/formatter.test.d.ts +2 -0
  59. package/dist/formatter.test.d.ts.map +1 -0
  60. package/dist/formatter.test.js +156 -0
  61. package/dist/formatter.test.js.map +1 -0
  62. package/dist/index.d.ts +6 -0
  63. package/dist/index.d.ts.map +1 -0
  64. package/dist/index.js +5 -0
  65. package/dist/index.js.map +1 -0
  66. package/dist/index.test.d.ts +2 -0
  67. package/dist/index.test.d.ts.map +1 -0
  68. package/dist/index.test.js +14 -0
  69. package/dist/index.test.js.map +1 -0
  70. package/dist/io.d.ts +13 -0
  71. package/dist/io.d.ts.map +1 -0
  72. package/dist/io.js +22 -0
  73. package/dist/io.js.map +1 -0
  74. package/dist/language_server.d.ts +15 -0
  75. package/dist/language_server.d.ts.map +1 -0
  76. package/dist/language_server.js +248 -0
  77. package/dist/language_server.js.map +1 -0
  78. package/dist/literals.d.ts +13 -0
  79. package/dist/literals.d.ts.map +1 -0
  80. package/dist/literals.js +100 -0
  81. package/dist/literals.js.map +1 -0
  82. package/dist/literals.test.d.ts +2 -0
  83. package/dist/literals.test.d.ts.map +1 -0
  84. package/dist/literals.test.js +149 -0
  85. package/dist/literals.test.js.map +1 -0
  86. package/dist/module_collector.d.ts +3 -0
  87. package/dist/module_collector.d.ts.map +1 -0
  88. package/dist/module_collector.js +22 -0
  89. package/dist/module_collector.js.map +1 -0
  90. package/dist/module_set.d.ts +44 -0
  91. package/dist/module_set.d.ts.map +1 -0
  92. package/dist/module_set.js +1025 -0
  93. package/dist/module_set.js.map +1 -0
  94. package/dist/module_set.test.d.ts +2 -0
  95. package/dist/module_set.test.d.ts.map +1 -0
  96. package/dist/module_set.test.js +1330 -0
  97. package/dist/module_set.test.js.map +1 -0
  98. package/dist/parser.d.ts +6 -0
  99. package/dist/parser.d.ts.map +1 -0
  100. package/dist/parser.js +971 -0
  101. package/dist/parser.js.map +1 -0
  102. package/dist/parser.test.d.ts +2 -0
  103. package/dist/parser.test.d.ts.map +1 -0
  104. package/dist/parser.test.js +1366 -0
  105. package/dist/parser.test.js.map +1 -0
  106. package/dist/snapshotter.d.ts +6 -0
  107. package/dist/snapshotter.d.ts.map +1 -0
  108. package/dist/snapshotter.js +107 -0
  109. package/dist/snapshotter.js.map +1 -0
  110. package/dist/tokenizer.d.ts +4 -0
  111. package/dist/tokenizer.d.ts.map +1 -0
  112. package/dist/tokenizer.js +192 -0
  113. package/dist/tokenizer.js.map +1 -0
  114. package/dist/tokenizer.test.d.ts +2 -0
  115. package/dist/tokenizer.test.d.ts.map +1 -0
  116. package/dist/tokenizer.test.js +425 -0
  117. package/dist/tokenizer.test.js.map +1 -0
  118. package/dist/types.d.ts +375 -0
  119. package/dist/types.d.ts.map +1 -0
  120. package/dist/types.js +2 -0
  121. package/dist/types.js.map +1 -0
  122. package/package.json +63 -0
  123. package/src/casing.ts +64 -0
  124. package/src/command_line_parser.ts +249 -0
  125. package/src/compatibility_checker.ts +470 -0
  126. package/src/compiler.ts +435 -0
  127. package/src/config.ts +28 -0
  128. package/src/definition_finder.ts +221 -0
  129. package/src/encoding.ts +32 -0
  130. package/src/error_renderer.ts +278 -0
  131. package/src/formatter.ts +274 -0
  132. package/src/index.ts +6 -0
  133. package/src/io.ts +33 -0
  134. package/src/language_server.ts +301 -0
  135. package/src/literals.ts +120 -0
  136. package/src/module_collector.ts +22 -0
  137. package/src/module_set.ts +1175 -0
  138. package/src/parser.ts +1122 -0
  139. package/src/snapshotter.ts +136 -0
  140. package/src/tokenizer.ts +216 -0
  141. package/src/types.ts +518 -0
@@ -0,0 +1,375 @@
1
+ /**
2
+ * @fileoverview Public types present in the interface between the compiler and
3
+ * language plugins.
4
+ */
5
+ import type { z } from "zod";
6
+ /**
7
+ * Generates code in one programming language from a set of parsed Skir modules.
8
+ */
9
+ export interface CodeGenerator<Config = unknown> {
10
+ readonly id: string;
11
+ readonly version: string;
12
+ readonly configType: z.ZodType<Config>;
13
+ generateCode(input: CodeGenerator.Input<Config>): CodeGenerator.Output;
14
+ }
15
+ export declare namespace CodeGenerator {
16
+ interface Input<Config> {
17
+ readonly modules: ReadonlyArray<Module>;
18
+ readonly recordMap: ReadonlyMap<RecordKey, RecordLocation>;
19
+ readonly config: Config;
20
+ }
21
+ interface Output {
22
+ readonly files: readonly OutputFile[];
23
+ }
24
+ interface OutputFile {
25
+ readonly path: string;
26
+ readonly code: string;
27
+ }
28
+ }
29
+ /** One line in a module. */
30
+ export interface CodeLine {
31
+ /** Zero-based. */
32
+ readonly lineNumber: number;
33
+ readonly line: string;
34
+ readonly position: number;
35
+ readonly modulePath: string;
36
+ }
37
+ /** A lexical token. */
38
+ export interface Token {
39
+ /** Empty if the token is the special token for EOF. */
40
+ readonly text: string;
41
+ /** Measured in number of characters from the start of the module. */
42
+ readonly position: number;
43
+ readonly line: CodeLine;
44
+ /** Zero-based. */
45
+ readonly colNumber: number;
46
+ }
47
+ export type Casing = "lowerCamel" | "lower_underscore" | "UpperCamel" | "UPPER_UNDERSCORE";
48
+ /** A user error in a module. */
49
+ export type SkirError = {
50
+ readonly token: Token;
51
+ /** Convention: starts with a capital letter. */
52
+ readonly message: string;
53
+ readonly expected?: undefined;
54
+ readonly errorIsInOtherModule?: true;
55
+ } | {
56
+ readonly token: Token;
57
+ /** Convention: starts with a lowercase letter. */
58
+ readonly expected: string;
59
+ readonly message?: undefined;
60
+ readonly errorIsInOtherModule?: undefined;
61
+ };
62
+ export interface ErrorSink {
63
+ push(error: SkirError): void;
64
+ }
65
+ /**
66
+ * Holds a value of type T and possible errors registered during the computation
67
+ * of the value.
68
+ */
69
+ export interface Result<T> {
70
+ readonly result: T;
71
+ readonly errors: readonly SkirError[];
72
+ }
73
+ export type Primitive = "bool" | "int32" | "int64" | "uint64" | "float32" | "float64" | "timestamp" | "string" | "bytes";
74
+ export interface PrimitiveType {
75
+ kind: "primitive";
76
+ primitive: Primitive;
77
+ }
78
+ /**
79
+ * A reference to a record, e.g. 'Foobar' or 'foo.Bar' or '.Foo.Bar'.
80
+ * One of the possible unresolved value types. The corresponding resolved value
81
+ * type is `ResolvedRecordRef`.
82
+ */
83
+ export interface UnresolvedRecordRef {
84
+ readonly kind: "record";
85
+ /**
86
+ * The different pieces in the name, e.g. ['Foo', 'Bar'].
87
+ * Cannot be empty.
88
+ */
89
+ readonly nameParts: readonly Token[];
90
+ /**
91
+ * True if the reference starts with a dot, e.g. ".Foo.Bar".
92
+ * In this example, "Foo" is to be found at the top-level of the module.
93
+ */
94
+ readonly absolute: boolean;
95
+ }
96
+ /** Uniquely identifies a record within a module set. */
97
+ export type RecordKey = string;
98
+ export interface ResolvedRecordRef {
99
+ readonly kind: "record";
100
+ readonly key: RecordKey;
101
+ readonly recordType: "struct" | "enum";
102
+ readonly nameParts: ReadonlyArray<{
103
+ /**
104
+ * A single name in the type reference.
105
+ * Can refer to either a report or a module alias.
106
+ */
107
+ token: Token;
108
+ /**
109
+ * Either the definition of the record or the aliased import declaration.
110
+ */
111
+ declaration: Record | ImportAlias;
112
+ }>;
113
+ /**
114
+ * Last token in the type reference. For example, if the type reference is
115
+ * ".Foo.Bar", this is the token for "Bar".
116
+ */
117
+ readonly refToken: Token;
118
+ }
119
+ export interface MutableFieldPathItem {
120
+ /** The field name token in the field path. */
121
+ readonly name: Token;
122
+ /** The field declaration in the record definition. */
123
+ declaration?: Field;
124
+ }
125
+ /** A field or a sequence of field for keying items in an array. */
126
+ export interface MutableFieldPath<Mutable extends boolean = true> {
127
+ /** The "|" token. */
128
+ readonly pipeToken: Token;
129
+ /**
130
+ * A non-empty sequence of field names.
131
+ * If the key type is an enum type, the last field name is guaranteed to be
132
+ * "kind".
133
+ */
134
+ readonly path: ReadonlyArray<Mutable extends true ? MutableFieldPathItem : Readonly<MutableFieldPathItem>>;
135
+ /** The type used to key every item: either a primitive or an enum. */
136
+ keyType: PrimitiveType | ResolvedRecordRef;
137
+ }
138
+ export type FieldPath<Mutable extends boolean = boolean> = Mutable extends true ? MutableFieldPath : Readonly<MutableFieldPath<false>>;
139
+ export interface ArrayType<Type = ResolvedType, Mutable extends boolean = boolean> {
140
+ readonly kind: "array";
141
+ readonly item: Type;
142
+ /**
143
+ * If set, the value obtained by following the field path from an item can be
144
+ * used as a unique key for the item. The user takes responsibility for
145
+ * ensuring that not two items in the array have the same key.
146
+ * The item type must be a struct type.
147
+ */
148
+ readonly key: FieldPath<Mutable> | undefined;
149
+ }
150
+ export type UnresolvedArrayType = ArrayType<UnresolvedType>;
151
+ export type MutableArrayType = ArrayType<ResolvedType, true>;
152
+ export interface OptionalType<Type = ResolvedType> {
153
+ readonly kind: "optional";
154
+ readonly other: Type;
155
+ }
156
+ /**
157
+ * Result of parsing a type from a `.skir` file, without resolving the record
158
+ * references.
159
+ */
160
+ export type UnresolvedType = PrimitiveType | UnresolvedRecordRef | UnresolvedArrayType | OptionalType<UnresolvedType>;
161
+ /**
162
+ * Result of recursively resolving the record references in an unresolved type.
163
+ * When Mutable is true, the optional field path of an array type can be
164
+ * modified.
165
+ */
166
+ export type ResolvedType<Mutable extends boolean = boolean> = PrimitiveType | ResolvedRecordRef | ArrayType<ResolvedType, Mutable> | OptionalType<ResolvedType<Mutable>>;
167
+ export type MutableResolvedType = ResolvedType<true>;
168
+ /** Field of a struct or enum. */
169
+ export interface MutableField<Mutable extends boolean = true> {
170
+ readonly kind: "field";
171
+ readonly name: Token;
172
+ readonly number: number;
173
+ /** May only be undefined if the field is a constant in an enum. */
174
+ readonly unresolvedType: UnresolvedType | undefined;
175
+ /** May only be undefined if the field is a constant in an enum. */
176
+ type: ResolvedType<Mutable> | undefined;
177
+ /**
178
+ * Evaluates to true if the value type of the field depends on the record
179
+ * where the field is defined. If `Struct.DEFAULT.field` is or contains
180
+ * `Struct.DEFAULT`, then the dependency is "hard", otherwise it is "soft".
181
+ *
182
+ * Examples:
183
+ * struct A { s: string; } // false
184
+ * struct B { b: B; } // "hard"
185
+ * struct C { c: C?; } // "soft"
186
+ * struct D { d: [D]; } // "soft"
187
+ * struct E { f: F; } // "hard"
188
+ * struct F { e: E; } // "hard"
189
+ * struct G { b: B; } // false
190
+ * struct H { i: I; } // "soft"
191
+ * enum I { h: H; } // "soft"
192
+ */
193
+ isRecursive: false | "soft" | "hard";
194
+ }
195
+ /** Field of a struct or enum. */
196
+ export type Field<Mutable extends boolean = boolean> = Mutable extends true ? MutableField : Readonly<MutableField<false>>;
197
+ /** A 'removed' declaration in a struct or enum. */
198
+ export interface Removed {
199
+ readonly kind: "removed";
200
+ /** The 'removed' keyword token. */
201
+ readonly removedToken: Token;
202
+ readonly numbers: readonly number[];
203
+ }
204
+ /** A declaration within a record. */
205
+ export type RecordLevelDeclaration<Mutable extends boolean = boolean> = Field | Removed | Record<Mutable>;
206
+ export type MutableRecordLevelDeclaration = RecordLevelDeclaration<true>;
207
+ export type Numbering = "" | "implicit" | "explicit" | "broken";
208
+ /** Definition of a struct or enum type. */
209
+ export interface Record<Mutable extends boolean = boolean> {
210
+ readonly kind: "record";
211
+ /** Uniquely identifies the record within the module set. */
212
+ readonly key: RecordKey;
213
+ readonly name: Token;
214
+ readonly recordType: "struct" | "enum";
215
+ /** Maps a field or nested record name to the corresponding declaration. */
216
+ readonly nameToDeclaration: {
217
+ [n: string]: RecordLevelDeclaration<Mutable>;
218
+ };
219
+ readonly declarations: ReadonlyArray<RecordLevelDeclaration<Mutable>>;
220
+ readonly fields: ReadonlyArray<Field<Mutable>>;
221
+ readonly nestedRecords: ReadonlyArray<Record<Mutable>>;
222
+ readonly numbering: Numbering;
223
+ readonly removedNumbers: readonly number[];
224
+ /**
225
+ * A number which uniquely identifies this record, if specified.
226
+ * Syntax: `struct Foo(123) { ... }`
227
+ */
228
+ readonly recordNumber: number | null;
229
+ /**
230
+ * If the record is a struct, 1 + the maximum field number.
231
+ * Zero if the record is an enum.
232
+ */
233
+ readonly numSlots: number;
234
+ /**
235
+ * If the record is a struct, 1 + the maximum of all field numbers and removed
236
+ * numbers.
237
+ * Zero if the record is an enum.
238
+ */
239
+ readonly numSlotsInclRemovedNumbers: number;
240
+ }
241
+ export type MutableRecord = Record<true>;
242
+ export interface MutableImport {
243
+ readonly kind: "import";
244
+ readonly importedNames: Token[];
245
+ /** The token corresponding to the quoted string. */
246
+ readonly modulePath: Token;
247
+ resolvedModulePath?: string;
248
+ }
249
+ export type Import<Mutable extends boolean = boolean> = Mutable extends true ? MutableImport : Readonly<MutableImport>;
250
+ export interface MutableImportAlias {
251
+ readonly kind: "import-alias";
252
+ /** The alias. */
253
+ readonly name: Token;
254
+ /** The token corresponding to the quoted string. */
255
+ readonly modulePath: Token;
256
+ resolvedModulePath?: string;
257
+ }
258
+ export type ImportAlias<Mutable extends boolean = boolean> = Mutable extends true ? MutableImportAlias : Readonly<MutableImportAlias>;
259
+ export interface MutableMethod<Mutable extends boolean = true> {
260
+ readonly kind: "method";
261
+ readonly name: Token;
262
+ readonly unresolvedRequestType: UnresolvedType;
263
+ readonly unresolvedResponseType: UnresolvedType;
264
+ requestType: ResolvedType<Mutable> | undefined;
265
+ responseType: ResolvedType<Mutable> | undefined;
266
+ readonly number: number;
267
+ readonly hasExplicitNumber: boolean;
268
+ }
269
+ export type Method<Mutable extends boolean = boolean> = Mutable extends true ? MutableMethod : Readonly<MutableMethod<false>>;
270
+ /** A `const` declaration. */
271
+ export interface MutableConstant<Mutable extends boolean = true> {
272
+ readonly kind: "constant";
273
+ readonly name: Token;
274
+ readonly unresolvedType: UnresolvedType;
275
+ type: ResolvedType<Mutable> | undefined;
276
+ readonly value: Value;
277
+ valueAsDenseJson: DenseJson | undefined;
278
+ }
279
+ export type Constant<Mutable extends boolean = boolean> = Mutable extends true ? MutableConstant : Readonly<MutableConstant<false>>;
280
+ /** A name:value entry of an object. */
281
+ export interface MutableObjectEntry<Mutable extends boolean = true> {
282
+ readonly name: Token;
283
+ readonly value: Value<Mutable>;
284
+ }
285
+ export type ObjectEntry<Mutable extends boolean = boolean> = Mutable extends true ? MutableObjectEntry : Readonly<MutableObjectEntry<false>>;
286
+ /** An object value, for example `{r: 255, g: 0, b: 0}`. */
287
+ export interface MutableObjectValue<Mutable extends boolean = true> {
288
+ readonly kind: "object";
289
+ readonly token: Token;
290
+ readonly entries: Readonly<{
291
+ [f: string]: ObjectEntry<Mutable>;
292
+ }>;
293
+ partial: boolean;
294
+ type?: RecordKey;
295
+ }
296
+ export type ObjectValue<Mutable extends boolean = boolean> = Mutable extends true ? MutableObjectValue : Readonly<MutableObjectValue<false>>;
297
+ /** An array value, for example `[0, 1, 2]`. */
298
+ export interface MutableArrayValue<Mutable extends boolean = true> {
299
+ readonly kind: "array";
300
+ readonly token: Token;
301
+ readonly items: ReadonlyArray<Value<Mutable>>;
302
+ key?: FieldPath | undefined;
303
+ }
304
+ export type ArrayValue<Mutable extends boolean = boolean> = Mutable extends true ? MutableArrayValue : Readonly<MutableArrayValue<false>>;
305
+ /** One of: a quoted string, a number, `true`, `false`. */
306
+ export interface MutableLiteralValue {
307
+ readonly kind: "literal";
308
+ readonly token: Token;
309
+ type?: PrimitiveType | {
310
+ kind: "enum";
311
+ key: RecordKey;
312
+ } | {
313
+ kind: "null";
314
+ };
315
+ }
316
+ export type LiteralValue<Mutable extends boolean = boolean> = Mutable extends true ? MutableLiteralValue : Readonly<MutableLiteralValue>;
317
+ /** The value on the right side of the `=` symbol of a `const` declaration. */
318
+ export type Value<Mutable extends boolean = boolean> = ObjectValue<Mutable> | ArrayValue<Mutable> | LiteralValue<Mutable>;
319
+ export type MutableValue = Value<true>;
320
+ /** Result of serializing a skir value to dense JSON format. */
321
+ export type DenseJson = null | boolean | number | string | readonly DenseJson[];
322
+ /** A declaration which can appear at the top-level of a module. */
323
+ export type ModuleLevelDeclaration<Mutable extends boolean = boolean> = Record<Mutable> | Import<Mutable> | ImportAlias<Mutable> | Method<Mutable> | Constant<Mutable>;
324
+ export type MutableModuleLevelDeclaration = ModuleLevelDeclaration<true>;
325
+ export type Declaration<Mutable extends boolean = boolean> = RecordLevelDeclaration<Mutable> | ModuleLevelDeclaration<Mutable>;
326
+ export type MutableDeclaration = Declaration<true>;
327
+ /**
328
+ * Contains the definition of a record and information about where the record
329
+ * was defined.
330
+ */
331
+ export interface RecordLocation<Mutable extends boolean = boolean> {
332
+ readonly kind: "record-location";
333
+ readonly record: Record<Mutable>;
334
+ /**
335
+ * Chain of records from the top-level record to `record` included.
336
+ * Every record is nested within the record preceding it in the chain.
337
+ */
338
+ readonly recordAncestors: readonly Record[];
339
+ readonly modulePath: string;
340
+ }
341
+ export type MutableRecordLocation = RecordLocation<true>;
342
+ /** The set of names from one module imported to another module. */
343
+ export type ImportedNames = {
344
+ kind: "all";
345
+ alias: string;
346
+ } | {
347
+ kind: "some";
348
+ names: ReadonlySet<string>;
349
+ };
350
+ export interface Module<Mutable extends boolean = boolean> {
351
+ readonly kind: "module";
352
+ readonly path: string;
353
+ readonly sourceCode: string;
354
+ readonly nameToDeclaration: {
355
+ [n: string]: ModuleLevelDeclaration<Mutable>;
356
+ };
357
+ readonly declarations: ReadonlyArray<ModuleLevelDeclaration<Mutable>>;
358
+ /**
359
+ * Maps the path (to another module) to the corresponding import declarations in
360
+ * this module.
361
+ */
362
+ readonly pathToImportedNames: {
363
+ [path: string]: ImportedNames;
364
+ };
365
+ /**
366
+ * All the record declared in the module, at the top-level or not.
367
+ * Depth-first: "Foo.Bar" will appear before "Foo".
368
+ */
369
+ readonly records: Mutable extends true ? MutableRecordLocation[] : readonly RecordLocation[];
370
+ readonly methods: ReadonlyArray<Method<Mutable>>;
371
+ readonly constants: ReadonlyArray<Constant<Mutable>>;
372
+ }
373
+ /** Can be assigned to a `Module`. */
374
+ export type MutableModule = Module<true>;
375
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAM7B;;GAEG;AACH,MAAM,WAAW,aAAa,CAAC,MAAM,GAAG,OAAO;IAC7C,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,UAAU,EAAE,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IACvC,YAAY,CAAC,KAAK,EAAE,aAAa,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,aAAa,CAAC,MAAM,CAAC;CACxE;AAED,MAAM,CAAC,OAAO,WAAW,aAAa,CAAC;IACrC,UAAiB,KAAK,CAAC,MAAM;QAC3B,QAAQ,CAAC,OAAO,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;QACxC,QAAQ,CAAC,SAAS,EAAE,WAAW,CAAC,SAAS,EAAE,cAAc,CAAC,CAAC;QAC3D,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;KACzB;IAED,UAAiB,MAAM;QACrB,QAAQ,CAAC,KAAK,EAAE,SAAS,UAAU,EAAE,CAAC;KACvC;IAED,UAAiB,UAAU;QACzB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;QACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;KACvB;CACF;AAMD,4BAA4B;AAC5B,MAAM,WAAW,QAAQ;IACvB,kBAAkB;IAClB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5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,CAAC,YAAY,EAAE,aAAa,CAAC,sBAAsB,CAAC,OAAO,CAAC,CAAC,CAAC;IAEtE;;;OAGG;IACH,QAAQ,CAAC,mBAAmB,EAAE;QAAE,CAAC,IAAI,EAAE,MAAM,GAAG,aAAa,CAAA;KAAE,CAAC;IAEhE;;;OAGG;IACH,QAAQ,CAAC,OAAO,EAAE,OAAO,SAAS,IAAI,GAClC,qBAAqB,EAAE,GACvB,SAAS,cAAc,EAAE,CAAC;IAE9B,QAAQ,CAAC,OAAO,EAAE,aAAa,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC;IAEjD,QAAQ,CAAC,SAAS,EAAE,aAAa,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC;CACtD;AAED,qCAAqC;AACrC,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC"}
package/dist/types.js ADDED
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
package/package.json ADDED
@@ -0,0 +1,63 @@
1
+ {
2
+ "name": "skir",
3
+ "version": "0.0.1",
4
+ "description": "",
5
+ "homepage": "https://github.com/gepheum/skir#readme",
6
+ "bugs": {
7
+ "url": "https://github.com/gepheum/skir/issues"
8
+ },
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "git+https://github.com/gepheum/skir.git"
12
+ },
13
+ "license": "ISC",
14
+ "author": "Tyler Fibonacci <gepheum@gmail.com>",
15
+ "type": "module",
16
+ "exports": {
17
+ ".": {
18
+ "import": "./dist/index.js",
19
+ "require": "./dist/index.js"
20
+ },
21
+ "./dist/*": {
22
+ "import": "./dist/*",
23
+ "require": "./dist/*"
24
+ }
25
+ },
26
+ "main": "./dist/index.js",
27
+ "module": "./dist/index.js",
28
+ "bin": "./dist/compiler.js",
29
+ "files": [
30
+ "dist",
31
+ "src",
32
+ "!**/*.test.ts"
33
+ ],
34
+ "scripts": {
35
+ "build": "tsc",
36
+ "format": "prettier --write \"src/**/*.ts\"",
37
+ "format:check": "prettier --check \"src/**/*.ts\"",
38
+ "skir": "npm run build && node ./dist/compiler.js",
39
+ "test": "mocha",
40
+ "lint": "eslint src/**/*.ts",
41
+ "lint:fix": "eslint src/**/*.ts --fix"
42
+ },
43
+ "dependencies": {
44
+ "glob": "^11.0.1",
45
+ "watcher": "^2.3.1",
46
+ "yaml": "^2.7.1",
47
+ "zod": "^3.24.3",
48
+ "zod-validation-error": "^3.4.0"
49
+ },
50
+ "devDependencies": {
51
+ "@types/mocha": "^10.0.1",
52
+ "@types/node": "^20.6.0",
53
+ "@typescript-eslint/eslint-plugin": "^6.13.0",
54
+ "@typescript-eslint/parser": "^6.13.0",
55
+ "eslint": "^8.54.0",
56
+ "prettier-plugin-organize-imports": "^4.2.0",
57
+ "buckwheat": "^1.1.2",
58
+ "mocha": "^10.2.0",
59
+ "prettier": "^3.2.4",
60
+ "ts-node": "^10.9.2",
61
+ "typescript": "^5.2.2"
62
+ }
63
+ }
package/src/casing.ts ADDED
@@ -0,0 +1,64 @@
1
+ import type { Casing, ErrorSink, Token } from "./types.js";
2
+
3
+ /** Registers an error if the given token does not match the expected casing. */
4
+ export function validate(
5
+ name: Token,
6
+ expected: "lower_underscore" | "UpperCamel" | "UPPER_UNDERSCORE",
7
+ errors: ErrorSink,
8
+ ): void {
9
+ if (!caseMatches(name.text, expected)) {
10
+ errors.push({
11
+ token: name,
12
+ expected: expected,
13
+ });
14
+ }
15
+ }
16
+
17
+ export function convertCase(
18
+ text: string,
19
+ source: Casing,
20
+ target: Casing,
21
+ ): string {
22
+ let words: string[];
23
+ switch (source) {
24
+ case "lowerCamel":
25
+ case "UpperCamel":
26
+ words = text.split(/(?=[A-Z])/).map((w) => w.toLowerCase());
27
+ break;
28
+ case "lower_underscore":
29
+ words = text.split("_");
30
+ break;
31
+ case "UPPER_UNDERSCORE":
32
+ words = text.split("_").map((w) => w.toLowerCase());
33
+ break;
34
+ }
35
+ switch (target) {
36
+ case "lowerCamel":
37
+ return words.map((w, i) => (i ? capitalize(w) : w)).join("");
38
+ case "lower_underscore":
39
+ return words.join("_");
40
+ case "UpperCamel":
41
+ return words.map(capitalize).join("");
42
+ case "UPPER_UNDERSCORE":
43
+ return words.map((w) => w.toUpperCase()).join("_");
44
+ }
45
+ }
46
+
47
+ /** Returns a new string with the first letter of `name` capitalized. */
48
+ export function capitalize(name: string): string {
49
+ return name[0]!.toUpperCase() + name.slice(1);
50
+ }
51
+
52
+ export function caseMatches(
53
+ name: string,
54
+ expected: "lower_underscore" | "UpperCamel" | "UPPER_UNDERSCORE",
55
+ ): boolean {
56
+ switch (expected) {
57
+ case "lower_underscore":
58
+ return /^[a-z][0-9a-z]*(_[a-z][0-9a-z]*)*$/.test(name);
59
+ case "UpperCamel":
60
+ return /^[A-Z][0-9A-Za-z]*$/.test(name);
61
+ case "UPPER_UNDERSCORE":
62
+ return /^[A-Z][0-9A-Z]*(_[A-Z][0-9A-Z]*)*$/.test(name);
63
+ }
64
+ }