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

ios-sim-portable

Package Overview
Dependencies
Maintainers
12
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.3.0 to 4.4.0

lib/child-process.d.ts

5

lib/commands/device-types.js

@@ -1,9 +0,8 @@

///<reference path=".././.d.ts"/>
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Command = void 0;
const iphoneSimulatorLibPath = require("./../iphone-simulator");
const iphone_simulator_1 = require("../iphone-simulator");
class Command {
execute(args) {
var iphoneSimulator = new iphoneSimulatorLibPath.iPhoneSimulator();
var iphoneSimulator = new iphone_simulator_1.iPhoneSimulator();
return iphoneSimulator.printDeviceTypes();

@@ -10,0 +9,0 @@ }

1

lib/commands/help.js

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

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

@@ -3,0 +2,0 @@ Object.defineProperty(exports, "__esModule", { value: true });

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Command = void 0;
const iphoneSimulatorLibPath = require("./../iphone-simulator");
const iphone_simulator_1 = require("../iphone-simulator");
const options = require("../options");
class Command {
execute(args) {
var iphoneSimulator = new iphoneSimulatorLibPath.iPhoneSimulator();
var iphoneSimulator = new iphone_simulator_1.iPhoneSimulator();
return iphoneSimulator.run(args[0], args[1], options);

@@ -10,0 +10,0 @@ }

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Command = void 0;
const iphoneSimulatorLibPath = require("./../iphone-simulator");
const iphone_simulator_1 = require("./../iphone-simulator");
class Command {
execute(args) {
var iphoneSimulator = new iphoneSimulatorLibPath.iPhoneSimulator();
var iphoneSimulator = new iphone_simulator_1.iPhoneSimulator();
return iphoneSimulator.sendNotification(args[0], args[1]);

@@ -9,0 +9,0 @@ }

@@ -1,9 +0,8 @@

///<reference path=".././.d.ts"/>
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Command = void 0;
const iphoneSimulatorLibPath = require("./../iphone-simulator");
const iphone_simulator_1 = require("./../iphone-simulator");
class Command {
execute(args) {
var iphoneSimulator = new iphoneSimulatorLibPath.iPhoneSimulator();
var iphoneSimulator = new iphone_simulator_1.iPhoneSimulator();
return iphoneSimulator.printSDKS();

@@ -10,0 +9,0 @@ }

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

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

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

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

@@ -3,0 +2,0 @@ Object.defineProperty(exports, "__esModule", { value: true });

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const commandExecutorLibPath = require("./command-executor");
var commandExecutor = new commandExecutorLibPath.CommandExecutor();
const command_executor_1 = require("./command-executor");
var commandExecutor = new command_executor_1.CommandExecutor();
commandExecutor.execute();
//# sourceMappingURL=ios-sim-standalone.js.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.startSimulator = exports.getInstalledApplications = void 0;
const bplistParser = require("bplist-parser");
const fs = require("fs");
const _ = require("lodash");
const os_1 = require("os");
const path = require("path");
const plist = require("plist");
const childProcess = require("./child-process");
const xcode = require("./xcode");
const fs = require("fs");
const path = require("path");
const _ = require("lodash");
let bplistParser = require("bplist-parser");
let plist = require("plist");
let osenv = require("osenv");
let isDeviceLogOperationStarted = false;
let pid;
let deviceLogChildProcess;
function getInstalledApplications(deviceId) {
let rootApplicationsPath = path.join(osenv.home(), `/Library/Developer/CoreSimulator/Devices/${deviceId}/data/Containers/Bundle/Application`);
let rootApplicationsPath = path.join((0, os_1.homedir)(), `/Library/Developer/CoreSimulator/Devices/${deviceId}/data/Containers/Bundle/Application`);
if (!fs.existsSync(rootApplicationsPath)) {
rootApplicationsPath = path.join(osenv.home(), `/Library/Developer/CoreSimulator/Devices/${deviceId}/data/Applications`);
rootApplicationsPath = path.join((0, os_1.homedir)(), `/Library/Developer/CoreSimulator/Devices/${deviceId}/data/Applications`);
}

@@ -27,7 +24,7 @@ // since ios 14 - the Applications folder is not created on a fresh simulator, so if it doesn't exist

let result = [];
_.each(applicationGuids, applicationGuid => {
_.each(applicationGuids, (applicationGuid) => {
let fullApplicationPath = path.join(rootApplicationsPath, applicationGuid);
if (fs.statSync(fullApplicationPath).isDirectory()) {
let applicationDirContents = fs.readdirSync(fullApplicationPath);
let applicationName = _.find(applicationDirContents, fileName => path.extname(fileName) === ".app");
let applicationName = _.find(applicationDirContents, (fileName) => path.extname(fileName) === ".app");
let plistFilePath = path.join(fullApplicationPath, applicationName, "Info.plist");

@@ -37,3 +34,3 @@ result.push({

appIdentifier: getBundleIdentifier(plistFilePath),
path: path.join(fullApplicationPath, applicationName)
path: path.join(fullApplicationPath, applicationName),
});

@@ -49,3 +46,3 @@ }

if (deviceId) {
args.push('--args', '-CurrentDeviceUDID', deviceId);
args.push("--args", "-CurrentDeviceUDID", deviceId);
}

@@ -55,6 +52,16 @@ childProcess.execSync(args.join(" "));

exports.startSimulator = startSimulator;
function parsePlist(fileNameOrBuffer) {
let data;
if (Buffer.isBuffer(fileNameOrBuffer)) {
data = fileNameOrBuffer;
}
else {
data = fs.readFileSync(fileNameOrBuffer);
}
return bplistParser.parseBuffer(data);
}
function getBundleIdentifier(plistFilePath) {
let plistData;
try {
plistData = bplistParser.parseFileSync(plistFilePath)[0];
plistData = parsePlist(plistFilePath)[0];
}

@@ -61,0 +68,0 @@ catch (err) {

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

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

@@ -3,0 +2,0 @@ Object.defineProperty(exports, "__esModule", { value: true });

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

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

@@ -14,12 +13,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

exports.XCodeSimctlSimulator = void 0;
const child_process = require("child_process");
const _ = require("lodash");
const childProcess = require("./child-process");
const child_process = require("child_process");
const errors = require("./errors");
const simctl_1 = require("./simctl");
const path = require("path");
const common = require("./iphone-simulator-common");
const path = require("path");
const simctl_1 = require("./simctl");
const utils = require("./utils");
const _ = require("lodash");
const os_1 = require("os");
const iphone_simulator_name_getter_1 = require("./iphone-simulator-name-getter");
const osenv = require("osenv");
class XCodeSimctlSimulator extends iphone_simulator_name_getter_1.IPhoneSimulatorNameGetter {

@@ -40,6 +39,6 @@ constructor() {

let devices = yield this.simctl.getDevices();
return _.map(devices, device => {
return _.map(devices, (device) => {
return {
displayName: `iOS ${device.runtimeVersion}`,
version: device.runtimeVersion
version: device.runtimeVersion,
};

@@ -151,3 +150,6 @@ });

const grepAppProcessCommand = `ps -ef | grep ${bundleExecutable} | grep \/${deviceId}\/`;
return childProcess.execSync(`${grepAppProcessCommand} | grep -v "${grepAppProcessCommand}" | awk '{print $2}'`, null, { skipError: true }).toString().trim();
return childProcess
.execSync(`${grepAppProcessCommand} | grep -v "${grepAppProcessCommand}" | awk '{print $2}'`, null, { skipError: true })
.toString()
.trim();
}

@@ -199,4 +201,9 @@ getDeviceLogProcess(deviceId, predicate) {

else {
const logFilePath = path.join(osenv.home(), "Library", "Logs", "CoreSimulator", deviceId, "system.log");
this.deviceLogChildProcess = child_process.spawn("tail", ['-f', '-n', '1', logFilePath]);
const logFilePath = path.join((0, os_1.homedir)(), "Library", "Logs", "CoreSimulator", deviceId, "system.log");
this.deviceLogChildProcess = child_process.spawn("tail", [
"-f",
"-n",
"1",
logFilePath,
]);
fulfillSafe();

@@ -229,3 +236,4 @@ }

if (deviceIdOrName && sdkVersion) {
return device.runtimeVersion === sdkVersion && (device.name === deviceIdOrName || device.id === deviceIdOrName);
return (device.runtimeVersion === sdkVersion &&
(device.name === deviceIdOrName || device.id === deviceIdOrName));
}

@@ -249,3 +257,3 @@ if (!sdkVersion && !deviceIdOrName) {

}
return device.state === 'Booted';
return device.state === "Booted";
}

@@ -255,3 +263,3 @@ getBootedDevice() {

let devices = yield this.simctl.getDevices();
return _.find(devices, device => this.isDeviceBooted(device));
return _.find(devices, (device) => this.isDeviceBooted(device));
});

@@ -262,3 +270,3 @@ }

const devices = yield this.simctl.getDevices();
return _.filter(devices, device => this.isDeviceBooted(device));
return _.filter(devices, (device) => this.isDeviceBooted(device));
});

@@ -316,3 +324,4 @@ }

const deviceId = device.id || device;
if (!_.find(availableDevices, { id: deviceId }) && !_.find(availableDevices, { name: deviceId })) {
if (!_.find(availableDevices, { id: deviceId }) &&
!_.find(availableDevices, { name: deviceId })) {
errors.fail(`No simulator image available for device identifier '${deviceId}'.`);

@@ -329,6 +338,6 @@ }

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

@@ -29,3 +29,3 @@ "use strict";

if (options.device) {
const hasSuchDevice = _.find(yield this.simulator.getDevices(), device => device.name === options.device || device.id === options.device);
const hasSuchDevice = _.find(yield this.simulator.getDevices(), (device) => device.name === options.device || device.id === options.device);
if (!hasSuchDevice) {

@@ -48,3 +48,3 @@ errors.fail(`Unable to find device ${options.device}.`);

let devices = yield this.simulator.getDevices();
_.each(devices, device => console.log(`Device Identifier: ${device.fullId}. ${os.EOL}Runtime version: ${device.runtimeVersion} ${os.EOL}`));
_.each(devices, (device) => console.log(`Device Identifier: ${device.fullId}. ${os.EOL}Runtime version: ${device.runtimeVersion} ${os.EOL}`));
});

@@ -51,0 +51,0 @@ }

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

///<reference path=".d.ts"/>
"use strict";
var yargs = require("yargs");
const yargs = require("yargs");
const _ = require("lodash");

@@ -20,3 +19,3 @@ class OptionType {

var parsed = {};
var argv = yargs(process.argv.slice(2)).options(knownOptions).argv;
var argv = yargs(process.argv.slice(2)).options(knownOptions).parseSync();
// 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".

@@ -23,0 +22,0 @@ _.each(_.keys(argv), optionName => {

@@ -13,7 +13,7 @@ "use strict";

exports.Simctl = void 0;
const child_process = require("child_process");
const fs = require("fs");
const _ = require("lodash");
const childProcess = require("./child-process");
const child_process = require("child_process");
const errors = require("./errors");
const _ = require("lodash");
const fs = require("fs");
class Simctl {

@@ -57,3 +57,6 @@ launch(deviceId, appIdentifier, options) {

try {
const appContainerPath = yield this.spawnAsync("get_app_container", [deviceId, appIdentifier]);
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.

@@ -82,3 +85,3 @@ return fs.existsSync(appContainerPath) ? appContainerPath : null;

// and the rest of the listing in order to later find the devices
let deviceSectionRegex = /-- (iOS) (.+) --(\n .+)*/mg;
let deviceSectionRegex = /-- (iOS) (.+) --(\n .+)*/gm;
let match = deviceSectionRegex.exec(rawDevices);

@@ -92,3 +95,3 @@ let matches = [];

if (matches.length < 1) {
errors.fail('Could not find device section. ' + match);
errors.fail("Could not find device section. " + match);
}

@@ -100,3 +103,3 @@ // get all the devices for each sdk

// split the full match into lines and remove the first
for (let line of match[0].split('\n').slice(1)) {
for (let line of match[0].split("\n").slice(1)) {
// a line is something like

@@ -114,3 +117,3 @@ // iPhone 4s (A99FFFC3-8E19-4DCF-B585-7D9D46B4C16E) (Shutdown)

if (lineMatch === null) {
errors.fail('Could not match line. ' + line);
errors.fail("Could not match line. " + line);
}

@@ -124,3 +127,3 @@ let available = lineMatch[4];

runtimeVersion: sdk,
state: lineMatch[3]
state: lineMatch[3],
});

@@ -158,3 +161,5 @@ }

try {
const result = childProcess.execSync("xcode-select -p", { stdio: "pipe" });
const result = childProcess.execSync("xcode-select -p", {
stdio: "pipe",
});
canExecuteXcrun = !!(result && result.toString().trim());

@@ -161,0 +166,0 @@ if (!canExecuteXcrun) {

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getXcodeVersionData = exports.getPathFromXcodeSelect = void 0;
const childProcess = require("./child-process");
const childProcess = require("child_process");
function getPathFromXcodeSelect() {

@@ -16,3 +16,3 @@ return childProcess.execSync("xcode-select -print-path").toString().trim();

minor: parts[1],
build: lines[1].split("Build version ")[1]
build: lines[1].split("Build version ")[1],
};

@@ -19,0 +19,0 @@ }

{
"name": "ios-sim-portable",
"version": "4.3.0",
"version": "4.4.0",
"description": "",

@@ -8,6 +8,9 @@ "main": "./lib/ios-sim.js",

"lib/**/*.js",
"lib/**/*.map",
"lib/**/*.d.ts",
"resources"
],
"scripts": {
"prepack": "node prepack.js",
"prepack": "tsc",
"dev": "tsc --watch",
"test": "echo \"Error: no test specified\" && exit 1"

@@ -34,17 +37,14 @@ },

"dependencies": {
"bplist-parser": "https://github.com/telerik/node-bplist-parser/tarball/master",
"lodash": "~4.17.15",
"osenv": "~0.1.5",
"plist": "3.0.1",
"bplist-parser": "0.3.2",
"lodash": "4.17.21",
"plist": "3.0.6",
"shelljs": "~0.8.4",
"yargs": "~16.0.3"
"yargs": "17.7.1"
},
"devDependencies": {
"@types/lodash": "^4.14.161",
"@types/lodash": "4.14.191",
"@types/node": "^14.11.1",
"grunt": "~1.3.0",
"grunt-contrib-clean": "~2.0.0",
"grunt-shell": "~3.0.0",
"grunt-ts": "~6.0.0-beta.22",
"typescript": "4.0.3"
"@types/plist": "^3.0.2",
"@types/yargs": "^17.0.23",
"typescript": "5.0.2"
},

@@ -51,0 +51,0 @@ "engines": {

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