diff --git a/.babelrc.js b/.babelrc.js index 5055eab..38569a7 100644 --- a/.babelrc.js +++ b/.babelrc.js @@ -6,10 +6,9 @@ module.exports = { loose: true, modules: false, targets: { - node: 6, + node: 18, }, }, ], ], - plugins: ['@babel/transform-modules-commonjs'], } diff --git a/.gitignore b/.gitignore index 491fc35..f06235c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,2 @@ node_modules -lib +dist diff --git a/package.json b/package.json index b836e3a..0185cab 100644 --- a/package.json +++ b/package.json @@ -4,9 +4,25 @@ "description": "Babel plugin for annotating automatically pure function calls.", "author": "Mateusz BurzyƄski (https://github.com/Andarist)", "license": "MIT", - "main": "lib/index.js", + "engines": { + "node": ">=18" + }, + "main": "dist/babel-plugin-annotate-pure-calls.cjs.js", + "module": "dist/babel-plugin-annotate-pure-calls.esm.js", + "exports": { + ".": { + "types": { + "import": "./dist/babel-plugin-annotate-pure-calls.cjs.mjs", + "default": "./dist/babel-plugin-annotate-pure-calls.cjs.js" + }, + "module": "./dist/babel-plugin-annotate-pure-calls.esm.js", + "import": "./dist/babel-plugin-annotate-pure-calls.cjs.mjs", + "default": "./dist/babel-plugin-annotate-pure-calls.cjs.js" + }, + "./package.json": "./package.json" + }, "files": [ - "lib" + "dist" ], "repository": { "type": "git", @@ -23,7 +39,6 @@ "url": "https://github.com/Andarist/babel-plugin-annotate-pure-calls/issues" }, "homepage": "https://github.com/Andarist/babel-plugin-annotate-pure-calls#readme", - "dependencies": {}, "peerDependencies": { "@babel/core": "^7.0.0" }, @@ -32,6 +47,7 @@ "@babel/core": "^7.1.0", "@babel/plugin-transform-modules-commonjs": "^7.1.0", "@babel/preset-env": "^7.1.0", + "@preconstruct/cli": "^2.8.10", "babel-plugin-tester": "^5.4.0", "husky": "^0.14.3", "jest": "^23.1.0", @@ -39,7 +55,7 @@ "prettier": "^1.13.5" }, "scripts": { - "build": "babel src --out-dir lib", + "build": "preconstruct build", "pretest": "npm run build", "test": "jest", "precommit": "lint-staged", @@ -56,5 +72,13 @@ "semi": false, "trailingComma": "all", "proseWrap": "always" + }, + "preconstruct": { + "exports": { + "importConditionDefaultExport": "default" + }, + "___experimentalFlags_WILL_CHANGE_IN_PATCH": { + "importsConditions": true + } } }