skir 1.2.5 → 1.2.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/casing.d.ts +5 -0
- package/dist/casing.js +23 -0
- package/dist/casing.js.map +1 -0
- package/dist/command_line_parser.d.ts +36 -0
- package/dist/command_line_parser.d.ts.map +1 -0
- package/dist/command_line_parser.js +240 -0
- package/dist/command_line_parser.js.map +1 -0
- package/dist/compatibility_checker.d.ts +74 -0
- package/dist/compatibility_checker.js +331 -0
- package/dist/compatibility_checker.js.map +1 -0
- package/dist/compiler.d.ts +3 -0
- package/dist/compiler.js +406 -0
- package/dist/compiler.js.map +1 -0
- package/dist/completion_helper.d.ts +27 -0
- package/dist/completion_helper.js +101 -0
- package/dist/completion_helper.js.map +1 -0
- package/dist/config.d.ts +18 -0
- package/dist/config.js +19 -0
- package/dist/config.js.map +1 -0
- package/dist/config_parser.d.ts +34 -0
- package/dist/config_parser.js +217 -0
- package/dist/config_parser.js.map +1 -0
- package/dist/definition_finder.d.ts +16 -0
- package/dist/definition_finder.js +375 -0
- package/dist/definition_finder.js.map +1 -0
- package/dist/dependency_manager.d.ts +14 -0
- package/dist/dependency_manager.js +109 -0
- package/dist/dependency_manager.js.map +1 -0
- package/dist/doc_comment_parser.d.ts +6 -0
- package/dist/doc_comment_parser.js +269 -0
- package/dist/doc_comment_parser.js.map +1 -0
- package/dist/doc_reference_resolver.d.ts +5 -0
- package/dist/doc_reference_resolver.js +232 -0
- package/dist/doc_reference_resolver.js.map +1 -0
- package/dist/error_renderer.d.ts +24 -0
- package/dist/error_renderer.js +326 -0
- package/dist/error_renderer.js.map +1 -0
- package/dist/exit_error.d.ts +8 -0
- package/dist/exit_error.d.ts.map +1 -0
- package/dist/exit_error.js +8 -0
- package/dist/exit_error.js.map +1 -0
- package/dist/expected_names.d.ts +11 -0
- package/dist/expected_names.js +34 -0
- package/dist/expected_names.js.map +1 -0
- package/dist/formatter.d.ts +28 -0
- package/dist/formatter.js +338 -0
- package/dist/formatter.js.map +1 -0
- package/dist/get_dependencies_flow.d.ts +40 -0
- package/dist/get_dependencies_flow.js +177 -0
- package/dist/get_dependencies_flow.js.map +1 -0
- package/dist/import_block_formatter.d.ts +3 -0
- package/dist/import_block_formatter.js +36 -0
- package/dist/import_block_formatter.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/io.d.ts +23 -0
- package/dist/io.d.ts.map +1 -0
- package/dist/io.js +58 -0
- package/dist/io.js.map +1 -0
- package/dist/literals.d.ts +12 -0
- package/dist/literals.js +96 -0
- package/dist/literals.js.map +1 -0
- package/dist/module_collector.d.ts +9 -0
- package/dist/module_collector.js +73 -0
- package/dist/module_collector.js.map +1 -0
- package/dist/module_set.d.ts +51 -0
- package/dist/module_set.js +1331 -0
- package/dist/module_set.js.map +1 -0
- package/dist/package_downloader.d.ts +4 -0
- package/dist/package_downloader.js +256 -0
- package/dist/package_downloader.js.map +1 -0
- package/dist/package_types.d.ts +30 -0
- package/dist/package_types.d.ts.map +1 -0
- package/dist/package_types.js +2 -0
- package/dist/package_types.js.map +1 -0
- package/dist/parser.d.ts +7 -0
- package/dist/parser.js +1335 -0
- package/dist/parser.js.map +1 -0
- package/dist/project_initializer.d.ts +2 -0
- package/dist/project_initializer.d.ts.map +1 -0
- package/dist/project_initializer.js +207 -0
- package/dist/project_initializer.js.map +1 -0
- package/dist/snapshotter.d.ts +16 -0
- package/dist/snapshotter.js +263 -0
- package/dist/snapshotter.js.map +1 -0
- package/dist/tokenizer.d.ts +18 -0
- package/dist/tokenizer.js +244 -0
- package/dist/tokenizer.js.map +1 -0
- package/package.json +2 -2
package/dist/casing.d.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
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
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,36 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,240 @@
|
|
|
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
|
|
@@ -0,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AC,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"}
|
|
@@ -0,0 +1,74 @@
|
|
|
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
|