Skip to content

Commit

Permalink
changed parse-json requires to json5 (#272)
Browse files Browse the repository at this point in the history
  • Loading branch information
philipodev authored and devongovett committed Dec 15, 2017
1 parent 333c3aa commit ed35a09
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/FSCache.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const path = require('path');
const md5 = require('./utils/md5');
const objectHash = require('./utils/objectHash');
const pkg = require('../package.json');
const parseJson = require('parse-json');
const json5 = require('json5');

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

let data = await fs.readFile(cacheFile);
return parseJson(data);
return json5.parse(data);
} catch (err) {
return null;
}
Expand Down
6 changes: 3 additions & 3 deletions test/hmr.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const rimraf = require('rimraf');
const promisify = require('../src/utils/promisify');
const ncp = promisify(require('ncp'));
const WebSocket = require('ws');
const parseJson = require('parse-json');
const json5 = require('json5');

describe('hmr', function() {
let b, ws;
Expand Down Expand Up @@ -45,7 +45,7 @@ describe('hmr', function() {
'exports.a = 5; exports.b = 5;'
);

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

let msg = parseJson(await nextEvent(ws, 'message'));
let msg = json5.parse(await nextEvent(ws, 'message'));
assert.equal(msg.type, 'update');
assert.equal(msg.assets.length, 2);
});
Expand Down

0 comments on commit ed35a09

Please sign in to comment.