diff --git a/.changelogrc.cjs b/.changelogrc.js similarity index 100% rename from .changelogrc.cjs rename to .changelogrc.js diff --git a/.commitlintrc.cjs b/.commitlintrc.js similarity index 100% rename from .commitlintrc.cjs rename to .commitlintrc.js diff --git a/.dumirc.ts b/.dumirc.ts index ad750be..ca68669 100644 --- a/.dumirc.ts +++ b/.dumirc.ts @@ -61,6 +61,7 @@ const themeConfig: SiteThemeConfig = { export default defineConfig({ alias: { '@lobehub/tts/react': path.join(__dirname, './src/react'), + '@lobehub/tts/server': path.join(__dirname, './src/server'), }, apiParser: isProduction ? {} : false, base: '/', diff --git a/.eslintrc.cjs b/.eslintrc.js similarity index 100% rename from .eslintrc.cjs rename to .eslintrc.js diff --git a/.fatherrc.ts b/.fatherrc.ts index 4dd0f8f..8ee4f1b 100644 --- a/.fatherrc.ts +++ b/.fatherrc.ts @@ -1,18 +1,5 @@ import { defineConfig } from 'father'; export default defineConfig({ - esm: { - output: 'dist', - overrides: { - 'src/core': { - output: 'core', - }, - 'src/react': { - output: 'react', - }, - 'src/server': { - output: 'server', - }, - }, - }, + esm: { output: 'es' }, }); diff --git a/.gitignore b/.gitignore index 5f4d875..c37a580 100644 --- a/.gitignore +++ b/.gitignore @@ -57,5 +57,6 @@ public/*.js bun.lockb react/** server/** - core/** +react.d.ts +server.d.ts diff --git a/.i18nrc.cjs b/.i18nrc.js similarity index 100% rename from .i18nrc.cjs rename to .i18nrc.js diff --git a/.prettierrc.cjs b/.prettierrc.js similarity index 100% rename from .prettierrc.cjs rename to .prettierrc.js diff --git a/.releaserc.cjs b/.releaserc.js similarity index 100% rename from .releaserc.cjs rename to .releaserc.js diff --git a/.remarkrc.cjs b/.remarkrc.js similarity index 100% rename from .remarkrc.cjs rename to .remarkrc.js diff --git a/.stylelintrc.cjs b/.stylelintrc.js similarity index 100% rename from .stylelintrc.cjs rename to .stylelintrc.js diff --git a/package.json b/package.json index 1dc01a0..c425449 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@lobehub/tts", - "version": "1.25.7", + "version": "beta", "description": "A high-quality & reliable TTS React Hooks library", "homepage": "https://github.com/lobehub/lobe-tts", "bugs": { @@ -13,36 +13,18 @@ "license": "MIT", "author": "LobeHub ", "sideEffects": false, - "type": "module", - "exports": { - "./package.json": "./package.json", - ".": { - "types": "./core/index.d.ts", - "import": "./core/index.js", - "module": "./core/index.js" - }, - "./server": { - "types": "./server/index.d.ts", - "import": "./server/index.js", - "module": "./server/index.js" - }, - "./react": { - "types": "./react/index.d.ts", - "import": "./react/index.js", - "module": "./react/index.js" - } - }, - "main": "./core/index.js", - "module": "./core/index.js", - "types": "./core/index.d.ts", + "main": "es/index.js", + "module": "es/index.js", + "types": "es/index.d.ts", "files": [ - "dist", - "core", - "react", - "server" + "es", + "server.d.ts", + "server.js", + "react.d.ts", + "react.js" ], "scripts": { - "build": "father build", + "build": "father build && cp react.js react.d.ts && cp server.js server.d.ts", "ci": "npm run lint && npm run type-check && npm run doctor", "dev": "father dev", "docs:build": "npm run build && dumi build", @@ -83,11 +65,6 @@ "eslint --fix" ] }, - "browserslist": [ - "> 1%", - "last 2 versions", - "not ie <= 10" - ], "dependencies": { "@babel/runtime": "^7.26.0", "lodash-es": "^4.17.21", @@ -105,18 +82,18 @@ "@commitlint/cli": "^19.6.0", "@lobehub/i18n-cli": "^1.20.0", "@lobehub/lint": "^1.24.4", - "@lobehub/ui": "^1.153.1", "@types/lodash-es": "^4.17.12", "@types/node": "^20.17.7", - "@types/react": "^18.3.12", + "@types/react": "18.2.40", "@types/react-dom": "^18.3.1", "@types/uuid": "^9.0.8", "@vercel/node": "^3.2.26", + "@vitest/coverage-v8": "~1.2.2", "babel-plugin-antd-style": "^1.0.4", "commitlint": "^19.6.0", "concurrently": "^9.1.0", "dumi": "^2.4.14", - "dumi-theme-lobehub": "^1.10.4", + "dumi-theme-lobehub": "^1.10.6", "eslint": "^8.57.1", "father": "^4.5.1", "husky": "^9.1.7", @@ -128,7 +105,8 @@ "stylelint": "^15.11.0", "tsx": "^4.19.2", "typescript": "^5.7.2", - "vercel": "^28.20.0" + "vercel": "^28.20.0", + "vitest": "~1.2.2" }, "peerDependencies": { "@lobehub/ui": ">=1", diff --git a/react.js b/react.js new file mode 100644 index 0000000..78a52fe --- /dev/null +++ b/react.js @@ -0,0 +1 @@ +export * from './es/react'; diff --git a/server.js b/server.js new file mode 100644 index 0000000..44d1aab --- /dev/null +++ b/server.js @@ -0,0 +1 @@ +export * from './es/server'; diff --git a/tsconfig.json b/tsconfig.json index 835cd1c..ad0929c 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -6,15 +6,24 @@ "esModuleInterop": true, "jsx": "react-jsx", "lib": ["dom", "dom.iterable", "esnext"], - "resolveJsonModule": true, - "skipLibCheck": true, - "strict": true, + "module": "esnext", + "moduleResolution": "node", "paths": { "@@/*": [".dumi/tmp/*"], "@/*": ["./src/*"], - "@lobehub/tts": ["./src/core"], - "@lobehub/tts/react": ["./src/react"] - } + "@lobehub/tts": ["./src"], + "@lobehub/tts/*": ["src/*"], + "@lobehub/tts/react": ["./src/react"], + "@lobehub/tts/react/*": ["./src/react/*"], + "@lobehub/tts/server": ["./src/server"], + "@lobehub/tts/server/*": ["./src/server/*"] + }, + "resolveJsonModule": true, + "skipLibCheck": true, + "strict": true, + "target": "es6", + "types": ["vitest/globals"] }, + "exclude": ["./react.d.ts", "./server.d.ts"], "include": ["src", "docs", ".dumirc.ts", "api", "**/*.ts", "**/*.d.ts", "**/*.tsx"] }