@descryy/adapter-kotlin 0.1.0

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/spring.js ADDED
@@ -0,0 +1,231 @@
1
+ /**
2
+ * `API_ROUTE` from Kotlin source — Spring MVC and Spring WebFlux annotations.
3
+ *
4
+ * `language-problems.md` §9's first row: `frameworkExtractors` names only
5
+ * `ktor`, and Kotlin-on-Spring — Spring Initializr's own default for a Kotlin
6
+ * backend, and the framework `spring-petclinic-kotlin` is written against —
7
+ * produced nothing at all, disclosed only in `adapter.ts`'s prose rather than
8
+ * in the refusal ledger.
9
+ *
10
+ * This is a direct port of `adapter-java/src/spring.ts`'s admission rules —
11
+ * DEC-127's class-prefix/method-suffix join, and the `@Controller` vs.
12
+ * `@RestController` view/data distinction — onto Kotlin's own annotation
13
+ * grammar, which is shaped differently from Java's: an annotation with no
14
+ * arguments is a bare `user_type` (`@RestController`), and one with arguments
15
+ * is a `constructor_invocation` (`@RequestMapping("/orders")`) — never one
16
+ * grammar node for both, the way Java's is.
17
+ *
18
+ * ## Measured, not assumed
19
+ *
20
+ * `spring-petclinic-kotlin` (the official Spring reference app in Kotlin) is
21
+ * the only real corpus on disk: 6 controllers, 26 mapping annotations, **all
22
+ * of them `@Controller`, none `@RestController`, and every handler returns
23
+ * `String`** (a Thymeleaf view name). Correctly refused as view routes, this
24
+ * reader emits **zero** `API_ROUTE`s from it — the same shape Java's own
25
+ * `spring-petclinic` measured (93.8% view-refused) and the reason
26
+ * `controllerKind` exists at all: admitting all 26 would have been 26 wrong
27
+ * edges, not a degraded number.
28
+ *
29
+ * There is no `@RestController` witness in any corpus on disk, so the "data"
30
+ * path is verified structurally (it is the same rule Java's is, and Java's is
31
+ * measured) and by unit test, not by a second real corpus. Disclosed here
32
+ * rather than left implicit.
33
+ */
34
+ const namedChildren = (node) => {
35
+ const out = [];
36
+ for (let i = 0; i < node.namedChildCount; i += 1) {
37
+ const child = node.namedChild(i);
38
+ if (child !== null)
39
+ out.push(child);
40
+ }
41
+ return out;
42
+ };
43
+ const firstOfType = (node, type) => namedChildren(node).find((child) => child.type === type);
44
+ const lineOf = (node) => node.startPosition.row + 1;
45
+ /**
46
+ * A plain string literal, or every element of a `["a", "b"]` array literal —
47
+ * `undefined` for anything else, including one containing interpolation.
48
+ *
49
+ * The whitelist rule `routes.ts`'s `stringLiteralOf` documents applies here
50
+ * too: enumerating what is a plain string cannot be outflanked by a grammar
51
+ * node this reader has not heard of.
52
+ */
53
+ function stringValuesOf(node) {
54
+ if (node === undefined)
55
+ return [];
56
+ if (node.type === "collection_literal")
57
+ return namedChildren(node).flatMap(stringValuesOf);
58
+ if (node.type !== "string_literal")
59
+ return [];
60
+ let content = "";
61
+ for (const child of namedChildren(node)) {
62
+ if (child.type !== "string_content")
63
+ return [];
64
+ content += child.text;
65
+ }
66
+ return [content];
67
+ }
68
+ /** Every annotation on a declaration's own `modifiers` block, with its arguments. */
69
+ function annotationsOf(node) {
70
+ const block = firstOfType(node, "modifiers");
71
+ if (block === undefined)
72
+ return [];
73
+ const out = [];
74
+ for (const child of namedChildren(block)) {
75
+ if (child.type !== "annotation")
76
+ continue;
77
+ const invocation = firstOfType(child, "constructor_invocation");
78
+ const userType = invocation === undefined ? firstOfType(child, "user_type") : firstOfType(invocation, "user_type");
79
+ const name = userType === undefined ? undefined : firstOfType(userType, "type_identifier")?.text;
80
+ if (name === undefined)
81
+ continue;
82
+ const valueArgs = invocation === undefined ? undefined : firstOfType(invocation, "value_arguments");
83
+ const args = [];
84
+ if (valueArgs !== undefined) {
85
+ for (const va of namedChildren(valueArgs)) {
86
+ if (va.type !== "value_argument")
87
+ continue;
88
+ const parts = namedChildren(va);
89
+ // `value_argument(name, value)` is named; `value_argument(value)` is positional.
90
+ const named = parts.length === 2 && parts[0]?.type === "simple_identifier";
91
+ args.push({ argName: named ? parts[0]?.text : undefined, valueNode: named ? parts[1] : parts[0], raw: va.text });
92
+ }
93
+ }
94
+ out.push({ name, arguments: args, line: lineOf(child) });
95
+ }
96
+ return out;
97
+ }
98
+ /** Verb-specific shortcuts. The verb is fixed by the annotation's own name. */
99
+ const SHORTCUTS = new Map([
100
+ ["GetMapping", "GET"],
101
+ ["PostMapping", "POST"],
102
+ ["PutMapping", "PUT"],
103
+ ["PatchMapping", "PATCH"],
104
+ ["DeleteMapping", "DELETE"],
105
+ ]);
106
+ const MAPPING = "RequestMapping";
107
+ const ALL_VERBS = ["GET", "POST", "PUT", "PATCH", "DELETE"];
108
+ const SPRING_PACKAGES = ["org.springframework.web.bind.annotation", "org.springframework.stereotype"];
109
+ function importsSpring(imports) {
110
+ return imports.some((i) => i.isWildcard ? SPRING_PACKAGES.includes(i.path) : SPRING_PACKAGES.some((pkg) => i.path.startsWith(`${pkg}.`)));
111
+ }
112
+ /** Positional argument wins; `value =`/`path =` are the same thing named. */
113
+ function pathsOf(annotation) {
114
+ const positional = annotation.arguments.find((a) => a.argName === undefined);
115
+ if (positional !== undefined)
116
+ return stringValuesOf(positional.valueNode);
117
+ const named = annotation.arguments.find((a) => a.argName === "value" || a.argName === "path");
118
+ return named === undefined ? [] : stringValuesOf(named.valueNode);
119
+ }
120
+ /** `@RequestMapping` with no `method` covers every verb (DEC-127's rule, ported). */
121
+ function verbsOf(annotation) {
122
+ const shortcut = SHORTCUTS.get(annotation.name);
123
+ if (shortcut !== undefined)
124
+ return [shortcut];
125
+ const declared = [];
126
+ for (const arg of annotation.arguments) {
127
+ if (arg.argName !== "method")
128
+ continue;
129
+ for (const verb of ALL_VERBS) {
130
+ if (new RegExp(`RequestMethod\\s*\\.\\s*${verb}\\b`).test(arg.raw))
131
+ declared.push(verb);
132
+ }
133
+ }
134
+ return declared.length > 0 ? declared : ALL_VERBS;
135
+ }
136
+ function mappingOf(annotations) {
137
+ return annotations.find((each) => SHORTCUTS.has(each.name) || each.name === MAPPING);
138
+ }
139
+ /** Spring is forgiving about the slash on either side; the join must not be. */
140
+ function join(prefix, suffix) {
141
+ const left = prefix.replace(/\/+$/, "");
142
+ const right = suffix.replace(/^\/+/, "");
143
+ if (right === "")
144
+ return left === "" ? "/" : left;
145
+ return `${left}/${right}`;
146
+ }
147
+ /** `@RestController`, or `@Controller` with a route-level opt-out. Ported from `adapter-java/src/spring.ts`. */
148
+ function controllerKind(annotations) {
149
+ const names = new Set(annotations.map((a) => a.name));
150
+ if (names.has("RestController"))
151
+ return "data";
152
+ if (!names.has("Controller"))
153
+ return null;
154
+ return names.has("ResponseBody") ? "data" : "view";
155
+ }
156
+ /** The outermost segment of a function's written return type — `ResponseEntity<T>` -> `ResponseEntity`. */
157
+ function returnTypeNameOf(fn) {
158
+ const userType = firstOfType(fn, "user_type");
159
+ return userType === undefined ? undefined : firstOfType(userType, "type_identifier")?.text;
160
+ }
161
+ /** `ResponseEntity<T>` is Spring's own response type and never resolves through a view. */
162
+ function returnsBody(fn) {
163
+ return returnTypeNameOf(fn) === "ResponseEntity";
164
+ }
165
+ /** Direct `function_declaration` children of a `class_body`/`enum_class_body` — never a nested type's own. */
166
+ function ownFunctions(body) {
167
+ return namedChildren(body).filter((c) => c.type === "function_declaration");
168
+ }
169
+ /** Every Spring MVC/WebFlux route declared anywhere in this file. */
170
+ export function readSpringRoutes(root, imports) {
171
+ if (!importsSpring(imports))
172
+ return [];
173
+ const routes = [];
174
+ const walkClasses = (node) => {
175
+ for (const child of namedChildren(node)) {
176
+ if (child.type !== "class_declaration" && child.type !== "object_declaration") {
177
+ if (child.namedChildCount > 0)
178
+ walkClasses(child);
179
+ continue;
180
+ }
181
+ const classAnnotations = annotationsOf(child);
182
+ const kind = controllerKind(classAnnotations);
183
+ const body = namedChildren(child).find((c) => c.type === "class_body" || c.type === "enum_class_body");
184
+ if (kind === null) {
185
+ if (body !== undefined)
186
+ walkClasses(body);
187
+ continue;
188
+ }
189
+ const classMapping = mappingOf(classAnnotations);
190
+ const classPaths = classMapping === undefined ? [] : pathsOf(classMapping);
191
+ const prefixes = classPaths.length > 0 ? classPaths : [""];
192
+ for (const fn of body === undefined ? [] : ownFunctions(body)) {
193
+ const fnAnnotations = annotationsOf(fn);
194
+ const mapping = mappingOf(fnAnnotations);
195
+ if (mapping === undefined)
196
+ continue;
197
+ // A view controller's handler serves a page unless it opts out itself —
198
+ // decided per handler, since one class may mix both kinds.
199
+ if (kind === "view" && !fnAnnotations.some((a) => a.name === "ResponseBody") && !returnsBody(fn))
200
+ continue;
201
+ const suffixes = pathsOf(mapping);
202
+ // No argument at all legally means "the class prefix"; an argument
203
+ // present but unreadable (a constant reference, not a literal) is
204
+ // refused rather than guessed — DEC-127's rule, ported unchanged.
205
+ const unreadable = suffixes.length === 0 && mapping.arguments.length > 0;
206
+ if (unreadable)
207
+ continue;
208
+ const parts = suffixes.length > 0 ? suffixes : [""];
209
+ for (const prefix of prefixes) {
210
+ for (const suffix of parts) {
211
+ const template = join(prefix, suffix);
212
+ if (!template.startsWith("/"))
213
+ continue;
214
+ for (const verb of verbsOf(mapping)) {
215
+ routes.push({ method: verb, template, written: `@${mapping.name}`, framework: "spring", line: mapping.line });
216
+ }
217
+ }
218
+ }
219
+ }
220
+ // Nested types (a companion object, an inner class) are walked too —
221
+ // Spring never nests a controller inside another, but a file mixing a
222
+ // controller with an unrelated nested type must not have the nested
223
+ // type's own body silently skipped by this reader.
224
+ if (body !== undefined)
225
+ walkClasses(body);
226
+ }
227
+ };
228
+ walkClasses(root);
229
+ return routes;
230
+ }
231
+ //# sourceMappingURL=spring.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"spring.js","sourceRoot":"","sources":["../src/spring.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAOH,MAAM,aAAa,GAAG,CAAC,IAAU,EAAU,EAAE;IAC3C,MAAM,GAAG,GAAW,EAAE,CAAC;IACvB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,eAAe,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC;QACjD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,EAAE,CAAC;wBAC3B,MAAM,QAAQ,GAAG,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;wBACtC,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,GAAG,CAAC;4BAAE,SAAS;wBACxC,KAAK,MAAM,IAAI,IAAI,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;4BACpC,MAAM,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,OAAO,CAAC,IAAI,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC;wBAChH,CAAC;oBACH,CAAC;gBACH,CAAC;YACH,CAAC;YAED,qEAAqE;YACrE,sEAAsE;YACtE,oEAAoE;YACpE,mDAAmD;YACnD,IAAI,IAAI,KAAK,SAAS;gBAAE,WAAW,CAAC,IAAI,CAAC,CAAC;QAC5C,CAAC;IACH,CAAC,CAAC;IACF,WAAW,CAAC,IAAI,CAAC,CAAC;IAElB,OAAO,MAAM,CAAC;AAChB,CAAC"}
Binary file
package/package.json ADDED
@@ -0,0 +1,35 @@
1
+ {
2
+ "name": "@descryy/adapter-kotlin",
3
+ "version": "0.1.0",
4
+ "type": "module",
5
+ "description": "Kotlin adapter, breadth tier. The tenth language, and the first to share an identity anchor with another language rather than defining its own \u2014 it reuses @descryy/adapter-jvm, because Kotlin and Java answer the identity question the same way. Where a file does not sit where its package declaration says, the node is refused rather than anchored on the package alone: Kotlin Multiplatform declares one qualified name in several source sets by design, and a bare-package fallback collapses them onto one id.",
6
+ "license": "UNLICENSED",
7
+ "engines": {
8
+ "node": ">=22.5"
9
+ },
10
+ "exports": {
11
+ ".": {
12
+ "types": "./dist/index.d.ts",
13
+ "default": "./dist/index.js"
14
+ }
15
+ },
16
+ "files": [
17
+ "dist"
18
+ ],
19
+ "publishConfig": {
20
+ "registry": "https://registry.npmjs.org",
21
+ "access": "public"
22
+ },
23
+ "scripts": {
24
+ "build": "tsc -b && npm run build:assets",
25
+ "build:assets": "node ../../scripts/install-grammar.mjs"
26
+ },
27
+ "dependencies": {
28
+ "@descryy/adapter-common": "0.1.0",
29
+ "@descryy/adapter-jvm": "0.1.0",
30
+ "@descryy/adapter-openapi": "0.1.0",
31
+ "@descryy/adapter-sql": "0.1.0",
32
+ "@descryy/adapter-treesitter": "0.1.0",
33
+ "@descryy/ir": "0.3.0"
34
+ }
35
+ }