webmcp-nexus-core 0.1.9

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/index.js ADDED
@@ -0,0 +1,568 @@
1
+ // src/ts-extractor.ts
2
+ import nodePath from "path";
3
+ import {
4
+ Project,
5
+ SyntaxKind
6
+ } from "ts-morph";
7
+ var REGISTRATION_FUNCTIONS = ["registerGlobalTools", "useWebMcpTools"];
8
+ var isDebug = () => (process.env.DEBUG ?? "").toLowerCase().includes("webmcp");
9
+ function resolveWithAlias(spec, alias) {
10
+ if (!alias) return null;
11
+ const keys = Object.keys(alias).sort((a, b) => b.length - a.length);
12
+ for (const key of keys) {
13
+ const target = alias[key];
14
+ if (typeof target !== "string") continue;
15
+ if (key.endsWith("$")) {
16
+ if (spec === key.slice(0, -1)) return target;
17
+ continue;
18
+ }
19
+ if (spec === key) return target;
20
+ if (spec.startsWith(key + "/")) {
21
+ return nodePath.join(target, spec.slice(key.length + 1));
22
+ }
23
+ }
24
+ return null;
25
+ }
26
+ function mapType(type) {
27
+ if (type.isString() || type.isStringLiteral()) return "string";
28
+ if (type.isNumber() || type.isNumberLiteral()) return "number";
29
+ if (type.isBoolean() || type.isBooleanLiteral()) return "boolean";
30
+ if (type.isArray()) return "array";
31
+ if (type.isUnion()) {
32
+ const filtered = type.getUnionTypes().filter((t) => !t.isUndefined() && !t.isNull());
33
+ if (filtered.length === 0) return "string";
34
+ if (filtered.length === 1) return mapType(filtered[0]);
35
+ if (filtered.every((t) => t.isStringLiteral())) return "string";
36
+ if (filtered.every((t) => t.isNumberLiteral())) return "number";
37
+ if (filtered.every((t) => t.isBooleanLiteral())) return "boolean";
38
+ return "string";
39
+ }
40
+ if (type.isObject() && !type.isArray()) return "object";
41
+ if (type.isNull() || type.isUndefined()) return "string";
42
+ if (type.isAny() || type.isUnknown()) return "string";
43
+ return "string";
44
+ }
45
+ function getArrayItemType(type) {
46
+ if (!type.isArray()) return void 0;
47
+ const typeArgs = type.getTypeArguments();
48
+ if (typeArgs.length > 0) {
49
+ return mapType(typeArgs[0]);
50
+ }
51
+ return "string";
52
+ }
53
+ function extractEnumValues(type) {
54
+ if (!type.isUnion()) return void 0;
55
+ const unionTypes = type.getUnionTypes().filter((t) => !t.isUndefined() && !t.isNull());
56
+ if (unionTypes.length === 0) return void 0;
57
+ if (unionTypes.every((t) => t.isStringLiteral())) {
58
+ return unionTypes.map((t) => t.getLiteralValue());
59
+ }
60
+ return void 0;
61
+ }
62
+ function getPropertyDescription(symbol) {
63
+ const declarations = symbol.getDeclarations();
64
+ for (const decl of declarations) {
65
+ const jsDocs = decl.getJsDocs?.();
66
+ if (jsDocs && jsDocs.length > 0) {
67
+ const comment = jsDocs[0].getDescription?.();
68
+ if (comment) return comment.trim();
69
+ }
70
+ const fullText = decl.getFullText();
71
+ const match = fullText.match(/\/\*\*\s*(.*?)\s*\*\//s);
72
+ if (match) {
73
+ const raw = match[1].split("\n").map((line) => line.replace(/^\s*\*\s?/, "").trim()).filter(Boolean).join(" ");
74
+ if (raw) return raw;
75
+ }
76
+ }
77
+ return void 0;
78
+ }
79
+ function extractProperties(type, depth = 0) {
80
+ const properties = [];
81
+ for (const prop of type.getProperties()) {
82
+ const propType = prop.getValueDeclaration() ? prop.getTypeAtLocation(prop.getValueDeclaration()) : prop.getDeclaredType();
83
+ const isOptional = prop.isOptional();
84
+ const enumValues = extractEnumValues(propType);
85
+ const mappedType = mapType(propType);
86
+ let nestedProperties;
87
+ if (mappedType === "object" && depth < 3) {
88
+ nestedProperties = extractProperties(propType, depth + 1);
89
+ }
90
+ properties.push({
91
+ name: prop.getName(),
92
+ type: mappedType,
93
+ description: getPropertyDescription(prop),
94
+ required: !isOptional,
95
+ enumValues,
96
+ itemType: getArrayItemType(propType),
97
+ properties: nestedProperties
98
+ });
99
+ }
100
+ return properties;
101
+ }
102
+ function extractFunctionMetadata(node, _sourceFile) {
103
+ let description = "";
104
+ let readOnly = false;
105
+ let properties = [];
106
+ if (node.getKind() === SyntaxKind.FunctionDeclaration) {
107
+ const funcDecl = node;
108
+ const jsDocs = funcDecl.getJsDocs();
109
+ if (jsDocs.length > 0) {
110
+ description = jsDocs[0].getDescription()?.trim() ?? "";
111
+ const tags = jsDocs[0].getTags();
112
+ readOnly = tags.some((tag) => tag.getTagName() === "readonly");
113
+ }
114
+ const params = funcDecl.getParameters();
115
+ if (params.length > 0) {
116
+ const paramType = params[0].getType();
117
+ properties = extractProperties(paramType);
118
+ }
119
+ return { description, readOnly, properties };
120
+ }
121
+ if (node.getKind() === SyntaxKind.ArrowFunction || node.getKind() === SyntaxKind.FunctionExpression) {
122
+ const funcNode = node;
123
+ const parent = funcNode.getParent();
124
+ if (parent) {
125
+ let varStatement;
126
+ if (parent.getKind() === SyntaxKind.VariableDeclaration) {
127
+ varStatement = parent.getParent()?.getParent();
128
+ } else if (parent.getKind() === SyntaxKind.CallExpression) {
129
+ const callParent = parent.getParent();
130
+ if (callParent?.getKind() === SyntaxKind.VariableDeclaration) {
131
+ varStatement = callParent.getParent()?.getParent();
132
+ }
133
+ }
134
+ if (varStatement) {
135
+ const jsDocs = varStatement.getJsDocs?.();
136
+ if (jsDocs && jsDocs.length > 0) {
137
+ description = jsDocs[0].getDescription?.()?.trim() ?? "";
138
+ const tags = jsDocs[0].getTags?.() ?? [];
139
+ readOnly = tags.some((tag) => tag.getTagName() === "readonly");
140
+ }
141
+ }
142
+ }
143
+ const params = funcNode.getParameters();
144
+ if (params.length > 0) {
145
+ const paramType = params[0].getType();
146
+ properties = extractProperties(paramType);
147
+ }
148
+ return { description, readOnly, properties };
149
+ }
150
+ return { description, readOnly, properties };
151
+ }
152
+ function extractToolFromBindingElement(bindingElement, toolName, relPath) {
153
+ const be = bindingElement;
154
+ const nameNode = be.getNameNode?.();
155
+ if (!nameNode) return null;
156
+ const bindingType = nameNode.getType();
157
+ const callSignatures = bindingType.getCallSignatures();
158
+ if (callSignatures.length === 0) return null;
159
+ let properties = [];
160
+ const sig = callSignatures[0];
161
+ const sigParams = sig.getParameters();
162
+ if (sigParams.length > 0) {
163
+ const paramSym = sigParams[0];
164
+ const paramDecls = paramSym.getDeclarations();
165
+ if (paramDecls.length > 0) {
166
+ const paramType = paramSym.getTypeAtLocation(paramDecls[0]);
167
+ properties = extractProperties(paramType);
168
+ }
169
+ }
170
+ const propertyNameNode = be.getPropertyNameNode?.();
171
+ const propertyName = propertyNameNode ? propertyNameNode.getText() : toolName;
172
+ let description = "";
173
+ let readOnly = false;
174
+ const objectBindingPattern = bindingElement.getParent();
175
+ const variableDecl = objectBindingPattern?.getParent();
176
+ if (variableDecl && variableDecl.getKind() === SyntaxKind.VariableDeclaration) {
177
+ const initializer = variableDecl.getInitializer?.();
178
+ if (initializer) {
179
+ const initType = initializer.getType();
180
+ let propSym = initType.getProperty(propertyName);
181
+ if (!propSym && initType.isUnion?.()) {
182
+ for (const t of initType.getUnionTypes()) {
183
+ if (t.isNull?.() || t.isUndefined?.()) continue;
184
+ propSym = t.getProperty(propertyName);
185
+ if (propSym) break;
186
+ }
187
+ }
188
+ if (propSym) {
189
+ const propDecls = propSym.getDeclarations();
190
+ for (const pdecl of propDecls) {
191
+ const jsDocs = pdecl.getJsDocs?.();
192
+ if (jsDocs && jsDocs.length > 0) {
193
+ description = jsDocs[0].getDescription?.()?.trim() ?? "";
194
+ const tags = jsDocs[0].getTags?.() ?? [];
195
+ readOnly = tags.some((t) => t.getTagName() === "readonly");
196
+ break;
197
+ }
198
+ const fullText = pdecl.getFullText();
199
+ const m = fullText.match(/\/\*\*\s*([\s\S]*?)\s*\*\//);
200
+ if (m) {
201
+ const raw = m[1].split("\n").map((line) => line.replace(/^\s*\*\s?/, "").trim()).filter(Boolean).join(" ");
202
+ if (raw) {
203
+ description = raw;
204
+ if (/@readonly\b/.test(m[1])) readOnly = true;
205
+ break;
206
+ }
207
+ }
208
+ }
209
+ }
210
+ }
211
+ }
212
+ return {
213
+ name: toolName,
214
+ description,
215
+ properties,
216
+ readOnly,
217
+ sourceFile: relPath,
218
+ injectionTarget: toolName
219
+ };
220
+ }
221
+ function resolveObjectLiteralArg(arg, sourceFile, project, projectRoot) {
222
+ const tools = [];
223
+ if (arg.getKind() !== SyntaxKind.ObjectLiteralExpression) return tools;
224
+ const objLiteral = arg;
225
+ const filePath = sourceFile.getFilePath();
226
+ const baseDir = projectRoot ?? process.cwd();
227
+ const relPath = "./" + nodePath.relative(baseDir, filePath).replace(/\.tsx?$/, "");
228
+ for (const prop of objLiteral.getProperties()) {
229
+ let toolName;
230
+ let valueNode;
231
+ if (prop.getKind() === SyntaxKind.ShorthandPropertyAssignment) {
232
+ toolName = prop.getName();
233
+ const tc = project.getTypeChecker().compilerObject;
234
+ const valueSym = tc.getShorthandAssignmentValueSymbol(prop.compilerNode);
235
+ if (!valueSym || !valueSym.declarations || valueSym.declarations.length === 0) continue;
236
+ const decl = sourceFile._getNodeFromCompilerNode(valueSym.declarations[0]);
237
+ if (decl.getKind() === SyntaxKind.VariableDeclaration) {
238
+ valueNode = decl.getInitializer?.();
239
+ } else if (decl.getKind() === SyntaxKind.FunctionDeclaration) {
240
+ valueNode = decl;
241
+ } else if (decl.getKind() === SyntaxKind.Parameter) {
242
+ continue;
243
+ } else if (decl.getKind() === SyntaxKind.BindingElement) {
244
+ const tool = extractToolFromBindingElement(decl, toolName, relPath);
245
+ if (tool) tools.push(tool);
246
+ continue;
247
+ }
248
+ } else if (prop.getKind() === SyntaxKind.PropertyAssignment) {
249
+ toolName = prop.getName();
250
+ valueNode = prop.getInitializer?.();
251
+ } else {
252
+ continue;
253
+ }
254
+ if (!valueNode) continue;
255
+ let funcNode = valueNode;
256
+ if (valueNode.getKind() === SyntaxKind.CallExpression) {
257
+ const callExpr = valueNode;
258
+ const callName = callExpr.getExpression().getText();
259
+ if (callName === "useCallback") {
260
+ const args = callExpr.getArguments();
261
+ if (args.length > 0) {
262
+ funcNode = args[0];
263
+ }
264
+ }
265
+ }
266
+ if (funcNode.getKind() === SyntaxKind.Identifier) {
267
+ const symbol = funcNode.getSymbol();
268
+ if (symbol) {
269
+ const declarations = symbol.getDeclarations();
270
+ if (declarations.length > 0) {
271
+ const decl = declarations[0];
272
+ if (decl.getKind() === SyntaxKind.FunctionDeclaration) {
273
+ funcNode = decl;
274
+ } else if (decl.getKind() === SyntaxKind.VariableDeclaration) {
275
+ const init = decl.getInitializer?.();
276
+ if (init) funcNode = init;
277
+ }
278
+ }
279
+ }
280
+ }
281
+ const metadata = extractFunctionMetadata(funcNode, sourceFile);
282
+ tools.push({
283
+ name: toolName,
284
+ description: metadata.description,
285
+ properties: metadata.properties,
286
+ readOnly: metadata.readOnly,
287
+ sourceFile: relPath,
288
+ injectionTarget: toolName
289
+ });
290
+ }
291
+ return tools;
292
+ }
293
+ function resolveNamespaceImportArg(arg, sourceFile, project, projectRoot, alias) {
294
+ const tools = [];
295
+ if (arg.getKind() !== SyntaxKind.Identifier) return tools;
296
+ const identifier = arg;
297
+ const symbol = identifier.getSymbol();
298
+ if (!symbol) return tools;
299
+ const declarations = symbol.getDeclarations();
300
+ if (declarations.length === 0) return tools;
301
+ const decl = declarations[0];
302
+ if (decl.getKind() !== SyntaxKind.NamespaceImport) return tools;
303
+ const importDecl = decl.getParent()?.getParent();
304
+ if (!importDecl) return tools;
305
+ const moduleSpecifier = importDecl.getModuleSpecifierValue?.();
306
+ if (!moduleSpecifier) return tools;
307
+ const currentDir = nodePath.dirname(sourceFile.getFilePath());
308
+ const aliasResolved = resolveWithAlias(moduleSpecifier, alias);
309
+ let resolvedPath = null;
310
+ if (aliasResolved) {
311
+ resolvedPath = nodePath.isAbsolute(aliasResolved) ? aliasResolved : nodePath.resolve(projectRoot ?? currentDir, aliasResolved);
312
+ } else if (moduleSpecifier.startsWith(".") || nodePath.isAbsolute(moduleSpecifier)) {
313
+ resolvedPath = nodePath.resolve(currentDir, moduleSpecifier);
314
+ }
315
+ if (!resolvedPath) {
316
+ if (isDebug()) {
317
+ console.warn(
318
+ `[webmcp] skip bare module specifier "${moduleSpecifier}" in ${sourceFile.getFilePath()} (no alias match)`
319
+ );
320
+ }
321
+ return tools;
322
+ }
323
+ const possibleExtensions = [".ts", ".tsx", "/index.ts", "/index.tsx"];
324
+ let targetFile;
325
+ for (const ext of possibleExtensions) {
326
+ const tryPath = resolvedPath + ext;
327
+ targetFile = project.getSourceFile(tryPath);
328
+ if (targetFile) break;
329
+ }
330
+ if (!targetFile) {
331
+ for (const ext of possibleExtensions) {
332
+ const tryPath = resolvedPath + ext;
333
+ try {
334
+ targetFile = project.addSourceFileAtPath(tryPath);
335
+ if (targetFile) break;
336
+ } catch (err) {
337
+ if (isDebug()) {
338
+ console.warn(`[webmcp] failed to add source file: ${tryPath}`, err);
339
+ }
340
+ }
341
+ }
342
+ }
343
+ if (!targetFile) {
344
+ console.warn(
345
+ `[webmcp] cannot resolve module "${moduleSpecifier}" from ${sourceFile.getFilePath()}. Tried extensions: ${possibleExtensions.join(", ")}. Resolved base: ${resolvedPath}`
346
+ );
347
+ return tools;
348
+ }
349
+ const namespaceName = identifier.getText();
350
+ const baseDir = projectRoot ?? process.cwd();
351
+ const relPath = "./" + nodePath.relative(baseDir, targetFile.getFilePath()).replace(/\.tsx?$/, "");
352
+ for (const exportedDecl of targetFile.getExportedDeclarations()) {
353
+ const [exportName, declarations2] = exportedDecl;
354
+ if (declarations2.length === 0) continue;
355
+ const exportNode = declarations2[0];
356
+ let funcNode;
357
+ if (exportNode.getKind() === SyntaxKind.FunctionDeclaration) {
358
+ funcNode = exportNode;
359
+ } else if (exportNode.getKind() === SyntaxKind.VariableDeclaration) {
360
+ const init = exportNode.getInitializer?.();
361
+ if (init && (init.getKind() === SyntaxKind.ArrowFunction || init.getKind() === SyntaxKind.FunctionExpression)) {
362
+ funcNode = init;
363
+ }
364
+ }
365
+ if (!funcNode) continue;
366
+ const metadata = extractFunctionMetadata(funcNode, targetFile);
367
+ tools.push({
368
+ name: exportName,
369
+ description: metadata.description,
370
+ properties: metadata.properties,
371
+ readOnly: metadata.readOnly,
372
+ sourceFile: relPath,
373
+ injectionTarget: `${namespaceName}.${exportName}`
374
+ });
375
+ }
376
+ return tools;
377
+ }
378
+ function extractToolsFromFile(fileContent, filePath, projectRoot, alias) {
379
+ const hasRegistration = REGISTRATION_FUNCTIONS.some((fn) => fileContent.includes(fn));
380
+ if (!hasRegistration) return null;
381
+ if (isDebug()) {
382
+ console.log(
383
+ `[webmcp] extractToolsFromFile: ${filePath}, projectRoot=${projectRoot ?? "(none)"}`
384
+ );
385
+ }
386
+ try {
387
+ const project = new Project({
388
+ compilerOptions: {
389
+ strict: true,
390
+ target: 99,
391
+ // ESNext
392
+ module: 99,
393
+ // ESNext
394
+ jsx: 4,
395
+ // ReactJSX
396
+ moduleResolution: 100,
397
+ // Bundler
398
+ esModuleInterop: true,
399
+ ...projectRoot ? { rootDir: projectRoot, baseUrl: projectRoot } : {}
400
+ },
401
+ skipAddingFilesFromTsConfig: true,
402
+ useInMemoryFileSystem: false
403
+ });
404
+ const sourceFile = project.createSourceFile(filePath, fileContent, {
405
+ overwrite: true
406
+ });
407
+ const result = {
408
+ tools: [],
409
+ registrationCalls: []
410
+ };
411
+ sourceFile.forEachDescendant((node) => {
412
+ if (node.getKind() !== SyntaxKind.CallExpression) return;
413
+ const callExpr = node;
414
+ const exprText = callExpr.getExpression().getText();
415
+ if (!REGISTRATION_FUNCTIONS.includes(exprText)) return;
416
+ result.registrationCalls.push({
417
+ type: exprText,
418
+ start: callExpr.getStart()
419
+ });
420
+ const args = callExpr.getArguments();
421
+ for (const arg of args) {
422
+ if (arg.getKind() === SyntaxKind.ObjectLiteralExpression) {
423
+ const tools = resolveObjectLiteralArg(arg, sourceFile, project, projectRoot);
424
+ result.tools.push(...tools);
425
+ } else if (arg.getKind() === SyntaxKind.Identifier) {
426
+ const tools = resolveNamespaceImportArg(arg, sourceFile, project, projectRoot, alias);
427
+ result.tools.push(...tools);
428
+ }
429
+ }
430
+ });
431
+ if (result.tools.length === 0) {
432
+ if (isDebug()) {
433
+ console.warn(`[webmcp] no tools extracted from ${filePath}`);
434
+ }
435
+ return null;
436
+ }
437
+ return result;
438
+ } catch (err) {
439
+ console.warn(
440
+ `[webmcp] extractToolsFromFile failed for ${filePath}:`,
441
+ err instanceof Error ? err.message : err
442
+ );
443
+ if (isDebug()) {
444
+ console.warn(`[webmcp] full error:`, err);
445
+ }
446
+ return null;
447
+ }
448
+ }
449
+
450
+ // src/schema-generator.ts
451
+ function generateSchema(properties, description) {
452
+ const schema = {
453
+ type: "object",
454
+ properties: {},
455
+ required: []
456
+ };
457
+ if (description) {
458
+ schema.description = description;
459
+ }
460
+ for (const prop of properties) {
461
+ const propSchema = mapTypeToSchema(prop);
462
+ schema.properties[prop.name] = propSchema;
463
+ if (prop.required) {
464
+ schema.required.push(prop.name);
465
+ }
466
+ }
467
+ if (schema.required.length === 0) {
468
+ delete schema.required;
469
+ }
470
+ return schema;
471
+ }
472
+ function generateSchemaInjectionCode(injectionTarget, description, properties, readOnly) {
473
+ const inputSchema = generateSchema(properties);
474
+ delete inputSchema.description;
475
+ const schemaObj = {
476
+ description,
477
+ inputSchema,
478
+ readOnly
479
+ };
480
+ return `${injectionTarget}.__webmcpSchema = ${JSON.stringify(schemaObj, null, 2)};`;
481
+ }
482
+ function mapTypeToSchema(prop) {
483
+ const schema = { type: "string" };
484
+ if (prop.description) {
485
+ schema.description = prop.description;
486
+ }
487
+ if (prop.enumValues && prop.enumValues.length > 0) {
488
+ schema.type = "string";
489
+ schema.enum = prop.enumValues;
490
+ return schema;
491
+ }
492
+ switch (prop.type) {
493
+ case "string":
494
+ schema.type = "string";
495
+ break;
496
+ case "number":
497
+ schema.type = "number";
498
+ break;
499
+ case "boolean":
500
+ schema.type = "boolean";
501
+ break;
502
+ case "array":
503
+ schema.type = "array";
504
+ if (prop.itemType) {
505
+ schema.items = { type: prop.itemType };
506
+ }
507
+ break;
508
+ case "object":
509
+ schema.type = "object";
510
+ if (prop.properties && prop.properties.length > 0) {
511
+ schema.properties = {};
512
+ const required = [];
513
+ for (const subProp of prop.properties) {
514
+ schema.properties[subProp.name] = mapTypeToSchema(subProp);
515
+ if (subProp.required) required.push(subProp.name);
516
+ }
517
+ if (required.length > 0) schema.required = required;
518
+ }
519
+ break;
520
+ default:
521
+ schema.type = "string";
522
+ }
523
+ return schema;
524
+ }
525
+
526
+ // src/transform.ts
527
+ var isDebug2 = () => (process.env.DEBUG ?? "").toLowerCase().includes("webmcp");
528
+ function transformCode(code, filePath, options = {}) {
529
+ if (!code.includes("registerGlobalTools") && !code.includes("useWebMcpTools")) {
530
+ return { code, transformed: false };
531
+ }
532
+ if (isDebug2()) {
533
+ console.log(
534
+ `[webmcp] transformCode: ${filePath}, projectRoot=${options.projectRoot ?? "(none)"}`
535
+ );
536
+ }
537
+ const result = extractToolsFromFile(code, filePath, options.projectRoot, options.alias);
538
+ if (!result || result.tools.length === 0) {
539
+ return { code, transformed: false };
540
+ }
541
+ const injections = [];
542
+ for (const tool of result.tools) {
543
+ const injectionCode = generateSchemaInjectionCode(
544
+ tool.injectionTarget,
545
+ tool.description,
546
+ tool.properties,
547
+ tool.readOnly
548
+ );
549
+ injections.push(injectionCode);
550
+ }
551
+ if (injections.length === 0) {
552
+ return { code, transformed: false };
553
+ }
554
+ const firstCall = result.registrationCalls.sort((a, b) => a.start - b.start)[0];
555
+ const injectionBlock = "\n// [webmcp-nexus-core] \u6784\u5EFA\u65F6\u6CE8\u5165\u7684 schema \u5143\u6570\u636E\n" + injections.join("\n") + "\n";
556
+ const newCode = code.slice(0, firstCall.start) + injectionBlock + code.slice(firstCall.start);
557
+ return { code: newCode, transformed: true };
558
+ }
559
+ export {
560
+ extractProperties,
561
+ extractToolsFromFile,
562
+ generateSchema,
563
+ generateSchemaInjectionCode,
564
+ mapType,
565
+ mapTypeToSchema,
566
+ resolveWithAlias,
567
+ transformCode
568
+ };
package/package.json ADDED
@@ -0,0 +1,38 @@
1
+ {
2
+ "name": "webmcp-nexus-core",
3
+ "version": "0.1.9",
4
+ "description": "Core logic for WebMCP build plugins - TypeScript type extraction and JSON Schema generation",
5
+ "type": "module",
6
+ "main": "./dist/index.cjs",
7
+ "module": "./dist/index.js",
8
+ "types": "./dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "import": {
12
+ "types": "./dist/index.d.ts",
13
+ "default": "./dist/index.js"
14
+ },
15
+ "require": {
16
+ "types": "./dist/index.d.cts",
17
+ "default": "./dist/index.cjs"
18
+ }
19
+ }
20
+ },
21
+ "files": [
22
+ "dist"
23
+ ],
24
+ "dependencies": {
25
+ "ts-morph": "^28.0.0"
26
+ },
27
+ "devDependencies": {
28
+ "@types/node": "^24.12.2",
29
+ "tsup": "^8.5.0",
30
+ "vitest": "^3.1.3"
31
+ },
32
+ "scripts": {
33
+ "build": "tsup",
34
+ "dev": "tsup --watch",
35
+ "test": "vitest run",
36
+ "test:watch": "vitest"
37
+ }
38
+ }