Skip to content

Commit

Permalink
Widely supported exports
Browse files Browse the repository at this point in the history
  • Loading branch information
omgovich committed Apr 8, 2021
1 parent 0afd1db commit 14ccdc4
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 19 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ node_modules/

# tests
/coverage
/bench

# IDEs
.vscode/
Expand Down
31 changes: 16 additions & 15 deletions package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand All @@ -19,30 +19,31 @@
"author": "Vlad Shilov <[email protected]>",
"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": {
"lint": "eslint src/**/*.ts",
"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"
Expand Down Expand Up @@ -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"
}
]
Expand Down
8 changes: 4 additions & 4 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@ export default [
{
input: "src/index.ts",
output: {
file: "dist/index.js",
file: "dist/index.mjs",
format: "es",
},
plugins: getRollupPluginsConfig({ declaration: true }),
},
{
input: "src/index.ts",
output: {
file: "dist/index.cjs",
file: "dist/index.js",
format: "cjs",
},
plugins: getRollupPluginsConfig({ declaration: false }),
Expand All @@ -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 }),
Expand All @@ -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",
},
Expand Down

0 comments on commit 14ccdc4

Please sign in to comment.