@react-native-windows/fs
Advanced tools
@@ -52,4 +52,4 @@ "use strict"; | ||
| const opts = { | ||
| encoding: (options === null || options === void 0 ? void 0 : options.encoding) || 'utf-8', | ||
| flag: options === null || options === void 0 ? void 0 : options.flag, | ||
| encoding: options?.encoding || 'utf-8', | ||
| flag: options?.flag, | ||
| }; | ||
@@ -56,0 +56,0 @@ return JSON.parse(await asyncMethods.readFile(path, opts)); |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"asyncMethods.js","sourceRoot":"","sources":["../src/asyncMethods.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;AAEH,8DAA6B;AAC7B,gDAAwB;AAExB,MAAM,eAAe,GAAG;IACtB,QAAQ;IACR,YAAY;IACZ,OAAO;IACP,OAAO;IACP,UAAU;IACV,QAAQ;IACR,QAAQ;IACR,2BAA2B;IAC3B,aAAa;IACb,MAAM;IACN,OAAO;IACP,OAAO;IACP,SAAS;IACT,MAAM;IACN,SAAS;IACT,SAAS;IACT,UAAU;IACV,UAAU;IACV,UAAU;IACV,QAAQ;IACR,OAAO;IACP,2BAA2B;IAC3B,QAAQ;IACR,MAAM;IACN,SAAS;IACT,UAAU;IACV,QAAQ;IACR,QAAQ;IACR,WAAW;CACH,CAAC;AAqEX,MAAM,YAAY,GAAiB;IACjC,GAAG,wBAAwB,EAAE;IAE7B,MAAM,EAAE,CAAC,IAAiB,EAAE,EAAE,CAC5B,IAAI,OAAO,CAAC,OAAO,CAAC,EAAE;QACpB,qBAAE,CAAC,MAAM,CAAC,IAAI,EAAE,qBAAE,CAAC,SAAS,CAAC,IAAI,EAAE,GAAG,CAAC,EAAE,CACvC,GAAG,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CACrC,CAAC;IACJ,CAAC,CAAC;IAEJ,YAAY,EAAE,KAAK,EACjB,IAA0B,EAC1B,OAAuE,EACvE,EAAE;QACF,MAAM,IAAI,GAAG;YACX,QAAQ,EAAE,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,QAAQ,KAAI,OAAO;YACtC,IAAI,EAAE,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,IAAI;SACpB,CAAC;QACF,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,YAAY,CAAC,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;IAC7D,CAAC;CACF,CAAC;AAEF,kBAAe,YAAY,CAAC;AAE5B;;;GAGG;AACH,SAAS,aAAa;IACpB,MAAM,aAAa,GAA6B,EAAE,CAAC;IACnD,KAAK,MAAM,UAAU,IAAI,eAAe,EAAE;QACxC,aAAa;QACb,aAAa,CAAC,UAAU,CAAC,GAAG,qBAAE,CAAC,UAAU,CAAC,CAAC;KAC5C;IACD,OAAO,aAAgC,CAAC;AAC1C,CAAC;AAED,SAAS,wBAAwB;IAC/B,MAAM,kBAAkB,GAA+B,EAAE,CAAC;IAC1D,KAAK,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,aAAa,EAAE,CAAC,EAAE;QAClE,aAAa;QACb,kBAAkB,CAAC,UAAU,CAAC,GAAG,cAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;KACzD;IAED,OAAO,kBAAuC,CAAC;AACjD,CAAC","sourcesContent":["/**\n * Copyright (c) Microsoft Corporation.\n * Licensed under the MIT License.\n *\n * @format\n */\n\nimport fs from 'graceful-fs';\nimport util from 'util';\n\nconst importedMethods = [\n 'access',\n 'appendFile',\n 'chmod',\n 'chown',\n 'copyFile',\n 'lchmod',\n 'lchown',\n // Not available in Node 12\n // 'lutimes',\n 'link',\n 'lstat',\n 'mkdir',\n 'mkdtemp',\n 'open',\n 'opendir',\n 'readdir',\n 'readFile',\n 'readlink',\n 'realpath',\n 'rename',\n 'rmdir',\n // Not available in Node 12\n // 'rm',\n 'stat',\n 'symlink',\n 'truncate',\n 'unlink',\n 'utimes',\n 'writeFile',\n] as const;\n\ntype ValueOf<T extends readonly any[]> = T[number];\ntype ImportedMethodNames = ValueOf<typeof importedMethods>;\ntype ImportedMethods = Pick<typeof fs, ImportedMethodNames>;\n\ntype PromisifedMethods = {\n access: typeof fs.access.__promisify__;\n appendFile: typeof fs.appendFile.__promisify__;\n chmod: typeof fs.chmod.__promisify__;\n chown: typeof fs.chown.__promisify__;\n copyFile: typeof fs.copyFile.__promisify__;\n lchmod: typeof fs.lchmod.__promisify__;\n lchown: typeof fs.lchown.__promisify__;\n // Not available in Node 12\n // lutimes: typeof fs.lutimes.__promisify__;\n link: typeof fs.link.__promisify__;\n lstat: typeof fs.lstat.__promisify__;\n mkdir: typeof fs.mkdir.__promisify__;\n mkdtemp: typeof fs.mkdtemp.__promisify__;\n open: typeof fs.open.__promisify__;\n opendir: typeof fs.opendir.__promisify__;\n readdir: typeof fs.readdir.__promisify__;\n readFile: typeof fs.readFile.__promisify__;\n readlink: typeof fs.readlink.__promisify__;\n realpath: typeof fs.realpath.__promisify__;\n rename: typeof fs.rename.__promisify__;\n rmdir: typeof fs.rmdir.__promisify__;\n // Not available in Node 12\n // rm: typeof fs.rm.__promisify__;\n stat: typeof fs.stat.__promisify__;\n symlink: typeof fs.symlink.__promisify__;\n truncate: typeof fs.truncate.__promisify__;\n unlink: typeof fs.unlink.__promisify__;\n utimes: typeof fs.utimes.__promisify__;\n writeFile: typeof fs.writeFile.__promisify__;\n};\n\ntype ExtraMethods = {\n /**\n * Asynchronously tests whether or not the given path exists within the\n * file-system.\n * @param path A path to a file or directory.\n */\n exists: (path: fs.PathLike) => Promise<boolean>;\n\n /**\n * Asynchronously reads the contents of a file, then parses it as JSON.\n *\n * By default the parsed JSON file is assumed to be a JSON object, with no\n * assumptions made about content (`Record<string, unknown`). If the type is\n * known at call-time, it can be passed to this function to alter the return\n * type.This type is not validated to be correct at runtime.\n *\n * E.g. `await fs.readJsonFile<Document>(documentPath)`;\n *\n * @param path A path to a file.\n * @param options Optional set of options\n * @param options.encoding The encoding of the JSON file (defaults to utf-8)\n * @param options.flag File access flags\n */\n readJsonFile: <T = Record<string, unknown>>(\n path: fs.PathLike | number,\n options?: {encoding?: null | BufferEncoding; flag?: string | undefined},\n ) => Promise<T>;\n};\n\nexport type AsyncMethods = PromisifedMethods & ExtraMethods;\n\nconst asyncMethods: AsyncMethods = {\n ...promisifyImportedMethods(),\n\n exists: (path: fs.PathLike) =>\n new Promise(resolve => {\n fs.access(path, fs.constants.F_OK, err =>\n err ? resolve(false) : resolve(true),\n );\n }),\n\n readJsonFile: async (\n path: fs.PathLike | number,\n options?: {encoding?: null | BufferEncoding; flag?: string | undefined},\n ) => {\n const opts = {\n encoding: options?.encoding || 'utf-8',\n flag: options?.flag,\n };\n return JSON.parse(await asyncMethods.readFile(path, opts));\n },\n};\n\nexport default asyncMethods;\n\n/**\n * Import the patched callbacks from `graceful-fs` to promisify ourselves, since\n * `graceful-fs` does not patch `fs.promises`.\n */\nfunction importMethods(): ImportedMethods {\n const copiedMethods: Partial<ImportedMethods> = {};\n for (const methodName of importedMethods) {\n // @ts-ignore\n copiedMethods[methodName] = fs[methodName];\n }\n return copiedMethods as ImportedMethods;\n}\n\nfunction promisifyImportedMethods(): PromisifedMethods {\n const promisifiedMethods: Partial<PromisifedMethods> = {};\n for (const [methodName, method] of Object.entries(importMethods())) {\n // @ts-ignore\n promisifiedMethods[methodName] = util.promisify(method);\n }\n\n return promisifiedMethods as PromisifedMethods;\n}\n"]} | ||
| {"version":3,"file":"asyncMethods.js","sourceRoot":"","sources":["../src/asyncMethods.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;AAEH,8DAA6B;AAC7B,gDAAwB;AAExB,MAAM,eAAe,GAAG;IACtB,QAAQ;IACR,YAAY;IACZ,OAAO;IACP,OAAO;IACP,UAAU;IACV,QAAQ;IACR,QAAQ;IACR,2BAA2B;IAC3B,aAAa;IACb,MAAM;IACN,OAAO;IACP,OAAO;IACP,SAAS;IACT,MAAM;IACN,SAAS;IACT,SAAS;IACT,UAAU;IACV,UAAU;IACV,UAAU;IACV,QAAQ;IACR,OAAO;IACP,2BAA2B;IAC3B,QAAQ;IACR,MAAM;IACN,SAAS;IACT,UAAU;IACV,QAAQ;IACR,QAAQ;IACR,WAAW;CACH,CAAC;AAqEX,MAAM,YAAY,GAAiB;IACjC,GAAG,wBAAwB,EAAE;IAE7B,MAAM,EAAE,CAAC,IAAiB,EAAE,EAAE,CAC5B,IAAI,OAAO,CAAC,OAAO,CAAC,EAAE;QACpB,qBAAE,CAAC,MAAM,CAAC,IAAI,EAAE,qBAAE,CAAC,SAAS,CAAC,IAAI,EAAE,GAAG,CAAC,EAAE,CACvC,GAAG,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CACrC,CAAC;IACJ,CAAC,CAAC;IAEJ,YAAY,EAAE,KAAK,EACjB,IAA0B,EAC1B,OAAuE,EACvE,EAAE;QACF,MAAM,IAAI,GAAG;YACX,QAAQ,EAAE,OAAO,EAAE,QAAQ,IAAI,OAAO;YACtC,IAAI,EAAE,OAAO,EAAE,IAAI;SACpB,CAAC;QACF,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,YAAY,CAAC,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;IAC7D,CAAC;CACF,CAAC;AAEF,kBAAe,YAAY,CAAC;AAE5B;;;GAGG;AACH,SAAS,aAAa;IACpB,MAAM,aAAa,GAA6B,EAAE,CAAC;IACnD,KAAK,MAAM,UAAU,IAAI,eAAe,EAAE;QACxC,aAAa;QACb,aAAa,CAAC,UAAU,CAAC,GAAG,qBAAE,CAAC,UAAU,CAAC,CAAC;KAC5C;IACD,OAAO,aAAgC,CAAC;AAC1C,CAAC;AAED,SAAS,wBAAwB;IAC/B,MAAM,kBAAkB,GAA+B,EAAE,CAAC;IAC1D,KAAK,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,aAAa,EAAE,CAAC,EAAE;QAClE,aAAa;QACb,kBAAkB,CAAC,UAAU,CAAC,GAAG,cAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;KACzD;IAED,OAAO,kBAAuC,CAAC;AACjD,CAAC","sourcesContent":["/**\n * Copyright (c) Microsoft Corporation.\n * Licensed under the MIT License.\n *\n * @format\n */\n\nimport fs from 'graceful-fs';\nimport util from 'util';\n\nconst importedMethods = [\n 'access',\n 'appendFile',\n 'chmod',\n 'chown',\n 'copyFile',\n 'lchmod',\n 'lchown',\n // Not available in Node 12\n // 'lutimes',\n 'link',\n 'lstat',\n 'mkdir',\n 'mkdtemp',\n 'open',\n 'opendir',\n 'readdir',\n 'readFile',\n 'readlink',\n 'realpath',\n 'rename',\n 'rmdir',\n // Not available in Node 12\n // 'rm',\n 'stat',\n 'symlink',\n 'truncate',\n 'unlink',\n 'utimes',\n 'writeFile',\n] as const;\n\ntype ValueOf<T extends readonly any[]> = T[number];\ntype ImportedMethodNames = ValueOf<typeof importedMethods>;\ntype ImportedMethods = Pick<typeof fs, ImportedMethodNames>;\n\ntype PromisifedMethods = {\n access: typeof fs.access.__promisify__;\n appendFile: typeof fs.appendFile.__promisify__;\n chmod: typeof fs.chmod.__promisify__;\n chown: typeof fs.chown.__promisify__;\n copyFile: typeof fs.copyFile.__promisify__;\n lchmod: typeof fs.lchmod.__promisify__;\n lchown: typeof fs.lchown.__promisify__;\n // Not available in Node 12\n // lutimes: typeof fs.lutimes.__promisify__;\n link: typeof fs.link.__promisify__;\n lstat: typeof fs.lstat.__promisify__;\n mkdir: typeof fs.mkdir.__promisify__;\n mkdtemp: typeof fs.mkdtemp.__promisify__;\n open: typeof fs.open.__promisify__;\n opendir: typeof fs.opendir.__promisify__;\n readdir: typeof fs.readdir.__promisify__;\n readFile: typeof fs.readFile.__promisify__;\n readlink: typeof fs.readlink.__promisify__;\n realpath: typeof fs.realpath.__promisify__;\n rename: typeof fs.rename.__promisify__;\n rmdir: typeof fs.rmdir.__promisify__;\n // Not available in Node 12\n // rm: typeof fs.rm.__promisify__;\n stat: typeof fs.stat.__promisify__;\n symlink: typeof fs.symlink.__promisify__;\n truncate: typeof fs.truncate.__promisify__;\n unlink: typeof fs.unlink.__promisify__;\n utimes: typeof fs.utimes.__promisify__;\n writeFile: typeof fs.writeFile.__promisify__;\n};\n\ntype ExtraMethods = {\n /**\n * Asynchronously tests whether or not the given path exists within the\n * file-system.\n * @param path A path to a file or directory.\n */\n exists: (path: fs.PathLike) => Promise<boolean>;\n\n /**\n * Asynchronously reads the contents of a file, then parses it as JSON.\n *\n * By default the parsed JSON file is assumed to be a JSON object, with no\n * assumptions made about content (`Record<string, unknown`). If the type is\n * known at call-time, it can be passed to this function to alter the return\n * type.This type is not validated to be correct at runtime.\n *\n * E.g. `await fs.readJsonFile<Document>(documentPath)`;\n *\n * @param path A path to a file.\n * @param options Optional set of options\n * @param options.encoding The encoding of the JSON file (defaults to utf-8)\n * @param options.flag File access flags\n */\n readJsonFile: <T = Record<string, unknown>>(\n path: fs.PathLike | number,\n options?: {encoding?: null | BufferEncoding; flag?: string | undefined},\n ) => Promise<T>;\n};\n\nexport type AsyncMethods = PromisifedMethods & ExtraMethods;\n\nconst asyncMethods: AsyncMethods = {\n ...promisifyImportedMethods(),\n\n exists: (path: fs.PathLike) =>\n new Promise(resolve => {\n fs.access(path, fs.constants.F_OK, err =>\n err ? resolve(false) : resolve(true),\n );\n }),\n\n readJsonFile: async (\n path: fs.PathLike | number,\n options?: {encoding?: null | BufferEncoding; flag?: string | undefined},\n ) => {\n const opts = {\n encoding: options?.encoding || 'utf-8',\n flag: options?.flag,\n };\n return JSON.parse(await asyncMethods.readFile(path, opts));\n },\n};\n\nexport default asyncMethods;\n\n/**\n * Import the patched callbacks from `graceful-fs` to promisify ourselves, since\n * `graceful-fs` does not patch `fs.promises`.\n */\nfunction importMethods(): ImportedMethods {\n const copiedMethods: Partial<ImportedMethods> = {};\n for (const methodName of importedMethods) {\n // @ts-ignore\n copiedMethods[methodName] = fs[methodName];\n }\n return copiedMethods as ImportedMethods;\n}\n\nfunction promisifyImportedMethods(): PromisifedMethods {\n const promisifiedMethods: Partial<PromisifedMethods> = {};\n for (const [methodName, method] of Object.entries(importMethods())) {\n // @ts-ignore\n promisifiedMethods[methodName] = util.promisify(method);\n }\n\n return promisifiedMethods as PromisifedMethods;\n}\n"]} |
@@ -68,4 +68,4 @@ "use strict"; | ||
| const opts = { | ||
| encoding: (options === null || options === void 0 ? void 0 : options.encoding) || 'utf-8', | ||
| flag: options === null || options === void 0 ? void 0 : options.flag, | ||
| encoding: options?.encoding || 'utf-8', | ||
| flag: options?.flag, | ||
| }; | ||
@@ -72,0 +72,0 @@ return JSON.parse(syncMethods.readFileSync(path, opts)); |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"syncMethods.js","sourceRoot":"","sources":["../src/syncMethods.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;AAEH,8DAA6B;AAE7B,MAAM,eAAe,GAAG;IACtB,YAAY;IACZ,gBAAgB;IAChB,WAAW;IACX,WAAW;IACX,WAAW;IACX,cAAc;IACd,kBAAkB;IAClB,mBAAmB;IACnB,YAAY;IACZ,YAAY;IACZ,YAAY;IACZ,eAAe;IACf,WAAW;IACX,WAAW;IACX,eAAe;IACf,aAAa;IACb,YAAY;IACZ,YAAY;IACZ,2BAA2B;IAC3B,iBAAiB;IACjB,UAAU;IACV,WAAW;IACX,WAAW;IACX,aAAa;IACb,aAAa;IACb,UAAU;IACV,aAAa;IACb,cAAc;IACd,cAAc;IACd,UAAU;IACV,2BAA2B;IAC3B,eAAe;IACf,cAAc;IACd,cAAc;IACd,YAAY;IACZ,WAAW;IACX,2BAA2B;IAC3B,YAAY;IACZ,UAAU;IACV,aAAa;IACb,cAAc;IACd,YAAY;IACZ,YAAY;IACZ,OAAO;IACP,WAAW;IACX,eAAe;IACf,WAAW;IACX,WAAW;IACX,YAAY;CACJ,CAAC;AA8BX,MAAM,WAAW,GAAgB;IAC/B,GAAG,aAAa,EAAE;IAElB,gBAAgB,EAAE,CAChB,IAA0B,EAC1B,OAAuE,EACvE,EAAE;QACF,MAAM,IAAI,GAAG;YACX,QAAQ,EAAE,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,QAAQ,KAAI,OAAO;YACtC,IAAI,EAAE,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,IAAI;SACpB,CAAC;QACF,OAAO,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,YAAY,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;IAC1D,CAAC;CACF,CAAC;AAEF,kBAAe,WAAW,CAAC;AAE3B,SAAS,aAAa;IACpB,MAAM,aAAa,GAA6B,EAAE,CAAC;IACnD,KAAK,MAAM,UAAU,IAAI,eAAe,EAAE;QACxC,aAAa;QACb,aAAa,CAAC,UAAU,CAAC,GAAG,qBAAE,CAAC,UAAU,CAAC,CAAC;KAC5C;IACD,OAAO,aAAgC,CAAC;AAC1C,CAAC","sourcesContent":["/**\n * Copyright (c) Microsoft Corporation.\n * Licensed under the MIT License.\n *\n * @format\n */\n\nimport fs from 'graceful-fs';\n\nconst importedMethods = [\n 'accessSync',\n 'appendFileSync',\n 'chmodSync',\n 'chownSync',\n 'closeSync',\n 'copyFileSync',\n 'createReadStream',\n 'createWriteStream',\n 'existsSync',\n 'fchmodSync',\n 'fchownSync',\n 'fdatasyncSync',\n 'fstatSync',\n 'fsyncSync',\n 'ftruncateSync',\n 'futimesSync',\n 'lchmodSync',\n 'lchownSync',\n // Not available in Node 12\n // 'lutimesSync',\n 'linkSync',\n 'lstatSync',\n 'mkdirSync',\n 'mkdtempSync',\n 'opendirSync',\n 'openSync',\n 'readdirSync',\n 'readlinkSync',\n 'readFileSync',\n 'readSync',\n // Not available in Node 12\n // 'readvSync',\n 'realpathSync',\n 'realpathSync',\n 'renameSync',\n 'rmdirSync',\n // Not available in Node 12\n // 'rmSync',\n 'statSync',\n 'symlinkSync',\n 'truncateSync',\n 'unlinkSync',\n 'utimesSync',\n 'watch',\n 'watchFile',\n 'writeFileSync',\n 'writeSync',\n 'writeSync',\n 'writevSync',\n] as const;\n\ntype ValueOf<T extends readonly any[]> = T[number];\ntype ImportedMethodNames = ValueOf<typeof importedMethods>;\ntype ImportedMethods = Pick<typeof fs, ImportedMethodNames>;\n\ntype ExtraMethods = {\n /**\n * Synchronously reads the contents of a file, then parses it as JSON.\n *\n * By default the parsed JSON file is assumed to be a JSON object, with no\n * assumptions made about content (`Record<string, unknown`). If the type is\n * known at call-time, it can be passed to this function to alter the return\n * type.This type is not validated to be correct at runtime.\n *\n * E.g. `fs.readJsonFileSync<Document>(documentPath)`;\n *\n * @param path A path to a file.\n * @param options Optional set of options\n * @param options.encoding The encoding of the JSON file (defaults to utf-8)\n * @param options.flag File access flags\n */\n readJsonFileSync: <T = Record<string, unknown>>(\n path: fs.PathLike | number,\n options?: {encoding?: null | BufferEncoding; flag?: string | undefined},\n ) => T;\n};\n\nexport type SyncMethods = ImportedMethods & ExtraMethods;\n\nconst syncMethods: SyncMethods = {\n ...importMethods(),\n\n readJsonFileSync: (\n path: fs.PathLike | number,\n options?: {encoding?: null | BufferEncoding; flag?: string | undefined},\n ) => {\n const opts = {\n encoding: options?.encoding || 'utf-8',\n flag: options?.flag,\n };\n return JSON.parse(syncMethods.readFileSync(path, opts));\n },\n};\n\nexport default syncMethods;\n\nfunction importMethods(): ImportedMethods {\n const copiedMethods: Partial<ImportedMethods> = {};\n for (const methodName of importedMethods) {\n // @ts-ignore\n copiedMethods[methodName] = fs[methodName];\n }\n return copiedMethods as ImportedMethods;\n}\n"]} | ||
| {"version":3,"file":"syncMethods.js","sourceRoot":"","sources":["../src/syncMethods.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;AAEH,8DAA6B;AAE7B,MAAM,eAAe,GAAG;IACtB,YAAY;IACZ,gBAAgB;IAChB,WAAW;IACX,WAAW;IACX,WAAW;IACX,cAAc;IACd,kBAAkB;IAClB,mBAAmB;IACnB,YAAY;IACZ,YAAY;IACZ,YAAY;IACZ,eAAe;IACf,WAAW;IACX,WAAW;IACX,eAAe;IACf,aAAa;IACb,YAAY;IACZ,YAAY;IACZ,2BAA2B;IAC3B,iBAAiB;IACjB,UAAU;IACV,WAAW;IACX,WAAW;IACX,aAAa;IACb,aAAa;IACb,UAAU;IACV,aAAa;IACb,cAAc;IACd,cAAc;IACd,UAAU;IACV,2BAA2B;IAC3B,eAAe;IACf,cAAc;IACd,cAAc;IACd,YAAY;IACZ,WAAW;IACX,2BAA2B;IAC3B,YAAY;IACZ,UAAU;IACV,aAAa;IACb,cAAc;IACd,YAAY;IACZ,YAAY;IACZ,OAAO;IACP,WAAW;IACX,eAAe;IACf,WAAW;IACX,WAAW;IACX,YAAY;CACJ,CAAC;AA8BX,MAAM,WAAW,GAAgB;IAC/B,GAAG,aAAa,EAAE;IAElB,gBAAgB,EAAE,CAChB,IAA0B,EAC1B,OAAuE,EACvE,EAAE;QACF,MAAM,IAAI,GAAG;YACX,QAAQ,EAAE,OAAO,EAAE,QAAQ,IAAI,OAAO;YACtC,IAAI,EAAE,OAAO,EAAE,IAAI;SACpB,CAAC;QACF,OAAO,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,YAAY,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;IAC1D,CAAC;CACF,CAAC;AAEF,kBAAe,WAAW,CAAC;AAE3B,SAAS,aAAa;IACpB,MAAM,aAAa,GAA6B,EAAE,CAAC;IACnD,KAAK,MAAM,UAAU,IAAI,eAAe,EAAE;QACxC,aAAa;QACb,aAAa,CAAC,UAAU,CAAC,GAAG,qBAAE,CAAC,UAAU,CAAC,CAAC;KAC5C;IACD,OAAO,aAAgC,CAAC;AAC1C,CAAC","sourcesContent":["/**\n * Copyright (c) Microsoft Corporation.\n * Licensed under the MIT License.\n *\n * @format\n */\n\nimport fs from 'graceful-fs';\n\nconst importedMethods = [\n 'accessSync',\n 'appendFileSync',\n 'chmodSync',\n 'chownSync',\n 'closeSync',\n 'copyFileSync',\n 'createReadStream',\n 'createWriteStream',\n 'existsSync',\n 'fchmodSync',\n 'fchownSync',\n 'fdatasyncSync',\n 'fstatSync',\n 'fsyncSync',\n 'ftruncateSync',\n 'futimesSync',\n 'lchmodSync',\n 'lchownSync',\n // Not available in Node 12\n // 'lutimesSync',\n 'linkSync',\n 'lstatSync',\n 'mkdirSync',\n 'mkdtempSync',\n 'opendirSync',\n 'openSync',\n 'readdirSync',\n 'readlinkSync',\n 'readFileSync',\n 'readSync',\n // Not available in Node 12\n // 'readvSync',\n 'realpathSync',\n 'realpathSync',\n 'renameSync',\n 'rmdirSync',\n // Not available in Node 12\n // 'rmSync',\n 'statSync',\n 'symlinkSync',\n 'truncateSync',\n 'unlinkSync',\n 'utimesSync',\n 'watch',\n 'watchFile',\n 'writeFileSync',\n 'writeSync',\n 'writeSync',\n 'writevSync',\n] as const;\n\ntype ValueOf<T extends readonly any[]> = T[number];\ntype ImportedMethodNames = ValueOf<typeof importedMethods>;\ntype ImportedMethods = Pick<typeof fs, ImportedMethodNames>;\n\ntype ExtraMethods = {\n /**\n * Synchronously reads the contents of a file, then parses it as JSON.\n *\n * By default the parsed JSON file is assumed to be a JSON object, with no\n * assumptions made about content (`Record<string, unknown`). If the type is\n * known at call-time, it can be passed to this function to alter the return\n * type.This type is not validated to be correct at runtime.\n *\n * E.g. `fs.readJsonFileSync<Document>(documentPath)`;\n *\n * @param path A path to a file.\n * @param options Optional set of options\n * @param options.encoding The encoding of the JSON file (defaults to utf-8)\n * @param options.flag File access flags\n */\n readJsonFileSync: <T = Record<string, unknown>>(\n path: fs.PathLike | number,\n options?: {encoding?: null | BufferEncoding; flag?: string | undefined},\n ) => T;\n};\n\nexport type SyncMethods = ImportedMethods & ExtraMethods;\n\nconst syncMethods: SyncMethods = {\n ...importMethods(),\n\n readJsonFileSync: (\n path: fs.PathLike | number,\n options?: {encoding?: null | BufferEncoding; flag?: string | undefined},\n ) => {\n const opts = {\n encoding: options?.encoding || 'utf-8',\n flag: options?.flag,\n };\n return JSON.parse(syncMethods.readFileSync(path, opts));\n },\n};\n\nexport default syncMethods;\n\nfunction importMethods(): ImportedMethods {\n const copiedMethods: Partial<ImportedMethods> = {};\n for (const methodName of importedMethods) {\n // @ts-ignore\n copiedMethods[methodName] = fs[methodName];\n }\n return copiedMethods as ImportedMethods;\n}\n"]} |
+2
-2
| { | ||
| "name": "@react-native-windows/fs", | ||
| "description": "A minimal-dependency drop-in replacement to `fs` with changes for resiliency, promises, and convenience.", | ||
| "version": "0.81.0", | ||
| "version": "0.81.1", | ||
| "license": "MIT", | ||
@@ -39,3 +39,3 @@ "scripts": { | ||
| "beachball": { | ||
| "defaultNpmTag": "latest", | ||
| "defaultNpmTag": "v0.81-stable", | ||
| "disallowedChangeTypes": [ | ||
@@ -42,0 +42,0 @@ "major", |
168539
-0.17%