nativescript 8.9.0-dev.1 → 8.9.0-dev.2
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/.d.ts +1 -0
- package/lib/android-tools-info.js +32 -9
- package/lib/base-package-manager.js +71 -47
- package/lib/bootstrap.js +6 -1
- package/lib/bun-package-manager.js +104 -65
- package/lib/color.js +5 -2
- package/lib/commands/add-platform.js +31 -14
- package/lib/commands/apple-login.js +30 -18
- package/lib/commands/appstore-list.js +46 -34
- package/lib/commands/appstore-upload.js +68 -52
- package/lib/commands/build.js +90 -57
- package/lib/commands/clean.js +197 -161
- package/lib/commands/command-base.js +28 -14
- package/lib/commands/config.js +71 -48
- package/lib/commands/create-project.js +235 -210
- package/lib/commands/debug.js +93 -66
- package/lib/commands/deploy.js +47 -30
- package/lib/commands/embedding/embed.js +59 -33
- package/lib/commands/extensibility/install-extension.js +17 -5
- package/lib/commands/extensibility/list-extensions.js +25 -13
- package/lib/commands/extensibility/uninstall-extension.js +16 -4
- package/lib/commands/fonts.js +42 -30
- package/lib/commands/generate-assets.js +29 -13
- package/lib/commands/generate-help.js +14 -2
- package/lib/commands/generate.js +70 -12
- package/lib/commands/info.js +14 -2
- package/lib/commands/install.js +50 -34
- package/lib/commands/list-platforms.js +26 -14
- package/lib/commands/migrate.js +27 -15
- package/lib/commands/native-add.js +51 -23
- package/lib/commands/platform-clean.js +33 -19
- package/lib/commands/plugin/add-plugin.js +26 -12
- package/lib/commands/plugin/build-plugin.js +45 -31
- package/lib/commands/plugin/create-plugin.js +138 -110
- package/lib/commands/plugin/list-plugins.js +34 -22
- package/lib/commands/plugin/remove-plugin.js +35 -20
- package/lib/commands/plugin/update-plugin.js +34 -20
- package/lib/commands/post-install.js +39 -20
- package/lib/commands/prepare.js +39 -22
- package/lib/commands/preview.js +64 -49
- package/lib/commands/remove-platform.js +19 -7
- package/lib/commands/resources/resources-update.js +28 -13
- package/lib/commands/run.js +77 -55
- package/lib/commands/setup.js +1 -0
- package/lib/commands/start.js +20 -6
- package/lib/commands/test-init.js +138 -123
- package/lib/commands/test.js +97 -67
- package/lib/commands/typings.js +143 -126
- package/lib/commands/update-platform.js +40 -22
- package/lib/commands/update.js +45 -30
- package/lib/commands/widget.js +767 -0
- package/lib/common/bootstrap.js +1 -0
- package/lib/common/child-process.js +75 -53
- package/lib/common/codeGeneration/code-entity.js +2 -1
- package/lib/common/codeGeneration/code-printer.js +2 -1
- package/lib/common/command-params.js +19 -7
- package/lib/common/commands/analytics.js +43 -27
- package/lib/common/commands/autocompletion.js +59 -39
- package/lib/common/commands/device/device-log-stream.js +24 -12
- package/lib/common/commands/device/get-file.js +35 -22
- package/lib/common/commands/device/list-applications.js +24 -12
- package/lib/common/commands/device/list-devices.js +90 -72
- package/lib/common/commands/device/list-files.js +36 -23
- package/lib/common/commands/device/put-file.js +35 -22
- package/lib/common/commands/device/run-application.js +26 -12
- package/lib/common/commands/device/stop-application.js +23 -11
- package/lib/common/commands/device/uninstall-application.js +18 -6
- package/lib/common/commands/doctor.js +3 -2
- package/lib/common/commands/generate-messages.js +29 -17
- package/lib/common/commands/help.js +34 -20
- package/lib/common/commands/package-manager-get.js +18 -6
- package/lib/common/commands/package-manager-set.js +21 -9
- package/lib/common/commands/post-install.js +14 -2
- package/lib/common/commands/preuninstall.js +48 -24
- package/lib/common/commands/proxy/proxy-base.js +23 -8
- package/lib/common/commands/proxy/proxy-clear.js +16 -4
- package/lib/common/commands/proxy/proxy-get.js +15 -3
- package/lib/common/commands/proxy/proxy-set.js +101 -87
- package/lib/common/common-lib.js +1 -0
- package/lib/common/constants.js +22 -11
- package/lib/common/decorators.js +70 -10
- package/lib/common/dispatchers.js +106 -80
- package/lib/common/errors.js +116 -91
- package/lib/common/file-system.js +141 -108
- package/lib/common/header.js +5 -1
- package/lib/common/helpers.js +267 -152
- package/lib/common/host-info.js +54 -37
- package/lib/common/http-client.js +128 -93
- package/lib/common/logger/appenders/cli-appender.js +6 -1
- package/lib/common/logger/appenders/emit-appender.js +6 -1
- package/lib/common/logger/layouts/cli-layout.js +3 -1
- package/lib/common/logger/logger.js +9 -4
- package/lib/common/messages/messages.js +6 -0
- package/lib/common/mobile/android/android-application-manager.js +162 -122
- package/lib/common/mobile/android/android-debug-bridge-result-handler.js +2 -1
- package/lib/common/mobile/android/android-debug-bridge.js +118 -87
- package/lib/common/mobile/android/android-device-file-system.js +135 -98
- package/lib/common/mobile/android/android-device-hash-service.js +78 -50
- package/lib/common/mobile/android/android-device.js +93 -68
- package/lib/common/mobile/android/android-emulator-services.js +131 -105
- package/lib/common/mobile/android/android-ini-file-parser.js +9 -0
- package/lib/common/mobile/android/android-log-filter.js +5 -1
- package/lib/common/mobile/android/android-virtual-device-service.js +123 -76
- package/lib/common/mobile/android/device-android-debug-bridge.js +30 -13
- package/lib/common/mobile/android/genymotion/genymotion-service.js +123 -91
- package/lib/common/mobile/android/genymotion/virtualbox-service.js +92 -64
- package/lib/common/mobile/android/logcat-helper.js +140 -108
- package/lib/common/mobile/application-manager-base.js +113 -84
- 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 +19 -7
- 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 +3 -0
- package/lib/common/mobile/ios/device/ios-application-manager.js +111 -79
- package/lib/common/mobile/ios/device/ios-device-file-system.js +106 -78
- package/lib/common/mobile/ios/device/ios-device-operations.js +146 -105
- package/lib/common/mobile/ios/device/ios-device.js +40 -20
- package/lib/common/mobile/ios/ios-device-base.js +82 -58
- 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 +96 -63
- package/lib/common/mobile/ios/simulator/ios-sim-resolver.js +2 -1
- package/lib/common/mobile/ios/simulator/ios-simulator-application-manager.js +95 -60
- package/lib/common/mobile/ios/simulator/ios-simulator-device.js +48 -27
- package/lib/common/mobile/ios/simulator/ios-simulator-file-system.js +63 -37
- package/lib/common/mobile/ios/simulator/ios-simulator-log-provider.js +36 -24
- 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 +64 -43
- package/lib/common/mobile/mobile-core/android-emulator-discovery.js +35 -21
- package/lib/common/mobile/mobile-core/android-process-service.js +214 -143
- package/lib/common/mobile/mobile-core/device-discovery.js +14 -2
- package/lib/common/mobile/mobile-core/devices-service.js +505 -386
- package/lib/common/mobile/mobile-core/ios-device-discovery.js +37 -24
- package/lib/common/mobile/mobile-core/ios-simulator-discovery.js +65 -47
- package/lib/common/mobile/mobile-helper.js +27 -15
- package/lib/common/mobile/wp8/wp8-emulator-services.js +53 -25
- package/lib/common/opener.js +3 -2
- 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 +114 -91
- package/lib/common/queue.js +21 -9
- package/lib/common/resource-loader.js +1 -0
- package/lib/common/services/auto-completion-service.js +65 -40
- package/lib/common/services/cancellation.js +29 -17
- package/lib/common/services/commands-service.js +180 -146
- package/lib/common/services/help-service.js +166 -133
- package/lib/common/services/hooks-service.js +121 -93
- package/lib/common/services/ios-notification-service.js +35 -21
- package/lib/common/services/json-file-settings-service.js +77 -52
- package/lib/common/services/lock-service.js +58 -35
- package/lib/common/services/message-contract-generator.js +47 -35
- package/lib/common/services/messages-service.js +1 -0
- package/lib/common/services/micro-templating-service.js +21 -4
- package/lib/common/services/net-service.js +110 -90
- package/lib/common/services/project-files-manager.js +28 -10
- package/lib/common/services/project-files-provider-base.js +1 -0
- package/lib/common/services/proxy-service.js +25 -13
- package/lib/common/services/qr.js +25 -13
- package/lib/common/services/settings-service.js +2 -1
- package/lib/common/services/xcode-select-service.js +36 -20
- package/lib/common/utils.js +3 -2
- package/lib/common/validators/project-name-validator.js +2 -1
- package/lib/common/validators/validation-result.js +2 -1
- package/lib/common/verify-node-version.js +11 -3
- package/lib/common/yok.js +69 -35
- package/lib/config.js +72 -36
- package/lib/constants-provider.js +1 -0
- package/lib/constants.js +78 -25
- package/lib/controllers/build-controller.js +100 -82
- package/lib/controllers/debug-controller.js +133 -107
- package/lib/controllers/deploy-controller.js +24 -15
- package/lib/controllers/migrate-controller.js +884 -723
- package/lib/controllers/platform-controller.js +94 -71
- package/lib/controllers/prepare-controller.js +274 -232
- package/lib/controllers/run-controller.js +427 -397
- package/lib/controllers/update-controller-base.js +30 -16
- package/lib/controllers/update-controller.js +130 -94
- 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 +2 -4
- package/lib/data/run-data.js +1 -0
- package/lib/definitions/project.d.ts +26 -0
- package/lib/detached-processes/cleanup-js-subprocess.js +20 -5
- package/lib/detached-processes/cleanup-process.js +43 -30
- package/lib/detached-processes/file-log-service.js +2 -1
- package/lib/device-path-provider.js +35 -23
- package/lib/device-sockets/ios/app-debug-socket-proxy-factory.js +171 -149
- package/lib/device-sockets/ios/notification.js +4 -1
- package/lib/device-sockets/ios/socket-request-executor.js +42 -24
- package/lib/helpers/android-bundle-validator-helper.js +3 -2
- package/lib/helpers/deploy-command-helper.js +50 -44
- package/lib/helpers/key-command-helper.js +17 -6
- package/lib/helpers/livesync-command-helper.js +155 -137
- package/lib/helpers/network-connectivity-validator.js +18 -6
- package/lib/helpers/options-track-helper.js +19 -7
- package/lib/helpers/package-path-helper.js +1 -0
- package/lib/helpers/platform-command-helper.js +127 -101
- package/lib/helpers/version-validator-helper.js +1 -0
- package/lib/key-commands/bootstrap.js +3 -2
- package/lib/key-commands/index.js +205 -154
- package/lib/nativescript-cli-lib-bootstrap.js +4 -0
- package/lib/nativescript-cli-lib.js +1 -0
- package/lib/nativescript-cli.js +24 -6
- package/lib/node/pbxproj-dom-xcode.js +1 -0
- package/lib/node/xcode.js +1 -0
- package/lib/node-package-manager.js +114 -81
- package/lib/options.js +156 -122
- package/lib/package-installation-manager.js +172 -130
- package/lib/package-manager.js +88 -63
- package/lib/platform-command-param.js +16 -4
- package/lib/pnpm-package-manager.js +81 -59
- package/lib/project-data.js +13 -1
- package/lib/providers/project-files-provider.js +2 -1
- package/lib/resolvers/livesync-service-resolver.js +1 -0
- package/lib/services/analytics/analytics-broker-process.js +32 -19
- package/lib/services/analytics/analytics-broker.js +31 -17
- package/lib/services/analytics/analytics-service.js +210 -170
- package/lib/services/analytics/google-analytics-provider.js +59 -43
- package/lib/services/analytics-settings-service.js +37 -15
- package/lib/services/android/android-bundle-tool-service.js +61 -43
- package/lib/services/android/gradle-build-args-service.js +23 -9
- package/lib/services/android/gradle-build-service.js +36 -22
- package/lib/services/android/gradle-command-service.js +36 -22
- package/lib/services/android-device-debug-service.js +123 -90
- package/lib/services/android-plugin-build-service.js +260 -205
- package/lib/services/android-project-service.js +241 -129
- package/lib/services/android-resources-migration-service.js +71 -51
- package/lib/services/apple-portal/apple-portal-application-service.js +64 -46
- package/lib/services/apple-portal/apple-portal-cookie-service.js +1 -0
- package/lib/services/apple-portal/apple-portal-session-service.js +218 -197
- package/lib/services/apple-portal/srp/srp-wrapper.js +61 -43
- package/lib/services/assets-generation/assets-generation-service.js +128 -103
- package/lib/services/build-artifacts-service.js +22 -10
- package/lib/services/build-data-service.js +1 -0
- package/lib/services/build-info-file-service.js +36 -20
- package/lib/services/cleanup-service.js +81 -48
- package/lib/services/cocoapods-platform-manager.js +9 -0
- package/lib/services/cocoapods-service.js +153 -112
- 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 +72 -54
- package/lib/services/doctor-service.js +135 -101
- package/lib/services/extensibility-service.js +108 -81
- package/lib/services/files-hash-service.js +44 -26
- package/lib/services/hmr-status-service.js +3 -1
- package/lib/services/info-service.js +1 -0
- package/lib/services/initialize-service.js +54 -37
- package/lib/services/ios/export-options-plist-service.js +55 -38
- package/lib/services/ios/ios-signing-service.js +191 -168
- package/lib/services/ios/spm-service.js +70 -46
- package/lib/services/ios/xcodebuild-args-service.js +103 -77
- package/lib/services/ios/xcodebuild-command-service.js +26 -14
- package/lib/services/ios/xcodebuild-service.js +72 -52
- package/lib/services/ios-debugger-port-service.js +38 -24
- package/lib/services/ios-device-debug-service.js +103 -75
- package/lib/services/ios-entitlements-service.js +43 -31
- package/lib/services/ios-extensions-service.js +30 -18
- 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 +605 -437
- package/lib/services/ios-provision-service.js +132 -108
- package/lib/services/ios-watch-app-service.js +33 -21
- package/lib/services/ip-service.js +55 -38
- package/lib/services/itmstransporter-service.js +153 -129
- package/lib/services/karma-execution.js +2 -0
- package/lib/services/livesync/android-device-livesync-service-base.js +49 -31
- package/lib/services/livesync/android-device-livesync-service.js +151 -120
- package/lib/services/livesync/android-device-livesync-sockets-service.js +155 -121
- package/lib/services/livesync/android-livesync-service.js +36 -14
- package/lib/services/livesync/android-livesync-tool.js +117 -90
- package/lib/services/livesync/device-livesync-service-base.js +30 -15
- package/lib/services/livesync/ios-device-livesync-service.js +150 -114
- package/lib/services/livesync/ios-livesync-service.js +60 -42
- package/lib/services/livesync/livesync-socket.js +1 -0
- package/lib/services/livesync/platform-livesync-service-base.js +124 -94
- package/lib/services/livesync-process-data-service.js +1 -0
- package/lib/services/log-parser-service.js +2 -1
- package/lib/services/log-source-map-service.js +56 -30
- package/lib/services/marking-mode-service.js +33 -17
- package/lib/services/metadata-filtering-service.js +1 -0
- package/lib/services/npm-config-service.js +5 -1
- package/lib/services/pacote-service.js +71 -49
- package/lib/services/performance-service.js +4 -2
- package/lib/services/platform/add-platform-service.js +119 -51
- package/lib/services/platform/platform-validation-service.js +34 -22
- package/lib/services/platform/prepare-native-platform-service.js +65 -49
- package/lib/services/platform-environment-requirements.js +43 -27
- 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 +168 -125
- package/lib/services/prepare-data-service.js +1 -0
- package/lib/services/project-backup-service.js +5 -1
- package/lib/services/project-changes-service.js +152 -124
- package/lib/services/project-cleanup-service.js +79 -64
- package/lib/services/project-config-service.js +111 -73
- package/lib/services/project-data-service.js +154 -108
- package/lib/services/project-name-service.js +44 -28
- package/lib/services/project-service.js +113 -84
- package/lib/services/project-templates-service.js +68 -52
- package/lib/services/qr-code-terminal-service.js +1 -0
- package/lib/services/require-service.js +1 -0
- package/lib/services/start-service.js +60 -41
- package/lib/services/temp-service.js +22 -8
- package/lib/services/terminal-spinner-service.js +28 -15
- package/lib/services/test-execution-service.js +79 -59
- package/lib/services/test-initialization-service.js +6 -2
- package/lib/services/timeline-profiler-service.js +2 -1
- package/lib/services/user-settings-service.js +1 -0
- package/lib/services/versions-service.js +140 -119
- package/lib/services/watch-ignore-list-service.js +1 -0
- package/lib/services/webpack/webpack-compiler-service.js +279 -215
- package/lib/services/xcconfig-service.js +21 -8
- package/lib/services/xcproj-service.js +1 -0
- package/lib/shared-event-bus.js +6 -0
- package/lib/sys-info.js +63 -45
- package/lib/tools/config-manipulation/config-transformer.js +21 -0
- package/lib/tools/node-modules/node-modules-builder.js +28 -16
- package/lib/tools/node-modules/node-modules-dependencies-builder.js +6 -0
- package/lib/yarn-package-manager.js +79 -59
- package/lib/yarn2-package-manager.js +82 -60
- package/node_modules/@npmcli/move-file/LICENSE.md +22 -0
- package/node_modules/@npmcli/move-file/README.md +69 -0
- package/node_modules/@npmcli/move-file/lib/index.js +185 -0
- package/node_modules/@npmcli/move-file/node_modules/mkdirp/LICENSE +21 -0
- package/node_modules/@npmcli/move-file/node_modules/mkdirp/bin/cmd.js +68 -0
- package/node_modules/@npmcli/move-file/node_modules/mkdirp/index.js +31 -0
- package/node_modules/@npmcli/move-file/node_modules/mkdirp/lib/find-made.js +29 -0
- package/node_modules/@npmcli/move-file/node_modules/mkdirp/lib/mkdirp-manual.js +64 -0
- package/node_modules/@npmcli/move-file/node_modules/mkdirp/lib/mkdirp-native.js +39 -0
- package/node_modules/@npmcli/move-file/node_modules/mkdirp/lib/opts-arg.js +23 -0
- package/node_modules/@npmcli/move-file/node_modules/mkdirp/lib/path-arg.js +29 -0
- package/node_modules/@npmcli/move-file/node_modules/mkdirp/lib/use-native.js +10 -0
- package/node_modules/@npmcli/move-file/node_modules/mkdirp/package.json +44 -0
- package/node_modules/@npmcli/move-file/node_modules/mkdirp/readme.markdown +266 -0
- package/node_modules/@npmcli/move-file/package.json +47 -0
- package/node_modules/balanced-match/.github/FUNDING.yml +2 -0
- package/node_modules/balanced-match/LICENSE.md +21 -0
- package/node_modules/balanced-match/README.md +97 -0
- package/node_modules/balanced-match/index.js +62 -0
- package/node_modules/balanced-match/package.json +48 -0
- package/node_modules/concat-map/.travis.yml +4 -0
- package/node_modules/concat-map/LICENSE +18 -0
- package/node_modules/concat-map/README.markdown +62 -0
- package/node_modules/concat-map/example/map.js +6 -0
- package/node_modules/concat-map/index.js +13 -0
- package/node_modules/concat-map/package.json +43 -0
- package/node_modules/concat-map/test/map.js +39 -0
- package/node_modules/fs.realpath/LICENSE +43 -0
- package/node_modules/fs.realpath/README.md +33 -0
- package/node_modules/fs.realpath/index.js +66 -0
- package/node_modules/fs.realpath/old.js +303 -0
- package/node_modules/fs.realpath/package.json +26 -0
- package/node_modules/inflight/LICENSE +15 -0
- package/node_modules/inflight/README.md +37 -0
- package/node_modules/inflight/inflight.js +54 -0
- package/node_modules/inflight/package.json +29 -0
- package/node_modules/inherits/LICENSE +16 -0
- package/node_modules/inherits/README.md +42 -0
- package/node_modules/inherits/inherits.js +9 -0
- package/node_modules/inherits/inherits_browser.js +27 -0
- package/node_modules/inherits/package.json +29 -0
- package/node_modules/once/LICENSE +15 -0
- package/node_modules/once/README.md +79 -0
- package/node_modules/once/once.js +42 -0
- package/node_modules/once/package.json +33 -0
- package/node_modules/path-is-absolute/index.js +20 -0
- package/node_modules/path-is-absolute/license +21 -0
- package/node_modules/path-is-absolute/package.json +43 -0
- package/node_modules/path-is-absolute/readme.md +59 -0
- package/node_modules/rimraf/LICENSE +15 -0
- package/node_modules/rimraf/README.md +101 -0
- package/node_modules/rimraf/bin.js +68 -0
- package/node_modules/rimraf/node_modules/brace-expansion/LICENSE +21 -0
- package/node_modules/rimraf/node_modules/brace-expansion/README.md +129 -0
- package/node_modules/rimraf/node_modules/brace-expansion/index.js +201 -0
- package/node_modules/rimraf/node_modules/brace-expansion/package.json +47 -0
- package/node_modules/rimraf/node_modules/glob/LICENSE +21 -0
- package/node_modules/rimraf/node_modules/glob/README.md +378 -0
- package/node_modules/rimraf/node_modules/glob/common.js +238 -0
- package/node_modules/rimraf/node_modules/glob/glob.js +790 -0
- package/node_modules/rimraf/node_modules/glob/package.json +55 -0
- package/node_modules/rimraf/node_modules/glob/sync.js +486 -0
- package/node_modules/rimraf/node_modules/minimatch/LICENSE +15 -0
- package/node_modules/rimraf/node_modules/minimatch/README.md +230 -0
- package/node_modules/rimraf/node_modules/minimatch/minimatch.js +947 -0
- package/node_modules/rimraf/node_modules/minimatch/package.json +33 -0
- package/node_modules/rimraf/package.json +32 -0
- package/node_modules/rimraf/rimraf.js +360 -0
- package/node_modules/stringify-package/LICENSE +13 -0
- package/node_modules/stringify-package/README.md +55 -0
- package/node_modules/stringify-package/index.js +18 -0
- package/node_modules/stringify-package/package.json +38 -0
- package/node_modules/wrappy/LICENSE +15 -0
- package/node_modules/wrappy/README.md +36 -0
- package/node_modules/wrappy/package.json +29 -0
- package/node_modules/wrappy/wrappy.js +33 -0
- package/package.json +79 -64
package/lib/common/helpers.js
CHANGED
|
@@ -1,57 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
2
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.stripComments =
|
|
4
|
-
exports.
|
|
5
|
-
exports.someWithRegExps = someWithRegExps;
|
|
6
|
-
exports.getCurrentNpmCommandArgv = getCurrentNpmCommandArgv;
|
|
7
|
-
exports.isInstallingNativeScriptGlobally = isInstallingNativeScriptGlobally;
|
|
8
|
-
exports.createRegExp = createRegExp;
|
|
9
|
-
exports.regExpEscape = regExpEscape;
|
|
10
|
-
exports.getShortPluginName = getShortPluginName;
|
|
11
|
-
exports.executeActionByChunks = executeActionByChunks;
|
|
12
|
-
exports.deferPromise = deferPromise;
|
|
13
|
-
exports.settlePromises = settlePromises;
|
|
14
|
-
exports.getPropertyName = getPropertyName;
|
|
15
|
-
exports.quoteString = quoteString;
|
|
16
|
-
exports.createGUID = createGUID;
|
|
17
|
-
exports.stringReplaceAll = stringReplaceAll;
|
|
18
|
-
exports.isRequestSuccessful = isRequestSuccessful;
|
|
19
|
-
exports.isResponseRedirect = isResponseRedirect;
|
|
20
|
-
exports.formatListOfNames = formatListOfNames;
|
|
21
|
-
exports.getRelativeToRootPath = getRelativeToRootPath;
|
|
22
|
-
exports.setIsInteractive = setIsInteractive;
|
|
23
|
-
exports.isInteractive = isInteractive;
|
|
24
|
-
exports.toBoolean = toBoolean;
|
|
25
|
-
exports.block = block;
|
|
26
|
-
exports.isNumberWithoutExponent = isNumberWithoutExponent;
|
|
27
|
-
exports.fromWindowsRelativePathToUnix = fromWindowsRelativePathToUnix;
|
|
28
|
-
exports.isNullOrWhitespace = isNullOrWhitespace;
|
|
29
|
-
exports.getCurrentEpochTime = getCurrentEpochTime;
|
|
30
|
-
exports.sleep = sleep;
|
|
31
|
-
exports.createTable = createTable;
|
|
32
|
-
exports.getMessageWithBorders = getMessageWithBorders;
|
|
33
|
-
exports.remove = remove;
|
|
34
|
-
exports.trimSymbol = trimSymbol;
|
|
35
|
-
exports.parseJson = parseJson;
|
|
36
|
-
exports.getFuturesResults = getFuturesResults;
|
|
37
|
-
exports.appendZeroesToVersion = appendZeroesToVersion;
|
|
38
|
-
exports.decorateMethod = decorateMethod;
|
|
39
|
-
exports.hook = hook;
|
|
40
|
-
exports.isPromise = isPromise;
|
|
41
|
-
exports.attachAwaitDetach = attachAwaitDetach;
|
|
42
|
-
exports.connectEventually = connectEventually;
|
|
43
|
-
exports.getHash = getHash;
|
|
44
|
-
exports.connectEventuallyUntilTimeout = connectEventuallyUntilTimeout;
|
|
45
|
-
exports.getProjectFilesConfig = getProjectFilesConfig;
|
|
46
|
-
exports.getPidFromiOSSimulatorLogs = getPidFromiOSSimulatorLogs;
|
|
47
|
-
exports.getValueFromNestedObject = getValueFromNestedObject;
|
|
48
|
-
exports.getWinRegPropertyValue = getWinRegPropertyValue;
|
|
49
|
-
exports.stringify = stringify;
|
|
50
|
-
exports.getFixedLengthDateString = getFixedLengthDateString;
|
|
51
|
-
exports.getFormattedDateComponent = getFormattedDateComponent;
|
|
52
|
-
exports.getFormattedMilliseconds = getFormattedMilliseconds;
|
|
53
|
-
exports.annotate = annotate;
|
|
54
|
-
exports.hasValidAndroidSigning = hasValidAndroidSigning;
|
|
12
|
+
exports.getFormattedMilliseconds = exports.getFormattedDateComponent = exports.getFixedLengthDateString = exports.stringify = exports.getWinRegPropertyValue = exports.getValueFromNestedObject = exports.getPidFromiOSSimulatorLogs = exports.getProjectFilesConfig = exports.connectEventuallyUntilTimeout = exports.getHash = exports.connectEventually = exports.attachAwaitDetach = exports.isPromise = exports.hook = exports.decorateMethod = exports.appendZeroesToVersion = exports.getFuturesResults = exports.parseJson = exports.trimSymbol = exports.remove = exports.getMessageWithBorders = exports.createTable = exports.sleep = exports.getCurrentEpochTime = exports.isNullOrWhitespace = exports.fromWindowsRelativePathToUnix = exports.isNumberWithoutExponent = exports.block = exports.toBoolean = exports.isInteractive = exports.setIsInteractive = exports.getRelativeToRootPath = exports.formatListOfNames = exports.isResponseRedirect = exports.isRequestSuccessful = exports.stringReplaceAll = exports.createGUID = exports.quoteString = exports.getPropertyName = exports.settlePromises = exports.deferPromise = exports.executeActionByChunks = exports.getShortPluginName = exports.regExpEscape = exports.createRegExp = exports.isInstallingNativeScriptGlobally = exports.getCurrentNpmCommandArgv = exports.someWithRegExps = exports.doesCurrentNpmCommandMatch = exports.stripComments = void 0;
|
|
13
|
+
exports.hasValidAndroidSigning = exports.annotate = void 0;
|
|
55
14
|
const uuid_1 = require("uuid");
|
|
56
15
|
const os_1 = require("os");
|
|
57
16
|
const constants_1 = require("./constants");
|
|
@@ -63,6 +22,7 @@ function stripComments(content) {
|
|
|
63
22
|
const newContent = content.replace(STRIP_COMMENTS, "");
|
|
64
23
|
return newContent;
|
|
65
24
|
}
|
|
25
|
+
exports.stripComments = stripComments;
|
|
66
26
|
function doesCurrentNpmCommandMatch(patterns) {
|
|
67
27
|
const currentNpmCommandArgv = getCurrentNpmCommandArgv();
|
|
68
28
|
let result = false;
|
|
@@ -71,9 +31,18 @@ function doesCurrentNpmCommandMatch(patterns) {
|
|
|
71
31
|
}
|
|
72
32
|
return result;
|
|
73
33
|
}
|
|
34
|
+
exports.doesCurrentNpmCommandMatch = doesCurrentNpmCommandMatch;
|
|
35
|
+
/**
|
|
36
|
+
* Equivalent of lodash's some, but instead of lambda, just pass array of Regular Expressions.
|
|
37
|
+
* If any of them matches any of the given elements, true is returned.
|
|
38
|
+
* @param {string[]} array Elements to be checked.
|
|
39
|
+
* @param {RegExp[]} patterns Regular expressions to be tested
|
|
40
|
+
* @returns {boolean} True in case any element of the array matches any of the patterns. False otherwise.
|
|
41
|
+
*/
|
|
74
42
|
function someWithRegExps(array, patterns) {
|
|
75
43
|
return _.some(array, (item) => _.some(patterns, (pattern) => !!item.match(pattern)));
|
|
76
44
|
}
|
|
45
|
+
exports.someWithRegExps = someWithRegExps;
|
|
77
46
|
function getCurrentNpmCommandArgv() {
|
|
78
47
|
let result = [];
|
|
79
48
|
if (process.env && process.env.npm_config_argv) {
|
|
@@ -82,14 +51,17 @@ function getCurrentNpmCommandArgv() {
|
|
|
82
51
|
result = npmConfigArgv.original || [];
|
|
83
52
|
}
|
|
84
53
|
catch (error) {
|
|
54
|
+
// ignore
|
|
85
55
|
}
|
|
86
56
|
}
|
|
87
57
|
return result;
|
|
88
58
|
}
|
|
59
|
+
exports.getCurrentNpmCommandArgv = getCurrentNpmCommandArgv;
|
|
89
60
|
function isInstallingNativeScriptGlobally() {
|
|
90
61
|
return (isInstallingNativeScriptGloballyWithNpm() ||
|
|
91
62
|
isInstallingNativeScriptGloballyWithYarn());
|
|
92
63
|
}
|
|
64
|
+
exports.isInstallingNativeScriptGlobally = isInstallingNativeScriptGlobally;
|
|
93
65
|
function isInstallingNativeScriptGloballyWithNpm() {
|
|
94
66
|
const isInstallCommand = doesCurrentNpmCommandMatch([/^install$/, /^i$/]);
|
|
95
67
|
const isGlobalCommand = doesCurrentNpmCommandMatch([/^--global$/, /^-g$/]);
|
|
@@ -100,6 +72,7 @@ function isInstallingNativeScriptGloballyWithNpm() {
|
|
|
100
72
|
return isInstallCommand && isGlobalCommand && hasNativeScriptPackage;
|
|
101
73
|
}
|
|
102
74
|
function isInstallingNativeScriptGloballyWithYarn() {
|
|
75
|
+
// yarn populates the same env used by npm - npm_config_argv, so check it for yarn specific command
|
|
103
76
|
const isInstallCommand = doesCurrentNpmCommandMatch([/^add$/]);
|
|
104
77
|
const isGlobalCommand = doesCurrentNpmCommandMatch([/^global$/]);
|
|
105
78
|
const hasNativeScriptPackage = doesCurrentNpmCommandMatch([
|
|
@@ -108,6 +81,13 @@ function isInstallingNativeScriptGloballyWithYarn() {
|
|
|
108
81
|
]);
|
|
109
82
|
return isInstallCommand && isGlobalCommand && hasNativeScriptPackage;
|
|
110
83
|
}
|
|
84
|
+
/**
|
|
85
|
+
* Creates regular expression from input string.
|
|
86
|
+
* The method replaces all occurences of RegExp special symbols in the input string with \<symbol>.
|
|
87
|
+
* @param {string} input The string from which a regular expression should be created.
|
|
88
|
+
* @param {string} opts RegExp options, for example "gm" - global and multiline.
|
|
89
|
+
* @returns {RegExp} The regular expression created from the input string.
|
|
90
|
+
*/
|
|
111
91
|
function createRegExp(input, opts) {
|
|
112
92
|
if (!input || !_.isString(input)) {
|
|
113
93
|
throw new Error("Input must be a string.");
|
|
@@ -115,31 +95,44 @@ function createRegExp(input, opts) {
|
|
|
115
95
|
const escapedSource = regExpEscape(input);
|
|
116
96
|
return new RegExp(escapedSource, opts);
|
|
117
97
|
}
|
|
98
|
+
exports.createRegExp = createRegExp;
|
|
99
|
+
/**
|
|
100
|
+
* Escapes all special symbols used in regex.
|
|
101
|
+
* @param {string} input The string in which to replace the special regexp symbols.
|
|
102
|
+
* @returns {string} A string in which all regex symbols are escaped.
|
|
103
|
+
*/
|
|
118
104
|
function regExpEscape(input) {
|
|
105
|
+
// https://stackoverflow.com/questions/3446170/escape-string-for-use-in-javascript-regex
|
|
119
106
|
return input.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
120
107
|
}
|
|
108
|
+
exports.regExpEscape = regExpEscape;
|
|
121
109
|
function getShortPluginName(pluginName) {
|
|
122
110
|
return sanitizePluginName(pluginName).replace(/[\-]/g, "_");
|
|
123
111
|
}
|
|
112
|
+
exports.getShortPluginName = getShortPluginName;
|
|
124
113
|
function sanitizePluginName(pluginName) {
|
|
114
|
+
// avoid long plugin names, exclude the npm module scope (@scope/nativescript-plugin) from the android plugin name
|
|
125
115
|
return pluginName.split("/").pop();
|
|
126
116
|
}
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
117
|
+
function executeActionByChunks(initialData, chunkSize, elementAction) {
|
|
118
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
119
|
+
let arrayToChunk;
|
|
120
|
+
let action;
|
|
121
|
+
if (_.isArray(initialData)) {
|
|
122
|
+
arrayToChunk = initialData;
|
|
123
|
+
action = (element) => elementAction(element, initialData.indexOf(element));
|
|
124
|
+
}
|
|
125
|
+
else {
|
|
126
|
+
arrayToChunk = _.keys(initialData);
|
|
127
|
+
action = (key) => elementAction(initialData[key], key);
|
|
128
|
+
}
|
|
129
|
+
const chunks = _.chunk(arrayToChunk, chunkSize);
|
|
130
|
+
for (const chunk of chunks) {
|
|
131
|
+
yield Promise.all(_.map(chunk, (element) => action(element)));
|
|
132
|
+
}
|
|
133
|
+
});
|
|
142
134
|
}
|
|
135
|
+
exports.executeActionByChunks = executeActionByChunks;
|
|
143
136
|
function deferPromise() {
|
|
144
137
|
let resolve;
|
|
145
138
|
let reject;
|
|
@@ -168,6 +161,14 @@ function deferPromise() {
|
|
|
168
161
|
getResult: () => result,
|
|
169
162
|
};
|
|
170
163
|
}
|
|
164
|
+
exports.deferPromise = deferPromise;
|
|
165
|
+
/**
|
|
166
|
+
* Executes all promises and does not stop in case any of them throws.
|
|
167
|
+
* Returns the results of all promises in array when all are successfully resolved.
|
|
168
|
+
* In case any of the promises is rejected, rejects the resulted promise with all accumulated errors.
|
|
169
|
+
* @param {Promise<T>[]} promises Promises to be resolved.
|
|
170
|
+
* @returns {Promise<T[]>} New promise which will be resolved with the results of all promises.
|
|
171
|
+
*/
|
|
171
172
|
function settlePromises(promises) {
|
|
172
173
|
return new Promise((resolve, reject) => {
|
|
173
174
|
let settledPromisesCount = 0;
|
|
@@ -183,6 +184,7 @@ function settlePromises(promises) {
|
|
|
183
184
|
results[index] = result;
|
|
184
185
|
})
|
|
185
186
|
.catch((err) => {
|
|
187
|
+
// Accumulate all errors.
|
|
186
188
|
errors.push(err);
|
|
187
189
|
})
|
|
188
190
|
.then(() => {
|
|
@@ -199,6 +201,7 @@ function settlePromises(promises) {
|
|
|
199
201
|
});
|
|
200
202
|
});
|
|
201
203
|
}
|
|
204
|
+
exports.settlePromises = settlePromises;
|
|
202
205
|
function getPropertyName(func) {
|
|
203
206
|
if (func) {
|
|
204
207
|
const match = func
|
|
@@ -210,16 +213,19 @@ function getPropertyName(func) {
|
|
|
210
213
|
}
|
|
211
214
|
return null;
|
|
212
215
|
}
|
|
216
|
+
exports.getPropertyName = getPropertyName;
|
|
213
217
|
function bashQuote(s) {
|
|
214
218
|
if (s[0] === "'" && s[s.length - 1] === "'") {
|
|
215
219
|
return s;
|
|
216
220
|
}
|
|
221
|
+
// replace ' with '"'"' and wrap in ''
|
|
217
222
|
return "'" + s.replace(/'/g, "'\"'\"'") + "'";
|
|
218
223
|
}
|
|
219
224
|
function cmdQuote(s) {
|
|
220
225
|
if (s[0] === '"' && s[s.length - 1] === '"') {
|
|
221
226
|
return s;
|
|
222
227
|
}
|
|
228
|
+
// replace " with \" and wrap in ""
|
|
223
229
|
return '"' + s.replace(/"/g, '\\"') + '"';
|
|
224
230
|
}
|
|
225
231
|
function quoteString(s) {
|
|
@@ -228,6 +234,7 @@ function quoteString(s) {
|
|
|
228
234
|
}
|
|
229
235
|
return (0, os_1.platform)() === "win32" ? cmdQuote(s) : bashQuote(s);
|
|
230
236
|
}
|
|
237
|
+
exports.quoteString = quoteString;
|
|
231
238
|
function createGUID(useBraces) {
|
|
232
239
|
let output;
|
|
233
240
|
useBraces = useBraces === undefined ? true : useBraces;
|
|
@@ -239,15 +246,19 @@ function createGUID(useBraces) {
|
|
|
239
246
|
}
|
|
240
247
|
return output;
|
|
241
248
|
}
|
|
249
|
+
exports.createGUID = createGUID;
|
|
242
250
|
function stringReplaceAll(inputString, find, replace) {
|
|
243
251
|
return inputString.split(find).join(replace);
|
|
244
252
|
}
|
|
253
|
+
exports.stringReplaceAll = stringReplaceAll;
|
|
245
254
|
function isRequestSuccessful(request) {
|
|
246
255
|
return request.statusCode >= 200 && request.statusCode < 300;
|
|
247
256
|
}
|
|
257
|
+
exports.isRequestSuccessful = isRequestSuccessful;
|
|
248
258
|
function isResponseRedirect(response) {
|
|
249
259
|
return _.includes([301, 302, 303, 307, 308], response.statusCode);
|
|
250
260
|
}
|
|
261
|
+
exports.isResponseRedirect = isResponseRedirect;
|
|
251
262
|
function formatListOfNames(names, conjunction) {
|
|
252
263
|
conjunction = conjunction === undefined ? "or" : conjunction;
|
|
253
264
|
if (names.length <= 1) {
|
|
@@ -261,14 +272,17 @@ function formatListOfNames(names, conjunction) {
|
|
|
261
272
|
names[names.length - 1]);
|
|
262
273
|
}
|
|
263
274
|
}
|
|
275
|
+
exports.formatListOfNames = formatListOfNames;
|
|
264
276
|
function getRelativeToRootPath(rootPath, filePath) {
|
|
265
277
|
const relativeToRootPath = filePath.substr(rootPath.length);
|
|
266
278
|
return relativeToRootPath;
|
|
267
279
|
}
|
|
280
|
+
exports.getRelativeToRootPath = getRelativeToRootPath;
|
|
268
281
|
let customIsInteractive;
|
|
269
282
|
function setIsInteractive(override) {
|
|
270
283
|
customIsInteractive = override;
|
|
271
284
|
}
|
|
285
|
+
exports.setIsInteractive = setIsInteractive;
|
|
272
286
|
function isInteractive() {
|
|
273
287
|
if (customIsInteractive) {
|
|
274
288
|
return customIsInteractive();
|
|
@@ -276,6 +290,10 @@ function isInteractive() {
|
|
|
276
290
|
const result = isRunningInTTY() && !isCIEnvironment();
|
|
277
291
|
return result;
|
|
278
292
|
}
|
|
293
|
+
exports.isInteractive = isInteractive;
|
|
294
|
+
/**
|
|
295
|
+
* Checks if current process is running in Text Terminal (TTY)
|
|
296
|
+
*/
|
|
279
297
|
function isRunningInTTY() {
|
|
280
298
|
return (process.stdout &&
|
|
281
299
|
process.stdout.isTTY &&
|
|
@@ -283,11 +301,16 @@ function isRunningInTTY() {
|
|
|
283
301
|
process.stdin.isTTY);
|
|
284
302
|
}
|
|
285
303
|
function isCIEnvironment() {
|
|
304
|
+
// The following CI environments set their own environment variables that we respect:
|
|
305
|
+
// travis: "CI",
|
|
306
|
+
// circleCI: "CI",
|
|
307
|
+
// jenkins: "JENKINS_HOME"
|
|
286
308
|
return !!(process.env && (process.env.CI || process.env.JENKINS_HOME));
|
|
287
309
|
}
|
|
288
310
|
function toBoolean(str) {
|
|
289
311
|
return !!(str && str.toString && str.toString().toLowerCase() === "true");
|
|
290
312
|
}
|
|
313
|
+
exports.toBoolean = toBoolean;
|
|
291
314
|
function block(operation) {
|
|
292
315
|
if (isInteractive()) {
|
|
293
316
|
process.stdin.setRawMode(false);
|
|
@@ -297,6 +320,7 @@ function block(operation) {
|
|
|
297
320
|
process.stdin.setRawMode(true);
|
|
298
321
|
}
|
|
299
322
|
}
|
|
323
|
+
exports.block = block;
|
|
300
324
|
function isNumberWithoutExponent(n) {
|
|
301
325
|
const parsedNum = parseFloat(n);
|
|
302
326
|
return (!isNaN(parsedNum) &&
|
|
@@ -304,24 +328,31 @@ function isNumberWithoutExponent(n) {
|
|
|
304
328
|
n.toString &&
|
|
305
329
|
n.toString() === parsedNum.toString());
|
|
306
330
|
}
|
|
331
|
+
exports.isNumberWithoutExponent = isNumberWithoutExponent;
|
|
307
332
|
function fromWindowsRelativePathToUnix(windowsRelativePath) {
|
|
308
333
|
return windowsRelativePath.replace(/\\/g, "/");
|
|
309
334
|
}
|
|
335
|
+
exports.fromWindowsRelativePathToUnix = fromWindowsRelativePathToUnix;
|
|
310
336
|
function isNullOrWhitespace(input) {
|
|
311
337
|
if (!input && input !== false) {
|
|
312
338
|
return true;
|
|
313
339
|
}
|
|
314
340
|
return _.isString(input) && input.replace(/\s/gi, "").length < 1;
|
|
315
341
|
}
|
|
342
|
+
exports.isNullOrWhitespace = isNullOrWhitespace;
|
|
316
343
|
function getCurrentEpochTime() {
|
|
317
344
|
const dateTime = new Date();
|
|
318
345
|
return dateTime.getTime();
|
|
319
346
|
}
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
347
|
+
exports.getCurrentEpochTime = getCurrentEpochTime;
|
|
348
|
+
function sleep(ms) {
|
|
349
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
350
|
+
return new Promise((resolve, reject) => {
|
|
351
|
+
setTimeout(() => __awaiter(this, void 0, void 0, function* () { return resolve(); }), ms);
|
|
352
|
+
});
|
|
323
353
|
});
|
|
324
354
|
}
|
|
355
|
+
exports.sleep = sleep;
|
|
325
356
|
function createTable(headers, data) {
|
|
326
357
|
const table = new Table({
|
|
327
358
|
head: headers,
|
|
@@ -330,6 +361,7 @@ function createTable(headers, data) {
|
|
|
330
361
|
_.forEach(data, (row) => table.push(row));
|
|
331
362
|
return table;
|
|
332
363
|
}
|
|
364
|
+
exports.createTable = createTable;
|
|
333
365
|
function getMessageWithBorders(message, spanLength = 3) {
|
|
334
366
|
if (!message) {
|
|
335
367
|
return "";
|
|
@@ -337,11 +369,11 @@ function getMessageWithBorders(message, spanLength = 3) {
|
|
|
337
369
|
const longestRowLength = message.split("\n").sort((a, b) => {
|
|
338
370
|
return b.length - a.length;
|
|
339
371
|
})[0].length;
|
|
340
|
-
let border = "*".repeat(longestRowLength + 2 * spanLength);
|
|
372
|
+
let border = "*".repeat(longestRowLength + 2 * spanLength); // * 2 for both sides
|
|
341
373
|
if (border.length % 2 === 0) {
|
|
342
|
-
border += "*";
|
|
374
|
+
border += "*"; // the * should always be an odd number in order to get * in each edge (we will remove the even *s below)
|
|
343
375
|
}
|
|
344
|
-
border = border.replace(/\*\*/g, "* ");
|
|
376
|
+
border = border.replace(/\*\*/g, "* "); // ***** => * * * in order to have similar padding to the side borders
|
|
345
377
|
const formatRow = function (row) {
|
|
346
378
|
return (_.padEnd("*", spanLength) +
|
|
347
379
|
_.padEnd(row, border.length - 2 * spanLength) +
|
|
@@ -353,6 +385,7 @@ function getMessageWithBorders(message, spanLength = 3) {
|
|
|
353
385
|
messageWithBorders.push(os_1.EOL, border + os_1.EOL, emptyRow, ...message.split("\n").map((row) => formatRow(row.trim())), emptyRow, border + os_1.EOL, os_1.EOL);
|
|
354
386
|
return messageWithBorders.join("");
|
|
355
387
|
}
|
|
388
|
+
exports.getMessageWithBorders = getMessageWithBorders;
|
|
356
389
|
function remove(array, predicate, numberOfElements) {
|
|
357
390
|
numberOfElements = numberOfElements || 1;
|
|
358
391
|
const index = _.findIndex(array, predicate);
|
|
@@ -361,6 +394,7 @@ function remove(array, predicate, numberOfElements) {
|
|
|
361
394
|
}
|
|
362
395
|
return array.splice(index, numberOfElements);
|
|
363
396
|
}
|
|
397
|
+
exports.remove = remove;
|
|
364
398
|
function trimSymbol(str, symbol) {
|
|
365
399
|
while (str.charAt(0) === symbol) {
|
|
366
400
|
str = str.substr(1);
|
|
@@ -370,13 +404,26 @@ function trimSymbol(str, symbol) {
|
|
|
370
404
|
}
|
|
371
405
|
return str;
|
|
372
406
|
}
|
|
407
|
+
exports.trimSymbol = trimSymbol;
|
|
373
408
|
function parseJson(data) {
|
|
409
|
+
// Replace BOM from the header of the file if it exists
|
|
374
410
|
return JSON.parse(data.replace(/^\uFEFF/, ""));
|
|
375
411
|
}
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
412
|
+
exports.parseJson = parseJson;
|
|
413
|
+
// TODO: Use generic for predicatе predicate: (element: T|T[]) when TypeScript support this.
|
|
414
|
+
function getFuturesResults(promises, predicate) {
|
|
415
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
416
|
+
const results = yield Promise.all(promises);
|
|
417
|
+
return _(results).filter(predicate).flatten().value();
|
|
418
|
+
});
|
|
379
419
|
}
|
|
420
|
+
exports.getFuturesResults = getFuturesResults;
|
|
421
|
+
/**
|
|
422
|
+
* Appends zeroes to a version string until it reaches a specified length.
|
|
423
|
+
* @param {string} version The version on which to append zeroes.
|
|
424
|
+
* @param requiredVersionLength The required length of the version string.
|
|
425
|
+
* @returns {string} Appended version string. In case input is null, undefined or empty string, it is returned immediately without appending anything.
|
|
426
|
+
*/
|
|
380
427
|
function appendZeroesToVersion(version, requiredVersionLength) {
|
|
381
428
|
if (version) {
|
|
382
429
|
const zeroesToAppend = requiredVersionLength - version.split(".").length;
|
|
@@ -386,34 +433,38 @@ function appendZeroesToVersion(version, requiredVersionLength) {
|
|
|
386
433
|
}
|
|
387
434
|
return version;
|
|
388
435
|
}
|
|
436
|
+
exports.appendZeroesToVersion = appendZeroesToVersion;
|
|
389
437
|
function decorateMethod(before, after) {
|
|
390
438
|
return (target, propertyKey, descriptor) => {
|
|
391
439
|
const sink = descriptor.value;
|
|
392
|
-
descriptor.value =
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
let hasBeenReplaced = false;
|
|
398
|
-
let result;
|
|
399
|
-
if (newMethods && newMethods.length) {
|
|
400
|
-
const replacementMethods = _.filter(newMethods, (f) => _.isFunction(f));
|
|
401
|
-
if (replacementMethods.length > 0) {
|
|
402
|
-
hasBeenReplaced = true;
|
|
403
|
-
const chainedReplacementMethod = _.reduce(replacementMethods, (prev, next) => next.bind(next, args, prev), sink.bind(this));
|
|
404
|
-
result = chainedReplacementMethod();
|
|
440
|
+
descriptor.value = function (...args) {
|
|
441
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
442
|
+
let newMethods = null;
|
|
443
|
+
if (before) {
|
|
444
|
+
newMethods = yield before(sink, this, args);
|
|
405
445
|
}
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
446
|
+
let hasBeenReplaced = false;
|
|
447
|
+
let result;
|
|
448
|
+
if (newMethods && newMethods.length) {
|
|
449
|
+
const replacementMethods = _.filter(newMethods, (f) => _.isFunction(f));
|
|
450
|
+
if (replacementMethods.length > 0) {
|
|
451
|
+
hasBeenReplaced = true;
|
|
452
|
+
const chainedReplacementMethod = _.reduce(replacementMethods, (prev, next) => next.bind(next, args, prev), sink.bind(this));
|
|
453
|
+
result = chainedReplacementMethod();
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
if (!hasBeenReplaced) {
|
|
457
|
+
result = sink.apply(this, args);
|
|
458
|
+
}
|
|
459
|
+
if (after) {
|
|
460
|
+
return yield after(sink, this, result, args);
|
|
461
|
+
}
|
|
462
|
+
return result;
|
|
463
|
+
});
|
|
414
464
|
};
|
|
415
465
|
};
|
|
416
466
|
}
|
|
467
|
+
exports.decorateMethod = decorateMethod;
|
|
417
468
|
function hook(commandName) {
|
|
418
469
|
function getHooksService(self) {
|
|
419
470
|
let hooksService = self.$hooksService;
|
|
@@ -437,82 +488,98 @@ function hook(commandName) {
|
|
|
437
488
|
result[hooksService.hookArgsName] = argHash;
|
|
438
489
|
return result;
|
|
439
490
|
}
|
|
440
|
-
return decorateMethod(
|
|
491
|
+
return decorateMethod((method, self, args) => __awaiter(this, void 0, void 0, function* () {
|
|
441
492
|
const hooksService = getHooksService(self);
|
|
442
493
|
return hooksService.executeBeforeHooks(commandName, prepareArguments(method, args, hooksService));
|
|
443
|
-
},
|
|
444
|
-
const result =
|
|
494
|
+
}), (method, self, resultPromise, args) => __awaiter(this, void 0, void 0, function* () {
|
|
495
|
+
const result = yield resultPromise;
|
|
445
496
|
const hooksService = getHooksService(self);
|
|
446
|
-
|
|
497
|
+
yield hooksService.executeAfterHooks(commandName, prepareArguments(method, args, hooksService));
|
|
447
498
|
return Promise.resolve(result);
|
|
448
|
-
});
|
|
499
|
+
}));
|
|
449
500
|
}
|
|
501
|
+
exports.hook = hook;
|
|
450
502
|
function isPromise(candidateFuture) {
|
|
451
503
|
return !!(candidateFuture && typeof candidateFuture.then === "function");
|
|
452
504
|
}
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
505
|
+
exports.isPromise = isPromise;
|
|
506
|
+
function attachAwaitDetach(eventName, eventEmitter, eventHandler, operation) {
|
|
507
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
508
|
+
eventEmitter.on(eventName, eventHandler);
|
|
509
|
+
try {
|
|
510
|
+
yield operation;
|
|
511
|
+
}
|
|
512
|
+
finally {
|
|
513
|
+
eventEmitter.removeListener(eventName, eventHandler);
|
|
514
|
+
}
|
|
515
|
+
});
|
|
461
516
|
}
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
517
|
+
exports.attachAwaitDetach = attachAwaitDetach;
|
|
518
|
+
function connectEventually(factory, handler) {
|
|
519
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
520
|
+
function tryConnect() {
|
|
521
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
522
|
+
const tryConnectAfterTimeout = setTimeout.bind(undefined, tryConnect, 1000);
|
|
523
|
+
const socket = yield factory();
|
|
524
|
+
socket.on("connect", () => {
|
|
525
|
+
socket.removeListener("error", tryConnectAfterTimeout);
|
|
526
|
+
handler(socket);
|
|
527
|
+
});
|
|
528
|
+
socket.on("error", tryConnectAfterTimeout);
|
|
529
|
+
});
|
|
530
|
+
}
|
|
531
|
+
yield tryConnect();
|
|
532
|
+
});
|
|
473
533
|
}
|
|
534
|
+
exports.connectEventually = connectEventually;
|
|
474
535
|
function getHash(str, options) {
|
|
475
536
|
return crypto
|
|
476
537
|
.createHash((options && options.algorithm) || "sha256")
|
|
477
538
|
.update(str)
|
|
478
539
|
.digest((options && options.encoding) || "hex");
|
|
479
540
|
}
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
}
|
|
489
|
-
}, timeout);
|
|
490
|
-
async function tryConnect() {
|
|
491
|
-
const tryConnectAfterTimeout = (error) => {
|
|
492
|
-
if (isResolved) {
|
|
493
|
-
return;
|
|
494
|
-
}
|
|
495
|
-
lastKnownError = error;
|
|
496
|
-
setTimeout(tryConnect, 1000);
|
|
497
|
-
};
|
|
498
|
-
try {
|
|
499
|
-
const socket = await factory();
|
|
500
|
-
socket.on("connect", () => {
|
|
501
|
-
socket.removeListener("error", tryConnectAfterTimeout);
|
|
541
|
+
exports.getHash = getHash;
|
|
542
|
+
function connectEventuallyUntilTimeout(factory, timeout) {
|
|
543
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
544
|
+
return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
|
|
545
|
+
let lastKnownError;
|
|
546
|
+
let isResolved = false;
|
|
547
|
+
const connectionTimer = setTimeout(function () {
|
|
548
|
+
if (!isResolved) {
|
|
502
549
|
isResolved = true;
|
|
503
|
-
|
|
504
|
-
|
|
550
|
+
reject(lastKnownError || new Error(`Unable to connect for ${timeout}ms`));
|
|
551
|
+
}
|
|
552
|
+
}, timeout);
|
|
553
|
+
function tryConnect() {
|
|
554
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
555
|
+
const tryConnectAfterTimeout = (error) => {
|
|
556
|
+
if (isResolved) {
|
|
557
|
+
return;
|
|
558
|
+
}
|
|
559
|
+
lastKnownError = error;
|
|
560
|
+
setTimeout(tryConnect, 1000);
|
|
561
|
+
};
|
|
562
|
+
try {
|
|
563
|
+
const socket = yield factory();
|
|
564
|
+
socket.on("connect", () => {
|
|
565
|
+
socket.removeListener("error", tryConnectAfterTimeout);
|
|
566
|
+
isResolved = true;
|
|
567
|
+
clearTimeout(connectionTimer);
|
|
568
|
+
resolve(socket);
|
|
569
|
+
});
|
|
570
|
+
socket.on("error", tryConnectAfterTimeout);
|
|
571
|
+
}
|
|
572
|
+
catch (e) {
|
|
573
|
+
lastKnownError = e;
|
|
574
|
+
tryConnectAfterTimeout(e);
|
|
575
|
+
}
|
|
505
576
|
});
|
|
506
|
-
socket.on("error", tryConnectAfterTimeout);
|
|
507
577
|
}
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
tryConnectAfterTimeout(e);
|
|
511
|
-
}
|
|
512
|
-
}
|
|
513
|
-
await tryConnect();
|
|
578
|
+
yield tryConnect();
|
|
579
|
+
}));
|
|
514
580
|
});
|
|
515
581
|
}
|
|
582
|
+
exports.connectEventuallyUntilTimeout = connectEventuallyUntilTimeout;
|
|
516
583
|
function getProjectFilesConfig(opts) {
|
|
517
584
|
const projectFilesConfig = {
|
|
518
585
|
configuration: opts.isReleaseBuild
|
|
@@ -521,6 +588,15 @@ function getProjectFilesConfig(opts) {
|
|
|
521
588
|
};
|
|
522
589
|
return projectFilesConfig;
|
|
523
590
|
}
|
|
591
|
+
exports.getProjectFilesConfig = getProjectFilesConfig;
|
|
592
|
+
/**
|
|
593
|
+
* Tries to find the process id (PID) of the specified application identifier.
|
|
594
|
+
* This is specific implementation for iOS Simulator, where the running applications are real processes.
|
|
595
|
+
* Their PIDs are printed in a specific format in the the logs, once the application is started.
|
|
596
|
+
* @param {string} applicationIdentifier Application Identifier of the app for which we try to get the PID.
|
|
597
|
+
* @param {string} logLine Line that may contain the PID of the process.
|
|
598
|
+
* @returns {string} The PID of the searched application identifier in case it's found in the current line, null otherwise.
|
|
599
|
+
*/
|
|
524
600
|
function getPidFromiOSSimulatorLogs(applicationIdentifier, logLine) {
|
|
525
601
|
if (logLine) {
|
|
526
602
|
const pidRegExp = new RegExp(`${applicationIdentifier}:\\s?(\\d+)`);
|
|
@@ -529,6 +605,7 @@ function getPidFromiOSSimulatorLogs(applicationIdentifier, logLine) {
|
|
|
529
605
|
}
|
|
530
606
|
return null;
|
|
531
607
|
}
|
|
608
|
+
exports.getPidFromiOSSimulatorLogs = getPidFromiOSSimulatorLogs;
|
|
532
609
|
function getValueFromNestedObject(obj, key) {
|
|
533
610
|
function _getValueRecursive(_obj, _key) {
|
|
534
611
|
if (_.has(_obj, _key)) {
|
|
@@ -548,6 +625,7 @@ function getValueFromNestedObject(obj, key) {
|
|
|
548
625
|
}
|
|
549
626
|
return _.head(_getValueRecursive(obj, key));
|
|
550
627
|
}
|
|
628
|
+
exports.getValueFromNestedObject = getValueFromNestedObject;
|
|
551
629
|
function getWinRegPropertyValue(key, propertyName) {
|
|
552
630
|
return new Promise((resolve, reject) => {
|
|
553
631
|
const Winreg = require("winreg");
|
|
@@ -565,9 +643,12 @@ function getWinRegPropertyValue(key, propertyName) {
|
|
|
565
643
|
});
|
|
566
644
|
});
|
|
567
645
|
}
|
|
646
|
+
exports.getWinRegPropertyValue = getWinRegPropertyValue;
|
|
568
647
|
function stringify(value, replacer, space) {
|
|
569
648
|
return JSON.stringify(value, replacer, space || 2);
|
|
570
649
|
}
|
|
650
|
+
exports.stringify = stringify;
|
|
651
|
+
//2019-01-07 18:29:50.745
|
|
571
652
|
function getFixedLengthDateString() {
|
|
572
653
|
const currentDate = new Date();
|
|
573
654
|
const year = currentDate.getFullYear();
|
|
@@ -579,10 +660,12 @@ function getFixedLengthDateString() {
|
|
|
579
660
|
const milliseconds = getFormattedMilliseconds(currentDate);
|
|
580
661
|
return `${[year, month, day].join("-")} ${[hour, minutes, seconds].join(":")}.${milliseconds}`;
|
|
581
662
|
}
|
|
663
|
+
exports.getFixedLengthDateString = getFixedLengthDateString;
|
|
582
664
|
function getFormattedDateComponent(component) {
|
|
583
665
|
const stringComponent = component.toString();
|
|
584
666
|
return stringComponent.length === 1 ? `0${stringComponent}` : stringComponent;
|
|
585
667
|
}
|
|
668
|
+
exports.getFormattedDateComponent = getFormattedDateComponent;
|
|
586
669
|
function getFormattedMilliseconds(date) {
|
|
587
670
|
let milliseconds = date.getMilliseconds().toString();
|
|
588
671
|
while (milliseconds.length < 3) {
|
|
@@ -590,6 +673,29 @@ function getFormattedMilliseconds(date) {
|
|
|
590
673
|
}
|
|
591
674
|
return milliseconds;
|
|
592
675
|
}
|
|
676
|
+
exports.getFormattedMilliseconds = getFormattedMilliseconds;
|
|
677
|
+
//--- begin part copied from AngularJS
|
|
678
|
+
//The MIT License
|
|
679
|
+
//
|
|
680
|
+
//Copyright (c) 2010-2012 Google, Inc. http://angularjs.org
|
|
681
|
+
//
|
|
682
|
+
//Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
683
|
+
//of this software and associated documentation files (the "Software"), to deal
|
|
684
|
+
//in the Software without restriction, including without limitation the rights
|
|
685
|
+
//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
686
|
+
//copies of the Software, and to permit persons to whom the Software is
|
|
687
|
+
//furnished to do so, subject to the following conditions:
|
|
688
|
+
//
|
|
689
|
+
// The above copyright notice and this permission notice shall be included in
|
|
690
|
+
//all copies or substantial portions of the Software.
|
|
691
|
+
//
|
|
692
|
+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
693
|
+
//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
694
|
+
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
695
|
+
//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
696
|
+
//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
697
|
+
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
698
|
+
//THE SOFTWARE.
|
|
593
699
|
const CLASS_NAME = /class\s+([A-Z].+?)(?:\s+.*?)?\{/;
|
|
594
700
|
const CONSTRUCTOR_ARGS = /constructor\s*([^\(]*)\(\s*([^\)]*)\)/m;
|
|
595
701
|
const FN_NAME_AND_ARGS = /^(?:function)?\s*([^\(]*)\(\s*([^\)]*)\)\s*(=>)?\s*[{_]/m;
|
|
@@ -619,6 +725,12 @@ function annotate(fn) {
|
|
|
619
725
|
}
|
|
620
726
|
return $inject;
|
|
621
727
|
}
|
|
728
|
+
exports.annotate = annotate;
|
|
729
|
+
/**
|
|
730
|
+
* Returns true if all Android signing options are provided, false otherwise.
|
|
731
|
+
* @param {IAndroidSigningData} signingData The signing data to be validated.
|
|
732
|
+
* @return {void}
|
|
733
|
+
*/
|
|
622
734
|
function hasValidAndroidSigning(signingData) {
|
|
623
735
|
const isValid = signingData &&
|
|
624
736
|
signingData.keyStorePath &&
|
|
@@ -627,3 +739,6 @@ function hasValidAndroidSigning(signingData) {
|
|
|
627
739
|
signingData.keyStoreAliasPassword;
|
|
628
740
|
return !!isValid;
|
|
629
741
|
}
|
|
742
|
+
exports.hasValidAndroidSigning = hasValidAndroidSigning;
|
|
743
|
+
//--- end part copied from AngularJS
|
|
744
|
+
//# sourceMappingURL=helpers.js.map
|