diff --git a/.changeset/fresh-moles-shake.md b/.changeset/fresh-moles-shake.md new file mode 100644 index 0000000000..5a1a78da81 --- /dev/null +++ b/.changeset/fresh-moles-shake.md @@ -0,0 +1,16 @@ +--- +'@react-spring/types': patch +'@react-spring/core': patch +'@react-spring/animated': patch +'@react-spring/parallax': patch +'@react-spring/rafz': patch +'react-spring': patch +'@react-spring/shared': patch +'@react-spring/konva': patch +'@react-spring/native': patch +'@react-spring/three': patch +'@react-spring/web': patch +'@react-spring/zdog': patch +--- + +fix types package diff --git a/.changeset/warm-schools-sell.md b/.changeset/warm-schools-sell.md new file mode 100644 index 0000000000..2d099b31be --- /dev/null +++ b/.changeset/warm-schools-sell.md @@ -0,0 +1,16 @@ +--- +'react-spring': patch +'@react-spring/animated': patch +'@react-spring/parallax': patch +'@react-spring/shared': patch +'@react-spring/types': patch +'@react-spring/native': patch +'@react-spring/core': patch +'@react-spring/rafz': patch +'@react-spring/konva': patch +'@react-spring/three': patch +'@react-spring/zdog': patch +'@react-spring/web': patch +--- + +chore: add exports to package.json diff --git a/packages/animated/package.json b/packages/animated/package.json index 3cbde1a188..f88ae27372 100644 --- a/packages/animated/package.json +++ b/packages/animated/package.json @@ -3,8 +3,17 @@ "version": "9.7.0", "description": "Animated component props for React", "main": "dist/index.js", - "module": "dist/index.mjs", + "module": "dist/esm/index.js", "types": "dist/index.d.ts", + "exports": { + ".": { + "types": "./dist/index.d.ts", + "import": "./dist/esm/index.js", + "module": "./dist/esm/index.js", + "require": "./dist/index.js" + }, + "./package.json": "./package.json" + }, "files": [ "dist/*", "README.md", @@ -29,7 +38,7 @@ "Josh Ellis (https://github.com/joshuaellis)" ], "scripts": { - "build": "tsup", + "build": "tsup --legacy-output", "dev": "tsup" }, "dependencies": { diff --git a/packages/core/package.json b/packages/core/package.json index caf44a1e50..a1e3262c85 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -2,8 +2,17 @@ "name": "@react-spring/core", "version": "9.7.0", "main": "dist/index.js", - "module": "dist/index.mjs", + "module": "dist/esm/index.js", "types": "dist/index.d.ts", + "exports": { + ".": { + "types": "./dist/index.d.ts", + "import": "./dist/esm/index.js", + "module": "./dist/esm/index.js", + "require": "./dist/index.js" + }, + "./package.json": "./package.json" + }, "files": [ "dist/*", "README.md", @@ -32,7 +41,7 @@ "Josh Ellis (https://github.com/joshuaellis)" ], "scripts": { - "build": "tsup", + "build": "tsup --legacy-output", "dev": "tsup" }, "dependencies": { diff --git a/packages/core/src/index.ts b/packages/core/src/index.ts index 32e539f416..d87989b4c0 100644 --- a/packages/core/src/index.ts +++ b/packages/core/src/index.ts @@ -21,6 +21,4 @@ export { export { inferTo } from './helpers' export * from './types' -export type { UnknownProps } from '@react-spring/types' -export * from '@react-spring/types/animated' -export * from '@react-spring/types/interpolation' +export * from '@react-spring/types' diff --git a/packages/parallax/package.json b/packages/parallax/package.json index eb81b70225..00b4fc7572 100644 --- a/packages/parallax/package.json +++ b/packages/parallax/package.json @@ -2,8 +2,17 @@ "name": "@react-spring/parallax", "version": "9.7.0", "main": "dist/index.js", - "module": "dist/index.mjs", + "module": "dist/esm/index.js", "types": "dist/index.d.ts", + "exports": { + ".": { + "types": "./dist/index.d.ts", + "import": "./dist/esm/index.js", + "module": "./dist/esm/index.js", + "require": "./dist/index.js" + }, + "./package.json": "./package.json" + }, "files": [ "dist/*", "README.md", @@ -28,7 +37,7 @@ "Josh Ellis (https://github.com/joshuaellis)" ], "scripts": { - "build": "tsup", + "build": "tsup --legacy-output", "dev": "tsup", "test": "vite serve ./test" }, diff --git a/packages/rafz/package.json b/packages/rafz/package.json index 2f1d17bfa2..ab85123b15 100644 --- a/packages/rafz/package.json +++ b/packages/rafz/package.json @@ -3,8 +3,17 @@ "version": "9.7.0", "description": "react-spring's fork of rafz one frameloop to rule them all", "main": "dist/index.js", - "module": "dist/index.mjs", + "module": "dist/esm/index.js", "types": "dist/index.d.ts", + "exports": { + ".": { + "types": "./dist/index.d.ts", + "import": "./dist/esm/index.js", + "module": "./dist/esm/index.js", + "require": "./dist/index.js" + }, + "./package.json": "./package.json" + }, "files": [ "dist/*", "README.md", @@ -26,7 +35,7 @@ "license": "MIT", "author": "Josh Ellis", "scripts": { - "build": "tsup", + "build": "tsup --legacy-output", "dev": "tsup" } } diff --git a/packages/react-spring/package.json b/packages/react-spring/package.json index d9f571518d..bb7f047baf 100644 --- a/packages/react-spring/package.json +++ b/packages/react-spring/package.json @@ -2,8 +2,17 @@ "name": "react-spring", "version": "9.7.0", "main": "dist/index.js", - "module": "dist/index.mjs", + "module": "dist/esm/index.js", "types": "dist/index.d.ts", + "exports": { + ".": { + "types": "./dist/index.d.ts", + "import": "./dist/esm/index.js", + "module": "./dist/esm/index.js", + "require": "./dist/index.js" + }, + "./package.json": "./package.json" + }, "files": [ "dist/*", "README.md", @@ -40,7 +49,7 @@ "react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0" }, "scripts": { - "build": "tsup", + "build": "tsup --legacy-output", "dev": "tsup" } } diff --git a/packages/shared/package.json b/packages/shared/package.json index 9d683fed69..c1f7c7259a 100644 --- a/packages/shared/package.json +++ b/packages/shared/package.json @@ -3,8 +3,17 @@ "version": "9.7.0", "description": "Globals and shared modules", "main": "dist/index.js", - "module": "dist/index.mjs", + "module": "dist/esm/index.js", "types": "dist/index.d.ts", + "exports": { + ".": { + "types": "./dist/index.d.ts", + "import": "./dist/esm/index.js", + "module": "./dist/esm/index.js", + "require": "./dist/index.js" + }, + "./package.json": "./package.json" + }, "files": [ "dist/*", "README.md", @@ -36,7 +45,7 @@ "react": "^16.8.0 || ^17.0.0 || ^18.0.0" }, "scripts": { - "build": "tsup", + "build": "tsup --legacy-output", "dev": "tsup" } } diff --git a/packages/types/animated.js b/packages/types/animated.js deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/packages/types/index.js b/packages/types/index.js deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/packages/types/interpolation.js b/packages/types/interpolation.js deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/packages/types/package.json b/packages/types/package.json index 476b7773eb..74d728ef63 100644 --- a/packages/types/package.json +++ b/packages/types/package.json @@ -2,8 +2,23 @@ "name": "@react-spring/types", "version": "9.7.0", "description": "Internal package with TypeScript stuff", - "main": "index.js", - "types": "index.d.ts", + "main": "dist/index.js", + "module": "dist/esm/index.js", + "types": "dist/index.d.ts", + "exports": { + ".": { + "types": "./dist/index.d.ts", + "import": "./dist/esm/index.js", + "module": "./dist/esm/index.js", + "require": "./dist/index.js" + }, + "./package.json": "./package.json" + }, + "files": [ + "dist/*", + "README.md", + "LICENSE" + ], "repository": "pmndrs/react-spring", "homepage": "https://github.com/pmndrs/react-spring#readme", "keywords": [ @@ -21,5 +36,9 @@ "author": "Paul Henschel", "maintainers": [ "Josh Ellis (https://github.com/joshuaellis)" - ] + ], + "scripts": { + "build": "tsup --legacy-output", + "dev": "tsup" + } } diff --git a/packages/types/animated.d.ts b/packages/types/src/animated.ts similarity index 100% rename from packages/types/animated.d.ts rename to packages/types/src/animated.ts diff --git a/packages/types/index.d.ts b/packages/types/src/index.ts similarity index 71% rename from packages/types/index.d.ts rename to packages/types/src/index.ts index 1f9a0ebef0..6156b86b43 100644 --- a/packages/types/index.d.ts +++ b/packages/types/src/index.ts @@ -1,3 +1,3 @@ export * from './animated' export * from './interpolation' -export * from './util' +export * from './utils' diff --git a/packages/types/interpolation.d.ts b/packages/types/src/interpolation.ts similarity index 98% rename from packages/types/interpolation.d.ts rename to packages/types/src/interpolation.ts index de35fbe6fe..439f7d2fd7 100644 --- a/packages/types/interpolation.d.ts +++ b/packages/types/src/interpolation.ts @@ -1,4 +1,4 @@ -import { Arrify, Constrain } from './util' +import { Arrify, Constrain } from './utils' import { Animatable } from './animated' export type EasingFunction = (t: number) => number diff --git a/packages/types/util.d.ts b/packages/types/src/utils.ts similarity index 99% rename from packages/types/util.d.ts rename to packages/types/src/utils.ts index 918910abe5..7fe4a2d761 100644 --- a/packages/types/util.d.ts +++ b/packages/types/src/utils.ts @@ -92,6 +92,7 @@ export interface UnknownProps extends Lookup {} /** Use `[T] extends [Any]` to know if a type parameter is `any` */ export class Any { + // @ts-ignore private _: never } diff --git a/packages/types/tsup.config.ts b/packages/types/tsup.config.ts new file mode 100644 index 0000000000..7ffdb6d887 --- /dev/null +++ b/packages/types/tsup.config.ts @@ -0,0 +1,12 @@ +import { defineConfig } from 'tsup' +import { defaultConfig } from '../../tsup.config.base' + +export default defineConfig(opts => { + return defaultConfig( + { + entry: ['src/index.ts'], + outDir: 'dist', + }, + opts + ) +}) diff --git a/scripts/version-and-publish.sh b/scripts/version-and-publish.sh index 198be0ad81..4f385b7df2 100755 --- a/scripts/version-and-publish.sh +++ b/scripts/version-and-publish.sh @@ -18,9 +18,6 @@ if [[ -z "$distTag" ]]; then read -r distTag fi - -echo "$version" - # publish packages ./node_modules/.bin/changeset version --snapshot "$version" ./node_modules/.bin/changeset publish --no-git-tag --snapshot --tag "$distTag" diff --git a/targets/konva/package.json b/targets/konva/package.json index 1097d9a72b..829d64a6a2 100644 --- a/targets/konva/package.json +++ b/targets/konva/package.json @@ -2,8 +2,17 @@ "name": "@react-spring/konva", "version": "9.7.0", "main": "dist/index.js", - "module": "dist/index.mjs", + "module": "dist/esm/index.js", "types": "dist/index.d.ts", + "exports": { + ".": { + "types": "./dist/index.d.ts", + "import": "./dist/esm/index.js", + "module": "./dist/esm/index.js", + "require": "./dist/index.js" + }, + "./package.json": "./package.json" + }, "files": [ "dist/*", "README.md", @@ -39,7 +48,7 @@ "react-konva": "^16.8.0 || ^16.8.7-0 || ^16.9.0-0 || ^16.10.1-0 || ^16.12.0-0 || ^16.13.0-0 || ^17.0.0-0 || ^17.0.1-0 || ^17.0.2-0 || ^18.0.0-0" }, "scripts": { - "build": "tsup", + "build": "tsup --legacy-output", "dev": "tsup" } } diff --git a/targets/native/package.json b/targets/native/package.json index 596059169c..04757f0bd7 100644 --- a/targets/native/package.json +++ b/targets/native/package.json @@ -2,8 +2,17 @@ "name": "@react-spring/native", "version": "9.7.0", "main": "dist/index.js", - "module": "dist/index.mjs", + "module": "dist/esm/index.js", "types": "dist/index.d.ts", + "exports": { + ".": { + "types": "./dist/index.d.ts", + "import": "./dist/esm/index.js", + "module": "./dist/esm/index.js", + "require": "./dist/index.js" + }, + "./package.json": "./package.json" + }, "files": [ "dist/*", "README.md", @@ -38,7 +47,7 @@ "react-native": ">=0.58" }, "scripts": { - "build": "tsup", + "build": "tsup --legacy-output", "dev": "tsup" } } diff --git a/targets/three/package.json b/targets/three/package.json index f39092c7f5..c8c9e3deaa 100644 --- a/targets/three/package.json +++ b/targets/three/package.json @@ -2,8 +2,17 @@ "name": "@react-spring/three", "version": "9.7.0", "main": "dist/index.js", - "module": "dist/index.mjs", + "module": "dist/esm/index.js", "types": "dist/index.d.ts", + "exports": { + ".": { + "types": "./dist/index.d.ts", + "import": "./dist/esm/index.js", + "module": "./dist/esm/index.js", + "require": "./dist/index.js" + }, + "./package.json": "./package.json" + }, "files": [ "dist/*", "README.md", @@ -39,7 +48,7 @@ "three": ">=0.126" }, "scripts": { - "build": "tsup", + "build": "tsup --legacy-output", "dev": "tsup" } } diff --git a/targets/web/package.json b/targets/web/package.json index 55ec980f73..08ec79a425 100644 --- a/targets/web/package.json +++ b/targets/web/package.json @@ -2,8 +2,17 @@ "name": "@react-spring/web", "version": "9.7.0", "main": "dist/index.js", - "module": "dist/index.mjs", + "module": "dist/esm/index.js", "types": "dist/index.d.ts", + "exports": { + ".": { + "types": "./dist/index.d.ts", + "import": "./dist/esm/index.js", + "module": "./dist/esm/index.js", + "require": "./dist/index.js" + }, + "./package.json": "./package.json" + }, "files": [ "dist/*", "README.md", @@ -38,7 +47,7 @@ "react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0" }, "scripts": { - "build": "tsup", + "build": "tsup --legacy-output", "dev": "tsup" } } diff --git a/targets/zdog/package.json b/targets/zdog/package.json index a80a638e1a..ed5a06f2c5 100644 --- a/targets/zdog/package.json +++ b/targets/zdog/package.json @@ -2,8 +2,17 @@ "name": "@react-spring/zdog", "version": "9.7.0", "main": "dist/index.js", - "module": "dist/index.mjs", + "module": "dist/esm/index.js", "types": "dist/index.d.ts", + "exports": { + ".": { + "types": "./dist/index.d.ts", + "import": "./dist/esm/index.js", + "module": "./dist/esm/index.js", + "require": "./dist/index.js" + }, + "./package.json": "./package.json" + }, "files": [ "dist/*", "README.md", @@ -40,7 +49,7 @@ "zdog": ">=1.0" }, "scripts": { - "build": "tsup", + "build": "tsup --legacy-output", "dev": "tsup" } }