From 6041521995a59708c6efff3feb66259eed8f82fb Mon Sep 17 00:00:00 2001 From: ryu <114303361+ryuapp@users.noreply.github.com> Date: Fri, 20 Sep 2024 03:27:04 +0900 Subject: [PATCH] =?UTF-8?q?=F0=9F=8F=B7=EF=B8=8F=20Fix=20types=20in=20pack?= =?UTF-8?q?age.json?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build_npm.ts | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/build_npm.ts b/build_npm.ts index aa024e4..9364f8b 100644 --- a/build_npm.ts +++ b/build_npm.ts @@ -25,13 +25,20 @@ const packageJson = { bugs: { url: "https://github.com/ryuapp/enogu/issues", }, + type: "module", main: "./cjs/colors.cjs", module: "./esm/colors.mjs", + types: "./types/colors.d.cts", exports: { ".": { - types: "./types/colors.d.ts", - import: "./esm/colors.mjs", - require: "./cjs/colors.cjs", + import: { + types: "./types/colors.d.ts", + default: "./esm/colors.mjs", + }, + require: { + types: "./types/colors.d.cts", + default: "./cjs/colors.cjs", + }, }, }, devDependencies: {}, @@ -84,10 +91,12 @@ for (const file of fileList) { const inputText = decoder.decode(content); const minifiedText = minifier.minify(inputText, { keepJsDocs: true }); - Deno.writeFile( - `${outDir}/types/${file}.d.ts`, - new TextEncoder().encode(minifiedText), - ); + for (const ext of [".d.ts", ".d.cts"]) { + Deno.writeFile( + `${outDir}/types/${file}${ext}`, + new TextEncoder().encode(minifiedText), + ); + } } // package.json