tidewave 0.2.4 → 0.4.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/README.md +141 -40
- package/dist/cli/index.js +11938 -11560
- package/dist/core.d.ts +11 -0
- package/dist/evaluation/eval_worker.js +1 -1
- package/dist/http/index.d.ts +3 -6
- package/dist/http/security.d.ts +2 -1
- package/dist/index.d.ts +2 -2
- package/dist/logger/circular-buffer.d.ts +54 -0
- package/dist/logger/instrumentation.d.ts +2 -0
- package/dist/logger/tidewave-log-record-processor.d.ts +17 -0
- package/dist/logger/tidewave-span-processor.d.ts +26 -0
- package/dist/next-js/handler.d.ts +11 -0
- package/dist/{http/index.js → next-js/handler.js} +32978 -32329
- package/dist/next-js/instrumentation.d.ts +7 -0
- package/dist/next-js/instrumentation.js +255 -0
- package/dist/tools.d.ts +18 -0
- package/dist/vite-plugin.d.ts +2 -1
- package/dist/vite-plugin.js +32924 -32366
- package/package.json +28 -5
- package/dist/core.js +0 -64
- package/dist/evaluation/code_executor.js +0 -81
- package/dist/http/security.js +0 -120
- package/dist/index.js +0 -883
- package/dist/mcp.js +0 -14151
- package/dist/resolution/formatters.js +0 -155
- package/dist/resolution/index.js +0 -829
- package/dist/resolution/module-resolver.js +0 -166
- package/dist/resolution/symbol-finder.js +0 -429
- package/dist/resolution/utils.js +0 -112
- package/dist/tools.js +0 -4099
|
@@ -1,155 +0,0 @@
|
|
|
1
|
-
import { createRequire } from "node:module";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
4
|
-
var __defProp = Object.defineProperty;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __toESM = (mod, isNodeMode, target) => {
|
|
8
|
-
target = mod != null ? __create(__getProtoOf(mod)) : {};
|
|
9
|
-
const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
|
|
10
|
-
for (let key of __getOwnPropNames(mod))
|
|
11
|
-
if (!__hasOwnProp.call(to, key))
|
|
12
|
-
__defProp(to, key, {
|
|
13
|
-
get: () => mod[key],
|
|
14
|
-
enumerable: true
|
|
15
|
-
});
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
19
|
-
var __export = (target, all) => {
|
|
20
|
-
for (var name in all)
|
|
21
|
-
__defProp(target, name, {
|
|
22
|
-
get: all[name],
|
|
23
|
-
enumerable: true,
|
|
24
|
-
configurable: true,
|
|
25
|
-
set: (newValue) => all[name] = () => newValue
|
|
26
|
-
});
|
|
27
|
-
};
|
|
28
|
-
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
29
|
-
|
|
30
|
-
// src/resolution/formatters.ts
|
|
31
|
-
import ts from "typescript";
|
|
32
|
-
function getSignature(checker, symbol, type) {
|
|
33
|
-
const signatures = checker.getSignaturesOfType(type, ts.SignatureKind.Call);
|
|
34
|
-
if (signatures.length > 0) {
|
|
35
|
-
return signatures.map((sig) => {
|
|
36
|
-
const sigString = checker.signatureToString(sig);
|
|
37
|
-
return `${symbol.getName()}${sigString}`;
|
|
38
|
-
}).join(`
|
|
39
|
-
`);
|
|
40
|
-
}
|
|
41
|
-
const constructSignatures = checker.getSignaturesOfType(type, ts.SignatureKind.Construct);
|
|
42
|
-
if (constructSignatures.length > 0) {
|
|
43
|
-
return constructSignatures.map((sig) => "new " + checker.signatureToString(sig)).join(`
|
|
44
|
-
`);
|
|
45
|
-
}
|
|
46
|
-
if (symbol.valueDeclaration || symbol.declarations && symbol.declarations.length > 0) {
|
|
47
|
-
const declaration = symbol.valueDeclaration || symbol.declarations[0];
|
|
48
|
-
if (!declaration)
|
|
49
|
-
return checker.typeToString(type);
|
|
50
|
-
const sourceFile = declaration.getSourceFile();
|
|
51
|
-
if (ts.isFunctionDeclaration(declaration) && declaration.name) {
|
|
52
|
-
const functionType = checker.getTypeOfSymbolAtLocation(symbol, declaration);
|
|
53
|
-
const functionSignatures = checker.getSignaturesOfType(functionType, ts.SignatureKind.Call);
|
|
54
|
-
if (functionSignatures.length > 0) {
|
|
55
|
-
return functionSignatures.map((sig) => checker.signatureToString(sig)).join(`
|
|
56
|
-
`);
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
if (ts.isInterfaceDeclaration(declaration) || ts.isTypeAliasDeclaration(declaration)) {
|
|
60
|
-
const start2 = declaration.getStart();
|
|
61
|
-
const end2 = declaration.getEnd();
|
|
62
|
-
const text2 = sourceFile.text.substring(start2, end2);
|
|
63
|
-
const lines = text2.split(`
|
|
64
|
-
`).map((line) => line.trim()).filter((line) => line.length > 0);
|
|
65
|
-
if (ts.isInterfaceDeclaration(declaration)) {
|
|
66
|
-
const bodyStart = text2.indexOf("{");
|
|
67
|
-
const bodyEnd = text2.lastIndexOf("}");
|
|
68
|
-
if (bodyStart !== -1 && bodyEnd !== -1) {
|
|
69
|
-
const body = text2.substring(bodyStart, bodyEnd + 1);
|
|
70
|
-
const interfaceName = `interface ${declaration.name.text}`;
|
|
71
|
-
const compactBody = body.replace(/\s*\n\s*/g, " ").replace(/\s+/g, " ");
|
|
72
|
-
return `${interfaceName} ${compactBody}`;
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
return lines.join(" ").replace(/\s+/g, " ");
|
|
76
|
-
}
|
|
77
|
-
if (ts.isClassDeclaration(declaration)) {
|
|
78
|
-
const classType = checker.getTypeOfSymbolAtLocation(symbol, declaration);
|
|
79
|
-
const classConstructSignatures = checker.getSignaturesOfType(classType, ts.SignatureKind.Construct);
|
|
80
|
-
if (classConstructSignatures.length > 0) {
|
|
81
|
-
return classConstructSignatures.map((sig) => "new " + checker.signatureToString(sig)).join(`
|
|
82
|
-
`);
|
|
83
|
-
} else {
|
|
84
|
-
const start2 = declaration.getStart();
|
|
85
|
-
const end2 = Math.min(declaration.getStart() + 100, declaration.getEnd());
|
|
86
|
-
const text2 = sourceFile.text.substring(start2, end2);
|
|
87
|
-
return text2.split(`
|
|
88
|
-
`)[0]?.trim() + (text2.includes(`
|
|
89
|
-
`) ? "..." : "") || "";
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
const start = declaration.getStart();
|
|
93
|
-
const end = Math.min(declaration.getStart() + 100, declaration.getEnd());
|
|
94
|
-
const text = sourceFile.text.substring(start, end);
|
|
95
|
-
return text.split(`
|
|
96
|
-
`)[0]?.trim() + (text.includes(`
|
|
97
|
-
`) ? "..." : "") || "";
|
|
98
|
-
}
|
|
99
|
-
return checker.typeToString(type);
|
|
100
|
-
}
|
|
101
|
-
function getTypeString(checker, symbol, type) {
|
|
102
|
-
if (symbol.flags & (ts.SymbolFlags.Interface | ts.SymbolFlags.TypeAlias)) {
|
|
103
|
-
const declaration = symbol.valueDeclaration || symbol.declarations && symbol.declarations[0];
|
|
104
|
-
if (declaration && ts.isInterfaceDeclaration(declaration)) {
|
|
105
|
-
const properties = type.getProperties();
|
|
106
|
-
if (properties.length > 0) {
|
|
107
|
-
const propertyStrings = properties.map((prop) => {
|
|
108
|
-
const propDeclaration = prop.valueDeclaration || prop.declarations && prop.declarations[0];
|
|
109
|
-
const propType = propDeclaration ? checker.getTypeOfSymbolAtLocation(prop, propDeclaration) : checker.getTypeAtLocation(prop.declarations[0]);
|
|
110
|
-
const propTypeString = checker.typeToString(propType);
|
|
111
|
-
const isOptional = prop.flags & ts.SymbolFlags.Optional;
|
|
112
|
-
return `${prop.getName()}${isOptional ? "?" : ""}: ${propTypeString}`;
|
|
113
|
-
});
|
|
114
|
-
return `{ ${propertyStrings.join("; ")} }`;
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
const defaultTypeString = checker.typeToString(type);
|
|
119
|
-
if (defaultTypeString === "any" && symbol.flags & ts.SymbolFlags.Interface) {
|
|
120
|
-
return `interface ${symbol.getName()}`;
|
|
121
|
-
}
|
|
122
|
-
return defaultTypeString;
|
|
123
|
-
}
|
|
124
|
-
function formatOutput(info) {
|
|
125
|
-
const output = [];
|
|
126
|
-
output.push(`
|
|
127
|
-
${info.name}`);
|
|
128
|
-
output.push(`Kind: ${info.kind}`);
|
|
129
|
-
output.push(`Location: ${info.location}`);
|
|
130
|
-
output.push("");
|
|
131
|
-
if (info.signature) {
|
|
132
|
-
output.push("Signature:");
|
|
133
|
-
output.push(info.signature);
|
|
134
|
-
output.push("");
|
|
135
|
-
}
|
|
136
|
-
if (info.documentation) {
|
|
137
|
-
output.push("Documentation:");
|
|
138
|
-
output.push(info.documentation);
|
|
139
|
-
output.push("");
|
|
140
|
-
}
|
|
141
|
-
if (info.jsDoc) {
|
|
142
|
-
output.push("JSDoc Tags:");
|
|
143
|
-
output.push(info.jsDoc);
|
|
144
|
-
output.push("");
|
|
145
|
-
}
|
|
146
|
-
output.push("Type:");
|
|
147
|
-
output.push(info.type);
|
|
148
|
-
return output.join(`
|
|
149
|
-
`);
|
|
150
|
-
}
|
|
151
|
-
export {
|
|
152
|
-
getTypeString,
|
|
153
|
-
getSignature,
|
|
154
|
-
formatOutput
|
|
155
|
-
};
|