From fc01355bc9ff1f301d0b324d21c81bbe61cbb33d Mon Sep 17 00:00:00 2001 From: Eric Clemmons Date: Wed, 18 Aug 2021 14:28:03 -0500 Subject: [PATCH 01/23] Move react/styles.css into src/ --- packages/react/src/styles.css | 2 ++ packages/react/styles.css | 2 -- 2 files changed, 2 insertions(+), 2 deletions(-) create mode 100644 packages/react/src/styles.css delete mode 100644 packages/react/styles.css diff --git a/packages/react/src/styles.css b/packages/react/src/styles.css new file mode 100644 index 00000000000..dfa7a979761 --- /dev/null +++ b/packages/react/src/styles.css @@ -0,0 +1,2 @@ +@import './components/Authenticator/styles.css'; +@import './primitives/styles.css'; diff --git a/packages/react/styles.css b/packages/react/styles.css deleted file mode 100644 index 8603d2515af..00000000000 --- a/packages/react/styles.css +++ /dev/null @@ -1,2 +0,0 @@ -@import './src/primitives/styles.css'; -@import './src/components/Authenticator/styles.css'; From f41761917a99ea83d30248837b9decf59aa1a533 Mon Sep 17 00:00:00 2001 From: Eric Clemmons Date: Wed, 18 Aug 2021 14:41:20 -0500 Subject: [PATCH 02/23] No longer compile packages/ with Next.js --- docs/next.config.js | 8 ++++---- examples/next/next.config.js | 10 ++-------- examples/next/package.json | 1 - packages/react/index.tsx | 1 - 4 files changed, 6 insertions(+), 14 deletions(-) delete mode 100644 packages/react/index.tsx diff --git a/docs/next.config.js b/docs/next.config.js index a406ff21c2e..a0073b14fd2 100644 --- a/docs/next.config.js +++ b/docs/next.config.js @@ -9,10 +9,10 @@ const withNextPluginPreval = require('next-plugin-preval/config')(); const withCompileNodeModules = require('@moxy/next-compile-node-modules')({ include: [ // Using `path.dirname` because `package.json#main` doesn't exist in some packages yet - path.dirname(require.resolve('@aws-amplify/ui-core/package.json')), - path.dirname(require.resolve('@aws-amplify/ui-react/package.json')), - path.dirname(require.resolve('@aws-amplify/ui-theme-base/package.json')), - path.dirname(require.resolve('amplify-docs/package.json')), + path.dirname( + // `amplify-docs` aren't bundled, so they require post-processing + require.resolve('amplify-docs/package.json') + ), ], test: /\.(js|ts)x?/, }); diff --git a/examples/next/next.config.js b/examples/next/next.config.js index 3334e1b516b..f4843cd7abd 100644 --- a/examples/next/next.config.js +++ b/examples/next/next.config.js @@ -1,10 +1,4 @@ -// TODO Remove this once @aws-amplify/ui-react is compiled -const withCompileNodeModules = require('@moxy/next-compile-node-modules')({ - include: /[\\/]packages[\\/]/, - test: /\.(js|ts)x?/, -}); - -module.exports = withCompileNodeModules({ +module.exports = { reactStrictMode: true, pageExtensions: ['page.tsx'], -}); +}; diff --git a/examples/next/package.json b/examples/next/package.json index b2e0a4064f3..e67211ee192 100644 --- a/examples/next/package.json +++ b/examples/next/package.json @@ -10,7 +10,6 @@ }, "dependencies": { "@aws-amplify/ui-react": "0.0.1", - "@moxy/next-compile-node-modules": "^2.1.1", "@types/node": "^15.12.4", "@types/react": "^17.0.11", "next": "latest", diff --git a/packages/react/index.tsx b/packages/react/index.tsx deleted file mode 100644 index 8420b1093fd..00000000000 --- a/packages/react/index.tsx +++ /dev/null @@ -1 +0,0 @@ -export * from './src'; From 7c6752a65d6eaea099792fb409260dcde4568c0f Mon Sep 17 00:00:00 2001 From: Eric Clemmons Date: Wed, 18 Aug 2021 15:33:41 -0500 Subject: [PATCH 03/23] Use esnext import/export instead of module.exports/require --- packages/react/tsconfig.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/react/tsconfig.json b/packages/react/tsconfig.json index cebc3cdee70..5e7b2bedab3 100644 --- a/packages/react/tsconfig.json +++ b/packages/react/tsconfig.json @@ -7,8 +7,8 @@ "outDir": "./dist", "skipLibCheck": true, "sourceMap": true, - "module": "commonjs", "target": "es5" + "module": "esnext", }, "exclude": ["node_modules"], "include": ["src/**/*.ts", "src/**/*.tsx"] From 252603f9c3479d5ff465302432caf9ce3e52d05b Mon Sep 17 00:00:00 2001 From: Eric Clemmons Date: Wed, 18 Aug 2021 15:33:55 -0500 Subject: [PATCH 04/23] Target ES6/2015 instead of ES5 --- packages/react/tsconfig.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/react/tsconfig.json b/packages/react/tsconfig.json index 5e7b2bedab3..4082e1a4233 100644 --- a/packages/react/tsconfig.json +++ b/packages/react/tsconfig.json @@ -7,8 +7,8 @@ "outDir": "./dist", "skipLibCheck": true, "sourceMap": true, - "target": "es5" "module": "esnext", + "target": "es2015" }, "exclude": ["node_modules"], "include": ["src/**/*.ts", "src/**/*.tsx"] From 9c5f754f57c865913a7287a0e869af4437a52d78 Mon Sep 17 00:00:00 2001 From: Eric Clemmons Date: Wed, 18 Aug 2021 15:34:13 -0500 Subject: [PATCH 05/23] Mirror node's moduleResolution --- packages/react/tsconfig.json | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/react/tsconfig.json b/packages/react/tsconfig.json index 4082e1a4233..d0a5e56ca0a 100644 --- a/packages/react/tsconfig.json +++ b/packages/react/tsconfig.json @@ -1,5 +1,7 @@ { "compilerOptions": { + "moduleResolution": "node", + "baseUrl": ".", "declaration": true, "esModuleInterop": true, "jsx": "react-jsx", From 8a2ee83733be48135ca418fe251a077e45c719c8 Mon Sep 17 00:00:00 2001 From: Eric Clemmons Date: Wed, 18 Aug 2021 15:35:16 -0500 Subject: [PATCH 06/23] Inline @aws-amplify/ui-core & @aws-amplify/ui-theme-base into package --- packages/react/package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/react/package.json b/packages/react/package.json index 70fda6264bd..06b1bfe1e76 100644 --- a/packages/react/package.json +++ b/packages/react/package.json @@ -26,8 +26,6 @@ "qrcode": "^1.4.4" }, "peerDependencies": { - "@aws-amplify/ui-core": "^0.0.1", - "@aws-amplify/ui-theme-base": "^0.0.1" }, "workspaces": { "nohoist": [ @@ -36,6 +34,8 @@ ] }, "devDependencies": { + "@aws-amplify/ui-core": "^0.0.1", + "@aws-amplify/ui-theme-base": "^0.0.1", "@testing-library/jest-dom": "^5.14.1", "@testing-library/react": "^12.0.0", "@testing-library/react-hooks": "^7.0.1", From 089024bc63d5d103fddb52a2aa7b2e56ae3c0a2a Mon Sep 17 00:00:00 2001 From: Eric Clemmons Date: Wed, 18 Aug 2021 15:35:53 -0500 Subject: [PATCH 07/23] Build using tsup --- packages/react/package.json | 20 ++++++++++++++++---- packages/react/tsup.config.cjs | 10 ++++++++++ 2 files changed, 26 insertions(+), 4 deletions(-) create mode 100644 packages/react/tsup.config.cjs diff --git a/packages/react/package.json b/packages/react/package.json index 06b1bfe1e76..f5a15a907e8 100644 --- a/packages/react/package.json +++ b/packages/react/package.json @@ -2,14 +2,22 @@ "private": true, "name": "@aws-amplify/ui-react", "version": "0.0.1", - "main": "dist/index.js", + "type": "module", + "main": "dist/index.cjs", + "module": "dist/index.js", + "exports": { + ".": "./dist/index.js", + "./styles.css": "./dist/index.css" + }, "types": "dist/index.d.ts", "files": [ - "dist/*.{js,ts}", - "dist/**/*.{js,ts}" + "dist" ], "scripts": { - "build": "tsc", + "prebuild": "rimraf dist", + "build": "tsup --minify", + "predev": "rimraf dist", + "dev": "tsup --watch", "update:icons": "node scripts/updateIcons.js", "build:icons": "yarn run clean:icons && node scripts/generateIcons.js", "clean": "rimraf dist", @@ -26,6 +34,9 @@ "qrcode": "^1.4.4" }, "peerDependencies": { + "aws-amplify": "3.x.x || 4.x.x", + "react": ">= 16.8.0", + "react-dom": ">= 16.8.0" }, "workspaces": { "nohoist": [ @@ -47,6 +58,7 @@ "jest": "^27.0.4", "rimraf": "^3.0.2", "ts-jest": "^27.0.3", + "tsup": "^4.14.0", "typescript": "^4.3.2" } } diff --git a/packages/react/tsup.config.cjs b/packages/react/tsup.config.cjs new file mode 100644 index 00000000000..7fbf7f727c7 --- /dev/null +++ b/packages/react/tsup.config.cjs @@ -0,0 +1,10 @@ +/** + * @type {import("tsup").Options} + */ +module.exports = { + dts: true, + entryPoints: ['src/index.tsx'], + format: ['cjs', 'esm'], + sourcemap: 'both', + splitting: false, +}; From 3cbd9ccaa77f24dfc2e9e940fd401e929270828b Mon Sep 17 00:00:00 2001 From: Eric Clemmons Date: Wed, 18 Aug 2021 15:40:08 -0500 Subject: [PATCH 08/23] Build styles.css --- packages/react/src/index.tsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/react/src/index.tsx b/packages/react/src/index.tsx index 81dfbf5c248..95a2e5b7754 100644 --- a/packages/react/src/index.tsx +++ b/packages/react/src/index.tsx @@ -1,3 +1,5 @@ +import './styles.css'; + export * from './components'; export * from './hooks'; export * from './primitives'; From 840b62781461fe8e66584d73cde68f5606b1803b Mon Sep 17 00:00:00 2001 From: Eric Clemmons Date: Wed, 18 Aug 2021 15:42:48 -0500 Subject: [PATCH 09/23] Inject react-shim https://esbuild.github.io/content-types/#auto-import-for-jsx --- packages/react/package.json | 1 + packages/react/patches/tsup+4.14.0.patch | 12 ++++++++++++ packages/react/src/react-shim.js | 9 +++++++++ 3 files changed, 22 insertions(+) create mode 100644 packages/react/patches/tsup+4.14.0.patch create mode 100644 packages/react/src/react-shim.js diff --git a/packages/react/package.json b/packages/react/package.json index f5a15a907e8..25a84da09df 100644 --- a/packages/react/package.json +++ b/packages/react/package.json @@ -22,6 +22,7 @@ "build:icons": "yarn run clean:icons && node scripts/generateIcons.js", "clean": "rimraf dist", "clean:icons": "rimraf ./src/primitives/Icon/icons", + "postinstall": "patch-package", "primitives:new": "hygen primitives new", "test": "yarn test:unit", "test:watch": "yarn test:unit:watch", diff --git a/packages/react/patches/tsup+4.14.0.patch b/packages/react/patches/tsup+4.14.0.patch new file mode 100644 index 00000000000..dbbb1cdce95 --- /dev/null +++ b/packages/react/patches/tsup+4.14.0.patch @@ -0,0 +1,12 @@ +diff --git a/node_modules/tsup/dist/index.js b/node_modules/tsup/dist/index.js +index 1fd3ea9..8f84cf0 100644 +--- a/node_modules/tsup/dist/index.js ++++ b/node_modules/tsup/dist/index.js +@@ -13633,6 +13633,7 @@ async function runEsbuild(options, { format, css }) { + jsxFactory: options.jsxFactory, + jsxFragment: options.jsxFragment, + sourcemap: options.sourcemap, ++ inject: ['./src/react-shim.js'], + target: options.target === "es5" ? "es2016" : options.target, + plugins: [ + externalPlugin({ diff --git a/packages/react/src/react-shim.js b/packages/react/src/react-shim.js new file mode 100644 index 00000000000..7dd24cc0757 --- /dev/null +++ b/packages/react/src/react-shim.js @@ -0,0 +1,9 @@ +/** + * This shim exists for `esbuild` to `inject` into every .tsx file. + * Otherwise, `import * as React from 'react'` would need to be added manually + * + * See: https://esbuild.github.io/content-types/#auto-import-for-jsx + */ + +import * as React from 'react'; +export { React }; From 66811ff07d33d0f8ee45fc83ba597fed11e84442 Mon Sep 17 00:00:00 2001 From: Eric Clemmons Date: Wed, 18 Aug 2021 15:43:18 -0500 Subject: [PATCH 10/23] Remove @fontsource/inter, since it can't be bundled into JS --- packages/theme-base/package.json | 3 --- packages/theme-base/src/css/theme.scss | 2 -- 2 files changed, 5 deletions(-) diff --git a/packages/theme-base/package.json b/packages/theme-base/package.json index 181bd55b1c6..13b4c8b50e0 100644 --- a/packages/theme-base/package.json +++ b/packages/theme-base/package.json @@ -22,8 +22,5 @@ "rimraf": "^3.0.2", "sass": "^1.35.2", "style-dictionary": "^3.0.1" - }, - "dependencies": { - "@fontsource/inter": "^4.5.0" } } diff --git a/packages/theme-base/src/css/theme.scss b/packages/theme-base/src/css/theme.scss index bb7982f8199..21409bf8658 100644 --- a/packages/theme-base/src/css/theme.scss +++ b/packages/theme-base/src/css/theme.scss @@ -3,8 +3,6 @@ */ @import '../../dist/variables.scss'; -@import '~@fontsource/inter/index.css'; -@import '~@fontsource/inter/variable.css'; html { font-family: var(--amplify-fonts-default-static); From 24e36ee46ff4b489bd351d56be7f4109f02c2712 Mon Sep 17 00:00:00 2001 From: Eric Clemmons Date: Wed, 18 Aug 2021 15:43:24 -0500 Subject: [PATCH 11/23] Update yarn.lock --- yarn.lock | 149 +++++++++++++++++++++++++----------------------------- 1 file changed, 70 insertions(+), 79 deletions(-) diff --git a/yarn.lock b/yarn.lock index 11be703eb00..1a10081c308 100644 --- a/yarn.lock +++ b/yarn.lock @@ -129,23 +129,14 @@ ora "5.3.0" rxjs "6.6.3" -"@angular/animations@~11.2.14", "@angular/animations@~11.2.4", "@angular/animations@~11.2.5": +"@angular/animations@~11.2.14", "@angular/animations@~11.2.4": version "11.2.14" resolved "https://registry.yarnpkg.com/@angular/animations/-/animations-11.2.14.tgz#cf119ea779bf11bd3759f1355c85e4e8e9e7bb03" integrity sha512-Heq/nNrCmb3jbkusu+BQszOecfFI/31Oxxj+CDQkqqYpBcswk6bOJLoEE472o+vmgxaXbgeflU9qbIiCQhpMFA== dependencies: tslib "^2.0.0" -"@angular/cdk@~11.2.4-sha-e54d6d8ee": - version "11.2.13" - resolved "https://registry.yarnpkg.com/@angular/cdk/-/cdk-11.2.13.tgz#d54c9187e3b8cf3f8ba190b1edddc08ed2b740de" - integrity sha512-FkE4iCwoLbQxLDUOjV1I7M/6hmpyb7erAjEdWgch7nGRNxF1hqX5Bqf1lvLFKPNCbx5NRI5K7YVAdIUQUR8vug== - dependencies: - tslib "^2.0.0" - optionalDependencies: - parse5 "^5.0.0" - -"@angular/cli@~11.2.14", "@angular/cli@~11.2.3", "@angular/cli@~11.2.4": +"@angular/cli@~11.2.14", "@angular/cli@~11.2.3": version "11.2.14" resolved "https://registry.yarnpkg.com/@angular/cli/-/cli-11.2.14.tgz#7f3bef6367af185fb3904de080d307f0bbb624ba" integrity sha512-8Ud7vcUK7CKjzT2Ks1glLhleAPIC5ChcrA15XtOb7k+/uMHBkMscP/UKymbVQiBjCJlglbzJoyj8cpVYTZY5KA== @@ -173,14 +164,14 @@ universal-analytics "0.4.23" uuid "8.3.2" -"@angular/common@~11.2.14", "@angular/common@~11.2.4", "@angular/common@~11.2.5": +"@angular/common@~11.2.14", "@angular/common@~11.2.4": version "11.2.14" resolved "https://registry.yarnpkg.com/@angular/common/-/common-11.2.14.tgz#52887277b0ae0438e584f9ae97b417ee51a694b5" integrity sha512-ZSLV/3j7eCTyLf/8g4yBFLWySjiLz3vLJAGWscYoUpnJWMnug1VRu6zoF/COxCbtORgE+Wz6K0uhfS6MziBGVw== dependencies: tslib "^2.0.0" -"@angular/compiler-cli@~11.2.14", "@angular/compiler-cli@~11.2.4", "@angular/compiler-cli@~11.2.5": +"@angular/compiler-cli@~11.2.14", "@angular/compiler-cli@~11.2.4": version "11.2.14" resolved "https://registry.yarnpkg.com/@angular/compiler-cli/-/compiler-cli-11.2.14.tgz#fdd22aeec25aa2477595bed631d19e977254ecc5" integrity sha512-A7ltnCp03/EVqK/Q3tVUDsokgz5GHW3dSPGl0Csk7Ys5uBB9ibHTmVt4eiXA4jt0+6Bk+mKxwe5BEDqLvwYFAg== @@ -206,7 +197,7 @@ resolved "https://registry.yarnpkg.com/@angular/compiler/-/compiler-9.0.0.tgz#87e0bef4c369b6cadae07e3a4295778fc93799d5" integrity sha512-ctjwuntPfZZT2mNj2NDIVu51t9cvbhl/16epc5xEwyzyDt76pX9UgwvY+MbXrf/C/FWwdtmNtfP698BKI+9leQ== -"@angular/compiler@~11.2.14", "@angular/compiler@~11.2.4", "@angular/compiler@~11.2.5": +"@angular/compiler@~11.2.14", "@angular/compiler@~11.2.4": version "11.2.14" resolved "https://registry.yarnpkg.com/@angular/compiler/-/compiler-11.2.14.tgz#9d3ea26b4d2d858aab935f69af9e201f53453a0f" integrity sha512-XBOK3HgA+/y6Cz7kOX4zcJYmgJ264XnfcbXUMU2cD7Ac+mbNhLPKohWrEiSWalfcjnpf5gRfufQrQP7lpAGu0A== @@ -218,42 +209,35 @@ resolved "https://registry.yarnpkg.com/@angular/core/-/core-9.0.0.tgz#227dc53e1ac81824f998c6e76000b7efc522641e" integrity sha512-6Pxgsrf0qF9iFFqmIcWmjJGkkCaCm6V5QNnxMy2KloO3SDq6QuMVRbN9RtC8Urmo25LP+eZ6ZgYqFYpdD8Hd9w== -"@angular/core@~11.2.14", "@angular/core@~11.2.4", "@angular/core@~11.2.5": +"@angular/core@~11.2.14", "@angular/core@~11.2.4": version "11.2.14" resolved "https://registry.yarnpkg.com/@angular/core/-/core-11.2.14.tgz#3ebe298c79d5413dc670d56b7f503bd4d788d4a8" integrity sha512-vpR4XqBGitk1Faph37CSpemwIYTmJ3pdIVNoHKP6jLonpWu+0azkchf0f7oD8/2ivj2F81opcIw0tcsy/D/5Vg== dependencies: tslib "^2.0.0" -"@angular/forms@~11.2.14", "@angular/forms@~11.2.4", "@angular/forms@~11.2.5": +"@angular/forms@~11.2.14", "@angular/forms@~11.2.4": version "11.2.14" resolved "https://registry.yarnpkg.com/@angular/forms/-/forms-11.2.14.tgz#dc858408f7647f4fd033996a03aa74df18a02079" integrity sha512-4LWqY6KEIk1AZQFnk+4PJSOCamlD4tumuVN06gO4D0dZo9Cx+GcvW6pM6N0CPubRvPs3sScCnu20WT11HNWC1w== dependencies: tslib "^2.0.0" -"@angular/material@~11.2.4-sha-e54d6d8ee": - version "11.2.13" - resolved "https://registry.yarnpkg.com/@angular/material/-/material-11.2.13.tgz#99960316d3ce58aac7497d7bb8b0c05468f502b9" - integrity sha512-FqFdGSkOtqsmeLyTSousodDGUy2NqbtxCIKv2rwbsIRwHNKB0KpR/UQhA2gMRuGa5hxhMJ0DW0Tf9neMRuLCTg== - dependencies: - tslib "^2.0.0" - -"@angular/platform-browser-dynamic@~11.2.14", "@angular/platform-browser-dynamic@~11.2.4", "@angular/platform-browser-dynamic@~11.2.5": +"@angular/platform-browser-dynamic@~11.2.14", "@angular/platform-browser-dynamic@~11.2.4": version "11.2.14" resolved "https://registry.yarnpkg.com/@angular/platform-browser-dynamic/-/platform-browser-dynamic-11.2.14.tgz#3c7fff1a1daacba5390acf033d28c377ec281166" integrity sha512-TWTPdFs6iBBcp+/YMsgCRQwdHpWGq8KjeJDJ2tfatGgBD3Gqt2YaHOMST1zPW6RkrmupytTejuVqXzeaKWFxuw== dependencies: tslib "^2.0.0" -"@angular/platform-browser@~11.2.14", "@angular/platform-browser@~11.2.4", "@angular/platform-browser@~11.2.5": +"@angular/platform-browser@~11.2.14", "@angular/platform-browser@~11.2.4": version "11.2.14" resolved "https://registry.yarnpkg.com/@angular/platform-browser/-/platform-browser-11.2.14.tgz#e52ad7a54a42a865033a17e57e213013919f1b1d" integrity sha512-fb7b7ss/gRoP8wLAN17W62leMgjynuyjEPU2eUoAAazsG9f2cgM+z3rK29GYncDVyYQxZUZYnjSqvL6GSXx86A== dependencies: tslib "^2.0.0" -"@angular/router@~11.2.14", "@angular/router@~11.2.4", "@angular/router@~11.2.5": +"@angular/router@~11.2.14", "@angular/router@~11.2.4": version "11.2.14" resolved "https://registry.yarnpkg.com/@angular/router/-/router-11.2.14.tgz#4a8eb6d010a1a45c8e7f0c3b5b705959bdb69294" integrity sha512-3aYBmj+zrEL9yf/ntIQxHIYaWShZOBKP3U07X2mX+TPMpGlvHDnR7L6bWhQVZwewzMMz7YVR16ldg50IFuAlfA== @@ -3307,11 +3291,6 @@ minimatch "^3.0.4" strip-json-comments "^3.1.1" -"@fontsource/inter@^4.5.0": - version "4.5.0" - resolved "https://registry.yarnpkg.com/@fontsource/inter/-/inter-4.5.0.tgz#b99e49fa178e4086250fb3df2ed6a7366c9a0cb5" - integrity sha512-2efK8Ru0LkuOYrEpiHPlV02YkTdIKGbezlxVNeA8/3c+tNt7P2aQPuiYYkVy7N4GA5LWSUVcLL/91MpCIjinOw== - "@hapi/accept@5.0.2": version "5.0.2" resolved "https://registry.yarnpkg.com/@hapi/accept/-/accept-5.0.2.tgz#ab7043b037e68b722f93f376afb05e85c0699523" @@ -4342,11 +4321,6 @@ resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.172.tgz#aad774c28e7bfd7a67de25408e03ee5a8c3d028a" integrity sha512-/BHF5HAx3em7/KkzVKm3LrsD6HZAXuXO1AJZQ3cRRBZj4oHZDviWPYu0aEplAqDFNHZPW6d3G7KN+ONcCCC7pw== -"@types/marked@^2.0.0": - version "2.0.4" - resolved "https://registry.yarnpkg.com/@types/marked/-/marked-2.0.4.tgz#34a0ea548afe6e0c01095229d47b48b2af650613" - integrity sha512-L9VRSe0Id8xbPL99mUo/4aKgD7ZoRwFZqUQScNKHi2pFjF9ZYSMNShUHD6VlMT6J/prQq0T1mxuU25m3R7dFzg== - "@types/mdast@^3.0.0": version "3.0.7" resolved "https://registry.yarnpkg.com/@types/mdast/-/mdast-3.0.7.tgz#cba63d0cc11eb1605cea5c0ad76e02684394166b" @@ -6245,6 +6219,11 @@ bytes@3.1.0, bytes@^3.0.0: resolved "https://registry.yarnpkg.com/bytes/-/bytes-3.1.0.tgz#f6cf7933a360e0588fa9fde85651cdc7f805d1f6" integrity sha512-zauLjrfCG+xvoyaqLoV8bLVXXNGC4JqlxFCutSDWA6fJrTo2ZuvLYTqZ7aHBLZSMOopbzwv8f+wZcVzfVTI2Dg== +cac@^6.7.2: + version "6.7.3" + resolved "https://registry.yarnpkg.com/cac/-/cac-6.7.3.tgz#10410b8611677990cc2e3c8b576d471c1d71b768" + integrity sha512-ECVqVZh74qgSuZG9YOt2OJPI3wGcf+EwwuF/XIOYqZBD0KZYLtgPWqFPxmDPQ6joxI1nOlvVgRV6VT53Ooyocg== + cacache@15.0.5: version "15.0.5" resolved "https://registry.yarnpkg.com/cacache/-/cacache-15.0.5.tgz#69162833da29170d6732334643c60e005f5f17d0" @@ -7028,6 +7007,11 @@ commander@^2.11.0, commander@^2.12.1, commander@^2.20.0, commander@^2.9.0: resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.3.tgz#fd485e84c03eb4881c20722ba48035e8531aeb33" integrity sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ== +commander@^4.0.0: + version "4.1.1" + resolved "https://registry.yarnpkg.com/commander/-/commander-4.1.1.tgz#9fd602bd936294e9e9ef46a3f4d6964044b18068" + integrity sha512-NOKm8xhkzAjzFx8B2v5OAHT+u5pRQc2UCa2Vq9jYL/31o2wi9mxBA7LIFs3sV5VSC49z6pEhfbMULvShKj26WA== + commander@^5.1.0: version "5.1.0" resolved "https://registry.yarnpkg.com/commander/-/commander-5.1.0.tgz#46abbd1652f8e059bddaef99bbdcb2ad9cf179ae" @@ -8493,11 +8477,6 @@ emoji-regex@^9.0.0: resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-9.2.2.tgz#840c8803b0d8047f4ff0cf963176b32d4ef3ed72" integrity sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg== -emoji-toolkit@^6.0.1: - version "6.6.0" - resolved "https://registry.yarnpkg.com/emoji-toolkit/-/emoji-toolkit-6.6.0.tgz#e7287c43a96f940ec4c5428cd7100a40e57518f1" - integrity sha512-pEu0kow2p1N8zCKnn/L6H0F3rWUBB3P3hVjr/O5yl1fK7N9jU4vO4G7EFapC5Y3XwZLUCY0FZbOPyTkH+4V2eQ== - emojis-list@^2.0.0: version "2.1.0" resolved "https://registry.yarnpkg.com/emojis-list/-/emojis-list-2.1.0.tgz#4daa4d9db00f9819880c79fa457ae5b09a1fd389" @@ -8705,6 +8684,11 @@ esbuild@^0.12.8: resolved "https://registry.yarnpkg.com/esbuild/-/esbuild-0.12.19.tgz#ab849766705a5093df5acd8ec2f6ba2159a38a6c" integrity sha512-5NuT1G6THW7l3fsSCDkcPepn24R0XtyPjKoqKHD8LfhqMXzCdz0mrS9HgO6hIhzVT7zt0T+JGbzCqF5AH8hS9w== +esbuild@^0.12.9: + version "0.12.20" + resolved "https://registry.yarnpkg.com/esbuild/-/esbuild-0.12.20.tgz#4d3c9d83c99a4031e027b42a4c398c23b6827cb0" + integrity sha512-u7+0qTo9Z64MD9PhooEngCmzyEYJ6ovFhPp8PLNh3UasR5Ihjv6HWVXqm8uHmasdQlpsAf0IsY4U0YVUfCpt4Q== + escalade@^3.1.1: version "3.1.1" resolved "https://registry.yarnpkg.com/escalade/-/escalade-3.1.1.tgz#d8cfdc7000965c5a0174b4a82eaa5c0552742e40" @@ -11812,6 +11796,11 @@ joi@^17.4.0: "@sideway/formula" "^3.0.0" "@sideway/pinpoint" "^2.0.0" +joycon@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/joycon/-/joycon-3.0.1.tgz#9074c9b08ccf37a6726ff74a18485f85efcaddaf" + integrity sha512-SJcJNBg32dGgxhPtM0wQqxqV0ax9k/9TaUskGDSJkSFSQOEWWvQ3zzWdGQRIUry2j1zA5+ReH13t0Mf3StuVZA== + js-cookie@^2.2.1: version "2.2.1" resolved "https://registry.yarnpkg.com/js-cookie/-/js-cookie-2.2.1.tgz#69e106dc5d5806894562902aa5baec3744e9b2b8" @@ -12095,13 +12084,6 @@ karma@~6.1.0: ua-parser-js "^0.7.23" yargs "^16.1.1" -katex@^0.13.0: - version "0.13.13" - resolved "https://registry.yarnpkg.com/katex/-/katex-0.13.13.tgz#15a796e95516869bc6d483443b58b2df872ee40f" - integrity sha512-cCMcil4jwMm7behpXGiQfXJA29sko/Gd/26iCsr53Dv5Jn2iHbHyEb14dm9uVrIijUXx6Zz1WhlFhHE6DckvkQ== - dependencies: - commander "^6.0.0" - keyv@^4.0.0: version "4.0.3" resolved "https://registry.yarnpkg.com/keyv/-/keyv-4.0.3.tgz#4f3aa98de254803cafcd2896734108daa35e4254" @@ -12655,11 +12637,6 @@ markdown-table@^2.0.0: dependencies: repeat-string "^1.0.0" -marked@^2.0.0: - version "2.1.3" - resolved "https://registry.yarnpkg.com/marked/-/marked-2.1.3.tgz#bd017cef6431724fd4b27e0657f5ceb14bff3753" - integrity sha512-/Q+7MGzaETqifOMWYEA7HVMaZb4XbcRfaOzcSsHZEith83KGlvaSG33u0SKu89Mj5h+T8V2hM+8O45Qc5XTgwA== - md5.js@^1.3.4: version "1.3.5" resolved "https://registry.yarnpkg.com/md5.js/-/md5.js-1.3.5.tgz#b5d07b8e3216e3e27cd728d72f70d1e6a342005f" @@ -13309,7 +13286,7 @@ mute-stream@0.0.8: resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.8.tgz#1630c42b2251ff81e2a283de96a5497ea92e5e0d" integrity sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA== -mz@^2.4.0: +mz@^2.4.0, mz@^2.7.0: version "2.7.0" resolved "https://registry.yarnpkg.com/mz/-/mz-2.7.0.tgz#95008057a56cafadc2bc63dde7f9ff6955948e32" integrity sha512-z81GNO7nnYMEhrGh9LeymoE4+Yr0Wn5McHIZMK5cfQCl+NDX08sCZgUc9/6MHni9IWuFLm1Z3HTCXu2z9fN62Q== @@ -13482,18 +13459,6 @@ ng-packagr@^11.0.0: sync-rpc "^1.3.6" terser "^5.5.1" -ngx-markdown@^11.1.2: - version "11.1.3" - resolved "https://registry.yarnpkg.com/ngx-markdown/-/ngx-markdown-11.1.3.tgz#4d01c2dc425e5a46d1b6aa8517d9a1c1feaa1efd" - integrity sha512-z32q8l76ubrcP62L03mdvrizwueLBHV10LkT8MEDnFcjmY+8J1PytxFJ9EBTJpvc+CaPolgAoi7felN2XJZTSg== - dependencies: - "@types/marked" "^2.0.0" - emoji-toolkit "^6.0.1" - katex "^0.13.0" - marked "^2.0.0" - prismjs "^1.23.0" - tslib "^2.0.0" - nice-try@^1.0.4: version "1.0.5" resolved "https://registry.yarnpkg.com/nice-try/-/nice-try-1.0.5.tgz#a3378a7696ce7d223e88fc9b764bd7ef1089e366" @@ -14276,11 +14241,6 @@ parse5@6.0.1, parse5@^6.0.0, parse5@^6.0.1: resolved "https://registry.yarnpkg.com/parse5/-/parse5-6.0.1.tgz#e1a1c085c569b3dc08321184f19a39cc27f7c30b" integrity sha512-Ofn/CTFzRGTTxwpNEs9PP93gXShHcTq255nzRYSKe8AkVpZY7e1fpmTfOyoIvjP5HG7Z2ZM7VS9PPhQGW2pOpw== -parse5@^5.0.0: - version "5.1.1" - resolved "https://registry.yarnpkg.com/parse5/-/parse5-5.1.1.tgz#f68e4e5ba1852ac2cadc00f4555fff6c2abb6178" - integrity sha512-ugq4DFI0Ptb+WWjAdOK16+u/nHfiIrcE+sh8kZMaM0WllQKLI9rOUq6c2b7cwPkXdzfQESqvoqK6ug7U/Yyzug== - parseurl@~1.3.2, parseurl@~1.3.3: version "1.3.3" resolved "https://registry.yarnpkg.com/parseurl/-/parseurl-1.3.3.tgz#9da19e7bee8d12dff0513ed5b76957793bc2e8d4" @@ -14684,7 +14644,7 @@ postcss-js@^3.0.3: camelcase-css "^2.0.1" postcss "^8.1.6" -postcss-load-config@^3.1.0: +postcss-load-config@^3.0.1, postcss-load-config@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/postcss-load-config/-/postcss-load-config-3.1.0.tgz#d39c47091c4aec37f50272373a6a648ef5e97829" integrity sha512-ipM8Ds01ZUophjDTQYSVP70slFSYg3T0/zyfII5vzhN6V57YSxMgG5syXuwi5VtS8wSf3iL30v0uBdoIVx4Q0g== @@ -15230,11 +15190,6 @@ prism-theme-night-owl@^1.4.0: resolved "https://registry.yarnpkg.com/prism-theme-night-owl/-/prism-theme-night-owl-1.4.0.tgz#af8a215ba75c081e22e74be41661dc40d7ad0c34" integrity sha512-1N1GVbVorGd5t1Vw76yL/3rhqdiCpDrJg26Is+jGeMV7qiIMZL+bC7Mjx7HMMuVKZoi+2nWSbU5IutBYNy9tiQ== -prismjs@^1.23.0: - version "1.24.1" - resolved "https://registry.yarnpkg.com/prismjs/-/prismjs-1.24.1.tgz#c4d7895c4d6500289482fa8936d9cdd192684036" - integrity sha512-mNPsedLuk90RVJioIky8ANZEwYm5w9LcvCXrxHlwf4fNVSn8jEipMybMkWUyyF0JhnC+C4VcOVSBuHRKs1L5Ow== - prismjs@~1.23.0: version "1.23.0" resolved "https://registry.yarnpkg.com/prismjs/-/prismjs-1.23.0.tgz#d3b3967f7d72440690497652a9d40ff046067f33" @@ -16210,7 +16165,7 @@ rollup@2.38.4: optionalDependencies: fsevents "~2.3.1" -rollup@^2.37.0, rollup@^2.38.5: +rollup@^2.37.0, rollup@^2.38.5, rollup@^2.56.1: version "2.56.2" resolved "https://registry.yarnpkg.com/rollup/-/rollup-2.56.2.tgz#a045ff3f6af53ee009b5f5016ca3da0329e5470f" integrity sha512-s8H00ZsRi29M2/lGdm1u8DJpJ9ML8SUOpVVBd33XNeEeL3NVaTiUcSBHzBdF3eAyR0l7VSpsuoVUGrRHq7aPwQ== @@ -17506,6 +17461,18 @@ subarg@^1.0.0: dependencies: minimist "^1.1.0" +sucrase@^3.18.1: + version "3.20.1" + resolved "https://registry.yarnpkg.com/sucrase/-/sucrase-3.20.1.tgz#1c055e97d0fab2f9857f02461364075b3a4ab226" + integrity sha512-BIG59HaJOxNct9Va6KvT5yzBA/rcMGetzvZyTx0ZdCcspIbpJTPS64zuAfYlJuOj+3WaI5JOdA+F0bJQQi8ZiQ== + dependencies: + commander "^4.0.0" + glob "7.1.6" + lines-and-columns "^1.1.6" + mz "^2.7.0" + pirates "^4.0.1" + ts-interface-checker "^0.1.9" + supports-color@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-2.0.0.tgz#535d045ce6b6363fa40117084629995e9df324c7" @@ -18001,7 +17968,7 @@ tr46@^2.1.0: resolved "https://registry.yarnpkg.com/traverse/-/traverse-0.3.9.tgz#717b8f220cc0bb7b44e40514c22b2e8bbc70d8b9" integrity sha1-cXuPIgzAu3tE5AUUwisui7xw2Lk= -tree-kill@1.2.2: +tree-kill@1.2.2, tree-kill@^1.2.2: version "1.2.2" resolved "https://registry.yarnpkg.com/tree-kill/-/tree-kill-1.2.2.tgz#4ca09a9092c88b73a7cdc5e8a01b507b0790a0cc" integrity sha512-L0Orpi8qGpRG//Nd+H90vFB+3iHnue1zSSGmNOOCh1GLJ7rUKVwV2HvijphGQS2UmhUZewS9VgvxYIdgr+fG1A== @@ -18026,6 +17993,11 @@ trough@^1.0.0: resolved "https://registry.yarnpkg.com/trough/-/trough-1.0.5.tgz#b8b639cefad7d0bb2abd37d433ff8293efa5f406" integrity sha512-rvuRbTarPXmMb79SmzEp8aqXNKcK+y0XaB298IXueQ8I2PsrATcPBCSPyK/dDNa2iWOhKlfNnOjdAOTBU/nkFA== +ts-interface-checker@^0.1.9: + version "0.1.13" + resolved "https://registry.yarnpkg.com/ts-interface-checker/-/ts-interface-checker-0.1.13.tgz#784fd3d679722bc103b1b4b8030bcddb5db2a699" + integrity sha512-Y/arvbn+rrz3JCKl9C4kVNfTfSm2/mEp5FSz5EsZSANGPSlQrpRI5M4PKF+mJnE52jOO90PnPSc3Ur3bTQw0gA== + ts-jest@^27.0.3: version "27.0.4" resolved "https://registry.yarnpkg.com/ts-jest/-/ts-jest-27.0.4.tgz#df49683535831560ccb58f94c023d831b1b80df0" @@ -18101,6 +18073,25 @@ tslint@~6.1.0: tslib "^1.13.0" tsutils "^2.29.0" +tsup@^4.14.0: + version "4.14.0" + resolved "https://registry.yarnpkg.com/tsup/-/tsup-4.14.0.tgz#3e2f602d8446041b48fcb557904a709c0fcec981" + integrity sha512-77rWdzhikTP9mQ34XMRzK83tw++LF6f4ox/HNERlgesB7g6g5VQ1iJlueG9O0P9HAZGVKavUwyoZv0+322p6rg== + dependencies: + cac "^6.7.2" + chalk "^4.1.0" + chokidar "^3.5.1" + debug "^4.3.1" + esbuild "^0.12.9" + execa "^5.0.0" + globby "^11.0.3" + joycon "^3.0.1" + postcss-load-config "^3.0.1" + resolve-from "^5.0.0" + rollup "^2.56.1" + sucrase "^3.18.1" + tree-kill "^1.2.2" + tsutils@^2.29.0: version "2.29.0" resolved "https://registry.yarnpkg.com/tsutils/-/tsutils-2.29.0.tgz#32b488501467acbedd4b85498673a0812aca0b99" From 3e6be6c4afe8c157280acdce6e871dd91bf8ca10 Mon Sep 17 00:00:00 2001 From: Eric Clemmons Date: Wed, 18 Aug 2021 15:48:16 -0500 Subject: [PATCH 12/23] Fix .page.tsx suffix for next-example --- examples/next/pages/{_app.tsx => _app.page.tsx} | 0 examples/next/pages/{_document.tsx => _document.page.tsx} | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename examples/next/pages/{_app.tsx => _app.page.tsx} (100%) rename examples/next/pages/{_document.tsx => _document.page.tsx} (100%) diff --git a/examples/next/pages/_app.tsx b/examples/next/pages/_app.page.tsx similarity index 100% rename from examples/next/pages/_app.tsx rename to examples/next/pages/_app.page.tsx diff --git a/examples/next/pages/_document.tsx b/examples/next/pages/_document.page.tsx similarity index 100% rename from examples/next/pages/_document.tsx rename to examples/next/pages/_document.page.tsx From c280c2295acdf0cbf520baf3977013f64f3f8a54 Mon Sep 17 00:00:00 2001 From: Eric Clemmons Date: Fri, 20 Aug 2021 12:51:36 -0500 Subject: [PATCH 13/23] Move tsup to root so it can be patched --- package.json | 3 ++- packages/react/package.json | 2 -- {packages/react/patches => patches}/tsup+4.14.0.patch | 0 3 files changed, 2 insertions(+), 3 deletions(-) rename {packages/react/patches => patches}/tsup+4.14.0.patch (100%) diff --git a/package.json b/package.json index 11a11811fa8..b3def6a7cc3 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,8 @@ }, "dependencies": { "patch-package": "^6.4.7", - "postinstall-postinstall": "^2.1.0" + "postinstall-postinstall": "^2.1.0", + "tsup": "^4.14.0" }, "devDependencies": { "husky": ">=6", diff --git a/packages/react/package.json b/packages/react/package.json index 25a84da09df..6c8f94826c3 100644 --- a/packages/react/package.json +++ b/packages/react/package.json @@ -22,7 +22,6 @@ "build:icons": "yarn run clean:icons && node scripts/generateIcons.js", "clean": "rimraf dist", "clean:icons": "rimraf ./src/primitives/Icon/icons", - "postinstall": "patch-package", "primitives:new": "hygen primitives new", "test": "yarn test:unit", "test:watch": "yarn test:unit:watch", @@ -59,7 +58,6 @@ "jest": "^27.0.4", "rimraf": "^3.0.2", "ts-jest": "^27.0.3", - "tsup": "^4.14.0", "typescript": "^4.3.2" } } diff --git a/packages/react/patches/tsup+4.14.0.patch b/patches/tsup+4.14.0.patch similarity index 100% rename from packages/react/patches/tsup+4.14.0.patch rename to patches/tsup+4.14.0.patch From 5738715a112102ec489f7be8acf41665365fe947 Mon Sep 17 00:00:00 2001 From: Eric Clemmons Date: Fri, 20 Aug 2021 13:17:21 -0500 Subject: [PATCH 14/23] Patch tsup at workspace root --- packages/core/src/globals.js | 9 +++++++++ packages/react/src/{react-shim.js => globals.js} | 1 + patches/tsup+4.14.0.patch | 2 +- 3 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 packages/core/src/globals.js rename packages/react/src/{react-shim.js => globals.js} (84%) diff --git a/packages/core/src/globals.js b/packages/core/src/globals.js new file mode 100644 index 00000000000..24165f3b1b7 --- /dev/null +++ b/packages/core/src/globals.js @@ -0,0 +1,9 @@ +/** + * This shim exists for `esbuild` to `inject` into every .tsx file. + * Otherwise, `import * as React from 'react'` would need to be added manually + * + * See: https://esbuild.github.io/content-types/#auto-import-for-jsx + * See: https://github.com/egoist/tsup/issues/390 + */ + +// No shims needed for core diff --git a/packages/react/src/react-shim.js b/packages/react/src/globals.js similarity index 84% rename from packages/react/src/react-shim.js rename to packages/react/src/globals.js index 7dd24cc0757..d4aff20c498 100644 --- a/packages/react/src/react-shim.js +++ b/packages/react/src/globals.js @@ -3,6 +3,7 @@ * Otherwise, `import * as React from 'react'` would need to be added manually * * See: https://esbuild.github.io/content-types/#auto-import-for-jsx + * See: https://github.com/egoist/tsup/issues/390 */ import * as React from 'react'; diff --git a/patches/tsup+4.14.0.patch b/patches/tsup+4.14.0.patch index dbbb1cdce95..44f6dcd0e56 100644 --- a/patches/tsup+4.14.0.patch +++ b/patches/tsup+4.14.0.patch @@ -6,7 +6,7 @@ index 1fd3ea9..8f84cf0 100644 jsxFactory: options.jsxFactory, jsxFragment: options.jsxFragment, sourcemap: options.sourcemap, -+ inject: ['./src/react-shim.js'], ++ inject: ['./src/globals.js'], target: options.target === "es5" ? "es2016" : options.target, plugins: [ externalPlugin({ From f51ed187a54f9a37eeb27683d46594f8807d1428 Mon Sep 17 00:00:00 2001 From: Eric Clemmons Date: Fri, 20 Aug 2021 13:17:35 -0500 Subject: [PATCH 15/23] Build theme-base && core && react on install --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index b3def6a7cc3..52d795d19ef 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "private": true, "scripts": { - "install": "yarn run theme-base build:all", + "install": "yarn run theme-base build:all && yarn core build && yarn react build", "postinstall": "patch-package", "build": "yarn workspaces run build", "angular": "yarn workspace @aws-amplify/ui-angular", From 86b0a76c4f930186325001281b39e7ff13709e81 Mon Sep 17 00:00:00 2001 From: Eric Clemmons Date: Fri, 20 Aug 2021 13:17:43 -0500 Subject: [PATCH 16/23] Remove core/index.ts --- packages/core/index.ts | 1 - 1 file changed, 1 deletion(-) delete mode 100644 packages/core/index.ts diff --git a/packages/core/index.ts b/packages/core/index.ts deleted file mode 100644 index 8420b1093fd..00000000000 --- a/packages/core/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './src'; From 45b6751d0248d3ccc9f64fd9001bdb66ac886124 Mon Sep 17 00:00:00 2001 From: Eric Clemmons Date: Fri, 20 Aug 2021 13:18:13 -0500 Subject: [PATCH 17/23] Don't clear dist on dev --- packages/react/package.json | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/react/package.json b/packages/react/package.json index 6c8f94826c3..a7787ace235 100644 --- a/packages/react/package.json +++ b/packages/react/package.json @@ -16,7 +16,6 @@ "scripts": { "prebuild": "rimraf dist", "build": "tsup --minify", - "predev": "rimraf dist", "dev": "tsup --watch", "update:icons": "node scripts/updateIcons.js", "build:icons": "yarn run clean:icons && node scripts/generateIcons.js", From c8dda63265ac6c573cf44daa92aa3e505d5aea79 Mon Sep 17 00:00:00 2001 From: Eric Clemmons Date: Fri, 20 Aug 2021 13:18:18 -0500 Subject: [PATCH 18/23] Only watch src --- packages/react/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/react/package.json b/packages/react/package.json index a7787ace235..d044f29d905 100644 --- a/packages/react/package.json +++ b/packages/react/package.json @@ -16,7 +16,7 @@ "scripts": { "prebuild": "rimraf dist", "build": "tsup --minify", - "dev": "tsup --watch", + "dev": "tsup --watch src", "update:icons": "node scripts/updateIcons.js", "build:icons": "yarn run clean:icons && node scripts/generateIcons.js", "clean": "rimraf dist", From 121f14082cb28246969fc3f6239273e979f0ea32 Mon Sep 17 00:00:00 2001 From: Eric Clemmons Date: Fri, 20 Aug 2021 13:18:42 -0500 Subject: [PATCH 19/23] Don't inline core or theme-base because of CJS/require gets pulled in --- packages/react/package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/react/package.json b/packages/react/package.json index d044f29d905..89470018619 100644 --- a/packages/react/package.json +++ b/packages/react/package.json @@ -28,6 +28,8 @@ "test:unit:watch": "jest --watch" }, "dependencies": { + "@aws-amplify/ui-core": "^0.0.1", + "@aws-amplify/ui-theme-base": "^0.0.1", "@xstate/react": "^1.4.0", "classnames": "^2.3.1", "qrcode": "^1.4.4" @@ -44,8 +46,6 @@ ] }, "devDependencies": { - "@aws-amplify/ui-core": "^0.0.1", - "@aws-amplify/ui-theme-base": "^0.0.1", "@testing-library/jest-dom": "^5.14.1", "@testing-library/react": "^12.0.0", "@testing-library/react-hooks": "^7.0.1", From 9f6b965838effba523562aa924449fcc1e80231d Mon Sep 17 00:00:00 2001 From: Eric Clemmons Date: Fri, 20 Aug 2021 13:18:55 -0500 Subject: [PATCH 20/23] Remove inspect from core --- packages/core/src/machines/authMachine.ts | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/packages/core/src/machines/authMachine.ts b/packages/core/src/machines/authMachine.ts index 10e591235c2..701019f5ec6 100644 --- a/packages/core/src/machines/authMachine.ts +++ b/packages/core/src/machines/authMachine.ts @@ -1,7 +1,6 @@ import { assign, createMachine, forwardTo, spawn } from 'xstate'; import { Auth, Amplify } from 'aws-amplify'; import { AuthContext, AuthEvent } from '../types'; -import { inspect } from '@xstate/inspect'; import { signInActor, signUpActor, @@ -10,15 +9,6 @@ import { } from './actors'; import { stopActor } from './actions'; -// TODO: Remove this before it's merged. -if (typeof window !== 'undefined') { - inspect({ - // options - // url: 'https://statecharts.io/inspect', // (default) - iframe: false, // open in new window - }); -} - export const authMachine = createMachine( { id: 'auth', From e796e253468667c3f27a80997033d4a7eeb751f2 Mon Sep 17 00:00:00 2001 From: Eric Clemmons Date: Fri, 20 Aug 2021 13:19:04 -0500 Subject: [PATCH 21/23] Working core build --- packages/core/package.json | 15 ++++++++++----- packages/core/tsup.config.cjs | 10 ++++++++++ 2 files changed, 20 insertions(+), 5 deletions(-) create mode 100644 packages/core/tsup.config.cjs diff --git a/packages/core/package.json b/packages/core/package.json index ecdd80dca43..b467b7bc00c 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -2,15 +2,17 @@ "private": true, "name": "@aws-amplify/ui-core", "version": "0.0.1", - "module": "index.ts", - "main": "dist/index.js", + "type": "module", + "main": "dist/index.cjs", + "module": "dist/index.js", "types": "dist/index.d.ts", "files": [ - "dist/*.{js,ts}", - "dist/**/*.{js,ts}" + "dist" ], "scripts": { - "build": "tsc", + "prebuild": "rimraf dist", + "build": "tsup --minify", + "dev": "tsup --watch src", "test": "echo \"Skipped: no test specified\"" }, "dependencies": { @@ -21,5 +23,8 @@ "@types/lodash": "^4.14.170", "@types/webpack-env": "^1.16.2", "tslib": "^2.3.0" + }, + "peerDependencies": { + "aws-amplify": "3.x.x || 4.x.x" } } diff --git a/packages/core/tsup.config.cjs b/packages/core/tsup.config.cjs new file mode 100644 index 00000000000..cbae115a554 --- /dev/null +++ b/packages/core/tsup.config.cjs @@ -0,0 +1,10 @@ +/** + * @type {import("tsup").Options} + */ +module.exports = { + dts: true, + entryPoints: ['src/index.ts'], + format: ['cjs', 'esm'], + sourcemap: 'both', + splitting: false, +}; From b09563a38f7040a4142c1269149c823476c6f903 Mon Sep 17 00:00:00 2001 From: Eric Clemmons Date: Fri, 20 Aug 2021 13:24:46 -0500 Subject: [PATCH 22/23] Clarify how to build & watch each package --- CONTRIBUTING.md | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index a4ce2acf2ec..4324e20e88f 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -19,7 +19,17 @@ Internally, this content is served by a single, Next.js [optional catch all route](https://nextjs.org/docs/routing/dynamic-routes#optional-catch-all-routes): [`docs/src/pages/[[...slugs]].tsx`](docs/src/pages/[[...slugs]].tsx). -## Next/React Development +## `@aws-amplify/core` + +- `yarn core build` to rebuild for production. +- `yarn core dev` to watch & rebuild for development. + +## `@aws-amplify/ui-react` + +- `yarn react build` to rebuild for production. +- `yarn react dev` to watch & rebuild for development. + +## Next Examples Development 1. Create or Update an example at [`examples/...`](examples) @@ -43,7 +53,7 @@ Internally, this content is served by a single, Next.js [optional catch all rout Next.js should automatically hot-reload your changes in the example. -### Documentation & Testing +### E2E Testing 1. Create or Update a `${feature}.feature` file (using [Gherkin](https://cucumber.io/docs/gherkin/reference/)) describing the behavior in [`packages/e2e/cypress/integration/${slug}`](packages/e2e/cypress/integration). @@ -61,6 +71,7 @@ Internally, this content is served by a single, Next.js [optional catch all rout ``` 1. Create or Update the accompanying `${slug}.feature` tests (e.g. `packages/e2e/cypress/integration/${slug}/${feature}/${feature}.ts` +1. Start one of the [examples](examples). 1. Run `yarn e2e dev` to load Cypress 1. Click on your updated `${feature}.feature` file to validate your changes 1. Add tags (e.g. `@react`, `@vue`, `@angular`, `@skip`, or `@focus`) above your `Scenario` to indicate which platform(s) to test against From f4d7e5c365cc4c62b2f82765eeef68e319c0d074 Mon Sep 17 00:00:00 2001 From: Eric Clemmons Date: Fri, 20 Aug 2021 13:25:53 -0500 Subject: [PATCH 23/23] Use .cjs for ES5 files --- packages/react/{jest.config.js => jest.config.cjs} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename packages/react/{jest.config.js => jest.config.cjs} (100%) diff --git a/packages/react/jest.config.js b/packages/react/jest.config.cjs similarity index 100% rename from packages/react/jest.config.js rename to packages/react/jest.config.cjs