fix: support cjs
This commit is contained in:
parent
0509dabb80
commit
7d274d3f8e
5 changed files with 120 additions and 1614 deletions
1484
package-lock.json
generated
1484
package-lock.json
generated
File diff suppressed because it is too large
Load diff
11
package.json
11
package.json
|
|
@ -6,6 +6,7 @@
|
|||
"author": "Anthropic, PBC (https://anthropic.com)",
|
||||
"homepage": "https://modelcontextprotocol.io",
|
||||
"bugs": "https://github.com/modelcontextprotocol/typescript-sdk/issues",
|
||||
"type": "module",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/modelcontextprotocol/typescript-sdk.git"
|
||||
|
|
@ -26,8 +27,7 @@
|
|||
"typesVersions": {
|
||||
"*": {
|
||||
"*": [
|
||||
"./dist/esm/*",
|
||||
"./dist/cjs/*"
|
||||
"./dist/esm/*"
|
||||
]
|
||||
}
|
||||
},
|
||||
|
|
@ -35,8 +35,10 @@
|
|||
"dist"
|
||||
],
|
||||
"scripts": {
|
||||
"build": "tsup",
|
||||
"prepack": "tsup",
|
||||
"build": "npm run build:esm && npm run build:cjs",
|
||||
"build:esm": "tsc -p tsconfig.prod.json && echo '{\"type\": \"module\"}' > dist/esm/package.json",
|
||||
"build:cjs": "tsc -p tsconfig.cjs.json && echo '{\"type\": \"commonjs\"}' > dist/cjs/package.json",
|
||||
"prepack": "npm run build:esm && npm run build:cjs",
|
||||
"lint": "eslint src/",
|
||||
"test": "jest",
|
||||
"start": "npm run server",
|
||||
|
|
@ -49,7 +51,6 @@
|
|||
"zod": "^3.23.8"
|
||||
},
|
||||
"devDependencies": {
|
||||
"tsup": "^8.3.5",
|
||||
"@eslint/js": "^9.8.0",
|
||||
"@types/content-type": "^1.1.8",
|
||||
"@types/eslint__js": "^8.42.3",
|
||||
|
|
|
|||
9
tsconfig.cjs.json
Normal file
9
tsconfig.cjs.json
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
{
|
||||
"extends": "./tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"moduleResolution": "node",
|
||||
"outDir": "./dist/cjs"
|
||||
},
|
||||
"exclude": ["**/*.test.ts"]
|
||||
}
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
{
|
||||
"extends": "./tsconfig.json",
|
||||
"exclude": [
|
||||
"**/*.test.ts",
|
||||
]
|
||||
"compilerOptions": {
|
||||
"outDir": "./dist/esm"
|
||||
},
|
||||
"exclude": ["**/*.test.ts"]
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,25 +0,0 @@
|
|||
import { defineConfig, Options } from "tsup";
|
||||
|
||||
const commonConfig: Options = {
|
||||
clean: true,
|
||||
dts: true,
|
||||
splitting: false,
|
||||
tsconfig: "tsconfig.prod.json",
|
||||
};
|
||||
|
||||
export default defineConfig([
|
||||
{
|
||||
...commonConfig,
|
||||
entry: ["src/**/*"],
|
||||
bundle: false,
|
||||
outDir: "dist/cjs",
|
||||
format: ["cjs"],
|
||||
},
|
||||
{
|
||||
...commonConfig,
|
||||
entry: ["src/**/*"],
|
||||
bundle: false,
|
||||
outDir: "dist/esm",
|
||||
format: ["esm"],
|
||||
},
|
||||
]);
|
||||
Loading…
Reference in a new issue