Skip to content

Commit f100a59

Browse files
committed
build and bump
1 parent 930059e commit f100a59

File tree

7 files changed

+51
-28
lines changed

7 files changed

+51
-28
lines changed

.babelrc.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module.exports = (api) => ({
22
presets: [
3-
['env-modules', { modules: api.env() === 'esm' ? false : 'commonjs' }],
3+
['env-modules', { modules: api.env() === 'cjs' ? 'commonjs' : false }],
44
['@babel/react', { runtime: 'automatic' }],
55
'@babel/preset-typescript',
66
],

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
lib/
2+
cjs/
23
.cache/
34
www/public
45

package.json

Lines changed: 39 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -11,26 +11,44 @@
1111
"url": "git+https://github.com/react-restart/ui.git"
1212
},
1313
"license": "MIT",
14-
"main": "lib/cjs/index.js",
15-
"module": "lib/esm/index.js",
16-
"types": "lib/esm/index.d.ts",
14+
"main": "cjs/index.js",
15+
"module": "lib/index.js",
16+
"types": "lib/index.d.ts",
1717
"exports": {
18+
"./package.json": "./package.json",
1819
".": {
19-
"types": "./esm/index.d.ts",
20-
"node": "./cjs/index.js",
21-
"import": "./esm/index.js",
22-
"require": "./cjs/index.js"
20+
"node": {
21+
"types": "./cjs/index.d.ts",
22+
"default": "./cjs/index.js"
23+
},
24+
"require": {
25+
"types": "./cjs/index.d.ts",
26+
"default": "./cjs/index.js"
27+
},
28+
"import": {
29+
"types": "./lib/index.d.ts",
30+
"default": "./lib/index.js"
31+
}
2332
},
2433
"./*": {
25-
"types": "./esm/*.d.ts",
26-
"node": "./cjs/*.js",
27-
"import": "./esm/*.js",
28-
"require": "./cjs/*.js"
34+
"node": {
35+
"types": "./cjs/*.d.ts",
36+
"default": "./cjs/*.js"
37+
},
38+
"require": {
39+
"types": "./cjs/*.d.ts",
40+
"default": "./cjs/*.js"
41+
},
42+
"import": {
43+
"types": "./lib/*.d.ts",
44+
"default": "./lib/*.js"
45+
}
2946
}
3047
},
3148
"sideEffects": false,
3249
"files": [
33-
"lib"
50+
"lib",
51+
"cjs"
3452
],
3553
"gitHooks": {
3654
"pre-commit": "lint-staged"
@@ -48,11 +66,15 @@
4866
],
4967
"scripts": {
5068
"bootstrap": "yarn --network-timeout 100000 && yarn --cwd www --network-timeout 100000",
51-
"build": "rimraf lib && 4c build src && yarn build:popper && yarn build:pick",
69+
"build": "rimraf lib && yarn build:esm && yarn build:cjs && yarn build:popper",
70+
"build:esm": "babel src --out-dir lib --delete-dir-on-start --extensions '.ts,.tsx' --ignore='**/*.d.ts' && yarn build:esm:types",
71+
"build:cjs": "babel src --out-dir cjs --env-name cjs --delete-dir-on-start --extensions '.ts,.tsx' --ignore='**/*.d.ts' && yarn build:cjs:types && echo '{\"type\": \"commonjs\"}' > cjs/package.json",
72+
"build:esm:types": "tsc -p . --emitDeclarationOnly --declaration --outDir lib",
73+
"build:cjs:types": "tsc -p . --emitDeclarationOnly --declaration --outDir cjs",
5274
"build:pick": "cherry-pick --cwd=lib --input-dir=../src --cjs-dir=cjs --esm-dir=esm",
53-
"build:popper": "rollup src/popper.ts --file lib/cjs/popper.js --format cjs --name popper --plugin @rollup/plugin-node-resolve",
75+
"build:popper": "rollup src/popper.ts --file cjs/popper.js --format cjs --name popper --plugin @rollup/plugin-node-resolve && rollup src/popper.ts --file lib/popper.js --format esm --name popper --plugin @rollup/plugin-node-resolve",
5476
"deploy-docs": "yarn --cwd www deploy",
55-
"lint": "eslint src test *.ts",
77+
"lint": "eslint src test",
5678
"prepublishOnly": "yarn build",
5779
"release": "rollout",
5880
"start": "yarn --cwd www start",
@@ -79,11 +101,11 @@
79101
"@babel/runtime": "^7.26.0",
80102
"@popperjs/core": "^2.11.8",
81103
"@react-aria/ssr": "^3.5.0",
82-
"@restart/hooks": "^0.5.0",
104+
"@restart/hooks": "^0.6.2",
83105
"@types/warning": "^3.0.3",
84106
"dequal": "^2.0.3",
85107
"dom-helpers": "^5.2.0",
86-
"uncontrollable": "^8.0.4",
108+
"uncontrollable": "^9.0.0",
87109
"warning": "^4.0.3"
88110
},
89111
"peerDependencies": {

src/Anchor.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as React from 'react';
22

3-
import { useEventCallback } from '@restart/hooks';
3+
import useEventCallback from '@restart/hooks/useEventCallback';
44
import { useButtonProps } from './Button';
55

66
export function isTrivialHref(href?: string) {
File renamed without changes.

www/src/WaypointExample.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { useCallbackRef } from '@restart/hooks';
1+
import useCallbackRef from '@restart/hooks/useCallbackRef';
22
import useIsomorphicEffect from '@restart/hooks/useIsomorphicEffect';
33
import Waypoint, { Position } from '@restart/ui/Waypoint';
44
import clsx from 'clsx';

yarn.lock

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2043,10 +2043,10 @@
20432043
eslint-config-prettier "^8.1.0"
20442044
eslint-plugin-react-hooks "^4.2.0"
20452045

2046-
"@restart/hooks@^0.5.0":
2047-
version "0.5.0"
2048-
resolved "https://registry.yarnpkg.com/@restart/hooks/-/hooks-0.5.0.tgz#a594af7c3b64f5e65a7aca011551b0cdd93ec14e"
2049-
integrity sha512-wS+h6IusJCPjTkmOOrRZxIPICD/mtFA3PRZviutoM23/b7akyDGfZF/WS+nIFk27u7JDhPE2+0GBdZxjSqHZkg==
2046+
"@restart/hooks@^0.6.2":
2047+
version "0.6.2"
2048+
resolved "https://registry.yarnpkg.com/@restart/hooks/-/hooks-0.6.2.tgz#55a1f9b9bb413aaf2cbb00b0ff337f807082b72e"
2049+
integrity sha512-0QzYBe1raty/ULcuyTk0ZdLf+e//4n/f39hDPt5JYZW5kSbHEAgnZhLpWErCKEYSzi14oVBSbNsllnJmWlloBg==
20502050
dependencies:
20512051
dequal "^2.0.3"
20522052

@@ -10856,10 +10856,10 @@ unbox-primitive@^1.1.0:
1085610856
has-symbols "^1.1.0"
1085710857
which-boxed-primitive "^1.1.1"
1085810858

10859-
uncontrollable@^8.0.4:
10860-
version "8.0.4"
10861-
resolved "https://registry.yarnpkg.com/uncontrollable/-/uncontrollable-8.0.4.tgz#a0a8307f638795162fafd0550f4a1efa0f8c5eb6"
10862-
integrity sha512-ulRWYWHvscPFc0QQXvyJjY6LIXU56f0h8pQFvhxiKk5V1fcI8gp9Ht9leVAhrVjzqMw0BgjspBINx9r6oyJUvQ==
10859+
uncontrollable@^9.0.0:
10860+
version "9.0.0"
10861+
resolved "https://registry.yarnpkg.com/uncontrollable/-/uncontrollable-9.0.0.tgz#a20495552b1c23640edd530733ed8c57bf66c103"
10862+
integrity sha512-wPScOFmvRkHdvebf7qNPn9Wog9B1TL8Dqcx0Vecz6HYTKFKMfGKP6MJHTjiKL8kwd8KTW3YfIUke7pmRDtkcRQ==
1086310863

1086410864
undici-types@~5.26.4:
1086510865
version "5.26.5"

0 commit comments

Comments
 (0)