From 8caf6a6abc078b2ca76380b825bc9bc008f43f34 Mon Sep 17 00:00:00 2001 From: Nick Randall Date: Sun, 10 Jul 2022 20:47:39 -0600 Subject: [PATCH 1/9] fix spelling --- package.json | 5 ++- packages/react/package.json | 75 +++++++++++++++++++++++++++++++++++- packages/styled/package.json | 43 ++++++++++++++++++++- packages/utils/package.json | 27 +++++++++++++ 4 files changed, 147 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 30ba195a0..6d11eb2c2 100644 --- a/package.json +++ b/package.json @@ -135,6 +135,9 @@ "react": "React", "react/jsx-runtime": "ReactJSX", "react/jsx-dev-runtime": "ReactJSXDev" + }, + "___experimentalFlags_WILL_CHANGE_IN_PATCH": { + "exports": true } }, "bugs": { @@ -187,7 +190,7 @@ "@manypkg/cli": "^0.16.1", "@mdx-js/mdx": "^1.6.22", "@mdx-js/react": "^1.6.22", - "@preconstruct/cli": "^2.1.5", + "@preconstruct/cli": "^2.1.8", "@testing-library/react": "13.0.0-alpha.5", "@types/jest": "^27.0.3", "@types/node": "^10.11.4", diff --git a/packages/react/package.json b/packages/react/package.json index 359967d82..98fbc10b9 100644 --- a/packages/react/package.json +++ b/packages/react/package.json @@ -7,6 +7,73 @@ "./dist/emotion-react.cjs.js": "./dist/emotion-react.browser.cjs.js", "./dist/emotion-react.esm.js": "./dist/emotion-react.browser.esm.js" }, + "exports": { + "./package.json": "./package.json", + ".": { + "browser": { + "production": { + "module": "./dist/emotion-react.browser.esm.prod.js", + "default": "./dist/emotion-react.browser.cjs.prod.js" + }, + "module": "./dist/emotion-react.browser.esm.dev.js", + "default": "./dist/emotion-react.browser.cjs.js" + }, + "production": { + "module": "./dist/emotion-react.esm.prod.js", + "default": "./dist/emotion-react.cjs.prod.js" + }, + "module": "./dist/emotion-react.esm.dev.js", + "default": "./dist/emotion-react.cjs.js" + }, + "./jsx-runtime": { + "browser": { + "production": { + "module": "./jsx-runtime/dist/emotion-react-jsx-runtime.browser.esm.prod.js", + "default": "./jsx-runtime/dist/emotion-react-jsx-runtime.browser.cjs.prod.js" + }, + "module": "./jsx-runtime/dist/emotion-react-jsx-runtime.browser.esm.dev.js", + "default": "./jsx-runtime/dist/emotion-react-jsx-runtime.browser.cjs.js" + }, + "production": { + "module": "./jsx-runtime/dist/emotion-react-jsx-runtime.esm.prod.js", + "default": "./jsx-runtime/dist/emotion-react-jsx-runtime.cjs.prod.js" + }, + "module": "./jsx-runtime/dist/emotion-react-jsx-runtime.esm.dev.js", + "default": "./jsx-runtime/dist/emotion-react-jsx-runtime.cjs.js" + }, + "./jsx-dev-runtime": { + "browser": { + "production": { + "module": "./jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.browser.esm.prod.js", + "default": "./jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.browser.cjs.prod.js" + }, + "module": "./jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.browser.esm.dev.js", + "default": "./jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.browser.cjs.js" + }, + "production": { + "module": "./jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.esm.prod.js", + "default": "./jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.cjs.prod.js" + }, + "module": "./jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.esm.dev.js", + "default": "./jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.cjs.js" + }, + "./_isolated-hnrs": { + "browser": { + "production": { + "module": "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.browser.esm.prod.js", + "default": "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.browser.cjs.prod.js" + }, + "module": "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.browser.esm.dev.js", + "default": "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.browser.cjs.js" + }, + "production": { + "module": "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.esm.prod.js", + "default": "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.cjs.prod.js" + }, + "module": "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.esm.dev.js", + "default": "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.cjs.js" + } + }, "types": "types/index.d.ts", "files": [ "src", @@ -70,6 +137,12 @@ "./jsx-dev-runtime.js", "./_isolated-hnrs.js" ], - "umdName": "emotionReact" + "umdName": "emotionReact", + "exports": { + "envConditions": [ + "browser", + "worker" + ] + } } } diff --git a/packages/styled/package.json b/packages/styled/package.json index 7a2fd56e3..d73420b96 100644 --- a/packages/styled/package.json +++ b/packages/styled/package.json @@ -54,11 +54,52 @@ "./dist/emotion-styled.cjs.js": "./dist/emotion-styled.browser.cjs.js", "./dist/emotion-styled.esm.js": "./dist/emotion-styled.browser.esm.js" }, + "exports": { + "./package.json": "./package.json", + ".": { + "browser": { + "production": { + "module": "./dist/emotion-styled.browser.esm.prod.js", + "default": "./dist/emotion-styled.browser.cjs.prod.js" + }, + "module": "./dist/emotion-styled.browser.esm.dev.js", + "default": "./dist/emotion-styled.browser.cjs.js" + }, + "production": { + "module": "./dist/emotion-styled.esm.prod.js", + "default": "./dist/emotion-styled.cjs.prod.js" + }, + "module": "./dist/emotion-styled.esm.dev.js", + "default": "./dist/emotion-styled.cjs.js" + }, + "./base": { + "browser": { + "production": { + "module": "./base/dist/emotion-styled-base.browser.esm.prod.js", + "default": "./base/dist/emotion-styled-base.browser.cjs.prod.js" + }, + "module": "./base/dist/emotion-styled-base.browser.esm.dev.js", + "default": "./base/dist/emotion-styled-base.browser.cjs.js" + }, + "production": { + "module": "./base/dist/emotion-styled-base.esm.prod.js", + "default": "./base/dist/emotion-styled-base.cjs.prod.js" + }, + "module": "./base/dist/emotion-styled-base.esm.dev.js", + "default": "./base/dist/emotion-styled-base.cjs.js" + } + }, "preconstruct": { "umdName": "emotionStyled", "entrypoints": [ "./index.js", "./base.js" - ] + ], + "exports": { + "envConditions": [ + "browser", + "worker" + ] + } } } diff --git a/packages/utils/package.json b/packages/utils/package.json index 5367f4dce..ba11578d0 100644 --- a/packages/utils/package.json +++ b/packages/utils/package.json @@ -8,6 +8,25 @@ "./dist/emotion-utils.cjs.js": "./dist/emotion-utils.browser.cjs.js", "./dist/emotion-utils.esm.js": "./dist/emotion-utils.browser.esm.js" }, + "exports": { + "./package.json": "./package.json", + ".": { + "browser": { + "production": { + "module": "./dist/emotion-utils.browser.esm.prod.js", + "default": "./dist/emotion-utils.browser.cjs.prod.js" + }, + "module": "./dist/emotion-utils.browser.esm.dev.js", + "default": "./dist/emotion-utils.browser.cjs.js" + }, + "production": { + "module": "./dist/emotion-utils.esm.prod.js", + "default": "./dist/emotion-utils.cjs.prod.js" + }, + "module": "./dist/emotion-utils.esm.dev.js", + "default": "./dist/emotion-utils.cjs.js" + } + }, "types": "types/index.d.ts", "license": "MIT", "scripts": { @@ -25,5 +44,13 @@ "devDependencies": { "@definitelytyped/dtslint": "0.0.112", "typescript": "^4.5.5" + }, + "preconstruct": { + "exports": { + "envConditions": [ + "browser", + "worker" + ] + } } } From 35000990bba47f6aebff493d4e84768e1f858b86 Mon Sep 17 00:00:00 2001 From: Nick Randall Date: Sun, 10 Jul 2022 21:04:21 -0600 Subject: [PATCH 2/9] adding yarn.lock --- yarn.lock | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/yarn.lock b/yarn.lock index e08674d51..8a96227ab 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5086,10 +5086,10 @@ schema-utils "^2.6.5" source-map "^0.7.3" -"@preconstruct/cli@^2.1.5": - version "2.1.5" - resolved "https://registry.yarnpkg.com/@preconstruct/cli/-/cli-2.1.5.tgz#f7f6d06809f382521589af15f67b87009b240c58" - integrity sha512-bMnGTkaotxq+xoOkXoUOfTFvxBX/ZUxukcacf3mx3G7Iz5m/T4ZGzSOU12pxl64e+rVWGTKlUsgaDSgyFkup0A== +"@preconstruct/cli@^2.1.8": + version "2.1.8" + resolved "https://registry.yarnpkg.com/@preconstruct/cli/-/cli-2.1.8.tgz#7adb77d1db4e88b4bb33ce0ac31a3df5dc17d414" + integrity sha512-s5nrYvNxNDZOgwcjaNfqdkDClbKEDO15ZlH2l7CSunO99/Atj0kHSpKXho6mipJtSRYXGiMzOVN2qH7Dl29XzQ== dependencies: "@babel/code-frame" "^7.5.5" "@babel/core" "^7.7.7" @@ -30601,8 +30601,10 @@ watchpack@^1.7.4: resolved "https://registry.yarnpkg.com/watchpack/-/watchpack-1.7.5.tgz#1267e6c55e0b9b5be44c2023aed5437a2c26c453" integrity sha512-9P3MWk6SrKjHsGkLT2KHXdQ/9SNkyoJbabxnKOoJepsvJjJG8uYTR3yTPxPQvNDI3w4Nz1xnE0TLHK4RIVe/MQ== dependencies: + chokidar "^3.4.1" graceful-fs "^4.1.2" neo-async "^2.5.0" + watchpack-chokidar2 "^2.0.1" optionalDependencies: chokidar "^3.4.1" watchpack-chokidar2 "^2.0.1" From c1ce58e27cda22fec83a1d9aa49dada379ef3a87 Mon Sep 17 00:00:00 2001 From: Nick Randall Date: Sun, 10 Jul 2022 21:22:04 -0600 Subject: [PATCH 3/9] try again --- packages/react/_isolated-hnrs/package.json | 1 - packages/react/jsx-dev-runtime/package.json | 1 - packages/react/jsx-runtime/package.json | 1 - packages/react/package.json | 75 ++++++--------------- packages/styled/base/package.json | 1 - packages/styled/package.json | 43 ++++-------- packages/utils/package.json | 21 ++---- 7 files changed, 40 insertions(+), 103 deletions(-) diff --git a/packages/react/_isolated-hnrs/package.json b/packages/react/_isolated-hnrs/package.json index 33a92e72b..a8a01ced6 100644 --- a/packages/react/_isolated-hnrs/package.json +++ b/packages/react/_isolated-hnrs/package.json @@ -3,7 +3,6 @@ "module": "dist/emotion-react-_isolated-hnrs.esm.js", "umd:main": "dist/emotion-react-_isolated-hnrs.umd.min.js", "browser": { - "./dist/emotion-react-_isolated-hnrs.cjs.js": "./dist/emotion-react-_isolated-hnrs.browser.cjs.js", "./dist/emotion-react-_isolated-hnrs.esm.js": "./dist/emotion-react-_isolated-hnrs.browser.esm.js" }, "sideEffects": false, diff --git a/packages/react/jsx-dev-runtime/package.json b/packages/react/jsx-dev-runtime/package.json index 3a5befd1b..42a33d8e5 100644 --- a/packages/react/jsx-dev-runtime/package.json +++ b/packages/react/jsx-dev-runtime/package.json @@ -3,7 +3,6 @@ "module": "dist/emotion-react-jsx-dev-runtime.esm.js", "umd:main": "dist/emotion-react-jsx-dev-runtime.umd.min.js", "browser": { - "./dist/emotion-react-jsx-dev-runtime.cjs.js": "./dist/emotion-react-jsx-dev-runtime.browser.cjs.js", "./dist/emotion-react-jsx-dev-runtime.esm.js": "./dist/emotion-react-jsx-dev-runtime.browser.esm.js" }, "types": "../types/jsx-dev-runtime", diff --git a/packages/react/jsx-runtime/package.json b/packages/react/jsx-runtime/package.json index 4bc8de6ec..d57371db3 100644 --- a/packages/react/jsx-runtime/package.json +++ b/packages/react/jsx-runtime/package.json @@ -3,7 +3,6 @@ "module": "dist/emotion-react-jsx-runtime.esm.js", "umd:main": "dist/emotion-react-jsx-runtime.umd.min.js", "browser": { - "./dist/emotion-react-jsx-runtime.cjs.js": "./dist/emotion-react-jsx-runtime.browser.cjs.js", "./dist/emotion-react-jsx-runtime.esm.js": "./dist/emotion-react-jsx-runtime.browser.esm.js" }, "types": "../types/jsx-runtime", diff --git a/packages/react/package.json b/packages/react/package.json index 98fbc10b9..de9470c10 100644 --- a/packages/react/package.json +++ b/packages/react/package.json @@ -4,75 +4,42 @@ "main": "dist/emotion-react.cjs.js", "module": "dist/emotion-react.esm.js", "browser": { - "./dist/emotion-react.cjs.js": "./dist/emotion-react.browser.cjs.js", "./dist/emotion-react.esm.js": "./dist/emotion-react.browser.esm.js" }, "exports": { - "./package.json": "./package.json", ".": { - "browser": { - "production": { - "module": "./dist/emotion-react.browser.esm.prod.js", - "default": "./dist/emotion-react.browser.cjs.prod.js" - }, - "module": "./dist/emotion-react.browser.esm.dev.js", - "default": "./dist/emotion-react.browser.cjs.js" + "module": { + "worker": "./dist/emotion-react.worker.esm.js", + "browser": "./dist/emotion-react.browser.esm.js", + "default": "./dist/emotion-react.esm.js" }, - "production": { - "module": "./dist/emotion-react.esm.prod.js", - "default": "./dist/emotion-react.cjs.prod.js" - }, - "module": "./dist/emotion-react.esm.dev.js", "default": "./dist/emotion-react.cjs.js" }, "./jsx-runtime": { - "browser": { - "production": { - "module": "./jsx-runtime/dist/emotion-react-jsx-runtime.browser.esm.prod.js", - "default": "./jsx-runtime/dist/emotion-react-jsx-runtime.browser.cjs.prod.js" - }, - "module": "./jsx-runtime/dist/emotion-react-jsx-runtime.browser.esm.dev.js", - "default": "./jsx-runtime/dist/emotion-react-jsx-runtime.browser.cjs.js" - }, - "production": { - "module": "./jsx-runtime/dist/emotion-react-jsx-runtime.esm.prod.js", - "default": "./jsx-runtime/dist/emotion-react-jsx-runtime.cjs.prod.js" + "module": { + "worker": "./jsx-runtime/dist/emotion-react-jsx-runtime.worker.esm.js", + "browser": "./jsx-runtime/dist/emotion-react-jsx-runtime.browser.esm.js", + "default": "./jsx-runtime/dist/emotion-react-jsx-runtime.esm.js" }, - "module": "./jsx-runtime/dist/emotion-react-jsx-runtime.esm.dev.js", "default": "./jsx-runtime/dist/emotion-react-jsx-runtime.cjs.js" }, - "./jsx-dev-runtime": { - "browser": { - "production": { - "module": "./jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.browser.esm.prod.js", - "default": "./jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.browser.cjs.prod.js" - }, - "module": "./jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.browser.esm.dev.js", - "default": "./jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.browser.cjs.js" + "./_isolated-hnrs": { + "module": { + "worker": "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.worker.esm.js", + "browser": "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.browser.esm.js", + "default": "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.esm.js" }, - "production": { - "module": "./jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.esm.prod.js", - "default": "./jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.cjs.prod.js" + "default": "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.cjs.js" + }, + "./jsx-dev-runtime": { + "module": { + "worker": "./jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.worker.esm.js", + "browser": "./jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.browser.esm.js", + "default": "./jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.esm.js" }, - "module": "./jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.esm.dev.js", "default": "./jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.cjs.js" }, - "./_isolated-hnrs": { - "browser": { - "production": { - "module": "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.browser.esm.prod.js", - "default": "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.browser.cjs.prod.js" - }, - "module": "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.browser.esm.dev.js", - "default": "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.browser.cjs.js" - }, - "production": { - "module": "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.esm.prod.js", - "default": "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.cjs.prod.js" - }, - "module": "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.esm.dev.js", - "default": "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.cjs.js" - } + "./package.json": "./package.json" }, "types": "types/index.d.ts", "files": [ diff --git a/packages/styled/base/package.json b/packages/styled/base/package.json index 96f433f21..f115977ba 100644 --- a/packages/styled/base/package.json +++ b/packages/styled/base/package.json @@ -3,7 +3,6 @@ "module": "dist/emotion-styled-base.esm.js", "umd:main": "dist/emotion-styled-base.umd.min.js", "browser": { - "./dist/emotion-styled-base.cjs.js": "./dist/emotion-styled-base.browser.cjs.js", "./dist/emotion-styled-base.esm.js": "./dist/emotion-styled-base.browser.esm.js" }, "types": "../types/base", diff --git a/packages/styled/package.json b/packages/styled/package.json index d73420b96..8e3af0419 100644 --- a/packages/styled/package.json +++ b/packages/styled/package.json @@ -51,43 +51,26 @@ ], "umd:main": "dist/emotion-styled.umd.min.js", "browser": { - "./dist/emotion-styled.cjs.js": "./dist/emotion-styled.browser.cjs.js", "./dist/emotion-styled.esm.js": "./dist/emotion-styled.browser.esm.js" }, "exports": { - "./package.json": "./package.json", - ".": { - "browser": { - "production": { - "module": "./dist/emotion-styled.browser.esm.prod.js", - "default": "./dist/emotion-styled.browser.cjs.prod.js" - }, - "module": "./dist/emotion-styled.browser.esm.dev.js", - "default": "./dist/emotion-styled.browser.cjs.js" + "./base": { + "module": { + "worker": "./base/dist/emotion-styled-base.worker.esm.js", + "browser": "./base/dist/emotion-styled-base.browser.esm.js", + "default": "./base/dist/emotion-styled-base.esm.js" }, - "production": { - "module": "./dist/emotion-styled.esm.prod.js", - "default": "./dist/emotion-styled.cjs.prod.js" + "default": "./base/dist/emotion-styled-base.cjs.js" + }, + ".": { + "module": { + "worker": "./dist/emotion-styled.worker.esm.js", + "browser": "./dist/emotion-styled.browser.esm.js", + "default": "./dist/emotion-styled.esm.js" }, - "module": "./dist/emotion-styled.esm.dev.js", "default": "./dist/emotion-styled.cjs.js" }, - "./base": { - "browser": { - "production": { - "module": "./base/dist/emotion-styled-base.browser.esm.prod.js", - "default": "./base/dist/emotion-styled-base.browser.cjs.prod.js" - }, - "module": "./base/dist/emotion-styled-base.browser.esm.dev.js", - "default": "./base/dist/emotion-styled-base.browser.cjs.js" - }, - "production": { - "module": "./base/dist/emotion-styled-base.esm.prod.js", - "default": "./base/dist/emotion-styled-base.cjs.prod.js" - }, - "module": "./base/dist/emotion-styled-base.esm.dev.js", - "default": "./base/dist/emotion-styled-base.cjs.js" - } + "./package.json": "./package.json" }, "preconstruct": { "umdName": "emotionStyled", diff --git a/packages/utils/package.json b/packages/utils/package.json index ba11578d0..84e6044b3 100644 --- a/packages/utils/package.json +++ b/packages/utils/package.json @@ -5,27 +5,18 @@ "main": "dist/emotion-utils.cjs.js", "module": "dist/emotion-utils.esm.js", "browser": { - "./dist/emotion-utils.cjs.js": "./dist/emotion-utils.browser.cjs.js", "./dist/emotion-utils.esm.js": "./dist/emotion-utils.browser.esm.js" }, "exports": { - "./package.json": "./package.json", ".": { - "browser": { - "production": { - "module": "./dist/emotion-utils.browser.esm.prod.js", - "default": "./dist/emotion-utils.browser.cjs.prod.js" - }, - "module": "./dist/emotion-utils.browser.esm.dev.js", - "default": "./dist/emotion-utils.browser.cjs.js" + "module": { + "worker": "./dist/emotion-utils.worker.esm.js", + "browser": "./dist/emotion-utils.browser.esm.js", + "default": "./dist/emotion-utils.esm.js" }, - "production": { - "module": "./dist/emotion-utils.esm.prod.js", - "default": "./dist/emotion-utils.cjs.prod.js" - }, - "module": "./dist/emotion-utils.esm.dev.js", "default": "./dist/emotion-utils.cjs.js" - } + }, + "./package.json": "./package.json" }, "types": "types/index.d.ts", "license": "MIT", From 573be6e3fc73f17cf53158539de78b1f821e8b9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20Burzy=C5=84ski?= Date: Tue, 26 Jul 2022 11:43:26 +0200 Subject: [PATCH 4/9] update preconstruct --- package.json | 2 +- yarn.lock | 62 ++++++++++++++++++++++++++++++++++++---------------- 2 files changed, 44 insertions(+), 20 deletions(-) diff --git a/package.json b/package.json index 6d11eb2c2..f6c2a3694 100644 --- a/package.json +++ b/package.json @@ -190,7 +190,7 @@ "@manypkg/cli": "^0.16.1", "@mdx-js/mdx": "^1.6.22", "@mdx-js/react": "^1.6.22", - "@preconstruct/cli": "^2.1.8", + "@preconstruct/cli": "^2.2.1", "@testing-library/react": "13.0.0-alpha.5", "@types/jest": "^27.0.3", "@types/node": "^10.11.4", diff --git a/yarn.lock b/yarn.lock index 8a96227ab..734a29ad9 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5086,10 +5086,10 @@ schema-utils "^2.6.5" source-map "^0.7.3" -"@preconstruct/cli@^2.1.8": - version "2.1.8" - resolved "https://registry.yarnpkg.com/@preconstruct/cli/-/cli-2.1.8.tgz#7adb77d1db4e88b4bb33ce0ac31a3df5dc17d414" - integrity sha512-s5nrYvNxNDZOgwcjaNfqdkDClbKEDO15ZlH2l7CSunO99/Atj0kHSpKXho6mipJtSRYXGiMzOVN2qH7Dl29XzQ== +"@preconstruct/cli@^2.2.1": + version "2.2.1" + resolved "https://registry.yarnpkg.com/@preconstruct/cli/-/cli-2.2.1.tgz#fafff5b5124f895ae933445ca8e2d674006f614f" + integrity sha512-G+sUV9o8l6Ds/82qJZYTXkCsVqPXLuD+bv+nVQeo3OL+eqzO/uAiBBFVp0DMcBJiyQYeU9nb+V8q22/PPaepDw== dependencies: "@babel/code-frame" "^7.5.5" "@babel/core" "^7.7.7" @@ -5099,7 +5099,7 @@ "@rollup/plugin-alias" "^3.1.1" "@rollup/plugin-commonjs" "^15.0.0" "@rollup/plugin-json" "^4.1.0" - "@rollup/plugin-node-resolve" "^9.0.0" + "@rollup/plugin-node-resolve" "^11.2.1" "@rollup/plugin-replace" "^2.4.1" builtin-modules "^3.1.0" chalk "^4.1.0" @@ -5314,6 +5314,18 @@ dependencies: "@rollup/pluginutils" "^3.0.8" +"@rollup/plugin-node-resolve@^11.2.1": + version "11.2.1" + resolved "https://registry.yarnpkg.com/@rollup/plugin-node-resolve/-/plugin-node-resolve-11.2.1.tgz#82aa59397a29cd4e13248b106e6a4a1880362a60" + integrity sha512-yc2n43jcqVyGE2sqV5/YCmocy9ArjVAP/BeXyTtADTBBX6V0e5UMqwO8CdQ0kzjb6zu5P1qMzsScCMRvE9OlVg== + dependencies: + "@rollup/pluginutils" "^3.1.0" + "@types/resolve" "1.17.1" + builtin-modules "^3.1.0" + deepmerge "^4.2.2" + is-module "^1.0.0" + resolve "^1.19.0" + "@rollup/plugin-node-resolve@^7.1.1": version "7.1.3" resolved "https://registry.yarnpkg.com/@rollup/plugin-node-resolve/-/plugin-node-resolve-7.1.3.tgz#80de384edfbd7bfc9101164910f86078151a3eca" @@ -5325,18 +5337,6 @@ is-module "^1.0.0" resolve "^1.14.2" -"@rollup/plugin-node-resolve@^9.0.0": - version "9.0.0" - resolved "https://registry.yarnpkg.com/@rollup/plugin-node-resolve/-/plugin-node-resolve-9.0.0.tgz#39bd0034ce9126b39c1699695f440b4b7d2b62e6" - integrity sha512-gPz+utFHLRrd41WMP13Jq5mqqzHL3OXrfj3/MkSyB6UBIcuNt9j60GCbarzMzdf1VHFpOxfQh/ez7wyadLMqkg== - dependencies: - "@rollup/pluginutils" "^3.1.0" - "@types/resolve" "1.17.1" - builtin-modules "^3.1.0" - deepmerge "^4.2.2" - is-module "^1.0.0" - resolve "^1.17.0" - "@rollup/plugin-replace@^2.3.1", "@rollup/plugin-replace@^2.4.1": version "2.4.2" resolved "https://registry.yarnpkg.com/@rollup/plugin-replace/-/plugin-replace-2.4.2.tgz#a2d539314fbc77c244858faa523012825068510a" @@ -17055,6 +17055,13 @@ is-core-module@^2.5.0: dependencies: has "^1.0.3" +is-core-module@^2.9.0: + version "2.9.0" + resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.9.0.tgz#e1c34429cd51c6dd9e09e0799e396e27b19a9c69" + integrity sha512-+5FPy5PnwmO3lvfMb0AsoPaBG+5KHUI0wYFXOtYPnVVVspTFUuMZNfNaNVRt3FZadstu2c8x23vykRW/NBoU6A== + dependencies: + has "^1.0.3" + is-data-descriptor@^0.1.4: version "0.1.4" resolved "https://registry.yarnpkg.com/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz#0b5ee648388e2c860282e793f1856fec3f301b56" @@ -23472,6 +23479,11 @@ path-parse@^1.0.6: resolved "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz#d62dbb5679405d72c4737ec58600e9ddcf06d24c" integrity sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw== +path-parse@^1.0.7: + version "1.0.7" + resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.7.tgz#fbc114b60ca42b30d9daf5858e4bd68bbedb6735" + integrity sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw== + path-to-regexp@0.1.7: version "0.1.7" resolved "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz#df604178005f522f15eb4490e7247a1bfaa67f8c" @@ -26691,6 +26703,15 @@ resolve@^1.14.2, resolve@^1.18.1, resolve@^1.20.0, resolve@^1.8.1: is-core-module "^2.2.0" path-parse "^1.0.6" +resolve@^1.19.0: + version "1.22.1" + resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.22.1.tgz#27cb2ebb53f91abb49470a928bba7558066ac177" + integrity sha512-nBpuuYuY5jFsli/JIs1oldw6fOQCBioohqWZg/2hiaOybXOft4lonv85uDOKXdf8rhyK159cxU5cDcK/NKk8zw== + dependencies: + is-core-module "^2.9.0" + path-parse "^1.0.7" + supports-preserve-symlinks-flag "^1.0.0" + resolve@^2.0.0-next.3: version "2.0.0-next.3" resolved "https://registry.yarnpkg.com/resolve/-/resolve-2.0.0-next.3.tgz#d41016293d4a8586a39ca5d9b5f15cbea1f55e46" @@ -28776,6 +28797,11 @@ supports-hyperlinks@^2.0.0: has-flag "^4.0.0" supports-color "^7.0.0" +supports-preserve-symlinks-flag@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz#6eda4bd344a3c94aea376d4cc31bc77311039e09" + integrity sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w== + svg-parser@^2.0.2: version "2.0.4" resolved "https://registry.yarnpkg.com/svg-parser/-/svg-parser-2.0.4.tgz#fdc2e29e13951736140b76cb122c8ee6630eb6b5" @@ -30601,10 +30627,8 @@ watchpack@^1.7.4: resolved "https://registry.yarnpkg.com/watchpack/-/watchpack-1.7.5.tgz#1267e6c55e0b9b5be44c2023aed5437a2c26c453" integrity sha512-9P3MWk6SrKjHsGkLT2KHXdQ/9SNkyoJbabxnKOoJepsvJjJG8uYTR3yTPxPQvNDI3w4Nz1xnE0TLHK4RIVe/MQ== dependencies: - chokidar "^3.4.1" graceful-fs "^4.1.2" neo-async "^2.5.0" - watchpack-chokidar2 "^2.0.1" optionalDependencies: chokidar "^3.4.1" watchpack-chokidar2 "^2.0.1" From 44c6a7239142368a4eced99b2da2b325adb35f97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20Burzy=C5=84ski?= Date: Tue, 26 Jul 2022 12:19:49 +0200 Subject: [PATCH 5/9] Update exports configs with extras --- packages/css/package.json | 19 ++++++++++++++++++- packages/native/package.json | 17 ++++++++++++++--- packages/primitives/package.json | 22 +++++++++++++++++++++- packages/react/package.json | 10 ++++++++-- packages/styled/package.json | 8 ++++++-- 5 files changed, 67 insertions(+), 9 deletions(-) diff --git a/packages/css/package.json b/packages/css/package.json index 7bea4af24..c67952869 100644 --- a/packages/css/package.json +++ b/packages/css/package.json @@ -52,11 +52,28 @@ "url": "https://github.com/emotion-js/emotion/issues" }, "umd:main": "dist/emotion-css.umd.min.js", + "exports": { + ".": { + "module": "./dist/emotion-css.esm.js", + "default": "./dist/emotion-css.cjs.js" + }, + "./create-instance": { + "module": "./create-instance/dist/emotion-css-create-instance.esm.js", + "default": "./create-instance/dist/emotion-css-create-instance.cjs.js" + }, + "./package.json": "./package.json", + "./macro": "./macro.js" + }, "preconstruct": { "umdName": "emotion", "entrypoints": [ "./index.js", "./create-instance.js" - ] + ], + "exports": { + "extra": { + "./macro": "./macro.js" + } + } } } diff --git a/packages/native/package.json b/packages/native/package.json index 85324ba96..4b9a367a9 100644 --- a/packages/native/package.json +++ b/packages/native/package.json @@ -4,6 +4,14 @@ "description": "Style and render React Native components using emotion", "main": "dist/emotion-native.cjs.js", "module": "dist/emotion-native.esm.js", + "exports": { + ".": { + "module": "./dist/emotion-native.esm.js", + "default": "./dist/emotion-native.cjs.js" + }, + "./package.json": "./package.json", + "./macro": "./macro.js" + }, "scripts": { "test:typescript": "dtslint types" }, @@ -51,8 +59,11 @@ "publishConfig": { "access": "public" }, - "browser": { - "./dist/emotion-native.cjs.js": "./dist/emotion-native.browser.cjs.js", - "./dist/emotion-native.esm.js": "./dist/emotion-native.browser.esm.js" + "preconstruct": { + "exports": { + "extra": { + "./macro": "./macro.js" + } + } } } diff --git a/packages/primitives/package.json b/packages/primitives/package.json index 05b47a94f..b10cd2d0b 100644 --- a/packages/primitives/package.json +++ b/packages/primitives/package.json @@ -51,7 +51,27 @@ "access": "public" }, "browser": { - "./dist/emotion-primitives.cjs.js": "./dist/emotion-primitives.browser.cjs.js", "./dist/emotion-primitives.esm.js": "./dist/emotion-primitives.browser.esm.js" + }, + "exports": { + ".": { + "module": { + "browser": "./dist/emotion-primitives.browser.esm.js", + "default": "./dist/emotion-primitives.esm.js" + }, + "default": "./dist/emotion-primitives.cjs.js" + }, + "./package.json": "./package.json", + "./macro": "./macro.js" + }, + "preconstruct": { + "exports": { + "extra": { + "./macro": "./macro.js" + }, + "envConditions": [ + "browser" + ] + } } } diff --git a/packages/react/package.json b/packages/react/package.json index de9470c10..bcd5f3358 100644 --- a/packages/react/package.json +++ b/packages/react/package.json @@ -39,7 +39,9 @@ }, "default": "./jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.cjs.js" }, - "./package.json": "./package.json" + "./package.json": "./package.json", + "./types/css-prop": "./types/css-prop.d.ts", + "./macro": "./macro.js" }, "types": "types/index.d.ts", "files": [ @@ -109,7 +111,11 @@ "envConditions": [ "browser", "worker" - ] + ], + "extra": { + "./types/css-prop": "./types/css-prop.d.ts", + "./macro": "./macro.js" + } } } } diff --git a/packages/styled/package.json b/packages/styled/package.json index 8e3af0419..0e0742a4e 100644 --- a/packages/styled/package.json +++ b/packages/styled/package.json @@ -70,7 +70,8 @@ }, "default": "./dist/emotion-styled.cjs.js" }, - "./package.json": "./package.json" + "./package.json": "./package.json", + "./macro": "./macro.js" }, "preconstruct": { "umdName": "emotionStyled", @@ -82,7 +83,10 @@ "envConditions": [ "browser", "worker" - ] + ], + "extra": { + "./macro": "./macro.js" + } } } } From 74580852ca36d0b74dfafcc8483754f18c09f174 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20Burzy=C5=84ski?= Date: Tue, 26 Jul 2022 13:05:40 +0200 Subject: [PATCH 6/9] fixed Flow task --- .flowconfig | 1 + .flowconfig-ci | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.flowconfig b/.flowconfig index 453cebbcd..d04879273 100644 --- a/.flowconfig +++ b/.flowconfig @@ -7,6 +7,7 @@ .*/node_modules/graphql/.* .*/node_modules/metro.* .*/node_modules/@parcel/.* +.*/node_modules/resolve/.* [untyped] .*/node_modules/polished/.* diff --git a/.flowconfig-ci b/.flowconfig-ci index 599ace2fc..0cc0b7f2f 100644 --- a/.flowconfig-ci +++ b/.flowconfig-ci @@ -7,7 +7,7 @@ .*/node_modules/graphql/.* .*/node_modules/metro.* .*/node_modules/@parcel/.* - +.*/node_modules/resolve/.* [untyped] .*/node_modules/polished/.* From 451c0d3f2b2147f88d2379ff23980efc42efbcd7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20Burzy=C5=84ski?= Date: Wed, 27 Jul 2022 23:45:12 +0200 Subject: [PATCH 7/9] Add `.d.ts` reexports and enforce `preconstruct.exports` globally --- package.json | 1 + .../babel-plugin-jsx-pragmatic/package.json | 7 +++++ packages/babel-plugin/package.json | 7 +++++ packages/babel-preset-css-prop/package.json | 7 +++++ packages/cache/package.json | 20 ++++++++++++-- packages/cache/src/index.d.ts | 2 ++ packages/css-prettifier/package.json | 7 +++++ packages/css-prettifier/src/index.d.ts | 2 ++ packages/css/src/create-instance.d.ts | 2 ++ packages/css/src/index.d.ts | 1 + packages/eslint-plugin/package.json | 8 ++++++ packages/hash/package.json | 12 ++++++--- packages/hash/src/index.d.ts | 2 ++ packages/is-prop-valid/package.json | 12 ++++++--- packages/is-prop-valid/src/index.d.ts | 2 ++ packages/jest/package.json | 19 +++++++++++++ packages/jest/src/enzyme-serializer.d.ts | 1 + packages/jest/src/enzyme.d.ts | 1 + packages/jest/src/index.d.ts | 1 + packages/jest/src/serializer.d.ts | 1 + packages/memoize/package.json | 12 ++++++--- packages/memoize/src/index.d.ts | 2 ++ packages/native/src/index.d.ts | 2 ++ packages/native/tsconfig.json | 17 ++++++++++++ packages/primitives-core/package.json | 18 ++++++++++++- packages/react/src/_isolated-hnrs.d.ts | 3 +++ packages/react/src/index.d.ts | 1 + packages/react/src/jsx-dev-runtime.d.ts | 1 + packages/react/src/jsx-runtime.d.ts | 1 + packages/serialize/package.json | 18 ++++++++++++- packages/serialize/src/index.d.ts | 2 ++ packages/server/create-instance/package.json | 3 ++- packages/server/package.json | 27 +++++++++++++++++-- .../server/src/create-instance/index.d.ts | 2 ++ packages/server/src/index.d.ts | 1 + packages/sheet/package.json | 18 ++++++++++++- packages/sheet/src/index.d.ts | 2 ++ packages/styled/src/base.d.ts | 2 ++ packages/styled/src/index.d.ts | 2 ++ packages/unitless/package.json | 12 ++++++--- packages/unitless/src/index.d.ts | 2 ++ packages/utils/src/index.d.ts | 1 + packages/weak-memoize/package.json | 12 ++++++--- packages/weak-memoize/src/index.d.ts | 2 ++ tsconfig.json | 24 +++++++++++++++++ 45 files changed, 279 insertions(+), 23 deletions(-) create mode 100644 packages/cache/src/index.d.ts create mode 100644 packages/css-prettifier/src/index.d.ts create mode 100644 packages/css/src/create-instance.d.ts create mode 100644 packages/css/src/index.d.ts create mode 100644 packages/hash/src/index.d.ts create mode 100644 packages/is-prop-valid/src/index.d.ts create mode 100644 packages/jest/src/enzyme-serializer.d.ts create mode 100644 packages/jest/src/enzyme.d.ts create mode 100644 packages/jest/src/index.d.ts create mode 100644 packages/jest/src/serializer.d.ts create mode 100644 packages/memoize/src/index.d.ts create mode 100644 packages/native/src/index.d.ts create mode 100644 packages/native/tsconfig.json create mode 100644 packages/react/src/_isolated-hnrs.d.ts create mode 100644 packages/react/src/index.d.ts create mode 100644 packages/react/src/jsx-dev-runtime.d.ts create mode 100644 packages/react/src/jsx-runtime.d.ts create mode 100644 packages/serialize/src/index.d.ts create mode 100644 packages/server/src/create-instance/index.d.ts create mode 100644 packages/server/src/index.d.ts create mode 100644 packages/sheet/src/index.d.ts create mode 100644 packages/styled/src/base.d.ts create mode 100644 packages/styled/src/index.d.ts create mode 100644 packages/unitless/src/index.d.ts create mode 100644 packages/utils/src/index.d.ts create mode 100644 packages/weak-memoize/src/index.d.ts create mode 100644 tsconfig.json diff --git a/package.json b/package.json index acf5c0552..650eab5c4 100644 --- a/package.json +++ b/package.json @@ -134,6 +134,7 @@ "react/jsx-runtime": "ReactJSX", "react/jsx-dev-runtime": "ReactJSXDev" }, + "exports": true, "___experimentalFlags_WILL_CHANGE_IN_PATCH": { "exports": true } diff --git a/packages/babel-plugin-jsx-pragmatic/package.json b/packages/babel-plugin-jsx-pragmatic/package.json index 7195057ff..7d5a948c7 100644 --- a/packages/babel-plugin-jsx-pragmatic/package.json +++ b/packages/babel-plugin-jsx-pragmatic/package.json @@ -4,6 +4,13 @@ "description": "Insert code to load a module corresponding to JSX pragma.", "main": "dist/emotion-babel-plugin-jsx-pragmatic.cjs.js", "module": "dist/emotion-babel-plugin-jsx-pragmatic.esm.js", + "exports": { + ".": { + "module": "./dist/emotion-babel-plugin-jsx-pragmatic.esm.js", + "default": "./dist/emotion-babel-plugin-jsx-pragmatic.cjs.js" + }, + "./package.json": "./package.json" + }, "license": "MIT", "repository": "https://github.com/emotion-js/emotion/tree/main/packages/babel-plugin-jsx-pragmatic", "scripts": { diff --git a/packages/babel-plugin/package.json b/packages/babel-plugin/package.json index 29d2ff9e8..be1e3bd2c 100644 --- a/packages/babel-plugin/package.json +++ b/packages/babel-plugin/package.json @@ -4,6 +4,13 @@ "description": "A recommended babel preprocessing plugin for emotion, The Next Generation of CSS-in-JS.", "main": "dist/emotion-babel-plugin.cjs.js", "module": "dist/emotion-babel-plugin.esm.js", + "exports": { + ".": { + "module": "./dist/emotion-babel-plugin.esm.js", + "default": "./dist/emotion-babel-plugin.cjs.js" + }, + "./package.json": "./package.json" + }, "files": [ "src", "lib", diff --git a/packages/babel-preset-css-prop/package.json b/packages/babel-preset-css-prop/package.json index fe5930895..bd220dd9f 100644 --- a/packages/babel-preset-css-prop/package.json +++ b/packages/babel-preset-css-prop/package.json @@ -4,6 +4,13 @@ "description": "A babel preset to automatically enable emotion's css prop", "main": "dist/emotion-babel-preset-css-prop.cjs.js", "module": "dist/emotion-babel-preset-css-prop.esm.js", + "exports": { + ".": { + "module": "./dist/emotion-babel-preset-css-prop.esm.js", + "default": "./dist/emotion-babel-preset-css-prop.cjs.js" + }, + "./package.json": "./package.json" + }, "license": "MIT", "repository": "https://github.com/emotion-js/emotion/tree/main/packages/babel-preset-css-prop", "scripts": { diff --git a/packages/cache/package.json b/packages/cache/package.json index 17926fa7a..033d7b46b 100644 --- a/packages/cache/package.json +++ b/packages/cache/package.json @@ -5,9 +5,18 @@ "main": "dist/emotion-cache.cjs.js", "module": "dist/emotion-cache.esm.js", "browser": { - "./dist/emotion-cache.cjs.js": "./dist/emotion-cache.browser.cjs.js", "./dist/emotion-cache.esm.js": "./dist/emotion-cache.browser.esm.js" }, + "exports": { + ".": { + "module": { + "browser": "./dist/emotion-cache.browser.esm.js", + "default": "./dist/emotion-cache.esm.js" + }, + "default": "./dist/emotion-cache.cjs.js" + }, + "./package.json": "./package.json" + }, "types": "types/index.d.ts", "license": "MIT", "repository": "https://github.com/emotion-js/emotion/tree/main/packages/cache", @@ -33,5 +42,12 @@ "src", "dist", "types/*.d.ts" - ] + ], + "preconstruct": { + "exports": { + "envConditions": [ + "browser" + ] + } + } } diff --git a/packages/cache/src/index.d.ts b/packages/cache/src/index.d.ts new file mode 100644 index 000000000..9e4609375 --- /dev/null +++ b/packages/cache/src/index.d.ts @@ -0,0 +1,2 @@ +export * from '../types' +export { default } from '../types' diff --git a/packages/css-prettifier/package.json b/packages/css-prettifier/package.json index 7927ce116..91157c309 100644 --- a/packages/css-prettifier/package.json +++ b/packages/css-prettifier/package.json @@ -11,6 +11,13 @@ "author": "Mateusz BurzyƄski (https://github.com/Andarist)", "main": "dist/emotion-css-prettifier.cjs.js", "module": "dist/emotion-css-prettifier.esm.js", + "exports": { + ".": { + "module": "./dist/emotion-css-prettifier.esm.js", + "default": "./dist/emotion-css-prettifier.cjs.js" + }, + "./package.json": "./package.json" + }, "types": "types/index.d.ts", "license": "MIT", "repository": "https://github.com/emotion-js/emotion/tree/main/packages/css-prettifier", diff --git a/packages/css-prettifier/src/index.d.ts b/packages/css-prettifier/src/index.d.ts new file mode 100644 index 000000000..9e4609375 --- /dev/null +++ b/packages/css-prettifier/src/index.d.ts @@ -0,0 +1,2 @@ +export * from '../types' +export { default } from '../types' diff --git a/packages/css/src/create-instance.d.ts b/packages/css/src/create-instance.d.ts new file mode 100644 index 000000000..9e4609375 --- /dev/null +++ b/packages/css/src/create-instance.d.ts @@ -0,0 +1,2 @@ +export * from '../types' +export { default } from '../types' diff --git a/packages/css/src/index.d.ts b/packages/css/src/index.d.ts new file mode 100644 index 000000000..51a3b4100 --- /dev/null +++ b/packages/css/src/index.d.ts @@ -0,0 +1 @@ +export * from '../types' diff --git a/packages/eslint-plugin/package.json b/packages/eslint-plugin/package.json index c6c399666..286a9c48d 100644 --- a/packages/eslint-plugin/package.json +++ b/packages/eslint-plugin/package.json @@ -13,6 +13,14 @@ ], "author": "alex-pex ", "main": "dist/emotion-eslint-plugin.cjs.js", + "module": "dist/emotion-eslint-plugin.esm.js", + "exports": { + ".": { + "module": "./dist/emotion-eslint-plugin.esm.js", + "default": "./dist/emotion-eslint-plugin.cjs.js" + }, + "./package.json": "./package.json" + }, "engines": { "node": ">=6" }, diff --git a/packages/hash/package.json b/packages/hash/package.json index a59753252..f52a2f792 100644 --- a/packages/hash/package.json +++ b/packages/hash/package.json @@ -22,8 +22,14 @@ "@definitelytyped/dtslint": "0.0.112", "typescript": "^4.5.5" }, - "browser": { - "./dist/emotion-hash.cjs.js": "./dist/emotion-hash.browser.cjs.js", - "./dist/emotion-hash.esm.js": "./dist/emotion-hash.browser.esm.js" + "exports": { + ".": { + "module": "./dist/emotion-hash.esm.js", + "default": "./dist/emotion-hash.cjs.js" + }, + "./package.json": "./package.json" + }, + "preconstruct": { + "exports": true } } diff --git a/packages/hash/src/index.d.ts b/packages/hash/src/index.d.ts new file mode 100644 index 000000000..9e4609375 --- /dev/null +++ b/packages/hash/src/index.d.ts @@ -0,0 +1,2 @@ +export * from '../types' +export { default } from '../types' diff --git a/packages/is-prop-valid/package.json b/packages/is-prop-valid/package.json index 1d56f76ef..f9022d519 100644 --- a/packages/is-prop-valid/package.json +++ b/packages/is-prop-valid/package.json @@ -25,8 +25,14 @@ "dist", "types/*.d.ts" ], - "browser": { - "./dist/emotion-is-prop-valid.cjs.js": "./dist/emotion-is-prop-valid.browser.cjs.js", - "./dist/emotion-is-prop-valid.esm.js": "./dist/emotion-is-prop-valid.browser.esm.js" + "exports": { + ".": { + "module": "./dist/emotion-is-prop-valid.esm.js", + "default": "./dist/emotion-is-prop-valid.cjs.js" + }, + "./package.json": "./package.json" + }, + "preconstruct": { + "exports": true } } diff --git a/packages/is-prop-valid/src/index.d.ts b/packages/is-prop-valid/src/index.d.ts new file mode 100644 index 000000000..9e4609375 --- /dev/null +++ b/packages/is-prop-valid/src/index.d.ts @@ -0,0 +1,2 @@ +export * from '../types' +export { default } from '../types' diff --git a/packages/jest/package.json b/packages/jest/package.json index c8ac54c8e..4b08cea84 100644 --- a/packages/jest/package.json +++ b/packages/jest/package.json @@ -4,6 +4,25 @@ "description": "Jest utilities for emotion", "main": "dist/emotion-jest.cjs.js", "module": "dist/emotion-jest.esm.js", + "exports": { + ".": { + "module": "./dist/emotion-jest.esm.js", + "default": "./dist/emotion-jest.cjs.js" + }, + "./enzyme": { + "module": "./enzyme/dist/emotion-jest-enzyme.esm.js", + "default": "./enzyme/dist/emotion-jest-enzyme.cjs.js" + }, + "./serializer": { + "module": "./serializer/dist/emotion-jest-serializer.esm.js", + "default": "./serializer/dist/emotion-jest-serializer.cjs.js" + }, + "./enzyme-serializer": { + "module": "./enzyme-serializer/dist/emotion-jest-enzyme-serializer.esm.js", + "default": "./enzyme-serializer/dist/emotion-jest-enzyme-serializer.cjs.js" + }, + "./package.json": "./package.json" + }, "types": "types/index.d.ts", "files": [ "src", diff --git a/packages/jest/src/enzyme-serializer.d.ts b/packages/jest/src/enzyme-serializer.d.ts new file mode 100644 index 000000000..7e9e849df --- /dev/null +++ b/packages/jest/src/enzyme-serializer.d.ts @@ -0,0 +1 @@ +export * from '../types/enzyme-serializer' diff --git a/packages/jest/src/enzyme.d.ts b/packages/jest/src/enzyme.d.ts new file mode 100644 index 000000000..fdcaa2b47 --- /dev/null +++ b/packages/jest/src/enzyme.d.ts @@ -0,0 +1 @@ +export * from '../types/enzyme' diff --git a/packages/jest/src/index.d.ts b/packages/jest/src/index.d.ts new file mode 100644 index 000000000..51a3b4100 --- /dev/null +++ b/packages/jest/src/index.d.ts @@ -0,0 +1 @@ +export * from '../types' diff --git a/packages/jest/src/serializer.d.ts b/packages/jest/src/serializer.d.ts new file mode 100644 index 000000000..a9c753c4d --- /dev/null +++ b/packages/jest/src/serializer.d.ts @@ -0,0 +1 @@ +export * from '../types/serializer' diff --git a/packages/memoize/package.json b/packages/memoize/package.json index b0c5638ba..07118dd70 100644 --- a/packages/memoize/package.json +++ b/packages/memoize/package.json @@ -22,8 +22,14 @@ "dist", "types/*.d.ts" ], - "browser": { - "./dist/emotion-memoize.cjs.js": "./dist/emotion-memoize.browser.cjs.js", - "./dist/emotion-memoize.esm.js": "./dist/emotion-memoize.browser.esm.js" + "exports": { + ".": { + "module": "./dist/emotion-memoize.esm.js", + "default": "./dist/emotion-memoize.cjs.js" + }, + "./package.json": "./package.json" + }, + "preconstruct": { + "exports": true } } diff --git a/packages/memoize/src/index.d.ts b/packages/memoize/src/index.d.ts new file mode 100644 index 000000000..9e4609375 --- /dev/null +++ b/packages/memoize/src/index.d.ts @@ -0,0 +1,2 @@ +export * from '../types' +export { default } from '../types' diff --git a/packages/native/src/index.d.ts b/packages/native/src/index.d.ts new file mode 100644 index 000000000..9e4609375 --- /dev/null +++ b/packages/native/src/index.d.ts @@ -0,0 +1,2 @@ +export * from '../types' +export { default } from '../types' diff --git a/packages/native/tsconfig.json b/packages/native/tsconfig.json new file mode 100644 index 000000000..653808e23 --- /dev/null +++ b/packages/native/tsconfig.json @@ -0,0 +1,17 @@ +{ + "compilerOptions": { + "esModuleInterop": true, + "forceConsistentCasingInFileNames": true, + "isolatedModules": true, + "jsx": "react", + "lib": ["es6", "dom"], + "module": "commonjs", + "noEmit": true, + "skipLibCheck": true, + "skipDefaultLibCheck": true, + "resolveJsonModule": true, + "strict": true, + "target": "es5", + "types": [] + } +} diff --git a/packages/primitives-core/package.json b/packages/primitives-core/package.json index 852a4b926..17b1c2f8c 100644 --- a/packages/primitives-core/package.json +++ b/packages/primitives-core/package.json @@ -41,7 +41,23 @@ "access": "public" }, "browser": { - "./dist/emotion-primitives-core.cjs.js": "./dist/emotion-primitives-core.browser.cjs.js", "./dist/emotion-primitives-core.esm.js": "./dist/emotion-primitives-core.browser.esm.js" + }, + "exports": { + ".": { + "module": { + "browser": "./dist/emotion-primitives-core.browser.esm.js", + "default": "./dist/emotion-primitives-core.esm.js" + }, + "default": "./dist/emotion-primitives-core.cjs.js" + }, + "./package.json": "./package.json" + }, + "preconstruct": { + "exports": { + "envConditions": [ + "browser" + ] + } } } diff --git a/packages/react/src/_isolated-hnrs.d.ts b/packages/react/src/_isolated-hnrs.d.ts new file mode 100644 index 000000000..1444ee061 --- /dev/null +++ b/packages/react/src/_isolated-hnrs.d.ts @@ -0,0 +1,3 @@ +// this entry point is not publicly available so we don't need to expose any types here +// we need to define a definition file for each entrypoint though, otherwise Preconstruct might get confused +export {} diff --git a/packages/react/src/index.d.ts b/packages/react/src/index.d.ts new file mode 100644 index 000000000..f7fee2b3c --- /dev/null +++ b/packages/react/src/index.d.ts @@ -0,0 +1 @@ +export * from '../types/index' diff --git a/packages/react/src/jsx-dev-runtime.d.ts b/packages/react/src/jsx-dev-runtime.d.ts new file mode 100644 index 000000000..22c581745 --- /dev/null +++ b/packages/react/src/jsx-dev-runtime.d.ts @@ -0,0 +1 @@ +export * from '../types/jsx-dev-runtime' diff --git a/packages/react/src/jsx-runtime.d.ts b/packages/react/src/jsx-runtime.d.ts new file mode 100644 index 000000000..ba8fea998 --- /dev/null +++ b/packages/react/src/jsx-runtime.d.ts @@ -0,0 +1 @@ +export * from '../types/jsx-runtime' diff --git a/packages/serialize/package.json b/packages/serialize/package.json index e2fb1dee3..ec9bc2454 100644 --- a/packages/serialize/package.json +++ b/packages/serialize/package.json @@ -30,7 +30,23 @@ "types/*.d.ts" ], "browser": { - "./dist/emotion-serialize.cjs.js": "./dist/emotion-serialize.browser.cjs.js", "./dist/emotion-serialize.esm.js": "./dist/emotion-serialize.browser.esm.js" + }, + "exports": { + ".": { + "module": { + "browser": "./dist/emotion-serialize.browser.esm.js", + "default": "./dist/emotion-serialize.esm.js" + }, + "default": "./dist/emotion-serialize.cjs.js" + }, + "./package.json": "./package.json" + }, + "preconstruct": { + "exports": { + "envConditions": [ + "browser" + ] + } } } diff --git a/packages/serialize/src/index.d.ts b/packages/serialize/src/index.d.ts new file mode 100644 index 000000000..9e4609375 --- /dev/null +++ b/packages/serialize/src/index.d.ts @@ -0,0 +1,2 @@ +export * from '../types' +export { default } from '../types' diff --git a/packages/server/create-instance/package.json b/packages/server/create-instance/package.json index ccf4d75c8..42bb62dab 100644 --- a/packages/server/create-instance/package.json +++ b/packages/server/create-instance/package.json @@ -1,7 +1,8 @@ { "main": "dist/emotion-server-create-instance.cjs.js", + "module": "dist/emotion-server-create-instance.esm.js", "browser": { - "./dist/emotion-server-create-instance.cjs.js": "./dist/emotion-server-create-instance.browser.cjs.js" + "./dist/emotion-server-create-instance.esm.js": "./dist/emotion-server-create-instance.browser.esm.js" }, "types": "../types/create-instance" } diff --git a/packages/server/package.json b/packages/server/package.json index 2e2273559..89bbfec88 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -3,6 +3,7 @@ "version": "11.4.0", "description": "Extract and inline critical css with emotion for server side rendering.", "main": "dist/emotion-server.cjs.js", + "module": "dist/emotion-server.esm.js", "types": "types/index.d.ts", "files": [ "src", @@ -52,12 +53,34 @@ "url": "https://github.com/emotion-js/emotion/issues" }, "browser": { - "./dist/emotion-server.cjs.js": "./dist/emotion-server.browser.cjs.js" + "./dist/emotion-server.esm.js": "./dist/emotion-server.browser.esm.js" + }, + "exports": { + ".": { + "module": { + "browser": "./dist/emotion-server.browser.esm.js", + "default": "./dist/emotion-server.esm.js" + }, + "default": "./dist/emotion-server.cjs.js" + }, + "./create-instance": { + "module": { + "browser": "./create-instance/dist/emotion-server-create-instance.browser.esm.js", + "default": "./create-instance/dist/emotion-server-create-instance.esm.js" + }, + "default": "./create-instance/dist/emotion-server-create-instance.cjs.js" + }, + "./package.json": "./package.json" }, "preconstruct": { "entrypoints": [ "./index.js", "./create-instance/index.js" - ] + ], + "exports": { + "envConditions": [ + "browser" + ] + } } } diff --git a/packages/server/src/create-instance/index.d.ts b/packages/server/src/create-instance/index.d.ts new file mode 100644 index 000000000..96f450230 --- /dev/null +++ b/packages/server/src/create-instance/index.d.ts @@ -0,0 +1,2 @@ +export * from '../../types/create-instance' +export { default } from '../../types/create-instance' diff --git a/packages/server/src/index.d.ts b/packages/server/src/index.d.ts new file mode 100644 index 000000000..51a3b4100 --- /dev/null +++ b/packages/server/src/index.d.ts @@ -0,0 +1 @@ +export * from '../types' diff --git a/packages/sheet/package.json b/packages/sheet/package.json index a93b7cc55..c6f8ea19a 100644 --- a/packages/sheet/package.json +++ b/packages/sheet/package.json @@ -5,9 +5,18 @@ "main": "dist/emotion-sheet.cjs.js", "module": "dist/emotion-sheet.esm.js", "browser": { - "./dist/emotion-sheet.cjs.js": "./dist/emotion-sheet.browser.cjs.js", "./dist/emotion-sheet.esm.js": "./dist/emotion-sheet.browser.esm.js" }, + "exports": { + ".": { + "module": { + "browser": "./dist/emotion-sheet.browser.esm.js", + "default": "./dist/emotion-sheet.esm.js" + }, + "default": "./dist/emotion-sheet.cjs.js" + }, + "./package.json": "./package.json" + }, "types": "types/index.d.ts", "license": "MIT", "scripts": { @@ -25,5 +34,12 @@ "devDependencies": { "@definitelytyped/dtslint": "0.0.112", "typescript": "^4.5.5" + }, + "preconstruct": { + "exports": { + "envConditions": [ + "browser" + ] + } } } diff --git a/packages/sheet/src/index.d.ts b/packages/sheet/src/index.d.ts new file mode 100644 index 000000000..9e4609375 --- /dev/null +++ b/packages/sheet/src/index.d.ts @@ -0,0 +1,2 @@ +export * from '../types' +export { default } from '../types' diff --git a/packages/styled/src/base.d.ts b/packages/styled/src/base.d.ts new file mode 100644 index 000000000..6da8b18fd --- /dev/null +++ b/packages/styled/src/base.d.ts @@ -0,0 +1,2 @@ +export * from '../types/base' +export { default } from '../types/base' diff --git a/packages/styled/src/index.d.ts b/packages/styled/src/index.d.ts new file mode 100644 index 000000000..9e4609375 --- /dev/null +++ b/packages/styled/src/index.d.ts @@ -0,0 +1,2 @@ +export * from '../types' +export { default } from '../types' diff --git a/packages/unitless/package.json b/packages/unitless/package.json index f2639670a..a3abe4c41 100644 --- a/packages/unitless/package.json +++ b/packages/unitless/package.json @@ -16,8 +16,14 @@ "src", "dist" ], - "browser": { - "./dist/emotion-unitless.cjs.js": "./dist/emotion-unitless.browser.cjs.js", - "./dist/emotion-unitless.esm.js": "./dist/emotion-unitless.browser.esm.js" + "exports": { + ".": { + "module": "./dist/emotion-unitless.esm.js", + "default": "./dist/emotion-unitless.cjs.js" + }, + "./package.json": "./package.json" + }, + "preconstruct": { + "exports": true } } diff --git a/packages/unitless/src/index.d.ts b/packages/unitless/src/index.d.ts new file mode 100644 index 000000000..9e4609375 --- /dev/null +++ b/packages/unitless/src/index.d.ts @@ -0,0 +1,2 @@ +export * from '../types' +export { default } from '../types' diff --git a/packages/utils/src/index.d.ts b/packages/utils/src/index.d.ts new file mode 100644 index 000000000..51a3b4100 --- /dev/null +++ b/packages/utils/src/index.d.ts @@ -0,0 +1 @@ +export * from '../types' diff --git a/packages/weak-memoize/package.json b/packages/weak-memoize/package.json index f6b4e3b85..5f074b46b 100644 --- a/packages/weak-memoize/package.json +++ b/packages/weak-memoize/package.json @@ -22,8 +22,14 @@ "dist", "types/*.d.ts" ], - "browser": { - "./dist/emotion-weak-memoize.cjs.js": "./dist/emotion-weak-memoize.browser.cjs.js", - "./dist/emotion-weak-memoize.esm.js": "./dist/emotion-weak-memoize.browser.esm.js" + "exports": { + ".": { + "module": "./dist/emotion-weak-memoize.esm.js", + "default": "./dist/emotion-weak-memoize.cjs.js" + }, + "./package.json": "./package.json" + }, + "preconstruct": { + "exports": true } } diff --git a/packages/weak-memoize/src/index.d.ts b/packages/weak-memoize/src/index.d.ts new file mode 100644 index 000000000..9e4609375 --- /dev/null +++ b/packages/weak-memoize/src/index.d.ts @@ -0,0 +1,2 @@ +export * from '../types' +export { default } from '../types' diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 000000000..b955ce77e --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "esModuleInterop": true, + "forceConsistentCasingInFileNames": true, + "isolatedModules": true, + "jsx": "react", + "lib": ["es6", "dom"], + "module": "commonjs", + "noEmit": true, + "skipLibCheck": true, + "skipDefaultLibCheck": true, + "resolveJsonModule": true, + "strict": true, + "target": "es5", + "types": [] + }, + "include": ["packages", "scripts", "site", "test", "playgrounds"], + "exclude": [ + "node_modules", + "packages/*/types/test/*", + "packages/*/types/test*", + "packages/native" + ] +} From 6f782a1b4000e3d95cba8171672f335078785a04 Mon Sep 17 00:00:00 2001 From: mitchellhamilton Date: Thu, 28 Jul 2022 11:22:23 +1000 Subject: [PATCH 8/9] Remove unnecessary preconstruct.exports: true --- packages/hash/package.json | 3 --- packages/is-prop-valid/package.json | 3 --- packages/memoize/package.json | 3 --- packages/unitless/package.json | 3 --- packages/weak-memoize/package.json | 3 --- 5 files changed, 15 deletions(-) diff --git a/packages/hash/package.json b/packages/hash/package.json index f52a2f792..fb3b4fd73 100644 --- a/packages/hash/package.json +++ b/packages/hash/package.json @@ -28,8 +28,5 @@ "default": "./dist/emotion-hash.cjs.js" }, "./package.json": "./package.json" - }, - "preconstruct": { - "exports": true } } diff --git a/packages/is-prop-valid/package.json b/packages/is-prop-valid/package.json index f9022d519..ca0968356 100644 --- a/packages/is-prop-valid/package.json +++ b/packages/is-prop-valid/package.json @@ -31,8 +31,5 @@ "default": "./dist/emotion-is-prop-valid.cjs.js" }, "./package.json": "./package.json" - }, - "preconstruct": { - "exports": true } } diff --git a/packages/memoize/package.json b/packages/memoize/package.json index 07118dd70..0634ec747 100644 --- a/packages/memoize/package.json +++ b/packages/memoize/package.json @@ -28,8 +28,5 @@ "default": "./dist/emotion-memoize.cjs.js" }, "./package.json": "./package.json" - }, - "preconstruct": { - "exports": true } } diff --git a/packages/unitless/package.json b/packages/unitless/package.json index a3abe4c41..8f5698d6c 100644 --- a/packages/unitless/package.json +++ b/packages/unitless/package.json @@ -22,8 +22,5 @@ "default": "./dist/emotion-unitless.cjs.js" }, "./package.json": "./package.json" - }, - "preconstruct": { - "exports": true } } diff --git a/packages/weak-memoize/package.json b/packages/weak-memoize/package.json index 5f074b46b..21b6708d5 100644 --- a/packages/weak-memoize/package.json +++ b/packages/weak-memoize/package.json @@ -28,8 +28,5 @@ "default": "./dist/emotion-weak-memoize.cjs.js" }, "./package.json": "./package.json" - }, - "preconstruct": { - "exports": true } } From ea2283985cd8f855a44b9689a2c414acbc6e648e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20Burzy=C5=84ski?= Date: Sun, 31 Jul 2022 10:53:50 +0200 Subject: [PATCH 9/9] Add changesets --- .changeset/seven-ways-collect.md | 26 ++++++++++++++++++++++++++ .changeset/wet-teachers-peel.md | 7 +++++++ 2 files changed, 33 insertions(+) create mode 100644 .changeset/seven-ways-collect.md create mode 100644 .changeset/wet-teachers-peel.md diff --git a/.changeset/seven-ways-collect.md b/.changeset/seven-ways-collect.md new file mode 100644 index 000000000..6583220b5 --- /dev/null +++ b/.changeset/seven-ways-collect.md @@ -0,0 +1,26 @@ +--- +'@emotion/babel-plugin': minor +'@emotion/babel-plugin-jsx-pragmatic': minor +'@emotion/babel-preset-css-prop': minor +'@emotion/cache': minor +'@emotion/css': minor +'@emotion/css-prettifier': minor +'@emotion/eslint-plugin': minor +'@emotion/hash': minor +'@emotion/is-prop-valid': minor +'@emotion/jest': minor +'@emotion/memoize': minor +'@emotion/native': minor +'@emotion/primitives': minor +'@emotion/primitives-core': minor +'@emotion/react': minor +'@emotion/serialize': minor +'@emotion/server': minor +'@emotion/sheet': minor +'@emotion/styled': minor +'@emotion/unitless': minor +'@emotion/utils': minor +'@emotion/weak-memoize': minor +--- + +`exports` field has been added to the `package.json` manifest. This fixes how our default exports are treated by Node.js when using their native support for ES modules. It also limits what files can be imported from a package but we've tried our best to allow importing all the files that were considered to be a part of the public API. diff --git a/.changeset/wet-teachers-peel.md b/.changeset/wet-teachers-peel.md new file mode 100644 index 000000000..824596e61 --- /dev/null +++ b/.changeset/wet-teachers-peel.md @@ -0,0 +1,7 @@ +--- +'@emotion/react': minor +'@emotion/styled': minor +'@emotion/utils': minor +--- + +Thanks to the added `exports` field, the package now includes a `worker` condition that can be utilized by properly configured bundlers when targeting worker-like environments. It fixes the issue with browser-specific files being prioritized by some bundlers when targeting workers.