Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ios-sim-portable

Package Overview
Dependencies
Maintainers
5
Versions
90
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ios-sim-portable - npm Package Compare versions

Comparing version 4.0.9 to 4.1.0

1

lib/child-process.js

@@ -66,1 +66,2 @@ "use strict";

exports.spawn = spawn;
//# sourceMappingURL=child-process.js.map

@@ -43,1 +43,2 @@ "use strict";

exports.CommandExecutor = CommandExecutor;
//# sourceMappingURL=command-executor.js.map

@@ -0,1 +1,2 @@

///<reference path=".././.d.ts"/>
"use strict";

@@ -10,1 +11,2 @@ const iphoneSimulatorLibPath = require("./../iphone-simulator");

exports.Command = Command;
//# sourceMappingURL=device-types.js.map

@@ -0,1 +1,2 @@

///<reference path=".././.d.ts"/>
"use strict";

@@ -25,1 +26,2 @@ const fs = require("fs");

exports.Command = Command;
//# sourceMappingURL=help.js.map

@@ -11,1 +11,2 @@ "use strict";

exports.Command = Command;
//# sourceMappingURL=launch.js.map

@@ -10,1 +10,2 @@ "use strict";

exports.Command = Command;
//# sourceMappingURL=notify-post.js.map

@@ -0,1 +1,2 @@

///<reference path=".././.d.ts"/>
"use strict";

@@ -10,1 +11,2 @@ const iphoneSimulatorLibPath = require("./../iphone-simulator");

exports.Command = Command;
//# sourceMappingURL=sdks.js.map

@@ -0,1 +1,3 @@

///<reference path="./.d.ts"/>
"use strict";
//# sourceMappingURL=declarations.js.map

@@ -0,1 +1,2 @@

///<reference path="./.d.ts"/>
"use strict";

@@ -8,1 +9,2 @@ const util = require("util");

exports.fail = fail;
//# sourceMappingURL=errors.js.map

@@ -5,1 +5,2 @@ "use strict";

commandExecutor.execute();
//# sourceMappingURL=ios-sim-standalone.js.map

@@ -146,1 +146,2 @@ "use strict";

module.exports = publicApi;
//# sourceMappingURL=ios-sim.js.map

@@ -53,1 +53,2 @@ "use strict";

}
//# sourceMappingURL=iphone-simulator-common.js.map

@@ -0,1 +1,2 @@

///<reference path="./.d.ts"/>
"use strict";

@@ -11,1 +12,2 @@ class IPhoneSimulatorNameGetter {

exports.IPhoneSimulatorNameGetter = IPhoneSimulatorNameGetter;
//# sourceMappingURL=iphone-simulator-name-getter.js.map

@@ -0,1 +1,2 @@

///<reference path="./.d.ts"/>
"use strict";

@@ -81,2 +82,16 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

return __awaiter(this, void 0, void 0, function* () {
const startingAppKey = deviceId + appIdentifier;
if (XCodeSimctlSimulator.startingApps[startingAppKey]) {
return XCodeSimctlSimulator.startingApps[startingAppKey];
}
const deferPromise = utils.deferPromise();
XCodeSimctlSimulator.startingApps[startingAppKey] = deferPromise.promise;
// let the app start for 3 seconds in order to avoid a frozen simulator
// when the app is killed on splash screen
setTimeout(() => {
delete XCodeSimctlSimulator.startingApps[startingAppKey];
deferPromise.resolve();
}, 3000);
// simctl launch command does not launch the process immediately and we have to wait a little bit,
// just to ensure all related processes and services are alive.
const launchResult = yield this.simctl.launch(deviceId, appIdentifier, options);

@@ -89,2 +104,11 @@ utils.sleep(0.5);

return __awaiter(this, void 0, void 0, function* () {
const appKey = deviceId + appIdentifier;
if (XCodeSimctlSimulator.stoppingApps[appKey]) {
return XCodeSimctlSimulator.stoppingApps[appKey];
}
const deferPromise = utils.deferPromise();
XCodeSimctlSimulator.stoppingApps[appKey] = deferPromise.promise;
if (XCodeSimctlSimulator.startingApps[appKey]) {
yield XCodeSimctlSimulator.startingApps[appKey];
}
try {

@@ -104,5 +128,13 @@ let pid = this.getPid(deviceId, bundleExecutable);

utils.sleep(0.5);
delete XCodeSimctlSimulator.stoppingApps[appKey];
deferPromise.resolve();
return deferPromise.promise;
});
}
getPid(deviceId, bundleExecutable) {
// Sample output of the command ps -ef | grep app3grep | grep /86DCBE59-7ED0-447D-832B-A397322BD712/
// 1203284766 59345 51524 0 7:11pm ?? 0:01.32 /Users/username/Library/Developer/CoreSimulator/Devices/86DCBE59-7ED0-447D-832B-A397322BD712/data/Containers/Bundle/Application/4E79A7E8-9AAB-40B9-89EF-C8D7B91B819E/app3grep.app/app3grep
// 1203284766 59486 59396 0 7:15pm ?? 0:00.01 /bin/sh -c ps -ef | grep app3grep | grep /86DCBE59-7ED0-447D-832B-A397322BD712/
// The process, that is execed by Node.js is also returned, so we need to exclude it from the result.
// To achieve this, remove the command we've executed from the ps result.
const grepAppProcessCommand = `ps -ef | grep ${bundleExecutable} | grep \/${deviceId}\/`;

@@ -145,2 +177,3 @@ return childProcess.execSync(`${grepAppProcessCommand} | grep -v "${grepAppProcessCommand}" | awk '{print $2}'`, null, { skipError: true }).toString().trim();

}, 3000);
// For some reason starting the process takes a lot of time. So wait for the first message on stdout and resolve the promise at this point.
this.deviceLogChildProcess = this.simctl.getLog(deviceId, predicate);

@@ -221,2 +254,3 @@ if (this.deviceLogChildProcess.stdout) {

device = device || (yield this.getDeviceToRun(options));
// In case the id is undefined, skip verification - we'll start default simulator.
if (device && device.id) {

@@ -232,2 +266,3 @@ yield this.verifyDevice(device);

if (isSimulatorAppRunning) {
// In case user closes simulator window but simulator app is still alive
if (!haveBootedDevices) {

@@ -242,2 +277,5 @@ device = yield this.getDeviceToRun(options);

common.startSimulator(device.id);
// startSimulaltor doesn't always finish immediately, and the subsequent
// install fails since the simulator is not running.
// Give it some time to start before we attempt installing.
utils.sleep(1);

@@ -280,2 +318,5 @@ }

XCodeSimctlSimulator.DEVICE_IDENTIFIER_PREFIX = "com.apple.CoreSimulator.SimDeviceType";
XCodeSimctlSimulator.startingApps = {};
XCodeSimctlSimulator.stoppingApps = {};
exports.XCodeSimctlSimulator = XCodeSimctlSimulator;
//# sourceMappingURL=iphone-simulator-xcode-simctl.js.map

@@ -70,1 +70,2 @@ "use strict";

exports.iPhoneSimulator = iPhoneSimulator;
//# sourceMappingURL=iphone-simulator.js.map

@@ -0,1 +1,2 @@

///<reference path=".d.ts"/>
"use strict";

@@ -20,2 +21,3 @@ var yargs = require("yargs");

var argv = yargs(process.argv.slice(2)).options(knownOptions).argv;
// DO NOT REMOVE { } as when they are missing and some of the option values is false, the each stops as it thinks we have set "return false".
_.each(_.keys(argv), optionName => {

@@ -25,1 +27,2 @@ parsed[optionName] = argv[optionName];

module.exports = parsed;
//# sourceMappingURL=options.js.map

@@ -54,2 +54,3 @@ "use strict";

const appContainerPath = yield this.spawnAsync("get_app_container", [deviceId, appIdentifier]);
// In case application is not installed on simulator, get_app_container returns some random location. After you installation, the application goes in a different location.
return fs.existsSync(appContainerPath) ? appContainerPath : null;

@@ -68,5 +69,15 @@ }

let rawDevices = yield this.spawnAsync("list", ["devices"]);
// expect to get a listing like
// -- iOS 8.1 --
// iPhone 4s (3CA6E7DD-220E-45E5-B716-1E992B3A429C) (Shutdown)
// ...
// -- iOS 8.2 --
// iPhone 4s (A99FFFC3-8E19-4DCF-B585-7D9D46B4C16E) (Shutdown)
// ...
// so, get the `-- iOS X.X --` line to find the sdk (X.X)
// and the rest of the listing in order to later find the devices
let deviceSectionRegex = /-- (iOS) (.+) --(\n .+)*/mg;
let match = deviceSectionRegex.exec(rawDevices);
let matches = [];
// make an entry for each sdk version
while (match !== null) {

@@ -79,6 +90,17 @@ matches.push(match);

}
// get all the devices for each sdk
let devices = [];
for (match of matches) {
let sdk = match[2];
// split the full match into lines and remove the first
for (let line of match[0].split('\n').slice(1)) {
// a line is something like
// iPhone 4s (A99FFFC3-8E19-4DCF-B585-7D9D46B4C16E) (Shutdown)
// iPad Air 2 (9696A8ED-3020-49FC-90D6-DAFD29A0EA8D) (Shutdown)
// iPad Pro (9.7 inch) (7FF984D4-0755-432D-BE0E-6EB44F0489CB) (Shutdown)
// iPad Pro (12.9 inch) (F02012C8-6D4D-46FF-90D7-5DF90EF579E8) (Booted)
// retrieve:
// iPhone 4s
// A99FFFC3-8E19-4DCF-B585-7D9D46B4C16E
// Shutdown
let lineRegex = /^\s+(.*?)\s+\(([0-9A-F]{8}(?:-[0-9A-F]{4}){3}-[0-9A-F]{12})\)\s+\((.*?)\)(\s+\((?:.*?)\))?/;

@@ -145,1 +167,2 @@ let lineMatch = lineRegex.exec(line);

exports.Simctl = Simctl;
//# sourceMappingURL=simctl.js.map

@@ -17,1 +17,31 @@ "use strict";

exports.sleep = sleep;
function deferPromise() {
let resolve;
let reject;
let isResolved = false;
let isRejected = false;
let promise;
let result;
promise = new Promise((innerResolve, innerReject) => {
resolve = (value) => {
isResolved = true;
result = value;
return innerResolve(value);
};
reject = (reason) => {
isRejected = true;
return innerReject(reason);
};
});
return {
promise,
resolve,
reject,
isResolved: () => isResolved,
isRejected: () => isRejected,
isPending: () => !isResolved && !isRejected,
getResult: () => result
};
}
exports.deferPromise = deferPromise;
//# sourceMappingURL=utils.js.map

@@ -18,1 +18,2 @@ "use strict";

exports.getXcodeVersionData = getXcodeVersionData;
//# sourceMappingURL=xcode.js.map

5

package.json
{
"name": "ios-sim-portable",
"version": "4.0.9",
"version": "4.1.0",
"description": "",
"main": "./lib/ios-sim.js",
"scripts": {
"prepublish": "node prepublish.js",
"test": "echo \"Error: no test specified\" && exit 1"

@@ -46,2 +47,2 @@ },

}
}
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc