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

build: Add exports field and ESM build for bundlers with module field/condition #1695

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/loud-islands-cheat.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@ag.ds-next/react': patch
---

build: Add `exports` field to support importing in Node ESM environments and add ESM build for bundlers
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { faker } from '@faker-js/faker';
import { COUNTRY_OPTIONS } from '@ag.ds-next/react/src/combobox/test-utils';
import { COUNTRY_OPTIONS } from '../../../../docs/components/designSystemComponents';

export type BusinessForAuditStatus =
| 'notBooked'
Expand Down
8 changes: 6 additions & 2 deletions docs/components/designSystemComponents.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -260,11 +260,15 @@ export {
export { TimePicker } from '@ag.ds-next/react/time-picker';

// Used to populate options on documentation site and playroom
// these have to be relative imports because these aren't properly
// exported from the package and the package has an `exports` field
// which restricts importing things not specified in the `exports` field
// (though importing relatively like this isn't restricted)
export {
COUNTRY_OPTIONS,
NAME_OPTIONS,
} from '@ag.ds-next/react/src/combobox/test-utils';
} from '../../packages/react/src/combobox/test-utils';
export {
createExampleFile,
createExampleImageFile,
} from '@ag.ds-next/react/src/file-upload/test-utils';
} from '../../packages/react/src/file-upload/test-utils';
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@
"preconstruct": {
"packages": [
"packages/*"
]
],
"exports": true
}
}
3 changes: 2 additions & 1 deletion packages/react/a11y/package.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"main": "dist/ag.ds-next-react-a11y.cjs.js"
"main": "dist/ag.ds-next-react-a11y.cjs.js",
"module": "dist/ag.ds-next-react-a11y.esm.js"
}
3 changes: 2 additions & 1 deletion packages/react/accordion/package.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"main": "dist/ag.ds-next-react-accordion.cjs.js"
"main": "dist/ag.ds-next-react-accordion.cjs.js",
"module": "dist/ag.ds-next-react-accordion.esm.js"
}
3 changes: 2 additions & 1 deletion packages/react/ag-branding/package.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"main": "dist/ag.ds-next-react-ag-branding.cjs.js"
"main": "dist/ag.ds-next-react-ag-branding.cjs.js",
"module": "dist/ag.ds-next-react-ag-branding.esm.js"
}
3 changes: 2 additions & 1 deletion packages/react/app-layout/package.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"main": "dist/ag.ds-next-react-app-layout.cjs.js"
"main": "dist/ag.ds-next-react-app-layout.cjs.js",
"module": "dist/ag.ds-next-react-app-layout.esm.js"
}
3 changes: 2 additions & 1 deletion packages/react/autocomplete/package.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"main": "dist/ag.ds-next-react-autocomplete.cjs.js"
"main": "dist/ag.ds-next-react-autocomplete.cjs.js",
"module": "dist/ag.ds-next-react-autocomplete.esm.js"
}
3 changes: 2 additions & 1 deletion packages/react/avatar/package.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"main": "dist/ag.ds-next-react-avatar.cjs.js"
"main": "dist/ag.ds-next-react-avatar.cjs.js",
"module": "dist/ag.ds-next-react-avatar.esm.js"
}
3 changes: 2 additions & 1 deletion packages/react/badge/package.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"main": "dist/ag.ds-next-react-badge.cjs.js"
"main": "dist/ag.ds-next-react-badge.cjs.js",
"module": "dist/ag.ds-next-react-badge.esm.js"
}
3 changes: 2 additions & 1 deletion packages/react/box/package.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"main": "dist/ag.ds-next-react-box.cjs.js"
"main": "dist/ag.ds-next-react-box.cjs.js",
"module": "dist/ag.ds-next-react-box.esm.js"
}
3 changes: 2 additions & 1 deletion packages/react/breadcrumbs/package.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"main": "dist/ag.ds-next-react-breadcrumbs.cjs.js"
"main": "dist/ag.ds-next-react-breadcrumbs.cjs.js",
"module": "dist/ag.ds-next-react-breadcrumbs.esm.js"
}
3 changes: 2 additions & 1 deletion packages/react/button/package.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"main": "dist/ag.ds-next-react-button.cjs.js"
"main": "dist/ag.ds-next-react-button.cjs.js",
"module": "dist/ag.ds-next-react-button.esm.js"
}
3 changes: 2 additions & 1 deletion packages/react/call-to-action/package.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"main": "dist/ag.ds-next-react-call-to-action.cjs.js"
"main": "dist/ag.ds-next-react-call-to-action.cjs.js",
"module": "dist/ag.ds-next-react-call-to-action.esm.js"
}
3 changes: 2 additions & 1 deletion packages/react/callout/package.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"main": "dist/ag.ds-next-react-callout.cjs.js"
"main": "dist/ag.ds-next-react-callout.cjs.js",
"module": "dist/ag.ds-next-react-callout.esm.js"
}
3 changes: 2 additions & 1 deletion packages/react/card/package.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"main": "dist/ag.ds-next-react-card.cjs.js"
"main": "dist/ag.ds-next-react-card.cjs.js",
"module": "dist/ag.ds-next-react-card.esm.js"
}
3 changes: 2 additions & 1 deletion packages/react/checkbox/package.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"main": "dist/ag.ds-next-react-checkbox.cjs.js"
"main": "dist/ag.ds-next-react-checkbox.cjs.js",
"module": "dist/ag.ds-next-react-checkbox.esm.js"
}
3 changes: 2 additions & 1 deletion packages/react/columns/package.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"main": "dist/ag.ds-next-react-columns.cjs.js"
"main": "dist/ag.ds-next-react-columns.cjs.js",
"module": "dist/ag.ds-next-react-columns.esm.js"
}
3 changes: 2 additions & 1 deletion packages/react/combobox/package.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"main": "dist/ag.ds-next-react-combobox.cjs.js"
"main": "dist/ag.ds-next-react-combobox.cjs.js",
"module": "dist/ag.ds-next-react-combobox.esm.js"
}
3 changes: 2 additions & 1 deletion packages/react/content/package.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"main": "dist/ag.ds-next-react-content.cjs.js"
"main": "dist/ag.ds-next-react-content.cjs.js",
"module": "dist/ag.ds-next-react-content.esm.js"
}
3 changes: 2 additions & 1 deletion packages/react/control-group/package.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"main": "dist/ag.ds-next-react-control-group.cjs.js"
"main": "dist/ag.ds-next-react-control-group.cjs.js",
"module": "dist/ag.ds-next-react-control-group.esm.js"
}
3 changes: 2 additions & 1 deletion packages/react/control-input/package.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"main": "dist/ag.ds-next-react-control-input.cjs.js"
"main": "dist/ag.ds-next-react-control-input.cjs.js",
"module": "dist/ag.ds-next-react-control-input.esm.js"
}
3 changes: 2 additions & 1 deletion packages/react/core/package.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"main": "dist/ag.ds-next-react-core.cjs.js"
"main": "dist/ag.ds-next-react-core.cjs.js",
"module": "dist/ag.ds-next-react-core.esm.js"
}
3 changes: 2 additions & 1 deletion packages/react/date-picker/package.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"main": "dist/ag.ds-next-react-date-picker.cjs.js"
"main": "dist/ag.ds-next-react-date-picker.cjs.js",
"module": "dist/ag.ds-next-react-date-picker.esm.js"
}
3 changes: 2 additions & 1 deletion packages/react/date-range-picker/package.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"main": "dist/ag.ds-next-react-date-range-picker.cjs.js"
"main": "dist/ag.ds-next-react-date-range-picker.cjs.js",
"module": "dist/ag.ds-next-react-date-range-picker.esm.js"
}
3 changes: 2 additions & 1 deletion packages/react/details/package.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"main": "dist/ag.ds-next-react-details.cjs.js"
"main": "dist/ag.ds-next-react-details.cjs.js",
"module": "dist/ag.ds-next-react-details.esm.js"
}
3 changes: 2 additions & 1 deletion packages/react/direction-link/package.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"main": "dist/ag.ds-next-react-direction-link.cjs.js"
"main": "dist/ag.ds-next-react-direction-link.cjs.js",
"module": "dist/ag.ds-next-react-direction-link.esm.js"
}
3 changes: 2 additions & 1 deletion packages/react/divider/package.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"main": "dist/ag.ds-next-react-divider.cjs.js"
"main": "dist/ag.ds-next-react-divider.cjs.js",
"module": "dist/ag.ds-next-react-divider.esm.js"
}
3 changes: 2 additions & 1 deletion packages/react/drawer/package.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"main": "dist/ag.ds-next-react-drawer.cjs.js"
"main": "dist/ag.ds-next-react-drawer.cjs.js",
"module": "dist/ag.ds-next-react-drawer.esm.js"
}
3 changes: 2 additions & 1 deletion packages/react/dropdown-menu/package.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"main": "dist/ag.ds-next-react-dropdown-menu.cjs.js"
"main": "dist/ag.ds-next-react-dropdown-menu.cjs.js",
"module": "dist/ag.ds-next-react-dropdown-menu.esm.js"
}
3 changes: 2 additions & 1 deletion packages/react/field/package.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"main": "dist/ag.ds-next-react-field.cjs.js"
"main": "dist/ag.ds-next-react-field.cjs.js",
"module": "dist/ag.ds-next-react-field.esm.js"
}
3 changes: 2 additions & 1 deletion packages/react/fieldset/package.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"main": "dist/ag.ds-next-react-fieldset.cjs.js"
"main": "dist/ag.ds-next-react-fieldset.cjs.js",
"module": "dist/ag.ds-next-react-fieldset.esm.js"
}
3 changes: 2 additions & 1 deletion packages/react/file-input/package.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"main": "dist/ag.ds-next-react-file-input.cjs.js"
"main": "dist/ag.ds-next-react-file-input.cjs.js",
"module": "dist/ag.ds-next-react-file-input.esm.js"
}
3 changes: 2 additions & 1 deletion packages/react/file-upload/package.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"main": "dist/ag.ds-next-react-file-upload.cjs.js"
"main": "dist/ag.ds-next-react-file-upload.cjs.js",
"module": "dist/ag.ds-next-react-file-upload.esm.js"
}
3 changes: 2 additions & 1 deletion packages/react/filter-drawer/package.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"main": "dist/ag.ds-next-react-filter-drawer.cjs.js"
"main": "dist/ag.ds-next-react-filter-drawer.cjs.js",
"module": "dist/ag.ds-next-react-filter-drawer.esm.js"
}
3 changes: 2 additions & 1 deletion packages/react/filter-sidebar/package.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"main": "dist/ag.ds-next-react-filter-sidebar.cjs.js"
"main": "dist/ag.ds-next-react-filter-sidebar.cjs.js",
"module": "dist/ag.ds-next-react-filter-sidebar.esm.js"
}
3 changes: 2 additions & 1 deletion packages/react/flex/package.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"main": "dist/ag.ds-next-react-flex.cjs.js"
"main": "dist/ag.ds-next-react-flex.cjs.js",
"module": "dist/ag.ds-next-react-flex.esm.js"
}
3 changes: 2 additions & 1 deletion packages/react/footer/package.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"main": "dist/ag.ds-next-react-footer.cjs.js"
"main": "dist/ag.ds-next-react-footer.cjs.js",
"module": "dist/ag.ds-next-react-footer.esm.js"
}
3 changes: 2 additions & 1 deletion packages/react/form-stack/package.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"main": "dist/ag.ds-next-react-form-stack.cjs.js"
"main": "dist/ag.ds-next-react-form-stack.cjs.js",
"module": "dist/ag.ds-next-react-form-stack.esm.js"
}
3 changes: 2 additions & 1 deletion packages/react/global-alert/package.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"main": "dist/ag.ds-next-react-global-alert.cjs.js"
"main": "dist/ag.ds-next-react-global-alert.cjs.js",
"module": "dist/ag.ds-next-react-global-alert.esm.js"
}
3 changes: 2 additions & 1 deletion packages/react/grouped-fields/package.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"main": "dist/ag.ds-next-react-grouped-fields.cjs.js"
"main": "dist/ag.ds-next-react-grouped-fields.cjs.js",
"module": "dist/ag.ds-next-react-grouped-fields.esm.js"
}
3 changes: 2 additions & 1 deletion packages/react/header/package.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"main": "dist/ag.ds-next-react-header.cjs.js"
"main": "dist/ag.ds-next-react-header.cjs.js",
"module": "dist/ag.ds-next-react-header.esm.js"
}
3 changes: 2 additions & 1 deletion packages/react/heading/package.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"main": "dist/ag.ds-next-react-heading.cjs.js"
"main": "dist/ag.ds-next-react-heading.cjs.js",
"module": "dist/ag.ds-next-react-heading.esm.js"
}
3 changes: 2 additions & 1 deletion packages/react/hero-banner/package.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"main": "dist/ag.ds-next-react-hero-banner.cjs.js"
"main": "dist/ag.ds-next-react-hero-banner.cjs.js",
"module": "dist/ag.ds-next-react-hero-banner.esm.js"
}
3 changes: 2 additions & 1 deletion packages/react/icon/package.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"main": "dist/ag.ds-next-react-icon.cjs.js"
"main": "dist/ag.ds-next-react-icon.cjs.js",
"module": "dist/ag.ds-next-react-icon.esm.js"
}
3 changes: 2 additions & 1 deletion packages/react/indicator-dot/package.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"main": "dist/ag.ds-next-react-indicator-dot.cjs.js"
"main": "dist/ag.ds-next-react-indicator-dot.cjs.js",
"module": "dist/ag.ds-next-react-indicator-dot.esm.js"
}
3 changes: 2 additions & 1 deletion packages/react/inpage-nav/package.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"main": "dist/ag.ds-next-react-inpage-nav.cjs.js"
"main": "dist/ag.ds-next-react-inpage-nav.cjs.js",
"module": "dist/ag.ds-next-react-inpage-nav.esm.js"
}
3 changes: 2 additions & 1 deletion packages/react/link-list/package.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"main": "dist/ag.ds-next-react-link-list.cjs.js"
"main": "dist/ag.ds-next-react-link-list.cjs.js",
"module": "dist/ag.ds-next-react-link-list.esm.js"
}
3 changes: 2 additions & 1 deletion packages/react/list/package.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"main": "dist/ag.ds-next-react-list.cjs.js"
"main": "dist/ag.ds-next-react-list.cjs.js",
"module": "dist/ag.ds-next-react-list.esm.js"
}
3 changes: 2 additions & 1 deletion packages/react/loading/package.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"main": "dist/ag.ds-next-react-loading.cjs.js"
"main": "dist/ag.ds-next-react-loading.cjs.js",
"module": "dist/ag.ds-next-react-loading.esm.js"
}
3 changes: 2 additions & 1 deletion packages/react/main-nav/package.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"main": "dist/ag.ds-next-react-main-nav.cjs.js"
"main": "dist/ag.ds-next-react-main-nav.cjs.js",
"module": "dist/ag.ds-next-react-main-nav.esm.js"
}
3 changes: 2 additions & 1 deletion packages/react/modal/package.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"main": "dist/ag.ds-next-react-modal.cjs.js"
"main": "dist/ag.ds-next-react-modal.cjs.js",
"module": "dist/ag.ds-next-react-modal.esm.js"
}
3 changes: 2 additions & 1 deletion packages/react/notification-badge/package.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"main": "dist/ag.ds-next-react-notification-badge.cjs.js"
"main": "dist/ag.ds-next-react-notification-badge.cjs.js",
"module": "dist/ag.ds-next-react-notification-badge.esm.js"
}
Loading
Loading