diff --git a/.github/workflows/prbot.yml b/.github/workflows/prbot.yml index 08d32a043b9..2736a5771be 100644 --- a/.github/workflows/prbot.yml +++ b/.github/workflows/prbot.yml @@ -91,7 +91,6 @@ jobs: - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 - uses: ./.github/actions/setup - run: npm run build - - run: cat packages/atomic/dist/atomic/atomic.esm.js - uses: ./.github/actions/playwright-atomic with: shardIndex: ${{ matrix.shardIndex }} @@ -107,7 +106,6 @@ jobs: - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 - uses: ./.github/actions/setup - run: npm run build - - run: cat packages/atomic/dist/atomic/atomic.esm.js - uses: ./.github/actions/merge-playwright-reports - name: Generate a token if: ${{ always() && github.event_name == 'pull_request'}} diff --git a/.prettierignore b/.prettierignore index 26b8de76282..6603d0cf302 100644 --- a/.prettierignore +++ b/.prettierignore @@ -20,7 +20,8 @@ packages/atomic/dist-storybook/**/* packages/atomic/src/components/search/atomic-search-interface/lang/*.json packages/atomic/src/external-builds/**/* packages/atomic/src/generated/** +packages/headless/src/external-builds/**/* packages/quantic/docs/out/quantic-docs.json packages/samples/headless-react/build/**/* packages/samples/angular/src/lang/*.json -packages/samples/vuejs/public/lang/*.json \ No newline at end of file +packages/samples/vuejs/public/lang/*.json diff --git a/package-lock.json b/package-lock.json index 5bb374818e2..6d98571983d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4935,6 +4935,12 @@ "resolved": "packages/bueno", "link": true }, + "node_modules/@coveo/explorer-messenger": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/@coveo/explorer-messenger/-/explorer-messenger-0.4.0.tgz", + "integrity": "sha512-nVxwn+4Z+SZe6K94evxPaIeJWJq7hATNaUrTKznnauVptFMYcujts/nnhMplddm9ePg7NgZQjvcHwbi5kqw/EA==", + "license": "Apache-2.0" + }, "node_modules/@coveo/headless": { "resolved": "packages/headless", "link": true @@ -4975,6 +4981,29 @@ "resolved": "packages/quantic", "link": true }, + "node_modules/@coveo/relay": { + "version": "0.7.10", + "resolved": "https://registry.npmjs.org/@coveo/relay/-/relay-0.7.10.tgz", + "integrity": "sha512-d/4Vf8wwj746M0RV9xAek7SV/rZhv3ERoQoZo6I2IKAqzMxX8r0Vyrau+UZG1sdxybd6zzo8AVIzvRFHGXxvnA==", + "license": "Apache-2.0", + "dependencies": { + "@coveo/explorer-messenger": "^0.4.0", + "uuid": "^9.0.1" + } + }, + "node_modules/@coveo/relay/node_modules/uuid": { + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.1.tgz", + "integrity": "sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA==", + "funding": [ + "https://github.com/sponsors/broofa", + "https://github.com/sponsors/ctavan" + ], + "license": "MIT", + "bin": { + "uuid": "dist/bin/uuid" + } + }, "node_modules/@coveo/release": { "resolved": "utils/release", "link": true @@ -10635,6 +10664,30 @@ } } }, + "node_modules/@reduxjs/toolkit": { + "version": "2.2.7", + "resolved": "https://registry.npmjs.org/@reduxjs/toolkit/-/toolkit-2.2.7.tgz", + "integrity": "sha512-faI3cZbSdFb8yv9dhDTmGwclW0vk0z5o1cia+kf7gCbaCwHI5e+7tP57mJUv22pNcNbeA62GSrPpfrUfdXcQ6g==", + "license": "MIT", + "dependencies": { + "immer": "^10.0.3", + "redux": "^5.0.1", + "redux-thunk": "^3.1.0", + "reselect": "^5.1.0" + }, + "peerDependencies": { + "react": "^16.9.0 || ^17.0.0 || ^18", + "react-redux": "^7.2.1 || ^8.1.3 || ^9.0.0" + }, + "peerDependenciesMeta": { + "react": { + "optional": true + }, + "react-redux": { + "optional": true + } + } + }, "node_modules/@remix-run/router": { "version": "1.19.0", "resolved": "https://registry.npmjs.org/@remix-run/router/-/router-1.19.0.tgz", @@ -10938,9 +10991,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm-musleabihf": { - "version": "4.18.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.18.0.tgz", - "integrity": "sha512-l3m9ewPgjQSXrUMHg93vt0hYCGnrMOcUpTz6FLtbwljo2HluS4zTXFy2571YQbisTnfTKPZ01u/ukJdQTLGh9A==", + "version": "4.22.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.22.4.tgz", + "integrity": "sha512-dJnWUgwWBX1YBRsuKKMOlXCzh2Wu1mlHzv20TpqEsfdZLb3WoJW2kIEsGwLkroYf24IrPAvOT/ZQ2OYMV6vlrg==", "cpu": [ "arm" ], @@ -25467,6 +25520,17 @@ "url": "https://opencollective.com/webpack" } }, + "node_modules/core-js": { + "version": "3.37.1", + "resolved": "https://registry.npmjs.org/core-js/-/core-js-3.37.1.tgz", + "integrity": "sha512-Xn6qmxrQZyB0FFY8E3bgRXei3lWDJHhvI+u0q9TKIYM49G8pAr0FgnnrFRAmsbptZL1yxRADVXn+x5AGsbBfyw==", + "hasInstallScript": true, + "license": "MIT", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/core-js" + } + }, "node_modules/core-js-compat": { "version": "3.37.1", "resolved": "https://registry.npmjs.org/core-js-compat/-/core-js-compat-3.37.1.tgz", @@ -28571,6 +28635,36 @@ "integrity": "sha512-jyfL/pwPqaFXyKnj8lP8iLk6Z0m099uXR45aSN8Av1XD4vhvQutxxPzgA2bTcAwQpa1zCXDcWOlhFgyP3GKqhQ==", "dev": true }, + "node_modules/esbuild-plugin-alias-path": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/esbuild-plugin-alias-path/-/esbuild-plugin-alias-path-2.0.2.tgz", + "integrity": "sha512-YK8H9bzx6/CG6YBV11XjoNLjRhNZP0Ta4xZ3ATHhPn7pN8ljQGg+zne4d47DpIzF8/sX2qM+xQWev0CvaD2rSQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "find-up": "5.0.0", + "fs-extra": "^10.1.0", + "jsonfile": "^6.1.0" + }, + "peerDependencies": { + "esbuild": ">= 0.14.0" + } + }, + "node_modules/esbuild-plugin-alias-path/node_modules/fs-extra": { + "version": "10.1.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-10.1.0.tgz", + "integrity": "sha512-oRXApq54ETRj4eMiFzGnHWGy+zo5raudjuxN0b8H7s/RU2oW0Wvsx9O0ACRN/kRq9E8Vu/ReskGB5o3ji+FzHQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "graceful-fs": "^4.2.0", + "jsonfile": "^6.0.1", + "universalify": "^2.0.0" + }, + "engines": { + "node": ">=12" + } + }, "node_modules/esbuild-plugin-umd-wrapper": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/esbuild-plugin-umd-wrapper/-/esbuild-plugin-umd-wrapper-2.0.3.tgz", @@ -33987,6 +34081,38 @@ "url": "https://github.com/sponsors/typicode" } }, + "node_modules/i18next": { + "version": "23.12.2", + "resolved": "https://registry.npmjs.org/i18next/-/i18next-23.12.2.tgz", + "integrity": "sha512-XIeh5V+bi8SJSWGL3jqbTEBW5oD6rbP5L+E7dVQh1MNTxxYef0x15rhJVcRb7oiuq4jLtgy2SD8eFlf6P2cmqg==", + "funding": [ + { + "type": "individual", + "url": "https://locize.com" + }, + { + "type": "individual", + "url": "https://locize.com/i18next.html" + }, + { + "type": "individual", + "url": "https://www.i18next.com/how-to/faq#i18next-is-awesome.-how-can-i-support-the-project" + } + ], + "license": "MIT", + "dependencies": { + "@babel/runtime": "^7.23.2" + } + }, + "node_modules/i18next-http-backend": { + "version": "2.5.2", + "resolved": "https://registry.npmjs.org/i18next-http-backend/-/i18next-http-backend-2.5.2.tgz", + "integrity": "sha512-+K8HbDfrvc1/2X8jpb7RLhI9ZxBDpx3xogYkQwGKlWAUXLSEGXzgdt3EcUjLlBCdMwdQY+K+EUF6oh8oB6rwHw==", + "license": "MIT", + "dependencies": { + "cross-fetch": "4.0.0" + } + }, "node_modules/iconv-lite": { "version": "0.6.3", "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz", @@ -34049,6 +34175,16 @@ "node": ">=10" } }, + "node_modules/immer": { + "version": "10.1.1", + "resolved": "https://registry.npmjs.org/immer/-/immer-10.1.1.tgz", + "integrity": "sha512-s2MPrmjovJcoMaHtx6K11Ra7oD05NT97w1IC5zpMkT6Atjr7H8LjaDd81iIxUYpMKSRRNMJE703M1Fhr/TctHw==", + "license": "MIT", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/immer" + } + }, "node_modules/immutable": { "version": "4.3.5", "resolved": "https://registry.npmjs.org/immutable/-/immutable-4.3.5.tgz", @@ -45312,6 +45448,21 @@ "balanced-match": "^1.0.0" } }, + "node_modules/redux": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/redux/-/redux-5.0.1.tgz", + "integrity": "sha512-M9/ELqF6fy8FwmkpnF0S3YKOqMyoWJ4+CS5Efg2ct3oY9daQvd/Pc71FpGZsVsbl3Cpb+IIcjBDUnnyBdQbq4w==", + "license": "MIT" + }, + "node_modules/redux-thunk": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/redux-thunk/-/redux-thunk-3.1.0.tgz", + "integrity": "sha512-NW2r5T6ksUKXCabzhL9z+h206HQw/NJkcLm1GPImRQ8IzfXwRGqjVhKJGauHirT0DAuyy6hjdnMZaRoAcy0Klw==", + "license": "MIT", + "peerDependencies": { + "redux": "^5.0.0" + } + }, "node_modules/reflect-metadata": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/reflect-metadata/-/reflect-metadata-0.2.1.tgz", @@ -45707,6 +45858,12 @@ "lodash": "^4.17.21" } }, + "node_modules/reselect": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/reselect/-/reselect-5.1.1.tgz", + "integrity": "sha512-K/BG6eIky/SBpzfHZv/dd+9JBFiS4SWV7FIujVyJRux6e45+73RaUHXLmIR1f7WOMaQ0U1km6qwklRQxpJJY0w==", + "license": "MIT" + }, "node_modules/resolve": { "version": "1.22.8", "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.8.tgz", @@ -49093,6 +49250,12 @@ "typescript": ">=4.2.0" } }, + "node_modules/ts-debounce": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/ts-debounce/-/ts-debounce-4.0.0.tgz", + "integrity": "sha512-+1iDGY6NmOGidq7i7xZGA4cm8DAa6fqdYcvO5Z6yBevH++Bdo9Qt/mN0TzHUgcCcKv1gmh9+W5dHqz8pMWbCbg==", + "license": "MIT" + }, "node_modules/ts-dedent": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/ts-dedent/-/ts-dedent-2.2.0.tgz", @@ -52043,6 +52206,7 @@ "postcss-nested": "6.2.0", "puppeteer": "22.14.0", "react": "18.3.1", + "rollup": "4.22.4", "rollup-plugin-html": "0.2.1", "shadow-dom-testing-library": "1.11.2", "storybook": "8.1.2", @@ -52058,6 +52222,7 @@ "node": "^20.9.0" }, "peerDependencies": { + "@coveo/bueno": "1.0.0", "@coveo/headless": "3.0.0" } }, @@ -53313,195 +53478,210 @@ } }, "packages/atomic/node_modules/@rollup/rollup-android-arm-eabi": { - "version": "4.18.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.18.0.tgz", - "integrity": "sha512-Tya6xypR10giZV1XzxmH5wr25VcZSncG0pZIjfePT0OVBvqNEurzValetGNarVrGiq66EBVAFn15iYX4w6FKgQ==", + "version": "4.22.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.22.4.tgz", + "integrity": "sha512-Fxamp4aEZnfPOcGA8KSNEohV8hX7zVHOemC8jVBoBUHu5zpJK/Eu3uJwt6BMgy9fkvzxDaurgj96F/NiLukF2w==", "cpu": [ "arm" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "android" ] }, "packages/atomic/node_modules/@rollup/rollup-android-arm64": { - "version": "4.18.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.18.0.tgz", - "integrity": "sha512-avCea0RAP03lTsDhEyfy+hpfr85KfyTctMADqHVhLAF3MlIkq83CP8UfAHUssgXTYd+6er6PaAhx/QGv4L1EiA==", + "version": "4.22.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.22.4.tgz", + "integrity": "sha512-VXoK5UMrgECLYaMuGuVTOx5kcuap1Jm8g/M83RnCHBKOqvPPmROFJGQaZhGccnsFtfXQ3XYa4/jMCJvZnbJBdA==", "cpu": [ "arm64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "android" ] }, "packages/atomic/node_modules/@rollup/rollup-darwin-arm64": { - "version": "4.18.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.18.0.tgz", - "integrity": "sha512-IWfdwU7KDSm07Ty0PuA/W2JYoZ4iTj3TUQjkVsO/6U+4I1jN5lcR71ZEvRh52sDOERdnNhhHU57UITXz5jC1/w==", + "version": "4.22.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.22.4.tgz", + "integrity": "sha512-xMM9ORBqu81jyMKCDP+SZDhnX2QEVQzTcC6G18KlTQEzWK8r/oNZtKuZaCcHhnsa6fEeOBionoyl5JsAbE/36Q==", "cpu": [ "arm64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "darwin" ] }, "packages/atomic/node_modules/@rollup/rollup-darwin-x64": { - "version": "4.18.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.18.0.tgz", - "integrity": "sha512-n2LMsUz7Ynu7DoQrSQkBf8iNrjOGyPLrdSg802vk6XT3FtsgX6JbE8IHRvposskFm9SNxzkLYGSq9QdpLYpRNA==", + "version": "4.22.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.22.4.tgz", + "integrity": "sha512-aJJyYKQwbHuhTUrjWjxEvGnNNBCnmpHDvrb8JFDbeSH3m2XdHcxDd3jthAzvmoI8w/kSjd2y0udT+4okADsZIw==", "cpu": [ "x64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "darwin" ] }, "packages/atomic/node_modules/@rollup/rollup-linux-arm-gnueabihf": { - "version": "4.18.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.18.0.tgz", - "integrity": "sha512-C/zbRYRXFjWvz9Z4haRxcTdnkPt1BtCkz+7RtBSuNmKzMzp3ZxdM28Mpccn6pt28/UWUCTXa+b0Mx1k3g6NOMA==", + "version": "4.22.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.22.4.tgz", + "integrity": "sha512-j63YtCIRAzbO+gC2L9dWXRh5BFetsv0j0va0Wi9epXDgU/XUi5dJKo4USTttVyK7fGw2nPWK0PbAvyliz50SCQ==", "cpu": [ "arm" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "linux" ] }, "packages/atomic/node_modules/@rollup/rollup-linux-arm64-gnu": { - "version": "4.18.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.18.0.tgz", - "integrity": "sha512-rJ5D47d8WD7J+7STKdCUAgmQk49xuFrRi9pZkWoRD1UeSMakbcepWXPF8ycChBoAqs1pb2wzvbY6Q33WmN2ftw==", + "version": "4.22.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.22.4.tgz", + "integrity": "sha512-AdPRoNi3NKVLolCN/Sp4F4N1d98c4SBnHMKoLuiG6RXgoZ4sllseuGioszumnPGmPM2O7qaAX/IJdeDU8f26Aw==", "cpu": [ "arm64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "linux" ] }, "packages/atomic/node_modules/@rollup/rollup-linux-arm64-musl": { - "version": "4.18.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.18.0.tgz", - "integrity": "sha512-be6Yx37b24ZwxQ+wOQXXLZqpq4jTckJhtGlWGZs68TgdKXJgw54lUUoFYrg6Zs/kjzAQwEwYbp8JxZVzZLRepQ==", + "version": "4.22.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.22.4.tgz", + "integrity": "sha512-Gl0AxBtDg8uoAn5CCqQDMqAx22Wx22pjDOjBdmG0VIWX3qUBHzYmOKh8KXHL4UpogfJ14G4wk16EQogF+v8hmA==", "cpu": [ "arm64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "linux" ] }, "packages/atomic/node_modules/@rollup/rollup-linux-powerpc64le-gnu": { - "version": "4.18.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-powerpc64le-gnu/-/rollup-linux-powerpc64le-gnu-4.18.0.tgz", - "integrity": "sha512-hNVMQK+qrA9Todu9+wqrXOHxFiD5YmdEi3paj6vP02Kx1hjd2LLYR2eaN7DsEshg09+9uzWi2W18MJDlG0cxJA==", + "version": "4.22.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-powerpc64le-gnu/-/rollup-linux-powerpc64le-gnu-4.22.4.tgz", + "integrity": "sha512-3aVCK9xfWW1oGQpTsYJJPF6bfpWfhbRnhdlyhak2ZiyFLDaayz0EP5j9V1RVLAAxlmWKTDfS9wyRyY3hvhPoOg==", "cpu": [ "ppc64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "linux" ] }, "packages/atomic/node_modules/@rollup/rollup-linux-riscv64-gnu": { - "version": "4.18.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.18.0.tgz", - "integrity": "sha512-ROCM7i+m1NfdrsmvwSzoxp9HFtmKGHEqu5NNDiZWQtXLA8S5HBCkVvKAxJ8U+CVctHwV2Gb5VUaK7UAkzhDjlg==", + "version": "4.22.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.22.4.tgz", + "integrity": "sha512-ePYIir6VYnhgv2C5Xe9u+ico4t8sZWXschR6fMgoPUK31yQu7hTEJb7bCqivHECwIClJfKgE7zYsh1qTP3WHUA==", "cpu": [ "riscv64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "linux" ] }, "packages/atomic/node_modules/@rollup/rollup-linux-s390x-gnu": { - "version": "4.18.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.18.0.tgz", - "integrity": "sha512-0UyyRHyDN42QL+NbqevXIIUnKA47A+45WyasO+y2bGJ1mhQrfrtXUpTxCOrfxCR4esV3/RLYyucGVPiUsO8xjg==", + "version": "4.22.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.22.4.tgz", + "integrity": "sha512-GqFJ9wLlbB9daxhVlrTe61vJtEY99/xB3C8e4ULVsVfflcpmR6c8UZXjtkMA6FhNONhj2eA5Tk9uAVw5orEs4Q==", "cpu": [ "s390x" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "linux" ] }, "packages/atomic/node_modules/@rollup/rollup-linux-x64-gnu": { - "version": "4.18.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.18.0.tgz", - "integrity": "sha512-xuglR2rBVHA5UsI8h8UbX4VJ470PtGCf5Vpswh7p2ukaqBGFTnsfzxUBetoWBWymHMxbIG0Cmx7Y9qDZzr648w==", + "version": "4.22.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.22.4.tgz", + "integrity": "sha512-87v0ol2sH9GE3cLQLNEy0K/R0pz1nvg76o8M5nhMR0+Q+BBGLnb35P0fVz4CQxHYXaAOhE8HhlkaZfsdUOlHwg==", "cpu": [ "x64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "linux" ] }, "packages/atomic/node_modules/@rollup/rollup-linux-x64-musl": { - "version": "4.18.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.18.0.tgz", - "integrity": "sha512-LKaqQL9osY/ir2geuLVvRRs+utWUNilzdE90TpyoX0eNqPzWjRm14oMEE+YLve4k/NAqCdPkGYDaDF5Sw+xBfg==", + "version": "4.22.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.22.4.tgz", + "integrity": "sha512-UV6FZMUgePDZrFjrNGIWzDo/vABebuXBhJEqrHxrGiU6HikPy0Z3LfdtciIttEUQfuDdCn8fqh7wiFJjCNwO+g==", "cpu": [ "x64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "linux" ] }, "packages/atomic/node_modules/@rollup/rollup-win32-arm64-msvc": { - "version": "4.18.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.18.0.tgz", - "integrity": "sha512-7J6TkZQFGo9qBKH0pk2cEVSRhJbL6MtfWxth7Y5YmZs57Pi+4x6c2dStAUvaQkHQLnEQv1jzBUW43GvZW8OFqA==", + "version": "4.22.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.22.4.tgz", + "integrity": "sha512-BjI+NVVEGAXjGWYHz/vv0pBqfGoUH0IGZ0cICTn7kB9PyjrATSkX+8WkguNjWoj2qSr1im/+tTGRaY+4/PdcQw==", "cpu": [ "arm64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "win32" ] }, "packages/atomic/node_modules/@rollup/rollup-win32-ia32-msvc": { - "version": "4.18.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.18.0.tgz", - "integrity": "sha512-Txjh+IxBPbkUB9+SXZMpv+b/vnTEtFyfWZgJ6iyCmt2tdx0OF5WhFowLmnh8ENGNpfUlUZkdI//4IEmhwPieNg==", + "version": "4.22.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.22.4.tgz", + "integrity": "sha512-SiWG/1TuUdPvYmzmYnmd3IEifzR61Tragkbx9D3+R8mzQqDBz8v+BvZNDlkiTtI9T15KYZhP0ehn3Dld4n9J5g==", "cpu": [ "ia32" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "win32" ] }, "packages/atomic/node_modules/@rollup/rollup-win32-x64-msvc": { - "version": "4.18.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.18.0.tgz", - "integrity": "sha512-UOo5FdvOL0+eIVTgS4tIdbW+TtnBLWg1YBCcU2KWM7nuNwRz9bksDX1bekJJCpu25N1DVWaCwnT39dVQxzqS8g==", + "version": "4.22.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.22.4.tgz", + "integrity": "sha512-j8pPKp53/lq9lMXN57S8cFz0MynJk8OWNuUnXct/9KCpKU7DgU3bYMJhwWmcqC0UU29p8Lr0/7KEVcaM6bf47Q==", "cpu": [ "x64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "win32" @@ -53725,16 +53905,6 @@ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", "dev": true }, - "packages/atomic/node_modules/core-js": { - "version": "3.37.1", - "resolved": "https://registry.npmjs.org/core-js/-/core-js-3.37.1.tgz", - "integrity": "sha512-Xn6qmxrQZyB0FFY8E3bgRXei3lWDJHhvI+u0q9TKIYM49G8pAr0FgnnrFRAmsbptZL1yxRADVXn+x5AGsbBfyw==", - "hasInstallScript": true, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/core-js" - } - }, "packages/atomic/node_modules/cosmiconfig": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-6.0.0.tgz", @@ -53937,36 +54107,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "packages/atomic/node_modules/i18next": { - "version": "23.12.2", - "resolved": "https://registry.npmjs.org/i18next/-/i18next-23.12.2.tgz", - "integrity": "sha512-XIeh5V+bi8SJSWGL3jqbTEBW5oD6rbP5L+E7dVQh1MNTxxYef0x15rhJVcRb7oiuq4jLtgy2SD8eFlf6P2cmqg==", - "funding": [ - { - "type": "individual", - "url": "https://locize.com" - }, - { - "type": "individual", - "url": "https://locize.com/i18next.html" - }, - { - "type": "individual", - "url": "https://www.i18next.com/how-to/faq#i18next-is-awesome.-how-can-i-support-the-project" - } - ], - "dependencies": { - "@babel/runtime": "^7.23.2" - } - }, - "packages/atomic/node_modules/i18next-http-backend": { - "version": "2.5.2", - "resolved": "https://registry.npmjs.org/i18next-http-backend/-/i18next-http-backend-2.5.2.tgz", - "integrity": "sha512-+K8HbDfrvc1/2X8jpb7RLhI9ZxBDpx3xogYkQwGKlWAUXLSEGXzgdt3EcUjLlBCdMwdQY+K+EUF6oh8oB6rwHw==", - "dependencies": { - "cross-fetch": "4.0.0" - } - }, "packages/atomic/node_modules/js-yaml": { "name": "@zkochan/js-yaml", "version": "0.0.7", @@ -54344,10 +54484,11 @@ } }, "packages/atomic/node_modules/rollup": { - "version": "4.18.0", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.18.0.tgz", - "integrity": "sha512-QmJz14PX3rzbJCN1SG4Xe/bAAX2a6NpCP8ab2vfu2GiUr8AQcr2nCV/oEO3yneFarB67zk8ShlIyWb2LGTb3Sg==", + "version": "4.22.4", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.22.4.tgz", + "integrity": "sha512-vD8HJ5raRcWOyymsR6Z3o6+RzfEPCnVLMFJ6vRslO1jt4LO6dUo5Qnpg7y4RkZFM2DMe3WUirkI5c16onjrc6A==", "dev": true, + "license": "MIT", "dependencies": { "@types/estree": "1.0.5" }, @@ -54359,22 +54500,22 @@ "npm": ">=8.0.0" }, "optionalDependencies": { - "@rollup/rollup-android-arm-eabi": "4.18.0", - "@rollup/rollup-android-arm64": "4.18.0", - "@rollup/rollup-darwin-arm64": "4.18.0", - "@rollup/rollup-darwin-x64": "4.18.0", - "@rollup/rollup-linux-arm-gnueabihf": "4.18.0", - "@rollup/rollup-linux-arm-musleabihf": "4.18.0", - "@rollup/rollup-linux-arm64-gnu": "4.18.0", - "@rollup/rollup-linux-arm64-musl": "4.18.0", - "@rollup/rollup-linux-powerpc64le-gnu": "4.18.0", - "@rollup/rollup-linux-riscv64-gnu": "4.18.0", - "@rollup/rollup-linux-s390x-gnu": "4.18.0", - "@rollup/rollup-linux-x64-gnu": "4.18.0", - "@rollup/rollup-linux-x64-musl": "4.18.0", - "@rollup/rollup-win32-arm64-msvc": "4.18.0", - "@rollup/rollup-win32-ia32-msvc": "4.18.0", - "@rollup/rollup-win32-x64-msvc": "4.18.0", + "@rollup/rollup-android-arm-eabi": "4.22.4", + "@rollup/rollup-android-arm64": "4.22.4", + "@rollup/rollup-darwin-arm64": "4.22.4", + "@rollup/rollup-darwin-x64": "4.22.4", + "@rollup/rollup-linux-arm-gnueabihf": "4.22.4", + "@rollup/rollup-linux-arm-musleabihf": "4.22.4", + "@rollup/rollup-linux-arm64-gnu": "4.22.4", + "@rollup/rollup-linux-arm64-musl": "4.22.4", + "@rollup/rollup-linux-powerpc64le-gnu": "4.22.4", + "@rollup/rollup-linux-riscv64-gnu": "4.22.4", + "@rollup/rollup-linux-s390x-gnu": "4.22.4", + "@rollup/rollup-linux-x64-gnu": "4.22.4", + "@rollup/rollup-linux-x64-musl": "4.22.4", + "@rollup/rollup-win32-arm64-msvc": "4.22.4", + "@rollup/rollup-win32-ia32-msvc": "4.22.4", + "@rollup/rollup-win32-x64-msvc": "4.22.4", "fsevents": "~2.3.2" } }, @@ -54555,11 +54696,6 @@ "streamx": "^2.15.0" } }, - "packages/atomic/node_modules/ts-debounce": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/ts-debounce/-/ts-debounce-4.0.0.tgz", - "integrity": "sha512-+1iDGY6NmOGidq7i7xZGA4cm8DAa6fqdYcvO5Z6yBevH++Bdo9Qt/mN0TzHUgcCcKv1gmh9+W5dHqz8pMWbCbg==" - }, "packages/atomic/node_modules/tsconfig-paths": { "version": "4.2.0", "resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-4.2.0.tgz", @@ -55446,6 +55582,7 @@ "@microsoft/api-extractor": "7.47.3", "@microsoft/api-extractor-model": "7.29.3", "@microsoft/tsdoc": "0.15.0", + "esbuild-plugin-alias-path": "2.0.2", "eslint-plugin-canonical": "4.18.0", "execa": "8.0.1", "install": "0.13.0", @@ -55848,20 +55985,6 @@ "node": ">=8" } }, - "packages/headless/node_modules/@coveo/explorer-messenger": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/@coveo/explorer-messenger/-/explorer-messenger-0.4.0.tgz", - "integrity": "sha512-nVxwn+4Z+SZe6K94evxPaIeJWJq7hATNaUrTKznnauVptFMYcujts/nnhMplddm9ePg7NgZQjvcHwbi5kqw/EA==" - }, - "packages/headless/node_modules/@coveo/relay": { - "version": "0.7.10", - "resolved": "https://registry.npmjs.org/@coveo/relay/-/relay-0.7.10.tgz", - "integrity": "sha512-d/4Vf8wwj746M0RV9xAek7SV/rZhv3ERoQoZo6I2IKAqzMxX8r0Vyrau+UZG1sdxybd6zzo8AVIzvRFHGXxvnA==", - "dependencies": { - "@coveo/explorer-messenger": "^0.4.0", - "uuid": "^9.0.1" - } - }, "packages/headless/node_modules/@coveo/relay-event-types": { "version": "9.2.0", "resolved": "https://registry.npmjs.org/@coveo/relay-event-types/-/relay-event-types-9.2.0.tgz", @@ -55920,30 +56043,6 @@ "resolve": "~1.22.2" } }, - "packages/headless/node_modules/@reduxjs/toolkit": { - "version": "2.2.7", - "resolved": "https://registry.npmjs.org/@reduxjs/toolkit/-/toolkit-2.2.7.tgz", - "integrity": "sha512-faI3cZbSdFb8yv9dhDTmGwclW0vk0z5o1cia+kf7gCbaCwHI5e+7tP57mJUv22pNcNbeA62GSrPpfrUfdXcQ6g==", - "license": "MIT", - "dependencies": { - "immer": "^10.0.3", - "redux": "^5.0.1", - "redux-thunk": "^3.1.0", - "reselect": "^5.1.0" - }, - "peerDependencies": { - "react": "^16.9.0 || ^17.0.0 || ^18", - "react-redux": "^7.2.1 || ^8.1.3 || ^9.0.0" - }, - "peerDependenciesMeta": { - "react": { - "optional": true - }, - "react-redux": { - "optional": true - } - } - }, "packages/headless/node_modules/@rushstack/node-core-library": { "version": "5.5.0", "resolved": "https://registry.npmjs.org/@rushstack/node-core-library/-/node-core-library-5.5.0.tgz", @@ -56209,15 +56308,6 @@ "node": ">=6 <7 || >=8" } }, - "packages/headless/node_modules/immer": { - "version": "10.0.3", - "resolved": "https://registry.npmjs.org/immer/-/immer-10.0.3.tgz", - "integrity": "sha512-pwupu3eWfouuaowscykeckFmVTpqbzW+rXFCX8rQLkZzM9ftBmU/++Ra+o+L27mz03zJTlyV4UUr+fdKNffo4A==", - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/immer" - } - }, "packages/headless/node_modules/jsonfile": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", @@ -56294,24 +56384,6 @@ "node": ">= 14.16" } }, - "packages/headless/node_modules/redux": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/redux/-/redux-5.0.1.tgz", - "integrity": "sha512-M9/ELqF6fy8FwmkpnF0S3YKOqMyoWJ4+CS5Efg2ct3oY9daQvd/Pc71FpGZsVsbl3Cpb+IIcjBDUnnyBdQbq4w==" - }, - "packages/headless/node_modules/redux-thunk": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/redux-thunk/-/redux-thunk-3.1.0.tgz", - "integrity": "sha512-NW2r5T6ksUKXCabzhL9z+h206HQw/NJkcLm1GPImRQ8IzfXwRGqjVhKJGauHirT0DAuyy6hjdnMZaRoAcy0Klw==", - "peerDependencies": { - "redux": "^5.0.0" - } - }, - "packages/headless/node_modules/reselect": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/reselect/-/reselect-5.1.0.tgz", - "integrity": "sha512-aw7jcGLDpSgNDyWBQLv2cedml85qd95/iszJjN988zX1t7AVRJi19d9kto5+W7oCfQ94gyo40dVbT6g2k4/kXg==" - }, "packages/headless/node_modules/semver": { "version": "7.5.4", "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", @@ -56351,11 +56423,6 @@ "node": ">=14.0.0" } }, - "packages/headless/node_modules/ts-debounce": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/ts-debounce/-/ts-debounce-4.0.0.tgz", - "integrity": "sha512-+1iDGY6NmOGidq7i7xZGA4cm8DAa6fqdYcvO5Z6yBevH++Bdo9Qt/mN0TzHUgcCcKv1gmh9+W5dHqz8pMWbCbg==" - }, "packages/headless/node_modules/typescript": { "version": "5.4.2", "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.4.2.tgz", @@ -56378,18 +56445,6 @@ "node": ">= 4.0.0" } }, - "packages/headless/node_modules/uuid": { - "version": "9.0.1", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.1.tgz", - "integrity": "sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA==", - "funding": [ - "https://github.com/sponsors/broofa", - "https://github.com/sponsors/ctavan" - ], - "bin": { - "uuid": "dist/bin/uuid" - } - }, "packages/headless/node_modules/vite-node": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/vite-node/-/vite-node-2.1.1.tgz", @@ -62131,6 +62186,7 @@ "version": "0.0.0", "dependencies": { "@coveo/atomic": "3.1.1", + "@coveo/bueno": "1.0.0", "@coveo/headless": "3.0.0", "@stencil/core": "4.20.0", "stencil-router-v2": "0.6.0" diff --git a/packages/atomic-react/rollup.config.mjs b/packages/atomic-react/rollup.config.mjs index c525b9a58bd..cc4e9596f95 100644 --- a/packages/atomic-react/rollup.config.mjs +++ b/packages/atomic-react/rollup.config.mjs @@ -52,9 +52,6 @@ const packageMappings = { '@coveo/headless/insight': { cdn: `/headless/${headlessVersion}/insight/headless.esm.js`, }, - '@coveo/headless/product-recommendation': { - cdn: `/headless/${headlessVersion}/product-recommendation/headless.esm.js`, - }, '@coveo/headless/recommendation': { cdn: `/headless/${headlessVersion}/recommendation/headless.esm.js`, }, diff --git a/packages/atomic/.storybook/main.mts b/packages/atomic/.storybook/main.mts index e0c55e0ca9c..91c3af17e60 100644 --- a/packages/atomic/.storybook/main.mts +++ b/packages/atomic/.storybook/main.mts @@ -1,9 +1,37 @@ import {nxViteTsPaths} from '@nx/vite/plugins/nx-tsconfig-paths.plugin'; import type {StorybookConfig} from '@storybook/web-components-vite'; -import path from 'node:path'; +import path from 'path'; +import {PluginImpl} from 'rollup'; import {mergeConfig} from 'vite'; -import headlessJson from '../../../packages/headless/package.json'; +import {generateExternalPackageMappings} from '../scripts/externalPackageMappings'; +const externalizeDependencies: PluginImpl = () => { + return { + name: 'externalize-dependencies', + enforce: 'pre', + resolveId(source, _importer, _options) { + if (/^\/(headless|bueno)/.test(source)) { + return false; + } + + const packageMappings = generateExternalPackageMappings(__dirname); + const packageMapping = packageMappings[source]; + + if (packageMapping) { + if (!isCDN) { + return false; + } + + return { + id: packageMapping.cdn, + external: 'absolute', + }; + } + + return null; + }, + }; +}; const isCDN = process.env.DEPLOYMENT_ENVIRONMENT === 'CDN'; const config: StorybookConfig = { @@ -33,10 +61,10 @@ const config: StorybookConfig = { }), }; -function resolveStorybookUtils() { +const resolveStorybookUtils: PluginImpl = () => { return { name: 'resolve-storybook-utils', - async resolveId(source: string, importer: unknown, options: unknown) { + async resolveId(source: string, importer, options) { if (source.startsWith('@coveo/atomic-storybook-utils')) { return this.resolve( source.replace( @@ -49,84 +77,6 @@ function resolveStorybookUtils() { } }, }; -} - -function externalizeDependencies() { - return { - name: 'externalize-dependencies', - enforce: 'pre', - resolveId: (id: string) => { - if (id.startsWith('/headless')) { - return false; - } - if (packageMappings[id]) { - if (!isCDN) { - return false; - } - - return { - id: packageMappings[id].cdn, - external: 'absolute', - }; - } - }, - }; -} - -let headlessVersion: string; -if (isCDN) { - console.log('Building for CDN'); - headlessVersion = 'v' + headlessJson.version; -} - -const packageMappings: {[key: string]: {devWatch: string; cdn: string}} = { - '@coveo/headless/commerce': { - devWatch: path.resolve( - __dirname, - '../src/external-builds/commerce/headless.esm.js' - ), - cdn: `/headless/${headlessVersion}/commerce/headless.esm.js`, - }, - '@coveo/headless/insight': { - devWatch: path.resolve( - __dirname, - '../src/external-builds/insight/headless.esm.js' - ), - cdn: `/headless/${headlessVersion}/insight/headless.esm.js`, - }, - '@coveo/headless/product-recommendation': { - devWatch: path.resolve( - __dirname, - '../src/external-builds/product-recommendation/headless.esm.js' - ), - cdn: `/headless/${headlessVersion}/product-recommendation/headless.esm.js`, - }, - '@coveo/headless/recommendation': { - devWatch: path.resolve( - __dirname, - '../src/external-builds/recommendation/headless.esm.js' - ), - cdn: `/headless/${headlessVersion}/recommendation/headless.esm.js`, - }, - '@coveo/headless/case-assist': { - devWatch: path.resolve( - __dirname, - '../src/external-builds/case-assist/headless.esm.js' - ), - cdn: `/headless/${headlessVersion}/case-assist/headless.esm.js`, - }, - '@coveo/headless': { - devWatch: path.resolve(__dirname, '../src/external-builds/headless.esm.js'), - cdn: `/headless/${headlessVersion}/headless.esm.js`, - }, - /* '@coveo/bueno': { - devWatch: path.resolve(__dirname, './src/external-builds/bueno.esm.js'), - cdn: `/bueno/${headlessVersion}/bueno.esm.js`, - }, */ }; export default config; - -// To customize your Vite configuration you can use the viteFinal field. -// Check https://storybook.js.org/docs/react/builders/vite#configuration -// and https://nx.dev/recipes/storybook/custom-builder-configs diff --git a/packages/atomic/package.json b/packages/atomic/package.json index 349dc6a9229..6c5de70493c 100644 --- a/packages/atomic/package.json +++ b/packages/atomic/package.json @@ -43,7 +43,7 @@ "loader/" ], "scripts": { - "clean": "rimraf -rf dist/*", + "clean": "rimraf -rf dist/* dist-storybook/* www/* docs/* loader/* playwright-report/*", "build": "nx build", "build:locales": "npx nx build:locales atomic", "start": "nx dev atomic", @@ -148,6 +148,7 @@ "postcss-nested": "6.2.0", "puppeteer": "22.14.0", "react": "18.3.1", + "rollup": "4.22.4", "rollup-plugin-html": "0.2.1", "shadow-dom-testing-library": "1.11.2", "storybook": "8.1.2", @@ -160,6 +161,7 @@ "wait-on": "7.2.0" }, "peerDependencies": { + "@coveo/bueno": "1.0.0", "@coveo/headless": "3.0.0" }, "license": "Apache-2.0", diff --git a/packages/atomic/project.json b/packages/atomic/project.json index ade80b95fca..1b1eb78f69a 100644 --- a/packages/atomic/project.json +++ b/packages/atomic/project.json @@ -117,9 +117,16 @@ "command": "wait-on dist/atomic" } }, + "wait-on:stencil-ping": { + "executor": "nx:run-commands", + "options": { + "cwd": "{projectRoot}", + "command": "wait-on http://localhost:3333/ping" + } + }, "storybook": { "executor": "nx:run-commands", - "dependsOn": ["wait-on:dist"], + "dependsOn": ["wait-on:stencil-ping"], "options": { "cwd": "{projectRoot}", "command": "npx storybook dev -p 4400" diff --git a/packages/atomic/scripts/externalPackageMappings.ts b/packages/atomic/scripts/externalPackageMappings.ts new file mode 100644 index 00000000000..23249b55312 --- /dev/null +++ b/packages/atomic/scripts/externalPackageMappings.ts @@ -0,0 +1,49 @@ +import path from 'node:path'; +import headlessJson from '../../headless/package.json'; +import buenoJson from '../../headless/package.json'; + +const headlessVersion = 'v' + headlessJson.version; +const buenoVersion = 'v' + buenoJson.version; + +export function generateExternalPackageMappings(basePath: string): { + [key: string]: {devWatch: string; cdn: string}; +} { + return { + '@coveo/headless/commerce': { + devWatch: path.resolve( + basePath, + 'src/external-builds/commerce/headless.esm.js' + ), + cdn: `/headless/${headlessVersion}/commerce/headless.esm.js`, + }, + '@coveo/headless/insight': { + devWatch: path.resolve( + basePath, + 'src/external-builds/insight/headless.esm.js' + ), + cdn: `/headless/${headlessVersion}/insight/headless.esm.js`, + }, + '@coveo/headless/recommendation': { + devWatch: path.resolve( + basePath, + 'src/external-builds/recommendation/headless.esm.js' + ), + cdn: `/headless/${headlessVersion}/recommendation/headless.esm.js`, + }, + '@coveo/headless/case-assist': { + devWatch: path.resolve( + basePath, + 'src/external-builds/case-assist/headless.esm.js' + ), + cdn: `/headless/${headlessVersion}/case-assist/headless.esm.js`, + }, + '@coveo/headless': { + devWatch: path.resolve(basePath, 'src/external-builds/headless.esm.js'), + cdn: `/headless/${headlessVersion}/headless.esm.js`, + }, + '@coveo/bueno': { + devWatch: path.resolve(basePath, 'src/external-builds/bueno.esm.js'), + cdn: `/bueno/${buenoVersion}/bueno.esm.js`, + }, + }; +} diff --git a/packages/atomic/stencil.config.ts b/packages/atomic/stencil.config.ts index b8301d1a236..023d65d79bc 100644 --- a/packages/atomic/stencil.config.ts +++ b/packages/atomic/stencil.config.ts @@ -6,73 +6,23 @@ import {Config} from '@stencil/core'; import {reactOutputTarget as react} from '@stencil/react-output-target'; import autoprefixer from 'autoprefixer'; import {readFileSync, readdirSync} from 'fs'; -import path from 'path'; import focusVisible from 'postcss-focus-visible'; import atImport from 'postcss-import'; import postcssMap from 'postcss-map'; import mixins from 'postcss-mixins'; import postcssNesting from 'postcss-nested'; +import {PluginImpl} from 'rollup'; import html from 'rollup-plugin-html'; import {inlineSvg} from 'stencil-inline-svg'; import tailwind from 'tailwindcss'; import tailwindNesting from 'tailwindcss/nesting'; -import headlessJson from '../../packages/headless/package.json'; +import {generateExternalPackageMappings} from './scripts/externalPackageMappings'; import {generateAngularModuleDefinition as angularModule} from './stencil-plugin/atomic-angular-module'; const isProduction = process.env.BUILD === 'production'; const isCDN = process.env.DEPLOYMENT_ENVIRONMENT === 'CDN'; -let headlessVersion: string = ''; -if (isCDN) { - console.log('Building for CDN'); - headlessVersion = 'v' + headlessJson.version; -} - -const packageMappings: {[key: string]: {devWatch: string; cdn: string}} = { - '@coveo/headless/commerce': { - devWatch: path.resolve( - __dirname, - './src/external-builds/commerce/headless.esm.js' - ), - cdn: `/headless/${headlessVersion}/commerce/headless.esm.js`, - }, - '@coveo/headless/insight': { - devWatch: path.resolve( - __dirname, - './src/external-builds/insight/headless.esm.js' - ), - cdn: `/headless/${headlessVersion}/insight/headless.esm.js`, - }, - '@coveo/headless/product-recommendation': { - devWatch: path.resolve( - __dirname, - './src/external-builds/product-recommendation/headless.esm.js' - ), - cdn: `/headless/${headlessVersion}/product-recommendation/headless.esm.js`, - }, - '@coveo/headless/recommendation': { - devWatch: path.resolve( - __dirname, - './src/external-builds/recommendation/headless.esm.js' - ), - cdn: `/headless/${headlessVersion}/recommendation/headless.esm.js`, - }, - '@coveo/headless/case-assist': { - devWatch: path.resolve( - __dirname, - './src/external-builds/case-assist/headless.esm.js' - ), - cdn: `/headless/${headlessVersion}/case-assist/headless.esm.js`, - }, - '@coveo/headless': { - devWatch: path.resolve(__dirname, './src/external-builds/headless.esm.js'), - cdn: `/headless/${headlessVersion}/headless.esm.js`, - }, - /* '@coveo/bueno': { - devWatch: path.resolve(__dirname, './src/external-builds/bueno.esm.js'), - cdn: `/bueno/${buenoVersion}/bueno.esm.js`, - }, */ -}; +const packageMappings = generateExternalPackageMappings(__dirname); function generateAliasEntries() { return Object.entries(packageMappings).map(([find, paths]) => ({ @@ -125,6 +75,28 @@ function replace() { }); } +const externalizeDependenciesPlugin: PluginImpl = () => { + return { + name: 'externalize-dependencies', + resolveId: (source, _importer, _options) => { + const packageMapping = packageMappings[source]; + + if (packageMapping) { + if (!isCDN) { + return false; + } + + return { + id: packageMapping.cdn, + external: 'absolute', + }; + } + + return null; + }, + }; +}; + const isDevWatch: boolean = process.argv && process.argv.indexOf('--dev') > -1 && @@ -261,22 +233,3 @@ export const config: Config = { enableImportInjection: true, }, }; -function externalizeDependenciesPlugin() { - return { - name: 'externalize-dependencies', - resolveId(source: string) { - if (packageMappings[source]) { - if (!isCDN) { - return false; - } - - return { - id: packageMappings[source].cdn, - external: 'absolute', - }; - } - - return null; - }, - }; -} diff --git a/packages/atomic/tsconfig.storybook.json b/packages/atomic/tsconfig.storybook.json index 30d5ba207d2..204c4760d5b 100644 --- a/packages/atomic/tsconfig.storybook.json +++ b/packages/atomic/tsconfig.storybook.json @@ -21,6 +21,7 @@ ".storybook/*.tsx", ".storybook/*.jsx", ".storybook/register.tsx", - ".storybook/main.mts" + ".storybook/main.mts", + "scripts/externalPackageMappings.ts" ] } diff --git a/packages/bueno/esbuild.mjs b/packages/bueno/esbuild.mjs index 92a53cbe190..7ec5d636e38 100644 --- a/packages/bueno/esbuild.mjs +++ b/packages/bueno/esbuild.mjs @@ -44,6 +44,28 @@ function browserEsm() { }); } +function browserEsmForAtomicDevelopment() { + const buildAtomic = build({ + ...base, + platform: 'browser', + outfile: '../atomic/src/external-builds/bueno.esm.js', + format: 'esm', + watch: devMode, + minify: false, + }); + + const buildHeadless = build({ + ...base, + platform: 'browser', + outfile: '../headless/src/external-builds/bueno.esm.js', + format: 'esm', + watch: devMode, + minify: false, + }); + + return Promise.all([buildAtomic, buildHeadless]); +} + function browserUmd() { return build({ ...base, @@ -58,7 +80,13 @@ function browserUmd() { } async function main() { - await Promise.all([nodeCjs(), nodeEsm(), browserEsm(), browserUmd()]); + await Promise.all([ + nodeCjs(), + nodeEsm(), + browserEsm(), + browserUmd(), + browserEsmForAtomicDevelopment(), + ]); } main(); diff --git a/packages/bueno/project.json b/packages/bueno/project.json index d3cec81afb3..17a91046d3a 100644 --- a/packages/bueno/project.json +++ b/packages/bueno/project.json @@ -1,10 +1,22 @@ { "name": "bueno", "$schema": "../../node_modules/nx/schemas/project-schema.json", + "namedInputs": { + "negativeBuildOutputs": [ + "!{projectRoot}/dist", + "!{workspaceRoot}/packages/atomic/src/external-builds", + "!{workspaceRoot}/packages/headless/src/external-builds" + ] + }, "targets": { "release:phase1": {}, "cached:build": { "executor": "nx:run-commands", + "outputs": [ + "{projectRoot}/dist", + "{workspaceRoot}/packages/atomic/src/external-builds", + "{workspaceRoot}/packages/headless/src/external-builds" + ], "options": { "commands": ["npm run build:bundles", "npm run build:definitions"], "parallel": true, diff --git a/packages/headless/.eslintrc.cjs b/packages/headless/.eslintrc.cjs index 15709cc26ff..549e9ce930a 100644 --- a/packages/headless/.eslintrc.cjs +++ b/packages/headless/.eslintrc.cjs @@ -1,7 +1,7 @@ const {resolve} = require('path'); module.exports = { - ignorePatterns: ['dist', 'temp', 'ponyfills'], + ignorePatterns: ['dist', 'temp', 'ponyfills', 'src/external-builds/**/*'], plugins: ['canonical'], settings: { 'import/parsers': { @@ -13,6 +13,7 @@ module.exports = { }, }, }, + rules: { '@typescript-eslint/no-namespace': 'off', curly: ['error'], diff --git a/packages/headless/.gitignore b/packages/headless/.gitignore index a38284ed80e..a1fe693e0be 100644 --- a/packages/headless/.gitignore +++ b/packages/headless/.gitignore @@ -1,3 +1,5 @@ docs/js temp/ -doc-parser/build \ No newline at end of file +doc-parser/build + +src/external-builds diff --git a/packages/headless/esbuild.mjs b/packages/headless/esbuild.mjs index 87e99e222a0..02aebffff76 100644 --- a/packages/headless/esbuild.mjs +++ b/packages/headless/esbuild.mjs @@ -1,14 +1,17 @@ import alias from 'esbuild-plugin-alias'; +import {aliasPath} from 'esbuild-plugin-alias-path'; import {umdWrapper} from 'esbuild-plugin-umd-wrapper'; -import {readFileSync, promises, writeFileSync} from 'node:fs'; +import {readFileSync, writeFileSync} from 'node:fs'; import {createRequire} from 'node:module'; -import {dirname, resolve} from 'node:path'; +import path, {dirname, resolve} from 'node:path'; import {build} from '../../scripts/esbuild/build.mjs'; import {apacheLicense} from '../../scripts/license/apache.mjs'; const require = createRequire(import.meta.url); const devMode = process.argv[2] === 'dev'; +const __dirname = dirname(new URL(import.meta.url).pathname); + const useCaseEntries = { search: 'src/index.ts', recommendation: 'src/recommendation.index.ts', @@ -85,6 +88,16 @@ const browserEsmForAtomicDevelopment = Object.entries(useCaseEntries).map( format: 'esm', watch: devMode, minify: false, + plugins: [ + aliasPath({ + alias: { + '@coveo/bueno': path.resolve( + __dirname, + './src/external-builds/bueno.esm.js' + ), + }, + }), + ], }, outDir ); @@ -150,6 +163,7 @@ const quanticUmd = Object.entries(quanticUseCaseEntries).map((entry) => { banner: { js: `${base.banner.js}`, }, + external: ['crypto'], inject: [ 'ponyfills/abortable-fetch-shim.js', '../../node_modules/navigator.sendbeacon/dist/navigator.sendbeacon.cjs.js', @@ -192,7 +206,7 @@ async function buildBrowserConfig(options, outDir) { minify: true, sourcemap: true, metafile: true, - external: ['crypto'], + external: ['crypto', '@coveo/bueno'], ...options, plugins: [ alias({ diff --git a/packages/headless/package.json b/packages/headless/package.json index fa55569209d..319e3b3ea22 100644 --- a/packages/headless/package.json +++ b/packages/headless/package.json @@ -164,6 +164,7 @@ "@microsoft/api-extractor": "7.47.3", "@microsoft/api-extractor-model": "7.29.3", "@microsoft/tsdoc": "0.15.0", + "esbuild-plugin-alias-path": "2.0.2", "eslint-plugin-canonical": "4.18.0", "execa": "8.0.1", "install": "0.13.0", diff --git a/packages/samples/stencil/package.json b/packages/samples/stencil/package.json index 3a0de87cc49..2d427d1bd3d 100644 --- a/packages/samples/stencil/package.json +++ b/packages/samples/stencil/package.json @@ -9,6 +9,7 @@ }, "dependencies": { "@coveo/atomic": "3.1.1", + "@coveo/bueno": "1.0.0", "@coveo/headless": "3.0.0", "@stencil/core": "4.20.0", "stencil-router-v2": "0.6.0"