Skip to content

Commit 0ca8e3a

Browse files
authored
Drop support for CJS build output (#3708)
* Drop support for CJS build output * remove default export
1 parent 1265e67 commit 0ca8e3a

40 files changed

Lines changed: 48 additions & 58 deletions

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
npm install react-data-grid
5858
```
5959

60-
`react-data-grid` is published as ECMAScript modules for evergreen browsers / bundlers, and CommonJS for server-side rendering / Jest.
60+
`react-data-grid` is published as ECMAScript modules for evergreen browsers, bundlers, and server-side rendering.
6161

6262
## Quick start
6363

package.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,11 @@
1717
"./lib/styles.css": "./lib/styles.css",
1818
".": {
1919
"types": "./lib/index.d.ts",
20-
"module": "./lib/bundle.js",
21-
"require": "./lib/bundle.cjs",
2220
"default": "./lib/bundle.js"
2321
}
2422
},
2523
"browser": "./lib/bundle.js",
26-
"main": "./lib/bundle.cjs",
24+
"main": "./lib/bundle.js",
2725
"module": "./lib/bundle.js",
2826
"types": "./lib/index.d.ts",
2927
"files": [

rolldown.config.js

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,12 @@ import { defineConfig } from 'rolldown';
66

77
export default defineConfig({
88
input: './src/index.ts',
9-
output: [
10-
{
11-
dir: 'lib',
12-
entryFileNames: 'bundle.js',
13-
cssEntryFileNames: 'styles.css',
14-
format: 'es',
15-
sourcemap: true
16-
},
17-
{
18-
dir: 'lib',
19-
entryFileNames: 'bundle.cjs',
20-
cssEntryFileNames: 'styles.css',
21-
format: 'cjs',
22-
sourcemap: true
23-
}
24-
],
9+
output: {
10+
dir: 'lib',
11+
entryFileNames: 'bundle.js',
12+
cssEntryFileNames: 'styles.css',
13+
sourcemap: true
14+
},
2515
platform: 'browser',
2616
external: (/** @type {string} */ id) => !id.startsWith('.') && !isAbsolute(id),
2717
plugins: [

src/DataGrid.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -222,9 +222,7 @@ export interface DataGridProps<R, SR = unknown, K extends Key = Key> extends Sha
222222
*
223223
* <DataGrid columns={columns} rows={rows} />
224224
*/
225-
export default function DataGrid<R, SR = unknown, K extends Key = Key>(
226-
props: DataGridProps<R, SR, K>
227-
) {
225+
export function DataGrid<R, SR = unknown, K extends Key = Key>(props: DataGridProps<R, SR, K>) {
228226
const {
229227
ref,
230228
// Grid and data Props

src/TreeDataGrid.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import type {
1616
} from './types';
1717
import { renderToggleGroup } from './cellRenderers';
1818
import { SELECT_COLUMN_KEY } from './Columns';
19-
import DataGrid from './DataGrid';
19+
import { DataGrid } from './DataGrid';
2020
import type { DataGridProps } from './DataGrid';
2121
import { useDefaultRenderers } from './DataGridDefaultRenderersContext';
2222
import GroupedRow from './GroupRow';

src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import './style/layers.css';
22

33
export {
4-
default,
4+
DataGrid,
55
type DataGridProps,
66
type DataGridHandle,
77
type DefaultColumnOptions

test/browser/TextEditor.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { useState } from 'react';
22
import { page, userEvent } from '@vitest/browser/context';
33

4-
import DataGrid, { textEditor } from '../../src';
4+
import { DataGrid, textEditor } from '../../src';
55
import type { Column } from '../../src';
66
import { getCells } from './utils';
77

test/browser/column/renderCell.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { useState } from 'react';
22
import { page, userEvent } from '@vitest/browser/context';
33

4-
import DataGrid from '../../../src';
4+
import { DataGrid } from '../../../src';
55
import type { Column } from '../../../src';
66
import { getCells, getCellsAtRowIndexOld, setup } from '../utils';
77

test/browser/column/renderEditCell.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { createPortal } from 'react-dom';
33
import { waitFor } from '@testing-library/react';
44
import { page, userEvent } from '@vitest/browser/context';
55

6-
import DataGrid from '../../../src';
6+
import { DataGrid } from '../../../src';
77
import type { Column, DataGridProps } from '../../../src';
88
import { getCellsAtRowIndexOld, getGridOld, getSelectedCellOld, scrollGrid } from '../utils';
99

test/browser/columnOrder.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { page } from '@vitest/browser/context';
22

3-
import DataGrid, { SelectColumn, TreeDataGrid } from '../../src';
3+
import { DataGrid, SelectColumn, TreeDataGrid } from '../../src';
44
import type { Column } from '../../src';
55
import { getHeaderCells } from './utils';
66

0 commit comments

Comments
 (0)