Skip to content

Commit bd45866

Browse files
yamitzkydevongovett
authored andcommitted
Enable JSON5-flavored .babelrc (#256)
1 parent 39824c9 commit bd45866

3 files changed

Lines changed: 19 additions & 174 deletions

File tree

package.json

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,17 @@
2323
"htmlnano": "^0.1.6",
2424
"is-url": "^1.2.2",
2525
"js-yaml": "^3.10.0",
26+
"json5": "^0.5.1",
2627
"micromatch": "^3.0.4",
2728
"mkdirp": "^0.5.1",
2829
"node-libs-browser": "^2.0.0",
2930
"opn": "^5.1.0",
30-
"parse-json": "^4.0.0",
3131
"physical-cpu-count": "^2.0.0",
3232
"postcss": "^6.0.10",
3333
"postcss-value-parser": "^3.3.0",
3434
"posthtml": "^0.10.1",
3535
"resolve": "^1.4.0",
3636
"serve-static": "^1.12.4",
37-
"strip-json-comments": "^2.0.1",
3837
"uglify-es": "^3.2.1",
3938
"v8-compile-cache": "^1.1.0",
4039
"worker-farm": "^1.4.1",
@@ -66,7 +65,8 @@
6665
"build": "babel src -d lib",
6766
"prepublish": "yarn build",
6867
"precommit": "lint-staged",
69-
"postinstall": "node -e \"console.log('\\u001b[35m\\u001b[1mLove Parcel? You can now donate to our open collective:\\u001b[22m\\u001b[39m\\n > \\u001b[34mhttps://opencollective.com/parcel/donate\\u001b[0m')\""
68+
"postinstall":
69+
"node -e \"console.log('\\u001b[35m\\u001b[1mLove Parcel? You can now donate to our open collective:\\u001b[22m\\u001b[39m\\n > \\u001b[34mhttps://opencollective.com/parcel/donate\\u001b[0m')\""
7070
},
7171
"bin": {
7272
"parcel": "bin/cli.js"
@@ -75,10 +75,7 @@
7575
"node": ">= 6.0.0"
7676
},
7777
"lint-staged": {
78-
"*.{js,json,md}": [
79-
"prettier --write",
80-
"git add"
81-
]
78+
"*.{js,json,md}": ["prettier --write", "git add"]
8279
},
8380
"collective": {
8481
"type": "opencollective",

src/utils/config.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
const fs = require('./fs');
22
const path = require('path');
3-
const parseJson = require('parse-json');
4-
const stripJsonComments = require('strip-json-comments');
3+
const json5 = require('json5');
54

65
const existsCache = new Map();
76

@@ -37,7 +36,7 @@ async function load(filepath, filenames, root = path.parse(filepath).root) {
3736
}
3837

3938
let configStream = await fs.readFile(configFile);
40-
return parseJson(stripJsonComments(configStream.toString()));
39+
return json5.parse(configStream.toString());
4140
}
4241

4342
return null;

0 commit comments

Comments
 (0)