Skip to content

Commit ed35a09

Browse files
philipodevdevongovett
authored andcommitted
changed parse-json requires to json5 (#272)
1 parent 333c3aa commit ed35a09

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

src/FSCache.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ const path = require('path');
33
const md5 = require('./utils/md5');
44
const objectHash = require('./utils/objectHash');
55
const pkg = require('../package.json');
6-
const parseJson = require('parse-json');
6+
const json5 = require('json5');
77

88
// These keys can affect the output, so if they differ, the cache should not match
99
const OPTION_KEYS = ['publicURL', 'minify', 'hmr'];
@@ -56,7 +56,7 @@ class FSCache {
5656
}
5757

5858
let data = await fs.readFile(cacheFile);
59-
return parseJson(data);
59+
return json5.parse(data);
6060
} catch (err) {
6161
return null;
6262
}

test/hmr.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const rimraf = require('rimraf');
66
const promisify = require('../src/utils/promisify');
77
const ncp = promisify(require('ncp'));
88
const WebSocket = require('ws');
9-
const parseJson = require('parse-json');
9+
const json5 = require('json5');
1010

1111
describe('hmr', function() {
1212
let b, ws;
@@ -45,7 +45,7 @@ describe('hmr', function() {
4545
'exports.a = 5; exports.b = 5;'
4646
);
4747

48-
let msg = parseJson(await nextEvent(ws, 'message'));
48+
let msg = json5.parse(await nextEvent(ws, 'message'));
4949
assert.equal(msg.type, 'update');
5050
assert.equal(msg.assets.length, 1);
5151
assert.equal(msg.assets[0].generated.js, 'exports.a = 5; exports.b = 5;');
@@ -65,7 +65,7 @@ describe('hmr', function() {
6565
'require("fs"); exports.a = 5; exports.b = 5;'
6666
);
6767

68-
let msg = parseJson(await nextEvent(ws, 'message'));
68+
let msg = json5.parse(await nextEvent(ws, 'message'));
6969
assert.equal(msg.type, 'update');
7070
assert.equal(msg.assets.length, 2);
7171
});

0 commit comments

Comments
 (0)