From 60a398581ca9d1ba6b748f89443957c374acf2ae Mon Sep 17 00:00:00 2001 From: prisis Date: Sun, 17 Nov 2024 20:16:48 +0100 Subject: [PATCH] fix: fixed some found issues --- .../isolated-declarations-oxc/package.json | 4 +- .../packem.config.ts | 1 + .../isolated-declarations-swc/package.json | 4 +- .../packem.config.ts | 1 + .../package.json | 7 +-- .../packem.config.ts | 1 + packages/packem/package.json | 56 +++++++++++++++++++ packages/packem/packem.config.ts | 2 +- packages/packem/src/commands/add.ts | 3 +- .../packem/src/rollup/get-rollup-options.ts | 2 - 10 files changed, 67 insertions(+), 14 deletions(-) diff --git a/examples/isolated-declarations-oxc/package.json b/examples/isolated-declarations-oxc/package.json index 35c2882b..e1bb9331 100644 --- a/examples/isolated-declarations-oxc/package.json +++ b/examples/isolated-declarations-oxc/package.json @@ -19,9 +19,9 @@ "module": "./dist/index.mjs", "types": "./dist/index.d.ts", "typesVersions": { - "*": { + ">=5.5": { ".": [ - "./dist/index.d.ts" + "./dist/index.d.cts" ] } }, diff --git a/examples/isolated-declarations-oxc/packem.config.ts b/examples/isolated-declarations-oxc/packem.config.ts index 7ca5cb15..64fd7851 100644 --- a/examples/isolated-declarations-oxc/packem.config.ts +++ b/examples/isolated-declarations-oxc/packem.config.ts @@ -9,6 +9,7 @@ export default defineConfig({ isolatedDeclarationTransformer, rollup: { node10Compatibility: { + typeScriptVersion: ">=5.5", writeToPackageJson: true, }, }, diff --git a/examples/isolated-declarations-swc/package.json b/examples/isolated-declarations-swc/package.json index 45f2fb1f..5a1445c5 100644 --- a/examples/isolated-declarations-swc/package.json +++ b/examples/isolated-declarations-swc/package.json @@ -19,9 +19,9 @@ "module": "./dist/index.mjs", "types": "./dist/index.d.ts", "typesVersions": { - "*": { + ">=5.5": { ".": [ - "./dist/index.d.ts" + "./dist/index.d.cts" ] } }, diff --git a/examples/isolated-declarations-swc/packem.config.ts b/examples/isolated-declarations-swc/packem.config.ts index 2614ca3b..ebf4db0d 100644 --- a/examples/isolated-declarations-swc/packem.config.ts +++ b/examples/isolated-declarations-swc/packem.config.ts @@ -9,6 +9,7 @@ export default defineConfig({ isolatedDeclarationTransformer, rollup: { node10Compatibility: { + typeScriptVersion: ">=5.5", writeToPackageJson: true, }, }, diff --git a/examples/isolated-declarations-typescript/package.json b/examples/isolated-declarations-typescript/package.json index 5da0c648..9ba30a84 100644 --- a/examples/isolated-declarations-typescript/package.json +++ b/examples/isolated-declarations-typescript/package.json @@ -19,15 +19,10 @@ "module": "./dist/index.mjs", "types": "./dist/index.d.ts", "typesVersions": { - ">=5.0": { + ">=5.5": { ".": [ "./dist/index.d.cts" ] - }, - "*": { - ".": [ - "./dist/index.d.ts" - ] } }, "files": [ diff --git a/examples/isolated-declarations-typescript/packem.config.ts b/examples/isolated-declarations-typescript/packem.config.ts index c27d7445..859562d3 100644 --- a/examples/isolated-declarations-typescript/packem.config.ts +++ b/examples/isolated-declarations-typescript/packem.config.ts @@ -9,6 +9,7 @@ export default defineConfig({ isolatedDeclarationTransformer, rollup: { node10Compatibility: { + typeScriptVersion: ">=5.5", writeToPackageJson: true, }, }, diff --git a/packages/packem/package.json b/packages/packem/package.json index 092c7b98..20dcbdfa 100644 --- a/packages/packem/package.json +++ b/packages/packem/package.json @@ -311,6 +311,62 @@ "css/minifier/lightningcss": [ "./dist/rollup/plugins/css/minifiers/lightningcss.d.ts" ] + }, + ">=5.5": { + ".": [ + "./dist/packem.d.ts" + ], + "config": [ + "./dist/config.d.ts" + ], + "transformer/esbuild": [ + "./dist/rollup/plugins/esbuild/index.d.ts" + ], + "transformer/swc": [ + "./dist/rollup/plugins/swc/swc-plugin.d.ts" + ], + "dts/isolated/transformer/swc": [ + "./dist/rollup/plugins/swc/isolated-declarations-swc-transformer.d.ts" + ], + "dts/isolated/transformer/oxc": [ + "./dist/rollup/plugins/oxc/isolated-declarations-oxc-transformer.d.ts" + ], + "dts/isolated/transformer/typescript": [ + "./dist/rollup/plugins/typescript/isolated-declarations-typescript-transformer.d.ts" + ], + "transformer/sucrase": [ + "./dist/rollup/plugins/sucrase/index.d.ts" + ], + "builder/typedoc": [ + "./dist/builder/typedoc/index.d.ts" + ], + "runtime/inject-css": [ + "./dist/rollup/plugins/css/runtime/inject-css.d.ts" + ], + "css/loader/sourcemap": [ + "./dist/rollup/plugins/css/loaders/sourcemap.d.ts" + ], + "css/loader/less": [ + "./dist/rollup/plugins/css/loaders/less/index.d.ts" + ], + "css/loader/postcss": [ + "./dist/rollup/plugins/css/loaders/postcss/index.d.ts" + ], + "css/loader/sass": [ + "./dist/rollup/plugins/css/loaders/sass/index.d.ts" + ], + "css/loader/stylus": [ + "./dist/rollup/plugins/css/loaders/stylus/index.d.ts" + ], + "css/loader/lightningcss": [ + "./dist/rollup/plugins/css/loaders/lightningcss.d.ts" + ], + "css/minifier/cssnano": [ + "./dist/rollup/plugins/css/minifiers/cssnano.d.ts" + ], + "css/minifier/lightningcss": [ + "./dist/rollup/plugins/css/minifiers/lightningcss.d.ts" + ] } }, "bin": { diff --git a/packages/packem/packem.config.ts b/packages/packem/packem.config.ts index 510dde01..7e62a4a4 100644 --- a/packages/packem/packem.config.ts +++ b/packages/packem/packem.config.ts @@ -13,7 +13,7 @@ export default defineConfig({ path: "./LICENSE.md", }, node10Compatibility: { - typeScriptVersion: ">=5.0", + typeScriptVersion: ">=5.5", writeToPackageJson: true, }, }, diff --git a/packages/packem/src/commands/add.ts b/packages/packem/src/commands/add.ts index c7ca1d15..e51f2ca4 100644 --- a/packages/packem/src/commands/add.ts +++ b/packages/packem/src/commands/add.ts @@ -84,6 +84,7 @@ const createAddCommand = (cli: Cli): void => { return; } + // eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents const cssLoaders: (keyof typeof cssLoaderDependencies | "sourceMap")[] = []; const mainCssLoader = (await select({ @@ -128,7 +129,7 @@ const createAddCommand = (cli: Cli): void => { const packagesToInstall: string[] = []; for (const loader of cssLoaders) { - packagesToInstall.push(...cssLoaderDependencies[loader as keyof typeof cssLoaderDependencies]); + packagesToInstall.push(...cssLoaderDependencies[loader as keyof typeof cssLoaderDependencies] as string[]); } cssLoaders.push("sourceMap"); diff --git a/packages/packem/src/rollup/get-rollup-options.ts b/packages/packem/src/rollup/get-rollup-options.ts index a6271c71..dd3e7fc9 100644 --- a/packages/packem/src/rollup/get-rollup-options.ts +++ b/packages/packem/src/rollup/get-rollup-options.ts @@ -783,8 +783,6 @@ export const getRollupDtsOptions = async (context: BuildContext, fileCache: File nodeResolver, - context.options.sourcemap && sourcemapsPlugin(context.options.rollup.sourcemap), - ...normalPlugins, await memoizeDtsPluginByKey(uniqueProcessId)(context),