skir 1.2.3 → 1.2.5

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 (99) hide show
  1. package/README.md +1 -1
  2. package/dist/config_parser.d.ts.map +1 -1
  3. package/dist/module_collector.d.ts.map +1 -1
  4. package/dist/parser.d.ts.map +1 -1
  5. package/package.json +6 -4
  6. package/src/config_parser.ts +4 -1
  7. package/src/module_collector.ts +18 -20
  8. package/src/parser.ts +12 -0
  9. package/src/project_initializer.ts +18 -0
  10. package/dist/casing.d.ts +0 -5
  11. package/dist/casing.js +0 -23
  12. package/dist/casing.js.map +0 -1
  13. package/dist/command_line_parser.d.ts +0 -36
  14. package/dist/command_line_parser.d.ts.map +0 -1
  15. package/dist/command_line_parser.js +0 -240
  16. package/dist/command_line_parser.js.map +0 -1
  17. package/dist/compatibility_checker.d.ts +0 -74
  18. package/dist/compatibility_checker.js +0 -331
  19. package/dist/compatibility_checker.js.map +0 -1
  20. package/dist/compiler.d.ts +0 -3
  21. package/dist/compiler.js +0 -406
  22. package/dist/compiler.js.map +0 -1
  23. package/dist/completion_helper.d.ts +0 -27
  24. package/dist/completion_helper.js +0 -101
  25. package/dist/completion_helper.js.map +0 -1
  26. package/dist/config.d.ts +0 -18
  27. package/dist/config.js +0 -19
  28. package/dist/config.js.map +0 -1
  29. package/dist/config_parser.d.ts +0 -34
  30. package/dist/config_parser.js +0 -214
  31. package/dist/config_parser.js.map +0 -1
  32. package/dist/definition_finder.d.ts +0 -16
  33. package/dist/definition_finder.js +0 -375
  34. package/dist/definition_finder.js.map +0 -1
  35. package/dist/dependency_manager.d.ts +0 -14
  36. package/dist/dependency_manager.js +0 -109
  37. package/dist/dependency_manager.js.map +0 -1
  38. package/dist/doc_comment_parser.d.ts +0 -6
  39. package/dist/doc_comment_parser.js +0 -269
  40. package/dist/doc_comment_parser.js.map +0 -1
  41. package/dist/doc_reference_resolver.d.ts +0 -5
  42. package/dist/doc_reference_resolver.js +0 -232
  43. package/dist/doc_reference_resolver.js.map +0 -1
  44. package/dist/error_renderer.d.ts +0 -24
  45. package/dist/error_renderer.js +0 -326
  46. package/dist/error_renderer.js.map +0 -1
  47. package/dist/exit_error.d.ts +0 -8
  48. package/dist/exit_error.d.ts.map +0 -1
  49. package/dist/exit_error.js +0 -8
  50. package/dist/exit_error.js.map +0 -1
  51. package/dist/expected_names.d.ts +0 -11
  52. package/dist/expected_names.js +0 -34
  53. package/dist/expected_names.js.map +0 -1
  54. package/dist/formatter.d.ts +0 -28
  55. package/dist/formatter.js +0 -338
  56. package/dist/formatter.js.map +0 -1
  57. package/dist/get_dependencies_flow.d.ts +0 -40
  58. package/dist/get_dependencies_flow.js +0 -177
  59. package/dist/get_dependencies_flow.js.map +0 -1
  60. package/dist/import_block_formatter.d.ts +0 -3
  61. package/dist/import_block_formatter.js +0 -36
  62. package/dist/import_block_formatter.js.map +0 -1
  63. package/dist/index.d.ts +0 -2
  64. package/dist/index.d.ts.map +0 -1
  65. package/dist/index.js +0 -2
  66. package/dist/index.js.map +0 -1
  67. package/dist/io.d.ts +0 -23
  68. package/dist/io.d.ts.map +0 -1
  69. package/dist/io.js +0 -58
  70. package/dist/io.js.map +0 -1
  71. package/dist/literals.d.ts +0 -12
  72. package/dist/literals.js +0 -96
  73. package/dist/literals.js.map +0 -1
  74. package/dist/module_collector.d.ts +0 -9
  75. package/dist/module_collector.js +0 -75
  76. package/dist/module_collector.js.map +0 -1
  77. package/dist/module_set.d.ts +0 -51
  78. package/dist/module_set.js +0 -1331
  79. package/dist/module_set.js.map +0 -1
  80. package/dist/package_downloader.d.ts +0 -4
  81. package/dist/package_downloader.js +0 -256
  82. package/dist/package_downloader.js.map +0 -1
  83. package/dist/package_types.d.ts +0 -30
  84. package/dist/package_types.d.ts.map +0 -1
  85. package/dist/package_types.js +0 -2
  86. package/dist/package_types.js.map +0 -1
  87. package/dist/parser.d.ts +0 -7
  88. package/dist/parser.js +0 -1323
  89. package/dist/parser.js.map +0 -1
  90. package/dist/project_initializer.d.ts +0 -2
  91. package/dist/project_initializer.d.ts.map +0 -1
  92. package/dist/project_initializer.js +0 -189
  93. package/dist/project_initializer.js.map +0 -1
  94. package/dist/snapshotter.d.ts +0 -16
  95. package/dist/snapshotter.js +0 -263
  96. package/dist/snapshotter.js.map +0 -1
  97. package/dist/tokenizer.d.ts +0 -18
  98. package/dist/tokenizer.js +0 -244
  99. package/dist/tokenizer.js.map +0 -1
package/README.md CHANGED
@@ -1,5 +1,5 @@
1
1
  <div align="center">
2
- <h1>🐙 Skir 🐙</h1>
2
+ <h1>Skir</h1>
3
3
  <p><strong>Like Protobuf, without the pain</strong></p>
4
4
 
5
5
  <p>
@@ -1 +1 @@
1
- {"version":3,"file":"config_parser.d.ts","sourceRoot":"","sources":["../src/config_parser.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAQ9C,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,MAAM,WAAW,gBAAgB;IAC/B,gDAAgD;IAChD,UAAU,EAAE,UAAU,GAAG,SAAS,CAAC;IACnC,MAAM,EAAE,SAAS,eAAe,EAAE,CAAC;IACnC;;;OAGG;IACH,0BAA0B,CAAC,EAAE,OAAO,CAAC;CACtC;AAED,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,oBAAoB,CAAC;CAC9B;AAED,MAAM,WAAW,oBAAoB;IACnC,KAAK,EAAE,kBAAkB,CAAC;IAC1B,GAAG,EAAE,kBAAkB,CAAC;CACzB;AAED,MAAM,WAAW,kBAAkB;IACjC,cAAc;IACd,MAAM,EAAE,MAAM,CAAC;IACf,cAAc;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,cAAc;IACd,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,uDAAuD;AACvD,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,gBAAgB,CAElE;AAED,6DAA6D;AAC7D,wBAAsB,iCAAiC,CACrD,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,gBAAgB,CAAC,CAE3B;AAED,wBAAsB,mBAAmB,CACvC,GAAG,EAAE,MAAM,GACV,OAAO,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC,CAOjC"}
1
+ {"version":3,"file":"config_parser.d.ts","sourceRoot":"","sources":["../src/config_parser.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAS9C,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,MAAM,WAAW,gBAAgB;IAC/B,gDAAgD;IAChD,UAAU,EAAE,UAAU,GAAG,SAAS,CAAC;IACnC,MAAM,EAAE,SAAS,eAAe,EAAE,CAAC;IACnC;;;OAGG;IACH,0BAA0B,CAAC,EAAE,OAAO,CAAC;CACtC;AAED,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,oBAAoB,CAAC;CAC9B;AAED,MAAM,WAAW,oBAAoB;IACnC,KAAK,EAAE,kBAAkB,CAAC;IAC1B,GAAG,EAAE,kBAAkB,CAAC;CACzB;AAED,MAAM,WAAW,kBAAkB;IACjC,cAAc;IACd,MAAM,EAAE,MAAM,CAAC;IACf,cAAc;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,cAAc;IACd,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,uDAAuD;AACvD,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,gBAAgB,CAElE;AAED,6DAA6D;AAC7D,wBAAsB,iCAAiC,CACrD,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,gBAAgB,CAAC,CAE3B;AAED,wBAAsB,mBAAmB,CACvC,GAAG,EAAE,MAAM,GACV,OAAO,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC,CAOjC"}
@@ -1 +1 @@
1
- {"version":3,"file":"module_collector.d.ts","sourceRoot":"","sources":["../src/module_collector.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,wBAAsB,cAAc,CAClC,MAAM,EAAE,MAAM,EACd,YAAY,EAAE,SAAS,EACvB,KAAK,CAAC,EAAE,SAAS,GAChB,OAAO,CAAC,SAAS,CAAC,CAUpB;AAED,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AAED,wBAAsB,sBAAsB,CAC1C,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,aAAa,CAAC,cAAc,CAAC,CAAC,CAkCxC"}
1
+ {"version":3,"file":"module_collector.d.ts","sourceRoot":"","sources":["../src/module_collector.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,wBAAsB,cAAc,CAClC,MAAM,EAAE,MAAM,EACd,YAAY,EAAE,SAAS,EACvB,KAAK,CAAC,EAAE,SAAS,GAChB,OAAO,CAAC,SAAS,CAAC,CAUpB;AAED,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AAED,wBAAsB,sBAAsB,CAC1C,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,aAAa,CAAC,cAAc,CAAC,CAAC,CAgCxC"}
@@ -1 +1 @@
1
- {"version":3,"file":"parser.d.ts","sourceRoot":"","sources":["../src/parser.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAgBV,aAAa,EAab,MAAM,EAMP,MAAM,eAAe,CAAC;AAIvB,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,2CAA2C;AAC3C,wBAAgB,WAAW,CACzB,YAAY,EAAE,YAAY,EAC1B,IAAI,EAAE,QAAQ,GAAG,SAAS,GACzB,MAAM,CAAC,aAAa,CAAC,CA4IvB;AA4xCD,sEAAsE;AACtE,wBAAgB,oBAAoB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAG/D"}
1
+ {"version":3,"file":"parser.d.ts","sourceRoot":"","sources":["../src/parser.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAgBV,aAAa,EAab,MAAM,EAMP,MAAM,eAAe,CAAC;AAIvB,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,2CAA2C;AAC3C,wBAAgB,WAAW,CACzB,YAAY,EAAE,YAAY,EAC1B,IAAI,EAAE,QAAQ,GAAG,SAAS,GACzB,MAAM,CAAC,aAAa,CAAC,CA4IvB;AAwyCD,sEAAsE;AACtE,wBAAgB,oBAAoB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAG/D"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "skir",
3
- "version": "1.2.3",
3
+ "version": "1.2.5",
4
4
  "description": "",
5
5
  "homepage": "https://skir.build/",
6
6
  "bugs": {
@@ -32,7 +32,7 @@
32
32
  "!**/*.test.ts"
33
33
  ],
34
34
  "scripts": {
35
- "build": "tsc",
35
+ "build": "tsc -p tsconfig.build.json",
36
36
  "format": "prettier --write \"src/**/*.ts\"",
37
37
  "format:check": "prettier --check \"src/**/*.ts\"",
38
38
  "skir": "npm run build && node ./dist/compiler.js",
@@ -42,8 +42,9 @@
42
42
  },
43
43
  "dependencies": {
44
44
  "glob": "^13.0.6",
45
- "skir-cc-gen": "^1.0.13",
45
+ "skir-cc-gen": "^1.0.14",
46
46
  "skir-dart-gen": "^1.0.5",
47
+ "skir-gleam-gen": "^0.1.1",
47
48
  "skir-go-gen": "^0.1.5",
48
49
  "skir-internal": "^0.2.19",
49
50
  "skir-java-gen": "^1.0.8",
@@ -52,6 +53,7 @@
52
53
  "skir-rust-gen": "^0.1.3",
53
54
  "skir-swift-gen": "^0.1.4",
54
55
  "skir-typescript-gen": "^1.0.9",
56
+ "skir-zig-gen": "^0.1.4",
55
57
  "watcher": "^2.3.1",
56
58
  "yaml": "^2.7.1",
57
59
  "zod": "^4.3.6"
@@ -59,7 +61,7 @@
59
61
  "devDependencies": {
60
62
  "@eslint/js": "^10.0.1",
61
63
  "@types/mocha": "^10.0.1",
62
- "@types/node": "^20.6.0",
64
+ "@types/node": "^20.19.39",
63
65
  "@typescript-eslint/eslint-plugin": "^8.56.0",
64
66
  "@typescript-eslint/parser": "^8.56.0",
65
67
  "buckwheat": "^1.1.2",
@@ -1,5 +1,6 @@
1
1
  import * as CcGen from "skir-cc-gen";
2
2
  import * as DartGen from "skir-dart-gen";
3
+ import * as GleamGen from "skir-gleam-gen";
3
4
  import * as GoGen from "skir-go-gen";
4
5
  import { CodeGenerator } from "skir-internal";
5
6
  import * as JavaGen from "skir-java-gen";
@@ -8,6 +9,7 @@ import * as PythonGen from "skir-python-gen";
8
9
  import * as RustGen from "skir-rust-gen";
9
10
  import * as SwiftGen from "skir-swift-gen";
10
11
  import * as TypescriptGen from "skir-typescript-gen";
12
+ import * as ZigGen from "skir-zig-gen";
11
13
  import { LineCounter, parseDocument, Scalar, YAMLMap } from "yaml";
12
14
  import { SkirConfig } from "./config.js";
13
15
 
@@ -280,16 +282,17 @@ async function parseSkirConfigInternalAsync(
280
282
  return { skirConfig: zodResult.data!, errors: [] };
281
283
  }
282
284
 
283
- // TODO: remove the casts
284
285
  const STATIC_GENERATORS: Record<string, CodeGenerator<unknown>> = {
285
286
  "skir-cc-gen": CcGen.GENERATOR as any as CodeGenerator<unknown>,
286
287
  "skir-dart-gen": DartGen.GENERATOR as any as CodeGenerator<unknown>,
288
+ "skir-gleam-gen": GleamGen.GENERATOR as any as CodeGenerator<unknown>,
287
289
  "skir-go-gen": GoGen.GENERATOR as any as CodeGenerator<unknown>,
288
290
  "skir-java-gen": JavaGen.GENERATOR as any as CodeGenerator<unknown>,
289
291
  "skir-kotlin-gen": KotlinGen.GENERATOR as any as CodeGenerator<unknown>,
290
292
  "skir-python-gen": PythonGen.GENERATOR as any as CodeGenerator<unknown>,
291
293
  "skir-rust-gen": RustGen.GENERATOR as any as CodeGenerator<unknown>,
292
294
  "skir-swift-gen": SwiftGen.GENERATOR as any as CodeGenerator<unknown>,
295
+ "skir-zig-gen": ZigGen.GENERATOR as any as CodeGenerator<unknown>,
293
296
  "skir-typescript-gen":
294
297
  TypescriptGen.GENERATOR as any as CodeGenerator<unknown>,
295
298
  };
@@ -44,28 +44,26 @@ export async function collectEditableModules(
44
44
  );
45
45
  }
46
46
  }
47
- const result: EditableModule[] = [];
48
- for (const skirFile of skirFiles) {
49
- if (!skirFile.isFile) {
50
- continue;
51
- }
52
- const relativePath = //
53
- Paths.relative(srcDir, skirFile.fullpath()).replace(/\\/g, "/");
54
47
 
55
- validate(relativePath);
56
- const content = REAL_FILE_SYSTEM.readTextFile(skirFile.fullpath());
57
- if (content === undefined) {
58
- throw new ExitError(
59
- "Cannot read " + rewritePathForRendering(skirFile.fullpath()),
60
- );
61
- }
62
- result.push({
63
- fullPath: skirFile.fullpath(),
64
- modulePath: relativePath,
65
- content: content,
48
+ const modules = skirFiles
49
+ .filter((skirFile) => skirFile.isFile)
50
+ .map(async (skirFile): Promise<EditableModule> => {
51
+ const fullPath = skirFile.fullpath();
52
+ const relativePath = Paths.relative(srcDir, fullPath).replace(/\\/g, "/");
53
+
54
+ validate(relativePath);
55
+ const content = await REAL_FILE_SYSTEM.readTextFileAsync(fullPath);
56
+ if (content === undefined) {
57
+ throw new ExitError("Cannot read " + rewritePathForRendering(fullPath));
58
+ }
59
+ return {
60
+ fullPath: fullPath,
61
+ modulePath: relativePath,
62
+ content: content,
63
+ };
66
64
  });
67
- }
68
- return result;
65
+
66
+ return Promise.all(modules);
69
67
  }
70
68
 
71
69
  function validate(relativePath: string): void {
package/src/parser.ts CHANGED
@@ -366,6 +366,17 @@ class RecordBuilder {
366
366
  // Register the record/field name and make sure it's unique.
367
367
  if (nameToken !== undefined) {
368
368
  const name = nameToken.text;
369
+ if (this.recordType === "enum" && declaration.kind === "field") {
370
+ const foldedName = name.toLowerCase();
371
+ if (this.enumFoldedVariantNames.has(foldedName)) {
372
+ this.errors.push({
373
+ token: nameToken,
374
+ message: `Duplicate identifier '${name}'`,
375
+ });
376
+ return;
377
+ }
378
+ this.enumFoldedVariantNames.add(foldedName);
379
+ }
369
380
  if (name in this.nameToDeclaration) {
370
381
  this.errors.push({
371
382
  token: nameToken,
@@ -459,6 +470,7 @@ class RecordBuilder {
459
470
 
460
471
  private nameToDeclaration: { [n: string]: MutableRecordLevelDeclaration } =
461
472
  {};
473
+ private enumFoldedVariantNames = new Set<string>();
462
474
  private numbers = new Set<number>();
463
475
  private numbering: Numbering = "";
464
476
  private removedNumbers: number[] = [];
@@ -86,6 +86,15 @@ generators:
86
86
  # outDir: ./lib/skirout
87
87
  # config: {}
88
88
 
89
+ # # --------------------------------------------------------------------------
90
+ # # Gleam code generator
91
+ # # Home: https://github.com/gepheum/skir-gleam-gen
92
+ # # To install runtime dependencies: gleam add skir_client
93
+ # # --------------------------------------------------------------------------
94
+ # - mod: skir-gleam-gen
95
+ # outDir: ./src/skirout
96
+ # config: {}
97
+
89
98
  # # --------------------------------------------------------------------------
90
99
  # # Go code generator
91
100
  # # Home: https://github.com/gepheum/skir-go-gen
@@ -175,6 +184,15 @@ generators:
175
184
  # # Use ".js" for ES modules, "" for CommonJS
176
185
  # importPathExtension: ".js"
177
186
 
187
+ # # --------------------------------------------------------------------------
188
+ # # Zig code generator
189
+ # # Home: https://github.com/gepheum/skir-zig-gen
190
+ # # To install runtime dependencies: zig fetch --save https://github.com/gepheum/skir-zig-client/archive/refs/tags/\${latest_tag}.tar.gz
191
+ # # --------------------------------------------------------------------------
192
+ # - mod: skir-zig-gen
193
+ # outDir: ./src/skirout
194
+ # config: {}
195
+
178
196
  # # --------------------------------------------------------------------------
179
197
  # # External Skir dependencies hosted on GitHub
180
198
  # # To use an external repository, specify the GitHub repository identifier
package/dist/casing.d.ts DELETED
@@ -1,5 +0,0 @@
1
- import type { ErrorSink, Token } from "skir-internal";
2
- /** Registers an error if the given token does not match the expected casing. */
3
- export declare function validate(name: Token, expected: "lower_underscore" | "UpperCamel" | "UPPER_UNDERSCORE", errors: ErrorSink): void;
4
- export declare function caseMatches(name: string, expected: "lower_underscore" | "UpperCamel" | "UPPER_UNDERSCORE"): boolean;
5
- //# sourceMappingURL=casing.d.ts.map
package/dist/casing.js DELETED
@@ -1,23 +0,0 @@
1
- /** Registers an error if the given token does not match the expected casing. */
2
- export function validate(name, expected, errors) {
3
- if (!caseMatches(name.text, expected)) {
4
- errors.push({
5
- token: name,
6
- expected: expected,
7
- });
8
- }
9
- }
10
- export function caseMatches(name, expected) {
11
- switch (expected) {
12
- case "lower_underscore":
13
- return /^[a-z][0-9a-z]*(_[a-z][0-9a-z]*)*$/.test(name);
14
- case "UpperCamel":
15
- return (/^[A-Z][0-9A-Za-z]*$/.test(name) &&
16
- // If there is more than one letter, ensure there is at least one
17
- // lowercase letter
18
- (/^[A-Z][0-9]*$/.test(name) || /[a-z]/.test(name)));
19
- case "UPPER_UNDERSCORE":
20
- return /^[A-Z][0-9A-Z]*(_[A-Z][0-9A-Z]*)*$/.test(name);
21
- }
22
- }
23
- //# sourceMappingURL=casing.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"casing.js","sourceRoot":"","sources":["../src/casing.ts"],"names":[],"mappings":"AAEA,gFAAgF;AAChF,MAAM,UAAU,QAAQ,CACtB,IAAW,EACX,QAAgE,EAChE,MAAiB;IAEjB,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,EAAE,QAAQ,CAAC,EAAE,CAAC;QACtC,MAAM,CAAC,IAAI,CAAC;YACV,KAAK,EAAE,IAAI;YACX,QAAQ,EAAE,QAAQ;SACnB,CAAC,CAAC;IACL,CAAC;AACH,CAAC;AAED,MAAM,UAAU,WAAW,CACzB,IAAY,EACZ,QAAgE;IAEhE,QAAQ,QAAQ,EAAE,CAAC;QACjB,KAAK,kBAAkB;YACrB,OAAO,oCAAoC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACzD,KAAK,YAAY;YACf,OAAO,CACL,qBAAqB,CAAC,IAAI,CAAC,IAAI,CAAC;gBAChC,iEAAiE;gBACjE,mBAAmB;gBACnB,CAAC,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CACnD,CAAC;QACJ,KAAK,kBAAkB;YACrB,OAAO,oCAAoC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC3D,CAAC;AACH,CAAC"}
@@ -1,36 +0,0 @@
1
- export type ParsedArgs = {
2
- kind: "gen";
3
- subcommand?: "watch";
4
- root?: string;
5
- } | {
6
- kind: "format";
7
- subcommand?: "ci";
8
- root?: string;
9
- } | {
10
- kind: "snapshot";
11
- subcommand?: "ci" | "view" | "dry-run";
12
- root?: string;
13
- } | {
14
- kind: "init";
15
- root?: string;
16
- } | {
17
- kind: "help";
18
- root?: undefined;
19
- } | {
20
- kind: "version";
21
- root?: undefined;
22
- } | {
23
- kind: "error";
24
- root?: undefined;
25
- };
26
- /**
27
- * Parse command-line arguments and return a structured representation.
28
- *
29
- * @param args - Array of command-line arguments (typically process.argv.slice(2))
30
- * @returns ParsedCommandLine object representing the command and its options
31
- */
32
- export declare function parseCommandLine(args: string[]): ParsedArgs;
33
- export declare class CommandLineParseError extends Error {
34
- constructor(message: string);
35
- }
36
- //# sourceMappingURL=command_line_parser.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"command_line_parser.d.ts","sourceRoot":"","sources":["../src/command_line_parser.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,UAAU,GAClB;IACE,IAAI,EAAE,KAAK,CAAC;IACZ,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,GACD;IACE,IAAI,EAAE,QAAQ,CAAC;IACf,UAAU,CAAC,EAAE,IAAI,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,GACD;IACE,IAAI,EAAE,UAAU,CAAC;IACjB,UAAU,CAAC,EAAE,IAAI,GAAG,MAAM,GAAG,SAAS,CAAC;IACvC,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,GACD;IACE,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,GACD;IACE,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,SAAS,CAAC;CAClB,GACD;IACE,IAAI,EAAE,SAAS,CAAC;IAChB,IAAI,CAAC,EAAE,SAAS,CAAC;CAClB,GACD;IACE,IAAI,EAAE,OAAO,CAAC;IACd,IAAI,CAAC,EAAE,SAAS,CAAC;CAClB,CAAC;AAEN;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,UAAU,CA8C3D;AAqCD,qBAAa,qBAAsB,SAAQ,KAAK;gBAClC,OAAO,EAAE,MAAM;CAI5B"}
@@ -1,240 +0,0 @@
1
- /**
2
- * Parse command-line arguments and return a structured representation.
3
- *
4
- * @param args - Array of command-line arguments (typically process.argv.slice(2))
5
- * @returns ParsedCommandLine object representing the command and its options
6
- */
7
- export function parseCommandLine(args) {
8
- if (args.length === 0) {
9
- printHelp();
10
- return { kind: "help" };
11
- }
12
- const command = args[0];
13
- if (command === "help" || command === "--help" || command === "-h") {
14
- printHelp();
15
- return { kind: "help" };
16
- }
17
- if (command === "version" || command === "--version" || command === "-v") {
18
- return { kind: "version" };
19
- }
20
- const validCommands = ["gen", "format", "snapshot", "init"];
21
- if (!command || !validCommands.includes(command)) {
22
- printError(`Unknown command: ${command}`);
23
- printHelp();
24
- return { kind: "error" };
25
- }
26
- try {
27
- const options = parseOptions(args.slice(1));
28
- switch (command) {
29
- case "gen":
30
- return buildGenCommand(options);
31
- case "format":
32
- return buildFormatCommand(options);
33
- case "snapshot":
34
- return buildSnapshotCommand(options);
35
- case "init":
36
- return buildInitCommand(options);
37
- default:
38
- throw new CommandLineParseError(`Unexpected command: ${command}`);
39
- }
40
- }
41
- catch (error) {
42
- if (error instanceof CommandLineParseError) {
43
- printError(error.message);
44
- return { kind: "error" };
45
- }
46
- throw error;
47
- }
48
- }
49
- const COMMAND_BASE = "npx skir";
50
- const HELP_TEXT = `
51
- Usage: ${COMMAND_BASE} <command> [options]
52
-
53
- Commands:
54
- init Initialize a new Skir project in the current directory
55
- gen Generate code from .skir files to target languages
56
- format Format all .skir files in the source directory
57
- snapshot Take a snapshot of the source directory, look for
58
- breaking changes since the last snapshot
59
- help Display this help message
60
-
61
- Options:
62
- --root, -r <path> Path to the directory containing the skir.yml file
63
- --watch, -w Automatically run code generation when .skir files change
64
- (gen only)
65
- --ci Fail if code is not properly formatted (format) or if code
66
- has changed since the last snapshot (snapshot)
67
- --dry-run Look for breaking changes since the last snapshot without
68
- taking a new snapshot (snapshot only)
69
- --view Display the last snapshot (snapshot only)
70
-
71
- Examples:
72
- ${COMMAND_BASE} init
73
- ${COMMAND_BASE} gen
74
- ${COMMAND_BASE} gen --watch
75
- ${COMMAND_BASE} format --root path/to/root/dir
76
- ${COMMAND_BASE} format --ci -r path/to/root/dir
77
- ${COMMAND_BASE} snapshot
78
- ${COMMAND_BASE} snapshot --ci
79
- ${COMMAND_BASE} snapshot --dry-run
80
- ${COMMAND_BASE} snapshot --view --root path/to/root/dir
81
- `;
82
- export class CommandLineParseError extends Error {
83
- constructor(message) {
84
- super(message);
85
- this.name = "CommandLineParseError";
86
- }
87
- }
88
- function parseOptions(args) {
89
- const options = {
90
- unknown: [],
91
- };
92
- for (let i = 0; i < args.length; i++) {
93
- const arg = args[i];
94
- if (!arg)
95
- continue;
96
- // Check for --option=value syntax
97
- if (arg.startsWith("--root=") || arg.startsWith("-r=")) {
98
- const value = arg.substring(arg.indexOf("=") + 1);
99
- if (!value) {
100
- throw new CommandLineParseError(`Option ${arg.split("=")[0]} requires a value`);
101
- }
102
- if (options.root !== undefined) {
103
- throw new CommandLineParseError(`Option ${arg.split("=")[0]} specified multiple times`);
104
- }
105
- options.root = value;
106
- }
107
- else if (arg === "--root" || arg === "-r") {
108
- if (i + 1 >= args.length) {
109
- throw new CommandLineParseError(`Option ${arg} requires a value`);
110
- }
111
- if (options.root !== undefined) {
112
- throw new CommandLineParseError(`Option ${arg} specified multiple times`);
113
- }
114
- options.root = args[i + 1];
115
- i++; // Skip the next argument as it's the value
116
- }
117
- else if (arg === "--watch" || arg === "-w") {
118
- if (options.watch) {
119
- throw new CommandLineParseError(`Option ${arg} specified multiple times`);
120
- }
121
- options.watch = true;
122
- }
123
- else if (arg === "--ci") {
124
- if (options.ci) {
125
- throw new CommandLineParseError(`Option --ci specified multiple times`);
126
- }
127
- options.ci = true;
128
- }
129
- else if (arg === "--dry-run") {
130
- if (options.dryRun) {
131
- throw new CommandLineParseError(`Option --dry-run specified multiple times`);
132
- }
133
- options.dryRun = true;
134
- }
135
- else if (arg === "--view") {
136
- if (options.view) {
137
- throw new CommandLineParseError(`Option --view specified multiple times`);
138
- }
139
- options.view = true;
140
- }
141
- else if (arg.startsWith("-")) {
142
- options.unknown.push(arg);
143
- }
144
- else {
145
- // Positional argument - not allowed anymore
146
- throw new CommandLineParseError(`Unexpected argument: ${arg}`);
147
- }
148
- }
149
- return options;
150
- }
151
- function buildGenCommand(options) {
152
- validateNoUnknownOptions(options, "gen");
153
- if (options.ci) {
154
- throw new CommandLineParseError(`Option --ci is not valid for 'gen' command`);
155
- }
156
- if (options.dryRun) {
157
- throw new CommandLineParseError(`Option --dry-run is not valid for 'gen' command`);
158
- }
159
- if (options.view) {
160
- throw new CommandLineParseError(`Option --view is not valid for 'gen' command`);
161
- }
162
- return {
163
- kind: "gen",
164
- root: options.root,
165
- subcommand: options.watch ? "watch" : undefined,
166
- };
167
- }
168
- function buildFormatCommand(options) {
169
- validateNoUnknownOptions(options, "format");
170
- if (options.watch) {
171
- throw new CommandLineParseError(`Option --watch is not valid for 'format' command`);
172
- }
173
- if (options.dryRun) {
174
- throw new CommandLineParseError(`Option --dry-run is not valid for 'format' command`);
175
- }
176
- if (options.view) {
177
- throw new CommandLineParseError(`Option --view is not valid for 'format' command`);
178
- }
179
- return {
180
- kind: "format",
181
- root: options.root,
182
- subcommand: options.ci ? "ci" : undefined,
183
- };
184
- }
185
- function buildSnapshotCommand(options) {
186
- validateNoUnknownOptions(options, "snapshot");
187
- if (options.watch) {
188
- throw new CommandLineParseError(`Option --watch is not valid for 'snapshot' command`);
189
- }
190
- const activeOptions = [
191
- options.ci && "--ci",
192
- options.dryRun && "--dry-run",
193
- options.view && "--view",
194
- ].filter(Boolean);
195
- if (activeOptions.length > 1) {
196
- throw new CommandLineParseError(`Options ${activeOptions.join(" and ")} cannot be used together`);
197
- }
198
- return {
199
- kind: "snapshot",
200
- root: options.root,
201
- subcommand: options.ci
202
- ? "ci"
203
- : options.dryRun
204
- ? "dry-run"
205
- : options.view
206
- ? "view"
207
- : undefined,
208
- };
209
- }
210
- function buildInitCommand(options) {
211
- validateNoUnknownOptions(options, "init");
212
- if (options.watch) {
213
- throw new CommandLineParseError(`Option --watch is not valid for 'init' command`);
214
- }
215
- if (options.ci) {
216
- throw new CommandLineParseError(`Option --ci is not valid for 'init' command`);
217
- }
218
- if (options.dryRun) {
219
- throw new CommandLineParseError(`Option --dry-run is not valid for 'init' command`);
220
- }
221
- if (options.view) {
222
- throw new CommandLineParseError(`Option --view is not valid for 'init' command`);
223
- }
224
- return {
225
- kind: "init",
226
- root: options.root,
227
- };
228
- }
229
- function validateNoUnknownOptions(options, command) {
230
- if (options.unknown.length > 0) {
231
- throw new CommandLineParseError(`Unknown option${options.unknown.length > 1 ? "s" : ""} for '${command}': ${options.unknown.join(", ")}`);
232
- }
233
- }
234
- function printHelp() {
235
- console.log(HELP_TEXT);
236
- }
237
- function printError(message) {
238
- console.error(`Error: ${message}\n`);
239
- }
240
- //# sourceMappingURL=command_line_parser.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"command_line_parser.js","sourceRoot":"","sources":["../src/command_line_parser.ts"],"names":[],"mappings":"AAiCA;;;;;GAKG;AACH,MAAM,UAAU,gBAAgB,CAAC,IAAc;IAC7C,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACtB,SAAS,EAAE,CAAC;QACZ,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;IAC1B,CAAC;IAED,MAAM,OAAO,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;IAExB,IAAI,OAAO,KAAK,MAAM,IAAI,OAAO,KAAK,QAAQ,IAAI,OAAO,KAAK,IAAI,EAAE,CAAC;QACnE,SAAS,EAAE,CAAC;QACZ,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;IAC1B,CAAC;IAED,IAAI,OAAO,KAAK,SAAS,IAAI,OAAO,KAAK,WAAW,IAAI,OAAO,KAAK,IAAI,EAAE,CAAC;QACzE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;IAC7B,CAAC;IAED,MAAM,aAAa,GAAG,CAAC,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,CAAC,CAAC;IAC5D,IAAI,CAAC,OAAO,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC;QACjD,UAAU,CAAC,oBAAoB,OAAO,EAAE,CAAC,CAAC;QAC1C,SAAS,EAAE,CAAC;QACZ,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;IAC3B,CAAC;IAED,IAAI,CAAC;QACH,MAAM,OAAO,GAAG,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;QAE5C,QAAQ,OAAO,EAAE,CAAC;YAChB,KAAK,KAAK;gBACR,OAAO,eAAe,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MAAM,IAAI,qBAAqB,CAC7B,iBAAiB,OAAO,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,SAAS,OAAO,MAAM,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CACzG,CAAC;IACJ,CAAC;AACH,CAAC;AAED,SAAS,SAAS;IAChB,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;AACzB,CAAC;AAED,SAAS,UAAU,CAAC,OAAe;IACjC,OAAO,CAAC,KAAK,CAAC,UAAU,OAAO,IAAI,CAAC,CAAC;AACvC,CAAC"}
@@ -1,74 +0,0 @@
1
- import type { Method, RecordLocation, ResolvedType, Token } from "skir-internal";
2
- import { ModuleSet } from "./module_set.js";
3
- export interface BeforeAfter<T> {
4
- before: T;
5
- after: T;
6
- }
7
- export type BreakingChange = {
8
- kind: "illegal-type-change";
9
- expression: BeforeAfter<Expression>;
10
- type: BeforeAfter<ResolvedType>;
11
- } | {
12
- kind: "missing-slots";
13
- record: BeforeAfter<RecordLocation>;
14
- recordExpression: BeforeAfter<Expression>;
15
- missingRangeStart: number;
16
- missingRangeEnd: number;
17
- } | {
18
- kind: "missing-record";
19
- record: RecordLocation;
20
- recordNumber: number;
21
- } | {
22
- kind: "missing-method";
23
- method: Method;
24
- } | {
25
- kind: "record-kind-change";
26
- record: BeforeAfter<RecordLocation>;
27
- recordExpression: BeforeAfter<Expression>;
28
- recordType: BeforeAfter<"struct" | "enum">;
29
- } | {
30
- kind: "removed-number-reintroduced";
31
- record: BeforeAfter<RecordLocation>;
32
- recordExpression: BeforeAfter<Expression>;
33
- removedNumber: number;
34
- reintroducedAs: Token;
35
- } | {
36
- kind: "missing-variant";
37
- record: BeforeAfter<RecordLocation>;
38
- enumEpression: BeforeAfter<Expression>;
39
- variantName: Token;
40
- number: number;
41
- } | {
42
- kind: "wrapper-to-constant-variant";
43
- record: BeforeAfter<RecordLocation>;
44
- enumEpression: BeforeAfter<Expression>;
45
- variantName: BeforeAfter<Token>;
46
- number: number;
47
- };
48
- export type Expression = {
49
- kind: "request-type";
50
- methodName: Token;
51
- } | {
52
- kind: "response-type";
53
- methodName: Token;
54
- } | {
55
- kind: "record";
56
- recordName: Token;
57
- } | {
58
- kind: "item";
59
- arrayExpression: Expression;
60
- } | {
61
- kind: "optional-value";
62
- optionalExpression: Expression;
63
- } | {
64
- kind: "property";
65
- structExpression: Expression;
66
- fieldName: Token;
67
- } | {
68
- kind: "as-variant";
69
- enumExpression: Expression;
70
- variantName: Token;
71
- };
72
- export declare function checkCompatibility(moduleSet: BeforeAfter<ModuleSet>): readonly BreakingChange[];
73
- export declare function getTokenForBreakingChange(breakingChange: BreakingChange): Token | null;
74
- //# sourceMappingURL=compatibility_checker.d.ts.map