diff --git a/lib/CacheEnhancedResolve.js b/lib/CacheEnhancedResolve.js index 47f98cd8..fa9937ec 100644 --- a/lib/CacheEnhancedResolve.js +++ b/lib/CacheEnhancedResolve.js @@ -2,6 +2,7 @@ const path = require('path'); const lodash = require('lodash'); const nodeObjectHash = require('node-object-hash'); +const parseJson = require('parse-json'); const pluginCompat = require('./util/plugin-compat'); const promisify = require('./util/promisify'); @@ -10,7 +11,6 @@ const serial = require('./util/serial'); const values = require('./util/Object.values'); const bulkFsTask = require('./util/bulk-fs-task'); const { parityCacheFromCache, pushParityWriteOps } = require('./util/parity'); -const parseJson = require('./util/parseJson'); const serialNormalResolved = serial.created({ result: serial.path, diff --git a/lib/CacheModuleResolver.js b/lib/CacheModuleResolver.js index 9e090724..57aae313 100644 --- a/lib/CacheModuleResolver.js +++ b/lib/CacheModuleResolver.js @@ -1,9 +1,9 @@ const nodeObjectHash = require('node-object-hash'); +const parseJson = require('parse-json'); const serial = require('./util/serial'); const pluginCompat = require('./util/plugin-compat'); const relateContext = require('./util/relate-context'); -const parseJson = require('./util/parseJson'); const { parityCacheFromCache, pushParityWriteOps } = require('./util/parity'); const serialJsonKey = { diff --git a/lib/SerializerAppend2.js b/lib/SerializerAppend2.js index f42b6fb5..5dd42012 100644 --- a/lib/SerializerAppend2.js +++ b/lib/SerializerAppend2.js @@ -1,10 +1,10 @@ const fs = require('graceful-fs'); const { join, resolve } = require('path'); const _mkdirp = require('mkdirp'); +const parseJson = require('parse-json'); const _rimraf = require('rimraf'); const promisify = require('./util/promisify'); -const parseJson = require('./util/parseJson'); const close = promisify(fs.close); const mkdirp = promisify(_mkdirp); diff --git a/lib/util/parity.js b/lib/util/parity.js index 8a55c608..bc071fb8 100644 --- a/lib/util/parity.js +++ b/lib/util/parity.js @@ -1,5 +1,5 @@ +const parseJson = require('parse-json'); const { cachePrefix } = require('.'); -const parseJson = require('./parseJson'); class ParityRoot { constructor() { diff --git a/lib/util/parseJson.js b/lib/util/parseJson.js deleted file mode 100644 index b9cbed1c..00000000 --- a/lib/util/parseJson.js +++ /dev/null @@ -1,12 +0,0 @@ -module.exports = data => { - let result; - // Use standard json for performance. - try { - result = JSON.parse(data); - } catch (_) { - // Use jsonlint for clear errors. An error will rethrow with more - // information. - result = require('jsonlint').parse(data); - } - return result; -}; diff --git a/package.json b/package.json index adf6a76e..9cb81742 100644 --- a/package.json +++ b/package.json @@ -69,10 +69,10 @@ "chalk": "^2.4.1", "find-cache-dir": "^2.0.0", "graceful-fs": "^4.1.11", - "jsonlint": "^1.6.3", "lodash": "^4.15.0", "mkdirp": "^0.5.1", "node-object-hash": "^1.2.0", + "parse-json": "^4.0.0", "pkg-dir": "^3.0.0", "rimraf": "^2.6.2", "semver": "^5.6.0",