Skip to content

Commit b55adcb

Browse files
committed
chore: convert source to CommonJs and publish source directly
Allow us to work on the code as it's going to run instead of the hybrid ConnonJS-ESM format that cannot run anywhere natively. `babel-plugin-add-module-exports` always overwrote module.exports, so the module.exports.default that Babel created was not visible to consumers. I've tested importing the code from CommonJS and native ESM.
1 parent d491fba commit b55adcb

File tree

17 files changed

+67
-1061
lines changed

17 files changed

+67
-1061
lines changed

.babelrc

Lines changed: 0 additions & 7 deletions
This file was deleted.

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
node_modules
22
test/fixtures/*.actual.css
3-
dist
3+
src/parser.js
44
yarn-error.log

package.json

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,43 +9,41 @@
99
"calculation",
1010
"calc"
1111
],
12-
"main": "dist/index.js",
12+
"main": "src/index.js",
1313
"types": "types/index.d.ts",
1414
"files": [
15-
"dist",
15+
"src",
1616
"types",
1717
"LICENSE"
1818
],
1919
"scripts": {
2020
"prepare": "pnpm run build && tsc",
21-
"build": "rimraf dist && babel src --out-dir dist --ignore src/__tests__/**/*.js && jison src/parser.jison -o dist/parser.js",
21+
"build": "jison src/parser.jison -o src/parser.js",
2222
"lint": "eslint src && tsc",
2323
"pretest": "pnpm run build",
24-
"test": "uvu -r @babel/register src/__tests__"
24+
"test": "uvu src/__tests__"
2525
},
2626
"author": "Andy Jansson",
2727
"license": "MIT",
2828
"repository": "https://github.com/postcss/postcss-calc.git",
2929
"eslintConfig": {
3030
"extends": [
31-
"eslint:recommended",
32-
"plugin:import/recommended"
31+
"eslint:recommended"
3332
],
33+
"env": {
34+
"node": true,
35+
"es2017": true
36+
},
37+
"ignorePatterns": ["src/parser.js"],
3438
"rules": {
3539
"curly": "error"
3640
}
3741
},
3842
"devDependencies": {
39-
"@babel/cli": "^7.16.8",
40-
"@babel/core": "^7.16.12",
41-
"@babel/plugin-transform-modules-commonjs": "^7.16.8",
42-
"@babel/register": "^7.16.9",
43-
"babel-plugin-add-module-exports": "^1.0.0",
43+
"@types/node": "^17.0.14",
4444
"eslint": "^8.7.0",
45-
"eslint-plugin-import": "^2.25.4",
4645
"jison-gho": "^0.6.1-216",
4746
"postcss": "^8.2.2",
48-
"rimraf": "^3.0.2",
4947
"typescript": "^4.5.5",
5048
"uvu": "^0.5.3"
5149
},

0 commit comments

Comments
 (0)