@nestbridge/core 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/build/nestbridge.core.d.ts +71 -0
- package/build/nestbridge.core.js +356 -0
- package/build/nestbridge.core.js.map +1 -0
- package/package.json +32 -0
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
export declare const analyzeControllers: (filePaths: readonly string[]) => {
|
|
2
|
+
controllers: ControllerDefinition[];
|
|
3
|
+
diagnostics: NestBridgeDiagnostic[];
|
|
4
|
+
};
|
|
5
|
+
|
|
6
|
+
export declare interface ControllerDefinition {
|
|
7
|
+
name: string;
|
|
8
|
+
path: string;
|
|
9
|
+
sourceFile: string;
|
|
10
|
+
methods: ControllerMethodDefinition[];
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export declare interface ControllerMethodDefinition {
|
|
14
|
+
name: string;
|
|
15
|
+
httpMethod: HttpMethod;
|
|
16
|
+
path: string;
|
|
17
|
+
parameters: ControllerParameterDefinition[];
|
|
18
|
+
line: number;
|
|
19
|
+
column: number;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
declare interface ControllerParameterBase {
|
|
23
|
+
index: number;
|
|
24
|
+
parameterName: string;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export declare type ControllerParameterDefinition = (ControllerParameterBase & {
|
|
28
|
+
kind: 'param';
|
|
29
|
+
name: string;
|
|
30
|
+
}) | (ControllerParameterBase & {
|
|
31
|
+
kind: 'query';
|
|
32
|
+
name?: string;
|
|
33
|
+
}) | (ControllerParameterBase & {
|
|
34
|
+
kind: 'body';
|
|
35
|
+
name?: string;
|
|
36
|
+
}) | (ControllerParameterBase & {
|
|
37
|
+
kind: 'header';
|
|
38
|
+
name: string;
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
export declare const formatDiagnostic: (diagnostic: NestBridgeDiagnostic) => string;
|
|
42
|
+
|
|
43
|
+
export declare const generateControllerDeclaration: (controller: ControllerDefinition, outputFilePath: string) => string;
|
|
44
|
+
|
|
45
|
+
export declare type HttpMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
|
|
46
|
+
|
|
47
|
+
export declare interface NestBridgeDiagnostic {
|
|
48
|
+
code: NestBridgeDiagnosticCode;
|
|
49
|
+
title: string;
|
|
50
|
+
controllerName: string;
|
|
51
|
+
memberName: string;
|
|
52
|
+
detail: string;
|
|
53
|
+
found?: string;
|
|
54
|
+
expected?: string;
|
|
55
|
+
filePath: string;
|
|
56
|
+
line: number;
|
|
57
|
+
column: number;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export declare type NestBridgeDiagnosticCode = 'unsupported-route' | 'unsupported-parameter';
|
|
61
|
+
|
|
62
|
+
export declare class NestBridgeDiagnosticError extends Error {
|
|
63
|
+
readonly diagnostic: NestBridgeDiagnostic;
|
|
64
|
+
constructor(diagnostic: NestBridgeDiagnostic);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export declare type ParameterSourceKind = 'param' | 'query' | 'body' | 'header';
|
|
68
|
+
|
|
69
|
+
export declare const VERSION: string;
|
|
70
|
+
|
|
71
|
+
export { }
|
|
@@ -0,0 +1,356 @@
|
|
|
1
|
+
import { readFileSync } from 'node:fs';
|
|
2
|
+
import ts from 'typescript';
|
|
3
|
+
import { relative, dirname, extname } from 'node:path';
|
|
4
|
+
|
|
5
|
+
const findDecorator = (node, decoratorName) => {
|
|
6
|
+
const decorators = ts.getDecorators(node);
|
|
7
|
+
if (decorators === void 0) {
|
|
8
|
+
return void 0;
|
|
9
|
+
}
|
|
10
|
+
return decorators.find((decorator) => decoratorNameOf(decorator) === decoratorName);
|
|
11
|
+
};
|
|
12
|
+
const findAnyDecorator = (node, decoratorNames) => {
|
|
13
|
+
const decorators = ts.getDecorators(node);
|
|
14
|
+
if (decorators === void 0) {
|
|
15
|
+
return void 0;
|
|
16
|
+
}
|
|
17
|
+
return decorators.find((decorator) => decoratorNames.includes(decoratorNameOf(decorator) ?? ""));
|
|
18
|
+
};
|
|
19
|
+
const decoratorNameOf = (decorator) => {
|
|
20
|
+
const expression = decorator.expression;
|
|
21
|
+
if (ts.isCallExpression(expression) && ts.isIdentifier(expression.expression)) {
|
|
22
|
+
return expression.expression.text;
|
|
23
|
+
}
|
|
24
|
+
if (ts.isIdentifier(expression)) {
|
|
25
|
+
return expression.text;
|
|
26
|
+
}
|
|
27
|
+
return void 0;
|
|
28
|
+
};
|
|
29
|
+
const readStaticStringArgument = (decorator) => {
|
|
30
|
+
const expression = decorator.expression;
|
|
31
|
+
if (!ts.isCallExpression(expression)) {
|
|
32
|
+
return { ok: true, value: void 0 };
|
|
33
|
+
}
|
|
34
|
+
const [firstArgument] = expression.arguments;
|
|
35
|
+
if (firstArgument === void 0) {
|
|
36
|
+
return { ok: true, value: void 0 };
|
|
37
|
+
}
|
|
38
|
+
if (ts.isStringLiteralLike(firstArgument)) {
|
|
39
|
+
return { ok: true, value: firstArgument.text };
|
|
40
|
+
}
|
|
41
|
+
return { ok: false, argumentText: firstArgument.getText() };
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
const HTTP_METHOD_DECORATOR_NAMES = {
|
|
45
|
+
Get: "GET",
|
|
46
|
+
Post: "POST",
|
|
47
|
+
Put: "PUT",
|
|
48
|
+
Patch: "PATCH",
|
|
49
|
+
Delete: "DELETE"
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
const locationOf = (sourceFile, node) => {
|
|
53
|
+
const { line, character } = sourceFile.getLineAndCharacterOfPosition(node.getStart(sourceFile));
|
|
54
|
+
return { line: line + 1, column: character + 1 };
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
const SUPPORTED_PARAMETER_DECORATORS = ["Param", "Query", "Body", "Headers"];
|
|
58
|
+
const KNOWN_UNSUPPORTED_PARAMETER_DECORATORS = ["Req", "Res", "Request", "Response"];
|
|
59
|
+
const extractParameterDefinition = (parameter, index, context) => {
|
|
60
|
+
const decorator = findAnyDecorator(parameter, [
|
|
61
|
+
...SUPPORTED_PARAMETER_DECORATORS,
|
|
62
|
+
...KNOWN_UNSUPPORTED_PARAMETER_DECORATORS
|
|
63
|
+
]);
|
|
64
|
+
const location = locationOf(context.sourceFile, parameter);
|
|
65
|
+
if (decorator === void 0) {
|
|
66
|
+
context.diagnostics.push({
|
|
67
|
+
code: "unsupported-parameter",
|
|
68
|
+
title: "Unsupported parameter.",
|
|
69
|
+
controllerName: context.controllerName,
|
|
70
|
+
memberName: context.methodName,
|
|
71
|
+
detail: `Parameter "${parameter.name.getText()}" must be decorated with one of @Param, @Query, @Body, or @Headers to be transported through a NestBridge HTTP client.`,
|
|
72
|
+
filePath: context.filePath,
|
|
73
|
+
line: location.line,
|
|
74
|
+
column: location.column
|
|
75
|
+
});
|
|
76
|
+
return void 0;
|
|
77
|
+
}
|
|
78
|
+
const decoratorName = decoratorNameOf(decorator);
|
|
79
|
+
if (decoratorName !== void 0 && KNOWN_UNSUPPORTED_PARAMETER_DECORATORS.includes(decoratorName)) {
|
|
80
|
+
context.diagnostics.push({
|
|
81
|
+
code: "unsupported-parameter",
|
|
82
|
+
title: "Unsupported parameter.",
|
|
83
|
+
controllerName: context.controllerName,
|
|
84
|
+
memberName: context.methodName,
|
|
85
|
+
detail: `@${decoratorName}() cannot be transported through a NestBridge HTTP client.`,
|
|
86
|
+
filePath: context.filePath,
|
|
87
|
+
line: location.line,
|
|
88
|
+
column: location.column
|
|
89
|
+
});
|
|
90
|
+
return void 0;
|
|
91
|
+
}
|
|
92
|
+
if (!ts.isIdentifier(parameter.name)) {
|
|
93
|
+
context.diagnostics.push({
|
|
94
|
+
code: "unsupported-parameter",
|
|
95
|
+
title: "Unsupported parameter.",
|
|
96
|
+
controllerName: context.controllerName,
|
|
97
|
+
memberName: context.methodName,
|
|
98
|
+
detail: "Destructured parameters cannot be transported through a NestBridge HTTP client.",
|
|
99
|
+
filePath: context.filePath,
|
|
100
|
+
line: location.line,
|
|
101
|
+
column: location.column
|
|
102
|
+
});
|
|
103
|
+
return void 0;
|
|
104
|
+
}
|
|
105
|
+
const argument = readStaticStringArgument(decorator);
|
|
106
|
+
if (!argument.ok) {
|
|
107
|
+
context.diagnostics.push({
|
|
108
|
+
code: "unsupported-parameter",
|
|
109
|
+
title: "Unsupported parameter.",
|
|
110
|
+
controllerName: context.controllerName,
|
|
111
|
+
memberName: context.methodName,
|
|
112
|
+
detail: `@${decoratorName}() arguments must be statically analyzable string literals.`,
|
|
113
|
+
found: `@${decoratorName}(${argument.argumentText})`,
|
|
114
|
+
filePath: context.filePath,
|
|
115
|
+
line: location.line,
|
|
116
|
+
column: location.column
|
|
117
|
+
});
|
|
118
|
+
return void 0;
|
|
119
|
+
}
|
|
120
|
+
const base = {
|
|
121
|
+
index,
|
|
122
|
+
parameterName: parameter.name.text
|
|
123
|
+
};
|
|
124
|
+
if (decoratorName === "Param") {
|
|
125
|
+
if (argument.value === void 0) {
|
|
126
|
+
context.diagnostics.push({
|
|
127
|
+
code: "unsupported-parameter",
|
|
128
|
+
title: "Unsupported parameter.",
|
|
129
|
+
controllerName: context.controllerName,
|
|
130
|
+
memberName: context.methodName,
|
|
131
|
+
detail: "A whole @Param() is not supported; provide a route parameter name such as @Param('id').",
|
|
132
|
+
filePath: context.filePath,
|
|
133
|
+
line: location.line,
|
|
134
|
+
column: location.column
|
|
135
|
+
});
|
|
136
|
+
return void 0;
|
|
137
|
+
}
|
|
138
|
+
return { ...base, kind: "param", name: argument.value };
|
|
139
|
+
}
|
|
140
|
+
if (decoratorName === "Headers") {
|
|
141
|
+
if (argument.value === void 0) {
|
|
142
|
+
context.diagnostics.push({
|
|
143
|
+
code: "unsupported-parameter",
|
|
144
|
+
title: "Unsupported parameter.",
|
|
145
|
+
controllerName: context.controllerName,
|
|
146
|
+
memberName: context.methodName,
|
|
147
|
+
detail: "A whole @Headers() is not supported; provide a header name such as @Headers('x-example').",
|
|
148
|
+
filePath: context.filePath,
|
|
149
|
+
line: location.line,
|
|
150
|
+
column: location.column
|
|
151
|
+
});
|
|
152
|
+
return void 0;
|
|
153
|
+
}
|
|
154
|
+
return { ...base, kind: "header", name: argument.value };
|
|
155
|
+
}
|
|
156
|
+
if (decoratorName === "Query") {
|
|
157
|
+
return { ...base, kind: "query", name: argument.value };
|
|
158
|
+
}
|
|
159
|
+
return { ...base, kind: "body", name: argument.value };
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
const trimSlashes = (segment) => segment.replace(/^\/+/, "").replace(/\/+$/, "");
|
|
163
|
+
const joinRoutePath = (controllerPath, methodPath) => {
|
|
164
|
+
const segments = [trimSlashes(controllerPath), trimSlashes(methodPath ?? "")].filter(
|
|
165
|
+
(segment) => segment.length > 0
|
|
166
|
+
);
|
|
167
|
+
return `/${segments.join("/")}`;
|
|
168
|
+
};
|
|
169
|
+
|
|
170
|
+
const extractMethodDefinition = (method, context) => {
|
|
171
|
+
const decorator = findAnyDecorator(method, Object.keys(HTTP_METHOD_DECORATOR_NAMES));
|
|
172
|
+
if (decorator === void 0) {
|
|
173
|
+
return void 0;
|
|
174
|
+
}
|
|
175
|
+
const methodName = method.name.getText();
|
|
176
|
+
const decoratorName = decoratorNameOf(decorator);
|
|
177
|
+
const location = locationOf(context.sourceFile, method);
|
|
178
|
+
if (decoratorName === void 0) {
|
|
179
|
+
return void 0;
|
|
180
|
+
}
|
|
181
|
+
const httpMethod = HTTP_METHOD_DECORATOR_NAMES[decoratorName];
|
|
182
|
+
if (httpMethod === void 0) {
|
|
183
|
+
return void 0;
|
|
184
|
+
}
|
|
185
|
+
const routeArgument = readStaticStringArgument(decorator);
|
|
186
|
+
if (!routeArgument.ok) {
|
|
187
|
+
context.diagnostics.push({
|
|
188
|
+
code: "unsupported-route",
|
|
189
|
+
title: "Unsupported route.",
|
|
190
|
+
controllerName: context.controllerName,
|
|
191
|
+
memberName: methodName,
|
|
192
|
+
detail: "Route paths must be statically analyzable.",
|
|
193
|
+
found: `@${decoratorName}(${routeArgument.argumentText})`,
|
|
194
|
+
filePath: context.filePath,
|
|
195
|
+
line: location.line,
|
|
196
|
+
column: location.column
|
|
197
|
+
});
|
|
198
|
+
return void 0;
|
|
199
|
+
}
|
|
200
|
+
const parameters = method.parameters.map(
|
|
201
|
+
(parameter, index) => extractParameterDefinition(parameter, index, {
|
|
202
|
+
sourceFile: context.sourceFile,
|
|
203
|
+
filePath: context.filePath,
|
|
204
|
+
controllerName: context.controllerName,
|
|
205
|
+
methodName,
|
|
206
|
+
diagnostics: context.diagnostics
|
|
207
|
+
})
|
|
208
|
+
);
|
|
209
|
+
if (parameters.some((parameter) => parameter === void 0)) {
|
|
210
|
+
return void 0;
|
|
211
|
+
}
|
|
212
|
+
return {
|
|
213
|
+
name: methodName,
|
|
214
|
+
httpMethod,
|
|
215
|
+
path: joinRoutePath(context.controllerPath, routeArgument.value),
|
|
216
|
+
parameters: parameters.filter((parameter) => parameter !== void 0),
|
|
217
|
+
line: location.line,
|
|
218
|
+
column: location.column
|
|
219
|
+
};
|
|
220
|
+
};
|
|
221
|
+
|
|
222
|
+
const extractControllerDefinition = (classDeclaration, sourceFile, filePath, diagnostics) => {
|
|
223
|
+
const controllerName = classDeclaration.name?.text ?? "(anonymous controller)";
|
|
224
|
+
const decorator = findDecorator(classDeclaration, "Controller");
|
|
225
|
+
if (decorator === void 0) {
|
|
226
|
+
return void 0;
|
|
227
|
+
}
|
|
228
|
+
const location = locationOf(sourceFile, classDeclaration);
|
|
229
|
+
const argument = readStaticStringArgument(decorator);
|
|
230
|
+
if (!argument.ok) {
|
|
231
|
+
diagnostics.push({
|
|
232
|
+
code: "unsupported-route",
|
|
233
|
+
title: "Unsupported route.",
|
|
234
|
+
controllerName,
|
|
235
|
+
memberName: "",
|
|
236
|
+
detail: "Controller paths must be statically analyzable.",
|
|
237
|
+
found: `@Controller(${argument.argumentText})`,
|
|
238
|
+
filePath,
|
|
239
|
+
line: location.line,
|
|
240
|
+
column: location.column
|
|
241
|
+
});
|
|
242
|
+
return void 0;
|
|
243
|
+
}
|
|
244
|
+
const methods = classDeclaration.members.filter((member) => ts.isMethodDeclaration(member)).map(
|
|
245
|
+
(method) => extractMethodDefinition(method, {
|
|
246
|
+
sourceFile,
|
|
247
|
+
filePath,
|
|
248
|
+
controllerName,
|
|
249
|
+
controllerPath: argument.value ?? "",
|
|
250
|
+
diagnostics
|
|
251
|
+
})
|
|
252
|
+
).filter((method) => method !== void 0);
|
|
253
|
+
return {
|
|
254
|
+
name: controllerName,
|
|
255
|
+
path: argument.value ?? "",
|
|
256
|
+
sourceFile: filePath,
|
|
257
|
+
methods
|
|
258
|
+
};
|
|
259
|
+
};
|
|
260
|
+
|
|
261
|
+
const findControllerClasses = (sourceFile) => {
|
|
262
|
+
return sourceFile.statements.filter(
|
|
263
|
+
(statement) => ts.isClassDeclaration(statement) && findDecorator(statement, "Controller") !== void 0
|
|
264
|
+
);
|
|
265
|
+
};
|
|
266
|
+
|
|
267
|
+
const analyzeControllers = (filePaths) => {
|
|
268
|
+
const diagnostics = [];
|
|
269
|
+
const controllers = [];
|
|
270
|
+
for (const filePath of filePaths) {
|
|
271
|
+
const content = readFileSync(filePath, "utf-8");
|
|
272
|
+
const sourceFile = ts.createSourceFile(
|
|
273
|
+
filePath,
|
|
274
|
+
content,
|
|
275
|
+
ts.ScriptTarget.ESNext,
|
|
276
|
+
true,
|
|
277
|
+
ts.ScriptKind.TS
|
|
278
|
+
);
|
|
279
|
+
for (const classDeclaration of findControllerClasses(sourceFile)) {
|
|
280
|
+
const controller = extractControllerDefinition(
|
|
281
|
+
classDeclaration,
|
|
282
|
+
sourceFile,
|
|
283
|
+
filePath,
|
|
284
|
+
diagnostics
|
|
285
|
+
);
|
|
286
|
+
if (controller !== void 0) {
|
|
287
|
+
controllers.push(controller);
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
return { controllers, diagnostics };
|
|
292
|
+
};
|
|
293
|
+
|
|
294
|
+
const toPosixPath = (filePath) => filePath.replace(/\\/g, "/");
|
|
295
|
+
const importSpecifierFor = (sourceFile, outputFilePath) => {
|
|
296
|
+
if (!sourceFile.startsWith(".") && !/^[A-Za-z]:[\\/]/.test(sourceFile) && !sourceFile.startsWith("/")) {
|
|
297
|
+
return sourceFile;
|
|
298
|
+
}
|
|
299
|
+
const relativePath = toPosixPath(relative(dirname(outputFilePath), sourceFile));
|
|
300
|
+
return relativePath.startsWith(".") ? relativePath : `./${relativePath}`;
|
|
301
|
+
};
|
|
302
|
+
const stripExtension = (filePath) => {
|
|
303
|
+
const extension = extname(filePath);
|
|
304
|
+
return extension.length > 0 ? filePath.slice(0, -extension.length) : filePath;
|
|
305
|
+
};
|
|
306
|
+
const generateControllerDeclaration = (controller, outputFilePath) => {
|
|
307
|
+
const sourceFileSpecifier = importSpecifierFor(controller.sourceFile, outputFilePath);
|
|
308
|
+
const importSpecifier = stripExtension(sourceFileSpecifier);
|
|
309
|
+
const serverAlias = `__Server${controller.name}`;
|
|
310
|
+
const methodDeclarations = controller.methods.map(
|
|
311
|
+
(method) => ` ${method.name}(...args: Parameters<${serverAlias}['${method.name}']>): RemoteResult<${serverAlias}['${method.name}']>;`
|
|
312
|
+
);
|
|
313
|
+
const classBody = [" constructor();", "", ...methodDeclarations].join("\n");
|
|
314
|
+
return [
|
|
315
|
+
`import type { ${controller.name} as ${serverAlias} } from '${importSpecifier}';`,
|
|
316
|
+
`import type { RemoteResult } from '@nestbridge/runtime';`,
|
|
317
|
+
"",
|
|
318
|
+
"/**",
|
|
319
|
+
" * Generated by NestBridge — client-facing methods only.",
|
|
320
|
+
` * @see {@link ${sourceFileSpecifier}} for the real controller implementation.`,
|
|
321
|
+
" */",
|
|
322
|
+
`export declare class ${controller.name} {`,
|
|
323
|
+
classBody,
|
|
324
|
+
"}",
|
|
325
|
+
""
|
|
326
|
+
].join("\n");
|
|
327
|
+
};
|
|
328
|
+
|
|
329
|
+
const formatDiagnostic = (diagnostic) => {
|
|
330
|
+
const subject = diagnostic.memberName.length > 0 ? `${diagnostic.controllerName}.${diagnostic.memberName}` : diagnostic.controllerName;
|
|
331
|
+
const lines = [`[NestBridge] ${diagnostic.title}`, "", subject, "", diagnostic.detail];
|
|
332
|
+
if (diagnostic.found !== void 0) {
|
|
333
|
+
lines.push("", "Found:", diagnostic.found);
|
|
334
|
+
}
|
|
335
|
+
if (diagnostic.expected !== void 0) {
|
|
336
|
+
lines.push("", "Expected:", diagnostic.expected);
|
|
337
|
+
}
|
|
338
|
+
lines.push("", `${diagnostic.filePath}:${diagnostic.line}:${diagnostic.column}`);
|
|
339
|
+
return lines.join("\n");
|
|
340
|
+
};
|
|
341
|
+
|
|
342
|
+
class NestBridgeDiagnosticError extends Error {
|
|
343
|
+
diagnostic;
|
|
344
|
+
constructor(diagnostic) {
|
|
345
|
+
super(formatDiagnostic(diagnostic));
|
|
346
|
+
this.name = "NestBridgeDiagnosticError";
|
|
347
|
+
this.diagnostic = diagnostic;
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
const version = "0.1.0";
|
|
352
|
+
|
|
353
|
+
const VERSION = version;
|
|
354
|
+
|
|
355
|
+
export { NestBridgeDiagnosticError, VERSION, analyzeControllers, formatDiagnostic, generateControllerDeclaration };
|
|
356
|
+
//# sourceMappingURL=nestbridge.core.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nestbridge.core.js","sources":["../src/analysis/decorator-inspection.ts","../src/models/http-method.ts","../src/analysis/node-location.ts","../src/analysis/extract-parameter-definition.ts","../src/analysis/route-path.ts","../src/analysis/extract-method-definition.ts","../src/analysis/extract-controller-definition.ts","../src/analysis/find-controller-classes.ts","../src/analysis/analyze-controllers.ts","../src/declarations/generate-controller-declaration.ts","../src/diagnostics/format-diagnostic.ts","../src/diagnostics/nestbridge-diagnostic-error.ts","../src/version.ts"],"sourcesContent":["import ts from 'typescript';\n\nexport const findDecorator = (\n node: ts.ClassDeclaration | ts.MethodDeclaration | ts.ParameterDeclaration,\n decoratorName: string,\n) => {\n const decorators = ts.getDecorators(node);\n\n if (decorators === undefined) {\n return undefined;\n }\n\n return decorators.find((decorator) => decoratorNameOf(decorator) === decoratorName);\n};\n\nexport const findAnyDecorator = (\n node: ts.ClassDeclaration | ts.MethodDeclaration | ts.ParameterDeclaration,\n decoratorNames: readonly string[],\n) => {\n const decorators = ts.getDecorators(node);\n\n if (decorators === undefined) {\n return undefined;\n }\n\n return decorators.find((decorator) => decoratorNames.includes(decoratorNameOf(decorator) ?? ''));\n};\n\nexport const decoratorNameOf = (decorator: ts.Decorator) => {\n const expression = decorator.expression;\n\n if (ts.isCallExpression(expression) && ts.isIdentifier(expression.expression)) {\n return expression.expression.text;\n }\n\n if (ts.isIdentifier(expression)) {\n return expression.text;\n }\n\n return undefined;\n};\n\nexport const readStaticStringArgument = (decorator: ts.Decorator) => {\n const expression = decorator.expression;\n\n if (!ts.isCallExpression(expression)) {\n return { ok: true, value: undefined };\n }\n\n const [firstArgument] = expression.arguments;\n\n if (firstArgument === undefined) {\n return { ok: true, value: undefined };\n }\n\n if (ts.isStringLiteralLike(firstArgument)) {\n return { ok: true, value: firstArgument.text };\n }\n\n return { ok: false, argumentText: firstArgument.getText() };\n};\n","export type HttpMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';\n\nexport const HTTP_METHOD_DECORATOR_NAMES: Record<string, HttpMethod> = {\n Get: 'GET',\n Post: 'POST',\n Put: 'PUT',\n Patch: 'PATCH',\n Delete: 'DELETE',\n};\n","import type ts from 'typescript';\n\nexport const locationOf = (sourceFile: ts.SourceFile, node: ts.Node) => {\n const { line, character } = sourceFile.getLineAndCharacterOfPosition(node.getStart(sourceFile));\n return { line: line + 1, column: character + 1 };\n};\n","import ts from 'typescript';\nimport type { NestBridgeDiagnostic } from '../diagnostics/nestbridge-diagnostic';\nimport type { ControllerParameterDefinition } from '../models/controller-parameter-definition';\nimport {\n decoratorNameOf,\n findAnyDecorator,\n readStaticStringArgument,\n} from './decorator-inspection';\nimport { locationOf } from './node-location';\n\nconst SUPPORTED_PARAMETER_DECORATORS = ['Param', 'Query', 'Body', 'Headers'] as const;\nconst KNOWN_UNSUPPORTED_PARAMETER_DECORATORS = ['Req', 'Res', 'Request', 'Response'] as const;\n\ninterface ExtractionContext {\n sourceFile: ts.SourceFile;\n filePath: string;\n controllerName: string;\n methodName: string;\n diagnostics: NestBridgeDiagnostic[];\n}\n\nexport const extractParameterDefinition = (\n parameter: ts.ParameterDeclaration,\n index: number,\n context: ExtractionContext,\n): ControllerParameterDefinition | undefined => {\n const decorator = findAnyDecorator(parameter, [\n ...SUPPORTED_PARAMETER_DECORATORS,\n ...KNOWN_UNSUPPORTED_PARAMETER_DECORATORS,\n ]);\n const location = locationOf(context.sourceFile, parameter);\n\n if (decorator === undefined) {\n context.diagnostics.push({\n code: 'unsupported-parameter',\n title: 'Unsupported parameter.',\n controllerName: context.controllerName,\n memberName: context.methodName,\n detail: `Parameter \"${parameter.name.getText()}\" must be decorated with one of @Param, @Query, @Body, or @Headers to be transported through a NestBridge HTTP client.`,\n filePath: context.filePath,\n line: location.line,\n column: location.column,\n });\n return undefined;\n }\n\n const decoratorName = decoratorNameOf(decorator);\n\n if (\n decoratorName !== undefined &&\n (KNOWN_UNSUPPORTED_PARAMETER_DECORATORS as readonly string[]).includes(decoratorName)\n ) {\n context.diagnostics.push({\n code: 'unsupported-parameter',\n title: 'Unsupported parameter.',\n controllerName: context.controllerName,\n memberName: context.methodName,\n detail: `@${decoratorName}() cannot be transported through a NestBridge HTTP client.`,\n filePath: context.filePath,\n line: location.line,\n column: location.column,\n });\n return undefined;\n }\n\n if (!ts.isIdentifier(parameter.name)) {\n context.diagnostics.push({\n code: 'unsupported-parameter',\n title: 'Unsupported parameter.',\n controllerName: context.controllerName,\n memberName: context.methodName,\n detail: 'Destructured parameters cannot be transported through a NestBridge HTTP client.',\n filePath: context.filePath,\n line: location.line,\n column: location.column,\n });\n return undefined;\n }\n\n const argument = readStaticStringArgument(decorator);\n\n if (!argument.ok) {\n context.diagnostics.push({\n code: 'unsupported-parameter',\n title: 'Unsupported parameter.',\n controllerName: context.controllerName,\n memberName: context.methodName,\n detail: `@${decoratorName}() arguments must be statically analyzable string literals.`,\n found: `@${decoratorName}(${argument.argumentText})`,\n filePath: context.filePath,\n line: location.line,\n column: location.column,\n });\n return undefined;\n }\n\n const base = {\n index,\n parameterName: parameter.name.text,\n };\n\n if (decoratorName === 'Param') {\n if (argument.value === undefined) {\n context.diagnostics.push({\n code: 'unsupported-parameter',\n title: 'Unsupported parameter.',\n controllerName: context.controllerName,\n memberName: context.methodName,\n detail:\n \"A whole @Param() is not supported; provide a route parameter name such as @Param('id').\",\n filePath: context.filePath,\n line: location.line,\n column: location.column,\n });\n return undefined;\n }\n\n return { ...base, kind: 'param', name: argument.value };\n }\n\n if (decoratorName === 'Headers') {\n if (argument.value === undefined) {\n context.diagnostics.push({\n code: 'unsupported-parameter',\n title: 'Unsupported parameter.',\n controllerName: context.controllerName,\n memberName: context.methodName,\n detail:\n \"A whole @Headers() is not supported; provide a header name such as @Headers('x-example').\",\n filePath: context.filePath,\n line: location.line,\n column: location.column,\n });\n return undefined;\n }\n\n return { ...base, kind: 'header', name: argument.value };\n }\n\n if (decoratorName === 'Query') {\n return { ...base, kind: 'query', name: argument.value };\n }\n\n return { ...base, kind: 'body', name: argument.value };\n};\n","const trimSlashes = (segment: string) => segment.replace(/^\\/+/, '').replace(/\\/+$/, '');\n\nexport const joinRoutePath = (controllerPath: string, methodPath: string | undefined) => {\n const segments = [trimSlashes(controllerPath), trimSlashes(methodPath ?? '')].filter(\n (segment) => segment.length > 0,\n );\n\n return `/${segments.join('/')}`;\n};\n","import type ts from 'typescript';\nimport type { NestBridgeDiagnostic } from '../diagnostics/nestbridge-diagnostic';\nimport { HTTP_METHOD_DECORATOR_NAMES } from '../models/http-method';\nimport {\n decoratorNameOf,\n findAnyDecorator,\n readStaticStringArgument,\n} from './decorator-inspection';\nimport { extractParameterDefinition } from './extract-parameter-definition';\nimport { locationOf } from './node-location';\nimport { joinRoutePath } from './route-path';\n\ninterface ExtractionContext {\n sourceFile: ts.SourceFile;\n filePath: string;\n controllerName: string;\n controllerPath: string;\n diagnostics: NestBridgeDiagnostic[];\n}\n\nexport const extractMethodDefinition = (\n method: ts.MethodDeclaration,\n context: ExtractionContext,\n) => {\n const decorator = findAnyDecorator(method, Object.keys(HTTP_METHOD_DECORATOR_NAMES));\n\n if (decorator === undefined) {\n return undefined;\n }\n\n const methodName = method.name.getText();\n const decoratorName = decoratorNameOf(decorator);\n const location = locationOf(context.sourceFile, method);\n\n if (decoratorName === undefined) {\n return undefined;\n }\n\n const httpMethod = HTTP_METHOD_DECORATOR_NAMES[decoratorName];\n\n if (httpMethod === undefined) {\n return undefined;\n }\n\n const routeArgument = readStaticStringArgument(decorator);\n\n if (!routeArgument.ok) {\n context.diagnostics.push({\n code: 'unsupported-route',\n title: 'Unsupported route.',\n controllerName: context.controllerName,\n memberName: methodName,\n detail: 'Route paths must be statically analyzable.',\n found: `@${decoratorName}(${routeArgument.argumentText})`,\n filePath: context.filePath,\n line: location.line,\n column: location.column,\n });\n return undefined;\n }\n\n const parameters = method.parameters.map((parameter, index) =>\n extractParameterDefinition(parameter, index, {\n sourceFile: context.sourceFile,\n filePath: context.filePath,\n controllerName: context.controllerName,\n methodName,\n diagnostics: context.diagnostics,\n }),\n );\n\n if (parameters.some((parameter) => parameter === undefined)) {\n return undefined;\n }\n\n return {\n name: methodName,\n httpMethod,\n path: joinRoutePath(context.controllerPath, routeArgument.value),\n parameters: parameters.filter((parameter) => parameter !== undefined),\n line: location.line,\n column: location.column,\n };\n};\n","import ts from 'typescript';\nimport type { NestBridgeDiagnostic } from '../diagnostics/nestbridge-diagnostic';\nimport { findDecorator, readStaticStringArgument } from './decorator-inspection';\nimport { extractMethodDefinition } from './extract-method-definition';\nimport { locationOf } from './node-location';\n\nexport const extractControllerDefinition = (\n classDeclaration: ts.ClassDeclaration,\n sourceFile: ts.SourceFile,\n filePath: string,\n diagnostics: NestBridgeDiagnostic[],\n) => {\n const controllerName = classDeclaration.name?.text ?? '(anonymous controller)';\n const decorator = findDecorator(classDeclaration, 'Controller');\n\n if (decorator === undefined) {\n return undefined;\n }\n\n const location = locationOf(sourceFile, classDeclaration);\n const argument = readStaticStringArgument(decorator);\n\n if (!argument.ok) {\n diagnostics.push({\n code: 'unsupported-route',\n title: 'Unsupported route.',\n controllerName,\n memberName: '',\n detail: 'Controller paths must be statically analyzable.',\n found: `@Controller(${argument.argumentText})`,\n filePath,\n line: location.line,\n column: location.column,\n });\n return undefined;\n }\n\n const methods = classDeclaration.members\n .filter((member): member is ts.MethodDeclaration => ts.isMethodDeclaration(member))\n .map((method) =>\n extractMethodDefinition(method, {\n sourceFile,\n filePath,\n controllerName,\n controllerPath: argument.value ?? '',\n diagnostics,\n }),\n )\n .filter((method) => method !== undefined);\n\n return {\n name: controllerName,\n path: argument.value ?? '',\n sourceFile: filePath,\n methods,\n };\n};\n","import ts from 'typescript';\nimport { findDecorator } from './decorator-inspection';\n\nexport const findControllerClasses = (sourceFile: ts.SourceFile) => {\n return sourceFile.statements.filter(\n (statement): statement is ts.ClassDeclaration =>\n ts.isClassDeclaration(statement) && findDecorator(statement, 'Controller') !== undefined,\n );\n};\n","import { readFileSync } from 'node:fs';\nimport ts from 'typescript';\nimport type { NestBridgeDiagnostic } from '../diagnostics';\nimport type { ControllerDefinition } from '../models';\nimport { extractControllerDefinition } from './extract-controller-definition';\nimport { findControllerClasses } from './find-controller-classes';\n\nexport const analyzeControllers = (filePaths: readonly string[]) => {\n const diagnostics: NestBridgeDiagnostic[] = [];\n const controllers: ControllerDefinition[] = [];\n\n for (const filePath of filePaths) {\n const content = readFileSync(filePath, 'utf-8');\n const sourceFile = ts.createSourceFile(\n filePath,\n content,\n ts.ScriptTarget.ESNext,\n true,\n ts.ScriptKind.TS,\n );\n\n for (const classDeclaration of findControllerClasses(sourceFile)) {\n const controller = extractControllerDefinition(\n classDeclaration,\n sourceFile,\n filePath,\n diagnostics,\n );\n\n if (controller !== undefined) {\n controllers.push(controller);\n }\n }\n }\n\n return { controllers, diagnostics };\n};\n","import { dirname, extname, relative } from 'node:path';\nimport type { ControllerDefinition } from '../models';\n\nconst toPosixPath = (filePath: string) => filePath.replace(/\\\\/g, '/');\n\nconst importSpecifierFor = (sourceFile: string, outputFilePath: string) => {\n if (\n !sourceFile.startsWith('.') &&\n !/^[A-Za-z]:[\\\\/]/.test(sourceFile) &&\n !sourceFile.startsWith('/')\n ) {\n return sourceFile;\n }\n\n const relativePath = toPosixPath(relative(dirname(outputFilePath), sourceFile));\n return relativePath.startsWith('.') ? relativePath : `./${relativePath}`;\n};\n\nconst stripExtension = (filePath: string) => {\n const extension = extname(filePath);\n return extension.length > 0 ? filePath.slice(0, -extension.length) : filePath;\n};\n\nexport const generateControllerDeclaration = (\n controller: ControllerDefinition,\n outputFilePath: string,\n) => {\n const sourceFileSpecifier = importSpecifierFor(controller.sourceFile, outputFilePath);\n const importSpecifier = stripExtension(sourceFileSpecifier);\n const serverAlias = `__Server${controller.name}`;\n const methodDeclarations = controller.methods.map(\n (method) =>\n ` ${method.name}(...args: Parameters<${serverAlias}['${method.name}']>): RemoteResult<${serverAlias}['${method.name}']>;`,\n );\n\n const classBody = [' constructor();', '', ...methodDeclarations].join('\\n');\n\n return [\n `import type { ${controller.name} as ${serverAlias} } from '${importSpecifier}';`,\n `import type { RemoteResult } from '@nestbridge/runtime';`,\n '',\n '/**',\n ' * Generated by NestBridge — client-facing methods only.',\n ` * @see {@link ${sourceFileSpecifier}} for the real controller implementation.`,\n ' */',\n `export declare class ${controller.name} {`,\n classBody,\n '}',\n '',\n ].join('\\n');\n};\n","import type { NestBridgeDiagnostic } from './nestbridge-diagnostic';\n\nexport const formatDiagnostic = (diagnostic: NestBridgeDiagnostic) => {\n const subject =\n diagnostic.memberName.length > 0\n ? `${diagnostic.controllerName}.${diagnostic.memberName}`\n : diagnostic.controllerName;\n\n const lines = [`[NestBridge] ${diagnostic.title}`, '', subject, '', diagnostic.detail];\n\n if (diagnostic.found !== undefined) {\n lines.push('', 'Found:', diagnostic.found);\n }\n\n if (diagnostic.expected !== undefined) {\n lines.push('', 'Expected:', diagnostic.expected);\n }\n\n lines.push('', `${diagnostic.filePath}:${diagnostic.line}:${diagnostic.column}`);\n\n return lines.join('\\n');\n};\n","import { formatDiagnostic } from './format-diagnostic';\nimport type { NestBridgeDiagnostic } from './nestbridge-diagnostic';\n\nexport class NestBridgeDiagnosticError extends Error {\n readonly diagnostic: NestBridgeDiagnostic;\n\n constructor(diagnostic: NestBridgeDiagnostic) {\n super(formatDiagnostic(diagnostic));\n this.name = 'NestBridgeDiagnosticError';\n this.diagnostic = diagnostic;\n }\n}\n","import { version } from '../package.json';\n\nexport const VERSION: string = version;\n"],"names":[],"mappings":";;;;AAEO,MAAM,aAAA,GAAgB,CAC3B,IAAA,EACA,aAAA,KACG;AACH,EAAA,MAAM,UAAA,GAAa,EAAA,CAAG,aAAA,CAAc,IAAI,CAAA;AAExC,EAAA,IAAI,eAAe,MAAA,EAAW;AAC5B,IAAA,OAAO,MAAA;AAAA,EACT;AAEA,EAAA,OAAO,WAAW,IAAA,CAAK,CAAC,cAAc,eAAA,CAAgB,SAAS,MAAM,aAAa,CAAA;AACpF,CAAA;AAEO,MAAM,gBAAA,GAAmB,CAC9B,IAAA,EACA,cAAA,KACG;AACH,EAAA,MAAM,UAAA,GAAa,EAAA,CAAG,aAAA,CAAc,IAAI,CAAA;AAExC,EAAA,IAAI,eAAe,MAAA,EAAW;AAC5B,IAAA,OAAO,MAAA;AAAA,EACT;AAEA,EAAA,OAAO,UAAA,CAAW,IAAA,CAAK,CAAC,SAAA,KAAc,cAAA,CAAe,SAAS,eAAA,CAAgB,SAAS,CAAA,IAAK,EAAE,CAAC,CAAA;AACjG,CAAA;AAEO,MAAM,eAAA,GAAkB,CAAC,SAAA,KAA4B;AAC1D,EAAA,MAAM,aAAa,SAAA,CAAU,UAAA;AAE7B,EAAA,IAAI,EAAA,CAAG,iB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AAA,EAAU,UAAA,CAAW,KAAK,CAAA;AAAA,EAC3C;AAEA,EAAA,IAAI,UAAA,CAAW,aAAa,MAAA,EAAW;AACrC,IAAA,KAAA,CAAM,IAAA,CAAK,EAAA,EAAI,WAAA,EAAa,UAAA,CAAW,QAAQ,CAAA;AAAA,EACjD;AAEA,EAAA,KAAA,CAAM,IAAA,CAAK,EAAA,EAAI,CAAA,EAAG,UAAA,CAAW,QAAQ,CAAA,CAAA,EAAI,UAAA,CAAW,IAAI,CAAA,CAAA,EAAI,UAAA,CAAW,MAAM,CAAA,CAAE,CAAA;AAE/E,EAAA,OAAO,KAAA,CAAM,KAAK,IAAI,CAAA;AACxB;;AClBO,MAAM,kCAAkC,KAAA,CAAM;AAAA,EAC1C,UAAA;AAAA,EAET,YAAY,UAAA,EAAkC;AAC5C,IAAA,KAAA,CAAM,gBAAA,CAAiB,UAAU,CAAC,CAAA;AAClC,IAAA,IAAA,CAAK,IAAA,GAAO,2BAAA;AACZ,IAAA,IAAA,CAAK,UAAA,GAAa,UAAA;AAAA,EACpB;AACF;;;;ACTO,MAAM,OAAA,GAAkB;;"}
|
package/package.json
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@nestbridge/core",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"main": "./build/nestbridge.core.js",
|
|
7
|
+
"types": "./build/nestbridge.core.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./build/nestbridge.core.d.ts",
|
|
11
|
+
"import": "./build/nestbridge.core.js"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"files": [
|
|
15
|
+
"build"
|
|
16
|
+
],
|
|
17
|
+
"scripts": {
|
|
18
|
+
"build": "vite build",
|
|
19
|
+
"test": "vitest run",
|
|
20
|
+
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
21
|
+
"lint": "biome check ."
|
|
22
|
+
},
|
|
23
|
+
"dependencies": {
|
|
24
|
+
"typescript": "^5.7.2"
|
|
25
|
+
},
|
|
26
|
+
"devDependencies": {
|
|
27
|
+
"@types/node": "^22.10.2",
|
|
28
|
+
"vite": "^6.0.7",
|
|
29
|
+
"vite-plugin-dts": "^4.4.0",
|
|
30
|
+
"vitest": "^5.0.0"
|
|
31
|
+
}
|
|
32
|
+
}
|