Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: esm/cjs exports #2101

Merged
merged 5 commits into from
Feb 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
16 changes: 16 additions & 0 deletions .changeset/fresh-moles-shake.md
Original file line number Diff line number Diff line change
@@ -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
16 changes: 16 additions & 0 deletions .changeset/warm-schools-sell.md
Original file line number Diff line number Diff line change
@@ -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
13 changes: 11 additions & 2 deletions packages/animated/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -29,7 +38,7 @@
"Josh Ellis (https://github.com/joshuaellis)"
],
"scripts": {
"build": "tsup",
"build": "tsup --legacy-output",
"dev": "tsup"
},
"dependencies": {
Expand Down
13 changes: 11 additions & 2 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -32,7 +41,7 @@
"Josh Ellis (https://github.com/joshuaellis)"
],
"scripts": {
"build": "tsup",
"build": "tsup --legacy-output",
"dev": "tsup"
},
"dependencies": {
Expand Down
4 changes: 1 addition & 3 deletions packages/core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
13 changes: 11 additions & 2 deletions packages/parallax/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -28,7 +37,7 @@
"Josh Ellis (https://github.com/joshuaellis)"
],
"scripts": {
"build": "tsup",
"build": "tsup --legacy-output",
"dev": "tsup",
"test": "vite serve ./test"
},
Expand Down
13 changes: 11 additions & 2 deletions packages/rafz/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -26,7 +35,7 @@
"license": "MIT",
"author": "Josh Ellis",
"scripts": {
"build": "tsup",
"build": "tsup --legacy-output",
"dev": "tsup"
}
}
13 changes: 11 additions & 2 deletions packages/react-spring/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -40,7 +49,7 @@
"react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0"
},
"scripts": {
"build": "tsup",
"build": "tsup --legacy-output",
"dev": "tsup"
}
}
13 changes: 11 additions & 2 deletions packages/shared/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -36,7 +45,7 @@
"react": "^16.8.0 || ^17.0.0 || ^18.0.0"
},
"scripts": {
"build": "tsup",
"build": "tsup --legacy-output",
"dev": "tsup"
}
}
Empty file removed packages/types/animated.js
Empty file.
Empty file removed packages/types/index.js
Empty file.
Empty file removed packages/types/interpolation.js
Empty file.
25 changes: 22 additions & 3 deletions packages/types/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
Expand All @@ -21,5 +36,9 @@
"author": "Paul Henschel",
"maintainers": [
"Josh Ellis (https://github.com/joshuaellis)"
]
],
"scripts": {
"build": "tsup --legacy-output",
"dev": "tsup"
}
}
File renamed without changes.
2 changes: 1 addition & 1 deletion packages/types/index.d.ts → packages/types/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export * from './animated'
export * from './interpolation'
export * from './util'
export * from './utils'
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Arrify, Constrain } from './util'
import { Arrify, Constrain } from './utils'
import { Animatable } from './animated'

export type EasingFunction = (t: number) => number
Expand Down
1 change: 1 addition & 0 deletions packages/types/util.d.ts → packages/types/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ export interface UnknownProps extends Lookup<unknown> {}

/** Use `[T] extends [Any]` to know if a type parameter is `any` */
export class Any {
// @ts-ignore
private _: never
}

Expand Down
12 changes: 12 additions & 0 deletions packages/types/tsup.config.ts
Original file line number Diff line number Diff line change
@@ -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
)
})
3 changes: 0 additions & 3 deletions scripts/version-and-publish.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
13 changes: 11 additions & 2 deletions targets/konva/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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"
}
}
13 changes: 11 additions & 2 deletions targets/native/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -38,7 +47,7 @@
"react-native": ">=0.58"
},
"scripts": {
"build": "tsup",
"build": "tsup --legacy-output",
"dev": "tsup"
}
}
13 changes: 11 additions & 2 deletions targets/three/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -39,7 +48,7 @@
"three": ">=0.126"
},
"scripts": {
"build": "tsup",
"build": "tsup --legacy-output",
"dev": "tsup"
}
}