aboutsummaryrefslogtreecommitdiff
path: root/node_modules/json5/lib/register.js
blob: 935cdbafb323ac615fc22c86cfbaf3f2359771b8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
const fs = require('fs')
const JSON5 = require('./')

// eslint-disable-next-line node/no-deprecated-api
require.extensions['.json5'] = function (module, filename) {
    const content = fs.readFileSync(filename, 'utf8')
    try {
        module.exports = JSON5.parse(content)
    } catch (err) {
        err.message = filename + ': ' + err.message
        throw err
    }
}