UNPKG

pnpm

Version:

A fast implementation of npm install

18 lines 618 B
"use strict"; const path = require('path'); const fs = require('fs'); const cache = {}; /** * Works identically to require('/path/to/file.json'), but safer. */ function requireJson(pkgJsonPath, opts) { opts = opts || { ignoreCache: false }; pkgJsonPath = path.resolve(pkgJsonPath); if (!opts.ignoreCache && cache[pkgJsonPath]) return cache[pkgJsonPath]; cache[pkgJsonPath] = JSON.parse(fs.readFileSync(pkgJsonPath, 'utf-8')); return cache[pkgJsonPath]; } Object.defineProperty(exports, "__esModule", { value: true }); exports.default = requireJson; //# sourceMappingURL=requireJson.js.map