diff --git a/.gitignore b/.gitignore index 382f7d9..f307df2 100644 --- a/.gitignore +++ b/.gitignore @@ -7,6 +7,7 @@ node_modules/ # tests /coverage +/bench # IDEs .vscode/ diff --git a/package.json b/package.json index 40d0fa8..0f65627 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "colord", - "version": "0.9.0", + "version": "0.9.1", "description": "👑 A tiny yet powerful tool for high-performance color manipulations and conversions", "keywords": [ "color", @@ -19,22 +19,23 @@ "author": "Vlad Shilov ", "license": "MIT", "sideEffects": false, - "type": "module", - "module": "./index.js", - "main": "./index.cjs", + "main": "./index.js", + "module": "./index.mjs", "exports": { ".": { - "import": "./index.js", - "require": "./index.cjs" + "import": "./index.mjs", + "require": "./index.js", + "default": "./index.mjs" }, "./plugins/*": { - "import": "./plugins/*.js", - "require": "./plugins/*.cjs" + "import": "./plugins/*.mjs", + "require": "./plugins/*.js", + "default": "./plugins/*.mjs" } }, "files": [ - "*.{js,cjs,ts,map}", - "plugins/*.{js,cjs,ts,map}" + "*.{js,mjs,ts,map}", + "plugins/*.{js,mjs,ts,map}" ], "types": "index.d.ts", "scripts": { @@ -42,7 +43,7 @@ "size": "npm run build && size-limit", "check-types": "tsc --noEmit true", "test": "jest tests --coverage", - "benchmark": "node --experimental-specifier-resolution node --loader ts-node/esm ./tests/benchmark.ts", + "benchmark": "tsc --outDir bench --skipLibCheck --esModuleInterop ./tests/benchmark.ts && node ./bench/tests/benchmark.js && rm -rf ./bench", "build": "rm -rf ./dist/* && rollup --config", "release": "npm run build && cp *.json dist && cp *.md dist && npm publish dist", "check-release": "npm run release -- --dry-run" @@ -96,20 +97,20 @@ }, "size-limit": [ { - "path": "dist/index.js", + "path": "dist/index.mjs", "import": "{ colord }", "limit": "2 KB" }, { - "path": "dist/plugins/a11y.js", + "path": "dist/plugins/a11y.mjs", "limit": "0.5 KB" }, { - "path": "dist/plugins/names.js", + "path": "dist/plugins/names.mjs", "limit": "1.5 KB" }, { - "path": "dist/plugins/xyz.js", + "path": "dist/plugins/xyz.mjs", "limit": "1 KB" } ] diff --git a/rollup.config.js b/rollup.config.js index fb4838a..aeef461 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -28,7 +28,7 @@ export default [ { input: "src/index.ts", output: { - file: "dist/index.js", + file: "dist/index.mjs", format: "es", }, plugins: getRollupPluginsConfig({ declaration: true }), @@ -36,7 +36,7 @@ export default [ { input: "src/index.ts", output: { - file: "dist/index.cjs", + file: "dist/index.js", format: "cjs", }, plugins: getRollupPluginsConfig({ declaration: false }), @@ -46,7 +46,7 @@ export default [ ...colordPluginPaths.map((input) => ({ input, output: { - file: `dist/plugins/${path.parse(input).name}.js`, + file: `dist/plugins/${path.parse(input).name}.mjs`, format: "es", }, plugins: getRollupPluginsConfig({ declaration: false }), @@ -56,7 +56,7 @@ export default [ ...colordPluginPaths.map((input) => ({ input, output: { - file: `dist/plugins/${path.parse(input).name}.cjs`, + file: `dist/plugins/${path.parse(input).name}.js`, format: "cjs", exports: "default", },