10000 feat!: add exports map (#6901) · react-bootstrap/react-bootstrap@20c8687 · GitHub
[go: up one dir, main page]

Skip to content

Commit 20c8687

Browse files
authored
feat!: add exports map (#6901)
BREAKING CHANGE: Add package.json exports map and remove proxy directories. Removes SSR utilities.
1 parent 079e5fd commit 20c8687

File tree

106 files changed

+4119
-7356
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

106 files changed

+4119
-7356
lines changed

.github/workflows/ci.yml

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ permissions:
1212
contents: read
1313

1414
jobs:
15-
ci:
16-
name: CI
15+
test:
16+
name: Run tests
1717
runs-on: ${{ matrix.os }}
1818
strategy:
1919
matrix:
@@ -26,20 +26,17 @@ jobs:
2626
- name: Setup Node.js environment
2727
uses: actions/setup-node@v4
2828
with:
29-
node-version: 20.x
29+
node-version: 22.x
3030
cache: yarn
3131

3232
- name: Install Dependencies
33-
run: yarn bootstrap
33+
run: yarn --network-timeout 100000
3434
env:
3535
YARN_CACHE_FOLDER: .cache/yarn
3636

3737
- name: Install Playwright Browsers
3838
run: yarn playwright install --with-deps
3939

40-
- name: Run lint
41-
run: yarn lint
42-
4340
- name: Run Tests
4441
run: yarn test-browser --browser.name=${{ env.BROWSER }} --browser.headless --coverage
4542
env:
@@ -48,5 +45,26 @@ jobs:
4845
- name: Codecov
4946
uses: codecov/codecov-action@v4
5047

48+
build-lint:
49+
name: Build and lint
50+
runs-on: ubuntu-latest
51+
steps:
52+
- name: Checkout
53+
uses: actions/checkout@v4
54+
55+
- name: Setup Node.js environment
56+
uses: actions/setup-node@v4
57+
with:
58+
node-version: 22.x
59+
60+
- name: Install Dependencies
61+
run: yarn --network-timeout 100000
62+
63+
- name: Lint
64+
run: yarn lint
65+
66+
- name: Check types
67+
run: yarn check-types
68+
5169
- name: Build Project
5270
run: yarn build

.gitignore

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
2-
31
lib/
2+
cjs/
10000 43
coverage/
54
www/.cache/
65
www/public/
@@ -93,3 +92,6 @@ typings/
9392

9493
# Generated types
9594
/types
95+
96+
.yalc
97+
yalc.lock

package.json

Lines changed: 57 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-bootstrap",
3-
"version": "2.10.9",
3+
"version": "3.0.0-beta.0",
44
"description": "Bootstrap 5 components built with React",
55
"keywords": [
66
"bootstrap",
@@ -22,23 +22,47 @@
2222
"files": [
2323
"CHANGELOG.md",
2424
"lib",
25-
"dist",
26-
"es"
25+
"cjs"
2726
],
28-
"main": "lib/cjs/index.js",
29-
"module": "lib/esm/index.js",
30-
"types": "lib/esm/index.d.ts",
27+
"main": "cjs/index.js",
28+
"module": "lib/index.js",
29+
"types": "lib/index.d.ts",
30+
"exports": {
31+
"./package.json": "./package.json",
32+
".": {
33+
"require": {
34+
"types": "./cjs/index.d.ts",
35+
"default": "./cjs/index.js"
36+
},
37+
"import": {
38+
"types": "./lib/index.d.ts",
39+
"default": "./lib/index.js"
40+
}
41+
},
42+
"./*": {
43+
"require": {
44+
"types": "./cjs/*.d.ts",
45+
"default": "./cjs/*.js"
46+
},
47+
"import": {
48+
"types": "./lib/*.d.ts",
49+
"default": "./lib/*.js"
50+
}
51+
}
52+
},
3153
"sideEffects": false,
3254
"repository": {
3355
"type": "git",
3456
"url": "git+https://github.com/react-bootstrap/react-bootstrap.git"
3557
},
3658
"scripts": {
3759
"bootstrap": "yarn --network-timeout 100000 && yarn --cwd www --network-timeout 100000",
38-
"build": "node tools/build.js",
60+
"build": "rimraf lib && yarn build:esm && yarn build:esm:types && yarn build:cjs && yarn build:cjs:types",
61+
"build:esm": "babel src --out-dir lib --delete-dir-on-start --env-name esm --extensions .ts,.tsx --ignore '**/*.d.ts' && echo {\"type\": \"module\"} > lib/package.json",
62+
"build:cjs": "babel src --out-dir cjs --env-name cjs --delete-dir-on-start --extensions .ts,.tsx --ignore '**/*.d.ts' && echo {\"type\": \"commonjs\"} > cjs/package.json",
63+
"build:esm:types": "tsc --emitDeclarationOnly",
64+
"build:cjs:types": "tsc --emitDeclarationOnly --outDir cjs",
3965
"build-docs": "yarn --cwd www build",
40-
"build-types": "yarn tsc -d --emitDeclarationOnly --outDir types",
41-
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s",
4266
"check-types": "tsc -p ./test/tsconfig.json --noEmit",
4367
"deploy-docs": "yarn --cwd www deploy",
4468
"lint": "eslint src test",
@@ -57,60 +81,53 @@
5781
"singleQuote": true
5882
},
5983
"dependencies": {
60-
"@babel/runtime": "^7.24.7",
61-
"@restart/hooks": "^0.4.9",
62-
"@restart/ui": "^1.9.4",
63-
"@types/prop-types": "^15.7.12",
64-
"@types/react-transition-group": "^4.4.6",
84+
"@babel/runtime": "^7.26.7",
85+
"@restart/hooks": "^0.6.2",
86+
"@restart/ui": "^2.0.0-beta.2",
87+
"@types/prop-types": "^15.7.14",
88+
"@types/react-transition-group": "^4.4.12",
6589
"classnames": "^2.3.2",
6690
"dom-helpers": "^5.2.1",
6791
"invariant": "^2.2.4",
6892
"prop-types": "^15.8.1",
6993
"prop-types-extra": "^1.1.0",
7094
"react-transition-group": "^4.4.5",
71-
"uncontrollable": "^7.2.1",
95+
"uncontrollable": "^9.0.0",
7296
"warning": "^4.0.3"
7397
},
7498
"devDependencies": {
7599
"@4c/rollout": "^4.0.2",
76-
"@4c/tsconfig": "^0.4.1",
77-
"@babel/cli": "^7.23.4",
78-
"@babel/core": "^7.23.5",
79-
"@babel/preset-typescript": "^7.23.3",
80-
"@babel/register": "^7.22.15",
81-
"@react-bootstrap/babel-preset": "^2.2.0",
100+
"@babel/cli": "^7.26.4",
101+
"@babel/core": "^7.26.8",
102+
"@babel/preset-typescript": "^7.26.0",
103+
"@babel/register": "^7.25.9",
104+
"@react-bootstrap/babel-preset": "^2.3.0",
82105
"@testing-library/dom": "^10.4.0",
83106
"@testing-library/react": "^16.2.0",
84107
"@types/invariant": "^2.2.37",
85-
"@types/react": "^18.3.3",
86-
"@types/react-dom": "^18.3.0",
108+
"@types/react": "^18.3.18",
109+
"@types/react-dom": "^18.3.5",
87110
"@types/warning": "^3.0.3",
88111
"@vitejs/plugin-react": "^4.3.4",
89-
"@vitest/browser": "^3.0.4",
90-
"@vitest/coverage-istanbul": "^3.0.4",
91-
"babel-loader": "^9.1.3",
92-
"chalk": "^4.1.2",
93-
"cherry-pick": "^0.5.0",
94-
"cpy-cli": "^5.0.0",
95-
"cross-env": "^7.0.3",
96-
"eslint": "^9.19.0",
112+
"@vitest/browser": "^3.0.5",
113+
"@vitest/coverage-istanbul": "^3.0.5",
114+
"babel-loader": "^9.2.1",
115+
"eslint": "^9.20.0",
97116
"eslint-config-prettier": "^10.0.1",
98117
"eslint-plugin-prettier": "^5.2.3",
99118
"eslint-plugin-react": "^7.37.4",
100119
"eslint-plugin-react-hooks": "^5.1.0",
101-
"execa": "^5.1.1",
102-
"fs-extra": "^10.1.0",
103120
"globals": "^15.14.0",
104121
"husky": "^9.1.7",
105122
"lint-staged": "^15.4.3",
106-
"playwright": "^1.50.0",
107-
"prettier": "^3.4.2",
123+
"playwright": "^1.50.1",
124+
"prettier": "^3.5.0",
108125
"react": "^18.3.1",
109126
"react-dom": "^18.3.1",
110-
"typescript": "^5.5.4",
111-
"typescript-eslint": "^8.22.0",
112-
"vitest": "^3.0.4",
113-
"webpack": "^5.93.0"
127+
"rimraf": "^6.0.1",
128+
"typescript": "^5.7.3",
129+
"typescript-eslint": "^8.23.0",
130+
"vitest": "^3.0.5"
114131
},
115132
"peerDependencies": {
116133
"@types/react": ">=16.14.8",
@@ -123,7 +140,7 @@
123140
}
124141
},
125142
"publishConfig": {
126-
"directory": "lib"
143+
"access": "public"
127144
},
128145
"release": {
129146
"conventionalCommits": true

src/AbstractModalHeader.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import PropTypes from 'prop-types';
22
import * as React from 'react';
33
import { useContext } from 'react';
44
import useEventCallback from '@restart/hooks/useEventCallback';
5-
import CloseButton, { CloseButtonVariant } from './CloseButton';
5+
import CloseButton, { type CloseButtonVariant } from './CloseButton';
66
import ModalContext from './ModalContext';
77

88
export interface AbstractModalHeaderProps

src/Accordion.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ import AccordionBody from './AccordionBody';
88
import AccordionButton from './AccordionButton';
99
import AccordionCollapse from './AccordionCollapse';
1010
import AccordionContext, {
11-
AccordionSelectCallback,
12-
AccordionEventKey,
11+
type AccordionSelectCallback,
12+
type AccordionEventKey,
1313
} from './AccordionContext';
1414
import AccordionHeader from './AccordionHeader';
1515
import AccordionItem from './AccordionItem';
16-
import { BsPrefixProps, BsPrefixRefForwardingComponent } from './helpers';
16+
import type { BsPrefixProps, BsPrefixRefForwardingComponent } from './helpers';
1717

1818
export interface AccordionProps
1919
extends Omit<React.HTMLAttributes<HTMLElement>, 'onSelect'>,

src/AccordionBody.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ import classNames from 'classnames';
22
import * as React from 'react';
33
import { useContext } from 'react';
44
import PropTypes from 'prop-types';
5-
import { TransitionCallbacks } from '@restart/ui/types';
5+
import type { TransitionCallbacks } from '@restart/ui/types';
66
import { useBootstrapPrefix } from './ThemeProvider';
77
import AccordionCollapse from './AccordionCollapse';
88
import AccordionItemContext from './AccordionItemContext';
9-
import { BsPrefixRefForwardingComponent, BsPrefixProps } from './helpers';
9+
import type { BsPrefixRefForwardingComponent, BsPrefixProps } from './helpers';
1010

1111
export interface AccordionBodyProps
1212
extends BsPrefixProps,

src/AccordionButton.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ import classNames from 'classnames';
44
import PropTypes from 'prop-types';
55
import AccordionContext, {
66
isAccordionItemSelected,
7-
AccordionEventKey,
7+
type AccordionEventKey,
88
} from './AccordionContext';
99
import AccordionItemContext from './AccordionItemContext';
10-
import { BsPrefixProps, BsPrefixRefForwardingComponent } from './helpers';
10+
import type { BsPrefixProps, BsPrefixRefForwardingComponent } from './helpers';
1111
import { useBootstrapPrefix } from './ThemeProvider';
1212

1313
type EventHandler = React.EventHandler<React.SyntheticEvent>;

src/AccordionCollapse.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ import { useContext } from 'react';
44
import PropTypes from 'prop-types';
55
import { Transition } from 'react-transition-group';
66
import { useBootstrapPrefix } from './ThemeProvider';
7-
import Collapse, { CollapseProps } from './Collapse';
7+
import Collapse, { type CollapseProps } from './Collapse';
88
import AccordionContext, { isAccordionItemSelected } from './AccordionContext';
9-
import { BsPrefixRefForwardingComponent, BsPrefixProps } from './helpers';
9+
import type { BsPrefixRefForwardingComponent, BsPrefixProps } from './helpers';
1010

1111
export interface AccordionCollapseProps extends BsPrefixProps, CollapseProps {
1212
eventKey: string;

src/AccordionHeader.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import * as React from 'react';
33
import PropTypes from 'prop-types';< C052 /span>
44
import { useBootstrapPrefix } from './ThemeProvider';
55
import AccordionButton from './AccordionButton';
6-
import { BsPrefixRefForwardingComponent, BsPrefixProps } from './helpers';
6+
import type { BsPrefixRefForwardingComponent, BsPrefixProps } from './helpers';
77

88
export interface AccordionHeaderProps
99
extends BsPrefixProps,

src/AccordionItem.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ import { useMemo } from 'react';
44
import PropTypes from 'prop-types';
55
import { useBootstrapPrefix } from './ThemeProvider';
66
import AccordionItemContext, {
7-
AccordionItemContextValue,
7+
type AccordionItemContextValue,
88
} from './AccordionItemContext';
9-
import { BsPrefixRefForwardingComponent, BsPrefixProps } from './helpers';
9+
import type { BsPrefixRefForwardingComponent, BsPrefixProps } from './helpers';
1010

1111
export interface AccordionItemProps
1212
extends BsPrefixProps,

0 commit comments

Comments
 (0)
0