123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118 |
- module.exports = (function() {
- var __MODS__ = {};
- var __DEFINE__ = function(modId, func, req) { var m = { exports: {}, _tempexports: {} }; __MODS__[modId] = { status: 0, func: func, req: req, m: m }; };
- var __REQUIRE__ = function(modId, source) { if(!__MODS__[modId]) return require(source); if(!__MODS__[modId].status) { var m = __MODS__[modId].m; m._exports = m._tempexports; var desp = Object.getOwnPropertyDescriptor(m, "exports"); if (desp && desp.configurable) Object.defineProperty(m, "exports", { set: function (val) { if(typeof val === "object" && val !== m._exports) { m._exports.__proto__ = val.__proto__; Object.keys(val).forEach(function (k) { m._exports[k] = val[k]; }); } m._tempexports = val }, get: function () { return m._tempexports; } }); __MODS__[modId].status = 1; __MODS__[modId].func(__MODS__[modId].req, m, m.exports); } return __MODS__[modId].m.exports; };
- var __REQUIRE_WILDCARD__ = function(obj) { if(obj && obj.__esModule) { return obj; } else { var newObj = {}; if(obj != null) { for(var k in obj) { if (Object.prototype.hasOwnProperty.call(obj, k)) newObj[k] = obj[k]; } } newObj.default = obj; return newObj; } };
- var __REQUIRE_DEFAULT__ = function(obj) { return obj && obj.__esModule ? obj.default : obj; };
- __DEFINE__(1677462587462, function(require, module, exports) {
- let _fs
- try {
- _fs = require('graceful-fs')
- } catch (_) {
- _fs = require('fs')
- }
- const universalify = require('universalify')
- const { stringify, stripBom } = require('./utils')
- async function _readFile (file, options = {}) {
- if (typeof options === 'string') {
- options = { encoding: options }
- }
- const fs = options.fs || _fs
- const shouldThrow = 'throws' in options ? options.throws : true
- let data = await universalify.fromCallback(fs.readFile)(file, options)
- data = stripBom(data)
- let obj
- try {
- obj = JSON.parse(data, options ? options.reviver : null)
- } catch (err) {
- if (shouldThrow) {
- err.message = `${file}: ${err.message}`
- throw err
- } else {
- return null
- }
- }
- return obj
- }
- const readFile = universalify.fromPromise(_readFile)
- function readFileSync (file, options = {}) {
- if (typeof options === 'string') {
- options = { encoding: options }
- }
- const fs = options.fs || _fs
- const shouldThrow = 'throws' in options ? options.throws : true
- try {
- let content = fs.readFileSync(file, options)
- content = stripBom(content)
- return JSON.parse(content, options.reviver)
- } catch (err) {
- if (shouldThrow) {
- err.message = `${file}: ${err.message}`
- throw err
- } else {
- return null
- }
- }
- }
- async function _writeFile (file, obj, options = {}) {
- const fs = options.fs || _fs
- const str = stringify(obj, options)
- await universalify.fromCallback(fs.writeFile)(file, str, options)
- }
- const writeFile = universalify.fromPromise(_writeFile)
- function writeFileSync (file, obj, options = {}) {
- const fs = options.fs || _fs
- const str = stringify(obj, options)
- // not sure if fs.writeFileSync returns anything, but just in case
- return fs.writeFileSync(file, str, options)
- }
- const jsonfile = {
- readFile,
- readFileSync,
- writeFile,
- writeFileSync
- }
- module.exports = jsonfile
- }, function(modId) {var map = {"./utils":1677462587463}; return __REQUIRE__(map[modId], modId); })
- __DEFINE__(1677462587463, function(require, module, exports) {
- function stringify (obj, { EOL = '\n', finalEOL = true, replacer = null, spaces } = {}) {
- const EOF = finalEOL ? EOL : ''
- const str = JSON.stringify(obj, replacer, spaces)
- return str.replace(/\n/g, EOL) + EOF
- }
- function stripBom (content) {
- // we do this because JSON.parse would convert it to a utf8 string if encoding wasn't specified
- if (Buffer.isBuffer(content)) content = content.toString('utf8')
- return content.replace(/^\uFEFF/, '')
- }
- module.exports = { stringify, stripBom }
- }, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); })
- return __REQUIRE__(1677462587462);
- })()
- //miniprogram-npm-outsideDeps=["graceful-fs","fs","universalify"]
- //# sourceMappingURL=index.js.map
|