Skip to content

Commit db9ceca

Browse files
fix(api): improve type resolution when importing as a package (#37)
1 parent f2f08fa commit db9ceca

File tree

4 files changed

+8
-27
lines changed

4 files changed

+8
-27
lines changed

packages/mcp-server/build

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,7 @@ node scripts/postprocess-dist-package-json.cjs
2424

2525
# build to .js/.mjs/.d.ts files
2626
npm exec tsc-multi
27-
# we need to add exports = module.exports = Anthropic TypeScript to index.js;
28-
# No way to get that from index.ts because it would cause compile errors
29-
# when building .mjs
30-
DIST_PATH=./dist node ../../scripts/utils/fix-index-exports.cjs
31-
32-
# with "moduleResolution": "nodenext", if ESM resolves to index.d.ts,
33-
# it'll have TS errors on the default import. But if it resolves to
34-
# index.d.mts the default import will work (even though both files have
35-
# the same export default statement)
36-
cp dist/index.d.ts dist/index.d.mts
27+
3728
cp tsconfig.dist-src.json dist/src/tsconfig.json
3829

3930
# Add proper Node.js shebang to the top of the file

packages/mcp-server/package.json

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
"ts-jest": "^29.1.0",
4242
"ts-morph": "^19.0.0",
4343
"ts-node": "^10.5.0",
44-
"tsc-multi": "^1.1.0",
44+
"tsc-multi": "https://github.com/stainless-api/tsc-multi/releases/download/v1.1.3/tsc-multi.tgz",
4545
"tsconfig-paths": "^4.0.0",
4646
"typescript": "^4.8.2"
4747
},
@@ -51,23 +51,12 @@
5151
},
5252
"exports": {
5353
".": {
54-
"require": {
55-
"types": "./dist/index.d.ts",
56-
"default": "./dist/index.js"
57-
},
58-
"types": "./dist/index.d.mts",
54+
"require": "./dist/index.js",
5955
"default": "./dist/index.mjs"
6056
},
61-
"./*.mjs": {
62-
"types": "./dist/*.d.ts",
63-
"default": "./dist/*.mjs"
64-
},
65-
"./*.js": {
66-
"types": "./dist/*.d.ts",
67-
"default": "./dist/*.js"
68-
},
57+
"./*.mjs": "./dist/*.mjs",
58+
"./*.js": "./dist/*.js",
6959
"./*": {
70-
"types": "./dist/*.d.ts",
7160
"require": "./dist/*.js",
7261
"default": "./dist/*.mjs"
7362
}

packages/mcp-server/src/tools.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from './tools/index';

packages/mcp-server/tsconfig.build.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
"compilerOptions": {
66
"rootDir": "./dist/src",
77
"paths": {
8-
"isaacus-mcp/*": ["src/*"],
9-
"isaacus-mcp": ["src/index.ts"]
8+
"isaacus-mcp/*": ["dist/src/*"],
9+
"isaacus-mcp": ["dist/src/index.ts"]
1010
},
1111
"noEmit": false,
1212
"declaration": true,

0 commit comments

Comments
 (0)