diff --git a/.eslintignore b/.eslintignore index bb1f6ec8..4fb0a33f 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1,7 +1,7 @@ typings.d.ts package.json playwright.config.ts -rollup.config.js +rollup.config.* .eslintrc.cjs *.test.ts *.test.tsx diff --git a/package-lock.json b/package-lock.json index 8a9417f2..e9648912 100644 --- a/package-lock.json +++ b/package-lock.json @@ -24,7 +24,6 @@ "@commitlint/config-conventional": "^19.0.3", "@playwright/test": "^1.48.2", "@rollup/plugin-node-resolve": "^15.3.0", - "@rollup/plugin-terser": "^0.4.4", "@rollup/plugin-typescript": "^12.1.0", "@semantic-release/changelog": "^6.0.3", "@semantic-release/commit-analyzer": "^13.0.0", @@ -64,6 +63,7 @@ "prettier-plugin-tailwindcss": "^0.6.8", "release-it": "^17.6.0", "rollup": "^4.23.0", + "rollup-plugin-esbuild": "^6.1.1", "rollup-plugin-filesize": "^10.0.0", "rollup-plugin-sourcemaps": "^0.6.3", "semantic-release": "^24.1.0", @@ -4516,29 +4516,6 @@ } } }, - "node_modules/@rollup/plugin-terser": { - "version": "0.4.4", - "resolved": "https://registry.npmjs.org/@rollup/plugin-terser/-/plugin-terser-0.4.4.tgz", - "integrity": "sha512-XHeJC5Bgvs8LfukDwWZp7yeqin6ns8RTl2B9avbejt6tZqsqvVoWI7ZTQrcNsfKEDWBTnTxM8nMDkO2IFFbd0A==", - "dev": true, - "license": "MIT", - "dependencies": { - "serialize-javascript": "^6.0.1", - "smob": "^1.0.0", - "terser": "^5.17.4" - }, - "engines": { - "node": ">=14.0.0" - }, - "peerDependencies": { - "rollup": "^2.0.0||^3.0.0||^4.0.0" - }, - "peerDependenciesMeta": { - "rollup": { - "optional": true - } - } - }, "node_modules/@rollup/plugin-typescript": { "version": "12.1.1", "resolved": "https://registry.npmjs.org/@rollup/plugin-typescript/-/plugin-typescript-12.1.1.tgz", @@ -24207,16 +24184,6 @@ "node": ">=8" } }, - "node_modules/randombytes": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", - "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "safe-buffer": "^5.1.0" - } - }, "node_modules/rc": { "version": "1.2.8", "resolved": "https://registry.npmjs.org/rc/-/rc-1.2.8.tgz", @@ -25791,6 +25758,26 @@ "fsevents": "~2.3.2" } }, + "node_modules/rollup-plugin-esbuild": { + "version": "6.1.1", + "resolved": "https://registry.npmjs.org/rollup-plugin-esbuild/-/rollup-plugin-esbuild-6.1.1.tgz", + "integrity": "sha512-CehMY9FAqJD5OUaE/Mi1r5z0kNeYxItmRO2zG4Qnv2qWKF09J2lTy5GUzjJR354ZPrLkCj4fiBN41lo8PzBUhw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@rollup/pluginutils": "^5.0.5", + "debug": "^4.3.4", + "es-module-lexer": "^1.3.1", + "get-tsconfig": "^4.7.2" + }, + "engines": { + "node": ">=14.18.0" + }, + "peerDependencies": { + "esbuild": ">=0.18.0", + "rollup": "^1.20.0 || ^2.0.0 || ^3.0.0 || ^4.0.0" + } + }, "node_modules/rollup-plugin-filesize": { "version": "10.0.0", "resolved": "https://registry.npmjs.org/rollup-plugin-filesize/-/rollup-plugin-filesize-10.0.0.tgz", @@ -26448,16 +26435,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/serialize-javascript": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.2.tgz", - "integrity": "sha512-Saa1xPByTTq2gdeFZYLLo+RFE35NHZkAbqZeWNd3BpzppeVisAqpDjcp8dyf6uIvEqJRd46jemmyA4iFIeVk8g==", - "dev": true, - "license": "BSD-3-Clause", - "dependencies": { - "randombytes": "^2.1.0" - } - }, "node_modules/server-only": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/server-only/-/server-only-0.0.1.tgz", @@ -26988,13 +26965,6 @@ "npm": ">= 3.0.0" } }, - "node_modules/smob": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/smob/-/smob-1.5.0.tgz", - "integrity": "sha512-g6T+p7QO8npa+/hNx9ohv1E5pVCmWrVCUzUXJyLdMmftX6ER0oiWY/w9knEonLpnOp6b6FenKnMfR8gqwWdwig==", - "dev": true, - "license": "MIT" - }, "node_modules/socks": { "version": "2.8.3", "resolved": "https://registry.npmjs.org/socks/-/socks-2.8.3.tgz", diff --git a/package.json b/package.json index 2f713042..0e4ed33c 100644 --- a/package.json +++ b/package.json @@ -162,7 +162,7 @@ "command": "npm run dev:nextjs14" }, "dev:lib": { - "command": "cross-env IS_DEVELOPMENT=true rollup -c rollup.config.js --bundleConfigAsCjs -w", + "command": "cross-env IS_DEVELOPMENT=true rollup -c rollup.config.mjs -w", "service": { "readyWhen": { "lineMatches": "created " @@ -287,7 +287,7 @@ "command": "cd packages/example-react && npm run build" }, "build": { - "command": "rollup -c rollup.config.js --bundleConfigAsCjs", + "command": "rollup -c rollup.config.mjs", "dependencies": [ "rmdist" ] @@ -336,7 +336,6 @@ "@commitlint/config-conventional": "^19.0.3", "@playwright/test": "^1.48.2", "@rollup/plugin-node-resolve": "^15.3.0", - "@rollup/plugin-terser": "^0.4.4", "@rollup/plugin-typescript": "^12.1.0", "@semantic-release/changelog": "^6.0.3", "@semantic-release/commit-analyzer": "^13.0.0", @@ -376,6 +375,7 @@ "prettier-plugin-tailwindcss": "^0.6.8", "release-it": "^17.6.0", "rollup": "^4.23.0", + "rollup-plugin-esbuild": "^6.1.1", "rollup-plugin-filesize": "^10.0.0", "rollup-plugin-sourcemaps": "^0.6.3", "semantic-release": "^24.1.0", diff --git a/rollup.config.js b/rollup.config.mjs similarity index 82% rename from rollup.config.js rename to rollup.config.mjs index c9e26492..a42e8e82 100644 --- a/rollup.config.js +++ b/rollup.config.mjs @@ -1,10 +1,10 @@ import resolve from '@rollup/plugin-node-resolve'; -import terser from '@rollup/plugin-terser'; +import esbuild from 'rollup-plugin-esbuild' import sourcemaps from 'rollup-plugin-sourcemaps'; import typescript from '@rollup/plugin-typescript'; import filesize from 'rollup-plugin-filesize'; import { glob } from 'glob' -import config from './tsconfig.json' +import config from './tsconfig.json' assert { type: "json" }; const isProduction = !process.env.IS_DEVELOPMENT; const sourcemap = !isProduction; @@ -25,7 +25,11 @@ const plugins = [ !isProduction && sourcemaps(), - isProduction && terser({ ecma: '2022' }), + esbuild({ + sourceMap: !isProduction, // default + minify: isProduction, + target: 'es2023', // default, or 'es20XX', 'esnext' + }), filesize(), ].filter(Boolean);