first commit

This commit is contained in:
2026-03-10 16:18:05 +00:00
commit 11f9c069b5
31635 changed files with 3187747 additions and 0 deletions

22
node_modules/@expo/json-file/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,22 @@
The MIT License (MIT)
Copyright (c) 2015-present 650 Industries, Inc. (aka Expo)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

29
node_modules/@expo/json-file/README.md generated vendored Normal file
View File

@@ -0,0 +1,29 @@
<!-- Title -->
<h1 align="center">
👋 Welcome to <br><code>@expo/json-file</code>
</h1>
<p align="center">A library for reading and writing JSON files.</p>
<!-- Body -->
## 🏁 Setup
Install `@expo/json-file` in your project.
```sh
yarn add @expo/json-file
```
## ⚽️ Usage
```ts
import JsonFile, { JSONObject } from '@expo/json-file';
// Create a file instance
const jsonFile = new JsonFile<JSONObject>(filePath);
// Interact with the file
await jsonFile.readAsync();
await jsonFile.writeAsync({ some: 'data' });
```

82
node_modules/@expo/json-file/build/JsonFile.d.ts generated vendored Normal file
View File

@@ -0,0 +1,82 @@
export type JSONValue = boolean | number | string | null | JSONArray | JSONObject;
export interface JSONArray extends Array<JSONValue> {
}
export interface JSONObject {
[key: string]: JSONValue | undefined;
}
type Defined<T> = T extends undefined ? never : T;
type Options<TJSONObject extends JSONObject> = {
badJsonDefault?: TJSONObject;
jsonParseErrorDefault?: TJSONObject;
cantReadFileDefault?: TJSONObject;
ensureDir?: boolean;
default?: TJSONObject;
json5?: boolean;
space?: number;
addNewLineAtEOF?: boolean;
};
/**
* The JsonFile class represents the contents of json file.
*
* It's polymorphic on "JSONObject", which is a simple type representing
* and object with string keys and either objects or primitive types as values.
* @type {[type]}
*/
export default class JsonFile<TJSONObject extends JSONObject> {
file: string;
options: Options<TJSONObject>;
static read: typeof read;
static readAsync: typeof readAsync;
static parseJsonString: typeof parseJsonString;
static write: typeof write;
static writeAsync: typeof writeAsync;
static get: typeof getSync;
static getAsync: typeof getAsync;
static set: typeof setSync;
static setAsync: typeof setAsync;
static merge: typeof merge;
static mergeAsync: typeof mergeAsync;
static deleteKey: typeof deleteKey;
static deleteKeyAsync: typeof deleteKeyAsync;
static deleteKeys: typeof deleteKeys;
static deleteKeysAsync: typeof deleteKeysAsync;
static rewrite: typeof rewrite;
static rewriteAsync: typeof rewriteAsync;
constructor(file: string, options?: Options<TJSONObject>);
read(options?: Options<TJSONObject>): TJSONObject;
readAsync(options?: Options<TJSONObject>): Promise<TJSONObject>;
write(object: TJSONObject, options?: Options<TJSONObject>): TJSONObject;
writeAsync(object: TJSONObject, options?: Options<TJSONObject>): Promise<TJSONObject>;
parseJsonString(json: string, options?: Options<TJSONObject>): TJSONObject;
get<K extends keyof TJSONObject, TDefault extends TJSONObject[K] | null>(key: K, defaultValue: TDefault, options?: Options<TJSONObject>): Defined<TJSONObject[K]> | TDefault;
getAsync<K extends keyof TJSONObject, TDefault extends TJSONObject[K] | null>(key: K, defaultValue: TDefault, options?: Options<TJSONObject>): Promise<Defined<TJSONObject[K]> | TDefault>;
set(key: string, value: unknown, options?: Options<TJSONObject>): TJSONObject;
setAsync(key: string, value: unknown, options?: Options<TJSONObject>): Promise<TJSONObject>;
merge(sources: Partial<TJSONObject> | Partial<TJSONObject>[], options?: Options<TJSONObject>): Promise<TJSONObject>;
mergeAsync(sources: Partial<TJSONObject> | Partial<TJSONObject>[], options?: Options<TJSONObject>): Promise<TJSONObject>;
deleteKey(key: string, options?: Options<TJSONObject>): TJSONObject;
deleteKeyAsync(key: string, options?: Options<TJSONObject>): Promise<TJSONObject>;
deleteKeys(keys: string[], options?: Options<TJSONObject>): TJSONObject;
deleteKeysAsync(keys: string[], options?: Options<TJSONObject>): Promise<TJSONObject>;
rewrite(options?: Options<TJSONObject>): TJSONObject;
rewriteAsync(options?: Options<TJSONObject>): Promise<TJSONObject>;
_getOptions(options?: Options<TJSONObject>): Options<TJSONObject>;
}
declare function read<TJSONObject extends JSONObject>(file: string, options?: Options<TJSONObject>): TJSONObject;
declare function readAsync<TJSONObject extends JSONObject>(file: string, options?: Options<TJSONObject>): Promise<TJSONObject>;
declare function parseJsonString<TJSONObject extends JSONObject>(json: string, options?: Options<TJSONObject>, fileName?: string): TJSONObject;
declare function getSync<TJSONObject extends JSONObject, K extends keyof TJSONObject, DefaultValue>(file: string, key: K, defaultValue: DefaultValue, options?: Options<TJSONObject>): any;
declare function getAsync<TJSONObject extends JSONObject, K extends keyof TJSONObject, DefaultValue>(file: string, key: K, defaultValue: DefaultValue, options?: Options<TJSONObject>): Promise<any>;
declare function write<TJSONObject extends JSONObject>(file: string, object: TJSONObject, options?: Options<TJSONObject>): TJSONObject;
declare function writeAsync<TJSONObject extends JSONObject>(file: string, object: TJSONObject, options?: Options<TJSONObject>): Promise<TJSONObject>;
declare function setSync<TJSONObject extends JSONObject>(file: string, key: string, value: unknown, options?: Options<TJSONObject>): TJSONObject;
declare function setAsync<TJSONObject extends JSONObject>(file: string, key: string, value: unknown, options?: Options<TJSONObject>): Promise<TJSONObject>;
declare function mergeAsync<TJSONObject extends JSONObject>(file: string, sources: Partial<TJSONObject> | Partial<TJSONObject>[], options?: Options<TJSONObject>): Promise<TJSONObject>;
declare function merge<TJSONObject extends JSONObject>(file: string, sources: Partial<TJSONObject> | Partial<TJSONObject>[], options?: Options<TJSONObject>): TJSONObject;
declare function deleteKeyAsync<TJSONObject extends JSONObject>(file: string, key: string, options?: Options<TJSONObject>): Promise<TJSONObject>;
declare function deleteKey<TJSONObject extends JSONObject>(file: string, key: string, options?: Options<TJSONObject>): TJSONObject;
declare function deleteKeysAsync<TJSONObject extends JSONObject>(file: string, keys: string[], options?: Options<TJSONObject>): Promise<TJSONObject>;
declare function deleteKeys<TJSONObject extends JSONObject>(file: string, keys: string[], options?: Options<TJSONObject>): TJSONObject;
declare function rewriteAsync<TJSONObject extends JSONObject>(file: string, options?: Options<TJSONObject>): Promise<TJSONObject>;
declare function rewrite<TJSONObject extends JSONObject>(file: string, options?: Options<TJSONObject>): TJSONObject;
export {};

389
node_modules/@expo/json-file/build/JsonFile.js generated vendored Normal file
View File

@@ -0,0 +1,389 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || (function () {
var ownKeys = function(o) {
ownKeys = Object.getOwnPropertyNames || function (o) {
var ar = [];
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
return ar;
};
return ownKeys(o);
};
return function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
__setModuleDefault(result, mod);
return result;
};
})();
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const json5_1 = __importDefault(require("json5"));
const node_fs_1 = __importDefault(require("node:fs"));
const node_path_1 = __importDefault(require("node:path"));
const JsonFileError_1 = __importStar(require("./JsonFileError"));
const writeAtomic_1 = require("./writeAtomic");
const DEFAULT_OPTIONS = {
badJsonDefault: undefined,
jsonParseErrorDefault: undefined,
cantReadFileDefault: undefined,
ensureDir: false,
default: undefined,
json5: false,
space: 2,
addNewLineAtEOF: true,
};
/**
* The JsonFile class represents the contents of json file.
*
* It's polymorphic on "JSONObject", which is a simple type representing
* and object with string keys and either objects or primitive types as values.
* @type {[type]}
*/
class JsonFile {
file;
options;
static read = read;
static readAsync = readAsync;
static parseJsonString = parseJsonString;
static write = write;
static writeAsync = writeAsync;
static get = getSync;
static getAsync = getAsync;
static set = setSync;
static setAsync = setAsync;
static merge = merge;
static mergeAsync = mergeAsync;
static deleteKey = deleteKey;
static deleteKeyAsync = deleteKeyAsync;
static deleteKeys = deleteKeys;
static deleteKeysAsync = deleteKeysAsync;
static rewrite = rewrite;
static rewriteAsync = rewriteAsync;
constructor(file, options = {}) {
this.file = file;
this.options = options;
}
read(options) {
return read(this.file, this._getOptions(options));
}
async readAsync(options) {
return readAsync(this.file, this._getOptions(options));
}
write(object, options) {
return write(this.file, object, this._getOptions(options));
}
async writeAsync(object, options) {
return writeAsync(this.file, object, this._getOptions(options));
}
parseJsonString(json, options) {
return parseJsonString(json, options);
}
get(key, defaultValue, options) {
return getSync(this.file, key, defaultValue, this._getOptions(options));
}
async getAsync(key, defaultValue, options) {
return getAsync(this.file, key, defaultValue, this._getOptions(options));
}
set(key, value, options) {
return setSync(this.file, key, value, this._getOptions(options));
}
async setAsync(key, value, options) {
return setAsync(this.file, key, value, this._getOptions(options));
}
async merge(sources, options) {
return merge(this.file, sources, this._getOptions(options));
}
async mergeAsync(sources, options) {
return mergeAsync(this.file, sources, this._getOptions(options));
}
deleteKey(key, options) {
return deleteKey(this.file, key, this._getOptions(options));
}
async deleteKeyAsync(key, options) {
return deleteKeyAsync(this.file, key, this._getOptions(options));
}
deleteKeys(keys, options) {
return deleteKeys(this.file, keys, this._getOptions(options));
}
async deleteKeysAsync(keys, options) {
return deleteKeysAsync(this.file, keys, this._getOptions(options));
}
rewrite(options) {
return rewrite(this.file, this._getOptions(options));
}
async rewriteAsync(options) {
return rewriteAsync(this.file, this._getOptions(options));
}
_getOptions(options) {
return {
...this.options,
...options,
};
}
}
exports.default = JsonFile;
function read(file, options) {
let json;
try {
json = node_fs_1.default.readFileSync(file, 'utf8');
}
catch (error) {
assertEmptyJsonString(json, file);
const defaultValue = cantReadFileDefault(options);
if (defaultValue === undefined) {
throw new JsonFileError_1.default(`Can't read JSON file: ${file}`, error, error.code, file);
}
else {
return defaultValue;
}
}
return parseJsonString(json, options, file);
}
async function readAsync(file, options) {
let json;
try {
json = await node_fs_1.default.promises.readFile(file, 'utf8');
}
catch (error) {
assertEmptyJsonString(json, file);
const defaultValue = cantReadFileDefault(options);
if (defaultValue === undefined) {
throw new JsonFileError_1.default(`Can't read JSON file: ${file}`, error, error.code);
}
else {
return defaultValue;
}
}
return parseJsonString(json, options);
}
function parseJsonString(json, options, fileName) {
assertEmptyJsonString(json, fileName);
try {
if (_getOption(options, 'json5')) {
return json5_1.default.parse(json);
}
else {
return JSON.parse(json);
}
}
catch (e) {
const defaultValue = jsonParseErrorDefault(options);
if (defaultValue === undefined) {
const location = locationFromSyntaxError(e, json);
if (location) {
const { codeFrameColumns, } = require('@babel/code-frame');
const codeFrame = codeFrameColumns(json, { start: location });
e.codeFrame = codeFrame;
e.message += `\n${codeFrame}`;
}
throw new JsonFileError_1.default(`Error parsing JSON: ${json}`, e, 'EJSONPARSE', fileName);
}
else {
return defaultValue;
}
}
}
function getSync(file, key, defaultValue, options) {
const object = read(file, options);
if (key in object) {
return object[key];
}
if (defaultValue === undefined) {
throw new JsonFileError_1.default(`No value at key path "${String(key)}" in JSON object from: ${file}`);
}
return defaultValue;
}
async function getAsync(file, key, defaultValue, options) {
const object = await readAsync(file, options);
if (key in object) {
return object[key];
}
if (defaultValue === undefined) {
throw new JsonFileError_1.default(`No value at key path "${String(key)}" in JSON object from: ${file}`);
}
return defaultValue;
}
function write(file, object, options) {
if (options?.ensureDir) {
node_fs_1.default.mkdirSync(node_path_1.default.dirname(file), { recursive: true });
}
const space = _getOption(options, 'space');
const json5 = _getOption(options, 'json5');
const addNewLineAtEOF = _getOption(options, 'addNewLineAtEOF');
let json;
try {
if (json5) {
json = json5_1.default.stringify(object, null, space);
}
else {
json = JSON.stringify(object, null, space);
}
}
catch (e) {
throw new JsonFileError_1.default(`Couldn't JSON.stringify object for file: ${file}`, e);
}
const data = addNewLineAtEOF ? `${json}\n` : json;
(0, writeAtomic_1.writeFileAtomicSync)(file, data);
return object;
}
async function writeAsync(file, object, options) {
if (options?.ensureDir) {
await node_fs_1.default.promises.mkdir(node_path_1.default.dirname(file), { recursive: true });
}
const space = _getOption(options, 'space');
const json5 = _getOption(options, 'json5');
const addNewLineAtEOF = _getOption(options, 'addNewLineAtEOF');
let json;
try {
if (json5) {
json = json5_1.default.stringify(object, null, space);
}
else {
json = JSON.stringify(object, null, space);
}
}
catch (e) {
throw new JsonFileError_1.default(`Couldn't JSON.stringify object for file: ${file}`, e);
}
const data = addNewLineAtEOF ? `${json}\n` : json;
await (0, writeAtomic_1.writeFileAtomic)(file, data);
return object;
}
function setSync(file, key, value, options) {
// TODO: Consider implementing some kind of locking mechanism, but
// it's not critical for our use case, so we'll leave it out for now
const object = read(file, options);
return write(file, { ...object, [key]: value }, options);
}
async function setAsync(file, key, value, options) {
// TODO: Consider implementing some kind of locking mechanism, but
// it's not critical for our use case, so we'll leave it out for now
const object = await readAsync(file, options);
return writeAsync(file, { ...object, [key]: value }, options);
}
async function mergeAsync(file, sources, options) {
const object = await readAsync(file, options);
if (Array.isArray(sources)) {
Object.assign(object, ...sources);
}
else {
Object.assign(object, sources);
}
return writeAsync(file, object, options);
}
function merge(file, sources, options) {
const object = read(file, options);
if (Array.isArray(sources)) {
Object.assign(object, ...sources);
}
else {
Object.assign(object, sources);
}
return write(file, object, options);
}
async function deleteKeyAsync(file, key, options) {
return deleteKeysAsync(file, [key], options);
}
function deleteKey(file, key, options) {
return deleteKeys(file, [key], options);
}
async function deleteKeysAsync(file, keys, options) {
const object = await readAsync(file, options);
let didDelete = false;
for (let i = 0; i < keys.length; i++) {
const key = keys[i];
if (object.hasOwnProperty(key)) {
delete object[key];
didDelete = true;
}
}
if (didDelete) {
return writeAsync(file, object, options);
}
return object;
}
function deleteKeys(file, keys, options) {
const object = read(file, options);
let didDelete = false;
for (let i = 0; i < keys.length; i++) {
const key = keys[i];
if (object.hasOwnProperty(key)) {
delete object[key];
didDelete = true;
}
}
if (didDelete) {
return write(file, object, options);
}
return object;
}
async function rewriteAsync(file, options) {
const object = await readAsync(file, options);
return writeAsync(file, object, options);
}
function rewrite(file, options) {
return write(file, read(file, options), options);
}
function jsonParseErrorDefault(options = {}) {
if (options.jsonParseErrorDefault === undefined) {
return options.default;
}
else {
return options.jsonParseErrorDefault;
}
}
function cantReadFileDefault(options = {}) {
if (options.cantReadFileDefault === undefined) {
return options.default;
}
else {
return options.cantReadFileDefault;
}
}
function _getOption(options, field) {
if (options) {
if (options[field] !== undefined) {
return options[field];
}
}
return DEFAULT_OPTIONS[field];
}
function locationFromSyntaxError(error, sourceString) {
// JSON5 SyntaxError has lineNumber and columnNumber.
if ('lineNumber' in error && 'columnNumber' in error) {
return { line: error.lineNumber, column: error.columnNumber };
}
// JSON SyntaxError only includes the index in the message.
const match = /at position (\d+)/.exec(error.message);
if (match) {
const index = parseInt(match[1], 10);
const lines = sourceString.slice(0, index + 1).split('\n');
return { line: lines.length, column: lines[lines.length - 1].length };
}
return null;
}
function assertEmptyJsonString(json, file) {
if (json?.trim() === '') {
throw new JsonFileError_1.EmptyJsonFileError(file);
}
}
//# sourceMappingURL=JsonFile.js.map

1
node_modules/@expo/json-file/build/JsonFile.js.map generated vendored Normal file

File diff suppressed because one or more lines are too long

13
node_modules/@expo/json-file/build/JsonFileError.d.ts generated vendored Normal file
View File

@@ -0,0 +1,13 @@
/**
* Note that instances of this class do NOT pass `instanceof JsonFileError`.
*/
export default class JsonFileError extends Error {
cause: Error | undefined;
code: string | undefined;
fileName: string | undefined;
isJsonFileError: true;
constructor(message: string, cause?: Error, code?: string, fileName?: string);
}
export declare class EmptyJsonFileError extends JsonFileError {
constructor(fileName?: string);
}

35
node_modules/@expo/json-file/build/JsonFileError.js generated vendored Normal file
View File

@@ -0,0 +1,35 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.EmptyJsonFileError = void 0;
/**
* Note that instances of this class do NOT pass `instanceof JsonFileError`.
*/
class JsonFileError extends Error {
cause;
code;
fileName;
isJsonFileError;
constructor(message, cause, code, fileName) {
let fullMessage = message;
if (fileName) {
fullMessage += `\n${cause ? '├' : '└'}─ File: ${fileName}`;
}
if (cause) {
fullMessage += `\n└─ Cause: ${cause.name}: ${cause.message}`;
}
super(fullMessage);
this.name = this.constructor.name;
this.cause = cause;
this.code = code;
this.fileName = fileName;
this.isJsonFileError = true;
}
}
exports.default = JsonFileError;
class EmptyJsonFileError extends JsonFileError {
constructor(fileName) {
super(`Cannot parse an empty JSON string`, undefined, 'EJSONEMPTY', fileName);
}
}
exports.EmptyJsonFileError = EmptyJsonFileError;
//# sourceMappingURL=JsonFileError.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"JsonFileError.js","sourceRoot":"","sources":["../src/JsonFileError.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,MAAqB,aAAc,SAAQ,KAAK;IAC9C,KAAK,CAAoB;IACzB,IAAI,CAAqB;IACzB,QAAQ,CAAqB;IAC7B,eAAe,CAAO;IAEtB,YAAY,OAAe,EAAE,KAAa,EAAE,IAAa,EAAE,QAAiB;QAC1E,IAAI,WAAW,GAAG,OAAO,CAAC;QAC1B,IAAI,QAAQ,EAAE,CAAC;YACb,WAAW,IAAI,KAAK,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,WAAW,QAAQ,EAAE,CAAC;QAC7D,CAAC;QACD,IAAI,KAAK,EAAE,CAAC;YACV,WAAW,IAAI,eAAe,KAAK,CAAC,IAAI,KAAK,KAAK,CAAC,OAAO,EAAE,CAAC;QAC/D,CAAC;QACD,KAAK,CAAC,WAAW,CAAC,CAAC;QACnB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC;QAClC,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC;IAC9B,CAAC;CACF;AArBD,gCAqBC;AAED,MAAa,kBAAmB,SAAQ,aAAa;IACnD,YAAY,QAAiB;QAC3B,KAAK,CAAC,mCAAmC,EAAE,SAAS,EAAE,YAAY,EAAE,QAAQ,CAAC,CAAC;IAChF,CAAC;CACF;AAJD,gDAIC"}

2
node_modules/@expo/json-file/build/writeAtomic.d.ts generated vendored Normal file
View File

@@ -0,0 +1,2 @@
export declare function writeFileAtomicSync(filename: string, data: string | Buffer): void;
export declare function writeFileAtomic(filename: string, data: string | Buffer): Promise<void>;

54
node_modules/@expo/json-file/build/writeAtomic.js generated vendored Normal file
View File

@@ -0,0 +1,54 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || (function () {
var ownKeys = function(o) {
ownKeys = Object.getOwnPropertyNames || function (o) {
var ar = [];
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
return ar;
};
return ownKeys(o);
};
return function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
__setModuleDefault(result, mod);
return result;
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.writeFileAtomicSync = writeFileAtomicSync;
exports.writeFileAtomic = writeFileAtomic;
const node_crypto_1 = require("node:crypto");
const fs = __importStar(require("node:fs"));
function getTarget(filename, data) {
const hash = (0, node_crypto_1.createHash)('sha256').update(data).digest('base64url');
return `${filename}.${hash}`;
}
function writeFileAtomicSync(filename, data) {
const tmpfile = getTarget(filename, data);
fs.writeFileSync(tmpfile, data);
fs.renameSync(tmpfile, filename);
}
async function writeFileAtomic(filename, data) {
const tmpfile = getTarget(filename, data);
await fs.promises.writeFile(tmpfile, data);
await fs.promises.rename(tmpfile, filename);
}
//# sourceMappingURL=writeAtomic.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"writeAtomic.js","sourceRoot":"","sources":["../src/writeAtomic.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAQA,kDAIC;AAED,0CAIC;AAlBD,6CAAyC;AACzC,4CAA8B;AAE9B,SAAS,SAAS,CAAC,QAAgB,EAAE,IAAqB;IACxD,MAAM,IAAI,GAAG,IAAA,wBAAU,EAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;IACnE,OAAO,GAAG,QAAQ,IAAI,IAAI,EAAE,CAAC;AAC/B,CAAC;AAED,SAAgB,mBAAmB,CAAC,QAAgB,EAAE,IAAqB;IACzE,MAAM,OAAO,GAAG,SAAS,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;IAC1C,EAAE,CAAC,aAAa,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;IAChC,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;AACnC,CAAC;AAEM,KAAK,UAAU,eAAe,CAAC,QAAgB,EAAE,IAAqB;IAC3E,MAAM,OAAO,GAAG,SAAS,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;IAC1C,MAAM,EAAE,CAAC,QAAQ,CAAC,SAAS,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;IAC3C,MAAM,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;AAC9C,CAAC"}

46
node_modules/@expo/json-file/package.json generated vendored Normal file
View File

@@ -0,0 +1,46 @@
{
"name": "@expo/json-file",
"version": "10.0.12",
"description": "A module for reading, writing, and manipulating JSON files",
"main": "build/JsonFile.js",
"scripts": {
"build": "expo-module tsc",
"clean": "expo-module clean",
"lint": "expo-module lint",
"prepare": "expo-module clean && expo-module tsc",
"prepublishOnly": "expo-module prepublishOnly",
"test": "expo-module test",
"typecheck": "expo-module typecheck",
"watch": "expo-module tsc --watch --preserveWatchOutput"
},
"repository": {
"type": "git",
"url": "https://github.com/expo/expo.git",
"directory": "packages/@expo/json-file"
},
"keywords": [
"json"
],
"license": "MIT",
"bugs": {
"url": "https://github.com/expo/expo/issues"
},
"homepage": "https://github.com/expo/expo/tree/main/packages/@expo/json-file#readme",
"files": [
"build"
],
"dependencies": {
"@babel/code-frame": "^7.20.0",
"json5": "^2.2.3"
},
"devDependencies": {
"@types/babel__code-frame": "^7.27.0",
"@types/json5": "^2.2.0",
"expo-module-scripts": "^55.0.2",
"memfs": "^3.2.0"
},
"publishConfig": {
"access": "public"
},
"gitHead": "436ffb4355d5207f4a03fbc3568cd33424a40f3e"
}