forked from olcxjas-softworks/LarpixClient
fix gitignore again
This commit is contained in:
parent
ce5a1e330b
commit
5da5c2afe2
3329 changed files with 364540 additions and 3 deletions
25
electron/node_modules/@capacitor/cli/dist/util/cli.js
generated
vendored
Normal file
25
electron/node_modules/@capacitor/cli/dist/util/cli.js
generated
vendored
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.wrapAction = exports.ENV_PATHS = void 0;
|
||||
const tslib_1 = require("tslib");
|
||||
const env_paths_1 = tslib_1.__importDefault(require("env-paths"));
|
||||
const errors_1 = require("../errors");
|
||||
const log_1 = require("../log");
|
||||
exports.ENV_PATHS = (0, env_paths_1.default)('capacitor', { suffix: '' });
|
||||
function wrapAction(action) {
|
||||
return async (...args) => {
|
||||
try {
|
||||
await action(...args);
|
||||
}
|
||||
catch (e) {
|
||||
if ((0, errors_1.isFatal)(e)) {
|
||||
process.exitCode = e.exitCode;
|
||||
log_1.logger.error(e.message);
|
||||
}
|
||||
else {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
exports.wrapAction = wrapAction;
|
||||
13
electron/node_modules/@capacitor/cli/dist/util/emoji.js
generated
vendored
Normal file
13
electron/node_modules/@capacitor/cli/dist/util/emoji.js
generated
vendored
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.emoji = void 0;
|
||||
// Emoji falback, right now just uses fallback on windows,
|
||||
// but could expand to be more sophisticated to allow emoji
|
||||
// on Hyper term on windows, for example.
|
||||
const emoji = (x, fallback) => {
|
||||
if (process.platform === 'win32') {
|
||||
return fallback;
|
||||
}
|
||||
return x;
|
||||
};
|
||||
exports.emoji = emoji;
|
||||
13
electron/node_modules/@capacitor/cli/dist/util/fn.js
generated
vendored
Normal file
13
electron/node_modules/@capacitor/cli/dist/util/fn.js
generated
vendored
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.tryFn = void 0;
|
||||
const tryFn = async (fn, ...args) => {
|
||||
try {
|
||||
return await fn(...args);
|
||||
}
|
||||
catch {
|
||||
// ignore
|
||||
}
|
||||
return null;
|
||||
};
|
||||
exports.tryFn = tryFn;
|
||||
43
electron/node_modules/@capacitor/cli/dist/util/fs.js
generated
vendored
Normal file
43
electron/node_modules/@capacitor/cli/dist/util/fs.js
generated
vendored
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.readdirp = exports.deleteFolderRecursive = exports.convertToUnixPath = void 0;
|
||||
const fs_1 = require("fs");
|
||||
const promises_1 = require("fs/promises");
|
||||
const fs_extra_1 = require("fs-extra");
|
||||
const path_1 = require("path");
|
||||
const convertToUnixPath = (path) => {
|
||||
return path.replace(/\\/g, '/');
|
||||
};
|
||||
exports.convertToUnixPath = convertToUnixPath;
|
||||
const deleteFolderRecursive = (directoryPath) => {
|
||||
if ((0, fs_extra_1.existsSync)(directoryPath)) {
|
||||
(0, fs_extra_1.readdirSync)(directoryPath).forEach((file) => {
|
||||
const curPath = (0, path_1.join)(directoryPath, file);
|
||||
if ((0, fs_extra_1.lstatSync)(curPath).isDirectory()) {
|
||||
(0, exports.deleteFolderRecursive)(curPath);
|
||||
}
|
||||
else {
|
||||
(0, fs_extra_1.unlinkSync)(curPath);
|
||||
}
|
||||
});
|
||||
(0, fs_extra_1.rmdirSync)(directoryPath);
|
||||
}
|
||||
};
|
||||
exports.deleteFolderRecursive = deleteFolderRecursive;
|
||||
async function readdirp(dir, { filter }) {
|
||||
const dirContent = await (0, promises_1.readdir)(dir, { recursive: true });
|
||||
const dirContentWalker = [];
|
||||
const filteredContent = [];
|
||||
dirContent.forEach((element) => {
|
||||
const path = (0, path_1.join)(dir, element);
|
||||
const stats = (0, fs_1.statSync)(path);
|
||||
dirContentWalker.push({ path, stats });
|
||||
});
|
||||
dirContentWalker.forEach((element) => {
|
||||
if (filter(element)) {
|
||||
filteredContent.push(element.path);
|
||||
}
|
||||
});
|
||||
return filteredContent;
|
||||
}
|
||||
exports.readdirp = readdirp;
|
||||
66
electron/node_modules/@capacitor/cli/dist/util/iosplugin.js
generated
vendored
Normal file
66
electron/node_modules/@capacitor/cli/dist/util/iosplugin.js
generated
vendored
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.generateIOSPackageJSON = exports.writePluginJSON = exports.findPluginClasses = exports.getPluginFiles = void 0;
|
||||
const fs_extra_1 = require("fs-extra");
|
||||
const path_1 = require("path");
|
||||
const cordova_1 = require("../cordova");
|
||||
const plugin_1 = require("../plugin");
|
||||
const fs_1 = require("./fs");
|
||||
async function getPluginFiles(plugins) {
|
||||
var _a;
|
||||
let filenameList = [];
|
||||
const options = {
|
||||
filter: (item) => {
|
||||
if (item.stats.isFile() && (item.path.endsWith('.swift') || item.path.endsWith('.m'))) {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
},
|
||||
};
|
||||
for (const plugin of plugins) {
|
||||
if (plugin.ios && (0, plugin_1.getPluginType)(plugin, 'ios') === 0 /* PluginType.Core */) {
|
||||
const pluginPath = (0, path_1.resolve)(plugin.rootPath, (_a = plugin.ios) === null || _a === void 0 ? void 0 : _a.path);
|
||||
const filenames = await (0, fs_1.readdirp)(pluginPath, options);
|
||||
filenameList = filenameList.concat(filenames);
|
||||
}
|
||||
}
|
||||
return filenameList;
|
||||
}
|
||||
exports.getPluginFiles = getPluginFiles;
|
||||
async function findPluginClasses(files) {
|
||||
const classList = [];
|
||||
for (const file of files) {
|
||||
const fileData = (0, fs_extra_1.readFileSync)(file, 'utf-8');
|
||||
const swiftPluginRegex = RegExp(/@objc\(([A-Za-z0-9_-]+)\)/);
|
||||
const objcPluginRegex = RegExp(/CAP_PLUGIN\(([A-Za-z0-9_-]+)/);
|
||||
const swiftMatches = swiftPluginRegex.exec(fileData);
|
||||
if ((swiftMatches === null || swiftMatches === void 0 ? void 0 : swiftMatches[1]) && !classList.includes(swiftMatches[1])) {
|
||||
classList.push(swiftMatches[1]);
|
||||
}
|
||||
const objcMatches = objcPluginRegex.exec(fileData);
|
||||
if ((objcMatches === null || objcMatches === void 0 ? void 0 : objcMatches[1]) && !classList.includes(objcMatches[1])) {
|
||||
classList.push(objcMatches[1]);
|
||||
}
|
||||
}
|
||||
return classList;
|
||||
}
|
||||
exports.findPluginClasses = findPluginClasses;
|
||||
async function writePluginJSON(config, classList) {
|
||||
const capJSONFile = (0, path_1.resolve)(config.ios.nativeTargetDirAbs, 'capacitor.config.json');
|
||||
const capJSON = (0, fs_extra_1.readJSONSync)(capJSONFile);
|
||||
capJSON['packageClassList'] = classList;
|
||||
(0, fs_extra_1.writeJSONSync)(capJSONFile, capJSON, { spaces: '\t' });
|
||||
}
|
||||
exports.writePluginJSON = writePluginJSON;
|
||||
async function generateIOSPackageJSON(config, plugins) {
|
||||
const fileList = await getPluginFiles(plugins);
|
||||
const classList = await findPluginClasses(fileList);
|
||||
const cordovaPlugins = await (0, cordova_1.getCordovaPlugins)(config, 'ios');
|
||||
if (cordovaPlugins.length > 0) {
|
||||
classList.push('CDVPlugin');
|
||||
}
|
||||
writePluginJSON(config, classList);
|
||||
}
|
||||
exports.generateIOSPackageJSON = generateIOSPackageJSON;
|
||||
21
electron/node_modules/@capacitor/cli/dist/util/js.js
generated
vendored
Normal file
21
electron/node_modules/@capacitor/cli/dist/util/js.js
generated
vendored
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.formatJSObject = void 0;
|
||||
const tslib_1 = require("tslib");
|
||||
const util_1 = tslib_1.__importDefault(require("util"));
|
||||
function formatJSObject(o) {
|
||||
try {
|
||||
o = JSON.parse(JSON.stringify(o));
|
||||
}
|
||||
catch (e) {
|
||||
throw new Error(`Cannot parse object as JSON: ${e.stack ? e.stack : e}`);
|
||||
}
|
||||
return util_1.default.inspect(o, {
|
||||
compact: false,
|
||||
breakLength: Infinity,
|
||||
depth: Infinity,
|
||||
maxArrayLength: Infinity,
|
||||
maxStringLength: Infinity,
|
||||
});
|
||||
}
|
||||
exports.formatJSObject = formatJSObject;
|
||||
149
electron/node_modules/@capacitor/cli/dist/util/livereload.js
generated
vendored
Normal file
149
electron/node_modules/@capacitor/cli/dist/util/livereload.js
generated
vendored
Normal file
|
|
@ -0,0 +1,149 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.CapLiveReloadHelper = void 0;
|
||||
const fs_extra_1 = require("fs-extra");
|
||||
const os_1 = require("os");
|
||||
const path_1 = require("path");
|
||||
class CapLiveReload {
|
||||
constructor() {
|
||||
this.configJsonToRevertTo = {
|
||||
json: null,
|
||||
platformPath: null,
|
||||
};
|
||||
// nothing to do
|
||||
}
|
||||
getIpAddress(name, family) {
|
||||
var _a;
|
||||
const interfaces = (_a = (0, os_1.networkInterfaces)()) !== null && _a !== void 0 ? _a : {};
|
||||
const _normalizeFamily = (family) => {
|
||||
if (family === 4) {
|
||||
return 'ipv4';
|
||||
}
|
||||
if (family === 6) {
|
||||
return 'ipv6';
|
||||
}
|
||||
return family ? family.toLowerCase() : 'ipv4';
|
||||
};
|
||||
const isLoopback = (addr) => {
|
||||
return (/^(::f{4}:)?127\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})/.test(addr) ||
|
||||
/^fe80::1$/.test(addr) ||
|
||||
/^::1$/.test(addr) ||
|
||||
/^::$/.test(addr));
|
||||
};
|
||||
const isPrivate = (addr) => {
|
||||
return (/^(::f{4}:)?10\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$/i.test(addr) ||
|
||||
/^(::f{4}:)?192\.168\.([0-9]{1,3})\.([0-9]{1,3})$/i.test(addr) ||
|
||||
/^(::f{4}:)?172\.(1[6-9]|2\d|30|31)\.([0-9]{1,3})\.([0-9]{1,3})$/i.test(addr) ||
|
||||
/^(::f{4}:)?127\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$/i.test(addr) ||
|
||||
/^(::f{4}:)?169\.254\.([0-9]{1,3})\.([0-9]{1,3})$/i.test(addr) ||
|
||||
/^f[cd][0-9a-f]{2}:/i.test(addr) ||
|
||||
/^fe80:/i.test(addr) ||
|
||||
/^::1$/.test(addr) ||
|
||||
/^::$/.test(addr));
|
||||
};
|
||||
const isPublic = (addr) => {
|
||||
return !isPrivate(addr);
|
||||
};
|
||||
const loopback = (family) => {
|
||||
//
|
||||
// Default to `ipv4`
|
||||
//
|
||||
family = _normalizeFamily(family);
|
||||
if (family !== 'ipv4' && family !== 'ipv6') {
|
||||
throw new Error('family must be ipv4 or ipv6');
|
||||
}
|
||||
return family === 'ipv4' ? '127.0.0.1' : 'fe80::1';
|
||||
};
|
||||
//
|
||||
// Default to `ipv4`
|
||||
//
|
||||
family = _normalizeFamily(family);
|
||||
//
|
||||
// If a specific network interface has been named,
|
||||
// return the address.
|
||||
//
|
||||
if (name && name !== 'private' && name !== 'public') {
|
||||
const res = interfaces[name].filter((details) => {
|
||||
const itemFamily = _normalizeFamily(details.family);
|
||||
return itemFamily === family;
|
||||
});
|
||||
if (res.length === 0) {
|
||||
return undefined;
|
||||
}
|
||||
return res[0].address;
|
||||
}
|
||||
const all = Object.keys(interfaces)
|
||||
.map((nic) => {
|
||||
//
|
||||
// Note: name will only be `public` or `private`
|
||||
// when this is called.
|
||||
//
|
||||
const addresses = interfaces[nic].filter((details) => {
|
||||
details.family = _normalizeFamily(details.family);
|
||||
if (details.family !== family || isLoopback(details.address)) {
|
||||
return false;
|
||||
}
|
||||
if (!name) {
|
||||
return true;
|
||||
}
|
||||
return name === 'public' ? isPrivate(details.address) : isPublic(details.address);
|
||||
});
|
||||
return addresses.length ? addresses[0].address : undefined;
|
||||
})
|
||||
.filter(Boolean);
|
||||
return !all.length ? loopback(family) : all[0];
|
||||
}
|
||||
// TODO remove on next major as it's unused
|
||||
async editExtConfigForLiveReload(config, platformName, options, rootConfigChange = false) {
|
||||
const platformAbsPath = platformName == config.ios.name
|
||||
? config.ios.nativeTargetDirAbs
|
||||
: platformName == config.android.name
|
||||
? config.android.assetsDirAbs
|
||||
: null;
|
||||
if (platformAbsPath == null)
|
||||
throw new Error('Platform not found.');
|
||||
const capConfigPath = rootConfigChange
|
||||
? config.app.extConfigFilePath
|
||||
: (0, path_1.join)(platformAbsPath, 'capacitor.config.json');
|
||||
const configJson = { ...config.app.extConfig };
|
||||
this.configJsonToRevertTo.json = JSON.stringify(configJson, null, 2);
|
||||
this.configJsonToRevertTo.platformPath = capConfigPath;
|
||||
const url = `http://${options.host}:${options.port}`;
|
||||
configJson.server = {
|
||||
url,
|
||||
};
|
||||
return configJson;
|
||||
}
|
||||
// TODO remove rootConfigChange param on next major as it's unused
|
||||
async editCapConfigForLiveReload(config, platformName, options, rootConfigChange = false) {
|
||||
const platformAbsPath = platformName == config.ios.name
|
||||
? config.ios.nativeTargetDirAbs
|
||||
: platformName == config.android.name
|
||||
? config.android.assetsDirAbs
|
||||
: null;
|
||||
if (platformAbsPath == null)
|
||||
throw new Error('Platform not found.');
|
||||
const capConfigPath = rootConfigChange
|
||||
? config.app.extConfigFilePath
|
||||
: (0, path_1.join)(platformAbsPath, 'capacitor.config.json');
|
||||
const configJson = (0, fs_extra_1.readJSONSync)(capConfigPath);
|
||||
this.configJsonToRevertTo.json = JSON.stringify(configJson, null, 2);
|
||||
this.configJsonToRevertTo.platformPath = capConfigPath;
|
||||
const url = `${options.https ? 'https' : 'http'}://${options.host}${options.port ? `:${options.port}` : ''}`;
|
||||
configJson.server = {
|
||||
...configJson.server,
|
||||
url,
|
||||
};
|
||||
(0, fs_extra_1.writeJSONSync)(capConfigPath, configJson, { spaces: '\t' });
|
||||
}
|
||||
async revertCapConfigForLiveReload() {
|
||||
if (this.configJsonToRevertTo.json == null || this.configJsonToRevertTo.platformPath == null)
|
||||
return;
|
||||
const capConfigPath = this.configJsonToRevertTo.platformPath;
|
||||
const configJson = this.configJsonToRevertTo.json;
|
||||
(0, fs_extra_1.writeJSONSync)(capConfigPath, JSON.parse(configJson), { spaces: '\t' });
|
||||
this.configJsonToRevertTo.json = null;
|
||||
this.configJsonToRevertTo.platformPath = null;
|
||||
}
|
||||
}
|
||||
exports.CapLiveReloadHelper = new CapLiveReload();
|
||||
109
electron/node_modules/@capacitor/cli/dist/util/monorepotools.js
generated
vendored
Normal file
109
electron/node_modules/@capacitor/cli/dist/util/monorepotools.js
generated
vendored
Normal file
|
|
@ -0,0 +1,109 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.isNXMonorepo = exports.isMonorepo = exports.findPackageRelativePathInMonorepo = exports.findPackagePath = exports.findNXMonorepoRoot = exports.findMonorepoRoot = void 0;
|
||||
const node_fs_1 = require("node:fs");
|
||||
const node_path_1 = require("node:path");
|
||||
/**
|
||||
* Finds the monorepo root from the given path.
|
||||
* @param currentPath - The current path to start searching from.
|
||||
* @returns The path to the monorepo root.
|
||||
* @throws An error if the monorepo root is not found.
|
||||
*/
|
||||
function findMonorepoRoot(currentPath) {
|
||||
const packageJsonPath = (0, node_path_1.join)(currentPath, 'package.json');
|
||||
const pnpmWorkspacePath = (0, node_path_1.join)(currentPath, 'pnpm-workspace.yaml');
|
||||
if ((0, node_fs_1.existsSync)(pnpmWorkspacePath) ||
|
||||
((0, node_fs_1.existsSync)(packageJsonPath) && JSON.parse((0, node_fs_1.readFileSync)(packageJsonPath, 'utf-8')).workspaces)) {
|
||||
return currentPath;
|
||||
}
|
||||
const parentPath = (0, node_path_1.dirname)(currentPath);
|
||||
if (parentPath === currentPath) {
|
||||
throw new Error('Monorepo root not found');
|
||||
}
|
||||
return findMonorepoRoot(parentPath);
|
||||
}
|
||||
exports.findMonorepoRoot = findMonorepoRoot;
|
||||
/**
|
||||
* Finds the NX monorepo root from the given path.
|
||||
* @param currentPath - The current path to start searching from.
|
||||
* @returns The path to the monorepo root.
|
||||
* @throws An error if the monorepo root is not found.
|
||||
*/
|
||||
function findNXMonorepoRoot(currentPath) {
|
||||
const nxJsonPath = (0, node_path_1.join)(currentPath, 'nx.json');
|
||||
if ((0, node_fs_1.existsSync)(nxJsonPath)) {
|
||||
return currentPath;
|
||||
}
|
||||
const parentPath = (0, node_path_1.dirname)(currentPath);
|
||||
if (parentPath === currentPath) {
|
||||
throw new Error('Monorepo root not found');
|
||||
}
|
||||
return findNXMonorepoRoot(parentPath);
|
||||
}
|
||||
exports.findNXMonorepoRoot = findNXMonorepoRoot;
|
||||
/**
|
||||
* Finds the path to a package within the node_modules folder,
|
||||
* searching up the directory hierarchy until the last possible directory is reached.
|
||||
* @param packageName - The name of the package to find.
|
||||
* @param currentPath - The current path to start searching from.
|
||||
* @param lastPossibleDirectory - The last possible directory to search for the package.
|
||||
* @returns The path to the package, or null if not found.
|
||||
*/
|
||||
function findPackagePath(packageName, currentPath, lastPossibleDirectory) {
|
||||
const nodeModulesPath = (0, node_path_1.join)(currentPath, 'node_modules', packageName);
|
||||
if ((0, node_fs_1.existsSync)(nodeModulesPath)) {
|
||||
return nodeModulesPath;
|
||||
}
|
||||
if (currentPath === lastPossibleDirectory) {
|
||||
return null;
|
||||
}
|
||||
const parentPath = (0, node_path_1.dirname)(currentPath);
|
||||
return findPackagePath(packageName, parentPath, lastPossibleDirectory);
|
||||
}
|
||||
exports.findPackagePath = findPackagePath;
|
||||
/**
|
||||
* Finds the relative path to a package from the current directory,
|
||||
* using the monorepo root as the last possible directory.
|
||||
* @param packageName - The name of the package to find.
|
||||
* @param currentPath - The current path to start searching from.
|
||||
* @returns The relative path to the package, or null if not found.
|
||||
*/
|
||||
function findPackageRelativePathInMonorepo(packageName, currentPath) {
|
||||
const monorepoRoot = findMonorepoRoot(currentPath);
|
||||
const packagePath = findPackagePath(packageName, currentPath, monorepoRoot);
|
||||
if (packagePath) {
|
||||
return (0, node_path_1.relative)(currentPath, packagePath);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
exports.findPackageRelativePathInMonorepo = findPackageRelativePathInMonorepo;
|
||||
/**
|
||||
* Detects if the current directory is part of a monorepo (npm, yarn, pnpm).
|
||||
* @param currentPath - The current path to start searching from.
|
||||
* @returns True if the current directory is part of a monorepo, false otherwise.
|
||||
*/
|
||||
function isMonorepo(currentPath) {
|
||||
try {
|
||||
findMonorepoRoot(currentPath);
|
||||
return true;
|
||||
}
|
||||
catch (error) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
exports.isMonorepo = isMonorepo;
|
||||
/**
|
||||
* Detects if the current directory is part of a nx integrated monorepo.
|
||||
* @param currentPath - The current path to start searching from.
|
||||
* @returns True if the current directory is part of a monorepo, false otherwise.
|
||||
*/
|
||||
function isNXMonorepo(currentPath) {
|
||||
try {
|
||||
findNXMonorepoRoot(currentPath);
|
||||
return true;
|
||||
}
|
||||
catch (error) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
exports.isNXMonorepo = isNXMonorepo;
|
||||
63
electron/node_modules/@capacitor/cli/dist/util/native-run.js
generated
vendored
Normal file
63
electron/node_modules/@capacitor/cli/dist/util/native-run.js
generated
vendored
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.getPlatformTargets = exports.runNativeRun = void 0;
|
||||
const tslib_1 = require("tslib");
|
||||
const path_1 = require("path");
|
||||
const colors_1 = tslib_1.__importDefault(require("../colors"));
|
||||
const errors_1 = require("../errors");
|
||||
const log_1 = require("../log");
|
||||
const node_1 = require("./node");
|
||||
const subprocess_1 = require("./subprocess");
|
||||
async function runNativeRun(args, options = {}) {
|
||||
const p = (0, node_1.resolveNode)(__dirname, (0, path_1.dirname)('native-run/package'), 'bin/native-run');
|
||||
if (!p) {
|
||||
(0, errors_1.fatal)(`${colors_1.default.input('native-run')} not found.`);
|
||||
}
|
||||
if (process.versions.pnp) {
|
||||
return await (0, subprocess_1.runCommand)('yarn', ['node', p, ...args], options);
|
||||
}
|
||||
else {
|
||||
return await (0, subprocess_1.runCommand)(p, args, options);
|
||||
}
|
||||
}
|
||||
exports.runNativeRun = runNativeRun;
|
||||
async function getPlatformTargets(platformName) {
|
||||
const errors = [];
|
||||
try {
|
||||
const output = await runNativeRun([platformName, '--list', '--json']);
|
||||
const parsedOutput = JSON.parse(output);
|
||||
if (parsedOutput.devices.length || parsedOutput.virtualDevices.length) {
|
||||
return [
|
||||
...parsedOutput.devices.map((t) => ({ ...t, virtual: false })),
|
||||
...parsedOutput.virtualDevices.map((t) => ({
|
||||
...t,
|
||||
virtual: true,
|
||||
})),
|
||||
];
|
||||
}
|
||||
else {
|
||||
parsedOutput.errors.map((e) => {
|
||||
errors.push(e);
|
||||
});
|
||||
}
|
||||
}
|
||||
catch (e) {
|
||||
const err = JSON.parse(e);
|
||||
errors.push(err);
|
||||
}
|
||||
if (errors.length === 0) {
|
||||
log_1.logger.info('No devices found.');
|
||||
return [];
|
||||
}
|
||||
const plural = errors.length > 1 ? 's' : '';
|
||||
const errMsg = `${colors_1.default.strong('native-run')} failed with error${plural}\n
|
||||
${errors
|
||||
.map((e) => {
|
||||
return `\t${colors_1.default.strong(e.code)}: ${e.error}`;
|
||||
})
|
||||
.join('\n')}
|
||||
\n\tMore details for this error${plural} may be available online: ${colors_1.default.strong('https://github.com/ionic-team/native-run/wiki/Android-Errors')}
|
||||
`;
|
||||
throw errMsg;
|
||||
}
|
||||
exports.getPlatformTargets = getPlatformTargets;
|
||||
54
electron/node_modules/@capacitor/cli/dist/util/node.js
generated
vendored
Normal file
54
electron/node_modules/@capacitor/cli/dist/util/node.js
generated
vendored
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.resolveNode = exports.requireTS = void 0;
|
||||
const fs_1 = require("fs");
|
||||
const fs_extra_1 = require("fs-extra");
|
||||
const path_1 = require("path");
|
||||
/**
|
||||
* @see https://github.com/ionic-team/stencil/blob/HEAD/src/compiler/sys/node-require.ts
|
||||
*/
|
||||
const requireTS = (ts, p) => {
|
||||
const id = (0, path_1.resolve)(p);
|
||||
delete require.cache[id];
|
||||
require.extensions['.ts'] = (module, fileName) => {
|
||||
var _a;
|
||||
let sourceText = (0, fs_extra_1.readFileSync)(fileName, 'utf8');
|
||||
if (fileName.endsWith('.ts')) {
|
||||
const tsResults = ts.transpileModule(sourceText, {
|
||||
fileName,
|
||||
compilerOptions: {
|
||||
module: ts.ModuleKind.CommonJS,
|
||||
moduleResolution: ts.ModuleResolutionKind.NodeJs,
|
||||
esModuleInterop: true,
|
||||
strict: true,
|
||||
target: ts.ScriptTarget.ES2017,
|
||||
},
|
||||
reportDiagnostics: true,
|
||||
});
|
||||
sourceText = tsResults.outputText;
|
||||
}
|
||||
else {
|
||||
// quick hack to turn a modern es module
|
||||
// into and old school commonjs module
|
||||
sourceText = sourceText.replace(/export\s+\w+\s+(\w+)/gm, 'exports.$1');
|
||||
}
|
||||
(_a = module._compile) === null || _a === void 0 ? void 0 : _a.call(module, sourceText, fileName);
|
||||
};
|
||||
const m = require(id); // eslint-disable-line @typescript-eslint/no-var-requires
|
||||
delete require.extensions['.ts'];
|
||||
return m;
|
||||
};
|
||||
exports.requireTS = requireTS;
|
||||
function resolveNode(root, ...pathSegments) {
|
||||
try {
|
||||
return require.resolve(pathSegments.join('/'), { paths: [root] });
|
||||
}
|
||||
catch (e) {
|
||||
const path = [root, 'node_modules', ...pathSegments].join('/');
|
||||
if ((0, fs_1.existsSync)(path)) {
|
||||
return path;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
exports.resolveNode = resolveNode;
|
||||
35
electron/node_modules/@capacitor/cli/dist/util/promise.js
generated
vendored
Normal file
35
electron/node_modules/@capacitor/cli/dist/util/promise.js
generated
vendored
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.lazy = exports.LazyPromise = exports.allSerial = void 0;
|
||||
function allSerial(funcs) {
|
||||
return funcs.reduce((promise, func) => promise.then((result) => func().then((x) => result.concat(x))), Promise.resolve([]));
|
||||
}
|
||||
exports.allSerial = allSerial;
|
||||
class LazyPromise extends Promise {
|
||||
constructor(executor) {
|
||||
super(() => {
|
||||
/* ignore */
|
||||
});
|
||||
this._executor = executor;
|
||||
}
|
||||
then(onfulfilled, onrejected) {
|
||||
this._promise = this._promise || new Promise(this._executor);
|
||||
return this._promise.then(onfulfilled, onrejected);
|
||||
}
|
||||
catch(onrejected) {
|
||||
this._promise = this._promise || new Promise(this._executor);
|
||||
return this._promise.catch(onrejected);
|
||||
}
|
||||
}
|
||||
exports.LazyPromise = LazyPromise;
|
||||
function lazy(fn) {
|
||||
return new LazyPromise(async (resolve, reject) => {
|
||||
try {
|
||||
resolve(await fn());
|
||||
}
|
||||
catch (e) {
|
||||
reject(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
exports.lazy = lazy;
|
||||
230
electron/node_modules/@capacitor/cli/dist/util/spm.js
generated
vendored
Normal file
230
electron/node_modules/@capacitor/cli/dist/util/spm.js
generated
vendored
Normal file
|
|
@ -0,0 +1,230 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.checkPackageTraitsRequirements = exports.checkSwiftToolsVersion = exports.addInfoPlistDebugIfNeeded = exports.runCocoapodsDeintegrate = exports.generatePackageText = exports.removeCocoapodsFiles = exports.extractSPMPackageDirectory = exports.checkPluginsForPackageSwift = exports.generatePackageFile = exports.findPackageSwiftFile = exports.checkPackageManager = void 0;
|
||||
const fs_extra_1 = require("fs-extra");
|
||||
const os_1 = require("os");
|
||||
const path_1 = require("path");
|
||||
const plist_1 = require("plist");
|
||||
const tar_1 = require("tar");
|
||||
const common_1 = require("../common");
|
||||
const errors_1 = require("../errors");
|
||||
const common_2 = require("../ios/common");
|
||||
const log_1 = require("../log");
|
||||
const plugin_1 = require("../plugin");
|
||||
const subprocess_1 = require("../util/subprocess");
|
||||
/**
|
||||
* @deprecated use config.ios.packageManager
|
||||
* @param config
|
||||
* @returns 'Cocoapods' | 'SPM'
|
||||
*/
|
||||
async function checkPackageManager(config) {
|
||||
const iosDirectory = config.ios.nativeProjectDirAbs;
|
||||
if ((0, fs_extra_1.existsSync)((0, path_1.resolve)(iosDirectory, 'CapApp-SPM'))) {
|
||||
return 'SPM';
|
||||
}
|
||||
return 'Cocoapods';
|
||||
}
|
||||
exports.checkPackageManager = checkPackageManager;
|
||||
async function findPackageSwiftFile(config) {
|
||||
const packageDirectory = (0, path_1.resolve)(config.ios.nativeProjectDirAbs, 'CapApp-SPM');
|
||||
return (0, path_1.resolve)(packageDirectory, 'Package.swift');
|
||||
}
|
||||
exports.findPackageSwiftFile = findPackageSwiftFile;
|
||||
async function generatePackageFile(config, plugins) {
|
||||
const packageSwiftFile = await findPackageSwiftFile(config);
|
||||
try {
|
||||
log_1.logger.info('Writing Package.swift');
|
||||
const textToWrite = await generatePackageText(config, plugins);
|
||||
(0, fs_extra_1.writeFileSync)(packageSwiftFile, textToWrite);
|
||||
}
|
||||
catch (err) {
|
||||
log_1.logger.error(`Unable to write to ${packageSwiftFile}. Verify it is not already open. \n Error: ${err}`);
|
||||
}
|
||||
}
|
||||
exports.generatePackageFile = generatePackageFile;
|
||||
async function checkPluginsForPackageSwift(config, plugins) {
|
||||
const iOSCapacitorPlugins = plugins.filter((p) => (0, plugin_1.getPluginType)(p, 'ios') === 0 /* PluginType.Core */);
|
||||
const packageSwiftPluginList = await pluginsWithPackageSwift(iOSCapacitorPlugins);
|
||||
if (plugins.length == packageSwiftPluginList.length) {
|
||||
log_1.logger.debug(`Found ${plugins.length} iOS plugins, ${packageSwiftPluginList.length} have a Package.swift file`);
|
||||
log_1.logger.info('All plugins have a Package.swift file and will be included in Package.swift');
|
||||
}
|
||||
else {
|
||||
log_1.logger.warn('Some installed packages are not compatable with SPM');
|
||||
}
|
||||
return packageSwiftPluginList;
|
||||
}
|
||||
exports.checkPluginsForPackageSwift = checkPluginsForPackageSwift;
|
||||
async function extractSPMPackageDirectory(config) {
|
||||
const spmDirectory = (0, path_1.join)(config.ios.nativeProjectDirAbs, 'CapApp-SPM');
|
||||
const spmTemplate = (0, path_1.join)(config.cli.assetsDirAbs, 'ios-spm-template.tar.gz');
|
||||
const debugConfig = (0, path_1.join)(config.ios.platformDirAbs, 'debug.xcconfig');
|
||||
log_1.logger.info('Extracting ' + spmTemplate + ' to ' + spmDirectory);
|
||||
try {
|
||||
const tempCapDir = await (0, fs_extra_1.mkdtemp)((0, path_1.join)((0, os_1.tmpdir)(), 'cap-'));
|
||||
const tempCapSPM = (0, path_1.join)(tempCapDir, 'App', 'CapApp-SPM');
|
||||
const tempDebugXCConfig = (0, path_1.join)(tempCapDir, 'debug.xcconfig');
|
||||
await (0, tar_1.extract)({ file: spmTemplate, cwd: tempCapDir });
|
||||
await (0, fs_extra_1.move)(tempCapSPM, spmDirectory);
|
||||
await (0, fs_extra_1.move)(tempDebugXCConfig, debugConfig);
|
||||
}
|
||||
catch (err) {
|
||||
(0, errors_1.fatal)('Failed to create ' + spmDirectory + ' with error: ' + err);
|
||||
}
|
||||
}
|
||||
exports.extractSPMPackageDirectory = extractSPMPackageDirectory;
|
||||
async function removeCocoapodsFiles(config) {
|
||||
const iosDirectory = config.ios.nativeProjectDirAbs;
|
||||
const podFile = (0, path_1.resolve)(iosDirectory, 'Podfile');
|
||||
const podlockFile = (0, path_1.resolve)(iosDirectory, 'Podfile.lock');
|
||||
const xcworkspaceFile = (0, path_1.resolve)(iosDirectory, 'App.xcworkspace');
|
||||
await (0, fs_extra_1.remove)(podFile);
|
||||
await (0, fs_extra_1.remove)(podlockFile);
|
||||
await (0, fs_extra_1.remove)(xcworkspaceFile);
|
||||
}
|
||||
exports.removeCocoapodsFiles = removeCocoapodsFiles;
|
||||
async function generatePackageText(config, plugins) {
|
||||
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
||||
const iosPlatformVersion = await (0, common_1.getCapacitorPackageVersion)(config, config.ios.name);
|
||||
const iosVersion = (0, common_2.getMajoriOSVersion)(config);
|
||||
const packageTraits = (_d = (_c = (_b = (_a = config.app.extConfig.experimental) === null || _a === void 0 ? void 0 : _a.ios) === null || _b === void 0 ? void 0 : _b.spm) === null || _c === void 0 ? void 0 : _c.packageTraits) !== null && _d !== void 0 ? _d : {};
|
||||
const swiftToolsVersion = (_h = (_g = (_f = (_e = config.app.extConfig.experimental) === null || _e === void 0 ? void 0 : _e.ios) === null || _f === void 0 ? void 0 : _f.spm) === null || _g === void 0 ? void 0 : _g.swiftToolsVersion) !== null && _h !== void 0 ? _h : '5.9';
|
||||
let packageSwiftText = `// swift-tools-version: ${swiftToolsVersion}
|
||||
import PackageDescription
|
||||
|
||||
// DO NOT MODIFY THIS FILE - managed by Capacitor CLI commands
|
||||
let package = Package(
|
||||
name: "CapApp-SPM",
|
||||
platforms: [.iOS(.v${iosVersion})],
|
||||
products: [
|
||||
.library(
|
||||
name: "CapApp-SPM",
|
||||
targets: ["CapApp-SPM"])
|
||||
],
|
||||
dependencies: [
|
||||
.package(url: "https://github.com/ionic-team/capacitor-swift-pm.git", exact: "${iosPlatformVersion}")`;
|
||||
for (const plugin of plugins) {
|
||||
if ((0, plugin_1.getPluginType)(plugin, config.ios.name) === 1 /* PluginType.Cordova */) {
|
||||
packageSwiftText += `,\n .package(name: "${plugin.name}", path: "../../capacitor-cordova-ios-plugins/sources/${plugin.name}")`;
|
||||
}
|
||||
else {
|
||||
const relPath = (0, path_1.relative)(config.ios.nativeXcodeProjDirAbs, plugin.rootPath);
|
||||
const traits = packageTraits[plugin.id];
|
||||
const traitsSuffix = (traits === null || traits === void 0 ? void 0 : traits.length)
|
||||
? `, traits: [${traits
|
||||
.map((t) => {
|
||||
// Any trait is written with quotes, with the exception of .defaults
|
||||
return /^\.?defaults?$/i.test(t) ? '.defaults' : `"${t}"`;
|
||||
})
|
||||
.join(', ')}]`
|
||||
: '';
|
||||
packageSwiftText += `,\n .package(name: "${(_j = plugin.ios) === null || _j === void 0 ? void 0 : _j.name}", path: "${relPath}"${traitsSuffix})`;
|
||||
}
|
||||
}
|
||||
packageSwiftText += `
|
||||
],
|
||||
targets: [
|
||||
.target(
|
||||
name: "CapApp-SPM",
|
||||
dependencies: [
|
||||
.product(name: "Capacitor", package: "capacitor-swift-pm"),
|
||||
.product(name: "Cordova", package: "capacitor-swift-pm")`;
|
||||
for (const plugin of plugins) {
|
||||
packageSwiftText += `,\n .product(name: "${(_k = plugin.ios) === null || _k === void 0 ? void 0 : _k.name}", package: "${(_l = plugin.ios) === null || _l === void 0 ? void 0 : _l.name}")`;
|
||||
}
|
||||
packageSwiftText += `
|
||||
]
|
||||
)
|
||||
]
|
||||
)
|
||||
`;
|
||||
return packageSwiftText;
|
||||
}
|
||||
exports.generatePackageText = generatePackageText;
|
||||
async function runCocoapodsDeintegrate(config) {
|
||||
const podPath = await config.ios.podPath;
|
||||
const projectFileName = config.ios.nativeXcodeProjDirAbs;
|
||||
const useBundler = (await config.ios.packageManager) === 'bundler';
|
||||
log_1.logger.info('Running pod deintegrate on project ' + projectFileName);
|
||||
if (useBundler) {
|
||||
log_1.logger.info('Found bundler, using it to run CocoaPods.');
|
||||
await (0, subprocess_1.runCommand)('bundle', ['exec', 'pod', 'deintegrate', projectFileName], {
|
||||
cwd: config.ios.nativeProjectDirAbs,
|
||||
});
|
||||
}
|
||||
else {
|
||||
await (0, subprocess_1.runCommand)(podPath, ['deintegrate', projectFileName], {
|
||||
cwd: config.ios.nativeProjectDirAbs,
|
||||
});
|
||||
}
|
||||
}
|
||||
exports.runCocoapodsDeintegrate = runCocoapodsDeintegrate;
|
||||
async function addInfoPlistDebugIfNeeded(config) {
|
||||
const infoPlist = (0, path_1.resolve)(config.ios.nativeTargetDirAbs, 'Info.plist');
|
||||
log_1.logger.info('Checking ' + infoPlist + ' for CAPACITOR_DEBUG');
|
||||
if ((0, fs_extra_1.existsSync)(infoPlist)) {
|
||||
const infoPlistContents = (0, fs_extra_1.readFileSync)(infoPlist, 'utf-8');
|
||||
const plistEntries = (0, plist_1.parse)(infoPlistContents);
|
||||
if (plistEntries['CAPACITOR_DEBUG'] === undefined) {
|
||||
log_1.logger.info('Writing CAPACITOR_DEBUG to ' + infoPlist);
|
||||
plistEntries['CAPACITOR_DEBUG'] = '$(CAPACITOR_DEBUG)';
|
||||
const plistToWrite = (0, plist_1.build)(plistEntries);
|
||||
(0, fs_extra_1.writeFileSync)(infoPlist, plistToWrite);
|
||||
}
|
||||
else {
|
||||
log_1.logger.warn('Found CAPACITOR_DEBUG set to ' + plistEntries['CAPACITOR_DEBUG'] + ', skipping.');
|
||||
}
|
||||
}
|
||||
else {
|
||||
log_1.logger.warn(infoPlist + ' not found.');
|
||||
}
|
||||
}
|
||||
exports.addInfoPlistDebugIfNeeded = addInfoPlistDebugIfNeeded;
|
||||
async function checkSwiftToolsVersion(config, version) {
|
||||
if (!version) {
|
||||
return null;
|
||||
}
|
||||
const swiftToolsVersionRegex = /^[0-9]+\.[0-9]+(\.[0-9]+)?$/;
|
||||
if (!swiftToolsVersionRegex.test(version)) {
|
||||
return (`Invalid Swift tools version: "${version}".\n` +
|
||||
`The Swift tools version must be in major.minor or major.minor.patch format (e.g., "5.9", "6.0", "5.9.2").`);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
exports.checkSwiftToolsVersion = checkSwiftToolsVersion;
|
||||
async function checkPackageTraitsRequirements(config) {
|
||||
var _a, _b, _c, _d, _e, _f;
|
||||
const packageTraits = (_c = (_b = (_a = config.app.extConfig.experimental) === null || _a === void 0 ? void 0 : _a.ios) === null || _b === void 0 ? void 0 : _b.spm) === null || _c === void 0 ? void 0 : _c.packageTraits;
|
||||
const swiftToolsVersion = (_f = (_e = (_d = config.app.extConfig.experimental) === null || _d === void 0 ? void 0 : _d.ios) === null || _e === void 0 ? void 0 : _e.spm) === null || _f === void 0 ? void 0 : _f.swiftToolsVersion;
|
||||
const hasPackageTraits = packageTraits && Object.keys(packageTraits).some((key) => { var _a; return ((_a = packageTraits[key]) === null || _a === void 0 ? void 0 : _a.length) > 0; });
|
||||
if (!hasPackageTraits) {
|
||||
return null;
|
||||
}
|
||||
if (!swiftToolsVersion) {
|
||||
return (`Package traits require an explicit Swift tools version of 6.1 or higher.\n` +
|
||||
`Set experimental.ios.spm.swiftToolsVersion to '6.1' or higher in your Capacitor configuration.`);
|
||||
}
|
||||
const versionParts = swiftToolsVersion.split('.').map((part) => parseInt(part, 10));
|
||||
const major = versionParts[0] || 0;
|
||||
const minor = versionParts[1] || 0;
|
||||
if (major < 6 || (major === 6 && minor < 1)) {
|
||||
return (`Package traits require Swift tools version 6.1 or higher, but "${swiftToolsVersion}" was specified.\n` +
|
||||
`Update experimental.ios.spm.swiftToolsVersion to '6.1' or higher in your Capacitor configuration.`);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
exports.checkPackageTraitsRequirements = checkPackageTraitsRequirements;
|
||||
// Private Functions
|
||||
async function pluginsWithPackageSwift(plugins) {
|
||||
const pluginList = [];
|
||||
for (const plugin of plugins) {
|
||||
const packageSwiftFound = await (0, fs_extra_1.pathExists)((0, path_1.join)(plugin.rootPath, 'Package.swift'));
|
||||
if (packageSwiftFound) {
|
||||
pluginList.push(plugin);
|
||||
}
|
||||
else {
|
||||
log_1.logger.warn(plugin.id + ' does not have a Package.swift');
|
||||
}
|
||||
}
|
||||
return pluginList;
|
||||
}
|
||||
37
electron/node_modules/@capacitor/cli/dist/util/subprocess.js
generated
vendored
Normal file
37
electron/node_modules/@capacitor/cli/dist/util/subprocess.js
generated
vendored
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.isInstalled = exports.getCommandOutput = exports.runCommand = void 0;
|
||||
const utils_subprocess_1 = require("@ionic/utils-subprocess");
|
||||
async function runCommand(command, args, options = {}) {
|
||||
const p = new utils_subprocess_1.Subprocess(command, args, options);
|
||||
try {
|
||||
return await p.output();
|
||||
}
|
||||
catch (e) {
|
||||
if (e instanceof utils_subprocess_1.SubprocessError) {
|
||||
// old behavior of just throwing the stdout/stderr strings
|
||||
throw e.output ? e.output : e.cause ? `${e.message} ${e.cause.toString()}` : e.code ? e.code : 'Unknown error';
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
exports.runCommand = runCommand;
|
||||
async function getCommandOutput(command, args, options = {}) {
|
||||
try {
|
||||
return (await runCommand(command, args, options)).trim();
|
||||
}
|
||||
catch (e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
exports.getCommandOutput = getCommandOutput;
|
||||
async function isInstalled(command) {
|
||||
try {
|
||||
await (0, utils_subprocess_1.which)(command);
|
||||
}
|
||||
catch (e) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
exports.isInstalled = isInstalled;
|
||||
10
electron/node_modules/@capacitor/cli/dist/util/template.js
generated
vendored
Normal file
10
electron/node_modules/@capacitor/cli/dist/util/template.js
generated
vendored
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.extractTemplate = void 0;
|
||||
const fs_extra_1 = require("fs-extra");
|
||||
const tar_1 = require("tar");
|
||||
async function extractTemplate(src, dir) {
|
||||
await (0, fs_extra_1.mkdirp)(dir);
|
||||
await (0, tar_1.extract)({ file: src, cwd: dir });
|
||||
}
|
||||
exports.extractTemplate = extractTemplate;
|
||||
30
electron/node_modules/@capacitor/cli/dist/util/term.js
generated
vendored
Normal file
30
electron/node_modules/@capacitor/cli/dist/util/term.js
generated
vendored
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.isInteractive = exports.checkInteractive = void 0;
|
||||
const tslib_1 = require("tslib");
|
||||
const utils_terminal_1 = require("@ionic/utils-terminal");
|
||||
const colors_1 = tslib_1.__importDefault(require("../colors"));
|
||||
const log_1 = require("../log");
|
||||
// Given input variables to a command, make sure all are provided if the terminal
|
||||
// is not interactive (because we won't be able to prompt the user)
|
||||
const checkInteractive = (...args) => {
|
||||
if ((0, exports.isInteractive)()) {
|
||||
return true;
|
||||
}
|
||||
// Fail if no args are provided, treat this as just a check of whether the term is
|
||||
// interactive or not.
|
||||
if (!args.length) {
|
||||
return false;
|
||||
}
|
||||
// Make sure none of the provided args are empty, otherwise print the interactive
|
||||
// warning and return false
|
||||
if (args.filter((arg) => !arg).length) {
|
||||
log_1.logger.error(`Non-interactive shell detected.\n` +
|
||||
`Run the command with ${colors_1.default.input('--help')} to see a list of arguments that must be provided.`);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
exports.checkInteractive = checkInteractive;
|
||||
const isInteractive = () => utils_terminal_1.TERMINAL_INFO.tty && !utils_terminal_1.TERMINAL_INFO.ci;
|
||||
exports.isInteractive = isInteractive;
|
||||
11
electron/node_modules/@capacitor/cli/dist/util/uuid.js
generated
vendored
Normal file
11
electron/node_modules/@capacitor/cli/dist/util/uuid.js
generated
vendored
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.uuidv4 = void 0;
|
||||
function uuidv4() {
|
||||
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => {
|
||||
const r = (Math.random() * 16) | 0;
|
||||
const v = c == 'x' ? r : (r & 0x3) | 0x8;
|
||||
return v.toString(16);
|
||||
});
|
||||
}
|
||||
exports.uuidv4 = uuidv4;
|
||||
55
electron/node_modules/@capacitor/cli/dist/util/xml.js
generated
vendored
Normal file
55
electron/node_modules/@capacitor/cli/dist/util/xml.js
generated
vendored
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.buildXmlElement = exports.writeXML = exports.parseXML = exports.readXML = void 0;
|
||||
const tslib_1 = require("tslib");
|
||||
const fs_extra_1 = require("fs-extra");
|
||||
const xml2js_1 = tslib_1.__importDefault(require("xml2js"));
|
||||
async function readXML(path) {
|
||||
var _a;
|
||||
try {
|
||||
const xmlStr = await (0, fs_extra_1.readFile)(path, { encoding: 'utf-8' });
|
||||
try {
|
||||
return await xml2js_1.default.parseStringPromise(xmlStr);
|
||||
}
|
||||
catch (e) {
|
||||
throw `Error parsing: ${path}, ${(_a = e.stack) !== null && _a !== void 0 ? _a : e}`;
|
||||
}
|
||||
}
|
||||
catch (e) {
|
||||
throw `Unable to read: ${path}`;
|
||||
}
|
||||
}
|
||||
exports.readXML = readXML;
|
||||
function parseXML(xmlStr, options) {
|
||||
const parser = options !== undefined ? new xml2js_1.default.Parser({ ...options }) : new xml2js_1.default.Parser();
|
||||
let xmlObj;
|
||||
parser.parseString(xmlStr, (err, result) => {
|
||||
if (!err) {
|
||||
xmlObj = result;
|
||||
}
|
||||
});
|
||||
return xmlObj;
|
||||
}
|
||||
exports.parseXML = parseXML;
|
||||
async function writeXML(object) {
|
||||
return new Promise((resolve) => {
|
||||
const builder = new xml2js_1.default.Builder({
|
||||
headless: true,
|
||||
explicitRoot: false,
|
||||
rootName: 'deleteme',
|
||||
});
|
||||
let xml = builder.buildObject(object);
|
||||
xml = xml.replace('<deleteme>', '').replace('</deleteme>', '');
|
||||
resolve(xml);
|
||||
});
|
||||
}
|
||||
exports.writeXML = writeXML;
|
||||
function buildXmlElement(configElement, rootName) {
|
||||
const builder = new xml2js_1.default.Builder({
|
||||
headless: true,
|
||||
explicitRoot: false,
|
||||
rootName: rootName,
|
||||
});
|
||||
return builder.buildObject(configElement);
|
||||
}
|
||||
exports.buildXmlElement = buildXmlElement;
|
||||
Loading…
Add table
Add a link
Reference in a new issue