diff --git a/.circleci/api-comment.js b/.circleci/api-comment.js
index 262d449daa3..fb30bca8c69 100644
--- a/.circleci/api-comment.js
+++ b/.circleci/api-comment.js
@@ -53,7 +53,13 @@ async function run() {
if (pr != null) {
let commentId = await findDifferComment(pr);
- let diffs = fs.readFileSync('/tmp/dist/ts-diff.txt');
+ let diffs;
+ try {
+ diffs = fs.readFileSync('/tmp/dist/ts-diff.txt');
+ } catch (e) {
+ console.log('No TS Diff output to run on.')
+ return;
+ }
if (diffs.length > 0) {
if (commentId != null) {
// delete existing comment
diff --git a/.circleci/config.yml b/.circleci/config.yml
index bb0d6195bd8..5665d79bf6b 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -27,6 +27,14 @@ executors:
CACHE_VERSION: v1
working_directory: ~/react-spectrum
+ rsp-xlarge-nodeupdate:
+ docker:
+ - image: cimg/node:16.18.0
+ resource_class: xlarge
+ environment:
+ CACHE_VERSION: v1
+ working_directory: ~/react-spectrum
+
jobs:
install:
executor: rsp-large
@@ -206,6 +214,20 @@ jobs:
- store_artifacts:
path: ~/junit
+
+ test-esm:
+ executor: rsp-xlarge-nodeupdate
+ steps:
+ - restore_cache:
+ key: react-spectrum-{{ .Environment.CACHE_VERSION }}-{{ .Environment.CIRCLE_SHA1 }}
+
+ - run:
+ name: test
+ command: |
+ make build
+ yarn lerna run prepublishOnly
+ node --loader ./scripts/esm-support/loader.mjs ./scripts/esm-support/testESM.mjs
+
lint:
executor: rsp
steps:
@@ -451,6 +473,9 @@ workflows:
- test-17:
requires:
- install-17
+ - test-esm:
+ requires:
+ - install
- lint:
requires:
- install
@@ -506,6 +531,7 @@ workflows:
- test-16
- test-ssr-17
- test-17
+ - test-esm
- storybook
- storybook-16
- storybook-17
diff --git a/Makefile b/Makefile
index 0a13d2dd222..be03b0a2d52 100644
--- a/Makefile
+++ b/Makefile
@@ -83,6 +83,12 @@ publish-nightly: build
build:
parcel build packages/@react-{spectrum,aria,stately}/*/ packages/@internationalized/{message,string,date,number}/ --no-optimize
+ yarn lerna run prepublishOnly
+ for pkg in packages/@react-{spectrum,aria,stately}/*/ packages/@internationalized/{message,string,date,number}/ packages/@adobe/react-spectrum/ packages/react-aria/ packages/react-stately/; \
+ do cp $$pkg/dist/module.js $$pkg/dist/import.mjs; \
+ done
+ sed -i.bak s/\.js/\.mjs/ packages/@react-aria/i18n/dist/import.mjs
+ rm packages/@react-aria/i18n/dist/import.mjs.bak
website:
yarn build:docs --public-url /reactspectrum/$$(git rev-parse HEAD)/docs --dist-dir dist/$$(git rev-parse HEAD)/docs
diff --git a/babel-esm.config.json b/babel-esm.config.json
new file mode 100644
index 00000000000..cb8c7529066
--- /dev/null
+++ b/babel-esm.config.json
@@ -0,0 +1,61 @@
+{
+ "presets": [
+ "@babel/preset-typescript",
+ "@babel/preset-react",
+ ["@babel/preset-env",
+ {
+ "loose": true,
+ "modules": false
+ }
+ ]
+ ],
+ "env": {
+ "storybook": {
+ "presets": [
+ [
+ "@babel/preset-env",
+ {
+ "loose": true,
+ "targets": {
+ "esmodules": true
+ }
+ }
+ ]
+ ]
+ },
+ "cover": {
+ "plugins": [
+ "istanbul"
+ ]
+ },
+ "production": {
+ "plugins": [
+ [
+ "react-remove-properties",
+ {
+ "properties": [
+ "data-testid"
+ ]
+ }
+ ]
+ ]
+ }
+ },
+ "plugins": [
+ [
+ "@babel/plugin-transform-runtime",
+ {
+ "version": "^7.6.2"
+ }
+ ],
+ [
+ "@babel/plugin-proposal-decorators",
+ {
+ "legacy": true
+ }
+ ],
+ "transform-glob-import",
+ "babel-plugin-macros"
+ ],
+ "sourceType": "unambiguous"
+}
diff --git a/bin/imports.js b/bin/imports.js
index 7569f5595f0..5e0fd9e64a1 100644
--- a/bin/imports.js
+++ b/bin/imports.js
@@ -16,73 +16,78 @@ const fs = require('fs');
const Module = require('module');
const substrings = ['-', '+'];
-module.exports = function (context) {
- let processNode = (node) => {
- if (!node.source || node.importKind === 'type') {
- return;
- }
-
- let source = node.source.value.replace(/^[a-z]+:/, '');
- if (source.startsWith('.') || Module.builtinModules.includes(source)) {
- return;
- }
-
- // Split the import specifier on slashes. If it starts with an @ then it's
- // a scoped package, otherwise just take the first part.
- let parts = source.split('/');
- let pkgName = source.startsWith('@') ? parts.slice(0, 2).join('/') : parts[0];
-
- // Search for a package.json starting from the current filename
- let pkgPath = findUp.sync('package.json', {cwd: path.dirname(context.getFilename())});
- if (!pkgPath) {
- return;
- }
-
- let pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf8'));
-
- // The only dev dependency should be spectrum-css.
- if (exists(pkg.devDependencies, pkgName) && pkgName === '@adobe/spectrum-css-temp') {
- return;
- }
-
- if (!exists(pkg.dependencies, pkgName) && !exists(pkg.peerDependencies, pkgName)) {
- context.report({
- node,
- message: `Missing dependency on ${pkgName}.`,
- fix(fixer) {
- // Attempt to find a package in the monorepo. If the dep is for an external library,
- // then we cannot auto fix it because we don't know the version to add.
- let depPath = __dirname + '/../packages/' + pkgName + '/package.json';
- if (!fs.existsSync(depPath)) {
- return;
+module.exports = {
+ meta: {
+ fixable: 'code'
+ },
+ create: function (context) {
+ let processNode = (node) => {
+ if (!node.source || node.importKind === 'type') {
+ return;
+ }
+
+ let source = node.source.value.replace(/^[a-z]+:/, '');
+ if (source.startsWith('.') || Module.builtinModules.includes(source)) {
+ return;
+ }
+
+ // Split the import specifier on slashes. If it starts with an @ then it's
+ // a scoped package, otherwise just take the first part.
+ let parts = source.split('/');
+ let pkgName = source.startsWith('@') ? parts.slice(0, 2).join('/') : parts[0];
+
+ // Search for a package.json starting from the current filename
+ let pkgPath = findUp.sync('package.json', {cwd: path.dirname(context.getFilename())});
+ if (!pkgPath) {
+ return;
+ }
+
+ let pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf8'));
+
+ // The only dev dependency should be spectrum-css.
+ if (exists(pkg.devDependencies, pkgName) && pkgName === '@adobe/spectrum-css-temp') {
+ return;
+ }
+
+ if (!exists(pkg.dependencies, pkgName) && !exists(pkg.peerDependencies, pkgName) && pkgName !== pkg.name) {
+ context.report({
+ node,
+ message: `Missing dependency on ${pkgName}.`,
+ fix(fixer) {
+ // Attempt to find a package in the monorepo. If the dep is for an external library,
+ // then we cannot auto fix it because we don't know the version to add.
+ let depPath = __dirname + '/../packages/' + pkgName + '/package.json';
+ if (!fs.existsSync(depPath)) {
+ return;
+ }
+
+ let depPkg = JSON.parse(fs.readFileSync(depPath, 'utf8'));
+ let pkgVersion = substrings.some(v => depPkg.version.includes(v)) ? depPkg.version : `^${depPkg.version}`;
+
+ if (pkgName === '@react-spectrum/provider') {
+ pkg.peerDependencies = insertObject(pkg.peerDependencies, pkgName, pkgVersion);
+ } else {
+ pkg.dependencies = insertObject(pkg.dependencies, pkgName, pkgVersion);
+ }
+
+ fs.writeFileSync(pkgPath, JSON.stringify(pkg, false, 2) + '\n');
+
+ // Fake fix so eslint doesn't show the error.
+ return {
+ range: [0, 0],
+ text: ''
+ };
}
-
- let depPkg = JSON.parse(fs.readFileSync(depPath, 'utf8'));
- let pkgVersion = substrings.some(v => depPkg.version.includes(v)) ? depPkg.version : `^${depPkg.version}`;
-
- if (pkgName === '@react-spectrum/provider') {
- pkg.peerDependencies = insertObject(pkg.peerDependencies, pkgName, pkgVersion);
- } else {
- pkg.dependencies = insertObject(pkg.dependencies, pkgName, pkgVersion);
- }
-
- fs.writeFileSync(pkgPath, JSON.stringify(pkg, false, 2) + '\n');
-
- // Fake fix so eslint doesn't show the error.
- return {
- range: [0, 0],
- text: ''
- };
- }
- });
- }
- };
-
- return {
- ImportDeclaration: processNode,
- ExportNamedDeclaration: processNode,
- ExportAllDeclaration: processNode
- };
+ });
+ }
+ };
+
+ return {
+ ImportDeclaration: processNode,
+ ExportNamedDeclaration: processNode,
+ ExportAllDeclaration: processNode
+ };
+ }
};
function exists(deps, name) {
diff --git a/examples/rsp-next-ts/next.config.js b/examples/rsp-next-ts/next.config.mjs
similarity index 98%
rename from examples/rsp-next-ts/next.config.js
rename to examples/rsp-next-ts/next.config.mjs
index 3bc91f3b24d..aed16861c6f 100644
--- a/examples/rsp-next-ts/next.config.js
+++ b/examples/rsp-next-ts/next.config.mjs
@@ -1,4 +1,4 @@
-module.exports = {
+export default {
transpilePackages: [
"@adobe/react-spectrum",
"@react-spectrum/actiongroup",
diff --git a/examples/rsp-next-ts/package.json b/examples/rsp-next-ts/package.json
index d1526ea5424..937bc041921 100644
--- a/examples/rsp-next-ts/package.json
+++ b/examples/rsp-next-ts/package.json
@@ -10,6 +10,7 @@
"start": "next start",
"lint": "next lint"
},
+ "type": "module",
"dependencies": {
"@adobe/react-spectrum": "^3.22.0",
"@react-spectrum/color": "^3.0.0-beta.16",
diff --git a/examples/rsp-webpack-4/.babelrc b/examples/rsp-webpack-4/.babelrc
new file mode 100644
index 00000000000..0dce8c0afe5
--- /dev/null
+++ b/examples/rsp-webpack-4/.babelrc
@@ -0,0 +1,3 @@
+{
+ "presets": ["@babel/env", "@babel/preset-react"]
+}
diff --git a/examples/rsp-webpack-4/jest.config.js b/examples/rsp-webpack-4/jest.config.js
new file mode 100644
index 00000000000..5dfb1591f16
--- /dev/null
+++ b/examples/rsp-webpack-4/jest.config.js
@@ -0,0 +1,5 @@
+module.exports = {
+ moduleNameMapper: {
+ '\\.(css|styl)$': 'identity-obj-proxy'
+ }
+};
diff --git a/examples/rsp-webpack-4/package.json b/examples/rsp-webpack-4/package.json
new file mode 100644
index 00000000000..68b4f7798c9
--- /dev/null
+++ b/examples/rsp-webpack-4/package.json
@@ -0,0 +1,34 @@
+{
+ "name": "rsp-cra-18-webpack-4",
+ "version": "1.0.0",
+ "description": "test esm with webpack 4",
+ "main": "src/index.jsx",
+ "scripts": {
+ "build": "webpack --mode production",
+ "start": "webpack-dev-server --mode development --open",
+ "test": "test"
+ },
+ "private": true,
+ "workspaces": [
+ "../../packages/*/*"
+ ],
+ "dependencies": {
+ "@adobe/react-spectrum": "^3.24.1",
+ "@spectrum-icons/workflow": "^4.0.6",
+ "react": "^18.2.0",
+ "react-dom": "^18.2.0"
+ },
+ "devDependencies": {
+ "@babel/core": "^7.1.0",
+ "@babel/cli": "^7.1.0",
+ "@babel/preset-env": "^7.1.0",
+ "@babel/preset-react": "^7.0.0",
+ "webpack": "4.19.1",
+ "webpack-cli": "3.1.1",
+ "webpack-dev-server": "3.1.8",
+ "style-loader": "0.23.0",
+ "css-loader": "1.0.0",
+ "babel-loader": "8.0.2",
+ "jest": "^26"
+ }
+}
diff --git a/examples/rsp-webpack-4/src/App.css b/examples/rsp-webpack-4/src/App.css
new file mode 100644
index 00000000000..b6b369d5d05
--- /dev/null
+++ b/examples/rsp-webpack-4/src/App.css
@@ -0,0 +1,22 @@
+body{
+ height: 100%;
+}
+
+.no-bullets{
+ list-style-type: none;
+ padding: 0px;
+}
+
+#root{
+ padding: 0;
+ margin: 0;
+ height: 100%;
+}
+
+html {
+ height: 100%;
+}
+
+.content-padding{
+ padding: 50px;
+}
\ No newline at end of file
diff --git a/examples/rsp-webpack-4/src/App.js b/examples/rsp-webpack-4/src/App.js
new file mode 100644
index 00000000000..165489e8d80
--- /dev/null
+++ b/examples/rsp-webpack-4/src/App.js
@@ -0,0 +1,22 @@
+import './App.css';
+import {Provider, defaultTheme} from '@adobe/react-spectrum'
+import Lighting from './Lighting';
+import {useState} from 'react'
+import BodyContent from './BodyContent';
+
+function App() {
+ let [selected, setSelection] = useState(false);
+
+ return (
+
+
+
+
+
+
+ );
+}
+
+export default App;
diff --git a/examples/rsp-webpack-4/src/BodyContent.js b/examples/rsp-webpack-4/src/BodyContent.js
new file mode 100644
index 00000000000..8b7581a696d
--- /dev/null
+++ b/examples/rsp-webpack-4/src/BodyContent.js
@@ -0,0 +1,106 @@
+import {useState, useRef} from "react";
+import {Item, TabList, TabPanels, Tabs} from '@adobe/react-spectrum'
+import TodoList from './TodoList';
+import JournalList from './JournalList';
+
+
+function BodyContent(){
+
+ //states for the To-Do list
+ const [list, setList] = useState([]);
+ const [value, setValue] = useState('');
+ const [completed, setCompleted] = useState([]);
+ const count = useRef(0);
+
+ //states for journal entries
+ const [rating, setRating] = useState('');
+ const [entryList, setEntryList] = useState([]);
+ const [description, setDescription] = useState('');
+ const countJournals = useRef(0);
+
+ const options = [
+ {id: "Bad", name: "Bad"},
+ {id: "Okay", name: "Okay"},
+ {id: "Good", name: "Good"},
+ {id: "Great", name: "Great"}
+ ]
+
+ //functions for the To-Do list
+ function handleSubmitToDo(e){
+ e.preventDefault()
+
+ if (value.length > 0){
+ setList(prevListArray => {
+ return [
+ ...prevListArray,
+ {id: count.current, task: value}]
+ })
+
+ count.current = count.current + 1;
+ }
+ setValue(""); //clears text field on submit
+ }
+
+ function updateCompleted(complete){
+ setCompleted(prevListArray => {
+ return [
+ ...prevListArray,
+ {id: prevListArray.length, task: complete}]
+ });
+ }
+
+ function clearCompleted(){
+ setCompleted(() => {
+ return [];
+ })
+ }
+
+ //functions for journal entries
+ function handleSubmitJournals(e){
+ e.preventDefault()
+
+ countJournals.current = countJournals.current + 1; //used to determine key for each item in the entryList array
+
+ setEntryList(prevListArray => {
+ return [
+ ...prevListArray,
+ {rate: rating, description: description, id: countJournals.current}
+ ]
+ })
+
+ setValue('') //clears the text area when submitted
+ }
+
+ return(
+
+
+
+ - To-do List
+ - Daily Journal
+
+
+ -
+
+
+ -
+
+
+
+
+ )
+}
+
+export default BodyContent;
diff --git a/examples/rsp-webpack-4/src/Completed.js b/examples/rsp-webpack-4/src/Completed.js
new file mode 100644
index 00000000000..d36268fb0f5
--- /dev/null
+++ b/examples/rsp-webpack-4/src/Completed.js
@@ -0,0 +1,37 @@
+import Delete from '@spectrum-icons/workflow/Delete';
+import {AlertDialog, DialogTrigger, ActionButton} from '@adobe/react-spectrum'
+import {Checkbox} from '@adobe/react-spectrum'
+import {Flex} from '@adobe/react-spectrum'
+
+function Completed(props){
+
+ const elements = props.completed.map(item => (
+ {item.task}
+ ))
+
+ let alertCancel = () => alert('Cancel button pressed.');
+
+ return (
+
+ {elements}
+
+
+
+
+
+ Are you sure you want to delete the completed tasks?
+
+
+
+
+ )
+}
+
+export default Completed;
diff --git a/examples/rsp-webpack-4/src/JournalEntries.js b/examples/rsp-webpack-4/src/JournalEntries.js
new file mode 100644
index 00000000000..b76dea74452
--- /dev/null
+++ b/examples/rsp-webpack-4/src/JournalEntries.js
@@ -0,0 +1,23 @@
+import {Flex, Divider} from '@adobe/react-spectrum'
+
+function JournalEntries(props){
+
+ const element = props.list.map(item => (
+
+
+ Your day was: {item.rate}
+ {item.description}
+
+
+ ))
+
+ return (
+
+
+
+ )
+}
+
+export default JournalEntries;
diff --git a/examples/rsp-webpack-4/src/JournalList.js b/examples/rsp-webpack-4/src/JournalList.js
new file mode 100644
index 00000000000..9e5b2cf546d
--- /dev/null
+++ b/examples/rsp-webpack-4/src/JournalList.js
@@ -0,0 +1,32 @@
+import AddCircle from '@spectrum-icons/workflow/AddCircle';
+import {Flex, Text, Button, Form, TextArea, Picker, Item, Divider} from '@adobe/react-spectrum'
+import JournalEntries from './JournalEntries'
+
+function JournalList(props){
+ return(
+ <>
+
+
+ Entries
+
+ >
+ )
+}
+
+export default JournalList;
diff --git a/examples/rsp-webpack-4/src/Lighting.js b/examples/rsp-webpack-4/src/Lighting.js
new file mode 100644
index 00000000000..129f3710ceb
--- /dev/null
+++ b/examples/rsp-webpack-4/src/Lighting.js
@@ -0,0 +1,14 @@
+import {Switch} from '@adobe/react-spectrum'
+
+function Lighting(props) {
+
+ let mode = props.selected ? "Light Mode" : "Dark Mode";
+ return (
+
+ {mode}
+
+ );
+ }
+
+
+export default Lighting;
diff --git a/examples/rsp-webpack-4/src/ToDoItems.js b/examples/rsp-webpack-4/src/ToDoItems.js
new file mode 100644
index 00000000000..2b0e326c7d9
--- /dev/null
+++ b/examples/rsp-webpack-4/src/ToDoItems.js
@@ -0,0 +1,35 @@
+import {CheckboxGroup, Checkbox, Flex} from '@adobe/react-spectrum'
+
+
+function TodoItems(props) {
+
+ function removeItem(id){
+
+ //add selected item to the completed list
+ const found = props.list.find(element => element.id === id)
+ if (found){
+ props.updateCompleted(found.task);
+ }
+
+ //remove the item from the list
+ props.handleList(props.list.filter(item => item.id !== id));
+ }
+
+ const elements = props.list.map(item => (
+ removeItem(item.id)}
+ key={item.id}
+ value={item.task}>
+ {item.task}
+
+ ))
+
+ return (
+
+
+ {elements}
+
+
+ );
+}
+
+export default TodoItems;
diff --git a/examples/rsp-webpack-4/src/TodoList.js b/examples/rsp-webpack-4/src/TodoList.js
new file mode 100644
index 00000000000..281e8727bae
--- /dev/null
+++ b/examples/rsp-webpack-4/src/TodoList.js
@@ -0,0 +1,33 @@
+import './App.css';
+import {Flex, TextField, Button, Form, Divider} from '@adobe/react-spectrum'
+import ToDoItems from "./ToDoItems"
+import Completed from "./Completed"
+
+
+function TodoList(props){
+
+ return (
+ <>
+
+
+ Completed
+
+ >
+ );
+}
+
+export default TodoList;
diff --git a/examples/rsp-webpack-4/src/index.css b/examples/rsp-webpack-4/src/index.css
new file mode 100644
index 00000000000..ec2585e8c0b
--- /dev/null
+++ b/examples/rsp-webpack-4/src/index.css
@@ -0,0 +1,13 @@
+body {
+ margin: 0;
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
+ 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
+ sans-serif;
+ -webkit-font-smoothing: antialiased;
+ -moz-osx-font-smoothing: grayscale;
+}
+
+code {
+ font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
+ monospace;
+}
diff --git a/examples/rsp-webpack-4/src/index.js b/examples/rsp-webpack-4/src/index.js
new file mode 100644
index 00000000000..e1271467e11
--- /dev/null
+++ b/examples/rsp-webpack-4/src/index.js
@@ -0,0 +1,11 @@
+import React from 'react';
+import ReactDOM from 'react-dom/client';
+import './index.css';
+import App from './App';
+
+const root = ReactDOM.createRoot(
+ document.getElementById('root')
+);
+root.render(
+
+);
diff --git a/examples/rsp-webpack-4/test/index.test.js b/examples/rsp-webpack-4/test/index.test.js
new file mode 100644
index 00000000000..af8a0ae55bb
--- /dev/null
+++ b/examples/rsp-webpack-4/test/index.test.js
@@ -0,0 +1,10 @@
+import Add from '@spectrum-icons/workflow/Add';
+import assert from 'assert';
+import {Button} from '@adobe/react-spectrum';
+
+describe('test', () => {
+ it('should work', () => {
+ assert.equal(typeof Button.render, 'function');
+ assert.equal(typeof Add, 'function');
+ });
+});
diff --git a/examples/rsp-webpack-4/webpack.config.js b/examples/rsp-webpack-4/webpack.config.js
new file mode 100644
index 00000000000..3b55e512ba3
--- /dev/null
+++ b/examples/rsp-webpack-4/webpack.config.js
@@ -0,0 +1,34 @@
+
+const path = require("path");
+const webpack = require("webpack");
+
+module.exports = {
+ entry: "./src/index.js",
+ mode: "development",
+ module: {
+ rules: [
+ {
+ test: /\.(js|jsx|ts|tsx)$/,
+ exclude: /(node_modules|bower_components)/,
+ loader: "babel-loader",
+ options: { presets: ["@babel/env"] }
+ },
+ {
+ test: /\.css$/,
+ use: ["style-loader", "css-loader"]
+ }
+ ]
+ },
+ output: {
+ path: path.resolve(__dirname, "dist/"),
+ publicPath: "/dist/",
+ filename: "bundle.js"
+ },
+ devServer: {
+ contentBase: path.join(__dirname, "public/"),
+ port: 3000,
+ publicPath: "http://localhost:3000/dist/",
+ hotOnly: true
+ },
+ plugins: [new webpack.HotModuleReplacementPlugin()]
+};
diff --git a/package.json b/package.json
index 3d3c5cba391..cafae70b506 100644
--- a/package.json
+++ b/package.json
@@ -105,6 +105,7 @@
"core-js": "^3.0.0",
"cross-env": "^7.0.2",
"cross-spawn": "^7.0.3",
+ "css-parse": "^2.0.0",
"delta-e": "^0.0.8",
"diff": "^5.1.0",
"eslint": "^8.25.0",
diff --git a/packages/@adobe/react-spectrum/package.json b/packages/@adobe/react-spectrum/package.json
index 85fde172bd7..2666560aef6 100644
--- a/packages/@adobe/react-spectrum/package.json
+++ b/packages/@adobe/react-spectrum/package.json
@@ -5,6 +5,11 @@
"license": "Apache-2.0",
"main": "dist/main.js",
"module": "dist/module.js",
+ "exports": {
+ "types": "./dist/types.d.ts",
+ "import": "./dist/import.mjs",
+ "require": "./dist/main.js"
+ },
"types": "dist/types.d.ts",
"source": "src/index.ts",
"files": [
diff --git a/packages/@internationalized/date/package.json b/packages/@internationalized/date/package.json
index 48ca06accc5..05976d70a15 100644
--- a/packages/@internationalized/date/package.json
+++ b/packages/@internationalized/date/package.json
@@ -5,6 +5,11 @@
"license": "Apache-2.0",
"main": "dist/main.js",
"module": "dist/module.js",
+ "exports": {
+ "types": "./dist/types.d.ts",
+ "import": "./dist/import.mjs",
+ "require": "./dist/main.js"
+ },
"types": "dist/types.d.ts",
"source": "src/index.ts",
"files": [
diff --git a/packages/@internationalized/message/package.json b/packages/@internationalized/message/package.json
index 9952a98be9c..e6608ef9d44 100644
--- a/packages/@internationalized/message/package.json
+++ b/packages/@internationalized/message/package.json
@@ -5,6 +5,11 @@
"license": "Apache-2.0",
"main": "dist/main.js",
"module": "dist/module.js",
+ "exports": {
+ "types": "./dist/types.d.ts",
+ "import": "./dist/import.mjs",
+ "require": "./dist/main.js"
+ },
"types": "dist/types.d.ts",
"source": "src/index.ts",
"files": [
diff --git a/packages/@internationalized/number/package.json b/packages/@internationalized/number/package.json
index 5d3bb074032..79e1796f300 100644
--- a/packages/@internationalized/number/package.json
+++ b/packages/@internationalized/number/package.json
@@ -5,6 +5,11 @@
"license": "Apache-2.0",
"main": "dist/main.js",
"module": "dist/module.js",
+ "exports": {
+ "types": "./dist/types.d.ts",
+ "import": "./dist/import.mjs",
+ "require": "./dist/main.js"
+ },
"types": "dist/types.d.ts",
"source": "src/index.ts",
"files": [
diff --git a/packages/@internationalized/string/package.json b/packages/@internationalized/string/package.json
index b8f2ab39480..0015f8251b6 100644
--- a/packages/@internationalized/string/package.json
+++ b/packages/@internationalized/string/package.json
@@ -5,6 +5,11 @@
"license": "Apache-2.0",
"main": "dist/main.js",
"module": "dist/module.js",
+ "exports": {
+ "types": "./dist/types.d.ts",
+ "import": "./dist/import.mjs",
+ "require": "./dist/main.js"
+ },
"types": "dist/types.d.ts",
"source": "src/index.ts",
"files": [
diff --git a/packages/@react-aria/accordion/package.json b/packages/@react-aria/accordion/package.json
index 230d89140de..f24373f59e2 100644
--- a/packages/@react-aria/accordion/package.json
+++ b/packages/@react-aria/accordion/package.json
@@ -5,6 +5,11 @@
"license": "Apache-2.0",
"main": "dist/main.js",
"module": "dist/module.js",
+ "exports": {
+ "types": "./dist/types.d.ts",
+ "import": "./dist/import.mjs",
+ "require": "./dist/main.js"
+ },
"types": "dist/types.d.ts",
"source": "src/index.ts",
"files": [
diff --git a/packages/@react-aria/actiongroup/package.json b/packages/@react-aria/actiongroup/package.json
index 6ef7fa364c2..89004fda3c1 100644
--- a/packages/@react-aria/actiongroup/package.json
+++ b/packages/@react-aria/actiongroup/package.json
@@ -5,6 +5,11 @@
"license": "Apache-2.0",
"main": "dist/main.js",
"module": "dist/module.js",
+ "exports": {
+ "types": "./dist/types.d.ts",
+ "import": "./dist/import.mjs",
+ "require": "./dist/main.js"
+ },
"types": "dist/types.d.ts",
"source": "src/index.ts",
"files": [
diff --git a/packages/@react-aria/aria-modal-polyfill/package.json b/packages/@react-aria/aria-modal-polyfill/package.json
index a3440881d8a..afc211535bf 100644
--- a/packages/@react-aria/aria-modal-polyfill/package.json
+++ b/packages/@react-aria/aria-modal-polyfill/package.json
@@ -5,6 +5,11 @@
"license": "Apache-2.0",
"main": "dist/main.js",
"module": "dist/module.js",
+ "exports": {
+ "types": "./dist/types.d.ts",
+ "import": "./dist/import.mjs",
+ "require": "./dist/main.js"
+ },
"types": "dist/types.d.ts",
"source": "src/index.ts",
"files": [
diff --git a/packages/@react-aria/autocomplete/package.json b/packages/@react-aria/autocomplete/package.json
index 78705c1b0a9..07ab0308555 100644
--- a/packages/@react-aria/autocomplete/package.json
+++ b/packages/@react-aria/autocomplete/package.json
@@ -5,6 +5,11 @@
"license": "Apache-2.0",
"main": "dist/main.js",
"module": "dist/module.js",
+ "exports": {
+ "types": "./dist/types.d.ts",
+ "import": "./dist/import.mjs",
+ "require": "./dist/main.js"
+ },
"types": "dist/types.d.ts",
"source": "src/index.ts",
"files": [
diff --git a/packages/@react-aria/breadcrumbs/package.json b/packages/@react-aria/breadcrumbs/package.json
index 7c0777eb7fe..a929871ec8b 100644
--- a/packages/@react-aria/breadcrumbs/package.json
+++ b/packages/@react-aria/breadcrumbs/package.json
@@ -5,6 +5,11 @@
"license": "Apache-2.0",
"main": "dist/main.js",
"module": "dist/module.js",
+ "exports": {
+ "types": "./dist/types.d.ts",
+ "import": "./dist/import.mjs",
+ "require": "./dist/main.js"
+ },
"types": "dist/types.d.ts",
"source": "src/index.ts",
"files": [
diff --git a/packages/@react-aria/button/package.json b/packages/@react-aria/button/package.json
index 2941692330f..3abf9f46831 100644
--- a/packages/@react-aria/button/package.json
+++ b/packages/@react-aria/button/package.json
@@ -5,6 +5,11 @@
"license": "Apache-2.0",
"main": "dist/main.js",
"module": "dist/module.js",
+ "exports": {
+ "types": "./dist/types.d.ts",
+ "import": "./dist/import.mjs",
+ "require": "./dist/main.js"
+ },
"types": "dist/types.d.ts",
"source": "src/index.ts",
"files": [
diff --git a/packages/@react-aria/calendar/package.json b/packages/@react-aria/calendar/package.json
index 2dd759c6493..89c98a446c0 100644
--- a/packages/@react-aria/calendar/package.json
+++ b/packages/@react-aria/calendar/package.json
@@ -5,6 +5,11 @@
"license": "Apache-2.0",
"main": "dist/main.js",
"module": "dist/module.js",
+ "exports": {
+ "types": "./dist/types.d.ts",
+ "import": "./dist/import.mjs",
+ "require": "./dist/main.js"
+ },
"types": "dist/types.d.ts",
"source": "src/index.ts",
"files": [
diff --git a/packages/@react-aria/checkbox/package.json b/packages/@react-aria/checkbox/package.json
index 6bc0c08dae2..d814e2fd284 100644
--- a/packages/@react-aria/checkbox/package.json
+++ b/packages/@react-aria/checkbox/package.json
@@ -5,6 +5,11 @@
"license": "Apache-2.0",
"main": "dist/main.js",
"module": "dist/module.js",
+ "exports": {
+ "types": "./dist/types.d.ts",
+ "import": "./dist/import.mjs",
+ "require": "./dist/main.js"
+ },
"types": "dist/types.d.ts",
"source": "src/index.ts",
"files": [
diff --git a/packages/@react-aria/color/package.json b/packages/@react-aria/color/package.json
index 01c78a23320..7f71f89c5eb 100644
--- a/packages/@react-aria/color/package.json
+++ b/packages/@react-aria/color/package.json
@@ -5,6 +5,11 @@
"license": "Apache-2.0",
"main": "dist/main.js",
"module": "dist/module.js",
+ "exports": {
+ "types": "./dist/types.d.ts",
+ "import": "./dist/import.mjs",
+ "require": "./dist/main.js"
+ },
"types": "dist/types.d.ts",
"source": "src/index.ts",
"files": [
diff --git a/packages/@react-aria/combobox/package.json b/packages/@react-aria/combobox/package.json
index ea5510a12a8..412a3458bb2 100644
--- a/packages/@react-aria/combobox/package.json
+++ b/packages/@react-aria/combobox/package.json
@@ -5,6 +5,11 @@
"license": "Apache-2.0",
"main": "dist/main.js",
"module": "dist/module.js",
+ "exports": {
+ "types": "./dist/types.d.ts",
+ "import": "./dist/import.mjs",
+ "require": "./dist/main.js"
+ },
"types": "dist/types.d.ts",
"source": "src/index.ts",
"files": [
diff --git a/packages/@react-aria/datepicker/package.json b/packages/@react-aria/datepicker/package.json
index 701327c30a7..4d97dfd6488 100644
--- a/packages/@react-aria/datepicker/package.json
+++ b/packages/@react-aria/datepicker/package.json
@@ -5,6 +5,11 @@
"license": "Apache-2.0",
"main": "dist/main.js",
"module": "dist/module.js",
+ "exports": {
+ "types": "./dist/types.d.ts",
+ "import": "./dist/import.mjs",
+ "require": "./dist/main.js"
+ },
"types": "dist/types.d.ts",
"source": "src/index.ts",
"files": [
diff --git a/packages/@react-aria/dialog/package.json b/packages/@react-aria/dialog/package.json
index 1db964a38b3..722d344d83b 100644
--- a/packages/@react-aria/dialog/package.json
+++ b/packages/@react-aria/dialog/package.json
@@ -5,6 +5,11 @@
"license": "Apache-2.0",
"main": "dist/main.js",
"module": "dist/module.js",
+ "exports": {
+ "types": "./dist/types.d.ts",
+ "import": "./dist/import.mjs",
+ "require": "./dist/main.js"
+ },
"types": "dist/types.d.ts",
"source": "src/index.ts",
"files": [
diff --git a/packages/@react-aria/dnd/package.json b/packages/@react-aria/dnd/package.json
index 8b2ed82cb30..6d5a0693b39 100644
--- a/packages/@react-aria/dnd/package.json
+++ b/packages/@react-aria/dnd/package.json
@@ -5,6 +5,11 @@
"license": "Apache-2.0",
"main": "dist/main.js",
"module": "dist/module.js",
+ "exports": {
+ "types": "./dist/types.d.ts",
+ "import": "./dist/import.mjs",
+ "require": "./dist/main.js"
+ },
"types": "dist/types.d.ts",
"source": "src/index.ts",
"files": [
diff --git a/packages/@react-aria/focus/package.json b/packages/@react-aria/focus/package.json
index 3c60599396c..c26a907a0e4 100644
--- a/packages/@react-aria/focus/package.json
+++ b/packages/@react-aria/focus/package.json
@@ -5,6 +5,11 @@
"license": "Apache-2.0",
"main": "dist/main.js",
"module": "dist/module.js",
+ "exports": {
+ "types": "./dist/types.d.ts",
+ "import": "./dist/import.mjs",
+ "require": "./dist/main.js"
+ },
"types": "dist/types.d.ts",
"source": "src/index.ts",
"files": [
diff --git a/packages/@react-aria/grid/package.json b/packages/@react-aria/grid/package.json
index 0d3df5614ca..de545a3fd15 100644
--- a/packages/@react-aria/grid/package.json
+++ b/packages/@react-aria/grid/package.json
@@ -5,6 +5,11 @@
"license": "Apache-2.0",
"main": "dist/main.js",
"module": "dist/module.js",
+ "exports": {
+ "types": "./dist/types.d.ts",
+ "import": "./dist/import.mjs",
+ "require": "./dist/main.js"
+ },
"types": "dist/types.d.ts",
"source": "src/index.ts",
"files": [
diff --git a/packages/@react-aria/gridlist/package.json b/packages/@react-aria/gridlist/package.json
index 0f3eacfbf91..ce5ba40d9b8 100644
--- a/packages/@react-aria/gridlist/package.json
+++ b/packages/@react-aria/gridlist/package.json
@@ -5,6 +5,11 @@
"license": "Apache-2.0",
"main": "dist/main.js",
"module": "dist/module.js",
+ "exports": {
+ "types": "./dist/types.d.ts",
+ "import": "./dist/import.mjs",
+ "require": "./dist/main.js"
+ },
"types": "dist/types.d.ts",
"source": "src/index.ts",
"files": [
diff --git a/packages/@react-aria/i18n/package.json b/packages/@react-aria/i18n/package.json
index a6e5faf786f..7580be012b8 100644
--- a/packages/@react-aria/i18n/package.json
+++ b/packages/@react-aria/i18n/package.json
@@ -5,6 +5,11 @@
"license": "Apache-2.0",
"main": "dist/main.js",
"module": "dist/module.js",
+ "exports": {
+ "types": "./dist/types.d.ts",
+ "import": "./dist/import.mjs",
+ "require": "./dist/main.js"
+ },
"real-main": "dist/real-main.js",
"real-module": "dist/real-module.js",
"types": "dist/types.d.ts",
@@ -27,8 +32,8 @@
"./src/useMessageFormatter.ts": false
},
"scripts": {
- "build:module": "yarn babel --presets @babel/preset-typescript src/useMessageFormatter.ts -o dist/useMessageFormatter.module.js && cp src/main.js dist",
- "build:cjs": "yarn babel --presets @babel/preset-typescript,@babel/preset-env src/useMessageFormatter.ts -o dist/useMessageFormatter.cjs.js && cp src/module.js dist",
+ "build:module": "yarn babel --presets @babel/preset-typescript src/useMessageFormatter.ts -o dist/useMessageFormatter.module.js && cp src/module.js dist/module.js && cp dist/real-module.js dist/real-module.mjs && cp dist/real-module.js.map dist/real-module.mjs.map && cp dist/useMessageFormatter.module.js dist/useMessageFormatter.module.mjs",
+ "build:cjs": "yarn babel --presets @babel/preset-typescript,@babel/preset-env src/useMessageFormatter.ts -o dist/useMessageFormatter.js && cp src/main.js dist/main.js",
"prepublishOnly": "yarn build:module && yarn build:cjs"
},
"files": [
diff --git a/packages/@react-aria/i18n/src/main.js b/packages/@react-aria/i18n/src/main.js
index 7c56bc9a6b0..f8e10cd4ee8 100644
--- a/packages/@react-aria/i18n/src/main.js
+++ b/packages/@react-aria/i18n/src/main.js
@@ -3,4 +3,4 @@
// it deopts tree shaking in Parcel even when unused. Instead, it is split into a separate
// file and re-exported here, which allows tree shaking to work properly.
module.exports = require('./real-main.js');
-Object.defineProperties(module.exports, Object.getOwnPropertyDescriptors(require('./useMessageFormatter.cjs.js')));
+Object.defineProperties(module.exports, Object.getOwnPropertyDescriptors(require('./useMessageFormatter.js')));
diff --git a/packages/@react-aria/i18n/src/useMessageFormatter.ts b/packages/@react-aria/i18n/src/useMessageFormatter.ts
index 947c49c502d..85332b3ff08 100644
--- a/packages/@react-aria/i18n/src/useMessageFormatter.ts
+++ b/packages/@react-aria/i18n/src/useMessageFormatter.ts
@@ -12,7 +12,7 @@
import {LocalizedStrings, MessageDictionary, MessageFormatter} from '@internationalized/message';
import {useCallback, useMemo} from 'react';
-import {useLocale} from '../';
+import {useLocale} from '@react-aria/i18n';
export type FormatMessage = (key: string, variables?: {[key: string]: any}) => string;
diff --git a/packages/@react-aria/interactions/package.json b/packages/@react-aria/interactions/package.json
index 21a364d871e..41291d96103 100644
--- a/packages/@react-aria/interactions/package.json
+++ b/packages/@react-aria/interactions/package.json
@@ -5,6 +5,11 @@
"license": "Apache-2.0",
"main": "dist/main.js",
"module": "dist/module.js",
+ "exports": {
+ "types": "./dist/types.d.ts",
+ "import": "./dist/import.mjs",
+ "require": "./dist/main.js"
+ },
"types": "dist/types.d.ts",
"source": "src/index.ts",
"files": [
diff --git a/packages/@react-aria/label/package.json b/packages/@react-aria/label/package.json
index cac1d1787a3..0c620eafdcf 100644
--- a/packages/@react-aria/label/package.json
+++ b/packages/@react-aria/label/package.json
@@ -5,6 +5,11 @@
"license": "Apache-2.0",
"main": "dist/main.js",
"module": "dist/module.js",
+ "exports": {
+ "types": "./dist/types.d.ts",
+ "import": "./dist/import.mjs",
+ "require": "./dist/main.js"
+ },
"types": "dist/types.d.ts",
"source": "src/index.ts",
"files": [
diff --git a/packages/@react-aria/landmark/package.json b/packages/@react-aria/landmark/package.json
index 72dbc6f0649..e7a559a416b 100644
--- a/packages/@react-aria/landmark/package.json
+++ b/packages/@react-aria/landmark/package.json
@@ -5,6 +5,11 @@
"license": "Apache-2.0",
"main": "dist/main.js",
"module": "dist/module.js",
+ "exports": {
+ "types": "./dist/types.d.ts",
+ "import": "./dist/import.mjs",
+ "require": "./dist/main.js"
+ },
"types": "dist/types.d.ts",
"source": "src/index.ts",
"files": [
diff --git a/packages/@react-aria/link/package.json b/packages/@react-aria/link/package.json
index 9508307c095..fd337a61dde 100644
--- a/packages/@react-aria/link/package.json
+++ b/packages/@react-aria/link/package.json
@@ -5,6 +5,11 @@
"license": "Apache-2.0",
"main": "dist/main.js",
"module": "dist/module.js",
+ "exports": {
+ "types": "./dist/types.d.ts",
+ "import": "./dist/import.mjs",
+ "require": "./dist/main.js"
+ },
"types": "dist/types.d.ts",
"source": "src/index.ts",
"files": [
diff --git a/packages/@react-aria/listbox/package.json b/packages/@react-aria/listbox/package.json
index fccd0a51332..e2be2d9d786 100644
--- a/packages/@react-aria/listbox/package.json
+++ b/packages/@react-aria/listbox/package.json
@@ -5,6 +5,11 @@
"license": "Apache-2.0",
"main": "dist/main.js",
"module": "dist/module.js",
+ "exports": {
+ "types": "./dist/types.d.ts",
+ "import": "./dist/import.mjs",
+ "require": "./dist/main.js"
+ },
"types": "dist/types.d.ts",
"source": "src/index.ts",
"files": [
diff --git a/packages/@react-aria/live-announcer/package.json b/packages/@react-aria/live-announcer/package.json
index 6a7ff984399..013ef162872 100644
--- a/packages/@react-aria/live-announcer/package.json
+++ b/packages/@react-aria/live-announcer/package.json
@@ -5,6 +5,11 @@
"license": "Apache-2.0",
"main": "dist/main.js",
"module": "dist/module.js",
+ "exports": {
+ "types": "./dist/types.d.ts",
+ "import": "./dist/import.mjs",
+ "require": "./dist/main.js"
+ },
"types": "dist/types.d.ts",
"source": "src/index.ts",
"files": [
diff --git a/packages/@react-aria/menu/package.json b/packages/@react-aria/menu/package.json
index 3c994367772..dab5ab5ad73 100644
--- a/packages/@react-aria/menu/package.json
+++ b/packages/@react-aria/menu/package.json
@@ -5,6 +5,11 @@
"license": "Apache-2.0",
"main": "dist/main.js",
"module": "dist/module.js",
+ "exports": {
+ "types": "./dist/types.d.ts",
+ "import": "./dist/import.mjs",
+ "require": "./dist/main.js"
+ },
"types": "dist/types.d.ts",
"source": "src/index.ts",
"files": [
diff --git a/packages/@react-aria/meter/package.json b/packages/@react-aria/meter/package.json
index 0d4ee80b838..9f9f8fe32dc 100644
--- a/packages/@react-aria/meter/package.json
+++ b/packages/@react-aria/meter/package.json
@@ -5,6 +5,11 @@
"license": "Apache-2.0",
"main": "dist/main.js",
"module": "dist/module.js",
+ "exports": {
+ "types": "./dist/types.d.ts",
+ "import": "./dist/import.mjs",
+ "require": "./dist/main.js"
+ },
"types": "dist/types.d.ts",
"source": "src/index.ts",
"files": [
diff --git a/packages/@react-aria/numberfield/package.json b/packages/@react-aria/numberfield/package.json
index 524bd3c81e5..5b7a77ed311 100644
--- a/packages/@react-aria/numberfield/package.json
+++ b/packages/@react-aria/numberfield/package.json
@@ -5,6 +5,11 @@
"license": "Apache-2.0",
"main": "dist/main.js",
"module": "dist/module.js",
+ "exports": {
+ "types": "./dist/types.d.ts",
+ "import": "./dist/import.mjs",
+ "require": "./dist/main.js"
+ },
"types": "dist/types.d.ts",
"source": "src/index.ts",
"files": [
diff --git a/packages/@react-aria/overlays/package.json b/packages/@react-aria/overlays/package.json
index 4294d1a7b6b..232654a2bba 100644
--- a/packages/@react-aria/overlays/package.json
+++ b/packages/@react-aria/overlays/package.json
@@ -5,6 +5,11 @@
"license": "Apache-2.0",
"main": "dist/main.js",
"module": "dist/module.js",
+ "exports": {
+ "types": "./dist/types.d.ts",
+ "import": "./dist/import.mjs",
+ "require": "./dist/main.js"
+ },
"types": "dist/types.d.ts",
"source": "src/index.ts",
"files": [
diff --git a/packages/@react-aria/pagination/package.json b/packages/@react-aria/pagination/package.json
index 16e62d03405..2c54fb74c99 100644
--- a/packages/@react-aria/pagination/package.json
+++ b/packages/@react-aria/pagination/package.json
@@ -6,6 +6,11 @@
"private": true,
"main": "dist/main.js",
"module": "dist/module.js",
+ "exports": {
+ "types": "./dist/types.d.ts",
+ "import": "./dist/import.mjs",
+ "require": "./dist/main.js"
+ },
"types": "dist/types.d.ts",
"source": "src/index.ts",
"files": [
diff --git a/packages/@react-aria/progress/package.json b/packages/@react-aria/progress/package.json
index 4ee1873c5e4..aec09d7f7e9 100644
--- a/packages/@react-aria/progress/package.json
+++ b/packages/@react-aria/progress/package.json
@@ -5,6 +5,11 @@
"license": "Apache-2.0",
"main": "dist/index.js",
"module": "dist/module.js",
+ "exports": {
+ "types": "./dist/types.d.ts",
+ "import": "./dist/import.mjs",
+ "require": "./dist/index.js"
+ },
"types": "dist/types.d.ts",
"source": "src/index.ts",
"files": [
diff --git a/packages/@react-aria/radio/package.json b/packages/@react-aria/radio/package.json
index ca7549eef51..b10477e60ae 100644
--- a/packages/@react-aria/radio/package.json
+++ b/packages/@react-aria/radio/package.json
@@ -5,6 +5,11 @@
"license": "Apache-2.0",
"main": "dist/main.js",
"module": "dist/module.js",
+ "exports": {
+ "types": "./dist/types.d.ts",
+ "import": "./dist/import.mjs",
+ "require": "./dist/main.js"
+ },
"types": "dist/types.d.ts",
"source": "src/index.ts",
"files": [
diff --git a/packages/@react-aria/searchfield/package.json b/packages/@react-aria/searchfield/package.json
index f6d97101778..660c87ff467 100644
--- a/packages/@react-aria/searchfield/package.json
+++ b/packages/@react-aria/searchfield/package.json
@@ -5,6 +5,11 @@
"license": "Apache-2.0",
"main": "dist/main.js",
"module": "dist/module.js",
+ "exports": {
+ "types": "./dist/types.d.ts",
+ "import": "./dist/import.mjs",
+ "require": "./dist/main.js"
+ },
"types": "dist/types.d.ts",
"source": "src/index.ts",
"files": [
diff --git a/packages/@react-aria/select/package.json b/packages/@react-aria/select/package.json
index c9cd27bc0fe..b4d60fb2d8d 100644
--- a/packages/@react-aria/select/package.json
+++ b/packages/@react-aria/select/package.json
@@ -5,6 +5,11 @@
"license": "Apache-2.0",
"main": "dist/main.js",
"module": "dist/module.js",
+ "exports": {
+ "types": "./dist/types.d.ts",
+ "import": "./dist/import.mjs",
+ "require": "./dist/main.js"
+ },
"types": "dist/types.d.ts",
"source": "src/index.ts",
"files": [
diff --git a/packages/@react-aria/selection/package.json b/packages/@react-aria/selection/package.json
index 80e12c0ddc8..354423b158e 100644
--- a/packages/@react-aria/selection/package.json
+++ b/packages/@react-aria/selection/package.json
@@ -5,6 +5,11 @@
"license": "Apache-2.0",
"main": "dist/main.js",
"module": "dist/module.js",
+ "exports": {
+ "types": "./dist/types.d.ts",
+ "import": "./dist/import.mjs",
+ "require": "./dist/main.js"
+ },
"types": "dist/types.d.ts",
"source": "src/index.ts",
"files": [
diff --git a/packages/@react-aria/separator/package.json b/packages/@react-aria/separator/package.json
index a273380df9e..878dd997ab5 100644
--- a/packages/@react-aria/separator/package.json
+++ b/packages/@react-aria/separator/package.json
@@ -5,6 +5,11 @@
"license": "Apache-2.0",
"main": "dist/main.js",
"module": "dist/module.js",
+ "exports": {
+ "types": "./dist/types.d.ts",
+ "import": "./dist/import.mjs",
+ "require": "./dist/main.js"
+ },
"types": "dist/types.d.ts",
"source": "src/index.ts",
"files": [
diff --git a/packages/@react-aria/sidenav/package.json b/packages/@react-aria/sidenav/package.json
index 4e6419f850f..6222d2b7b68 100644
--- a/packages/@react-aria/sidenav/package.json
+++ b/packages/@react-aria/sidenav/package.json
@@ -6,6 +6,11 @@
"license": "Apache-2.0",
"main": "dist/main.js",
"module": "dist/module.js",
+ "exports": {
+ "types": "./dist/types.d.ts",
+ "import": "./dist/import.mjs",
+ "require": "./dist/main.js"
+ },
"types": "dist/types.d.ts",
"source": "src/index.ts",
"files": [
diff --git a/packages/@react-aria/slider/package.json b/packages/@react-aria/slider/package.json
index a515617e8fb..59c4555512a 100644
--- a/packages/@react-aria/slider/package.json
+++ b/packages/@react-aria/slider/package.json
@@ -5,6 +5,11 @@
"license": "Apache-2.0",
"main": "dist/main.js",
"module": "dist/module.js",
+ "exports": {
+ "types": "./dist/types.d.ts",
+ "import": "./dist/import.mjs",
+ "require": "./dist/main.js"
+ },
"types": "dist/types.d.ts",
"source": "src/index.ts",
"files": [
diff --git a/packages/@react-aria/spinbutton/package.json b/packages/@react-aria/spinbutton/package.json
index 053fc3de4a7..3881d5141c8 100644
--- a/packages/@react-aria/spinbutton/package.json
+++ b/packages/@react-aria/spinbutton/package.json
@@ -5,6 +5,11 @@
"license": "Apache-2.0",
"main": "dist/main.js",
"module": "dist/module.js",
+ "exports": {
+ "types": "./dist/types.d.ts",
+ "import": "./dist/import.mjs",
+ "require": "./dist/main.js"
+ },
"types": "dist/types.d.ts",
"source": "src/index.ts",
"files": [
diff --git a/packages/@react-aria/ssr/package.json b/packages/@react-aria/ssr/package.json
index fb127a385db..8288a21edfd 100644
--- a/packages/@react-aria/ssr/package.json
+++ b/packages/@react-aria/ssr/package.json
@@ -5,6 +5,11 @@
"license": "Apache-2.0",
"main": "dist/main.js",
"module": "dist/module.js",
+ "exports": {
+ "types": "./dist/types.d.ts",
+ "import": "./dist/import.mjs",
+ "require": "./dist/main.js"
+ },
"types": "dist/types.d.ts",
"source": "src/index.ts",
"files": [
diff --git a/packages/@react-aria/switch/package.json b/packages/@react-aria/switch/package.json
index 7cfd02edb0d..d079348267d 100644
--- a/packages/@react-aria/switch/package.json
+++ b/packages/@react-aria/switch/package.json
@@ -5,6 +5,11 @@
"license": "Apache-2.0",
"main": "dist/main.js",
"module": "dist/module.js",
+ "exports": {
+ "types": "./dist/types.d.ts",
+ "import": "./dist/import.mjs",
+ "require": "./dist/main.js"
+ },
"types": "dist/types.d.ts",
"source": "src/index.ts",
"files": [
diff --git a/packages/@react-aria/table/package.json b/packages/@react-aria/table/package.json
index 9ab051cba6a..509814cb2d3 100644
--- a/packages/@react-aria/table/package.json
+++ b/packages/@react-aria/table/package.json
@@ -5,6 +5,11 @@
"license": "Apache-2.0",
"main": "dist/main.js",
"module": "dist/module.js",
+ "exports": {
+ "types": "./dist/types.d.ts",
+ "import": "./dist/import.mjs",
+ "require": "./dist/main.js"
+ },
"types": "dist/types.d.ts",
"source": "src/index.ts",
"files": [
diff --git a/packages/@react-aria/tabs/package.json b/packages/@react-aria/tabs/package.json
index 20d55321824..305b77d9bb4 100644
--- a/packages/@react-aria/tabs/package.json
+++ b/packages/@react-aria/tabs/package.json
@@ -5,6 +5,11 @@
"license": "Apache-2.0",
"main": "dist/main.js",
"module": "dist/module.js",
+ "exports": {
+ "types": "./dist/types.d.ts",
+ "import": "./dist/import.mjs",
+ "require": "./dist/main.js"
+ },
"types": "dist/types.d.ts",
"source": "src/index.ts",
"files": [
diff --git a/packages/@react-aria/tag/package.json b/packages/@react-aria/tag/package.json
index 6bf964907f1..6591dec2e60 100644
--- a/packages/@react-aria/tag/package.json
+++ b/packages/@react-aria/tag/package.json
@@ -5,6 +5,11 @@
"license": "Apache-2.0",
"main": "dist/main.js",
"module": "dist/module.js",
+ "exports": {
+ "types": "./dist/types.d.ts",
+ "import": "./dist/import.mjs",
+ "require": "./dist/main.js"
+ },
"types": "dist/types.d.ts",
"source": "src/index.ts",
"files": [
diff --git a/packages/@react-aria/textfield/package.json b/packages/@react-aria/textfield/package.json
index 365145cd295..942d39d19de 100644
--- a/packages/@react-aria/textfield/package.json
+++ b/packages/@react-aria/textfield/package.json
@@ -5,6 +5,11 @@
"license": "Apache-2.0",
"main": "dist/main.js",
"module": "dist/module.js",
+ "exports": {
+ "types": "./dist/types.d.ts",
+ "import": "./dist/import.mjs",
+ "require": "./dist/main.js"
+ },
"types": "dist/types.d.ts",
"source": "src/index.ts",
"files": [
diff --git a/packages/@react-aria/toast/package.json b/packages/@react-aria/toast/package.json
index cfc2d72f2b8..1707c15f3f0 100644
--- a/packages/@react-aria/toast/package.json
+++ b/packages/@react-aria/toast/package.json
@@ -5,6 +5,11 @@
"license": "Apache-2.0",
"main": "dist/main.js",
"module": "dist/module.js",
+ "exports": {
+ "types": "./dist/types.d.ts",
+ "import": "./dist/import.mjs",
+ "require": "./dist/main.js"
+ },
"types": "dist/types.d.ts",
"source": "src/index.ts",
"files": [
diff --git a/packages/@react-aria/toggle/package.json b/packages/@react-aria/toggle/package.json
index e298b1257cf..fcb2a8ad509 100644
--- a/packages/@react-aria/toggle/package.json
+++ b/packages/@react-aria/toggle/package.json
@@ -5,6 +5,11 @@
"license": "Apache-2.0",
"main": "dist/main.js",
"module": "dist/module.js",
+ "exports": {
+ "types": "./dist/types.d.ts",
+ "import": "./dist/import.mjs",
+ "require": "./dist/main.js"
+ },
"types": "dist/types.d.ts",
"source": "src/index.ts",
"files": [
diff --git a/packages/@react-aria/tooltip/package.json b/packages/@react-aria/tooltip/package.json
index 8c80d6fb8d8..d378aba8e0e 100644
--- a/packages/@react-aria/tooltip/package.json
+++ b/packages/@react-aria/tooltip/package.json
@@ -5,6 +5,11 @@
"license": "Apache-2.0",
"main": "dist/main.js",
"module": "dist/module.js",
+ "exports": {
+ "types": "./dist/types.d.ts",
+ "import": "./dist/import.mjs",
+ "require": "./dist/main.js"
+ },
"types": "dist/types.d.ts",
"source": "src/index.ts",
"files": [
diff --git a/packages/@react-aria/tree/package.json b/packages/@react-aria/tree/package.json
index 59fa86d9293..9e63b0f4742 100644
--- a/packages/@react-aria/tree/package.json
+++ b/packages/@react-aria/tree/package.json
@@ -6,6 +6,11 @@
"private": true,
"main": "dist/main.js",
"module": "dist/module.js",
+ "exports": {
+ "types": "./dist/types.d.ts",
+ "import": "./dist/import.mjs",
+ "require": "./dist/main.js"
+ },
"types": "dist/types.d.ts",
"source": "src/index.ts",
"files": [
diff --git a/packages/@react-aria/utils/package.json b/packages/@react-aria/utils/package.json
index b5e6f6c46d3..568d0be279a 100644
--- a/packages/@react-aria/utils/package.json
+++ b/packages/@react-aria/utils/package.json
@@ -5,6 +5,11 @@
"license": "Apache-2.0",
"main": "dist/main.js",
"module": "dist/module.js",
+ "exports": {
+ "types": "./dist/types.d.ts",
+ "import": "./dist/import.mjs",
+ "require": "./dist/main.js"
+ },
"types": "dist/types.d.ts",
"source": "src/index.ts",
"files": [
diff --git a/packages/@react-aria/virtualizer/package.json b/packages/@react-aria/virtualizer/package.json
index 5e408e30e9f..6a6be124c5f 100644
--- a/packages/@react-aria/virtualizer/package.json
+++ b/packages/@react-aria/virtualizer/package.json
@@ -5,6 +5,11 @@
"license": "Apache-2.0",
"main": "dist/main.js",
"module": "dist/module.js",
+ "exports": {
+ "types": "./dist/types.d.ts",
+ "import": "./dist/import.mjs",
+ "require": "./dist/main.js"
+ },
"types": "dist/types.d.ts",
"source": "src/index.ts",
"files": [
diff --git a/packages/@react-aria/visually-hidden/package.json b/packages/@react-aria/visually-hidden/package.json
index c7d681319f3..0681731a249 100644
--- a/packages/@react-aria/visually-hidden/package.json
+++ b/packages/@react-aria/visually-hidden/package.json
@@ -5,6 +5,11 @@
"license": "Apache-2.0",
"main": "dist/main.js",
"module": "dist/module.js",
+ "exports": {
+ "types": "./dist/types.d.ts",
+ "import": "./dist/import.mjs",
+ "require": "./dist/main.js"
+ },
"types": "dist/types.d.ts",
"source": "src/index.ts",
"files": [
diff --git a/packages/@react-spectrum/accordion/package.json b/packages/@react-spectrum/accordion/package.json
index 7f1ea55f444..3cb4e6052e3 100644
--- a/packages/@react-spectrum/accordion/package.json
+++ b/packages/@react-spectrum/accordion/package.json
@@ -5,6 +5,11 @@
"license": "Apache-2.0",
"main": "dist/main.js",
"module": "dist/module.js",
+ "exports": {
+ "types": "./dist/types.d.ts",
+ "import": "./dist/import.mjs",
+ "require": "./dist/main.js"
+ },
"types": "dist/types.d.ts",
"source": "src/index.ts",
"files": [
diff --git a/packages/@react-spectrum/actionbar/package.json b/packages/@react-spectrum/actionbar/package.json
index 1fe6e972ef0..b76c6be5880 100644
--- a/packages/@react-spectrum/actionbar/package.json
+++ b/packages/@react-spectrum/actionbar/package.json
@@ -5,6 +5,11 @@
"license": "Apache-2.0",
"main": "dist/main.js",
"module": "dist/module.js",
+ "exports": {
+ "types": "./dist/types.d.ts",
+ "import": "./dist/import.mjs",
+ "require": "./dist/main.js"
+ },
"types": "dist/types.d.ts",
"source": "src/index.ts",
"files": [
diff --git a/packages/@react-spectrum/actiongroup/package.json b/packages/@react-spectrum/actiongroup/package.json
index 12e72979adf..e8256bd15fe 100644
--- a/packages/@react-spectrum/actiongroup/package.json
+++ b/packages/@react-spectrum/actiongroup/package.json
@@ -5,6 +5,11 @@
"license": "Apache-2.0",
"main": "dist/main.js",
"module": "dist/module.js",
+ "exports": {
+ "types": "./dist/types.d.ts",
+ "import": "./dist/import.mjs",
+ "require": "./dist/main.js"
+ },
"types": "dist/types.d.ts",
"source": "src/index.ts",
"files": [
diff --git a/packages/@react-spectrum/alert/package.json b/packages/@react-spectrum/alert/package.json
index 0a720436c06..940962bb0b3 100644
--- a/packages/@react-spectrum/alert/package.json
+++ b/packages/@react-spectrum/alert/package.json
@@ -4,8 +4,13 @@
"description": "Spectrum UI components in React",
"license": "Apache-2.0",
"private": true,
- "main": "dist/Alert.js",
- "module": "dist/Alert.module.js",
+ "main": "dist/main.js",
+ "module": "dist/module.js",
+ "exports": {
+ "types": "./dist/types.d.ts",
+ "import": "./dist/import.mjs",
+ "require": "./dist/main.js"
+ },
"types": "dist/Alert.d.ts",
"source": "src/index.ts",
"files": [
diff --git a/packages/@react-spectrum/autocomplete/package.json b/packages/@react-spectrum/autocomplete/package.json
index 949d4a196af..0226900dfa0 100644
--- a/packages/@react-spectrum/autocomplete/package.json
+++ b/packages/@react-spectrum/autocomplete/package.json
@@ -5,6 +5,11 @@
"license": "Apache-2.0",
"main": "dist/main.js",
"module": "dist/module.js",
+ "exports": {
+ "types": "./dist/types.d.ts",
+ "import": "./dist/import.mjs",
+ "require": "./dist/main.js"
+ },
"types": "dist/types.d.ts",
"source": "src/index.ts",
"files": [
diff --git a/packages/@react-spectrum/avatar/package.json b/packages/@react-spectrum/avatar/package.json
index 111dc954b92..5c71a016779 100644
--- a/packages/@react-spectrum/avatar/package.json
+++ b/packages/@react-spectrum/avatar/package.json
@@ -5,6 +5,11 @@
"license": "Apache-2.0",
"main": "dist/main.js",
"module": "dist/module.js",
+ "exports": {
+ "types": "./dist/types.d.ts",
+ "import": "./dist/import.mjs",
+ "require": "./dist/main.js"
+ },
"types": "dist/types.d.ts",
"source": "src/index.ts",
"files": [
diff --git a/packages/@react-spectrum/badge/package.json b/packages/@react-spectrum/badge/package.json
index c4fa9575fb0..6e48ff5f383 100644
--- a/packages/@react-spectrum/badge/package.json
+++ b/packages/@react-spectrum/badge/package.json
@@ -5,6 +5,11 @@
"license": "Apache-2.0",
"main": "dist/main.js",
"module": "dist/module.js",
+ "exports": {
+ "types": "./dist/types.d.ts",
+ "import": "./dist/import.mjs",
+ "require": "./dist/main.js"
+ },
"types": "dist/types.d.ts",
"source": "src/index.ts",
"files": [
diff --git a/packages/@react-spectrum/badge/test/Badge.test.js b/packages/@react-spectrum/badge/test/Badge.test.js
index a7240ec7a79..07e137b1cc8 100644
--- a/packages/@react-spectrum/badge/test/Badge.test.js
+++ b/packages/@react-spectrum/badge/test/Badge.test.js
@@ -11,7 +11,7 @@
*/
import {Badge} from '../';
-import CheckmarkCircle from '@spectrum-icons/workflow/src/CheckmarkCircle';
+import CheckmarkCircle from '@spectrum-icons/workflow/CheckmarkCircle';
import React from 'react';
import {render} from '@react-spectrum/test-utils';
import {Text} from '@react-spectrum/text';
diff --git a/packages/@react-spectrum/breadcrumbs/package.json b/packages/@react-spectrum/breadcrumbs/package.json
index acf101fb61f..fe460c6a2b8 100644
--- a/packages/@react-spectrum/breadcrumbs/package.json
+++ b/packages/@react-spectrum/breadcrumbs/package.json
@@ -5,6 +5,11 @@
"license": "Apache-2.0",
"main": "dist/main.js",
"module": "dist/module.js",
+ "exports": {
+ "types": "./dist/types.d.ts",
+ "import": "./dist/import.mjs",
+ "require": "./dist/main.js"
+ },
"types": "dist/types.d.ts",
"source": "src/index.ts",
"files": [
diff --git a/packages/@react-spectrum/button/package.json b/packages/@react-spectrum/button/package.json
index cdefdf6cb09..7d77bbaa1e2 100644
--- a/packages/@react-spectrum/button/package.json
+++ b/packages/@react-spectrum/button/package.json
@@ -5,6 +5,11 @@
"license": "Apache-2.0",
"main": "dist/main.js",
"module": "dist/module.js",
+ "exports": {
+ "types": "./dist/types.d.ts",
+ "import": "./dist/import.mjs",
+ "require": "./dist/main.js"
+ },
"types": "dist/types.d.ts",
"source": "src/index.ts",
"files": [
diff --git a/packages/@react-spectrum/buttongroup/package.json b/packages/@react-spectrum/buttongroup/package.json
index e4e3254fdf6..a46f7861d6a 100644
--- a/packages/@react-spectrum/buttongroup/package.json
+++ b/packages/@react-spectrum/buttongroup/package.json
@@ -5,6 +5,11 @@
"license": "Apache-2.0",
"main": "dist/main.js",
"module": "dist/module.js",
+ "exports": {
+ "types": "./dist/types.d.ts",
+ "import": "./dist/import.mjs",
+ "require": "./dist/main.js"
+ },
"types": "dist/types.d.ts",
"source": "src/index.ts",
"files": [
diff --git a/packages/@react-spectrum/calendar/package.json b/packages/@react-spectrum/calendar/package.json
index 19ef321c17c..26a69a4c970 100644
--- a/packages/@react-spectrum/calendar/package.json
+++ b/packages/@react-spectrum/calendar/package.json
@@ -5,6 +5,11 @@
"license": "Apache-2.0",
"main": "dist/main.js",
"module": "dist/module.js",
+ "exports": {
+ "types": "./dist/types.d.ts",
+ "import": "./dist/import.mjs",
+ "require": "./dist/main.js"
+ },
"types": "dist/types.d.ts",
"source": "src/index.ts",
"files": [
diff --git a/packages/@react-spectrum/card/package.json b/packages/@react-spectrum/card/package.json
index 1b7103bc652..bd4c4012361 100644
--- a/packages/@react-spectrum/card/package.json
+++ b/packages/@react-spectrum/card/package.json
@@ -5,6 +5,11 @@
"license": "Apache-2.0",
"main": "dist/main.js",
"module": "dist/module.js",
+ "exports": {
+ "types": "./dist/types.d.ts",
+ "import": "./dist/import.mjs",
+ "require": "./dist/main.js"
+ },
"types": "dist/types.d.ts",
"source": "src/index.ts",
"files": [
diff --git a/packages/@react-spectrum/checkbox/package.json b/packages/@react-spectrum/checkbox/package.json
index 3440b257ca3..c2791702b9f 100644
--- a/packages/@react-spectrum/checkbox/package.json
+++ b/packages/@react-spectrum/checkbox/package.json
@@ -5,6 +5,11 @@
"license": "Apache-2.0",
"main": "dist/main.js",
"module": "dist/module.js",
+ "exports": {
+ "types": "./dist/types.d.ts",
+ "import": "./dist/import.mjs",
+ "require": "./dist/main.js"
+ },
"types": "dist/types.d.ts",
"source": "src/index.ts",
"files": [
diff --git a/packages/@react-spectrum/color/package.json b/packages/@react-spectrum/color/package.json
index eb6a19341be..2ab9af61940 100644
--- a/packages/@react-spectrum/color/package.json
+++ b/packages/@react-spectrum/color/package.json
@@ -5,6 +5,11 @@
"license": "Apache-2.0",
"main": "dist/main.js",
"module": "dist/module.js",
+ "exports": {
+ "types": "./dist/types.d.ts",
+ "import": "./dist/import.mjs",
+ "require": "./dist/main.js"
+ },
"types": "dist/types.d.ts",
"source": "src/index.ts",
"files": [
diff --git a/packages/@react-spectrum/combobox/package.json b/packages/@react-spectrum/combobox/package.json
index 78c1b023694..567dc6de95b 100644
--- a/packages/@react-spectrum/combobox/package.json
+++ b/packages/@react-spectrum/combobox/package.json
@@ -5,6 +5,11 @@
"license": "Apache-2.0",
"main": "dist/main.js",
"module": "dist/module.js",
+ "exports": {
+ "types": "./dist/types.d.ts",
+ "import": "./dist/import.mjs",
+ "require": "./dist/main.js"
+ },
"types": "dist/types.d.ts",
"source": "src/index.ts",
"files": [
diff --git a/packages/@react-spectrum/contextualhelp/package.json b/packages/@react-spectrum/contextualhelp/package.json
index e66b66062b4..9c605783795 100644
--- a/packages/@react-spectrum/contextualhelp/package.json
+++ b/packages/@react-spectrum/contextualhelp/package.json
@@ -5,6 +5,11 @@
"license": "Apache-2.0",
"main": "dist/main.js",
"module": "dist/module.js",
+ "exports": {
+ "types": "./dist/types.d.ts",
+ "import": "./dist/import.mjs",
+ "require": "./dist/main.js"
+ },
"types": "dist/types.d.ts",
"source": "src/index.ts",
"files": [
diff --git a/packages/@react-spectrum/datepicker/package.json b/packages/@react-spectrum/datepicker/package.json
index 5d34d9a378d..315720f9a29 100644
--- a/packages/@react-spectrum/datepicker/package.json
+++ b/packages/@react-spectrum/datepicker/package.json
@@ -5,6 +5,11 @@
"license": "Apache-2.0",
"main": "dist/main.js",
"module": "dist/module.js",
+ "exports": {
+ "types": "./dist/types.d.ts",
+ "import": "./dist/import.mjs",
+ "require": "./dist/main.js"
+ },
"types": "dist/types.d.ts",
"source": "src/index.ts",
"files": [
diff --git a/packages/@react-spectrum/dialog/package.json b/packages/@react-spectrum/dialog/package.json
index b92f5f38ce6..0cc737733f7 100644
--- a/packages/@react-spectrum/dialog/package.json
+++ b/packages/@react-spectrum/dialog/package.json
@@ -5,6 +5,11 @@
"license": "Apache-2.0",
"main": "dist/main.js",
"module": "dist/module.js",
+ "exports": {
+ "types": "./dist/types.d.ts",
+ "import": "./dist/import.mjs",
+ "require": "./dist/main.js"
+ },
"types": "dist/types.d.ts",
"source": "src/index.ts",
"files": [
diff --git a/packages/@react-spectrum/divider/package.json b/packages/@react-spectrum/divider/package.json
index 33790a54e9c..3e5800ac487 100644
--- a/packages/@react-spectrum/divider/package.json
+++ b/packages/@react-spectrum/divider/package.json
@@ -5,6 +5,11 @@
"license": "Apache-2.0",
"main": "dist/main.js",
"module": "dist/module.js",
+ "exports": {
+ "types": "./dist/types.d.ts",
+ "import": "./dist/import.mjs",
+ "require": "./dist/main.js"
+ },
"types": "dist/types.d.ts",
"source": "src/index.ts",
"files": [
diff --git a/packages/@react-spectrum/dnd/package.json b/packages/@react-spectrum/dnd/package.json
index 2f6477ddd50..176880927d7 100644
--- a/packages/@react-spectrum/dnd/package.json
+++ b/packages/@react-spectrum/dnd/package.json
@@ -5,6 +5,11 @@
"license": "Apache-2.0",
"main": "dist/main.js",
"module": "dist/module.js",
+ "exports": {
+ "types": "./dist/types.d.ts",
+ "import": "./dist/import.mjs",
+ "require": "./dist/main.js"
+ },
"types": "dist/types.d.ts",
"source": "src/index.ts",
"files": [
diff --git a/packages/@react-spectrum/form/package.json b/packages/@react-spectrum/form/package.json
index 17042fd8ec3..ddd4c09dfc8 100644
--- a/packages/@react-spectrum/form/package.json
+++ b/packages/@react-spectrum/form/package.json
@@ -5,6 +5,11 @@
"license": "Apache-2.0",
"main": "dist/main.js",
"module": "dist/module.js",
+ "exports": {
+ "types": "./dist/types.d.ts",
+ "import": "./dist/import.mjs",
+ "require": "./dist/main.js"
+ },
"types": "dist/types.d.ts",
"source": "src/index.ts",
"files": [
diff --git a/packages/@react-spectrum/icon/package.json b/packages/@react-spectrum/icon/package.json
index 305c01f4382..b556ef3f4dc 100644
--- a/packages/@react-spectrum/icon/package.json
+++ b/packages/@react-spectrum/icon/package.json
@@ -5,6 +5,11 @@
"license": "Apache-2.0",
"main": "dist/main.js",
"module": "dist/module.js",
+ "exports": {
+ "types": "./dist/types.d.ts",
+ "import": "./dist/import.mjs",
+ "require": "./dist/main.js"
+ },
"types": "dist/types.d.ts",
"source": "src/index.ts",
"files": [
diff --git a/packages/@react-spectrum/illustratedmessage/package.json b/packages/@react-spectrum/illustratedmessage/package.json
index 60a1ec9bb3e..35dcc16aa60 100644
--- a/packages/@react-spectrum/illustratedmessage/package.json
+++ b/packages/@react-spectrum/illustratedmessage/package.json
@@ -5,6 +5,11 @@
"license": "Apache-2.0",
"main": "dist/main.js",
"module": "dist/module.js",
+ "exports": {
+ "types": "./dist/types.d.ts",
+ "import": "./dist/import.mjs",
+ "require": "./dist/main.js"
+ },
"types": "dist/types.d.ts",
"source": "src/index.ts",
"files": [
diff --git a/packages/@react-spectrum/illustratedmessage/stories/IllustratedMessage.stories.tsx b/packages/@react-spectrum/illustratedmessage/stories/IllustratedMessage.stories.tsx
index 86ab19addcf..5fa18110440 100644
--- a/packages/@react-spectrum/illustratedmessage/stories/IllustratedMessage.stories.tsx
+++ b/packages/@react-spectrum/illustratedmessage/stories/IllustratedMessage.stories.tsx
@@ -13,7 +13,7 @@ import {ComponentMeta, ComponentStoryObj} from '@storybook/react';
import {Content} from '@react-spectrum/view';
import {Heading} from '@react-spectrum/text';
import {IllustratedMessage} from '../';
-import NotFound from '@spectrum-icons/illustrations/src/NotFound';
+import NotFound from '@spectrum-icons/illustrations/NotFound';
import React from 'react';
type IllustratedMessageStory = ComponentStoryObj;
diff --git a/packages/@react-spectrum/image/package.json b/packages/@react-spectrum/image/package.json
index 3922721f03e..a2ab91579c2 100644
--- a/packages/@react-spectrum/image/package.json
+++ b/packages/@react-spectrum/image/package.json
@@ -5,6 +5,11 @@
"license": "Apache-2.0",
"main": "dist/main.js",
"module": "dist/module.js",
+ "exports": {
+ "types": "./dist/types.d.ts",
+ "import": "./dist/import.mjs",
+ "require": "./dist/main.js"
+ },
"types": "dist/types.d.ts",
"source": "src/index.ts",
"files": [
diff --git a/packages/@react-spectrum/label/package.json b/packages/@react-spectrum/label/package.json
index a63a64705f2..af936778a85 100644
--- a/packages/@react-spectrum/label/package.json
+++ b/packages/@react-spectrum/label/package.json
@@ -5,6 +5,11 @@
"license": "Apache-2.0",
"main": "dist/main.js",
"module": "dist/module.js",
+ "exports": {
+ "types": "./dist/types.d.ts",
+ "import": "./dist/import.mjs",
+ "require": "./dist/main.js"
+ },
"types": "dist/types.d.ts",
"source": "src/index.ts",
"files": [
diff --git a/packages/@react-spectrum/labeledvalue/package.json b/packages/@react-spectrum/labeledvalue/package.json
index f5791003f11..09293b4a64c 100644
--- a/packages/@react-spectrum/labeledvalue/package.json
+++ b/packages/@react-spectrum/labeledvalue/package.json
@@ -5,6 +5,11 @@
"license": "Apache-2.0",
"main": "dist/main.js",
"module": "dist/module.js",
+ "exports": {
+ "types": "./dist/types.d.ts",
+ "import": "./dist/import.mjs",
+ "require": "./dist/main.js"
+ },
"types": "dist/types.d.ts",
"source": "src/index.ts",
"files": [
diff --git a/packages/@react-spectrum/layout/package.json b/packages/@react-spectrum/layout/package.json
index 8db8bfbb089..c5e72b1ba87 100644
--- a/packages/@react-spectrum/layout/package.json
+++ b/packages/@react-spectrum/layout/package.json
@@ -5,6 +5,11 @@
"license": "Apache-2.0",
"main": "dist/main.js",
"module": "dist/module.js",
+ "exports": {
+ "types": "./dist/types.d.ts",
+ "import": "./dist/import.mjs",
+ "require": "./dist/main.js"
+ },
"types": "dist/types.d.ts",
"source": "src/index.ts",
"files": [
diff --git a/packages/@react-spectrum/link/package.json b/packages/@react-spectrum/link/package.json
index 7ec6ae9193a..debbb557bd2 100644
--- a/packages/@react-spectrum/link/package.json
+++ b/packages/@react-spectrum/link/package.json
@@ -5,6 +5,11 @@
"license": "Apache-2.0",
"main": "dist/main.js",
"module": "dist/module.js",
+ "exports": {
+ "types": "./dist/types.d.ts",
+ "import": "./dist/import.mjs",
+ "require": "./dist/main.js"
+ },
"types": "dist/types.d.ts",
"source": "src/index.ts",
"files": [
diff --git a/packages/@react-spectrum/list/package.json b/packages/@react-spectrum/list/package.json
index a3479bf0fd3..039581fea20 100644
--- a/packages/@react-spectrum/list/package.json
+++ b/packages/@react-spectrum/list/package.json
@@ -5,6 +5,11 @@
"license": "Apache-2.0",
"main": "dist/main.js",
"module": "dist/module.js",
+ "exports": {
+ "types": "./dist/types.d.ts",
+ "import": "./dist/import.mjs",
+ "require": "./dist/main.js"
+ },
"types": "dist/types.d.ts",
"source": "src/index.ts",
"files": [
diff --git a/packages/@react-spectrum/list/stories/ListView.stories.tsx b/packages/@react-spectrum/list/stories/ListView.stories.tsx
index 684373f0557..ad3e8ee4097 100644
--- a/packages/@react-spectrum/list/stories/ListView.stories.tsx
+++ b/packages/@react-spectrum/list/stories/ListView.stories.tsx
@@ -22,7 +22,7 @@ import Info from '@spectrum-icons/workflow/Info';
import {Item, ListView} from '../';
import {ItemDropTarget} from '@react-types/shared';
import {Link} from '@react-spectrum/link';
-import NoSearchResults from '@spectrum-icons/illustrations/src/NoSearchResults';
+import NoSearchResults from '@spectrum-icons/illustrations/NoSearchResults';
import React, {useEffect, useState} from 'react';
import RemoveCircle from '@spectrum-icons/workflow/RemoveCircle';
import {storiesOf} from '@storybook/react';
diff --git a/packages/@react-spectrum/listbox/package.json b/packages/@react-spectrum/listbox/package.json
index 1a1444a011f..63850840876 100644
--- a/packages/@react-spectrum/listbox/package.json
+++ b/packages/@react-spectrum/listbox/package.json
@@ -5,6 +5,11 @@
"license": "Apache-2.0",
"main": "dist/main.js",
"module": "dist/module.js",
+ "exports": {
+ "types": "./dist/types.d.ts",
+ "import": "./dist/import.mjs",
+ "require": "./dist/main.js"
+ },
"types": "dist/types.d.ts",
"source": "src/index.ts",
"files": [
diff --git a/packages/@react-spectrum/menu/package.json b/packages/@react-spectrum/menu/package.json
index 61b1395ca2c..d7e9655b51b 100644
--- a/packages/@react-spectrum/menu/package.json
+++ b/packages/@react-spectrum/menu/package.json
@@ -5,6 +5,11 @@
"license": "Apache-2.0",
"main": "dist/main.js",
"module": "dist/module.js",
+ "exports": {
+ "types": "./dist/types.d.ts",
+ "import": "./dist/import.mjs",
+ "require": "./dist/main.js"
+ },
"types": "dist/types.d.ts",
"source": "src/index.ts",
"files": [
diff --git a/packages/@react-spectrum/meter/package.json b/packages/@react-spectrum/meter/package.json
index bcec6144fce..754b03511d3 100644
--- a/packages/@react-spectrum/meter/package.json
+++ b/packages/@react-spectrum/meter/package.json
@@ -5,6 +5,11 @@
"license": "Apache-2.0",
"main": "dist/main.js",
"module": "dist/module.js",
+ "exports": {
+ "types": "./dist/types.d.ts",
+ "import": "./dist/import.mjs",
+ "require": "./dist/main.js"
+ },
"types": "dist/types.d.ts",
"source": "src/index.ts",
"files": [
diff --git a/packages/@react-spectrum/numberfield/package.json b/packages/@react-spectrum/numberfield/package.json
index ac9f2860279..1b604211d12 100644
--- a/packages/@react-spectrum/numberfield/package.json
+++ b/packages/@react-spectrum/numberfield/package.json
@@ -5,6 +5,11 @@
"license": "Apache-2.0",
"main": "dist/main.js",
"module": "dist/module.js",
+ "exports": {
+ "types": "./dist/types.d.ts",
+ "import": "./dist/import.mjs",
+ "require": "./dist/main.js"
+ },
"types": "dist/types.d.ts",
"source": "src/index.ts",
"files": [
diff --git a/packages/@react-spectrum/overlays/package.json b/packages/@react-spectrum/overlays/package.json
index 825963c9dc8..bc7a493fa75 100644
--- a/packages/@react-spectrum/overlays/package.json
+++ b/packages/@react-spectrum/overlays/package.json
@@ -5,6 +5,11 @@
"license": "Apache-2.0",
"main": "dist/main.js",
"module": "dist/module.js",
+ "exports": {
+ "types": "./dist/types.d.ts",
+ "import": "./dist/import.mjs",
+ "require": "./dist/main.js"
+ },
"types": "dist/types.d.ts",
"source": "src/index.ts",
"files": [
diff --git a/packages/@react-spectrum/pagination/package.json b/packages/@react-spectrum/pagination/package.json
index d702ab07f23..3981f053751 100644
--- a/packages/@react-spectrum/pagination/package.json
+++ b/packages/@react-spectrum/pagination/package.json
@@ -6,6 +6,11 @@
"private": true,
"main": "dist/main.js",
"module": "dist/module.js",
+ "exports": {
+ "types": "./dist/types.d.ts",
+ "import": "./dist/import.mjs",
+ "require": "./dist/main.js"
+ },
"types": "dist/types.d.ts",
"source": "src/index.ts",
"files": [
diff --git a/packages/@react-spectrum/picker/package.json b/packages/@react-spectrum/picker/package.json
index 9e6e84aba13..7136a91a296 100644
--- a/packages/@react-spectrum/picker/package.json
+++ b/packages/@react-spectrum/picker/package.json
@@ -5,6 +5,11 @@
"license": "Apache-2.0",
"main": "dist/main.js",
"module": "dist/module.js",
+ "exports": {
+ "types": "./dist/types.d.ts",
+ "import": "./dist/import.mjs",
+ "require": "./dist/main.js"
+ },
"types": "dist/types.d.ts",
"source": "src/index.ts",
"files": [
diff --git a/packages/@react-spectrum/progress/package.json b/packages/@react-spectrum/progress/package.json
index 2e9f2eb5271..dbcecfb4932 100644
--- a/packages/@react-spectrum/progress/package.json
+++ b/packages/@react-spectrum/progress/package.json
@@ -5,6 +5,11 @@
"license": "Apache-2.0",
"main": "dist/main.js",
"module": "dist/module.js",
+ "exports": {
+ "types": "./dist/types.d.ts",
+ "import": "./dist/import.mjs",
+ "require": "./dist/main.js"
+ },
"types": "dist/types.d.ts",
"source": "src/index.ts",
"files": [
diff --git a/packages/@react-spectrum/provider/package.json b/packages/@react-spectrum/provider/package.json
index ea7a4579342..d5820da132d 100644
--- a/packages/@react-spectrum/provider/package.json
+++ b/packages/@react-spectrum/provider/package.json
@@ -5,6 +5,11 @@
"license": "Apache-2.0",
"main": "dist/main.js",
"module": "dist/module.js",
+ "exports": {
+ "types": "./dist/types.d.ts",
+ "import": "./dist/import.mjs",
+ "require": "./dist/main.js"
+ },
"types": "dist/types.d.ts",
"source": "src/index.ts",
"files": [
diff --git a/packages/@react-spectrum/radio/package.json b/packages/@react-spectrum/radio/package.json
index 1a9195909ae..228a37e1beb 100644
--- a/packages/@react-spectrum/radio/package.json
+++ b/packages/@react-spectrum/radio/package.json
@@ -5,6 +5,11 @@
"license": "Apache-2.0",
"main": "dist/main.js",
"module": "dist/module.js",
+ "exports": {
+ "types": "./dist/types.d.ts",
+ "import": "./dist/import.mjs",
+ "require": "./dist/main.js"
+ },
"types": "dist/types.d.ts",
"source": "src/index.ts",
"files": [
diff --git a/packages/@react-spectrum/searchfield/package.json b/packages/@react-spectrum/searchfield/package.json
index 4e5cfb62494..7fb6d42c2c8 100644
--- a/packages/@react-spectrum/searchfield/package.json
+++ b/packages/@react-spectrum/searchfield/package.json
@@ -5,6 +5,11 @@
"license": "Apache-2.0",
"main": "dist/main.js",
"module": "dist/module.js",
+ "exports": {
+ "types": "./dist/types.d.ts",
+ "import": "./dist/import.mjs",
+ "require": "./dist/main.js"
+ },
"types": "dist/types.d.ts",
"source": "src/index.ts",
"files": [
diff --git a/packages/@react-spectrum/searchwithin/package.json b/packages/@react-spectrum/searchwithin/package.json
index bf0e150edeb..37737ce9884 100644
--- a/packages/@react-spectrum/searchwithin/package.json
+++ b/packages/@react-spectrum/searchwithin/package.json
@@ -6,6 +6,11 @@
"private": true,
"main": "dist/main.js",
"module": "dist/module.js",
+ "exports": {
+ "types": "./dist/types.d.ts",
+ "import": "./dist/import.mjs",
+ "require": "./dist/main.js"
+ },
"types": "dist/types.d.ts",
"source": "src/index.ts",
"files": [
diff --git a/packages/@react-spectrum/sidenav/package.json b/packages/@react-spectrum/sidenav/package.json
index cbec23eddc2..ab8634a460c 100644
--- a/packages/@react-spectrum/sidenav/package.json
+++ b/packages/@react-spectrum/sidenav/package.json
@@ -6,6 +6,11 @@
"license": "Apache-2.0",
"main": "dist/main.js",
"module": "dist/module.js",
+ "exports": {
+ "types": "./dist/types.d.ts",
+ "import": "./dist/import.mjs",
+ "require": "./dist/main.js"
+ },
"types": "dist/types.d.ts",
"source": "src/index.ts",
"files": [
diff --git a/packages/@react-spectrum/slider/package.json b/packages/@react-spectrum/slider/package.json
index 4228485a197..51be099c66f 100644
--- a/packages/@react-spectrum/slider/package.json
+++ b/packages/@react-spectrum/slider/package.json
@@ -5,6 +5,11 @@
"license": "Apache-2.0",
"main": "dist/main.js",
"module": "dist/module.js",
+ "exports": {
+ "types": "./dist/types.d.ts",
+ "import": "./dist/import.mjs",
+ "require": "./dist/main.js"
+ },
"types": "dist/types.d.ts",
"source": "src/index.ts",
"files": [
diff --git a/packages/@react-spectrum/statuslight/package.json b/packages/@react-spectrum/statuslight/package.json
index 75c55de68f3..dbb7c0c5526 100644
--- a/packages/@react-spectrum/statuslight/package.json
+++ b/packages/@react-spectrum/statuslight/package.json
@@ -5,6 +5,11 @@
"license": "Apache-2.0",
"main": "dist/main.js",
"module": "dist/module.js",
+ "exports": {
+ "types": "./dist/types.d.ts",
+ "import": "./dist/import.mjs",
+ "require": "./dist/main.js"
+ },
"types": "dist/types.d.ts",
"source": "src/index.ts",
"files": [
diff --git a/packages/@react-spectrum/story-utils/package.json b/packages/@react-spectrum/story-utils/package.json
index 9eaa5f7276f..f7270a2fad3 100644
--- a/packages/@react-spectrum/story-utils/package.json
+++ b/packages/@react-spectrum/story-utils/package.json
@@ -6,6 +6,11 @@
"license": "Apache-2.0",
"main": "dist/main.js",
"module": "dist/module.js",
+ "exports": {
+ "types": "./dist/types.d.ts",
+ "import": "./dist/import.mjs",
+ "require": "./dist/main.js"
+ },
"types": "dist/types.d.ts",
"source": "src/index.ts",
"files": [
diff --git a/packages/@react-spectrum/switch/package.json b/packages/@react-spectrum/switch/package.json
index a1c0ae8647b..958ebf99af9 100644
--- a/packages/@react-spectrum/switch/package.json
+++ b/packages/@react-spectrum/switch/package.json
@@ -5,6 +5,11 @@
"license": "Apache-2.0",
"main": "dist/main.js",
"module": "dist/module.js",
+ "exports": {
+ "types": "./dist/types.d.ts",
+ "import": "./dist/import.mjs",
+ "require": "./dist/main.js"
+ },
"types": "dist/types.d.ts",
"source": "src/index.ts",
"files": [
diff --git a/packages/@react-spectrum/table/package.json b/packages/@react-spectrum/table/package.json
index 940f5edb1dc..978c0fa81ef 100644
--- a/packages/@react-spectrum/table/package.json
+++ b/packages/@react-spectrum/table/package.json
@@ -5,6 +5,11 @@
"license": "Apache-2.0",
"main": "dist/main.js",
"module": "dist/module.js",
+ "exports": {
+ "types": "./dist/types.d.ts",
+ "import": "./dist/import.mjs",
+ "require": "./dist/main.js"
+ },
"types": "dist/types.d.ts",
"source": "src/index.ts",
"files": [
diff --git a/packages/@react-spectrum/tabs/package.json b/packages/@react-spectrum/tabs/package.json
index 117d9bf0e31..6ea496b97d0 100644
--- a/packages/@react-spectrum/tabs/package.json
+++ b/packages/@react-spectrum/tabs/package.json
@@ -5,6 +5,11 @@
"license": "Apache-2.0",
"main": "dist/main.js",
"module": "dist/module.js",
+ "exports": {
+ "types": "./dist/types.d.ts",
+ "import": "./dist/import.mjs",
+ "require": "./dist/main.js"
+ },
"types": "dist/types.d.ts",
"source": "src/index.ts",
"files": [
diff --git a/packages/@react-spectrum/tag/package.json b/packages/@react-spectrum/tag/package.json
index f17f852bf97..8d15f3a0904 100644
--- a/packages/@react-spectrum/tag/package.json
+++ b/packages/@react-spectrum/tag/package.json
@@ -5,6 +5,11 @@
"license": "Apache-2.0",
"main": "dist/main.js",
"module": "dist/module.js",
+ "exports": {
+ "types": "./dist/types.d.ts",
+ "import": "./dist/import.mjs",
+ "require": "./dist/main.js"
+ },
"types": "dist/types.d.ts",
"source": "src/index.ts",
"files": [
diff --git a/packages/@react-spectrum/text/package.json b/packages/@react-spectrum/text/package.json
index e1f52e8ab4d..26fd71ee2f3 100644
--- a/packages/@react-spectrum/text/package.json
+++ b/packages/@react-spectrum/text/package.json
@@ -5,6 +5,11 @@
"license": "Apache-2.0",
"main": "dist/main.js",
"module": "dist/module.js",
+ "exports": {
+ "types": "./dist/types.d.ts",
+ "import": "./dist/import.mjs",
+ "require": "./dist/main.js"
+ },
"types": "dist/types.d.ts",
"source": "src/index.ts",
"files": [
diff --git a/packages/@react-spectrum/textfield/package.json b/packages/@react-spectrum/textfield/package.json
index 0e5dd5aa3c6..59b18324d82 100644
--- a/packages/@react-spectrum/textfield/package.json
+++ b/packages/@react-spectrum/textfield/package.json
@@ -5,6 +5,11 @@
"license": "Apache-2.0",
"main": "dist/main.js",
"module": "dist/module.js",
+ "exports": {
+ "types": "./dist/types.d.ts",
+ "import": "./dist/import.mjs",
+ "require": "./dist/main.js"
+ },
"types": "dist/types.d.ts",
"source": "src/index.ts",
"files": [
diff --git a/packages/@react-spectrum/theme-dark/package.json b/packages/@react-spectrum/theme-dark/package.json
index 4670a7593d0..46516cc5614 100644
--- a/packages/@react-spectrum/theme-dark/package.json
+++ b/packages/@react-spectrum/theme-dark/package.json
@@ -5,6 +5,11 @@
"license": "Apache-2.0",
"main": "dist/main.js",
"module": "dist/module.js",
+ "exports": {
+ "types": "./dist/types.d.ts",
+ "import": "./dist/import.mjs",
+ "require": "./dist/main.js"
+ },
"types": "dist/types.d.ts",
"source": "src/index.ts",
"files": [
diff --git a/packages/@react-spectrum/theme-default/package.json b/packages/@react-spectrum/theme-default/package.json
index 300219bc189..18f33cc53c8 100644
--- a/packages/@react-spectrum/theme-default/package.json
+++ b/packages/@react-spectrum/theme-default/package.json
@@ -5,6 +5,11 @@
"license": "Apache-2.0",
"main": "dist/main.js",
"module": "dist/module.js",
+ "exports": {
+ "types": "./dist/types.d.ts",
+ "import": "./dist/import.mjs",
+ "require": "./dist/main.js"
+ },
"types": "dist/types.d.ts",
"source": "src/index.ts",
"files": [
diff --git a/packages/@react-spectrum/theme-express/package.json b/packages/@react-spectrum/theme-express/package.json
index 4831ca6aaa6..3982006dba9 100644
--- a/packages/@react-spectrum/theme-express/package.json
+++ b/packages/@react-spectrum/theme-express/package.json
@@ -5,6 +5,11 @@
"license": "Apache-2.0",
"main": "dist/main.js",
"module": "dist/module.js",
+ "exports": {
+ "types": "./dist/types.d.ts",
+ "import": "./dist/import.mjs",
+ "require": "./dist/main.js"
+ },
"types": "dist/types.d.ts",
"source": "src/index.ts",
"files": [
diff --git a/packages/@react-spectrum/theme-light/package.json b/packages/@react-spectrum/theme-light/package.json
index 2bfd75ba337..6dc75cf5c57 100644
--- a/packages/@react-spectrum/theme-light/package.json
+++ b/packages/@react-spectrum/theme-light/package.json
@@ -5,6 +5,11 @@
"license": "Apache-2.0",
"main": "dist/main.js",
"module": "dist/module.js",
+ "exports": {
+ "types": "./dist/types.d.ts",
+ "import": "./dist/import.mjs",
+ "require": "./dist/main.js"
+ },
"types": "dist/types.d.ts",
"source": "src/index.ts",
"files": [
diff --git a/packages/@react-spectrum/toast/package.json b/packages/@react-spectrum/toast/package.json
index 38e24694d79..328a9420a9b 100644
--- a/packages/@react-spectrum/toast/package.json
+++ b/packages/@react-spectrum/toast/package.json
@@ -5,6 +5,11 @@
"license": "Apache-2.0",
"main": "dist/main.js",
"module": "dist/module.js",
+ "exports": {
+ "types": "./dist/types.d.ts",
+ "import": "./dist/import.mjs",
+ "require": "./dist/main.js"
+ },
"types": "dist/types.d.ts",
"source": "src/index.ts",
"files": [
diff --git a/packages/@react-spectrum/tooltip/package.json b/packages/@react-spectrum/tooltip/package.json
index f7cbe109242..c5715e838ce 100644
--- a/packages/@react-spectrum/tooltip/package.json
+++ b/packages/@react-spectrum/tooltip/package.json
@@ -5,6 +5,11 @@
"license": "Apache-2.0",
"main": "dist/main.js",
"module": "dist/module.js",
+ "exports": {
+ "types": "./dist/types.d.ts",
+ "import": "./dist/import.mjs",
+ "require": "./dist/main.js"
+ },
"types": "dist/types.d.ts",
"source": "src/index.ts",
"files": [
diff --git a/packages/@react-spectrum/tree/package.json b/packages/@react-spectrum/tree/package.json
index b28c2cd6a46..533f201471c 100644
--- a/packages/@react-spectrum/tree/package.json
+++ b/packages/@react-spectrum/tree/package.json
@@ -6,6 +6,11 @@
"private": true,
"main": "dist/main.js",
"module": "dist/module.js",
+ "exports": {
+ "types": "./dist/types.d.ts",
+ "import": "./dist/import.mjs",
+ "require": "./dist/main.js"
+ },
"types": "dist/types.d.ts",
"source": "src/index.ts",
"files": [
diff --git a/packages/@react-spectrum/utils/package.json b/packages/@react-spectrum/utils/package.json
index 3e54062292c..676691e23db 100644
--- a/packages/@react-spectrum/utils/package.json
+++ b/packages/@react-spectrum/utils/package.json
@@ -5,6 +5,11 @@
"license": "Apache-2.0",
"main": "dist/main.js",
"module": "dist/module.js",
+ "exports": {
+ "types": "./dist/types.d.ts",
+ "import": "./dist/import.mjs",
+ "require": "./dist/main.js"
+ },
"types": "dist/types.d.ts",
"source": "src/index.ts",
"files": [
diff --git a/packages/@react-spectrum/view/package.json b/packages/@react-spectrum/view/package.json
index 067c86ab963..52414dcb335 100644
--- a/packages/@react-spectrum/view/package.json
+++ b/packages/@react-spectrum/view/package.json
@@ -5,6 +5,11 @@
"license": "Apache-2.0",
"main": "dist/main.js",
"module": "dist/module.js",
+ "exports": {
+ "types": "./dist/types.d.ts",
+ "import": "./dist/import.mjs",
+ "require": "./dist/main.js"
+ },
"types": "dist/types.d.ts",
"source": "src/index.ts",
"files": [
diff --git a/packages/@react-spectrum/well/package.json b/packages/@react-spectrum/well/package.json
index e361ac87af7..54cb61ded14 100644
--- a/packages/@react-spectrum/well/package.json
+++ b/packages/@react-spectrum/well/package.json
@@ -5,6 +5,11 @@
"license": "Apache-2.0",
"main": "dist/main.js",
"module": "dist/module.js",
+ "exports": {
+ "types": "./dist/types.d.ts",
+ "import": "./dist/import.mjs",
+ "require": "./dist/main.js"
+ },
"types": "dist/types.d.ts",
"source": "src/index.ts",
"files": [
diff --git a/packages/@react-stately/calendar/package.json b/packages/@react-stately/calendar/package.json
index 15f3b8e95ac..3d947557496 100644
--- a/packages/@react-stately/calendar/package.json
+++ b/packages/@react-stately/calendar/package.json
@@ -5,6 +5,11 @@
"license": "Apache-2.0",
"main": "dist/main.js",
"module": "dist/module.js",
+ "exports": {
+ "types": "./dist/types.d.ts",
+ "import": "./dist/import.mjs",
+ "require": "./dist/main.js"
+ },
"types": "dist/types.d.ts",
"source": "src/index.ts",
"files": [
diff --git a/packages/@react-stately/checkbox/package.json b/packages/@react-stately/checkbox/package.json
index d8284c75b26..7d23834bf08 100644
--- a/packages/@react-stately/checkbox/package.json
+++ b/packages/@react-stately/checkbox/package.json
@@ -5,6 +5,11 @@
"license": "Apache-2.0",
"main": "dist/main.js",
"module": "dist/module.js",
+ "exports": {
+ "types": "./dist/types.d.ts",
+ "import": "./dist/import.mjs",
+ "require": "./dist/main.js"
+ },
"types": "dist/types.d.ts",
"source": "src/index.ts",
"files": [
diff --git a/packages/@react-stately/collections/package.json b/packages/@react-stately/collections/package.json
index 0f6c561865f..b70cd97ec19 100644
--- a/packages/@react-stately/collections/package.json
+++ b/packages/@react-stately/collections/package.json
@@ -5,6 +5,11 @@
"license": "Apache-2.0",
"main": "dist/main.js",
"module": "dist/module.js",
+ "exports": {
+ "types": "./dist/types.d.ts",
+ "import": "./dist/import.mjs",
+ "require": "./dist/main.js"
+ },
"types": "dist/types.d.ts",
"source": "src/index.ts",
"files": [
diff --git a/packages/@react-stately/color/package.json b/packages/@react-stately/color/package.json
index 95956c9d549..7597c6909e5 100644
--- a/packages/@react-stately/color/package.json
+++ b/packages/@react-stately/color/package.json
@@ -5,6 +5,11 @@
"license": "Apache-2.0",
"main": "dist/main.js",
"module": "dist/module.js",
+ "exports": {
+ "types": "./dist/types.d.ts",
+ "import": "./dist/import.mjs",
+ "require": "./dist/main.js"
+ },
"types": "dist/types.d.ts",
"source": "src/index.ts",
"files": [
diff --git a/packages/@react-stately/combobox/package.json b/packages/@react-stately/combobox/package.json
index 28e8e65e595..0e19144638c 100644
--- a/packages/@react-stately/combobox/package.json
+++ b/packages/@react-stately/combobox/package.json
@@ -5,6 +5,11 @@
"license": "Apache-2.0",
"main": "dist/main.js",
"module": "dist/module.js",
+ "exports": {
+ "types": "./dist/types.d.ts",
+ "import": "./dist/import.mjs",
+ "require": "./dist/main.js"
+ },
"types": "dist/types.d.ts",
"source": "src/index.ts",
"files": [
diff --git a/packages/@react-stately/data/package.json b/packages/@react-stately/data/package.json
index 4515ebca6d2..b1f6a776942 100644
--- a/packages/@react-stately/data/package.json
+++ b/packages/@react-stately/data/package.json
@@ -5,6 +5,11 @@
"license": "Apache-2.0",
"main": "dist/main.js",
"module": "dist/module.js",
+ "exports": {
+ "types": "./dist/types.d.ts",
+ "import": "./dist/import.mjs",
+ "require": "./dist/main.js"
+ },
"types": "dist/types.d.ts",
"source": "src/index.ts",
"files": [
diff --git a/packages/@react-stately/datepicker/package.json b/packages/@react-stately/datepicker/package.json
index 98bb82c90c7..672f52440e2 100644
--- a/packages/@react-stately/datepicker/package.json
+++ b/packages/@react-stately/datepicker/package.json
@@ -5,6 +5,11 @@
"license": "Apache-2.0",
"main": "dist/main.js",
"module": "dist/module.js",
+ "exports": {
+ "types": "./dist/types.d.ts",
+ "import": "./dist/import.mjs",
+ "require": "./dist/main.js"
+ },
"types": "dist/types.d.ts",
"source": "src/index.ts",
"files": [
diff --git a/packages/@react-stately/dnd/package.json b/packages/@react-stately/dnd/package.json
index 84450662818..9f3ddec540d 100644
--- a/packages/@react-stately/dnd/package.json
+++ b/packages/@react-stately/dnd/package.json
@@ -5,6 +5,11 @@
"license": "Apache-2.0",
"main": "dist/main.js",
"module": "dist/module.js",
+ "exports": {
+ "types": "./dist/types.d.ts",
+ "import": "./dist/import.mjs",
+ "require": "./dist/main.js"
+ },
"types": "dist/types.d.ts",
"source": "src/index.ts",
"files": [
diff --git a/packages/@react-stately/grid/package.json b/packages/@react-stately/grid/package.json
index ce6abe11146..fb6b3b968da 100644
--- a/packages/@react-stately/grid/package.json
+++ b/packages/@react-stately/grid/package.json
@@ -5,6 +5,11 @@
"license": "Apache-2.0",
"main": "dist/main.js",
"module": "dist/module.js",
+ "exports": {
+ "types": "./dist/types.d.ts",
+ "import": "./dist/import.mjs",
+ "require": "./dist/main.js"
+ },
"types": "dist/types.d.ts",
"source": "src/index.ts",
"files": [
diff --git a/packages/@react-stately/layout/package.json b/packages/@react-stately/layout/package.json
index 9e09f6f2e13..ed9db59dbec 100644
--- a/packages/@react-stately/layout/package.json
+++ b/packages/@react-stately/layout/package.json
@@ -5,6 +5,11 @@
"license": "Apache-2.0",
"main": "dist/main.js",
"module": "dist/module.js",
+ "exports": {
+ "types": "./dist/types.d.ts",
+ "import": "./dist/import.mjs",
+ "require": "./dist/main.js"
+ },
"types": "dist/types.d.ts",
"source": "src/index.ts",
"files": [
diff --git a/packages/@react-stately/list/package.json b/packages/@react-stately/list/package.json
index 034e3875b14..0f2da49d95a 100644
--- a/packages/@react-stately/list/package.json
+++ b/packages/@react-stately/list/package.json
@@ -5,6 +5,11 @@
"license": "Apache-2.0",
"main": "dist/main.js",
"module": "dist/module.js",
+ "exports": {
+ "types": "./dist/types.d.ts",
+ "import": "./dist/import.mjs",
+ "require": "./dist/main.js"
+ },
"types": "dist/types.d.ts",
"source": "src/index.ts",
"files": [
diff --git a/packages/@react-stately/menu/package.json b/packages/@react-stately/menu/package.json
index 97361935b90..110ec172813 100644
--- a/packages/@react-stately/menu/package.json
+++ b/packages/@react-stately/menu/package.json
@@ -5,6 +5,11 @@
"license": "Apache-2.0",
"main": "dist/main.js",
"module": "dist/module.js",
+ "exports": {
+ "types": "./dist/types.d.ts",
+ "import": "./dist/import.mjs",
+ "require": "./dist/main.js"
+ },
"types": "dist/types.d.ts",
"source": "src/index.ts",
"files": [
diff --git a/packages/@react-stately/numberfield/package.json b/packages/@react-stately/numberfield/package.json
index 8c6478f80a2..fdc4d66d07a 100644
--- a/packages/@react-stately/numberfield/package.json
+++ b/packages/@react-stately/numberfield/package.json
@@ -5,6 +5,11 @@
"license": "Apache-2.0",
"main": "dist/main.js",
"module": "dist/module.js",
+ "exports": {
+ "types": "./dist/types.d.ts",
+ "import": "./dist/import.mjs",
+ "require": "./dist/main.js"
+ },
"types": "dist/types.d.ts",
"source": "src/index.ts",
"files": [
diff --git a/packages/@react-stately/overlays/package.json b/packages/@react-stately/overlays/package.json
index b087da8cdb8..70d49079c8d 100644
--- a/packages/@react-stately/overlays/package.json
+++ b/packages/@react-stately/overlays/package.json
@@ -5,6 +5,11 @@
"license": "Apache-2.0",
"main": "dist/main.js",
"module": "dist/module.js",
+ "exports": {
+ "types": "./dist/types.d.ts",
+ "import": "./dist/import.mjs",
+ "require": "./dist/main.js"
+ },
"types": "dist/types.d.ts",
"source": "src/index.ts",
"files": [
diff --git a/packages/@react-stately/pagination/package.json b/packages/@react-stately/pagination/package.json
index e76ee84d14c..dc424a4fce6 100644
--- a/packages/@react-stately/pagination/package.json
+++ b/packages/@react-stately/pagination/package.json
@@ -6,6 +6,11 @@
"private": true,
"main": "dist/main.js",
"module": "dist/module.js",
+ "exports": {
+ "types": "./dist/types.d.ts",
+ "import": "./dist/import.mjs",
+ "require": "./dist/main.js"
+ },
"types": "dist/types.d.ts",
"source": "src/index.ts",
"files": [
diff --git a/packages/@react-stately/radio/package.json b/packages/@react-stately/radio/package.json
index f5c252036a2..d779a674fc4 100644
--- a/packages/@react-stately/radio/package.json
+++ b/packages/@react-stately/radio/package.json
@@ -5,6 +5,11 @@
"license": "Apache-2.0",
"main": "dist/main.js",
"module": "dist/module.js",
+ "exports": {
+ "types": "./dist/types.d.ts",
+ "import": "./dist/import.mjs",
+ "require": "./dist/main.js"
+ },
"types": "dist/types.d.ts",
"source": "src/index.ts",
"files": [
diff --git a/packages/@react-stately/searchfield/package.json b/packages/@react-stately/searchfield/package.json
index 817035599a7..a9458de85ca 100644
--- a/packages/@react-stately/searchfield/package.json
+++ b/packages/@react-stately/searchfield/package.json
@@ -5,6 +5,11 @@
"license": "Apache-2.0",
"main": "dist/main.js",
"module": "dist/module.js",
+ "exports": {
+ "types": "./dist/types.d.ts",
+ "import": "./dist/import.mjs",
+ "require": "./dist/main.js"
+ },
"types": "dist/types.d.ts",
"source": "src/index.ts",
"files": [
diff --git a/packages/@react-stately/select/package.json b/packages/@react-stately/select/package.json
index 1869e752462..c92d1741d75 100644
--- a/packages/@react-stately/select/package.json
+++ b/packages/@react-stately/select/package.json
@@ -5,6 +5,11 @@
"license": "Apache-2.0",
"main": "dist/main.js",
"module": "dist/module.js",
+ "exports": {
+ "types": "./dist/types.d.ts",
+ "import": "./dist/import.mjs",
+ "require": "./dist/main.js"
+ },
"types": "dist/types.d.ts",
"source": "src/index.ts",
"files": [
diff --git a/packages/@react-stately/selection/package.json b/packages/@react-stately/selection/package.json
index 126f766010f..69bf2bed75c 100644
--- a/packages/@react-stately/selection/package.json
+++ b/packages/@react-stately/selection/package.json
@@ -5,6 +5,11 @@
"license": "Apache-2.0",
"main": "dist/main.js",
"module": "dist/module.js",
+ "exports": {
+ "types": "./dist/types.d.ts",
+ "import": "./dist/import.mjs",
+ "require": "./dist/main.js"
+ },
"types": "dist/types.d.ts",
"source": "src/index.ts",
"files": [
diff --git a/packages/@react-stately/slider/package.json b/packages/@react-stately/slider/package.json
index 6b07d6176fb..e614d3d4280 100644
--- a/packages/@react-stately/slider/package.json
+++ b/packages/@react-stately/slider/package.json
@@ -5,6 +5,11 @@
"license": "Apache-2.0",
"main": "dist/main.js",
"module": "dist/module.js",
+ "exports": {
+ "types": "./dist/types.d.ts",
+ "import": "./dist/import.mjs",
+ "require": "./dist/main.js"
+ },
"types": "dist/types.d.ts",
"source": "src/index.ts",
"files": [
diff --git a/packages/@react-stately/table/package.json b/packages/@react-stately/table/package.json
index 68c56dc37b4..112d566cdb5 100644
--- a/packages/@react-stately/table/package.json
+++ b/packages/@react-stately/table/package.json
@@ -5,6 +5,11 @@
"license": "Apache-2.0",
"main": "dist/main.js",
"module": "dist/module.js",
+ "exports": {
+ "types": "./dist/types.d.ts",
+ "import": "./dist/import.mjs",
+ "require": "./dist/main.js"
+ },
"types": "dist/types.d.ts",
"source": "src/index.ts",
"files": [
diff --git a/packages/@react-stately/tabs/package.json b/packages/@react-stately/tabs/package.json
index 068061885fb..f134653da3e 100644
--- a/packages/@react-stately/tabs/package.json
+++ b/packages/@react-stately/tabs/package.json
@@ -5,6 +5,11 @@
"license": "Apache-2.0",
"main": "dist/main.js",
"module": "dist/module.js",
+ "exports": {
+ "types": "./dist/types.d.ts",
+ "import": "./dist/import.mjs",
+ "require": "./dist/main.js"
+ },
"types": "dist/types.d.ts",
"source": "src/index.ts",
"files": [
diff --git a/packages/@react-stately/tag/package.json b/packages/@react-stately/tag/package.json
index ce9b085151f..cd3da18b393 100644
--- a/packages/@react-stately/tag/package.json
+++ b/packages/@react-stately/tag/package.json
@@ -5,6 +5,11 @@
"license": "Apache-2.0",
"main": "dist/main.js",
"module": "dist/module.js",
+ "exports": {
+ "types": "./dist/types.d.ts",
+ "import": "./dist/import.mjs",
+ "require": "./dist/main.js"
+ },
"types": "dist/types.d.ts",
"source": "src/index.ts",
"files": [
diff --git a/packages/@react-stately/toast/package.json b/packages/@react-stately/toast/package.json
index dc517e7cc6f..417d25e3e9a 100644
--- a/packages/@react-stately/toast/package.json
+++ b/packages/@react-stately/toast/package.json
@@ -5,6 +5,11 @@
"license": "Apache-2.0",
"main": "dist/main.js",
"module": "dist/module.js",
+ "exports": {
+ "types": "./dist/types.d.ts",
+ "import": "./dist/import.mjs",
+ "require": "./dist/main.js"
+ },
"types": "dist/types.d.ts",
"source": "src/index.ts",
"files": [
diff --git a/packages/@react-stately/toggle/package.json b/packages/@react-stately/toggle/package.json
index 97da310d021..fc883e3dde4 100644
--- a/packages/@react-stately/toggle/package.json
+++ b/packages/@react-stately/toggle/package.json
@@ -5,6 +5,11 @@
"license": "Apache-2.0",
"main": "dist/main.js",
"module": "dist/module.js",
+ "exports": {
+ "types": "./dist/types.d.ts",
+ "import": "./dist/import.mjs",
+ "require": "./dist/main.js"
+ },
"types": "dist/types.d.ts",
"source": "src/index.ts",
"files": [
diff --git a/packages/@react-stately/tooltip/package.json b/packages/@react-stately/tooltip/package.json
index b13742f7113..724bf74602e 100644
--- a/packages/@react-stately/tooltip/package.json
+++ b/packages/@react-stately/tooltip/package.json
@@ -5,6 +5,11 @@
"license": "Apache-2.0",
"main": "dist/main.js",
"module": "dist/module.js",
+ "exports": {
+ "types": "./dist/types.d.ts",
+ "import": "./dist/import.mjs",
+ "require": "./dist/main.js"
+ },
"types": "dist/types.d.ts",
"source": "src/index.ts",
"files": [
diff --git a/packages/@react-stately/tree/package.json b/packages/@react-stately/tree/package.json
index 611e7a1992f..0d4a29de807 100644
--- a/packages/@react-stately/tree/package.json
+++ b/packages/@react-stately/tree/package.json
@@ -5,6 +5,11 @@
"license": "Apache-2.0",
"main": "dist/main.js",
"module": "dist/module.js",
+ "exports": {
+ "types": "./dist/types.d.ts",
+ "import": "./dist/import.mjs",
+ "require": "./dist/main.js"
+ },
"types": "dist/types.d.ts",
"source": "src/index.ts",
"files": [
diff --git a/packages/@react-stately/utils/package.json b/packages/@react-stately/utils/package.json
index ce000c35a59..e2cec6e00db 100644
--- a/packages/@react-stately/utils/package.json
+++ b/packages/@react-stately/utils/package.json
@@ -5,6 +5,11 @@
"license": "Apache-2.0",
"main": "dist/main.js",
"module": "dist/module.js",
+ "exports": {
+ "types": "./dist/types.d.ts",
+ "import": "./dist/import.mjs",
+ "require": "./dist/main.js"
+ },
"types": "dist/types.d.ts",
"source": "src/index.ts",
"files": [
diff --git a/packages/@react-stately/virtualizer/package.json b/packages/@react-stately/virtualizer/package.json
index 4b37d825dce..12abe066a9c 100644
--- a/packages/@react-stately/virtualizer/package.json
+++ b/packages/@react-stately/virtualizer/package.json
@@ -5,6 +5,11 @@
"license": "Apache-2.0",
"main": "dist/main.js",
"module": "dist/module.js",
+ "exports": {
+ "types": "./dist/types.d.ts",
+ "import": "./dist/import.mjs",
+ "require": "./dist/main.js"
+ },
"types": "dist/types.d.ts",
"source": "src/index.ts",
"files": [
diff --git a/packages/@spectrum-icons/color/package.json b/packages/@spectrum-icons/color/package.json
index 140aa06835e..336bea7e894 100644
--- a/packages/@spectrum-icons/color/package.json
+++ b/packages/@spectrum-icons/color/package.json
@@ -7,9 +7,19 @@
"type": "git",
"url": "https://github.com/adobe/react-spectrum"
},
+ "exports": {
+ "./*": {
+ "types": "./*.d.ts",
+ "import": "./*.module.mjs",
+ "require": "./*.js"
+ }
+ },
"scripts": {
- "build-icons": "cross-env BUILD_ENV=production babel --root-mode upward src -d . --extensions '.tsx'",
- "make-icons": "babel-node --presets @babel/env ./scripts/generateIcons.js -i '[]' && tsc --project ./tsconfig.types.json"
+ "build-cjs": "cross-env BUILD_ENV=production babel --root-mode upward src -d . --extensions '.ts,.tsx'",
+ "build-esm": "cross-env BUILD_ENV=production babel src -d . --extensions '.ts,.tsx' --out-file-extension '.module.mjs' --config-file '../../../babel-esm.config.json'",
+ "generate-types": "tsc --project ./tsconfig.types.json",
+ "build-icons": "yarn build-cjs && yarn build-esm",
+ "make-icons": "babel-node --extensions '.cjs,.js' --presets @babel/env ./scripts/generateIcons.cjs -i '[]' && yarn generate-types"
},
"dependencies": {
"@adobe/react-spectrum-workflow-color": "1.1.0",
diff --git a/packages/@spectrum-icons/color/scripts/generateIcons.js b/packages/@spectrum-icons/color/scripts/generateIcons.cjs
similarity index 97%
rename from packages/@spectrum-icons/color/scripts/generateIcons.js
rename to packages/@spectrum-icons/color/scripts/generateIcons.cjs
index 0597db9fde7..eba326e974c 100644
--- a/packages/@spectrum-icons/color/scripts/generateIcons.js
+++ b/packages/@spectrum-icons/color/scripts/generateIcons.cjs
@@ -22,7 +22,7 @@ function template(iconName) {
iconRename = '_' + importName;
}
return (
-`import {${iconName} as IconComponent} from '@adobe/react-spectrum-workflow-color/dist/${iconRename}';
+`import {${iconName} as IconComponent} from '@adobe/react-spectrum-workflow-color/dist/${iconRename}.js';
import {Icon} from '@react-spectrum/icon';
import React from 'react';
diff --git a/packages/@spectrum-icons/express/package.json b/packages/@spectrum-icons/express/package.json
index b1c17e0d84f..01010f32d4a 100644
--- a/packages/@spectrum-icons/express/package.json
+++ b/packages/@spectrum-icons/express/package.json
@@ -7,9 +7,19 @@
"type": "git",
"url": "https://github.com/adobe/react-spectrum"
},
+ "exports": {
+ "./*": {
+ "types": "./*.d.ts",
+ "import": "./*.module.mjs",
+ "require": "./*.js"
+ }
+ },
"scripts": {
- "build-icons": "cross-env BUILD_ENV=production babel --root-mode upward src -d . --extensions '.tsx'",
- "make-icons": "babel-node --presets @babel/env ./scripts/generateIcons.js -i '[]' && tsc --project ./tsconfig.types.json"
+ "build-cjs": "cross-env BUILD_ENV=production babel --root-mode upward src -d . --extensions '.ts,.tsx'",
+ "build-esm": "cross-env BUILD_ENV=production babel src -d . --extensions '.ts,.tsx' --out-file-extension '.module.mjs' --config-file '../../../babel-esm.config.json'",
+ "generate-types": "tsc --project ./tsconfig.types.json",
+ "build-icons": "yarn build-cjs && yarn build-esm",
+ "make-icons": "babel-node --extensions '.cjs,.js' --presets @babel/env ./scripts/generateIcons.cjs -i '[]' && yarn generate-types"
},
"dependencies": {
"@adobe/spectrum-css-ccx-workflow-icons": "1.0.2",
diff --git a/packages/@spectrum-icons/express/scripts/generateIcons.js b/packages/@spectrum-icons/express/scripts/generateIcons.cjs
similarity index 100%
rename from packages/@spectrum-icons/express/scripts/generateIcons.js
rename to packages/@spectrum-icons/express/scripts/generateIcons.cjs
diff --git a/packages/@spectrum-icons/illustrations/.gitignore b/packages/@spectrum-icons/illustrations/.gitignore
index 96b416b82fe..6a4c626a218 100644
--- a/packages/@spectrum-icons/illustrations/.gitignore
+++ b/packages/@spectrum-icons/illustrations/.gitignore
@@ -6,3 +6,4 @@
!tsconfig.types.json
!/src
!.npmignore
+!/scripts
diff --git a/packages/@spectrum-icons/illustrations/package.json b/packages/@spectrum-icons/illustrations/package.json
index d360739835c..d6041c395da 100644
--- a/packages/@spectrum-icons/illustrations/package.json
+++ b/packages/@spectrum-icons/illustrations/package.json
@@ -7,8 +7,18 @@
"type": "git",
"url": "https://github.com/adobe/react-spectrum"
},
+ "exports": {
+ "./*": {
+ "types": "./*.d.ts",
+ "import": "./*.module.mjs",
+ "require": "./*.js"
+ }
+ },
"scripts": {
- "build-icons": "cross-env BUILD_ENV=production babel --root-mode upward src -d . --extensions '.ts,.tsx' && tsc --project ./tsconfig.types.json"
+ "build-cjs": "cross-env BUILD_ENV=production babel --root-mode upward src -d . --extensions '.ts,.tsx'",
+ "build-esm": "cross-env BUILD_ENV=production babel src -d . --extensions '.ts,.tsx' --out-file-extension '.module.mjs' --config-file '../../../babel-esm.config.json'",
+ "generate-types": "tsc --project ./tsconfig.types.json",
+ "build-icons": "yarn build-cjs && yarn build-esm && yarn generate-types"
},
"dependencies": {
"@react-aria/utils": "^3.14.2",
diff --git a/packages/@spectrum-icons/ui/package.json b/packages/@spectrum-icons/ui/package.json
index b3c761d5fe6..439005d3d92 100644
--- a/packages/@spectrum-icons/ui/package.json
+++ b/packages/@spectrum-icons/ui/package.json
@@ -7,9 +7,19 @@
"type": "git",
"url": "https://github.com/adobe/react-spectrum"
},
+ "exports": {
+ "./*": {
+ "types": "./*.d.ts",
+ "import": "./*.module.mjs",
+ "require": "./*.js"
+ }
+ },
"scripts": {
- "build-icons": "cross-env BUILD_ENV=production babel --root-mode upward src -d . --extensions '.tsx'",
- "make-icons": "babel-node --presets @babel/env ./scripts/generateIcons.js -i '[]' && tsc --project ./tsconfig.types.json"
+ "build-cjs": "cross-env BUILD_ENV=production babel --root-mode upward src -d . --extensions '.ts,.tsx'",
+ "build-esm": "cross-env BUILD_ENV=production babel src -d . --extensions '.ts,.tsx' --out-file-extension '.module.mjs' --config-file '../../../babel-esm.config.json'",
+ "generate-types": "tsc --project ./tsconfig.types.json",
+ "build-icons": "yarn build-cjs && yarn build-esm",
+ "make-icons": "babel-node --extensions '.cjs,.js' --presets @babel/env ./scripts/generateIcons.cjs -i '[]' && yarn generate-types"
},
"dependencies": {
"@adobe/react-spectrum-ui": "1.2.0",
diff --git a/packages/@spectrum-icons/ui/scripts/generateIcons.js b/packages/@spectrum-icons/ui/scripts/generateIcons.cjs
similarity index 97%
rename from packages/@spectrum-icons/ui/scripts/generateIcons.js
rename to packages/@spectrum-icons/ui/scripts/generateIcons.cjs
index 0fa648fe45d..b3f741d32bf 100644
--- a/packages/@spectrum-icons/ui/scripts/generateIcons.js
+++ b/packages/@spectrum-icons/ui/scripts/generateIcons.cjs
@@ -34,7 +34,7 @@ function template(iconName) {
let jsx = compileSVG(path.join(expressDir, expressName + '.svg'), 'ExpressIcon');
return (
-`import {${iconName} as IconComponent} from '@adobe/react-spectrum-ui/dist/${iconName}';
+`import {${iconName} as IconComponent} from '@adobe/react-spectrum-ui/dist/${iconName}.js';
import {UIIcon, UIIconPropsWithoutChildren} from '@react-spectrum/icon';
import {useProvider} from '@react-spectrum/provider';
import React from 'react';
@@ -52,7 +52,7 @@ export default function ${iconName}(props: UIIconPropsWithoutChildren) {
}
return (
-`import {${iconName} as IconComponent} from '@adobe/react-spectrum-ui/dist/${iconName}';
+`import {${iconName} as IconComponent} from '@adobe/react-spectrum-ui/dist/${iconName}.js';
import {UIIcon, UIIconPropsWithoutChildren} from '@react-spectrum/icon';
import React from 'react';
diff --git a/packages/@spectrum-icons/workflow/package.json b/packages/@spectrum-icons/workflow/package.json
index 54c9db39c4b..831fb567bc5 100644
--- a/packages/@spectrum-icons/workflow/package.json
+++ b/packages/@spectrum-icons/workflow/package.json
@@ -7,9 +7,19 @@
"type": "git",
"url": "https://github.com/adobe/react-spectrum"
},
+ "exports": {
+ "./*": {
+ "types": "./*.d.ts",
+ "import": "./*.module.mjs",
+ "require": "./*.js"
+ }
+ },
"scripts": {
- "build-icons": "cross-env BUILD_ENV=production babel --root-mode upward src -d . --extensions '.tsx'",
- "make-icons": "babel-node --presets @babel/env ./scripts/generateIcons.js -i '[]' && tsc --project ./tsconfig.types.json"
+ "build-cjs": "cross-env BUILD_ENV=production babel --root-mode upward src -d . --extensions '.ts,.tsx'",
+ "build-esm": "cross-env BUILD_ENV=production babel src -d . --extensions '.ts,.tsx' --out-file-extension '.module.mjs' --config-file '../../../babel-esm.config.json'",
+ "generate-types": "tsc --project ./tsconfig.types.json",
+ "build-icons": "yarn build-cjs && yarn build-esm",
+ "make-icons": "babel-node --extensions '.cjs,.js' --presets @babel/env ./scripts/generateIcons.cjs -i '[]' && yarn generate-types"
},
"dependencies": {
"@adobe/react-spectrum-workflow": "2.3.3",
diff --git a/packages/@spectrum-icons/workflow/scripts/generateIcons.js b/packages/@spectrum-icons/workflow/scripts/generateIcons.cjs
similarity index 97%
rename from packages/@spectrum-icons/workflow/scripts/generateIcons.js
rename to packages/@spectrum-icons/workflow/scripts/generateIcons.cjs
index e2a90a97ace..c8311efafa1 100644
--- a/packages/@spectrum-icons/workflow/scripts/generateIcons.js
+++ b/packages/@spectrum-icons/workflow/scripts/generateIcons.cjs
@@ -22,7 +22,7 @@ function template(iconName) {
iconRename = '_' + importName;
}
return (
-`import {${iconName} as IconComponent} from '@adobe/react-spectrum-workflow/dist/${importName}';
+`import {${iconName} as IconComponent} from '@adobe/react-spectrum-workflow/dist/${importName}.js';
import {Icon, IconPropsWithoutChildren} from '@react-spectrum/icon';
import React from 'react';
diff --git a/packages/react-aria/package.json b/packages/react-aria/package.json
index 23af68781eb..409d4fe517e 100644
--- a/packages/react-aria/package.json
+++ b/packages/react-aria/package.json
@@ -5,6 +5,11 @@
"license": "Apache-2.0",
"main": "dist/main.js",
"module": "dist/module.js",
+ "exports": {
+ "types": "./dist/types.d.ts",
+ "import": "./dist/import.mjs",
+ "require": "./dist/main.js"
+ },
"types": "dist/types.d.ts",
"source": "src/index.ts",
"files": [
diff --git a/packages/react-stately/package.json b/packages/react-stately/package.json
index fdf996b3381..b17a2e13188 100644
--- a/packages/react-stately/package.json
+++ b/packages/react-stately/package.json
@@ -5,6 +5,11 @@
"license": "Apache-2.0",
"main": "dist/main.js",
"module": "dist/module.js",
+ "exports": {
+ "types": "./dist/types.d.ts",
+ "import": "./dist/import.mjs",
+ "require": "./dist/main.js"
+ },
"types": "dist/types.d.ts",
"source": "src/index.ts",
"files": [
diff --git a/plop-templates/@react-aria/package.json.hbs b/plop-templates/@react-aria/package.json.hbs
index 8ae775e4dac..27b2df0e209 100644
--- a/plop-templates/@react-aria/package.json.hbs
+++ b/plop-templates/@react-aria/package.json.hbs
@@ -7,6 +7,11 @@
"main": "dist/main.js",
"module": "dist/module.js",
"types": "dist/types.d.ts",
+ "exports": {
+ "types": "./dist/types.d.ts",
+ "import": "./dist/import.mjs",
+ "require": "./dist/main.js"
+ },
"source": "src/index.ts",
"files": [
"dist",
diff --git a/plop-templates/@react-spectrum/package.json.hbs b/plop-templates/@react-spectrum/package.json.hbs
index fa660ece727..6cf307aeb2a 100644
--- a/plop-templates/@react-spectrum/package.json.hbs
+++ b/plop-templates/@react-spectrum/package.json.hbs
@@ -7,6 +7,11 @@
"main": "dist/main.js",
"module": "dist/module.js",
"types": "dist/types.d.ts",
+ "exports": {
+ "types": "./dist/types.d.ts",
+ "import": "./dist/import.mjs",
+ "require": "./dist/main.js"
+ },
"source": "src/index.ts",
"files": ["dist", "src"],
"sideEffects": [
diff --git a/plop-templates/@react-stately/package.json.hbs b/plop-templates/@react-stately/package.json.hbs
index 830ae3b811d..a53fc226620 100644
--- a/plop-templates/@react-stately/package.json.hbs
+++ b/plop-templates/@react-stately/package.json.hbs
@@ -7,6 +7,11 @@
"main": "dist/main.js",
"module": "dist/module.js",
"types": "dist/types.d.ts",
+ "exports": {
+ "types": "./dist/types.d.ts",
+ "import": "./dist/import.mjs",
+ "require": "./dist/main.js"
+ },
"source": "src/index.ts",
"files": ["dist", "src"],
"sideEffects": false,
diff --git a/plop-templates/@scope/package.json.hbs b/plop-templates/@scope/package.json.hbs
index ff747954183..03901e24256 100644
--- a/plop-templates/@scope/package.json.hbs
+++ b/plop-templates/@scope/package.json.hbs
@@ -7,6 +7,11 @@
"main": "dist/main.js",
"module": "dist/module.js",
"types": "dist/types.d.ts",
+ "exports": {
+ "types": "./dist/types.d.ts",
+ "import": "./dist/import.mjs",
+ "require": "./dist/main.js"
+ },
"source": "src/index.ts",
"files": [
"dist",
diff --git a/scripts/cleanIcons.js b/scripts/cleanIcons.js
index f878f5bfcf2..43d27fe0943 100644
--- a/scripts/cleanIcons.js
+++ b/scripts/cleanIcons.js
@@ -14,7 +14,7 @@ import path from 'path';
import recursive from 'recursive-readdir';
import rimraf from 'rimraf';
-let topPaths = ['ui', 'workflow', 'color', 'express'].map(name => path.resolve(path.join(__dirname, '..', 'packages', '@spectrum-icons', name)));
+let topPaths = ['ui', 'workflow', 'color', 'express', 'illustrations'].map(name => path.resolve(path.join(__dirname, '..', 'packages', '@spectrum-icons', name)));
topPaths.forEach((rootPath) => {
recursive(rootPath, (err, files) => {
let filteredFiles = files.filter(filePath => /\/src\//.test(filePath));
@@ -24,10 +24,19 @@ topPaths.forEach((rootPath) => {
}
let toRemove = path.basename(filePath, '.tsx');
rimraf(path.join(rootPath, `${toRemove}.js`), [], () => {});
+ rimraf(path.join(rootPath, `${toRemove}.js.map`), [], () => {});
+ rimraf(path.join(rootPath, `${toRemove}.module.mjs`), [], () => {});
+ rimraf(path.join(rootPath, `${toRemove}.module.mjs.map`), [], () => {});
rimraf(path.join(rootPath, `${toRemove}.d.ts`), [], () => {});
rimraf(path.join(rootPath, `${toRemove}.d.ts.map`), [], () => {});
- rimraf(filePath, [], () => {});
+ if (!rootPath.endsWith('illustrations')) {
+ rimraf(filePath, [], () => {});
+ }
});
- rimraf(path.join(rootPath, 'src'), [], () => {});
+ if (!rootPath.endsWith('illustrations')) {
+ rimraf(path.join(rootPath, 'src'), [], () => {});
+ }
+ rimraf(path.join(rootPath, 'index.d.ts'), [], () => {});
+ rimraf(path.join(rootPath, 'index.d.ts.map'), [], () => {});
});
});
diff --git a/scripts/esm-support/loader.mjs b/scripts/esm-support/loader.mjs
new file mode 100644
index 00000000000..d79acde900e
--- /dev/null
+++ b/scripts/esm-support/loader.mjs
@@ -0,0 +1,67 @@
+import fs from 'node:fs/promises';
+import { fileURLToPath } from 'node:url';
+import { parseArgs } from 'node:util';
+
+import parseCSS from 'css-parse';
+
+const { values: { loadFullStyles } } = parseArgs({
+ options: {
+ loadFullStyles: { type: 'boolean' },
+ },
+});
+
+export async function resolve(specifier, context, next) {
+ const nextResult = await next(specifier, context);
+
+ if (!specifier.endsWith('.css')) return nextResult;
+
+ return {
+ format: 'css',
+ shortCircuit: true,
+ url: nextResult.url,
+ };
+}
+
+export async function load(url, context, next) {
+ if (context.format !== 'css') return next(url, context);
+
+ const rawSource = '' + await fs.readFile(fileURLToPath(url));
+ const parsed = parseCssToObject(rawSource);
+
+ return {
+ format: 'json',
+ shortCircuit: true,
+ source: JSON.stringify(parsed),
+ };
+}
+
+function parseCssToObject(rawSource) {
+ const output = {};
+
+ for (const rule of parseCSS(rawSource).stylesheet.rules) {
+ if (rule.selectors) {
+ let selector = rule['selectors'].at(-1); // Get right-most in the selector rule: `.Bar` in `.Foo > .Bar {…}`
+ if (selector[0] !== '.') break; // only care about classes
+
+ selector = selector
+ .substr(1) // Skip the initial `.`
+ .match(/(\w+)/)[1]; // Get only the classname: `Qux` in `.Qux[type="number"]`
+
+ output[selector] = loadFullStyles
+ ? getClassStyles(rule['declarations'])
+ : selector;
+ }
+ }
+
+ return output;
+}
+
+function getClassStyles(declarations) {
+ const styles = {};
+
+ for (const declaration of declarations) {
+ styles[declaration['property']] = declaration['value'];
+ }
+
+ return styles;
+}
diff --git a/scripts/esm-support/testESM.mjs b/scripts/esm-support/testESM.mjs
new file mode 100644
index 00000000000..263128911d4
--- /dev/null
+++ b/scripts/esm-support/testESM.mjs
@@ -0,0 +1,15 @@
+/*
+ * Copyright 2020 Adobe. All rights reserved.
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License. You may obtain a copy
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
+ * OF ANY KIND, either express or implied. See the License for the specific language
+ * governing permissions and limitations under the License.
+ */
+
+import * as Aria from 'react-aria';
+import * as Stately from 'react-stately';
+import * as RSP from '@adobe/react-spectrum';
diff --git a/scripts/findCircularDeps.js b/scripts/findCircularDeps.js
index cda7b050e74..d44d3b7473d 100644
--- a/scripts/findCircularDeps.js
+++ b/scripts/findCircularDeps.js
@@ -11,8 +11,13 @@ function addDep(dep, seen = new Set()) {
if (seen.has(dep)) {
let arr = [...seen];
let index = arr.indexOf(dep);
- console.log(`Circular dependency detected: ${arr.slice(index).join(' -> ')} -> ${dep}`);
- process.exit(1);
+ // ok for pkg to depend on itself
+ if (arr.slice(index).length > 1) {
+ console.log(`Circular dependency detected: ${arr.slice(index).join(' -> ')} -> ${dep}`);
+ process.exit(1);
+ } else {
+ return;
+ }
}
seen.add(dep);
diff --git a/scripts/lint-packages.js b/scripts/lint-packages.js
index 6729584207a..07bf2a59a8f 100644
--- a/scripts/lint-packages.js
+++ b/scripts/lint-packages.js
@@ -72,6 +72,8 @@ for (let pkg of packages) {
softAssert(json.main.endsWith('.js'), `${pkg}#main should be a .js file but got "${json.main}"`);
softAssert(json.module, `${pkg} did not have "module"`);
softAssert(json.module.endsWith('.js'), `${pkg}#module should be a .js file but got "${json.module}"`);
+ softAssert(json.exports.require.endsWith('.js'), `${pkg}#exports#require should be a .js file but got "${json.exports.require}"`);
+ softAssert(json.exports.import.endsWith('.mjs'), `${pkg}#exports#import should be a .mjs file but got "${json.exports.import}"`);
softAssert(json.source, `${pkg} did not have "source"`);
softAssert.equal(json.source, 'src/index.ts', `${pkg} did not match "src/index.ts"`);
softAssert.deepEqual(json.files, ['dist', 'src'], `${pkg} did not match "files"`);
diff --git a/scripts/verdaccio.sh b/scripts/verdaccio.sh
index 7c29f2ec96a..5c615bffc02 100755
--- a/scripts/verdaccio.sh
+++ b/scripts/verdaccio.sh
@@ -94,6 +94,17 @@ then
mv build-stats.txt ../../
mv build ../../$verdaccio_path
+ # install packages in webpack 4 test app
+ cd ../../examples/rsp-webpack-4
+ yarn install
+ yarn jest
+
+ # Build Webpack 4 test app and move to dist folder. Store the size of the build in a text file.
+ yarn build | tee build-stats.txt
+ du -ka dist/ | tee -a webpack-4-build-stats.txt
+ mv webpack-4-build-stats.txt ../../$verdaccio_path/publish-stats
+ mv dist ../../$verdaccio_path/webpack-4
+
# install packages in NextJS test app
cd ../../examples/rsp-next-ts
yarn install
diff --git a/yarn.lock b/yarn.lock
index 8c8bc5640b3..bbdd92752bb 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -7790,6 +7790,13 @@ css-loader@^3.6.0:
schema-utils "^2.7.0"
semver "^6.3.0"
+css-parse@^2.0.0:
+ version "2.0.0"
+ resolved "https://registry.yarnpkg.com/css-parse/-/css-parse-2.0.0.tgz#a468ee667c16d81ccf05c58c38d2a97c780dbfd4"
+ integrity sha512-UNIFik2RgSbiTwIW1IsFwXWn6vs+bYdq83LKTSOsx7NJR7WII9dxewkHLltfTLVppoUApHV0118a4RZRI9FLwA==
+ dependencies:
+ css "^2.0.0"
+
css-select-base-adapter@^0.1.1:
version "0.1.1"
resolved "https://registry.yarnpkg.com/css-select-base-adapter/-/css-select-base-adapter-0.1.1.tgz#3b2ff4972cc362ab88561507a95408a1432135d7"
@@ -7867,6 +7874,16 @@ css.escape@^1.5.1:
resolved "https://registry.yarnpkg.com/css.escape/-/css.escape-1.5.1.tgz#42e27d4fa04ae32f931a4b4d4191fa9cddee97cb"
integrity sha1-QuJ9T6BK4y+TGktNQZH6nN3ul8s=
+css@^2.0.0:
+ version "2.2.4"
+ resolved "https://registry.yarnpkg.com/css/-/css-2.2.4.tgz#c646755c73971f2bba6a601e2cf2fd71b1298929"
+ integrity sha512-oUnjmWpy0niI3x/mPL8dVEI1l7MnG3+HHyRPHf+YFSbK+svOhXpmSOcDURUh2aOCgl2grzrOPt1nHLuCVFULLw==
+ dependencies:
+ inherits "^2.0.3"
+ source-map "^0.6.1"
+ source-map-resolve "^0.5.2"
+ urix "^0.1.0"
+
css@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/css/-/css-3.0.0.tgz#4447a4d58fdd03367c516ca9f64ae365cee4aa5d"
@@ -19301,7 +19318,7 @@ source-list-map@^2.0.0:
resolved "https://registry.yarnpkg.com/source-list-map/-/source-list-map-2.0.1.tgz#3993bd873bfc48479cca9ea3a547835c7c154b34"
integrity sha512-qnQ7gVMxGNxsiL4lEuJwe/To8UnK7fAnmbGEEH8RpLouuKbeEm0lhbQVFIrNSuB+G7tVrAlVsZgETT5nljf+Iw==
-source-map-resolve@^0.5.0:
+source-map-resolve@^0.5.0, source-map-resolve@^0.5.2:
version "0.5.3"
resolved "https://registry.yarnpkg.com/source-map-resolve/-/source-map-resolve-0.5.3.tgz#190866bece7553e1f8f267a2ee82c606b5509a1a"
integrity sha512-Htz+RnsXWk5+P2slx5Jh3Q66vhQj1Cllm0zvnaY98+NFx+Dv2CF/f5O/t8x+KaNdrdIAsruNzoh/KpialbqAnw==