PHP WebShell

Текущая директория: /usr/lib/node_modules/bitgo/node_modules/@expo/cli/build/src/start/platforms

Просмотр файла: PlatformManager.js

"use strict";
Object.defineProperty(exports, "__esModule", {
    value: true
});
var _config = require("@expo/config");
var _assert = _interopRequireDefault(require("assert"));
var Log = _interopRequireWildcard(require("../../log"));
var _rudderstackClient = require("../../utils/analytics/rudderstackClient");
var _errors = require("../../utils/errors");
var _link = require("../../utils/link");
function _interopRequireDefault(obj) {
    return obj && obj.__esModule ? obj : {
        default: obj
    };
}
function _interopRequireWildcard(obj) {
    if (obj && obj.__esModule) {
        return obj;
    } else {
        var newObj = {};
        if (obj != null) {
            for(var key in obj){
                if (Object.prototype.hasOwnProperty.call(obj, key)) {
                    var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {};
                    if (desc.get || desc.set) {
                        Object.defineProperty(newObj, key, desc);
                    } else {
                        newObj[key] = obj[key];
                    }
                }
            }
        }
        newObj.default = obj;
        return newObj;
    }
}
class PlatformManager {
    constructor(projectRoot, props){
        this.projectRoot = projectRoot;
        this.props = props;
    }
    /** Returns the project application identifier or asserts that one is not defined. Exposed for testing. */ _getAppIdResolver() {
        throw new _errors.UnimplementedError();
    }
    async openProjectInExpoGoAsync(resolveSettings = {}) {
        const url = this.props.getExpoGoUrl();
        // This should never happen, but just in case...
        (0, _assert).default(url, "Could not get dev server URL");
        const deviceManager = await this.props.resolveDeviceAsync(resolveSettings);
        deviceManager.logOpeningUrl(url);
        // TODO: Expensive, we should only do this once.
        const { exp  } = (0, _config).getConfig(this.projectRoot);
        const installedExpo = await deviceManager.ensureExpoGoAsync(exp.sdkVersion);
        await deviceManager.activateWindowAsync();
        await deviceManager.openUrlAsync(url);
        (0, _rudderstackClient).logEvent("Open Url on Device", {
            platform: this.props.platform,
            installedExpo
        });
        return {
            url
        };
    }
    async openProjectInCustomRuntimeAsync(resolveSettings = {}, props = {}) {
        Log.debug(`open custom (${Object.entries(props).map(([k, v])=>`${k}: ${v}`
        ).join(", ")})`);
        let url = this.props.getCustomRuntimeUrl({
            scheme: props.scheme
        });
        var _applicationId;
        // TODO: It's unclear why we do application id validation when opening with a URL
        const applicationId = (_applicationId = props.applicationId) != null ? _applicationId : await this._getAppIdResolver().getAppIdAsync();
        const deviceManager = await this.props.resolveDeviceAsync(resolveSettings);
        if (!await deviceManager.isAppInstalledAsync(applicationId)) {
            throw new _errors.CommandError(`The development client (${applicationId}) for this project is not installed. ` + `Please build and install the client on the device first.\n${(0, _link).learnMore("https://docs.expo.dev/development/build/")}`);
        }
        // TODO: Rethink analytics
        (0, _rudderstackClient).logEvent("Open Url on Device", {
            platform: this.props.platform,
            installedExpo: false
        });
        if (!url) {
            url = this._resolveAlternativeLaunchUrl(applicationId, props);
        }
        deviceManager.logOpeningUrl(url);
        await deviceManager.activateWindowAsync();
        await deviceManager.openUrlAsync(url);
        return {
            url
        };
    }
    /** Launch the project on a device given the input runtime. */ async openAsync(options, resolveSettings = {}) {
        Log.debug(`open (runtime: ${options.runtime}, platform: ${this.props.platform}, device: %O, shouldPrompt: ${resolveSettings.shouldPrompt})`, resolveSettings.device);
        if (options.runtime === "expo") {
            return this.openProjectInExpoGoAsync(resolveSettings);
        } else if (options.runtime === "web") {
            return this.openWebProjectAsync(resolveSettings);
        } else if (options.runtime === "custom") {
            return this.openProjectInCustomRuntimeAsync(resolveSettings, options.props);
        } else {
            throw new _errors.CommandError(`Invalid runtime target: ${options.runtime}`);
        }
    }
    /** Open the current web project (Webpack) in a device . */ async openWebProjectAsync(resolveSettings = {}) {
        const url = this.props.getDevServerUrl();
        (0, _assert).default(url, "Dev server is not running.");
        const deviceManager = await this.props.resolveDeviceAsync(resolveSettings);
        deviceManager.logOpeningUrl(url);
        await deviceManager.activateWindowAsync();
        await deviceManager.openUrlAsync(url);
        return {
            url
        };
    }
    /** If the launch URL cannot be determined (`custom` runtimes) then an alternative string can be provided to open the device. Often a device ID or activity to launch. Exposed for testing. */ _resolveAlternativeLaunchUrl(applicationId, props = {}) {
        throw new _errors.UnimplementedError();
    }
}
exports.PlatformManager = PlatformManager;

//# sourceMappingURL=PlatformManager.js.map

Выполнить команду


Для локальной разработки. Не используйте в интернете!