refactor(setup): upgrade to TypeScript 6 with source-first monorepo resolution

This commit is contained in:
Simon
2026-04-12 02:04:21 +08:00
parent f68c73c5e9
commit 4d27d49752
35 changed files with 305 additions and 235 deletions

View File

@@ -2,14 +2,24 @@
"name": "@page-agent/llms",
"version": "1.7.1",
"type": "module",
"main": "./dist/lib/page-agent-llms.js",
"module": "./dist/lib/page-agent-llms.js",
"types": "./dist/lib/index.d.ts",
"main": "./src/index.ts",
"types": "./src/index.ts",
"exports": {
".": {
"types": "./dist/lib/index.d.ts",
"import": "./dist/lib/page-agent-llms.js",
"default": "./dist/lib/page-agent-llms.js"
"types": "./src/index.ts",
"default": "./src/index.ts"
}
},
"publishConfig": {
"main": "./dist/lib/page-agent-llms.js",
"module": "./dist/lib/page-agent-llms.js",
"types": "./dist/lib/index.d.ts",
"exports": {
".": {
"types": "./dist/lib/index.d.ts",
"import": "./dist/lib/page-agent-llms.js",
"default": "./dist/lib/page-agent-llms.js"
}
}
},
"files": [
@@ -33,8 +43,8 @@
"homepage": "https://alibaba.github.io/page-agent/",
"scripts": {
"build": "vite build",
"prepublishOnly": "node -e \"const fs=require('fs');['LICENSE'].forEach(f=>fs.copyFileSync('../../'+f,f))\"",
"postpublish": "node -e \"['LICENSE'].forEach(f=>{try{require('fs').unlinkSync(f)}catch{}})\""
"prepublishOnly": "node ../../scripts/prepare-publish.js",
"postpublish": "node ../../scripts/restore-dev.js"
},
"dependencies": {
"chalk": "^5.6.2"

View File

@@ -1,9 +0,0 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
// @workaround DTS bug
// dts do not work with monorepo path mapping
// disable path mapping for it
"paths": {}
}
}

View File

@@ -1,11 +1,7 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.tsbuildinfo",
"noEmit": false,
"allowImportingTsExtensions": false,
"baseUrl": ".",
"outDir": "dist"
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.tsbuildinfo"
},
"include": ["**/*.ts"],
"exclude": ["dist", "node_modules"]

View File

@@ -11,7 +11,17 @@ console.log(chalk.cyan(`📦 Building @page-agent/llms`))
export default defineConfig({
clearScreen: false,
plugins: [dts({ tsconfigPath: './tsconfig.dts.json', bundleTypes: true })],
plugins: [
dts({
bundleTypes: true,
compilerOptions: {
composite: true,
noEmit: false,
emitDeclarationOnly: true,
declaration: true,
},
}),
],
publicDir: false,
esbuild: {
keepNames: true,