From d143012b0962f68a5e1bfa2868984e6cdd7c2a1e Mon Sep 17 00:00:00 2001 From: Anthony Fu Date: Fri, 11 Mar 2022 19:47:14 +0800 Subject: [PATCH] chore: update build --- esbuild.d.ts | 2 -- index.d.ts | 2 -- nuxt.d.ts | 2 -- package.json | 15 +++++++++++---- resolvers.d.ts | 2 -- rollup.d.ts | 2 -- scripts/postbuild.ts | 1 - tsconfig.json | 6 +++--- tsup.config.ts | 4 ++++ types.d.ts | 2 -- vite.d.ts | 2 -- webpack.d.ts | 2 -- 12 files changed, 18 insertions(+), 24 deletions(-) delete mode 100644 esbuild.d.ts delete mode 100644 index.d.ts delete mode 100644 nuxt.d.ts delete mode 100644 resolvers.d.ts delete mode 100644 rollup.d.ts delete mode 100644 types.d.ts delete mode 100644 vite.d.ts delete mode 100644 webpack.d.ts diff --git a/esbuild.d.ts b/esbuild.d.ts deleted file mode 100644 index 55cb0e07..00000000 --- a/esbuild.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './dist/esbuild' -export { default } from './dist/esbuild' diff --git a/index.d.ts b/index.d.ts deleted file mode 100644 index f9b53da7..00000000 --- a/index.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './dist/index' -export { default } from './dist/index' diff --git a/nuxt.d.ts b/nuxt.d.ts deleted file mode 100644 index 6d1ce314..00000000 --- a/nuxt.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './dist/nuxt' -export { default } from './dist/nuxt' diff --git a/package.json b/package.json index 063504d1..ea279d43 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,7 @@ "funding": "https://github.com/sponsors/antfu", "main": "dist/index.js", "module": "dist/index.mjs", - "types": "index.d.ts", + "types": "dist/index.d.ts", "exports": { ".": { "require": "./dist/index.js", @@ -53,14 +53,21 @@ "dist", "*.d.ts" ], + "typesVersions": { + "*": { + "*": [ + "./dist/*" + ] + } + }, "scripts": { - "build": "tsup src/*.ts && esno scripts/postbuild.ts", - "dev": "tsup src/*.ts --watch src", + "build": "tsup && esno scripts/postbuild.ts", + "dev": "tsup --watch src", "example:build": "npm -C examples/vite-vue3 run build", "example:dev": "npm -C examples/vite-vue3 run dev", "prepublishOnly": "npm run build", "lint": "eslint .", - "release": "npx bumpp --commit --tag --push", + "release": "bumpp --commit --tag --push", "test": "vitest", "test:update": "vitest --u" }, diff --git a/resolvers.d.ts b/resolvers.d.ts deleted file mode 100644 index f0fd20f1..00000000 --- a/resolvers.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './dist/resolvers' -export { default } from './dist/resolvers' diff --git a/rollup.d.ts b/rollup.d.ts deleted file mode 100644 index f044ab8e..00000000 --- a/rollup.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './dist/rollup' -export { default } from './dist/rollup' diff --git a/scripts/postbuild.ts b/scripts/postbuild.ts index 6fd948b8..750e756d 100644 --- a/scripts/postbuild.ts +++ b/scripts/postbuild.ts @@ -17,7 +17,6 @@ async function run() { code = code.replace('exports.default =', 'module.exports =') code += 'exports.default = module.exports;' await fs.writeFile(file, code) - await fs.writeFile(`${name}.d.ts`, `export * from './dist/${name}'\nexport { default } from './dist/${name}'\n`) } } diff --git a/tsconfig.json b/tsconfig.json index c973a274..0e105b88 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,12 +1,12 @@ { "compilerOptions": { + "target": "es2017", "module": "esnext", - "target": "es2019", - "lib": ["esnext", "DOM"], + "lib": ["esnext"], + "moduleResolution": "node", "esModuleInterop": true, "strict": true, "strictNullChecks": true, - "moduleResolution": "node", "resolveJsonModule": true } } diff --git a/tsup.config.ts b/tsup.config.ts index 1f879685..674d9e4d 100644 --- a/tsup.config.ts +++ b/tsup.config.ts @@ -1,8 +1,12 @@ import type { Options } from 'tsup' export const tsup: Options = { + entry: [ + 'src/*.ts', + ], format: ['cjs', 'esm'], dts: true, splitting: true, clean: true, + shims: false, } diff --git a/types.d.ts b/types.d.ts deleted file mode 100644 index ac03eb06..00000000 --- a/types.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './dist/types' -export { default } from './dist/types' diff --git a/vite.d.ts b/vite.d.ts deleted file mode 100644 index a791d26b..00000000 --- a/vite.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './dist/vite' -export { default } from './dist/vite' diff --git a/webpack.d.ts b/webpack.d.ts deleted file mode 100644 index 190a5fe3..00000000 --- a/webpack.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './dist/webpack' -export { default } from './dist/webpack'