From 1c48fccbb844066626f137e57edf7015bc823fe5 Mon Sep 17 00:00:00 2001 From: geylnu Date: Wed, 6 Sep 2023 10:25:47 +0800 Subject: [PATCH 1/2] fix(repo): plugin type definitions not being exported correctly in ES Module --- packages/alias/package.json | 4 +++- packages/auto-install/package.json | 4 +++- packages/babel/package.json | 4 +++- packages/buble/package.json | 4 +++- packages/commonjs/package.json | 4 +++- packages/data-uri/package.json | 4 +++- packages/dsv/package.json | 4 +++- packages/dynamic-import-vars/package.json | 4 +++- packages/eslint/package.json | 4 +++- packages/esm-shim/package.json | 4 +++- packages/graphql/package.json | 4 +++- packages/html/package.json | 4 +++- packages/image/package.json | 4 +++- packages/inject/package.json | 4 +++- packages/json/package.json | 4 +++- packages/legacy/package.json | 4 +++- packages/multi-entry/package.json | 4 +++- packages/node-resolve/package.json | 4 +++- packages/pluginutils/package.json | 4 +++- packages/replace/package.json | 4 +++- packages/run/package.json | 4 +++- packages/strip/package.json | 4 +++- packages/sucrase/package.json | 4 +++- packages/swc/package.json | 4 +++- packages/terser/package.json | 4 +++- packages/typescript/package.json | 4 +++- packages/url/package.json | 4 +++- packages/virtual/package.json | 4 +++- packages/wasm/package.json | 4 +++- packages/yaml/package.json | 4 +++- shared/rollup.config.mjs | 16 +++++++++++++++- 31 files changed, 105 insertions(+), 31 deletions(-) diff --git a/packages/alias/package.json b/packages/alias/package.json index 214031d79..68466d271 100755 --- a/packages/alias/package.json +++ b/packages/alias/package.json @@ -16,7 +16,9 @@ "main": "./dist/cjs/index.js", "module": "./dist/es/index.js", "exports": { - "types": "./types/index.d.ts", + "types": { + "import": "./dist/es/index.d.ts" + }, "import": "./dist/es/index.js", "default": "./dist/cjs/index.js" }, diff --git a/packages/auto-install/package.json b/packages/auto-install/package.json index a5c0fd103..b6fdd9e8c 100755 --- a/packages/auto-install/package.json +++ b/packages/auto-install/package.json @@ -16,7 +16,9 @@ "main": "./dist/cjs/index.js", "module": "./dist/es/index.js", "exports": { - "types": "./types/index.d.ts", + "types": { + "import": "./dist/es/index.d.ts" + }, "import": "./dist/es/index.js", "default": "./dist/cjs/index.js" }, diff --git a/packages/babel/package.json b/packages/babel/package.json index 88e94728e..51ea2dffb 100644 --- a/packages/babel/package.json +++ b/packages/babel/package.json @@ -16,7 +16,9 @@ "main": "./dist/cjs/index.js", "module": "./dist/es/index.js", "exports": { - "types": "./types/index.d.ts", + "types": { + "import": "./dist/es/index.d.ts" + }, "import": "./dist/es/index.js", "default": "./dist/cjs/index.js" }, diff --git a/packages/buble/package.json b/packages/buble/package.json index 7965d3fa2..c2905487d 100644 --- a/packages/buble/package.json +++ b/packages/buble/package.json @@ -16,7 +16,9 @@ "main": "./dist/cjs/index.js", "module": "./dist/es/index.js", "exports": { - "types": "./types/index.d.ts", + "types": { + "import": "./dist/es/index.d.ts" + }, "import": "./dist/es/index.js", "default": "./dist/cjs/index.js" }, diff --git a/packages/commonjs/package.json b/packages/commonjs/package.json index 1cff5476a..39f1d9b3e 100644 --- a/packages/commonjs/package.json +++ b/packages/commonjs/package.json @@ -16,7 +16,9 @@ "main": "./dist/cjs/index.js", "module": "./dist/es/index.js", "exports": { - "types": "./types/index.d.ts", + "types": { + "import": "./dist/es/index.d.ts" + }, "import": "./dist/es/index.js", "default": "./dist/cjs/index.js" }, diff --git a/packages/data-uri/package.json b/packages/data-uri/package.json index 572038398..cefa4ac91 100644 --- a/packages/data-uri/package.json +++ b/packages/data-uri/package.json @@ -16,7 +16,9 @@ "main": "./dist/cjs/index.js", "module": "./dist/es/index.js", "exports": { - "types": "./types/index.d.ts", + "types": { + "import": "./dist/es/index.d.ts" + }, "import": "./dist/es/index.js", "default": "./dist/cjs/index.js" }, diff --git a/packages/dsv/package.json b/packages/dsv/package.json index ea17b8f19..99432ad1c 100755 --- a/packages/dsv/package.json +++ b/packages/dsv/package.json @@ -16,7 +16,9 @@ "main": "./dist/cjs/index.js", "module": "./dist/es/index.js", "exports": { - "types": "./types/index.d.ts", + "types": { + "import": "./dist/es/index.d.ts" + }, "import": "./dist/es/index.js", "default": "./dist/cjs/index.js" }, diff --git a/packages/dynamic-import-vars/package.json b/packages/dynamic-import-vars/package.json index d1ab51a0f..eb557dafe 100644 --- a/packages/dynamic-import-vars/package.json +++ b/packages/dynamic-import-vars/package.json @@ -16,7 +16,9 @@ "main": "./dist/cjs/index.js", "module": "./dist/es/index.js", "exports": { - "types": "./types/index.d.ts", + "types": { + "import": "./dist/es/index.d.ts" + }, "import": "./dist/es/index.js", "default": "./dist/cjs/index.js" }, diff --git a/packages/eslint/package.json b/packages/eslint/package.json index 5faceecc4..52330e13f 100755 --- a/packages/eslint/package.json +++ b/packages/eslint/package.json @@ -16,7 +16,9 @@ "main": "./dist/cjs/index.js", "module": "./dist/es/index.js", "exports": { - "types": "./types/index.d.ts", + "types": { + "import": "./dist/es/index.d.ts" + }, "import": "./dist/es/index.js", "default": "./dist/cjs/index.js" }, diff --git a/packages/esm-shim/package.json b/packages/esm-shim/package.json index 2512fb204..281d6160a 100644 --- a/packages/esm-shim/package.json +++ b/packages/esm-shim/package.json @@ -16,7 +16,9 @@ "main": "dist/cjs/index.js", "module": "dist/es/index.js", "exports": { - "types": "./types/index.d.ts", + "types": { + "import": "./dist/es/index.d.ts" + }, "import": "./dist/es/index.js", "default": "./dist/cjs/index.js" }, diff --git a/packages/graphql/package.json b/packages/graphql/package.json index f4fc4a8d1..059099b77 100644 --- a/packages/graphql/package.json +++ b/packages/graphql/package.json @@ -16,7 +16,9 @@ "main": "./dist/cjs/index.js", "module": "./dist/es/index.js", "exports": { - "types": "./types/index.d.ts", + "types": { + "import": "./dist/es/index.d.ts" + }, "import": "./dist/es/index.js", "default": "./dist/cjs/index.js" }, diff --git a/packages/html/package.json b/packages/html/package.json index 22f094b39..74df83e2d 100644 --- a/packages/html/package.json +++ b/packages/html/package.json @@ -16,7 +16,9 @@ "main": "./dist/cjs/index.js", "module": "./dist/es/index.js", "exports": { - "types": "./types/index.d.ts", + "types": { + "import": "./dist/es/index.d.ts" + }, "import": "./dist/es/index.js", "default": "./dist/cjs/index.js" }, diff --git a/packages/image/package.json b/packages/image/package.json index 9b326366f..c2de4686f 100644 --- a/packages/image/package.json +++ b/packages/image/package.json @@ -16,7 +16,9 @@ "main": "./dist/cjs/index.js", "module": "./dist/es/index.js", "exports": { - "types": "./types/index.d.ts", + "types": { + "import": "./dist/es/index.d.ts" + }, "import": "./dist/es/index.js", "default": "./dist/cjs/index.js" }, diff --git a/packages/inject/package.json b/packages/inject/package.json index 1d73f6198..d3e03b11e 100644 --- a/packages/inject/package.json +++ b/packages/inject/package.json @@ -16,7 +16,9 @@ "main": "./dist/cjs/index.js", "module": "./dist/es/index.js", "exports": { - "types": "./types/index.d.ts", + "types": { + "import": "./dist/es/index.d.ts" + }, "import": "./dist/es/index.js", "default": "./dist/cjs/index.js" }, diff --git a/packages/json/package.json b/packages/json/package.json index 0ff50380c..8bd9d4f38 100755 --- a/packages/json/package.json +++ b/packages/json/package.json @@ -16,7 +16,9 @@ "main": "./dist/cjs/index.js", "module": "./dist/es/index.js", "exports": { - "types": "./types/index.d.ts", + "types": { + "import": "./dist/es/index.d.ts" + }, "import": "./dist/es/index.js", "default": "./dist/cjs/index.js" }, diff --git a/packages/legacy/package.json b/packages/legacy/package.json index 88f61a344..e99de640f 100644 --- a/packages/legacy/package.json +++ b/packages/legacy/package.json @@ -16,7 +16,9 @@ "main": "./dist/cjs/index.js", "module": "./dist/es/index.js", "exports": { - "types": "./types/index.d.ts", + "types": { + "import": "./dist/es/index.d.ts" + }, "import": "./dist/es/index.js", "default": "./dist/cjs/index.js" }, diff --git a/packages/multi-entry/package.json b/packages/multi-entry/package.json index 1d3a7adfe..3b6281bf9 100755 --- a/packages/multi-entry/package.json +++ b/packages/multi-entry/package.json @@ -16,7 +16,9 @@ "main": "./dist/cjs/index.js", "module": "./dist/es/index.js", "exports": { - "types": "./types/index.d.ts", + "types": { + "import": "./dist/es/index.d.ts" + }, "import": "./dist/es/index.js", "default": "./dist/cjs/index.js" }, diff --git a/packages/node-resolve/package.json b/packages/node-resolve/package.json index 02a51b094..f6c94e867 100644 --- a/packages/node-resolve/package.json +++ b/packages/node-resolve/package.json @@ -16,7 +16,9 @@ "main": "./dist/cjs/index.js", "module": "./dist/es/index.js", "exports": { - "types": "./types/index.d.ts", + "types": { + "import": "./dist/es/index.d.ts" + }, "import": "./dist/es/index.js", "default": "./dist/cjs/index.js" }, diff --git a/packages/pluginutils/package.json b/packages/pluginutils/package.json index f149e9d4c..d03dda58a 100644 --- a/packages/pluginutils/package.json +++ b/packages/pluginutils/package.json @@ -19,7 +19,9 @@ "module": "./dist/es/index.js", "type": "commonjs", "exports": { - "types": "./types/index.d.ts", + "types": { + "import": "./dist/es/index.d.ts" + }, "import": "./dist/es/index.js", "default": "./dist/cjs/index.js" }, diff --git a/packages/replace/package.json b/packages/replace/package.json index 8d46239f6..8bc3c8735 100644 --- a/packages/replace/package.json +++ b/packages/replace/package.json @@ -16,7 +16,9 @@ "main": "dist/cjs/index.js", "module": "dist/es/index.js", "exports": { - "types": "./types/index.d.ts", + "types": { + "import": "./dist/es/index.d.ts" + }, "import": "./dist/es/index.js", "default": "./dist/cjs/index.js" }, diff --git a/packages/run/package.json b/packages/run/package.json index 5235b03bc..517dae9fc 100644 --- a/packages/run/package.json +++ b/packages/run/package.json @@ -16,7 +16,9 @@ "main": "./dist/cjs/index.js", "module": "./dist/es/index.js", "exports": { - "types": "./types/index.d.ts", + "types": { + "import": "./dist/es/index.d.ts" + }, "import": "./dist/es/index.js", "default": "./dist/cjs/index.js" }, diff --git a/packages/strip/package.json b/packages/strip/package.json index a769da1a2..a5eafb908 100644 --- a/packages/strip/package.json +++ b/packages/strip/package.json @@ -16,7 +16,9 @@ "main": "./dist/cjs/index.js", "module": "./dist/es/index.js", "exports": { - "types": "./types/index.d.ts", + "types": { + "import": "./dist/es/index.d.ts" + }, "import": "./dist/es/index.js", "default": "./dist/cjs/index.js" }, diff --git a/packages/sucrase/package.json b/packages/sucrase/package.json index db07e0acd..c55bdee1c 100644 --- a/packages/sucrase/package.json +++ b/packages/sucrase/package.json @@ -17,7 +17,9 @@ "module": "./dist/es/index.js", "type": "commonjs", "exports": { - "types": "./types/index.d.ts", + "types": { + "import": "./dist/es/index.d.ts" + }, "import": "./dist/es/index.js", "default": "./dist/cjs/index.js" }, diff --git a/packages/swc/package.json b/packages/swc/package.json index 2d4078bfb..6b28bc5ff 100644 --- a/packages/swc/package.json +++ b/packages/swc/package.json @@ -16,7 +16,9 @@ "main": "dist/cjs/index.js", "module": "dist/es/index.js", "exports": { - "types": "./types/index.d.ts", + "types": { + "import": "./dist/es/index.d.ts" + }, "import": "./dist/es/index.js", "default": "./dist/cjs/index.js" }, diff --git a/packages/terser/package.json b/packages/terser/package.json index b241c2bf5..34de42268 100644 --- a/packages/terser/package.json +++ b/packages/terser/package.json @@ -16,7 +16,9 @@ "main": "dist/cjs/index.js", "module": "dist/es/index.js", "exports": { - "types": "./types/index.d.ts", + "types": { + "import": "./dist/es/index.d.ts" + }, "import": "./dist/es/index.js", "default": "./dist/cjs/index.js" }, diff --git a/packages/typescript/package.json b/packages/typescript/package.json index 484a396f3..8f8d30135 100644 --- a/packages/typescript/package.json +++ b/packages/typescript/package.json @@ -16,7 +16,9 @@ "main": "./dist/cjs/index.js", "module": "./dist/es/index.js", "exports": { - "types": "./types/index.d.ts", + "types": { + "import": "./dist/es/index.d.ts" + }, "import": "./dist/es/index.js", "default": "./dist/cjs/index.js" }, diff --git a/packages/url/package.json b/packages/url/package.json index 9ea52608d..9654c780c 100644 --- a/packages/url/package.json +++ b/packages/url/package.json @@ -16,7 +16,9 @@ "main": "./dist/cjs/index.js", "module": "./dist/es/index.js", "exports": { - "types": "./types/index.d.ts", + "types": { + "import": "./dist/es/index.d.ts" + }, "import": "./dist/es/index.js", "default": "./dist/cjs/index.js" }, diff --git a/packages/virtual/package.json b/packages/virtual/package.json index 07e622c02..3e63572fe 100755 --- a/packages/virtual/package.json +++ b/packages/virtual/package.json @@ -16,7 +16,9 @@ "main": "./dist/cjs/index.js", "module": "./dist/es/index.js", "exports": { - "types": "./types/index.d.ts", + "types": { + "import": "./dist/es/index.d.ts" + }, "import": "./dist/es/index.js", "default": "./dist/cjs/index.js" }, diff --git a/packages/wasm/package.json b/packages/wasm/package.json index 9ecd8a831..dce50cd39 100644 --- a/packages/wasm/package.json +++ b/packages/wasm/package.json @@ -16,7 +16,9 @@ "main": "./dist/cjs/index.js", "module": "./dist/es/index.js", "exports": { - "types": "./types/index.d.ts", + "types": { + "import": "./dist/es/index.d.ts" + }, "import": "./dist/es/index.js", "default": "./dist/cjs/index.js" }, diff --git a/packages/yaml/package.json b/packages/yaml/package.json index e4d6e2dbc..41ae31f5d 100755 --- a/packages/yaml/package.json +++ b/packages/yaml/package.json @@ -16,7 +16,9 @@ "main": "./dist/cjs/index.js", "module": "./dist/es/index.js", "exports": { - "types": "./types/index.d.ts", + "types": { + "import": "./dist/es/index.d.ts" + }, "import": "./dist/es/index.js", "default": "./dist/cjs/index.js" }, diff --git a/shared/rollup.config.mjs b/shared/rollup.config.mjs index 377390a95..817f166c5 100644 --- a/shared/rollup.config.mjs +++ b/shared/rollup.config.mjs @@ -1,4 +1,5 @@ import { builtinModules } from 'module'; +import { promises as fs } from 'fs'; // eslint-disable-next-line import/no-extraneous-dependencies import typescript from '@rollup/plugin-typescript'; @@ -31,7 +32,7 @@ export function createConfig({ pkg, external = [] }) { { format: 'es', file: pkg.module, - plugins: [emitModulePackageFile()], + plugins: [emitModulePackageFile(), emitDeclarationFile()], sourcemap: true } ], @@ -51,3 +52,16 @@ export function emitModulePackageFile() { } }; } + +export function emitDeclarationFile() { + return { + name: 'emit-declaration-file', + async generateBundle() { + this.emitFile({ + type: 'asset', + fileName: 'index.d.ts', + source: await fs.readFile('./types/index.d.ts') + }); + } + }; +} From 1b5ab9316c77c16c02b1b558ef0d7e990a71b272 Mon Sep 17 00:00:00 2001 From: geylnu Date: Thu, 7 Sep 2023 10:50:00 +0800 Subject: [PATCH 2/2] refactor(repo): modify the declaration file to be a self-contained --- packages/alias/package.json | 4 ---- packages/auto-install/package.json | 4 ---- packages/babel/package.json | 4 ---- packages/buble/package.json | 4 ---- packages/commonjs/package.json | 4 ---- packages/data-uri/package.json | 4 ---- packages/dsv/package.json | 4 ---- packages/dynamic-import-vars/package.json | 4 ---- packages/eslint/package.json | 4 ---- packages/esm-shim/package.json | 6 +----- packages/graphql/package.json | 4 ---- packages/html/package.json | 4 ---- packages/image/package.json | 4 ---- packages/inject/package.json | 4 ---- packages/json/package.json | 4 ---- packages/legacy/package.json | 4 ---- packages/multi-entry/package.json | 4 ---- packages/node-resolve/package.json | 4 ---- packages/pluginutils/package.json | 4 ---- packages/replace/package.json | 4 ---- packages/run/package.json | 4 ---- packages/strip/package.json | 4 ---- packages/sucrase/package.json | 4 ---- packages/swc/package.json | 6 +----- packages/terser/package.json | 6 +----- packages/typescript/package.json | 6 +----- packages/url/package.json | 4 ---- packages/virtual/package.json | 4 ---- packages/wasm/package.json | 4 ---- packages/yaml/package.json | 4 ---- shared/rollup.config.mjs | 1 + 31 files changed, 5 insertions(+), 124 deletions(-) diff --git a/packages/alias/package.json b/packages/alias/package.json index 68466d271..ae3884e44 100755 --- a/packages/alias/package.json +++ b/packages/alias/package.json @@ -16,9 +16,6 @@ "main": "./dist/cjs/index.js", "module": "./dist/es/index.js", "exports": { - "types": { - "import": "./dist/es/index.d.ts" - }, "import": "./dist/es/index.js", "default": "./dist/cjs/index.js" }, @@ -70,7 +67,6 @@ "rollup": "^3.2.3", "typescript": "^4.8.3" }, - "types": "./types/index.d.ts", "ava": { "files": [ "!**/fixtures/**", diff --git a/packages/auto-install/package.json b/packages/auto-install/package.json index b6fdd9e8c..5408df3bb 100755 --- a/packages/auto-install/package.json +++ b/packages/auto-install/package.json @@ -16,9 +16,6 @@ "main": "./dist/cjs/index.js", "module": "./dist/es/index.js", "exports": { - "types": { - "import": "./dist/es/index.d.ts" - }, "import": "./dist/es/index.js", "default": "./dist/cjs/index.js" }, @@ -70,7 +67,6 @@ "rollup": "^3.2.3", "typescript": "^4.8.3" }, - "types": "./types/index.d.ts", "ava": { "workerThreads": false, "files": [ diff --git a/packages/babel/package.json b/packages/babel/package.json index 51ea2dffb..bef8a9ca5 100644 --- a/packages/babel/package.json +++ b/packages/babel/package.json @@ -16,9 +16,6 @@ "main": "./dist/cjs/index.js", "module": "./dist/es/index.js", "exports": { - "types": { - "import": "./dist/es/index.d.ts" - }, "import": "./dist/es/index.js", "default": "./dist/cjs/index.js" }, @@ -84,7 +81,6 @@ "rollup": "^3.2.3", "source-map": "^0.7.4" }, - "types": "./types/index.d.ts", "ava": { "files": [ "!**/fixtures/**", diff --git a/packages/buble/package.json b/packages/buble/package.json index c2905487d..51ded8919 100644 --- a/packages/buble/package.json +++ b/packages/buble/package.json @@ -16,9 +16,6 @@ "main": "./dist/cjs/index.js", "module": "./dist/es/index.js", "exports": { - "types": { - "import": "./dist/es/index.d.ts" - }, "import": "./dist/es/index.js", "default": "./dist/cjs/index.js" }, @@ -74,7 +71,6 @@ "source-map": "^0.7.4", "typescript": "^4.8.3" }, - "types": "./types/index.d.ts", "ava": { "workerThreads": false, "files": [ diff --git a/packages/commonjs/package.json b/packages/commonjs/package.json index 39f1d9b3e..74941ad0f 100644 --- a/packages/commonjs/package.json +++ b/packages/commonjs/package.json @@ -16,9 +16,6 @@ "main": "./dist/cjs/index.js", "module": "./dist/es/index.js", "exports": { - "types": { - "import": "./dist/es/index.d.ts" - }, "import": "./dist/es/index.js", "default": "./dist/cjs/index.js" }, @@ -82,7 +79,6 @@ "source-map-support": "^0.5.21", "typescript": "^4.8.3" }, - "types": "./types/index.d.ts", "ava": { "workerThreads": false, "files": [ diff --git a/packages/data-uri/package.json b/packages/data-uri/package.json index cefa4ac91..915733449 100644 --- a/packages/data-uri/package.json +++ b/packages/data-uri/package.json @@ -16,9 +16,6 @@ "main": "./dist/cjs/index.js", "module": "./dist/es/index.js", "exports": { - "types": { - "import": "./dist/es/index.d.ts" - }, "import": "./dist/es/index.js", "default": "./dist/cjs/index.js" }, @@ -71,7 +68,6 @@ "rollup": "^3.2.3", "typescript": "^4.8.3" }, - "types": "./types/index.d.ts", "ava": { "workerThreads": false, "files": [ diff --git a/packages/dsv/package.json b/packages/dsv/package.json index 99432ad1c..ba9572950 100755 --- a/packages/dsv/package.json +++ b/packages/dsv/package.json @@ -16,9 +16,6 @@ "main": "./dist/cjs/index.js", "module": "./dist/es/index.js", "exports": { - "types": { - "import": "./dist/es/index.d.ts" - }, "import": "./dist/es/index.js", "default": "./dist/cjs/index.js" }, @@ -60,7 +57,6 @@ "del-cli": "^5.0.0", "rollup": "^3.2.3" }, - "types": "./types/index.d.ts", "ava": { "workerThreads": false, "files": [ diff --git a/packages/dynamic-import-vars/package.json b/packages/dynamic-import-vars/package.json index eb557dafe..e0033dd25 100644 --- a/packages/dynamic-import-vars/package.json +++ b/packages/dynamic-import-vars/package.json @@ -16,9 +16,6 @@ "main": "./dist/cjs/index.js", "module": "./dist/es/index.js", "exports": { - "types": { - "import": "./dist/es/index.d.ts" - }, "import": "./dist/es/index.js", "default": "./dist/cjs/index.js" }, @@ -76,7 +73,6 @@ "prettier": "^2.7.1", "rollup": "^3.2.3" }, - "types": "./types/index.d.ts", "ava": { "workerThreads": false, "files": [ diff --git a/packages/eslint/package.json b/packages/eslint/package.json index 52330e13f..3777eb866 100755 --- a/packages/eslint/package.json +++ b/packages/eslint/package.json @@ -16,9 +16,6 @@ "main": "./dist/cjs/index.js", "module": "./dist/es/index.js", "exports": { - "types": { - "import": "./dist/es/index.d.ts" - }, "import": "./dist/es/index.js", "default": "./dist/cjs/index.js" }, @@ -74,7 +71,6 @@ "rollup": "^3.2.3", "typescript": "^4.8.3" }, - "types": "./types/index.d.ts", "ava": { "files": [ "!**/fixtures/**", diff --git a/packages/esm-shim/package.json b/packages/esm-shim/package.json index 281d6160a..e5f5aa03e 100644 --- a/packages/esm-shim/package.json +++ b/packages/esm-shim/package.json @@ -16,9 +16,6 @@ "main": "dist/cjs/index.js", "module": "dist/es/index.js", "exports": { - "types": { - "import": "./dist/es/index.d.ts" - }, "import": "./dist/es/index.js", "default": "./dist/cjs/index.js" }, @@ -67,6 +64,5 @@ "devDependencies": { "rollup": "^3.0.0-7", "typescript": "^4.8.3" - }, - "types": "./types/index.d.ts" + } } diff --git a/packages/graphql/package.json b/packages/graphql/package.json index 059099b77..21b7f0de3 100644 --- a/packages/graphql/package.json +++ b/packages/graphql/package.json @@ -16,9 +16,6 @@ "main": "./dist/cjs/index.js", "module": "./dist/es/index.js", "exports": { - "types": { - "import": "./dist/es/index.d.ts" - }, "import": "./dist/es/index.js", "default": "./dist/cjs/index.js" }, @@ -73,7 +70,6 @@ "graphql": "^16.6.0", "rollup": "^3.2.3" }, - "types": "./types/index.d.ts", "ava": { "workerThreads": false, "files": [ diff --git a/packages/html/package.json b/packages/html/package.json index 74df83e2d..50e7c8458 100644 --- a/packages/html/package.json +++ b/packages/html/package.json @@ -16,9 +16,6 @@ "main": "./dist/cjs/index.js", "module": "./dist/es/index.js", "exports": { - "types": { - "import": "./dist/es/index.d.ts" - }, "import": "./dist/es/index.js", "default": "./dist/cjs/index.js" }, @@ -67,7 +64,6 @@ "rollup-plugin-postcss": "^4.0.2", "typescript": "^4.8.3" }, - "types": "./types/index.d.ts", "ava": { "workerThreads": false, "files": [ diff --git a/packages/image/package.json b/packages/image/package.json index c2de4686f..e913c7d81 100644 --- a/packages/image/package.json +++ b/packages/image/package.json @@ -16,9 +16,6 @@ "main": "./dist/cjs/index.js", "module": "./dist/es/index.js", "exports": { - "types": { - "import": "./dist/es/index.d.ts" - }, "import": "./dist/es/index.js", "default": "./dist/cjs/index.js" }, @@ -67,7 +64,6 @@ "@rollup/plugin-buble": "^1.0.0", "rollup": "^3.2.3" }, - "types": "./types/index.d.ts", "ava": { "workerThreads": false, "files": [ diff --git a/packages/inject/package.json b/packages/inject/package.json index d3e03b11e..f75767a56 100644 --- a/packages/inject/package.json +++ b/packages/inject/package.json @@ -16,9 +16,6 @@ "main": "./dist/cjs/index.js", "module": "./dist/es/index.js", "exports": { - "types": { - "import": "./dist/es/index.d.ts" - }, "import": "./dist/es/index.js", "default": "./dist/cjs/index.js" }, @@ -75,7 +72,6 @@ "source-map": "^0.7.4", "typescript": "^4.8.3" }, - "types": "./types/index.d.ts", "ava": { "files": [ "!**/fixtures/**", diff --git a/packages/json/package.json b/packages/json/package.json index 8bd9d4f38..04de86e6c 100755 --- a/packages/json/package.json +++ b/packages/json/package.json @@ -16,9 +16,6 @@ "main": "./dist/cjs/index.js", "module": "./dist/es/index.js", "exports": { - "types": { - "import": "./dist/es/index.d.ts" - }, "import": "./dist/es/index.js", "default": "./dist/cjs/index.js" }, @@ -71,7 +68,6 @@ "rollup": "^3.2.3", "source-map-support": "^0.5.21" }, - "types": "./types/index.d.ts", "ava": { "workerThreads": false, "files": [ diff --git a/packages/legacy/package.json b/packages/legacy/package.json index e99de640f..592d4b4da 100644 --- a/packages/legacy/package.json +++ b/packages/legacy/package.json @@ -16,9 +16,6 @@ "main": "./dist/cjs/index.js", "module": "./dist/es/index.js", "exports": { - "types": { - "import": "./dist/es/index.d.ts" - }, "import": "./dist/es/index.js", "default": "./dist/cjs/index.js" }, @@ -65,7 +62,6 @@ "del-cli": "^5.0.0", "rollup": "^3.2.3" }, - "types": "./types/index.d.ts", "ava": { "workerThreads": false, "files": [ diff --git a/packages/multi-entry/package.json b/packages/multi-entry/package.json index 3b6281bf9..a1d1cd830 100755 --- a/packages/multi-entry/package.json +++ b/packages/multi-entry/package.json @@ -16,9 +16,6 @@ "main": "./dist/cjs/index.js", "module": "./dist/es/index.js", "exports": { - "types": { - "import": "./dist/es/index.d.ts" - }, "import": "./dist/es/index.js", "default": "./dist/cjs/index.js" }, @@ -68,7 +65,6 @@ "devDependencies": { "rollup": "^3.2.3" }, - "types": "./types/index.d.ts", "ava": { "files": [ "!**/fixtures/**", diff --git a/packages/node-resolve/package.json b/packages/node-resolve/package.json index f6c94e867..ffa27c3f0 100644 --- a/packages/node-resolve/package.json +++ b/packages/node-resolve/package.json @@ -16,9 +16,6 @@ "main": "./dist/cjs/index.js", "module": "./dist/es/index.js", "exports": { - "types": { - "import": "./dist/es/index.d.ts" - }, "import": "./dist/es/index.js", "default": "./dist/cjs/index.js" }, @@ -81,7 +78,6 @@ "source-map": "^0.7.4", "string-capitalize": "^1.0.1" }, - "types": "./types/index.d.ts", "ava": { "workerThreads": false, "files": [ diff --git a/packages/pluginutils/package.json b/packages/pluginutils/package.json index d03dda58a..fc749bbf6 100644 --- a/packages/pluginutils/package.json +++ b/packages/pluginutils/package.json @@ -19,9 +19,6 @@ "module": "./dist/es/index.js", "type": "commonjs", "exports": { - "types": { - "import": "./dist/es/index.d.ts" - }, "import": "./dist/es/index.js", "default": "./dist/cjs/index.js" }, @@ -77,7 +74,6 @@ "rollup": "^3.2.3", "typescript": "^4.8.3" }, - "types": "./types/index.d.ts", "ava": { "extensions": [ "ts" diff --git a/packages/replace/package.json b/packages/replace/package.json index 8bc3c8735..bbdc8c9a7 100644 --- a/packages/replace/package.json +++ b/packages/replace/package.json @@ -16,9 +16,6 @@ "main": "dist/cjs/index.js", "module": "dist/es/index.js", "exports": { - "types": { - "import": "./dist/es/index.d.ts" - }, "import": "./dist/es/index.js", "default": "./dist/cjs/index.js" }, @@ -74,7 +71,6 @@ "source-map": "^0.7.4", "typescript": "^4.8.3" }, - "types": "./types/index.d.ts", "ava": { "workerThreads": false, "files": [ diff --git a/packages/run/package.json b/packages/run/package.json index 517dae9fc..bf2f81bbd 100644 --- a/packages/run/package.json +++ b/packages/run/package.json @@ -16,9 +16,6 @@ "main": "./dist/cjs/index.js", "module": "./dist/es/index.js", "exports": { - "types": { - "import": "./dist/es/index.d.ts" - }, "import": "./dist/es/index.js", "default": "./dist/cjs/index.js" }, @@ -68,7 +65,6 @@ "sinon": "^14.0.0", "typescript": "^4.8.3" }, - "types": "./types/index.d.ts", "ava": { "workerThreads": false, "files": [ diff --git a/packages/strip/package.json b/packages/strip/package.json index a5eafb908..b397ff1dc 100644 --- a/packages/strip/package.json +++ b/packages/strip/package.json @@ -16,9 +16,6 @@ "main": "./dist/cjs/index.js", "module": "./dist/es/index.js", "exports": { - "types": { - "import": "./dist/es/index.d.ts" - }, "import": "./dist/es/index.js", "default": "./dist/cjs/index.js" }, @@ -65,7 +62,6 @@ "acorn": "^8.8.0", "rollup": "^3.2.3" }, - "types": "./types/index.d.ts", "ava": { "files": [ "!**/fixtures/**", diff --git a/packages/sucrase/package.json b/packages/sucrase/package.json index c55bdee1c..71914699d 100644 --- a/packages/sucrase/package.json +++ b/packages/sucrase/package.json @@ -17,9 +17,6 @@ "module": "./dist/es/index.js", "type": "commonjs", "exports": { - "types": { - "import": "./dist/es/index.d.ts" - }, "import": "./dist/es/index.js", "default": "./dist/cjs/index.js" }, @@ -71,7 +68,6 @@ "@rollup/plugin-alias": "^4.0.0", "rollup": "^3.2.3" }, - "types": "./types/index.d.ts", "ava": { "workerThreads": false, "files": [ diff --git a/packages/swc/package.json b/packages/swc/package.json index 6b28bc5ff..fc0fc2bfd 100644 --- a/packages/swc/package.json +++ b/packages/swc/package.json @@ -16,9 +16,6 @@ "main": "dist/cjs/index.js", "module": "dist/es/index.js", "exports": { - "types": { - "import": "./dist/es/index.d.ts" - }, "import": "./dist/es/index.js", "default": "./dist/cjs/index.js" }, @@ -71,6 +68,5 @@ "@swc/core": "^1.3.78", "rollup": "^3.0.0-7", "typescript": "^4.8.3" - }, - "types": "./types/index.d.ts" + } } diff --git a/packages/terser/package.json b/packages/terser/package.json index 34de42268..882e2c9eb 100644 --- a/packages/terser/package.json +++ b/packages/terser/package.json @@ -16,9 +16,6 @@ "main": "dist/cjs/index.js", "module": "dist/es/index.js", "exports": { - "types": { - "import": "./dist/es/index.d.ts" - }, "import": "./dist/es/index.js", "default": "./dist/cjs/index.js" }, @@ -71,6 +68,5 @@ "@types/serialize-javascript": "^5.0.2", "rollup": "^3.0.0-7", "typescript": "^4.8.3" - }, - "types": "./types/index.d.ts" + } } diff --git a/packages/typescript/package.json b/packages/typescript/package.json index 8f8d30135..eb3e596f5 100644 --- a/packages/typescript/package.json +++ b/packages/typescript/package.json @@ -16,9 +16,6 @@ "main": "./dist/cjs/index.js", "module": "./dist/es/index.js", "exports": { - "types": { - "import": "./dist/es/index.d.ts" - }, "import": "./dist/es/index.js", "default": "./dist/cjs/index.js" }, @@ -77,6 +74,5 @@ "buble": "^0.20.0", "rollup": "^3.2.3", "typescript": "^4.8.3" - }, - "types": "./types/index.d.ts" + } } diff --git a/packages/url/package.json b/packages/url/package.json index 9654c780c..b28b9f638 100644 --- a/packages/url/package.json +++ b/packages/url/package.json @@ -16,9 +16,6 @@ "main": "./dist/cjs/index.js", "module": "./dist/es/index.js", "exports": { - "types": { - "import": "./dist/es/index.d.ts" - }, "import": "./dist/es/index.js", "default": "./dist/cjs/index.js" }, @@ -68,7 +65,6 @@ "globby": "^11.1.0", "rollup": "^3.2.3" }, - "types": "./types/index.d.ts", "ava": { "workerThreads": false, "files": [ diff --git a/packages/virtual/package.json b/packages/virtual/package.json index 3e63572fe..59e8884de 100755 --- a/packages/virtual/package.json +++ b/packages/virtual/package.json @@ -16,9 +16,6 @@ "main": "./dist/cjs/index.js", "module": "./dist/es/index.js", "exports": { - "types": { - "import": "./dist/es/index.d.ts" - }, "import": "./dist/es/index.js", "default": "./dist/cjs/index.js" }, @@ -68,7 +65,6 @@ "rollup": "^3.2.3", "typescript": "^4.8.3" }, - "types": "./types/index.d.ts", "ava": { "files": [ "!**/fixtures/**", diff --git a/packages/wasm/package.json b/packages/wasm/package.json index dce50cd39..94b27bf3b 100644 --- a/packages/wasm/package.json +++ b/packages/wasm/package.json @@ -16,9 +16,6 @@ "main": "./dist/cjs/index.js", "module": "./dist/es/index.js", "exports": { - "types": { - "import": "./dist/es/index.d.ts" - }, "import": "./dist/es/index.js", "default": "./dist/cjs/index.js" }, @@ -71,7 +68,6 @@ "source-map": "^0.7.4", "typescript": "^4.8.3" }, - "types": "./types/index.d.ts", "ava": { "workerThreads": false, "files": [ diff --git a/packages/yaml/package.json b/packages/yaml/package.json index 41ae31f5d..b8f058669 100755 --- a/packages/yaml/package.json +++ b/packages/yaml/package.json @@ -16,9 +16,6 @@ "main": "./dist/cjs/index.js", "module": "./dist/es/index.js", "exports": { - "types": { - "import": "./dist/es/index.d.ts" - }, "import": "./dist/es/index.js", "default": "./dist/cjs/index.js" }, @@ -69,7 +66,6 @@ "rollup": "^3.2.3", "source-map-support": "^0.5.21" }, - "types": "./types/index.d.ts", "ava": { "workerThreads": false, "files": [ diff --git a/shared/rollup.config.mjs b/shared/rollup.config.mjs index 817f166c5..a2652cf17 100644 --- a/shared/rollup.config.mjs +++ b/shared/rollup.config.mjs @@ -27,6 +27,7 @@ export function createConfig({ pkg, external = [] }) { file: pkg.main, exports: 'named', footer: 'module.exports = Object.assign(exports.default, exports);', + plugins: [emitDeclarationFile()], sourcemap: true }, {