nativescript 8.9.3 → 8.9.4-sap.0
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/lib/android-tools-info.js +12 -0
- package/lib/base-package-manager.js +7 -0
- package/lib/bootstrap.js +5 -1
- package/lib/bun-package-manager.js +14 -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 +3 -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 +4 -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 +48 -1
- 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/commands/widget.js +20 -1
- 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 +3 -2
- 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 +26 -0
- package/lib/common/mobile/android/device-android-debug-bridge.js +1 -0
- package/lib/common/mobile/android/genymotion/genymotion-service.js +6 -1
- 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 +90 -4
- 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 +144 -119
- 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 +1 -0
- package/lib/services/android-device-debug-service.js +6 -0
- package/lib/services/android-plugin-build-service.js +31 -2
- 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/apple-portal/srp/srp-wrapper.js +4 -1
- package/lib/services/assets-generation/assets-generation-service.js +10 -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 +11 -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 +2 -1
- 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 +91 -1
- 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 +21 -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 +40 -0
- 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/package.json +8 -6
- package/vendor/gradle-plugin/build.gradle +3 -3
|
@@ -12,7 +12,10 @@ class ProxyCommandBase {
|
|
|
12
12
|
}
|
|
13
13
|
async tryTrackUsage() {
|
|
14
14
|
try {
|
|
15
|
+
// TODO(Analytics): Check why we have set the `disableAnalytics` to true and we track the command as separate one
|
|
16
|
+
// instead of tracking it through the commandsService.
|
|
15
17
|
this.$logger.trace(this.commandName);
|
|
18
|
+
// await this.$analyticsService.trackFeature(this.commandName);
|
|
16
19
|
}
|
|
17
20
|
catch (ex) {
|
|
18
21
|
this.$logger.trace("Error in trying to track proxy command usage:");
|
|
@@ -21,3 +24,4 @@ class ProxyCommandBase {
|
|
|
21
24
|
}
|
|
22
25
|
}
|
|
23
26
|
exports.ProxyCommandBase = ProxyCommandBase;
|
|
27
|
+
//# sourceMappingURL=proxy-base.js.map
|
package/lib/common/common-lib.js
CHANGED
package/lib/common/constants.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.SOCKET_CONNECTION_TIMEOUT_MS = exports.AndroidVirtualDevice = exports.ATTACH_REQUEST_EVENT_NAME = exports.DEBUGGER_PORT_FOUND_EVENT_NAME = exports.DEFAULT_CHUNK_SIZE = exports.HttpProtocolToPort = exports.HttpStatusCodes = exports.Proxy = exports.IOS_RELAY_NOTIFICATION_COMMAND_TYPE = exports.IOS_OBSERVE_NOTIFICATION_COMMAND_TYPE = exports.IOS_POST_NOTIFICATION_COMMAND_TYPE = exports.FileExtensions = exports.TNS_CORE_MODULES = exports.NODE_MODULES_DIR_NAME = exports.Configurations = exports.TARGET_FRAMEWORK_IDENTIFIERS = exports.FAIL_LIVESYNC_LOG_REGEX = exports.IOS_APP_CRASH_LOG_REG_EXP = exports.IOS_LOG_PREDICATE = exports.DEVICE_LOG_EVENT_NAME = exports.EmulatorDiscoveryNames = exports.DeviceDiscoveryEventNames = exports.HmrConstants = exports.LiveSyncPaths = exports.APPLE_VENDOR_NAME = exports.NOT_RUNNING_EMULATOR_STATUS = exports.RUNNING_EMULATOR_STATUS = exports.CONNECTED_STATUS = exports.UNREACHABLE_STATUS = exports.ERROR_NO_VALID_SUBCOMMAND_FORMAT = exports.ERROR_CANNOT_RESOLVE_DEVICE = exports.ERROR_NO_DEVICES_CANT_USE_IOS_SIMULATOR = exports.ERROR_CANT_USE_SIMULATOR = exports.ERROR_NO_DEVICES = exports.APP_RESOURCES_FOLDER_NAME = exports.DeviceTypes = exports.ProvisionType = void 0;
|
|
4
|
+
// enumeration taken from ProvisionType.cs
|
|
4
5
|
class ProvisionType {
|
|
5
6
|
}
|
|
6
7
|
exports.ProvisionType = ProvisionType;
|
|
@@ -82,6 +83,9 @@ Proxy.CACHE_FILE_NAME = "proxy-cache.json";
|
|
|
82
83
|
Proxy.USE_PROXY = "USE_PROXY";
|
|
83
84
|
Proxy.PROXY_PORT = "PROXY_PORT";
|
|
84
85
|
Proxy.PROXY_HOSTNAME = "PROXY_HOSTNAME";
|
|
86
|
+
/**
|
|
87
|
+
* Http status codes available from `require("http").STATUS_CODES`.
|
|
88
|
+
*/
|
|
85
89
|
class HttpStatusCodes {
|
|
86
90
|
}
|
|
87
91
|
exports.HttpStatusCodes = HttpStatusCodes;
|
|
@@ -107,7 +111,13 @@ AndroidVirtualDevice.INI_FILES_MASK = /^(.*)\.ini$/i;
|
|
|
107
111
|
AndroidVirtualDevice.AVD_FILES_MASK = /^(.*)\.avd$/i;
|
|
108
112
|
AndroidVirtualDevice.MIN_ANDROID_APILEVEL = 17;
|
|
109
113
|
AndroidVirtualDevice.MIN_ANDROID_VERSION = "4.2";
|
|
114
|
+
/**
|
|
115
|
+
* The message that is printed from `avdmanager list avds`
|
|
116
|
+
*/
|
|
110
117
|
AndroidVirtualDevice.AVAILABLE_AVDS_MESSAGE = "Available Android Virtual Devices:";
|
|
118
|
+
/**
|
|
119
|
+
* The delimiter between devices that is used from `avdmanager list avds`
|
|
120
|
+
*/
|
|
111
121
|
AndroidVirtualDevice.AVD_LIST_DELIMITER = "---------";
|
|
112
122
|
AndroidVirtualDevice.CONFIG_INI_FILE_NAME = "config.ini";
|
|
113
123
|
AndroidVirtualDevice.INI_FILE_EXTENSION = ".ini";
|
|
@@ -120,3 +130,4 @@ AndroidVirtualDevice.TIMEOUT_SECONDS = 120;
|
|
|
120
130
|
AndroidVirtualDevice.GENYMOTION_DEFAULT_STDERR_STRING = "Logging activities to file";
|
|
121
131
|
AndroidVirtualDevice.UNABLE_TO_START_EMULATOR_MESSAGE = "Cannot run the app in the selected native emulator. Try to restart the adb server by running the `adb kill-server` command in the Command Prompt, or increase the allocated RAM of the virtual device through the Android Virtual Device manager. NativeScript CLI users can try to increase the timeout of the operation by adding the `--timeout` flag.";
|
|
122
132
|
exports.SOCKET_CONNECTION_TIMEOUT_MS = 30000;
|
|
133
|
+
//# sourceMappingURL=constants.js.map
|
package/lib/common/decorators.js
CHANGED
|
@@ -9,6 +9,32 @@ exports.performanceLog = performanceLog;
|
|
|
9
9
|
exports.deprecated = deprecated;
|
|
10
10
|
const constants_1 = require("../constants");
|
|
11
11
|
const yok_1 = require("./yok");
|
|
12
|
+
/**
|
|
13
|
+
* Caches the result of the first execution of the method and returns it whenever it is called instead of executing it again.
|
|
14
|
+
* Works with methods and getters.
|
|
15
|
+
* @example
|
|
16
|
+
* ```
|
|
17
|
+
* class CacheDecoratorsTest {
|
|
18
|
+
*
|
|
19
|
+
* @cache()
|
|
20
|
+
* public method(num: number): number {
|
|
21
|
+
* return num;
|
|
22
|
+
* }
|
|
23
|
+
*
|
|
24
|
+
* @cache()
|
|
25
|
+
* public get property(): any {
|
|
26
|
+
* // execute some heavy operation.
|
|
27
|
+
* return result;
|
|
28
|
+
* }
|
|
29
|
+
* }
|
|
30
|
+
*
|
|
31
|
+
* const instance = new CacheDecoratorsTest();
|
|
32
|
+
* const result = instance.method(1); // returns 1;
|
|
33
|
+
*
|
|
34
|
+
* // all consecutive calls to instance.method will return 1.
|
|
35
|
+
* const result2 = instance.method(2); // returns 1;
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
12
38
|
function cache() {
|
|
13
39
|
return (target, propertyKey, descriptor) => {
|
|
14
40
|
let result;
|
|
@@ -28,6 +54,7 @@ function cache() {
|
|
|
28
54
|
let memoizeIDCounter = 0;
|
|
29
55
|
function memoize(options) {
|
|
30
56
|
return (target, propertyKey, descriptor) => {
|
|
57
|
+
// todo: remove once surely working as intended.
|
|
31
58
|
const DEBUG = false;
|
|
32
59
|
const memoizeID = memoizeIDCounter++;
|
|
33
60
|
const valueOrGet = descriptor.value ? "value" : "get";
|
|
@@ -48,6 +75,7 @@ function memoize(options) {
|
|
|
48
75
|
cacheMapName,
|
|
49
76
|
hashKey,
|
|
50
77
|
});
|
|
78
|
+
// initialize cache map if not exists
|
|
51
79
|
if (!this.hasOwnProperty(cacheMapName)) {
|
|
52
80
|
DEBUG && console.log("NO CACHE MAP YET, CREATING ONE NOW");
|
|
53
81
|
Object.defineProperty(this, cacheMapName, {
|
|
@@ -62,12 +90,16 @@ function memoize(options) {
|
|
|
62
90
|
console.log({
|
|
63
91
|
cacheMap,
|
|
64
92
|
});
|
|
93
|
+
// check if has memoized value based on hashFn
|
|
65
94
|
if (cacheMap.has(hashKey)) {
|
|
66
95
|
DEBUG && console.log("CACHE HIT");
|
|
96
|
+
// if yes, return cached value
|
|
67
97
|
return cacheMap.get(hashKey);
|
|
68
98
|
}
|
|
69
99
|
DEBUG && console.log("CACHE MISS");
|
|
100
|
+
// if not call original and get result
|
|
70
101
|
const result = originalMethod.apply(this, args);
|
|
102
|
+
// call shouldCache (if passed) with the result or default to true
|
|
71
103
|
let shouldCache = true;
|
|
72
104
|
if (options.shouldCache) {
|
|
73
105
|
shouldCache = options.shouldCache.call(this, result);
|
|
@@ -77,12 +109,21 @@ function memoize(options) {
|
|
|
77
109
|
DEBUG && console.log("CACHING NOW");
|
|
78
110
|
cacheMap.set(hashKey, result);
|
|
79
111
|
}
|
|
112
|
+
// if shouldCache: save result
|
|
80
113
|
DEBUG && console.log("RETURNING", result);
|
|
81
114
|
return result;
|
|
82
115
|
};
|
|
83
116
|
return descriptor;
|
|
84
117
|
};
|
|
85
118
|
}
|
|
119
|
+
/**
|
|
120
|
+
* Calls specific method of the instance before executing the decorated method.
|
|
121
|
+
* This is usable when some of your methods depend on initialize async method, that cannot be invoked in constructor of the class.
|
|
122
|
+
* IMPORTANT: The decorated method must be async.
|
|
123
|
+
* @param {string} methodName The name of the method that will be invoked before calling the decorated method.
|
|
124
|
+
* @param {any[]} methodArgs Args that will be passed to the method that will be invoked before calling the decorated one.
|
|
125
|
+
* @return {any} Result of the decorated method.
|
|
126
|
+
*/
|
|
86
127
|
function invokeBefore(methodName, methodArgs) {
|
|
87
128
|
return (target, propertyKey, descriptor) => {
|
|
88
129
|
const originalValue = descriptor.value;
|
|
@@ -114,6 +155,7 @@ function performanceLog(localInjector) {
|
|
|
114
155
|
const className = target.constructor.name;
|
|
115
156
|
const trackName = `${className}${constants_1.AnalyticsEventLabelDelimiter}${propertyKey}`;
|
|
116
157
|
const performanceService = localInjector.resolve("performanceService");
|
|
158
|
+
//needed for the returned function to have the same name as the original - used in hooks decorator
|
|
117
159
|
const functionWrapper = {
|
|
118
160
|
[originalMethod.name]: function (...args) {
|
|
119
161
|
const start = performanceService.now();
|
|
@@ -139,12 +181,14 @@ function performanceLog(localInjector) {
|
|
|
139
181
|
},
|
|
140
182
|
};
|
|
141
183
|
descriptor.value = functionWrapper[originalMethod.name];
|
|
184
|
+
// used to get parameter names in hooks decorator
|
|
142
185
|
descriptor.value.toString = () => {
|
|
143
186
|
return originalMethod.toString();
|
|
144
187
|
};
|
|
145
188
|
return descriptor;
|
|
146
189
|
};
|
|
147
190
|
}
|
|
191
|
+
// inspired by https://github.com/NativeScript/NativeScript/blob/55dfe25938569edbec89255008e5ad9804901305/tns-core-modules/globals/globals.ts#L121-L137
|
|
148
192
|
function deprecated(additionalInfo, localInjector) {
|
|
149
193
|
const isDeprecatedMessage = " is deprecated.";
|
|
150
194
|
return (target, key, descriptor) => {
|
|
@@ -153,6 +197,7 @@ function deprecated(additionalInfo, localInjector) {
|
|
|
153
197
|
const $logger = localInjector.resolve("logger");
|
|
154
198
|
if (descriptor) {
|
|
155
199
|
if (descriptor.value) {
|
|
200
|
+
// method
|
|
156
201
|
const originalMethod = descriptor.value;
|
|
157
202
|
descriptor.value = function (...args) {
|
|
158
203
|
$logger.warn(`${key.toString()}${isDeprecatedMessage} ${additionalInfo}`);
|
|
@@ -161,6 +206,7 @@ function deprecated(additionalInfo, localInjector) {
|
|
|
161
206
|
return descriptor;
|
|
162
207
|
}
|
|
163
208
|
else {
|
|
209
|
+
// property
|
|
164
210
|
if (descriptor.set) {
|
|
165
211
|
const originalSetter = descriptor.set;
|
|
166
212
|
descriptor.set = function (...args) {
|
|
@@ -179,6 +225,7 @@ function deprecated(additionalInfo, localInjector) {
|
|
|
179
225
|
}
|
|
180
226
|
}
|
|
181
227
|
else {
|
|
228
|
+
// class
|
|
182
229
|
$logger.warn(`${(target &&
|
|
183
230
|
(target.name ||
|
|
184
231
|
(target.constructor && target.constructor.name))) ||
|
|
@@ -187,3 +234,4 @@ function deprecated(additionalInfo, localInjector) {
|
|
|
187
234
|
}
|
|
188
235
|
};
|
|
189
236
|
}
|
|
237
|
+
//# sourceMappingURL=decorators.js.map
|
|
@@ -15,7 +15,9 @@ const yok_1 = require("./yok");
|
|
|
15
15
|
const constants_1 = require("../constants");
|
|
16
16
|
const semver = require("semver");
|
|
17
17
|
class CommandDispatcher {
|
|
18
|
-
constructor($logger,
|
|
18
|
+
constructor($logger,
|
|
19
|
+
// required by the hooksService
|
|
20
|
+
$injector, $cancellation, $commandsService, $staticConfig, $sysInfo, $options, $versionsService, $packageManager, $terminalSpinnerService) {
|
|
19
21
|
this.$logger = $logger;
|
|
20
22
|
this.$injector = $injector;
|
|
21
23
|
this.$cancellation = $cancellation;
|
|
@@ -32,6 +34,7 @@ class CommandDispatcher {
|
|
|
32
34
|
return this.printVersion();
|
|
33
35
|
}
|
|
34
36
|
if (this.$logger.getLevel() === "TRACE" && !this.$options.json) {
|
|
37
|
+
// CommandDispatcher is called from external CLI's only, so pass the path to their package.json
|
|
35
38
|
this.$logger.trace("Collecting system information...");
|
|
36
39
|
const sysInfo = await this.$sysInfo.getSysInfo({
|
|
37
40
|
pathToNativeScriptCliPackageJson: path.join(__dirname, "..", "..", "package.json"),
|
|
@@ -61,6 +64,7 @@ class CommandDispatcher {
|
|
|
61
64
|
await this.$commandsService.tryExecuteCommand(commandName, commandArguments);
|
|
62
65
|
}
|
|
63
66
|
async resolveCommand(commandName, commandArguments, argv) {
|
|
67
|
+
// just a hook point
|
|
64
68
|
return { commandName, commandArguments, argv };
|
|
65
69
|
}
|
|
66
70
|
getCommandName() {
|
|
@@ -68,12 +72,15 @@ class CommandDispatcher {
|
|
|
68
72
|
if (remaining.length > 0) {
|
|
69
73
|
return remaining[0].toString().toLowerCase();
|
|
70
74
|
}
|
|
75
|
+
// if only <CLI_NAME> is specified on console, show console help
|
|
71
76
|
this.$options.help = true;
|
|
72
77
|
return "";
|
|
73
78
|
}
|
|
74
79
|
async printVersion() {
|
|
75
80
|
this.$logger.info(this.$staticConfig.version);
|
|
76
81
|
if (this.$options.json) {
|
|
82
|
+
// we don't check for updates when --json is passed
|
|
83
|
+
// useful for tools that rely on the output of the command
|
|
77
84
|
return;
|
|
78
85
|
}
|
|
79
86
|
const spinner = this.$terminalSpinnerService.createSpinner();
|
|
@@ -101,6 +108,7 @@ class CommandDispatcher {
|
|
|
101
108
|
if (semver.gte(nativescriptCliVersion.currentVersion, nativescriptCliVersion.latestVersion, {
|
|
102
109
|
loose: true,
|
|
103
110
|
})) {
|
|
111
|
+
// up-to-date
|
|
104
112
|
spinner.succeed("Up to date.");
|
|
105
113
|
}
|
|
106
114
|
else {
|
|
@@ -132,3 +140,4 @@ class FutureDispatcher {
|
|
|
132
140
|
}
|
|
133
141
|
}
|
|
134
142
|
yok_1.injector.register("dispatcher", FutureDispatcher, false);
|
|
143
|
+
//# sourceMappingURL=dispatchers.js.map
|
package/lib/common/errors.js
CHANGED
|
@@ -15,7 +15,9 @@ const source_map_1 = require("source-map");
|
|
|
15
15
|
const helpers_1 = require("./helpers");
|
|
16
16
|
const decorators_1 = require("./decorators");
|
|
17
17
|
const yok_1 = require("./yok");
|
|
18
|
+
// we need this to overwrite .stack property (read-only in Error)
|
|
18
19
|
function Exception() {
|
|
20
|
+
/* intentionally left blank */
|
|
19
21
|
}
|
|
20
22
|
Exception.prototype = new Error();
|
|
21
23
|
async function resolveCallStack(error) {
|
|
@@ -60,6 +62,7 @@ async function resolveCallStack(error) {
|
|
|
60
62
|
}));
|
|
61
63
|
let outputMessage = remapped.join("\n");
|
|
62
64
|
if (outputMessage.indexOf(error.message) === -1) {
|
|
65
|
+
// when fibers throw error in node 0.12.x, the stack does NOT contain the message
|
|
63
66
|
outputMessage = outputMessage.replace(/Error/, "Error: " + error.message);
|
|
64
67
|
}
|
|
65
68
|
return outputMessage;
|
|
@@ -83,7 +86,9 @@ function installUncaughtExceptionListener(actionOnException) {
|
|
|
83
86
|
}
|
|
84
87
|
}
|
|
85
88
|
catch (err) {
|
|
86
|
-
|
|
89
|
+
// In case the handler throws error and we do not catch it, we'll go in infinite loop of unhandled rejections.
|
|
90
|
+
// We cannot do anything here as even `console.error` may fail. So just exit the process.
|
|
91
|
+
process.exit(131 /* ErrorCodes.UNHANDLED_REJECTION_FAILURE */);
|
|
87
92
|
}
|
|
88
93
|
};
|
|
89
94
|
process.on("uncaughtException", handler);
|
|
@@ -95,6 +100,7 @@ async function tryTrackException(error, localInjector) {
|
|
|
95
100
|
disableAnalytics = localInjector.resolve("staticConfig").disableAnalytics;
|
|
96
101
|
}
|
|
97
102
|
catch (err) {
|
|
103
|
+
// We should get here only in our unit tests.
|
|
98
104
|
disableAnalytics = true;
|
|
99
105
|
}
|
|
100
106
|
if (!disableAnalytics) {
|
|
@@ -103,6 +109,7 @@ async function tryTrackException(error, localInjector) {
|
|
|
103
109
|
await analyticsService.trackException(error, error.message);
|
|
104
110
|
}
|
|
105
111
|
catch (e) {
|
|
112
|
+
// Do not replace with logger due to cyclic dependency
|
|
106
113
|
console.error("Error while reporting exception: " + e);
|
|
107
114
|
}
|
|
108
115
|
}
|
|
@@ -140,9 +147,10 @@ class Errors {
|
|
|
140
147
|
exception.message = $messagesService.getMessage.apply($messagesService, [opts.formatStr].concat(argsArray));
|
|
141
148
|
}
|
|
142
149
|
catch (err) {
|
|
150
|
+
// Ignore
|
|
143
151
|
}
|
|
144
152
|
exception.stack = new Error(exception.message).stack;
|
|
145
|
-
exception.errorCode = opts.errorCode || 127
|
|
153
|
+
exception.errorCode = opts.errorCode || 127 /* ErrorCodes.UNKNOWN */;
|
|
146
154
|
exception.suggestCommandHelp = suggestCommandHelp;
|
|
147
155
|
exception.proxyAuthenticationRequired = !!opts.proxyAuthenticationRequired;
|
|
148
156
|
exception.printOnStdout = opts.printOnStdout;
|
|
@@ -174,9 +182,10 @@ class Errors {
|
|
|
174
182
|
await printCommandHelpSuggestion();
|
|
175
183
|
}
|
|
176
184
|
await tryTrackException(ex, this.$injector);
|
|
177
|
-
process.exit(_.isNumber(ex.errorCode) ? ex.errorCode : 127);
|
|
185
|
+
process.exit(_.isNumber(ex.errorCode) ? ex.errorCode : 127 /* ErrorCodes.UNKNOWN */);
|
|
178
186
|
}
|
|
179
187
|
}
|
|
188
|
+
// If you want to activate this function, start Node with flags --nouse_idle_notification and --expose_gc
|
|
180
189
|
verifyHeap(message) {
|
|
181
190
|
if (global.gc) {
|
|
182
191
|
console.log("verifyHeap: '%s'", message);
|
|
@@ -189,3 +198,4 @@ __decorate([
|
|
|
189
198
|
(0, decorators_1.deprecated)("Use `fail` instead.")
|
|
190
199
|
], Errors.prototype, "failWithoutHelp", null);
|
|
191
200
|
yok_1.injector.register("errors", Errors);
|
|
201
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -20,12 +20,14 @@ const constants_1 = require("../constants");
|
|
|
20
20
|
const os_1 = require("os");
|
|
21
21
|
const detectNewline = require("detect-newline");
|
|
22
22
|
const archiver_1 = require("archiver");
|
|
23
|
+
// TODO: Add .d.ts for mkdirp module (or use it from @types repo).
|
|
23
24
|
const mkdirp = require("mkdirp");
|
|
24
25
|
let FileSystem = FileSystem_1 = class FileSystem {
|
|
25
26
|
constructor($injector) {
|
|
26
27
|
this.$injector = $injector;
|
|
27
28
|
}
|
|
28
29
|
async zipFiles(zipFile, files, zipPathCallback) {
|
|
30
|
+
//we are resolving it here instead of in the constructor, because config has dependency on file system and config shouldn't require logger
|
|
29
31
|
const $logger = this.$injector.resolve("logger");
|
|
30
32
|
const zip = (0, archiver_1.create)("zip", {
|
|
31
33
|
zlib: {
|
|
@@ -62,10 +64,10 @@ let FileSystem = FileSystem_1 = class FileSystem {
|
|
|
62
64
|
proc = (0, path_1.join)(__dirname, "resources/platform-tools/unzip/win32/unzip");
|
|
63
65
|
}
|
|
64
66
|
else if ($hostInfo.isDarwin) {
|
|
65
|
-
proc = "unzip";
|
|
67
|
+
proc = "unzip"; // darwin unzip is info-zip
|
|
66
68
|
}
|
|
67
69
|
else if ($hostInfo.isLinux) {
|
|
68
|
-
proc = "unzip";
|
|
70
|
+
proc = "unzip"; // linux unzip is info-zip
|
|
69
71
|
}
|
|
70
72
|
if (!isCaseSensitive) {
|
|
71
73
|
zipFile = this.findFileCaseInsensitive(zipFile);
|
|
@@ -106,6 +108,7 @@ let FileSystem = FileSystem_1 = class FileSystem {
|
|
|
106
108
|
}
|
|
107
109
|
catch (err) {
|
|
108
110
|
if (err && err.code !== "ENOENT") {
|
|
111
|
+
// ignore "file doesn't exist" error
|
|
109
112
|
throw err;
|
|
110
113
|
}
|
|
111
114
|
}
|
|
@@ -144,6 +147,7 @@ let FileSystem = FileSystem_1 = class FileSystem {
|
|
|
144
147
|
}
|
|
145
148
|
});
|
|
146
149
|
if (root) {
|
|
150
|
+
// console.log("root", paths);
|
|
147
151
|
return Array.from(paths.values()).reduce((sum, current) => sum + current, 0);
|
|
148
152
|
}
|
|
149
153
|
};
|
|
@@ -216,6 +220,8 @@ let FileSystem = FileSystem_1 = class FileSystem {
|
|
|
216
220
|
writeFile(filename, data, encoding) {
|
|
217
221
|
this.createDirectory((0, path_1.dirname)(filename));
|
|
218
222
|
if (!data) {
|
|
223
|
+
// node 14 will no longer coerce unsupported input to strings anymore.
|
|
224
|
+
// clean any null or undefined data
|
|
219
225
|
data = "";
|
|
220
226
|
}
|
|
221
227
|
fs.writeFileSync(filename, data, { encoding: encoding });
|
|
@@ -246,6 +252,8 @@ let FileSystem = FileSystem_1 = class FileSystem {
|
|
|
246
252
|
return;
|
|
247
253
|
}
|
|
248
254
|
this.createDirectory((0, path_1.dirname)(destinationFileName));
|
|
255
|
+
// MobileApplication.app is resolved as a directory on Mac,
|
|
256
|
+
// therefore we need to copy it recursively as it's not a single file.
|
|
249
257
|
shelljs.cp("-rf", sourceFileName, destinationFileName);
|
|
250
258
|
const err = shelljs.error();
|
|
251
259
|
if (err) {
|
|
@@ -321,7 +329,9 @@ let FileSystem = FileSystem_1 = class FileSystem {
|
|
|
321
329
|
});
|
|
322
330
|
await this.futureFromEvent(chown, "close");
|
|
323
331
|
}
|
|
332
|
+
// nothing to do on Windows, as chown does not work on this platform
|
|
324
333
|
}
|
|
334
|
+
// filterCallback: function(path: String, stat: fs.Stats): Boolean
|
|
325
335
|
enumerateFilesInDirectorySync(directoryPath, filterCallback, opts, foundFiles) {
|
|
326
336
|
foundFiles = foundFiles || [];
|
|
327
337
|
if (!this.exists(directoryPath)) {
|
|
@@ -417,3 +427,4 @@ FileSystem.JSON_OBJECT_REGEXP = new RegExp(`{\\r*\\n*(\\W*)"`, "m");
|
|
|
417
427
|
exports.FileSystem = FileSystem = FileSystem_1 = __decorate([
|
|
418
428
|
injector.register("fs")
|
|
419
429
|
], FileSystem);
|
|
430
|
+
//# sourceMappingURL=file-system.js.map
|
package/lib/common/header.js
CHANGED
|
@@ -13,11 +13,13 @@ function printHeader() {
|
|
|
13
13
|
color_1.color.cyanBright.bold("{N} NativeScript "),
|
|
14
14
|
color_1.color.whiteBright.bold("CLI"),
|
|
15
15
|
color_1.color.dim(` [v${version}] `),
|
|
16
|
+
// color.dim(" │"),
|
|
16
17
|
].join("");
|
|
17
18
|
const tagLine = [
|
|
18
19
|
color_1.color.dim("│ "),
|
|
19
20
|
color_1.color.dim(" → "),
|
|
20
21
|
color_1.color.whiteBright.bold("Empower JavaScript with native APIs "),
|
|
22
|
+
// color.dim(" │"),
|
|
21
23
|
].join("");
|
|
22
24
|
const headerLength = (0, color_1.stripColors)(header).length;
|
|
23
25
|
const tagLineLength = (0, color_1.stripColors)(tagLine).length;
|
|
@@ -27,3 +29,4 @@ function printHeader() {
|
|
|
27
29
|
console.info(" " + tagLine + " ".repeat(width - tagLineLength) + color_1.color.dim("│"));
|
|
28
30
|
console.info(" " + color_1.color.dim("└" + "─".repeat(width - 1) + "┘"));
|
|
29
31
|
}
|
|
32
|
+
//# sourceMappingURL=header.js.map
|
package/lib/common/helpers.js
CHANGED
|
@@ -71,6 +71,13 @@ function doesCurrentNpmCommandMatch(patterns) {
|
|
|
71
71
|
}
|
|
72
72
|
return result;
|
|
73
73
|
}
|
|
74
|
+
/**
|
|
75
|
+
* Equivalent of lodash's some, but instead of lambda, just pass array of Regular Expressions.
|
|
76
|
+
* If any of them matches any of the given elements, true is returned.
|
|
77
|
+
* @param {string[]} array Elements to be checked.
|
|
78
|
+
* @param {RegExp[]} patterns Regular expressions to be tested
|
|
79
|
+
* @returns {boolean} True in case any element of the array matches any of the patterns. False otherwise.
|
|
80
|
+
*/
|
|
74
81
|
function someWithRegExps(array, patterns) {
|
|
75
82
|
return _.some(array, (item) => _.some(patterns, (pattern) => !!item.match(pattern)));
|
|
76
83
|
}
|
|
@@ -82,6 +89,7 @@ function getCurrentNpmCommandArgv() {
|
|
|
82
89
|
result = npmConfigArgv.original || [];
|
|
83
90
|
}
|
|
84
91
|
catch (error) {
|
|
92
|
+
// ignore
|
|
85
93
|
}
|
|
86
94
|
}
|
|
87
95
|
return result;
|
|
@@ -100,6 +108,7 @@ function isInstallingNativeScriptGloballyWithNpm() {
|
|
|
100
108
|
return isInstallCommand && isGlobalCommand && hasNativeScriptPackage;
|
|
101
109
|
}
|
|
102
110
|
function isInstallingNativeScriptGloballyWithYarn() {
|
|
111
|
+
// yarn populates the same env used by npm - npm_config_argv, so check it for yarn specific command
|
|
103
112
|
const isInstallCommand = doesCurrentNpmCommandMatch([/^add$/]);
|
|
104
113
|
const isGlobalCommand = doesCurrentNpmCommandMatch([/^global$/]);
|
|
105
114
|
const hasNativeScriptPackage = doesCurrentNpmCommandMatch([
|
|
@@ -108,6 +117,13 @@ function isInstallingNativeScriptGloballyWithYarn() {
|
|
|
108
117
|
]);
|
|
109
118
|
return isInstallCommand && isGlobalCommand && hasNativeScriptPackage;
|
|
110
119
|
}
|
|
120
|
+
/**
|
|
121
|
+
* Creates regular expression from input string.
|
|
122
|
+
* The method replaces all occurences of RegExp special symbols in the input string with \<symbol>.
|
|
123
|
+
* @param {string} input The string from which a regular expression should be created.
|
|
124
|
+
* @param {string} opts RegExp options, for example "gm" - global and multiline.
|
|
125
|
+
* @returns {RegExp} The regular expression created from the input string.
|
|
126
|
+
*/
|
|
111
127
|
function createRegExp(input, opts) {
|
|
112
128
|
if (!input || !_.isString(input)) {
|
|
113
129
|
throw new Error("Input must be a string.");
|
|
@@ -115,13 +131,20 @@ function createRegExp(input, opts) {
|
|
|
115
131
|
const escapedSource = regExpEscape(input);
|
|
116
132
|
return new RegExp(escapedSource, opts);
|
|
117
133
|
}
|
|
134
|
+
/**
|
|
135
|
+
* Escapes all special symbols used in regex.
|
|
136
|
+
* @param {string} input The string in which to replace the special regexp symbols.
|
|
137
|
+
* @returns {string} A string in which all regex symbols are escaped.
|
|
138
|
+
*/
|
|
118
139
|
function regExpEscape(input) {
|
|
140
|
+
// https://stackoverflow.com/questions/3446170/escape-string-for-use-in-javascript-regex
|
|
119
141
|
return input.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
120
142
|
}
|
|
121
143
|
function getShortPluginName(pluginName) {
|
|
122
144
|
return sanitizePluginName(pluginName).replace(/[\-]/g, "_");
|
|
123
145
|
}
|
|
124
146
|
function sanitizePluginName(pluginName) {
|
|
147
|
+
// avoid long plugin names, exclude the npm module scope (@scope/nativescript-plugin) from the android plugin name
|
|
125
148
|
return pluginName.split("/").pop();
|
|
126
149
|
}
|
|
127
150
|
async function executeActionByChunks(initialData, chunkSize, elementAction) {
|
|
@@ -168,6 +191,13 @@ function deferPromise() {
|
|
|
168
191
|
getResult: () => result,
|
|
169
192
|
};
|
|
170
193
|
}
|
|
194
|
+
/**
|
|
195
|
+
* Executes all promises and does not stop in case any of them throws.
|
|
196
|
+
* Returns the results of all promises in array when all are successfully resolved.
|
|
197
|
+
* In case any of the promises is rejected, rejects the resulted promise with all accumulated errors.
|
|
198
|
+
* @param {Promise<T>[]} promises Promises to be resolved.
|
|
199
|
+
* @returns {Promise<T[]>} New promise which will be resolved with the results of all promises.
|
|
200
|
+
*/
|
|
171
201
|
function settlePromises(promises) {
|
|
172
202
|
return new Promise((resolve, reject) => {
|
|
173
203
|
let settledPromisesCount = 0;
|
|
@@ -183,6 +213,7 @@ function settlePromises(promises) {
|
|
|
183
213
|
results[index] = result;
|
|
184
214
|
})
|
|
185
215
|
.catch((err) => {
|
|
216
|
+
// Accumulate all errors.
|
|
186
217
|
errors.push(err);
|
|
187
218
|
})
|
|
188
219
|
.then(() => {
|
|
@@ -214,12 +245,14 @@ function bashQuote(s) {
|
|
|
214
245
|
if (s[0] === "'" && s[s.length - 1] === "'") {
|
|
215
246
|
return s;
|
|
216
247
|
}
|
|
248
|
+
// replace ' with '"'"' and wrap in ''
|
|
217
249
|
return "'" + s.replace(/'/g, "'\"'\"'") + "'";
|
|
218
250
|
}
|
|
219
251
|
function cmdQuote(s) {
|
|
220
252
|
if (s[0] === '"' && s[s.length - 1] === '"') {
|
|
221
253
|
return s;
|
|
222
254
|
}
|
|
255
|
+
// replace " with \" and wrap in ""
|
|
223
256
|
return '"' + s.replace(/"/g, '\\"') + '"';
|
|
224
257
|
}
|
|
225
258
|
function quoteString(s) {
|
|
@@ -276,6 +309,9 @@ function isInteractive() {
|
|
|
276
309
|
const result = isRunningInTTY() && !isCIEnvironment();
|
|
277
310
|
return result;
|
|
278
311
|
}
|
|
312
|
+
/**
|
|
313
|
+
* Checks if current process is running in Text Terminal (TTY)
|
|
314
|
+
*/
|
|
279
315
|
function isRunningInTTY() {
|
|
280
316
|
return (process.stdout &&
|
|
281
317
|
process.stdout.isTTY &&
|
|
@@ -283,6 +319,10 @@ function isRunningInTTY() {
|
|
|
283
319
|
process.stdin.isTTY);
|
|
284
320
|
}
|
|
285
321
|
function isCIEnvironment() {
|
|
322
|
+
// The following CI environments set their own environment variables that we respect:
|
|
323
|
+
// travis: "CI",
|
|
324
|
+
// circleCI: "CI",
|
|
325
|
+
// jenkins: "JENKINS_HOME"
|
|
286
326
|
return !!(process.env && (process.env.CI || process.env.JENKINS_HOME));
|
|
287
327
|
}
|
|
288
328
|
function toBoolean(str) {
|
|
@@ -337,11 +377,11 @@ function getMessageWithBorders(message, spanLength = 3) {
|
|
|
337
377
|
const longestRowLength = message.split("\n").sort((a, b) => {
|
|
338
378
|
return b.length - a.length;
|
|
339
379
|
})[0].length;
|
|
340
|
-
let border = "*".repeat(longestRowLength + 2 * spanLength);
|
|
380
|
+
let border = "*".repeat(longestRowLength + 2 * spanLength); // * 2 for both sides
|
|
341
381
|
if (border.length % 2 === 0) {
|
|
342
|
-
border += "*";
|
|
382
|
+
border += "*"; // the * should always be an odd number in order to get * in each edge (we will remove the even *s below)
|
|
343
383
|
}
|
|
344
|
-
border = border.replace(/\*\*/g, "* ");
|
|
384
|
+
border = border.replace(/\*\*/g, "* "); // ***** => * * * in order to have similar padding to the side borders
|
|
345
385
|
const formatRow = function (row) {
|
|
346
386
|
return (_.padEnd("*", spanLength) +
|
|
347
387
|
_.padEnd(row, border.length - 2 * spanLength) +
|
|
@@ -371,12 +411,20 @@ function trimSymbol(str, symbol) {
|
|
|
371
411
|
return str;
|
|
372
412
|
}
|
|
373
413
|
function parseJson(data) {
|
|
414
|
+
// Replace BOM from the header of the file if it exists
|
|
374
415
|
return JSON.parse(data.replace(/^\uFEFF/, ""));
|
|
375
416
|
}
|
|
417
|
+
// TODO: Use generic for predicatе predicate: (element: T|T[]) when TypeScript support this.
|
|
376
418
|
async function getFuturesResults(promises, predicate) {
|
|
377
419
|
const results = await Promise.all(promises);
|
|
378
420
|
return _(results).filter(predicate).flatten().value();
|
|
379
421
|
}
|
|
422
|
+
/**
|
|
423
|
+
* Appends zeroes to a version string until it reaches a specified length.
|
|
424
|
+
* @param {string} version The version on which to append zeroes.
|
|
425
|
+
* @param requiredVersionLength The required length of the version string.
|
|
426
|
+
* @returns {string} Appended version string. In case input is null, undefined or empty string, it is returned immediately without appending anything.
|
|
427
|
+
*/
|
|
380
428
|
function appendZeroesToVersion(version, requiredVersionLength) {
|
|
381
429
|
if (version) {
|
|
382
430
|
const zeroesToAppend = requiredVersionLength - version.split(".").length;
|
|
@@ -521,6 +569,14 @@ function getProjectFilesConfig(opts) {
|
|
|
521
569
|
};
|
|
522
570
|
return projectFilesConfig;
|
|
523
571
|
}
|
|
572
|
+
/**
|
|
573
|
+
* Tries to find the process id (PID) of the specified application identifier.
|
|
574
|
+
* This is specific implementation for iOS Simulator, where the running applications are real processes.
|
|
575
|
+
* Their PIDs are printed in a specific format in the the logs, once the application is started.
|
|
576
|
+
* @param {string} applicationIdentifier Application Identifier of the app for which we try to get the PID.
|
|
577
|
+
* @param {string} logLine Line that may contain the PID of the process.
|
|
578
|
+
* @returns {string} The PID of the searched application identifier in case it's found in the current line, null otherwise.
|
|
579
|
+
*/
|
|
524
580
|
function getPidFromiOSSimulatorLogs(applicationIdentifier, logLine) {
|
|
525
581
|
if (logLine) {
|
|
526
582
|
const pidRegExp = new RegExp(`${applicationIdentifier}:\\s?(\\d+)`);
|
|
@@ -568,6 +624,7 @@ function getWinRegPropertyValue(key, propertyName) {
|
|
|
568
624
|
function stringify(value, replacer, space) {
|
|
569
625
|
return JSON.stringify(value, replacer, space || 2);
|
|
570
626
|
}
|
|
627
|
+
//2019-01-07 18:29:50.745
|
|
571
628
|
function getFixedLengthDateString() {
|
|
572
629
|
const currentDate = new Date();
|
|
573
630
|
const year = currentDate.getFullYear();
|
|
@@ -590,6 +647,28 @@ function getFormattedMilliseconds(date) {
|
|
|
590
647
|
}
|
|
591
648
|
return milliseconds;
|
|
592
649
|
}
|
|
650
|
+
//--- begin part copied from AngularJS
|
|
651
|
+
//The MIT License
|
|
652
|
+
//
|
|
653
|
+
//Copyright (c) 2010-2012 Google, Inc. http://angularjs.org
|
|
654
|
+
//
|
|
655
|
+
//Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
656
|
+
//of this software and associated documentation files (the "Software"), to deal
|
|
657
|
+
//in the Software without restriction, including without limitation the rights
|
|
658
|
+
//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
659
|
+
//copies of the Software, and to permit persons to whom the Software is
|
|
660
|
+
//furnished to do so, subject to the following conditions:
|
|
661
|
+
//
|
|
662
|
+
// The above copyright notice and this permission notice shall be included in
|
|
663
|
+
//all copies or substantial portions of the Software.
|
|
664
|
+
//
|
|
665
|
+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
666
|
+
//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
667
|
+
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
668
|
+
//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
669
|
+
//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
670
|
+
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
671
|
+
//THE SOFTWARE.
|
|
593
672
|
const CLASS_NAME = /class\s+([A-Z].+?)(?:\s+.*?)?\{/;
|
|
594
673
|
const CONSTRUCTOR_ARGS = /constructor\s*([^\(]*)\(\s*([^\)]*)\)/m;
|
|
595
674
|
const FN_NAME_AND_ARGS = /^(?:function)?\s*([^\(]*)\(\s*([^\)]*)\)\s*(=>)?\s*[{_]/m;
|
|
@@ -619,6 +698,11 @@ function annotate(fn) {
|
|
|
619
698
|
}
|
|
620
699
|
return $inject;
|
|
621
700
|
}
|
|
701
|
+
/**
|
|
702
|
+
* Returns true if all Android signing options are provided, false otherwise.
|
|
703
|
+
* @param {IAndroidSigningData} signingData The signing data to be validated.
|
|
704
|
+
* @return {void}
|
|
705
|
+
*/
|
|
622
706
|
function hasValidAndroidSigning(signingData) {
|
|
623
707
|
const isValid = signingData &&
|
|
624
708
|
signingData.keyStorePath &&
|
|
@@ -627,3 +711,5 @@ function hasValidAndroidSigning(signingData) {
|
|
|
627
711
|
signingData.keyStoreAliasPassword;
|
|
628
712
|
return !!isValid;
|
|
629
713
|
}
|
|
714
|
+
//--- end part copied from AngularJS
|
|
715
|
+
//# sourceMappingURL=helpers.js.map
|