Add capacitorjs runtime
This commit is contained in:
parent
d0ece489ee
commit
f90c0e6c40
8362 changed files with 1502407 additions and 1 deletions
21
node_modules/native-run/dist/utils/cli.js
generated
vendored
Normal file
21
node_modules/native-run/dist/utils/cli.js
generated
vendored
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.getOptionValues = exports.getOptionValue = void 0;
|
||||
function getOptionValue(args, arg, defaultValue) {
|
||||
const i = args.indexOf(arg);
|
||||
if (i >= 0) {
|
||||
return args[i + 1];
|
||||
}
|
||||
return defaultValue;
|
||||
}
|
||||
exports.getOptionValue = getOptionValue;
|
||||
function getOptionValues(args, arg) {
|
||||
const returnVal = [];
|
||||
args.map((entry, idx) => {
|
||||
if (entry === arg) {
|
||||
returnVal.push(args[idx + 1]);
|
||||
}
|
||||
});
|
||||
return returnVal;
|
||||
}
|
||||
exports.getOptionValues = getOptionValues;
|
||||
16
node_modules/native-run/dist/utils/fn.js
generated
vendored
Normal file
16
node_modules/native-run/dist/utils/fn.js
generated
vendored
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.once = void 0;
|
||||
function once(fn) {
|
||||
let called = false;
|
||||
let r;
|
||||
const wrapper = (...args) => {
|
||||
if (!called) {
|
||||
called = true;
|
||||
r = fn(...args);
|
||||
}
|
||||
return r;
|
||||
};
|
||||
return wrapper;
|
||||
}
|
||||
exports.once = once;
|
||||
12
node_modules/native-run/dist/utils/fs.js
generated
vendored
Normal file
12
node_modules/native-run/dist/utils/fs.js
generated
vendored
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.isDir = void 0;
|
||||
const utils_fs_1 = require("@ionic/utils-fs");
|
||||
async function isDir(p) {
|
||||
const stats = await (0, utils_fs_1.statSafe)(p);
|
||||
if (stats === null || stats === void 0 ? void 0 : stats.isDirectory()) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
exports.isDir = isDir;
|
||||
30
node_modules/native-run/dist/utils/ini.js
generated
vendored
Normal file
30
node_modules/native-run/dist/utils/ini.js
generated
vendored
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.writeINI = exports.readINI = void 0;
|
||||
const utils_fs_1 = require("@ionic/utils-fs");
|
||||
const Debug = require("debug");
|
||||
const util = require("util");
|
||||
const debug = Debug('native-run:android:utils:ini');
|
||||
async function readINI(p, guard = (o) => true) {
|
||||
const ini = await Promise.resolve().then(() => require('ini'));
|
||||
try {
|
||||
const contents = await (0, utils_fs_1.readFile)(p, { encoding: 'utf8' });
|
||||
const config = ini.decode(contents);
|
||||
if (!guard(config)) {
|
||||
throw new Error(`Invalid ini configuration file: ${p}\n` +
|
||||
`The following guard was used: ${guard.toString()}\n` +
|
||||
`INI config parsed as: ${util.inspect(config)}`);
|
||||
}
|
||||
return { __filename: p, ...config };
|
||||
}
|
||||
catch (e) {
|
||||
debug(e);
|
||||
}
|
||||
}
|
||||
exports.readINI = readINI;
|
||||
async function writeINI(p, o) {
|
||||
const ini = await Promise.resolve().then(() => require('ini'));
|
||||
const contents = ini.encode(o);
|
||||
await (0, utils_fs_1.writeFile)(p, contents, { encoding: 'utf8' });
|
||||
}
|
||||
exports.writeINI = writeINI;
|
||||
7
node_modules/native-run/dist/utils/json.js
generated
vendored
Normal file
7
node_modules/native-run/dist/utils/json.js
generated
vendored
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.stringify = void 0;
|
||||
function stringify(obj) {
|
||||
return JSON.stringify(obj, (k, v) => (v instanceof RegExp ? v.toString() : v), '\t');
|
||||
}
|
||||
exports.stringify = stringify;
|
||||
69
node_modules/native-run/dist/utils/list.js
generated
vendored
Normal file
69
node_modules/native-run/dist/utils/list.js
generated
vendored
Normal file
|
|
@ -0,0 +1,69 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.formatTargets = void 0;
|
||||
const utils_terminal_1 = require("@ionic/utils-terminal");
|
||||
const errors_1 = require("../errors");
|
||||
const json_1 = require("./json");
|
||||
function formatTargets(args, targets) {
|
||||
const { devices, virtualDevices, errors } = targets;
|
||||
const virtualOnly = args.includes('--virtual');
|
||||
const devicesOnly = args.includes('--device');
|
||||
if (virtualOnly && devicesOnly) {
|
||||
throw new errors_1.CLIException('Only one of --device or --virtual may be specified', errors_1.ERR_BAD_INPUT);
|
||||
}
|
||||
if (args.includes('--json')) {
|
||||
let result;
|
||||
if (virtualOnly) {
|
||||
result = { virtualDevices, errors };
|
||||
}
|
||||
else if (devicesOnly) {
|
||||
result = { devices, errors };
|
||||
}
|
||||
else {
|
||||
result = { devices, virtualDevices, errors };
|
||||
}
|
||||
return (0, json_1.stringify)(result);
|
||||
}
|
||||
let output = '';
|
||||
if (errors.length > 0) {
|
||||
output += `Errors (!):\n\n${errors.map((e) => ` ${(0, errors_1.serializeError)(e)}`)}\n`;
|
||||
}
|
||||
if (!virtualOnly) {
|
||||
output += printTargets('Connected Device', devices);
|
||||
if (devicesOnly) {
|
||||
return output;
|
||||
}
|
||||
output += '\n';
|
||||
}
|
||||
output += printTargets('Virtual Device', virtualDevices);
|
||||
return output;
|
||||
}
|
||||
exports.formatTargets = formatTargets;
|
||||
function printTargets(name, targets) {
|
||||
let output = `${name}s:\n\n`;
|
||||
if (targets.length === 0) {
|
||||
output += ` No ${name.toLowerCase()}s found\n`;
|
||||
}
|
||||
else {
|
||||
output += formatTargetTable(targets) + '\n';
|
||||
}
|
||||
return output;
|
||||
}
|
||||
function formatTargetTable(targets) {
|
||||
const spacer = (0, utils_terminal_1.indent)(2);
|
||||
return (spacer +
|
||||
(0, utils_terminal_1.columnar)(targets.map(targetToRow), {
|
||||
headers: ['Name', 'API', 'Target ID'],
|
||||
vsep: ' ',
|
||||
})
|
||||
.split('\n')
|
||||
.join(`\n${spacer}`));
|
||||
}
|
||||
function targetToRow(target) {
|
||||
var _a, _b, _c, _d;
|
||||
return [
|
||||
(_c = (_b = (_a = target.name) !== null && _a !== void 0 ? _a : target.model) !== null && _b !== void 0 ? _b : target.id) !== null && _c !== void 0 ? _c : '?',
|
||||
`${target.platform === 'ios' ? 'iOS' : 'API'} ${target.sdkVersion}`,
|
||||
(_d = target.id) !== null && _d !== void 0 ? _d : '?',
|
||||
];
|
||||
}
|
||||
11
node_modules/native-run/dist/utils/log.js
generated
vendored
Normal file
11
node_modules/native-run/dist/utils/log.js
generated
vendored
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.log = void 0;
|
||||
const json_1 = require("./json");
|
||||
function log(message) {
|
||||
if (process.argv.includes('--json')) {
|
||||
message = (0, json_1.stringify)({ message });
|
||||
}
|
||||
process.stdout.write(message);
|
||||
}
|
||||
exports.log = log;
|
||||
15
node_modules/native-run/dist/utils/object.js
generated
vendored
Normal file
15
node_modules/native-run/dist/utils/object.js
generated
vendored
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.sort = void 0;
|
||||
function sort(obj) {
|
||||
const entries = [...Object.entries(obj)];
|
||||
entries.sort(([k1], [k2]) => k1.localeCompare(k2));
|
||||
for (const [key] of entries) {
|
||||
delete obj[key];
|
||||
}
|
||||
for (const [key, value] of entries) {
|
||||
obj[key] = value;
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
exports.sort = sort;
|
||||
34
node_modules/native-run/dist/utils/process.js
generated
vendored
Normal file
34
node_modules/native-run/dist/utils/process.js
generated
vendored
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.onBeforeExit = exports.wait = exports.execFile = exports.exec = void 0;
|
||||
const cp = require("child_process");
|
||||
const Debug = require("debug");
|
||||
const util = require("util");
|
||||
const fn_1 = require("./fn");
|
||||
const debug = Debug('native-run:utils:process');
|
||||
exports.exec = util.promisify(cp.exec);
|
||||
exports.execFile = util.promisify(cp.execFile);
|
||||
exports.wait = util.promisify(setTimeout);
|
||||
const exitQueue = [];
|
||||
function onBeforeExit(fn) {
|
||||
exitQueue.push(fn);
|
||||
}
|
||||
exports.onBeforeExit = onBeforeExit;
|
||||
const BEFORE_EXIT_SIGNALS = ['SIGINT', 'SIGTERM', 'SIGHUP', 'SIGBREAK'];
|
||||
const beforeExitHandlerWrapper = (signal) => (0, fn_1.once)(async () => {
|
||||
debug('onBeforeExit handler: %s received', signal);
|
||||
debug('onBeforeExit handler: running %s queued functions', exitQueue.length);
|
||||
for (const [i, fn] of exitQueue.entries()) {
|
||||
try {
|
||||
await fn();
|
||||
}
|
||||
catch (e) {
|
||||
debug('Error from function %d in exit queue: %O', i, e);
|
||||
}
|
||||
}
|
||||
debug('onBeforeExit handler: exiting (exit code %s)', process.exitCode ? process.exitCode : 0);
|
||||
process.exit();
|
||||
});
|
||||
for (const signal of BEFORE_EXIT_SIGNALS) {
|
||||
process.on(signal, beforeExitHandlerWrapper(signal));
|
||||
}
|
||||
22
node_modules/native-run/dist/utils/unzip.js
generated
vendored
Normal file
22
node_modules/native-run/dist/utils/unzip.js
generated
vendored
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.unzip = void 0;
|
||||
const util_1 = require("util");
|
||||
async function unzip(srcPath, onEntry) {
|
||||
const yauzl = await Promise.resolve().then(() => require('yauzl'));
|
||||
return new Promise((resolve, reject) => {
|
||||
yauzl.open(srcPath, { lazyEntries: true }, (err, zipfile) => {
|
||||
if (!zipfile || err) {
|
||||
return reject(err);
|
||||
}
|
||||
const openReadStream = (0, util_1.promisify)(zipfile.openReadStream.bind(zipfile));
|
||||
zipfile.once('error', reject);
|
||||
// resolve when either one happens
|
||||
zipfile.once('close', resolve); // fd of zip closed
|
||||
zipfile.once('end', resolve); // last entry read
|
||||
zipfile.on('entry', (entry) => onEntry(entry, zipfile, openReadStream));
|
||||
zipfile.readEntry();
|
||||
});
|
||||
});
|
||||
}
|
||||
exports.unzip = unzip;
|
||||
Loading…
Add table
Add a link
Reference in a new issue