This commit is contained in:
Yamozha
2021-04-02 02:24:13 +03:00
parent c23950b545
commit 7256d79e2c
31493 changed files with 3036630 additions and 0 deletions

3
node_modules/@expo/plist/README.md generated vendored Normal file
View File

@ -0,0 +1,3 @@
# plist [![CircleCI](https://circleci.com/gh/expo/plist.svg?style=svg)](https://circleci.com/gh/expo/plist)
Mac OS X Plist parser/builder for Node.js and browsers, forked from this [repo](https://github.com/TooTallNate/plist.js)

11
node_modules/@expo/plist/build/build.d.ts generated vendored Normal file
View File

@ -0,0 +1,11 @@
/**
* Generate an XML plist string from the input object `obj`.
*
* @param {Object} obj - the object to convert
* @param {Object} [opts] - optional options object
* @returns {String} converted plist XML string
* @api public
*/
export declare function build(obj: any, opts?: {
[key: string]: any;
}): string;

151
node_modules/@expo/plist/build/build.js generated vendored Normal file
View File

@ -0,0 +1,151 @@
"use strict";
/* eslint-disable */
/* (The MIT License)
Copyright (c) 2010-2017 Nathan Rajlich <nathan@tootallnate.net>
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. */
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const base64_js_1 = __importDefault(require("base64-js"));
const xmlbuilder_1 = __importDefault(require("xmlbuilder"));
/**
* Accepts a `Date` instance and returns an ISO date string.
*
* @param {Date} d - Date instance to serialize
* @returns {String} ISO date string representation of `d`
* @api private
*/
function ISODateString(d) {
function pad(n) {
return n < 10 ? '0' + n : n;
}
return (d.getUTCFullYear() +
'-' +
pad(d.getUTCMonth() + 1) +
'-' +
pad(d.getUTCDate()) +
'T' +
pad(d.getUTCHours()) +
':' +
pad(d.getUTCMinutes()) +
':' +
pad(d.getUTCSeconds()) +
'Z');
}
/**
* Returns the internal "type" of `obj` via the
* `Object.prototype.toString()` trick.
*
* @param {Mixed} obj - any value
* @returns {String} the internal "type" name
* @api private
*/
const toString = Object.prototype.toString;
function type(obj) {
const m = toString.call(obj).match(/\[object (.*)\]/);
return m ? m[1] : m;
}
/**
* Generate an XML plist string from the input object `obj`.
*
* @param {Object} obj - the object to convert
* @param {Object} [opts] - optional options object
* @returns {String} converted plist XML string
* @api public
*/
function build(obj, opts) {
const XMLHDR = {
version: '1.0',
encoding: 'UTF-8',
};
const XMLDTD = {
pubid: '-//Apple//DTD PLIST 1.0//EN',
sysid: 'http://www.apple.com/DTDs/PropertyList-1.0.dtd',
};
const doc = xmlbuilder_1.default.create('plist');
doc.dec(XMLHDR.version, XMLHDR.encoding, XMLHDR.standalone);
doc.dtd(XMLDTD.pubid, XMLDTD.sysid);
doc.att('version', '1.0');
walk_obj(obj, doc);
if (!opts)
opts = {};
// default `pretty` to `true`
opts.pretty = opts.pretty !== false;
return doc.end(opts);
}
exports.build = build;
/**
* depth first, recursive traversal of a javascript object. when complete,
* next_child contains a reference to the build XML object.
*
* @api private
*/
function walk_obj(next, next_child) {
let tag_type, i, prop;
const name = type(next);
if (name == 'Undefined') {
}
else if (Array.isArray(next)) {
next_child = next_child.ele('array');
for (i = 0; i < next.length; i++) {
walk_obj(next[i], next_child);
}
}
else if (Buffer.isBuffer(next)) {
next_child.ele('data').raw(next.toString('base64'));
}
else if (name == 'Object') {
next_child = next_child.ele('dict');
for (prop in next) {
if (next.hasOwnProperty(prop)) {
next_child.ele('key').txt(prop);
walk_obj(next[prop], next_child);
}
}
}
else if (name == 'Number') {
// detect if this is an integer or real
// TODO: add an ability to force one way or another via a "cast"
tag_type = next % 1 === 0 ? 'integer' : 'real';
next_child.ele(tag_type).txt(next.toString());
}
else if (name == 'Date') {
next_child.ele('date').txt(ISODateString(new Date(next)));
}
else if (name == 'Boolean') {
next_child.ele(next ? 'true' : 'false');
}
else if (name == 'String') {
next_child.ele('string').txt(next);
}
else if (name == 'ArrayBuffer') {
next_child.ele('data').raw(base64_js_1.default.fromByteArray(next));
}
else if (next && next.buffer && type(next.buffer) == 'ArrayBuffer') {
// a typed array
next_child.ele('data').raw(base64_js_1.default.fromByteArray(new Uint8Array(next.buffer)));
}
}
//# sourceMappingURL=build.js.map

1
node_modules/@expo/plist/build/build.js.map generated vendored Normal file

File diff suppressed because one or more lines are too long

16
node_modules/@expo/plist/build/index.d.ts generated vendored Normal file
View File

@ -0,0 +1,16 @@
/// <reference types="node" />
import { XMLToStringOptions } from 'xmlbuilder';
import { build } from './build';
import { parse } from './parse';
export declare type PlistValue = string | number | boolean | Date | Buffer | PlistObject | PlistArray;
export interface PlistObject {
readonly [x: string]: PlistValue;
}
export interface PlistArray extends ReadonlyArray<PlistValue> {
}
export declare type PlistBuildOptions = XMLToStringOptions;
declare const _default: {
parse: typeof parse;
build: typeof build;
};
export default _default;

6
node_modules/@expo/plist/build/index.js generated vendored Normal file
View File

@ -0,0 +1,6 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const build_1 = require("./build");
const parse_1 = require("./parse");
exports.default = { parse: parse_1.parse, build: build_1.build };
//# sourceMappingURL=index.js.map

1
node_modules/@expo/plist/build/index.js.map generated vendored Normal file
View File

@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;AAEA,mCAAgC;AAChC,mCAAgC;AAahC,kBAAe,EAAE,KAAK,EAAL,aAAK,EAAE,KAAK,EAAL,aAAK,EAAE,CAAC","sourcesContent":["import { XMLToStringOptions } from 'xmlbuilder';\n\nimport { build } from './build';\nimport { parse } from './parse';\n\n// PlistValue\nexport type PlistValue = string | number | boolean | Date | Buffer | PlistObject | PlistArray;\nexport interface PlistObject {\n readonly [x: string]: PlistValue;\n}\nexport interface PlistArray extends ReadonlyArray<PlistValue> {}\n\n// PlistBuildOptions\n// The instance of this type is passed to 'xmlbuilder' module as it is.\nexport type PlistBuildOptions = XMLToStringOptions;\n\nexport default { parse, build };\n"]}

8
node_modules/@expo/plist/build/parse.d.ts generated vendored Normal file
View File

@ -0,0 +1,8 @@
/**
* Parses a Plist XML string. Returns an Object.
*
* @param {String} xml - the XML String to decode
* @returns {Mixed} the decoded value from the Plist XML
* @api public
*/
export declare function parse(xml: string): any;

200
node_modules/@expo/plist/build/parse.js generated vendored Normal file
View File

@ -0,0 +1,200 @@
"use strict";
/* eslint-disable */
/* (The MIT License)
Copyright (c) 2010-2017 Nathan Rajlich <nathan@tootallnate.net>
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. */
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const assert_1 = __importDefault(require("assert"));
const xmldom_1 = require("xmldom");
const TEXT_NODE = 3;
const CDATA_NODE = 4;
const COMMENT_NODE = 8;
/**
* We ignore raw text (usually whitespace), <!-- xml comments -->,
* and raw CDATA nodes.
*
* @param {Element} node
* @returns {Boolean}
* @api private
*/
function shouldIgnoreNode(node) {
return (node.nodeType === TEXT_NODE || node.nodeType === COMMENT_NODE || node.nodeType === CDATA_NODE);
}
/**
* Check if the node is empty. Some plist file has such node:
* <key />
* this node shoud be ignored.
*
* @see https://github.com/TooTallNate/plist.js/issues/66
* @param {Element} node
* @returns {Boolean}
* @api private
*/
function isEmptyNode(node) {
return !node.childNodes || node.childNodes.length === 0;
}
/**
* Parses a Plist XML string. Returns an Object.
*
* @param {String} xml - the XML String to decode
* @returns {Mixed} the decoded value from the Plist XML
* @api public
*/
function parse(xml) {
// prevent the parser from logging non-fatel errors
const doc = new xmldom_1.DOMParser({ errorHandler() { } }).parseFromString(xml);
assert_1.default(doc.documentElement.nodeName === 'plist', 'malformed document. First element should be <plist>');
let plist = parsePlistXML(doc.documentElement);
// the root <plist> node gets interpreted as an Array,
// so pull out the inner data first
if (plist.length == 1)
plist = plist[0];
return plist;
}
exports.parse = parse;
/**
* Convert an XML based plist document into a JSON representation.
*
* @param {Object} xml_node - current XML node in the plist
* @returns {Mixed} built up JSON object
* @api private
*/
function parsePlistXML(node) {
let i, new_obj, key, new_arr, res, counter;
if (!node)
return null;
if (node.nodeName === 'plist') {
new_arr = [];
if (isEmptyNode(node)) {
return new_arr;
}
for (i = 0; i < node.childNodes.length; i++) {
if (!shouldIgnoreNode(node.childNodes[i])) {
new_arr.push(parsePlistXML(node.childNodes[i]));
}
}
return new_arr;
}
else if (node.nodeName === 'dict') {
new_obj = {};
key = null;
counter = 0;
if (isEmptyNode(node)) {
return new_obj;
}
for (i = 0; i < node.childNodes.length; i++) {
if (shouldIgnoreNode(node.childNodes[i]))
continue;
if (counter % 2 === 0) {
assert_1.default(node.childNodes[i].nodeName === 'key', 'Missing key while parsing <dict/>.');
key = parsePlistXML(node.childNodes[i]);
}
else {
assert_1.default(node.childNodes[i].nodeName !== 'key', 'Unexpected key "' + parsePlistXML(node.childNodes[i]) + '" while parsing <dict/>.');
new_obj[key] = parsePlistXML(node.childNodes[i]);
}
counter += 1;
}
if (counter % 2 === 1) {
throw new Error('Missing value for "' + key + '" while parsing <dict/>');
}
return new_obj;
}
else if (node.nodeName === 'array') {
new_arr = [];
if (isEmptyNode(node)) {
return new_arr;
}
for (i = 0; i < node.childNodes.length; i++) {
if (!shouldIgnoreNode(node.childNodes[i])) {
res = parsePlistXML(node.childNodes[i]);
if (res != null)
new_arr.push(res);
}
}
return new_arr;
}
else if (node.nodeName === '#text') {
// TODO: what should we do with text types? (CDATA sections)
}
else if (node.nodeName === 'key') {
if (isEmptyNode(node)) {
return '';
}
return node.childNodes[0].nodeValue;
}
else if (node.nodeName === 'string') {
res = '';
if (isEmptyNode(node)) {
return res;
}
for (i = 0; i < node.childNodes.length; i++) {
const type = node.childNodes[i].nodeType;
if (type === TEXT_NODE || type === CDATA_NODE) {
res += node.childNodes[i].nodeValue;
}
}
return res;
}
else if (node.nodeName === 'integer') {
assert_1.default(!isEmptyNode(node), 'Cannot parse "" as integer.');
return parseInt(node.childNodes[0].nodeValue, 10);
}
else if (node.nodeName === 'real') {
assert_1.default(!isEmptyNode(node), 'Cannot parse "" as real.');
res = '';
for (i = 0; i < node.childNodes.length; i++) {
if (node.childNodes[i].nodeType === TEXT_NODE) {
res += node.childNodes[i].nodeValue;
}
}
return parseFloat(res);
}
else if (node.nodeName === 'data') {
res = '';
if (isEmptyNode(node)) {
return Buffer.from(res, 'base64');
}
for (i = 0; i < node.childNodes.length; i++) {
if (node.childNodes[i].nodeType === TEXT_NODE) {
res += node.childNodes[i].nodeValue.replace(/\s+/g, '');
}
}
return Buffer.from(res, 'base64');
}
else if (node.nodeName === 'date') {
assert_1.default(!isEmptyNode(node), 'Cannot parse "" as Date.');
return new Date(node.childNodes[0].nodeValue);
}
else if (node.nodeName === 'true') {
return true;
}
else if (node.nodeName === 'false') {
return false;
}
}
//# sourceMappingURL=parse.js.map

1
node_modules/@expo/plist/build/parse.js.map generated vendored Normal file

File diff suppressed because one or more lines are too long

40
node_modules/@expo/plist/package.json generated vendored Normal file
View File

@ -0,0 +1,40 @@
{
"name": "@expo/plist",
"version": "0.0.12",
"description": "Mac OS X Plist parser/builder for Node.js and browsers",
"main": "build/index.js",
"scripts": {
"watch": "tsc --watch",
"build": "tsc",
"prepare": "yarn build",
"test": "jest"
},
"repository": {
"type": "git",
"url": "https://github.com/expo/expo-cli.git",
"directory": "packages/plist"
},
"keywords": [
"plist"
],
"license": "MIT",
"bugs": {
"url": "https://github.com/expo/expo-cli/issues"
},
"homepage": "https://github.com/expo/expo-cli/tree/master/packages/plist#readme",
"files": [
"build"
],
"dependencies": {
"base64-js": "^1.2.3",
"xmlbuilder": "^14.0.0",
"xmldom": "~0.5.0"
},
"devDependencies": {
"@types/base64-js": "^1.2.5",
"@types/xmldom": "^0.1.29"
},
"publishConfig": {
"access": "public"
}
}