From 2bf5b7bd988036aa9fa0e5e186674273d1078071 Mon Sep 17 00:00:00 2001 From: Simon H <5968653+dummdidumm@users.noreply.github.com> Date: Thu, 18 Nov 2021 23:15:13 +0100 Subject: [PATCH 1/3] (fix) add types field to exports This will be needed when TS adds the new node module resolution algorithm. It also solves https://github.com/microsoft/TypeScript/issues/46860 on our end. --- package.json | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/package.json b/package.json index 5ddceacbceb3..41459ade91ec 100644 --- a/package.json +++ b/package.json @@ -31,38 +31,46 @@ "require": "./ssr.js" }, "import": "./index.mjs", - "require": "./index.js" + "require": "./index.js", + "types": "./types/runtime/index.d.ts" }, "./compiler": { "import": "./compiler.mjs", - "require": "./compiler.js" + "require": "./compiler.js", + "types": "./types/compiler/index.d.ts" }, "./animate": { "import": "./animate/index.mjs", - "require": "./animate/index.js" + "require": "./animate/index.js", + "types": "./types/runtime/animate/index.d.ts" }, "./easing": { "import": "./easing/index.mjs", - "require": "./easing/index.js" + "require": "./easing/index.js", + "types": "./types/runtime/easing/index.d.ts" }, "./internal": { "import": "./internal/index.mjs", - "require": "./internal/index.js" + "require": "./internal/index.js", + "types": "./types/runtime/internal/index.d.ts" }, "./motion": { "import": "./motion/index.mjs", - "require": "./motion/index.js" + "require": "./motion/index.js", + "types": "./types/runtime/motion/index.d.ts" }, "./register": { "require": "./register.js" }, "./store": { "import": "./store/index.mjs", - "require": "./store/index.js" + "require": "./store/index.js", + "types": "./types/runtime/store/index.d.ts" }, "./transition": { "import": "./transition/index.mjs", - "require": "./transition/index.js" + "require": "./transition/index.js", + "types": "./types/runtime/transition/index.d.ts" }, "./ssr": { "import": "./ssr.mjs", From 534a806a3917c92b94ffc372929610b0f20f4dc6 Mon Sep 17 00:00:00 2001 From: Simon H <5968653+dummdidumm@users.noreply.github.com> Date: Fri, 19 Nov 2021 09:21:32 +0100 Subject: [PATCH 2/3] switch order, add types to ssr --- package.json | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/package.json b/package.json index 41459ade91ec..c668f7d91dfa 100644 --- a/package.json +++ b/package.json @@ -22,6 +22,7 @@ "exports": { "./package.json": "./package.json", ".": { + "types": "./types/runtime/index.d.ts", "browser": { "import": "./index.mjs", "require": "./index.js" @@ -31,48 +32,48 @@ "require": "./ssr.js" }, "import": "./index.mjs", - "require": "./index.js", - "types": "./types/runtime/index.d.ts" + "require": "./index.js" }, "./compiler": { + "types": "./types/compiler/index.d.ts", "import": "./compiler.mjs", - "require": "./compiler.js", - "types": "./types/compiler/index.d.ts" + "require": "./compiler.js" }, "./animate": { + "types": "./types/runtime/animate/index.d.ts", "import": "./animate/index.mjs", - "require": "./animate/index.js", - "types": "./types/runtime/animate/index.d.ts" + "require": "./animate/index.js" }, "./easing": { + "types": "./types/runtime/easing/index.d.ts", "import": "./easing/index.mjs", - "require": "./easing/index.js", - "types": "./types/runtime/easing/index.d.ts" + "require": "./easing/index.js" }, "./internal": { + "types": "./types/runtime/internal/index.d.ts", "import": "./internal/index.mjs", - "require": "./internal/index.js", - "types": "./types/runtime/internal/index.d.ts" + "require": "./internal/index.js" }, "./motion": { + "types": "./types/runtime/motion/index.d.ts", "import": "./motion/index.mjs", - "require": "./motion/index.js", - "types": "./types/runtime/motion/index.d.ts" + "require": "./motion/index.js" }, "./register": { "require": "./register.js" }, "./store": { + "types": "./types/runtime/store/index.d.ts", "import": "./store/index.mjs", - "require": "./store/index.js", - "types": "./types/runtime/store/index.d.ts" + "require": "./store/index.js" }, "./transition": { + "types": "./types/runtime/transition/index.d.ts", "import": "./transition/index.mjs", - "require": "./transition/index.js", - "types": "./types/runtime/transition/index.d.ts" + "require": "./transition/index.js" }, "./ssr": { + "types": "./types/runtime/index.d.ts", "import": "./ssr.mjs", "require": "./ssr.js" } From 2a8c7ead3dddf5062cd116aee9ea06d4d1309fe4 Mon Sep 17 00:00:00 2001 From: Simon H <5968653+dummdidumm@users.noreply.github.com> Date: Fri, 19 Nov 2021 09:24:28 +0100 Subject: [PATCH 3/3] update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1c4a4ab92ea4..36dcaaee87a8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ * Fix overly restrictive preprocessor types ([#6904](https://github.com/sveltejs/svelte/pull/6904)) * More specific typing for crossfade function - returns a tuple, not an array ([#6926](https://github.com/sveltejs/svelte/issues/6926)) +* Add `types` field to `exports` map ([#6939](https://github.com/sveltejs/svelte/issues/6939)) ## 3.44.1