nativescript 8.8.0 → 8.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/config/test-deps-versions-generated.json +1 -1
- package/lib/android-tools-info.js +12 -0
- package/lib/base-package-manager.js +11 -1
- package/lib/bootstrap.js +5 -1
- package/lib/bun-package-manager.js +17 -1
- package/lib/color.js +3 -0
- package/lib/commands/add-platform.js +1 -0
- package/lib/commands/apple-login.js +1 -0
- package/lib/commands/appstore-list.js +1 -0
- package/lib/commands/appstore-upload.js +4 -0
- package/lib/commands/build.js +3 -2
- package/lib/commands/clean.js +22 -1
- package/lib/commands/command-base.js +1 -0
- package/lib/commands/config.js +3 -0
- package/lib/commands/create-project.js +6 -0
- package/lib/commands/debug.js +6 -1
- package/lib/commands/deploy.js +3 -2
- package/lib/commands/embedding/embed.js +7 -0
- package/lib/commands/extensibility/install-extension.js +1 -0
- package/lib/commands/extensibility/list-extensions.js +1 -0
- package/lib/commands/extensibility/uninstall-extension.js +1 -0
- package/lib/commands/fonts.js +1 -0
- package/lib/commands/generate-assets.js +1 -0
- package/lib/commands/generate-help.js +1 -0
- package/lib/commands/generate.js +12 -2
- package/lib/commands/info.js +1 -0
- package/lib/commands/install.js +1 -0
- package/lib/commands/list-platforms.js +1 -0
- package/lib/commands/migrate.js +1 -0
- package/lib/commands/native-add.js +5 -0
- package/lib/commands/platform-clean.js +1 -0
- package/lib/commands/plugin/add-plugin.js +1 -0
- package/lib/commands/plugin/build-plugin.js +1 -0
- package/lib/commands/plugin/create-plugin.js +5 -0
- package/lib/commands/plugin/list-plugins.js +1 -0
- package/lib/commands/plugin/remove-plugin.js +2 -0
- package/lib/commands/plugin/update-plugin.js +1 -0
- package/lib/commands/post-install.js +6 -0
- package/lib/commands/prepare.js +4 -3
- package/lib/commands/preview.js +2 -0
- package/lib/commands/remove-platform.js +1 -0
- package/lib/commands/resources/resources-update.js +2 -0
- package/lib/commands/run.js +1 -0
- package/lib/commands/setup.js +1 -0
- package/lib/commands/start.js +1 -0
- package/lib/commands/test-init.js +4 -0
- package/lib/commands/test.js +9 -2
- package/lib/commands/typings.js +2 -1
- package/lib/commands/update-platform.js +5 -0
- package/lib/commands/update.js +2 -0
- package/lib/common/bootstrap.js +1 -0
- package/lib/common/child-process.js +3 -0
- package/lib/common/codeGeneration/code-entity.js +1 -0
- package/lib/common/codeGeneration/code-printer.js +1 -0
- package/lib/common/command-params.js +1 -0
- package/lib/common/commands/analytics.js +3 -0
- package/lib/common/commands/autocompletion.js +3 -0
- package/lib/common/commands/device/device-log-stream.js +1 -0
- package/lib/common/commands/device/get-file.js +2 -0
- package/lib/common/commands/device/list-applications.js +1 -0
- package/lib/common/commands/device/list-devices.js +3 -0
- package/lib/common/commands/device/list-files.js +2 -0
- package/lib/common/commands/device/put-file.js +2 -0
- package/lib/common/commands/device/run-application.js +1 -0
- package/lib/common/commands/device/stop-application.js +1 -0
- package/lib/common/commands/device/uninstall-application.js +1 -0
- package/lib/common/commands/doctor.js +3 -2
- package/lib/common/commands/generate-messages.js +1 -0
- package/lib/common/commands/help.js +1 -0
- package/lib/common/commands/package-manager-get.js +1 -0
- package/lib/common/commands/package-manager-set.js +1 -0
- package/lib/common/commands/post-install.js +1 -0
- package/lib/common/commands/preuninstall.js +11 -2
- package/lib/common/commands/proxy/proxy-base.js +4 -0
- package/lib/common/commands/proxy/proxy-clear.js +1 -0
- package/lib/common/commands/proxy/proxy-get.js +1 -0
- package/lib/common/commands/proxy/proxy-set.js +1 -0
- package/lib/common/common-lib.js +1 -0
- package/lib/common/constants.js +11 -0
- package/lib/common/decorators.js +48 -0
- package/lib/common/dispatchers.js +10 -1
- package/lib/common/errors.js +13 -3
- package/lib/common/file-system.js +13 -2
- package/lib/common/header.js +3 -0
- package/lib/common/helpers.js +89 -3
- package/lib/common/host-info.js +4 -0
- package/lib/common/http-client.js +20 -0
- package/lib/common/logger/appenders/cli-appender.js +4 -0
- package/lib/common/logger/appenders/emit-appender.js +4 -0
- package/lib/common/logger/layouts/cli-layout.js +1 -0
- package/lib/common/logger/logger.js +5 -0
- package/lib/common/messages/messages.js +6 -0
- package/lib/common/mobile/android/android-application-manager.js +20 -1
- package/lib/common/mobile/android/android-debug-bridge-result-handler.js +1 -0
- package/lib/common/mobile/android/android-debug-bridge.js +6 -0
- package/lib/common/mobile/android/android-device-file-system.js +4 -0
- package/lib/common/mobile/android/android-device-hash-service.js +3 -0
- package/lib/common/mobile/android/android-device.js +8 -0
- package/lib/common/mobile/android/android-emulator-services.js +2 -1
- package/lib/common/mobile/android/android-ini-file-parser.js +9 -0
- package/lib/common/mobile/android/android-log-filter.js +4 -0
- package/lib/common/mobile/android/android-virtual-device-service.js +30 -1
- package/lib/common/mobile/android/device-android-debug-bridge.js +1 -0
- package/lib/common/mobile/android/genymotion/genymotion-service.js +5 -0
- package/lib/common/mobile/android/genymotion/virtualbox-service.js +11 -0
- package/lib/common/mobile/android/logcat-helper.js +13 -0
- package/lib/common/mobile/application-manager-base.js +6 -0
- package/lib/common/mobile/device-emitter.js +4 -0
- package/lib/common/mobile/device-log-emitter.js +1 -0
- package/lib/common/mobile/device-log-provider-base.js +1 -0
- package/lib/common/mobile/device-log-provider.js +23 -0
- package/lib/common/mobile/device-platforms-constants.js +1 -0
- package/lib/common/mobile/emulator-helper.js +4 -0
- package/lib/common/mobile/ios/device/ios-application-manager.js +3 -0
- package/lib/common/mobile/ios/device/ios-device-file-system.js +1 -0
- package/lib/common/mobile/ios/device/ios-device-operations.js +4 -0
- package/lib/common/mobile/ios/device/ios-device.js +4 -0
- package/lib/common/mobile/ios/ios-device-base.js +1 -0
- package/lib/common/mobile/ios/ios-device-product-name-mapper.js +2 -0
- package/lib/common/mobile/ios/ios-log-filter.js +1 -0
- package/lib/common/mobile/ios/simulator/ios-emulator-services.js +4 -0
- package/lib/common/mobile/ios/simulator/ios-sim-resolver.js +1 -0
- package/lib/common/mobile/ios/simulator/ios-simulator-application-manager.js +6 -0
- package/lib/common/mobile/ios/simulator/ios-simulator-device.js +5 -0
- package/lib/common/mobile/ios/simulator/ios-simulator-file-system.js +1 -0
- package/lib/common/mobile/ios/simulator/ios-simulator-log-provider.js +1 -0
- package/lib/common/mobile/local-to-device-path-data-factory.js +1 -0
- package/lib/common/mobile/log-filter.js +2 -0
- package/lib/common/mobile/logging-levels.js +1 -0
- package/lib/common/mobile/mobile-core/android-device-discovery.js +2 -0
- package/lib/common/mobile/mobile-core/android-emulator-discovery.js +3 -0
- package/lib/common/mobile/mobile-core/android-process-service.js +32 -0
- package/lib/common/mobile/mobile-core/device-discovery.js +1 -0
- package/lib/common/mobile/mobile-core/devices-service.js +69 -0
- package/lib/common/mobile/mobile-core/ios-device-discovery.js +2 -0
- package/lib/common/mobile/mobile-core/ios-simulator-discovery.js +3 -0
- package/lib/common/mobile/mobile-helper.js +1 -0
- package/lib/common/mobile/wp8/wp8-emulator-services.js +1 -0
- package/lib/common/opener.js +1 -0
- package/lib/common/os-info.js +1 -0
- package/lib/common/plist-parser.js +1 -0
- package/lib/common/project-helper.js +1 -0
- package/lib/common/prompter.js +9 -1
- package/lib/common/queue.js +1 -0
- package/lib/common/resource-loader.js +1 -0
- package/lib/common/services/auto-completion-service.js +13 -1
- package/lib/common/services/cancellation.js +2 -1
- package/lib/common/services/commands-service.js +17 -6
- package/lib/common/services/help-service.js +11 -3
- package/lib/common/services/hooks-service.js +13 -0
- package/lib/common/services/ios-notification-service.js +1 -0
- package/lib/common/services/json-file-settings-service.js +6 -0
- package/lib/common/services/lock-service.js +6 -0
- package/lib/common/services/message-contract-generator.js +1 -0
- package/lib/common/services/messages-service.js +1 -0
- package/lib/common/services/micro-templating-service.js +6 -0
- package/lib/common/services/net-service.js +3 -0
- package/lib/common/services/project-files-manager.js +5 -0
- package/lib/common/services/project-files-provider-base.js +1 -0
- package/lib/common/services/proxy-service.js +1 -0
- package/lib/common/services/qr.js +1 -0
- package/lib/common/services/settings-service.js +1 -0
- package/lib/common/services/xcode-select-service.js +1 -0
- package/lib/common/utils.js +1 -0
- package/lib/common/validators/project-name-validator.js +1 -0
- package/lib/common/validators/validation-result.js +1 -0
- package/lib/common/verify-node-version.js +8 -1
- package/lib/common/yok.js +32 -11
- package/lib/config.js +22 -1
- package/lib/constants-provider.js +1 -0
- package/lib/constants.js +53 -0
- package/lib/controllers/build-controller.js +4 -3
- package/lib/controllers/debug-controller.js +8 -3
- package/lib/controllers/deploy-controller.js +1 -0
- package/lib/controllers/migrate-controller.js +91 -3
- package/lib/controllers/platform-controller.js +9 -1
- package/lib/controllers/prepare-controller.js +17 -4
- package/lib/controllers/run-controller.js +17 -1
- package/lib/controllers/update-controller-base.js +1 -0
- package/lib/controllers/update-controller.js +11 -0
- package/lib/data/build-data.js +1 -0
- package/lib/data/controller-data-base.js +1 -0
- package/lib/data/debug-data.js +1 -0
- package/lib/data/platform-data.js +1 -0
- package/lib/data/prepare-data.js +1 -0
- package/lib/data/run-data.js +1 -0
- package/lib/detached-processes/cleanup-js-subprocess.js +8 -2
- package/lib/detached-processes/cleanup-process.js +18 -14
- package/lib/detached-processes/file-log-service.js +2 -1
- package/lib/device-path-provider.js +1 -0
- package/lib/device-sockets/ios/app-debug-socket-proxy-factory.js +7 -0
- package/lib/device-sockets/ios/notification.js +3 -0
- package/lib/device-sockets/ios/socket-request-executor.js +3 -0
- package/lib/helpers/android-bundle-validator-helper.js +2 -1
- package/lib/helpers/deploy-command-helper.js +1 -0
- package/lib/helpers/key-command-helper.js +4 -2
- package/lib/helpers/livesync-command-helper.js +4 -1
- package/lib/helpers/network-connectivity-validator.js +1 -0
- package/lib/helpers/options-track-helper.js +3 -2
- package/lib/helpers/package-path-helper.js +1 -0
- package/lib/helpers/platform-command-helper.js +7 -2
- package/lib/helpers/version-validator-helper.js +1 -0
- package/lib/key-commands/bootstrap.js +3 -2
- package/lib/key-commands/index.js +5 -4
- package/lib/nativescript-cli-lib-bootstrap.js +4 -0
- package/lib/nativescript-cli-lib.js +1 -0
- package/lib/nativescript-cli.js +10 -1
- package/lib/node/pbxproj-dom-xcode.js +1 -0
- package/lib/node/xcode.js +1 -0
- package/lib/node-package-manager.js +11 -1
- package/lib/options.js +143 -118
- package/lib/package-installation-manager.js +8 -1
- package/lib/package-manager.js +2 -0
- package/lib/platform-command-param.js +1 -0
- package/lib/pnpm-package-manager.js +4 -1
- package/lib/project-data.js +12 -0
- package/lib/providers/project-files-provider.js +1 -0
- package/lib/resolvers/livesync-service-resolver.js +1 -0
- package/lib/services/analytics/analytics-broker-process.js +10 -6
- package/lib/services/analytics/analytics-broker.js +2 -1
- package/lib/services/analytics/analytics-service.js +29 -25
- package/lib/services/analytics/google-analytics-provider.js +13 -12
- package/lib/services/analytics-settings-service.js +5 -0
- package/lib/services/android/android-bundle-tool-service.js +1 -0
- package/lib/services/android/gradle-build-args-service.js +3 -0
- package/lib/services/android/gradle-build-service.js +1 -0
- package/lib/services/android/gradle-command-service.js +6 -1
- package/lib/services/android-device-debug-service.js +6 -0
- package/lib/services/android-plugin-build-service.js +33 -1
- package/lib/services/android-project-service.js +71 -4
- package/lib/services/android-resources-migration-service.js +7 -0
- package/lib/services/apple-portal/apple-portal-application-service.js +1 -0
- package/lib/services/apple-portal/apple-portal-cookie-service.js +1 -0
- package/lib/services/apple-portal/apple-portal-session-service.js +6 -4
- package/lib/services/assets-generation/assets-generation-service.js +16 -5
- package/lib/services/build-artifacts-service.js +2 -1
- package/lib/services/build-data-service.js +1 -0
- package/lib/services/build-info-file-service.js +1 -0
- package/lib/services/cleanup-service.js +13 -9
- package/lib/services/cocoapods-platform-manager.js +9 -0
- package/lib/services/cocoapods-service.js +21 -1
- package/lib/services/debug-data-service.js +1 -0
- package/lib/services/debug-service-base.js +7 -0
- package/lib/services/device/device-install-app-service.js +2 -1
- package/lib/services/doctor-service.js +21 -6
- package/lib/services/extensibility-service.js +8 -0
- package/lib/services/files-hash-service.js +1 -0
- package/lib/services/hmr-status-service.js +2 -0
- package/lib/services/info-service.js +1 -0
- package/lib/services/initialize-service.js +5 -1
- package/lib/services/ios/export-options-plist-service.js +4 -0
- package/lib/services/ios/ios-signing-service.js +4 -0
- package/lib/services/ios/spm-service.js +9 -0
- package/lib/services/ios/xcodebuild-args-service.js +9 -0
- package/lib/services/ios/xcodebuild-command-service.js +1 -0
- package/lib/services/ios/xcodebuild-service.js +1 -0
- package/lib/services/ios-debugger-port-service.js +1 -0
- package/lib/services/ios-device-debug-service.js +1 -0
- package/lib/services/ios-entitlements-service.js +1 -0
- package/lib/services/ios-extensions-service.js +1 -0
- package/lib/services/ios-log-filter.js +20 -0
- package/lib/services/ios-native-target-service.js +6 -4
- package/lib/services/ios-project-service.js +94 -2
- package/lib/services/ios-provision-service.js +3 -0
- package/lib/services/ios-watch-app-service.js +1 -0
- package/lib/services/ip-service.js +2 -0
- package/lib/services/itmstransporter-service.js +1 -0
- package/lib/services/karma-execution.js +2 -0
- package/lib/services/livesync/android-device-livesync-service-base.js +1 -0
- package/lib/services/livesync/android-device-livesync-service.js +2 -0
- package/lib/services/livesync/android-device-livesync-sockets-service.js +3 -0
- package/lib/services/livesync/android-livesync-service.js +1 -0
- package/lib/services/livesync/android-livesync-tool.js +4 -0
- package/lib/services/livesync/device-livesync-service-base.js +2 -0
- package/lib/services/livesync/ios-device-livesync-service.js +7 -0
- package/lib/services/livesync/ios-livesync-service.js +2 -0
- package/lib/services/livesync/livesync-socket.js +1 -0
- package/lib/services/livesync/platform-livesync-service-base.js +5 -0
- package/lib/services/livesync-process-data-service.js +1 -0
- package/lib/services/log-parser-service.js +1 -0
- package/lib/services/log-source-map-service.js +15 -0
- package/lib/services/marking-mode-service.js +8 -5
- package/lib/services/metadata-filtering-service.js +1 -0
- package/lib/services/npm-config-service.js +4 -0
- package/lib/services/pacote-service.js +7 -0
- package/lib/services/performance-service.js +3 -1
- package/lib/services/platform/add-platform-service.js +49 -2
- package/lib/services/platform/platform-validation-service.js +1 -0
- package/lib/services/platform/prepare-native-platform-service.js +5 -2
- package/lib/services/platform-environment-requirements.js +8 -3
- package/lib/services/platform-project-service-base.js +1 -0
- package/lib/services/platforms-data-service.js +1 -0
- package/lib/services/plugins-service.js +20 -2
- package/lib/services/prepare-data-service.js +1 -0
- package/lib/services/project-backup-service.js +4 -0
- package/lib/services/project-changes-service.js +14 -3
- package/lib/services/project-cleanup-service.js +2 -0
- package/lib/services/project-config-service.js +22 -2
- package/lib/services/project-data-service.js +36 -7
- package/lib/services/project-name-service.js +1 -0
- package/lib/services/project-service.js +10 -0
- package/lib/services/project-templates-service.js +3 -2
- package/lib/services/qr-code-terminal-service.js +1 -0
- package/lib/services/require-service.js +1 -0
- package/lib/services/start-service.js +1 -0
- package/lib/services/temp-service.js +1 -0
- package/lib/services/terminal-spinner-service.js +2 -0
- package/lib/services/test-execution-service.js +9 -2
- package/lib/services/test-initialization-service.js +4 -0
- package/lib/services/timeline-profiler-service.js +1 -0
- package/lib/services/user-settings-service.js +1 -0
- package/lib/services/versions-service.js +6 -4
- package/lib/services/watch-ignore-list-service.js +1 -0
- package/lib/services/webpack/webpack-compiler-service.js +42 -1
- package/lib/services/xcconfig-service.js +2 -0
- package/lib/services/xcproj-service.js +1 -0
- package/lib/shared-event-bus.js +6 -0
- package/lib/sys-info.js +2 -1
- package/lib/tools/config-manipulation/config-transformer.js +12 -0
- package/lib/tools/node-modules/node-modules-builder.js +1 -0
- package/lib/tools/node-modules/node-modules-dependencies-builder.js +6 -0
- package/lib/yarn-package-manager.js +1 -0
- package/lib/yarn2-package-manager.js +3 -0
- package/node_modules/@npmcli/move-file/node_modules/mkdirp/CHANGELOG.md +15 -0
- package/node_modules/rimraf/CHANGELOG.md +65 -0
- package/node_modules/stringify-package/CHANGELOG.md +16 -0
- package/package.json +2 -2
|
@@ -36,6 +36,7 @@ class DeviceLogProvider extends device_log_provider_base_1.DeviceLogProviderBase
|
|
|
36
36
|
this.colorPoolIndex = 0;
|
|
37
37
|
}
|
|
38
38
|
logData(lineText, platform, deviceIdentifier) {
|
|
39
|
+
// console.log(lineText)
|
|
39
40
|
const loggingOptions = this.getDeviceLogOptionsForDevice(deviceIdentifier);
|
|
40
41
|
let data = this.$logFilter.filterData(platform, lineText, loggingOptions);
|
|
41
42
|
data = this.$logSourceMapService.replaceWithOriginalFileLocations(platform, data, loggingOptions);
|
|
@@ -53,6 +54,7 @@ class DeviceLogProvider extends device_log_provider_base_1.DeviceLogProviderBase
|
|
|
53
54
|
return this.deviceColorMap.get(deviceIdentifier);
|
|
54
55
|
}
|
|
55
56
|
const color = this.colorPool[this.colorPoolIndex];
|
|
57
|
+
// wrap around if we have no more colors in the pool
|
|
56
58
|
this.colorPoolIndex =
|
|
57
59
|
this.colorPoolIndex === this.colorPool.length - 1
|
|
58
60
|
? 0
|
|
@@ -62,10 +64,13 @@ class DeviceLogProvider extends device_log_provider_base_1.DeviceLogProviderBase
|
|
|
62
64
|
}
|
|
63
65
|
logDataCore(data, deviceIdentifier) {
|
|
64
66
|
var _a, _b, _c;
|
|
67
|
+
// todo: use config to set logger - --env.classicLogs is temporary!
|
|
65
68
|
if ("classicLogs" in ((_a = this.$options.env) !== null && _a !== void 0 ? _a : {})) {
|
|
69
|
+
// legacy logging
|
|
66
70
|
this.$logger.info(data, { [constants_2.LoggerConfigData.skipNewLine]: true });
|
|
67
71
|
return;
|
|
68
72
|
}
|
|
73
|
+
// todo: extract into an injectable printer/logger service
|
|
69
74
|
let shouldPrepend = false;
|
|
70
75
|
let splitIndexes = [];
|
|
71
76
|
const lines = data
|
|
@@ -120,7 +125,25 @@ class DeviceLogProvider extends device_log_provider_base_1.DeviceLogProviderBase
|
|
|
120
125
|
printLine(prefix, ...parts) {
|
|
121
126
|
const fullLine = parts.join(" ");
|
|
122
127
|
console.log(prefix, fullLine);
|
|
128
|
+
/**
|
|
129
|
+
* Note: Disabled
|
|
130
|
+
*
|
|
131
|
+
* This splits the output into lines that fit within the current
|
|
132
|
+
* terminal width, however this makes copying json objects that
|
|
133
|
+
* span across multiple lines difficult, as it introduces
|
|
134
|
+
* whitespace & line breaks
|
|
135
|
+
*/
|
|
136
|
+
// const maxWidth = process.stdout.columns - 2;
|
|
137
|
+
// if (!maxWidth || maxWidth < 10 || fullLine.length < maxWidth) {
|
|
138
|
+
// console.log(prefix, fullLine);
|
|
139
|
+
// } else {
|
|
140
|
+
// for (let i = 0; i < fullLine.length; i += maxWidth) {
|
|
141
|
+
// const part = fullLine.substring(i, i + maxWidth);
|
|
142
|
+
// console.log(prefix, part);
|
|
143
|
+
// }
|
|
144
|
+
// }
|
|
123
145
|
}
|
|
124
146
|
}
|
|
125
147
|
exports.DeviceLogProvider = DeviceLogProvider;
|
|
126
148
|
yok_1.injector.register("deviceLogProvider", DeviceLogProvider);
|
|
149
|
+
//# sourceMappingURL=device-log-provider.js.map
|
|
@@ -6,7 +6,9 @@ const _ = require("lodash");
|
|
|
6
6
|
const yok_1 = require("../yok");
|
|
7
7
|
class EmulatorHelper {
|
|
8
8
|
constructor() {
|
|
9
|
+
// https://developer.android.com/guide/topics/manifest/uses-sdk-element
|
|
9
10
|
this.mapAndroidApiLevelToVersion = {
|
|
11
|
+
"android-35": "15.0.0",
|
|
10
12
|
"android-34": "14.0.0",
|
|
11
13
|
"android-33": "13.0.0",
|
|
12
14
|
"android-32": "12.0.0",
|
|
@@ -78,7 +80,9 @@ class EmulatorHelper {
|
|
|
78
80
|
emulator.identifier = emulatorId;
|
|
79
81
|
emulator.status = constants_1.RUNNING_EMULATOR_STATUS;
|
|
80
82
|
emulator.type = constants_1.DeviceTypes.Device;
|
|
83
|
+
//emulator.isTablet; // TODO: consider to do this here!!!
|
|
81
84
|
}
|
|
82
85
|
}
|
|
83
86
|
exports.EmulatorHelper = EmulatorHelper;
|
|
84
87
|
yok_1.injector.register("emulatorHelper", EmulatorHelper);
|
|
88
|
+
//# sourceMappingURL=emulator-helper.js.map
|
|
@@ -144,9 +144,11 @@ class IOSApplicationManager extends application_manager_base_1.ApplicationManage
|
|
|
144
144
|
});
|
|
145
145
|
}
|
|
146
146
|
getDebuggableApps() {
|
|
147
|
+
// Implement when we can find debuggable applications for iOS.
|
|
147
148
|
return Promise.resolve([]);
|
|
148
149
|
}
|
|
149
150
|
getDebuggableAppViews(appIdentifiers) {
|
|
151
|
+
// Implement when we can find debuggable applications for iOS.
|
|
150
152
|
return Promise.resolve(null);
|
|
151
153
|
}
|
|
152
154
|
}
|
|
@@ -157,3 +159,4 @@ __decorate([
|
|
|
157
159
|
(0, decorators_1.cache)()
|
|
158
160
|
], IOSApplicationManager.prototype, "startDeviceLog", null);
|
|
159
161
|
exports.IOSApplicationManager = IOSApplicationManager;
|
|
162
|
+
//# sourceMappingURL=ios-application-manager.js.map
|
|
@@ -58,6 +58,7 @@ class IOSDeviceOperations extends events_1.EventEmitter {
|
|
|
58
58
|
if (options && options.shouldReturnImmediateResult) {
|
|
59
59
|
return;
|
|
60
60
|
}
|
|
61
|
+
// We need this because we need to make sure that we have devices.
|
|
61
62
|
yield new Promise((resolve, reject) => {
|
|
62
63
|
let iterationsCount = 0;
|
|
63
64
|
const maxIterationsCount = 3;
|
|
@@ -154,6 +155,8 @@ class IOSDeviceOperations extends events_1.EventEmitter {
|
|
|
154
155
|
});
|
|
155
156
|
}
|
|
156
157
|
dispose(signal) {
|
|
158
|
+
// We need to check if we should dispose the device lib.
|
|
159
|
+
// For example we do not want to dispose it when we start printing the device logs.
|
|
157
160
|
if (this.shouldDispose && this.deviceLib) {
|
|
158
161
|
this.deviceLib.removeAllListeners();
|
|
159
162
|
this.deviceLib.dispose(signal);
|
|
@@ -232,3 +235,4 @@ __decorate([
|
|
|
232
235
|
], IOSDeviceOperations.prototype, "attacheDeviceLogDataHandler", null);
|
|
233
236
|
exports.IOSDeviceOperations = IOSDeviceOperations;
|
|
234
237
|
yok_1.injector.register("iosDeviceOperations", IOSDeviceOperations);
|
|
238
|
+
//# sourceMappingURL=ios-device-operations.js.map
|
|
@@ -122,6 +122,7 @@ class IOSDevice extends ios_device_base_1.IOSDeviceBase {
|
|
|
122
122
|
const majorVersionAsString = productType.match(/.*?(\d+)\,(\d+)/)[1];
|
|
123
123
|
const majorVersion = parseInt(majorVersionAsString);
|
|
124
124
|
let isArm64Architecture = false;
|
|
125
|
+
//https://en.wikipedia.org/wiki/List_of_iOS_devices
|
|
125
126
|
if (_.startsWith(productType, "iphone")) {
|
|
126
127
|
isArm64Architecture = majorVersion >= 6;
|
|
127
128
|
}
|
|
@@ -132,6 +133,7 @@ class IOSDevice extends ios_device_base_1.IOSDeviceBase {
|
|
|
132
133
|
isArm64Architecture = majorVersion >= 7;
|
|
133
134
|
}
|
|
134
135
|
else if (_.startsWith(productType, "realitydevice")) {
|
|
136
|
+
// visionos
|
|
135
137
|
isArm64Architecture = true;
|
|
136
138
|
}
|
|
137
139
|
activeArchitecture = isArm64Architecture ? "arm64" : "armv7";
|
|
@@ -141,6 +143,7 @@ class IOSDevice extends ios_device_base_1.IOSDeviceBase {
|
|
|
141
143
|
getPlatform(productType) {
|
|
142
144
|
productType = productType.toLowerCase().trim();
|
|
143
145
|
if (_.startsWith(productType, "realitydevice")) {
|
|
146
|
+
// visionos
|
|
144
147
|
return this.$devicePlatformsConstants.visionOS;
|
|
145
148
|
}
|
|
146
149
|
return this.$devicePlatformsConstants.iOS;
|
|
@@ -151,3 +154,4 @@ __decorate([
|
|
|
151
154
|
], IOSDevice.prototype, "openDeviceLogStream", null);
|
|
152
155
|
exports.IOSDevice = IOSDevice;
|
|
153
156
|
yok_1.injector.register("iOSDevice", IOSDevice);
|
|
157
|
+
//# sourceMappingURL=ios-device.js.map
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const yok_1 = require("../../yok");
|
|
4
4
|
class IosDeviceProductNameMapper {
|
|
5
5
|
constructor() {
|
|
6
|
+
// http://support.hockeyapp.net/kb/client-integration-ios-mac-os-x/ios-device-types
|
|
6
7
|
this.map = {
|
|
7
8
|
"iPhone1,1": "iPhone",
|
|
8
9
|
"iPhone1,2": "iPhone 3G",
|
|
@@ -63,3 +64,4 @@ class IosDeviceProductNameMapper {
|
|
|
63
64
|
}
|
|
64
65
|
}
|
|
65
66
|
yok_1.injector.register("iOSDeviceProductNameMapper", IosDeviceProductNameMapper);
|
|
67
|
+
//# sourceMappingURL=ios-device-product-name-mapper.js.map
|
|
@@ -28,6 +28,7 @@ class IosEmulatorServices {
|
|
|
28
28
|
try {
|
|
29
29
|
if (options.platform === this.$devicePlatformsConstants.visionOS &&
|
|
30
30
|
!options.emulatorIdOrName) {
|
|
31
|
+
// find first available visionOS simulator (for now).
|
|
31
32
|
const { devices } = yield this.tryGetiOSSimDevices();
|
|
32
33
|
options.emulatorIdOrName = (_a = devices.find((device) => device.platform === this.$devicePlatformsConstants.visionOS)) === null || _a === void 0 ? void 0 : _a.id;
|
|
33
34
|
}
|
|
@@ -73,6 +74,8 @@ class IosEmulatorServices {
|
|
|
73
74
|
connectToPort(data) {
|
|
74
75
|
return __awaiter(this, void 0, void 0, function* () {
|
|
75
76
|
try {
|
|
77
|
+
// node v17+ resolves localhost to ::1 (ipv6) instead of 127.0.0.1 (ipv4)
|
|
78
|
+
// so we explicitly pass ipv4
|
|
76
79
|
const socket = net.connect(data.port, "127.0.0.1");
|
|
77
80
|
return socket;
|
|
78
81
|
}
|
|
@@ -137,3 +140,4 @@ class IosEmulatorServices {
|
|
|
137
140
|
}
|
|
138
141
|
}
|
|
139
142
|
yok_1.injector.register("iOSEmulatorServices", IosEmulatorServices);
|
|
143
|
+
//# sourceMappingURL=ios-emulator-services.js.map
|
|
@@ -21,3 +21,4 @@ IOSSimResolver.iOSSimName = "ios-sim-portable";
|
|
|
21
21
|
IOSSimResolver.iOSStandaloneExecutableName = "ios-sim-standalone.js";
|
|
22
22
|
exports.IOSSimResolver = IOSSimResolver;
|
|
23
23
|
yok_1.injector.register("iOSSimResolver", IOSSimResolver);
|
|
24
|
+
//# sourceMappingURL=ios-sim-resolver.js.map
|
|
@@ -95,9 +95,14 @@ class IOSSimulatorApplicationManager extends application_manager_base_1.Applicat
|
|
|
95
95
|
}
|
|
96
96
|
getDebuggableAppViews(appIdentifiers) {
|
|
97
97
|
return __awaiter(this, void 0, void 0, function* () {
|
|
98
|
+
// Implement when we can find debuggable applications for iOS.
|
|
98
99
|
return Promise.resolve(null);
|
|
99
100
|
});
|
|
100
101
|
}
|
|
102
|
+
// iOS will kill the app if we freeze it in the NativeScript Runtime and wait for debug-brk.
|
|
103
|
+
// In order to avoid that, we are attaching lldb and passing it "process continue".
|
|
104
|
+
// In this way, iOS will not kill the app because it has a native debugger attached
|
|
105
|
+
// and the users will be able to attach a debug session using the debug-brk flag.
|
|
101
106
|
attachNativeDebugger(appId, pid) {
|
|
102
107
|
this._lldbProcesses[appId] = this.$childProcess.spawn("lldb", ["-p", pid]);
|
|
103
108
|
if (log4js.levels.TRACE.isGreaterThanOrEqualTo(this.$logger.getLevel())) {
|
|
@@ -145,3 +150,4 @@ __decorate([
|
|
|
145
150
|
(0, decorators_1.cache)()
|
|
146
151
|
], IOSSimulatorApplicationManager.prototype, "startDeviceLog", null);
|
|
147
152
|
exports.IOSSimulatorApplicationManager = IOSSimulatorApplicationManager;
|
|
153
|
+
//# sourceMappingURL=ios-simulator-application-manager.js.map
|
|
@@ -80,11 +80,15 @@ class IOSSimulator extends ios_device_base_1.IOSDeviceBase {
|
|
|
80
80
|
let socket;
|
|
81
81
|
const attachRequestMessage = this.$iOSNotification.getAttachRequest(appId, this.deviceInfo.identifier);
|
|
82
82
|
yield this.$iOSEmulatorServices.postDarwinNotification(attachRequestMessage, this.deviceInfo.identifier);
|
|
83
|
+
// Retry posting the notification every five seconds, in case the AttachRequest
|
|
84
|
+
// event handler wasn't registered when the first one was sent
|
|
83
85
|
const postNotificationRetryInterval = setInterval(() => {
|
|
84
86
|
this.$iOSEmulatorServices
|
|
85
87
|
.postDarwinNotification(attachRequestMessage, this.deviceInfo.identifier)
|
|
86
88
|
.catch((e) => this.$logger.error(e));
|
|
87
89
|
}, 5e3);
|
|
90
|
+
// the internal retry-mechanism of getDebuggerPort will ensure the above
|
|
91
|
+
// interval has a chance to execute multiple times
|
|
88
92
|
const port = yield _super.getDebuggerPort.call(this, appId).finally(() => {
|
|
89
93
|
clearInterval(postNotificationRetryInterval);
|
|
90
94
|
});
|
|
@@ -104,3 +108,4 @@ __decorate([
|
|
|
104
108
|
(0, decorators_1.cache)()
|
|
105
109
|
], IOSSimulator.prototype, "openDeviceLogStream", null);
|
|
106
110
|
exports.IOSSimulator = IOSSimulator;
|
|
111
|
+
//# sourceMappingURL=ios-simulator-device.js.map
|
|
@@ -24,6 +24,7 @@ class LogFilter {
|
|
|
24
24
|
if (deviceLogFilter) {
|
|
25
25
|
return deviceLogFilter.filterData(data, loggingOptions);
|
|
26
26
|
}
|
|
27
|
+
// In case the platform is not valid, just return the data without filtering.
|
|
27
28
|
return data;
|
|
28
29
|
}
|
|
29
30
|
getDeviceLogFilterInstance(platform) {
|
|
@@ -49,3 +50,4 @@ class LogFilter {
|
|
|
49
50
|
}
|
|
50
51
|
exports.LogFilter = LogFilter;
|
|
51
52
|
yok_1.injector.register("logFilter", LogFilter);
|
|
53
|
+
//# sourceMappingURL=log-filter.js.map
|
|
@@ -54,6 +54,7 @@ class AndroidDeviceDiscovery extends device_discovery_1.DeviceDiscovery {
|
|
|
54
54
|
checkCurrentData(result) {
|
|
55
55
|
return __awaiter(this, void 0, void 0, function* () {
|
|
56
56
|
const currentDevices = result.map((element) => {
|
|
57
|
+
// http://developer.android.com/tools/help/adb.html#devicestatus
|
|
57
58
|
const data = element.split("\t");
|
|
58
59
|
const identifier = data[0];
|
|
59
60
|
const status = data[1];
|
|
@@ -89,3 +90,4 @@ class AndroidDeviceDiscovery extends device_discovery_1.DeviceDiscovery {
|
|
|
89
90
|
}
|
|
90
91
|
exports.AndroidDeviceDiscovery = AndroidDeviceDiscovery;
|
|
91
92
|
yok_1.injector.register("androidDeviceDiscovery", AndroidDeviceDiscovery);
|
|
93
|
+
//# sourceMappingURL=android-device-discovery.js.map
|
|
@@ -31,9 +31,11 @@ class AndroidEmulatorDiscovery extends events_1.EventEmitter {
|
|
|
31
31
|
const availableEmulatorsOutput = yield this.$androidEmulatorServices.getEmulatorImages();
|
|
32
32
|
const currentEmulators = availableEmulatorsOutput.devices;
|
|
33
33
|
const cachedEmulators = _.values(this._emulators);
|
|
34
|
+
// Remove old emulators
|
|
34
35
|
const lostEmulators = _(cachedEmulators)
|
|
35
36
|
.reject((e) => _.some(currentEmulators, (emulator) => emulator && e && emulator.imageIdentifier === e.imageIdentifier))
|
|
36
37
|
.value();
|
|
38
|
+
// Add new emulators
|
|
37
39
|
const foundEmulators = _(currentEmulators)
|
|
38
40
|
.reject((e) => _.some(cachedEmulators, (emulator) => emulator && e && emulator.imageIdentifier === e.imageIdentifier))
|
|
39
41
|
.value();
|
|
@@ -63,3 +65,4 @@ class AndroidEmulatorDiscovery extends events_1.EventEmitter {
|
|
|
63
65
|
}
|
|
64
66
|
exports.AndroidEmulatorDiscovery = AndroidEmulatorDiscovery;
|
|
65
67
|
yok_1.injector.register("androidEmulatorDiscovery", AndroidEmulatorDiscovery);
|
|
68
|
+
//# sourceMappingURL=android-emulator-discovery.js.map
|
|
@@ -87,6 +87,19 @@ class AndroidProcessService {
|
|
|
87
87
|
return __awaiter(this, void 0, void 0, function* () {
|
|
88
88
|
const adb = this.getAdb(deviceIdentifier);
|
|
89
89
|
const androidWebViewPortInformation = (yield this.getAbstractPortsInformation(adb)).split(os_1.EOL);
|
|
90
|
+
// TODO: Add tests and make sure only unique names are returned. Input before groupBy is:
|
|
91
|
+
// [ { deviceIdentifier: 'SH26BW100473',
|
|
92
|
+
// appIdentifier: 'com.telerik.EmptyNS',
|
|
93
|
+
// framework: 'NativeScript' },
|
|
94
|
+
// { deviceIdentifier: 'SH26BW100473',
|
|
95
|
+
// appIdentifier: 'com.telerik.EmptyNS',
|
|
96
|
+
// framework: 'Cordova' },
|
|
97
|
+
// { deviceIdentifier: 'SH26BW100473',
|
|
98
|
+
// appIdentifier: 'chrome',
|
|
99
|
+
// framework: 'Cordova' },
|
|
100
|
+
// { deviceIdentifier: 'SH26BW100473',
|
|
101
|
+
// appIdentifier: 'chrome',
|
|
102
|
+
// framework: 'Cordova' } ]
|
|
90
103
|
const portInformation = yield Promise.all(_.map(androidWebViewPortInformation, (line) => __awaiter(this, void 0, void 0, function* () {
|
|
91
104
|
return (yield this.getApplicationInfoFromWebViewPortInformation(adb, deviceIdentifier, line)) ||
|
|
92
105
|
(yield this.getNativeScriptApplicationInformation(adb, deviceIdentifier, line));
|
|
@@ -135,6 +148,7 @@ class AndroidProcessService {
|
|
|
135
148
|
}
|
|
136
149
|
getApplicationInfoFromWebViewPortInformation(adb, deviceIdentifier, information) {
|
|
137
150
|
return __awaiter(this, void 0, void 0, function* () {
|
|
151
|
+
// Need to search by processId to check for old Android webviews (@webview_devtools_remote_<processId>).
|
|
138
152
|
const processIdRegExp = /@webview_devtools_remote_(.+)/g;
|
|
139
153
|
const processIdMatches = processIdRegExp.exec(information);
|
|
140
154
|
let cordovaAppIdentifier;
|
|
@@ -143,6 +157,7 @@ class AndroidProcessService {
|
|
|
143
157
|
cordovaAppIdentifier = yield this.getApplicationIdentifierFromPid(adb, processId);
|
|
144
158
|
}
|
|
145
159
|
else {
|
|
160
|
+
// Search for appIdentifier (@<appIdentifier>_devtools_remote).
|
|
146
161
|
const chromeAppIdentifierRegExp = /@(.+)_devtools_remote\s?/g;
|
|
147
162
|
const chromeAppIdentifierMatches = chromeAppIdentifierRegExp.exec(information);
|
|
148
163
|
if (chromeAppIdentifierMatches && chromeAppIdentifierMatches.length > 0) {
|
|
@@ -161,6 +176,7 @@ class AndroidProcessService {
|
|
|
161
176
|
}
|
|
162
177
|
getNativeScriptApplicationInformation(adb, deviceIdentifier, information) {
|
|
163
178
|
return __awaiter(this, void 0, void 0, function* () {
|
|
179
|
+
// Search for appIdentifier (@<appIdentifier-debug>).
|
|
164
180
|
const nativeScriptAppIdentifierRegExp = /@(.+)-(debug|inspectorServer)/g;
|
|
165
181
|
const nativeScriptAppIdentifierMatches = nativeScriptAppIdentifierRegExp.exec(information);
|
|
166
182
|
if (nativeScriptAppIdentifierMatches &&
|
|
@@ -177,6 +193,10 @@ class AndroidProcessService {
|
|
|
177
193
|
}
|
|
178
194
|
getAbstractPortForApplication(adb, processId, appIdentifier, abstractPortsInformation, framework) {
|
|
179
195
|
return __awaiter(this, void 0, void 0, function* () {
|
|
196
|
+
// The result will look like this (without the columns names):
|
|
197
|
+
// Num RefCount Protocol Flags Type St Inode Path
|
|
198
|
+
// 0000000000000000: 00000002 00000000 00010000 0001 01 189004 @webview_devtools_remote_25512
|
|
199
|
+
// The Path column is the abstract port.
|
|
180
200
|
framework = framework || "";
|
|
181
201
|
switch (framework.toLowerCase()) {
|
|
182
202
|
case constants_1.TARGET_FRAMEWORK_IDENTIFIERS.Cordova.toLowerCase():
|
|
@@ -207,6 +227,9 @@ class AndroidProcessService {
|
|
|
207
227
|
}
|
|
208
228
|
getProcessIds(adb, appIdentifiers) {
|
|
209
229
|
return __awaiter(this, void 0, void 0, function* () {
|
|
230
|
+
// Process information will look like this (without the columns names):
|
|
231
|
+
// USER PID PPID VSIZE RSS WCHAN PC NAME
|
|
232
|
+
// u0_a63 25512 1334 1519560 96040 ffffffff f76a8f75 S com.telerik.appbuildertabstest
|
|
210
233
|
const result = {};
|
|
211
234
|
const processIdInformation = yield adb.executeShellCommand(["ps"]);
|
|
212
235
|
_.each(appIdentifiers, (appIdentifier) => {
|
|
@@ -219,6 +242,11 @@ class AndroidProcessService {
|
|
|
219
242
|
getAlreadyMappedPort(adb, deviceIdentifier, abstractPort, adbForwardList) {
|
|
220
243
|
return __awaiter(this, void 0, void 0, function* () {
|
|
221
244
|
const allForwardedPorts = adbForwardList || (yield adb.executeCommand(["forward", "--list"])) || "";
|
|
245
|
+
// Sample output:
|
|
246
|
+
// 5e2e580b tcp:62503 localabstract:webview_devtools_remote_7985
|
|
247
|
+
// 5e2e580b tcp:62524 localabstract:webview_devtools_remote_7986
|
|
248
|
+
// 5e2e580b tcp:63160 localabstract:webview_devtools_remote_7987
|
|
249
|
+
// 5e2e580b tcp:57577 localabstract:com.telerik.nrel-debug
|
|
222
250
|
const regex = new RegExp(`${deviceIdentifier}\\s+?tcp:(\\d+?)\\s+?.*?${abstractPort}$`);
|
|
223
251
|
return this.getFirstMatchingGroupFromMultilineResult(allForwardedPorts, regex);
|
|
224
252
|
});
|
|
@@ -234,6 +262,9 @@ class AndroidProcessService {
|
|
|
234
262
|
getApplicationIdentifierFromPid(adb, pid, psData) {
|
|
235
263
|
return __awaiter(this, void 0, void 0, function* () {
|
|
236
264
|
psData = psData || (yield adb.executeShellCommand(["ps"]));
|
|
265
|
+
// Process information will look like this (without the columns names):
|
|
266
|
+
// USER PID PPID VSIZE RSS WCHAN PC NAME
|
|
267
|
+
// u0_a63 25512 1334 1519560 96040 ffffffff f76a8f75 S com.telerik.appbuildertabstest
|
|
237
268
|
return this.getFirstMatchingGroupFromMultilineResult(psData, new RegExp(`\\s+${pid}(?:\\s+\\d+){3}\\s+.*\\s+(.*?)$`));
|
|
238
269
|
});
|
|
239
270
|
}
|
|
@@ -257,3 +288,4 @@ __decorate([
|
|
|
257
288
|
], AndroidProcessService.prototype, "getAppProcessId", null);
|
|
258
289
|
exports.AndroidProcessService = AndroidProcessService;
|
|
259
290
|
yok_1.injector.register("androidProcessService", AndroidProcessService);
|
|
291
|
+
//# sourceMappingURL=android-process-service.js.map
|
|
@@ -72,6 +72,7 @@ class DevicesService extends events_1.EventEmitter {
|
|
|
72
72
|
const device = yield this.getDevice(options.deviceId);
|
|
73
73
|
return device;
|
|
74
74
|
}
|
|
75
|
+
// Now let's take data for each device:
|
|
75
76
|
const availableDevicesAndEmulators = this.getDeviceInstances().filter((d) => d.deviceInfo.status === constants_2.CONNECTED_STATUS &&
|
|
76
77
|
(!this.platform ||
|
|
77
78
|
d.deviceInfo.platform.toLowerCase() === this.platform.toLowerCase()));
|
|
@@ -94,6 +95,8 @@ class DevicesService extends events_1.EventEmitter {
|
|
|
94
95
|
const devices = sortedInstances.filter((d) => !d.isEmulator);
|
|
95
96
|
let selectedInstance;
|
|
96
97
|
if (options.onlyEmulators || options.onlyDevices) {
|
|
98
|
+
// When --emulator or --forDevice is passed, the instances are already filtered
|
|
99
|
+
// So we are sure we have exactly the type we need and we can safely return the last one (highest OS version).
|
|
97
100
|
selectedInstance = _.last(sortedInstances);
|
|
98
101
|
}
|
|
99
102
|
else {
|
|
@@ -156,6 +159,7 @@ class DevicesService extends events_1.EventEmitter {
|
|
|
156
159
|
...additionalErrors,
|
|
157
160
|
];
|
|
158
161
|
}
|
|
162
|
+
// emulator is already running
|
|
159
163
|
if (emulator.status === constants.RUNNING_EMULATOR_STATUS) {
|
|
160
164
|
return null;
|
|
161
165
|
}
|
|
@@ -188,9 +192,11 @@ class DevicesService extends events_1.EventEmitter {
|
|
|
188
192
|
return !!(this.$mobileHelper.isiOSPlatform(device.deviceInfo.platform) &&
|
|
189
193
|
device.isEmulator);
|
|
190
194
|
}
|
|
195
|
+
/* tslint:disable:no-unused-variable */
|
|
191
196
|
setLogLevel(logLevel, deviceIdentifier) {
|
|
192
197
|
this.$deviceLogProvider.setLogLevel(logLevel, deviceIdentifier);
|
|
193
198
|
}
|
|
199
|
+
/* tslint:enable:no-unused-variable */
|
|
194
200
|
isAppInstalledOnDevices(deviceIdentifiers, appId, projectName, projectDir) {
|
|
195
201
|
this.$logger.trace(`Called isInstalledOnDevices for identifiers ${deviceIdentifiers}. AppIdentifier is ${appId}.`);
|
|
196
202
|
return _.map(deviceIdentifiers, (deviceIdentifier) => this.isApplicationInstalledOnDevice(deviceIdentifier, {
|
|
@@ -264,6 +270,9 @@ class DevicesService extends events_1.EventEmitter {
|
|
|
264
270
|
delete this._availableEmulators[emulator.imageIdentifier];
|
|
265
271
|
this.emit(constants.EmulatorDiscoveryNames.EMULATOR_IMAGE_LOST, emulator);
|
|
266
272
|
}
|
|
273
|
+
/**
|
|
274
|
+
* Starts looking for devices. Any found devices are pushed to "_devices" variable.
|
|
275
|
+
*/
|
|
267
276
|
detectCurrentlyAttachedDevices(deviceInitOpts) {
|
|
268
277
|
return __awaiter(this, void 0, void 0, function* () {
|
|
269
278
|
const options = this.getDeviceLookingOptions(deviceInitOpts);
|
|
@@ -336,6 +345,11 @@ class DevicesService extends events_1.EventEmitter {
|
|
|
336
345
|
clearInterval(this.emulatorDetectionInterval);
|
|
337
346
|
}
|
|
338
347
|
}
|
|
348
|
+
/**
|
|
349
|
+
* Returns device that matches an identifier.
|
|
350
|
+
* The identifier is expected to be the same as the running device declares it (emulator-5554 for android or GUID for ios).
|
|
351
|
+
* @param identifier running emulator or device identifier
|
|
352
|
+
*/
|
|
339
353
|
getDeviceByIdentifier(identifier) {
|
|
340
354
|
const searchedDevice = _.find(this.getDeviceInstances(), (device) => {
|
|
341
355
|
if (this.$mobileHelper.isApplePlatform(device.deviceInfo.platform) &&
|
|
@@ -351,6 +365,9 @@ class DevicesService extends events_1.EventEmitter {
|
|
|
351
365
|
}
|
|
352
366
|
return searchedDevice;
|
|
353
367
|
}
|
|
368
|
+
/**
|
|
369
|
+
* Starts looking for running devices. All found devices are pushed to _devices variable.
|
|
370
|
+
*/
|
|
354
371
|
startLookingForDevices(deviceInitOpts) {
|
|
355
372
|
return __awaiter(this, void 0, void 0, function* () {
|
|
356
373
|
this.$logger.trace("startLookingForDevices; platform is %s", this._platform);
|
|
@@ -362,10 +379,20 @@ class DevicesService extends events_1.EventEmitter {
|
|
|
362
379
|
yield this.startDeviceDetectionInterval(deviceInitOpts);
|
|
363
380
|
});
|
|
364
381
|
}
|
|
382
|
+
/**
|
|
383
|
+
* Returns device depending on the passed index.
|
|
384
|
+
* The index refers to assigned number to listed devices by tns device command.
|
|
385
|
+
* @param index assigned device number
|
|
386
|
+
*/
|
|
365
387
|
getDeviceByIndex(index) {
|
|
366
388
|
this.validateIndex(index - 1);
|
|
367
389
|
return this.getDeviceInstances()[index - 1];
|
|
368
390
|
}
|
|
391
|
+
/**
|
|
392
|
+
* Returns running device for specified --device <DeviceId>.
|
|
393
|
+
* Method expects running devices.
|
|
394
|
+
* @param deviceOption parameter passed by the user to --device flag. Can be name, identifier or imageIdentifier.
|
|
395
|
+
*/
|
|
369
396
|
getDevice(deviceOption) {
|
|
370
397
|
return __awaiter(this, void 0, void 0, function* () {
|
|
371
398
|
let device = null;
|
|
@@ -387,6 +414,11 @@ class DevicesService extends events_1.EventEmitter {
|
|
|
387
414
|
return device;
|
|
388
415
|
});
|
|
389
416
|
}
|
|
417
|
+
/**
|
|
418
|
+
* Method runs action for a --device (value), specified by the user.
|
|
419
|
+
* @param action action to be executed if canExecute returns true
|
|
420
|
+
* @param canExecute predicate to decide whether the command can be ran
|
|
421
|
+
*/
|
|
390
422
|
executeOnDevice(action, canExecute) {
|
|
391
423
|
return __awaiter(this, void 0, void 0, function* () {
|
|
392
424
|
if (!canExecute || canExecute(this._device)) {
|
|
@@ -397,6 +429,11 @@ class DevicesService extends events_1.EventEmitter {
|
|
|
397
429
|
}
|
|
398
430
|
});
|
|
399
431
|
}
|
|
432
|
+
/**
|
|
433
|
+
* Executes passed action for each found device.
|
|
434
|
+
* @param action action to be executed if canExecute returns true
|
|
435
|
+
* @param canExecute predicate to decide whether the command can be ran
|
|
436
|
+
*/
|
|
400
437
|
executeOnAllConnectedDevices(action, canExecute) {
|
|
401
438
|
return __awaiter(this, void 0, void 0, function* () {
|
|
402
439
|
const devices = this.filterDevicesByPlatform();
|
|
@@ -450,6 +487,12 @@ class DevicesService extends events_1.EventEmitter {
|
|
|
450
487
|
});
|
|
451
488
|
}));
|
|
452
489
|
}
|
|
490
|
+
/**
|
|
491
|
+
* Runs the passed action if the predicate "canExecute" returns true
|
|
492
|
+
* @param action action to be executed if canExecute returns true.
|
|
493
|
+
* @param canExecute predicate to decide whether the command can be ran
|
|
494
|
+
* @param options all possible options that can be passed to the command.
|
|
495
|
+
*/
|
|
453
496
|
execute(action, canExecute, options) {
|
|
454
497
|
return __awaiter(this, void 0, void 0, function* () {
|
|
455
498
|
assert.ok(this._isInitialized, "Devices services not initialized!");
|
|
@@ -459,6 +502,7 @@ class DevicesService extends events_1.EventEmitter {
|
|
|
459
502
|
this.$mobileHelper.isiOSPlatform(this._platform) &&
|
|
460
503
|
this.$options.emulator &&
|
|
461
504
|
!this.isOnlyiOSSimultorRunning()) {
|
|
505
|
+
// Executes the command only on iOS simulator
|
|
462
506
|
const originalCanExecute = canExecute;
|
|
463
507
|
canExecute = (dev) => this.isiOSSimulator(dev) &&
|
|
464
508
|
(!originalCanExecute || !!originalCanExecute(dev));
|
|
@@ -483,6 +527,11 @@ class DevicesService extends events_1.EventEmitter {
|
|
|
483
527
|
}
|
|
484
528
|
});
|
|
485
529
|
}
|
|
530
|
+
/**
|
|
531
|
+
* Starts emulator or simulator if necessary depending on --device or --emulator flags.
|
|
532
|
+
* If no options are passed runs default emulator/simulator if no devices are connected.
|
|
533
|
+
* @param deviceInitOpts mainly contains information about --emulator and --deviceId flags.
|
|
534
|
+
*/
|
|
486
535
|
startEmulatorIfNecessary(deviceInitOpts) {
|
|
487
536
|
return __awaiter(this, void 0, void 0, function* () {
|
|
488
537
|
if (deviceInitOpts && deviceInitOpts.deviceId && deviceInitOpts.emulator) {
|
|
@@ -492,6 +541,7 @@ class DevicesService extends events_1.EventEmitter {
|
|
|
492
541
|
if (deviceInitOpts &&
|
|
493
542
|
deviceInitOpts.platform &&
|
|
494
543
|
!deviceInitOpts.skipEmulatorStart) {
|
|
544
|
+
// are there any running devices
|
|
495
545
|
this._platform = deviceInitOpts.platform;
|
|
496
546
|
try {
|
|
497
547
|
yield this.startLookingForDevices(deviceInitOpts);
|
|
@@ -519,9 +569,11 @@ class DevicesService extends events_1.EventEmitter {
|
|
|
519
569
|
_startEmulatorIfNecessary(data) {
|
|
520
570
|
return __awaiter(this, void 0, void 0, function* () {
|
|
521
571
|
const deviceInstances = this.getDeviceInstances();
|
|
572
|
+
//if no --device is passed and no devices are found, the default emulator is started
|
|
522
573
|
if (!data.deviceId && _.isEmpty(deviceInstances)) {
|
|
523
574
|
return this.startEmulatorCore(data);
|
|
524
575
|
}
|
|
576
|
+
//check if --device(value) is running, if it's not or it's not the same as is specified, start with name from --device(value)
|
|
525
577
|
if (data.deviceId) {
|
|
526
578
|
if (!helpers.isNumberWithoutExponent(data.deviceId)) {
|
|
527
579
|
const activeDeviceInstance = _.find(deviceInstances, (device) => device.deviceInfo.identifier === data.deviceId);
|
|
@@ -530,6 +582,7 @@ class DevicesService extends events_1.EventEmitter {
|
|
|
530
582
|
}
|
|
531
583
|
}
|
|
532
584
|
}
|
|
585
|
+
// make sure if the target platform is visionOS we don't try to run it on an already running iOS simulator...
|
|
533
586
|
if (data.platform === this.$devicePlatformsConstants.visionOS &&
|
|
534
587
|
deviceInstances.length) {
|
|
535
588
|
const runningDeviceInstance = deviceInstances.find((device) => device.deviceInfo.platform === this.$devicePlatformsConstants.visionOS);
|
|
@@ -537,6 +590,7 @@ class DevicesService extends events_1.EventEmitter {
|
|
|
537
590
|
return this.startEmulatorCore(data);
|
|
538
591
|
}
|
|
539
592
|
}
|
|
593
|
+
// if only emulator flag is passed and no other emulators are running, start default emulator
|
|
540
594
|
if (data.emulator && deviceInstances.length) {
|
|
541
595
|
const runningDeviceInstance = _.some(deviceInstances, (value) => value.isEmulator);
|
|
542
596
|
if (!runningDeviceInstance) {
|
|
@@ -545,6 +599,12 @@ class DevicesService extends events_1.EventEmitter {
|
|
|
545
599
|
}
|
|
546
600
|
});
|
|
547
601
|
}
|
|
602
|
+
/**
|
|
603
|
+
* Takes care of gathering information about all running devices.
|
|
604
|
+
* Sets "_isInitialized" to true after infomation is present.
|
|
605
|
+
* Method expects running devices.
|
|
606
|
+
* @param data mainly contains information about --emulator and --deviceId flags.
|
|
607
|
+
*/
|
|
548
608
|
initialize(data) {
|
|
549
609
|
return __awaiter(this, void 0, void 0, function* () {
|
|
550
610
|
if (!this._deviceInitializePromise) {
|
|
@@ -554,6 +614,7 @@ class DevicesService extends events_1.EventEmitter {
|
|
|
554
614
|
yield this._deviceInitializePromise;
|
|
555
615
|
}
|
|
556
616
|
catch (err) {
|
|
617
|
+
// In case the initalization fails, we want to allow calling `initlialize` again with other arguments for example, so remove the cached promise value.
|
|
557
618
|
this.$logger.trace(`Error while initializing devicesService: ${err}`);
|
|
558
619
|
this._deviceInitializePromise = null;
|
|
559
620
|
throw err;
|
|
@@ -579,6 +640,7 @@ class DevicesService extends events_1.EventEmitter {
|
|
|
579
640
|
deviceInitOpts = deviceInitOpts || {};
|
|
580
641
|
this._data = deviceInitOpts;
|
|
581
642
|
if (!deviceInitOpts.skipEmulatorStart) {
|
|
643
|
+
// TODO: Remove from here as it calls startLookingForDevices, so we double the calls to specific device detection services
|
|
582
644
|
yield this.startEmulatorIfNecessary(deviceInitOpts);
|
|
583
645
|
}
|
|
584
646
|
const platform = deviceInitOpts.platform;
|
|
@@ -609,6 +671,7 @@ class DevicesService extends events_1.EventEmitter {
|
|
|
609
671
|
yield this.startLookingForDevices(deviceLookingOptions);
|
|
610
672
|
}
|
|
611
673
|
else {
|
|
674
|
+
// platform and deviceId are not specified
|
|
612
675
|
if (deviceInitOpts.skipInferPlatform) {
|
|
613
676
|
if (deviceInitOpts.skipDeviceDetectionInterval) {
|
|
614
677
|
yield this.detectCurrentlyAttachedDevices(deviceLookingOptions);
|
|
@@ -723,6 +786,11 @@ class DevicesService extends events_1.EventEmitter {
|
|
|
723
786
|
}
|
|
724
787
|
return null;
|
|
725
788
|
}
|
|
789
|
+
/**
|
|
790
|
+
* Starts emulator for platform and makes sure started devices/emulators/simulators are in _devices array before finishing.
|
|
791
|
+
* @param platform (optional) platform to start emulator/simulator for
|
|
792
|
+
* @param emulatorIdOrName (optional) emulator/simulator image identifier or name
|
|
793
|
+
*/
|
|
726
794
|
startEmulatorCore(deviceInitOpts = {}) {
|
|
727
795
|
return __awaiter(this, void 0, void 0, function* () {
|
|
728
796
|
const { deviceId } = deviceInitOpts;
|
|
@@ -852,3 +920,4 @@ __decorate([
|
|
|
852
920
|
], DevicesService.prototype, "getDebuggableViews", null);
|
|
853
921
|
exports.DevicesService = DevicesService;
|
|
854
922
|
yok_1.injector.register("devicesService", DevicesService);
|
|
923
|
+
//# sourceMappingURL=devices-service.js.map
|