nativescript 8.7.2 → 8.8.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/android-tools-info.js +0 -12
- package/lib/base-package-manager.js +0 -7
- package/lib/bootstrap.js +1 -5
- package/lib/bun-package-manager.js +1 -17
- package/lib/color.js +0 -3
- package/lib/commands/add-platform.js +0 -1
- package/lib/commands/apple-login.js +0 -1
- package/lib/commands/appstore-list.js +0 -1
- package/lib/commands/appstore-upload.js +0 -4
- package/lib/commands/build.js +2 -3
- package/lib/commands/clean.js +1 -22
- package/lib/commands/command-base.js +0 -1
- package/lib/commands/config.js +0 -3
- package/lib/commands/create-project.js +0 -6
- package/lib/commands/debug.js +1 -6
- package/lib/commands/deploy.js +2 -3
- package/lib/commands/extensibility/install-extension.js +0 -1
- package/lib/commands/extensibility/list-extensions.js +0 -1
- package/lib/commands/extensibility/uninstall-extension.js +0 -1
- package/lib/commands/fonts.js +0 -1
- package/lib/commands/generate-assets.js +0 -1
- package/lib/commands/generate-help.js +0 -1
- package/lib/commands/generate.js +2 -12
- package/lib/commands/info.js +0 -1
- package/lib/commands/install.js +0 -1
- package/lib/commands/list-platforms.js +0 -1
- package/lib/commands/migrate.js +0 -1
- package/lib/commands/platform-clean.js +0 -1
- package/lib/commands/plugin/add-plugin.js +0 -1
- package/lib/commands/plugin/build-plugin.js +0 -1
- package/lib/commands/plugin/create-plugin.js +0 -5
- package/lib/commands/plugin/list-plugins.js +0 -1
- package/lib/commands/plugin/remove-plugin.js +0 -2
- package/lib/commands/plugin/update-plugin.js +0 -1
- package/lib/commands/post-install.js +0 -6
- package/lib/commands/prepare.js +2 -3
- package/lib/commands/preview.js +0 -2
- package/lib/commands/remove-platform.js +0 -1
- package/lib/commands/resources/resources-update.js +0 -2
- package/lib/commands/run.js +0 -1
- package/lib/commands/setup.js +0 -1
- package/lib/commands/start.js +0 -1
- package/lib/commands/test-init.js +0 -4
- package/lib/commands/test.js +2 -9
- package/lib/commands/typings.js +1 -2
- package/lib/commands/update-platform.js +0 -5
- package/lib/commands/update.js +0 -2
- package/lib/common/bootstrap.js +0 -1
- package/lib/common/child-process.js +0 -3
- package/lib/common/codeGeneration/code-entity.js +0 -1
- package/lib/common/codeGeneration/code-printer.js +0 -1
- package/lib/common/command-params.js +0 -1
- package/lib/common/commands/analytics.js +0 -3
- package/lib/common/commands/autocompletion.js +0 -3
- package/lib/common/commands/device/device-log-stream.js +0 -1
- package/lib/common/commands/device/get-file.js +0 -2
- package/lib/common/commands/device/list-applications.js +0 -1
- package/lib/common/commands/device/list-devices.js +0 -3
- package/lib/common/commands/device/list-files.js +0 -2
- package/lib/common/commands/device/put-file.js +0 -2
- package/lib/common/commands/device/run-application.js +0 -1
- package/lib/common/commands/device/stop-application.js +0 -1
- package/lib/common/commands/device/uninstall-application.js +0 -1
- package/lib/common/commands/doctor.js +2 -3
- package/lib/common/commands/generate-messages.js +0 -1
- package/lib/common/commands/help.js +0 -1
- package/lib/common/commands/package-manager-get.js +0 -1
- package/lib/common/commands/package-manager-set.js +0 -1
- package/lib/common/commands/post-install.js +0 -1
- package/lib/common/commands/preuninstall.js +2 -11
- package/lib/common/commands/proxy/proxy-base.js +0 -4
- package/lib/common/commands/proxy/proxy-clear.js +0 -1
- package/lib/common/commands/proxy/proxy-get.js +0 -1
- package/lib/common/commands/proxy/proxy-set.js +0 -1
- package/lib/common/common-lib.js +0 -1
- package/lib/common/constants.js +0 -11
- package/lib/common/decorators.js +0 -48
- package/lib/common/dispatchers.js +1 -10
- package/lib/common/errors.js +3 -13
- package/lib/common/file-system.js +2 -13
- package/lib/common/header.js +0 -3
- package/lib/common/helpers.js +3 -89
- package/lib/common/host-info.js +0 -4
- package/lib/common/http-client.js +0 -20
- package/lib/common/logger/appenders/cli-appender.js +0 -4
- package/lib/common/logger/appenders/emit-appender.js +0 -4
- package/lib/common/logger/layouts/cli-layout.js +0 -1
- package/lib/common/logger/logger.js +0 -5
- package/lib/common/messages/messages.js +0 -6
- package/lib/common/mobile/android/android-application-manager.js +1 -20
- package/lib/common/mobile/android/android-debug-bridge-result-handler.js +0 -1
- package/lib/common/mobile/android/android-debug-bridge.js +0 -6
- package/lib/common/mobile/android/android-device-file-system.js +0 -4
- package/lib/common/mobile/android/android-device-hash-service.js +0 -3
- package/lib/common/mobile/android/android-device.js +0 -8
- package/lib/common/mobile/android/android-emulator-services.js +1 -2
- package/lib/common/mobile/android/android-ini-file-parser.js +0 -9
- package/lib/common/mobile/android/android-log-filter.js +0 -4
- package/lib/common/mobile/android/android-virtual-device-service.js +0 -26
- package/lib/common/mobile/android/device-android-debug-bridge.js +0 -1
- package/lib/common/mobile/android/genymotion/genymotion-service.js +0 -5
- package/lib/common/mobile/android/genymotion/virtualbox-service.js +0 -11
- package/lib/common/mobile/android/logcat-helper.js +1 -20
- package/lib/common/mobile/application-manager-base.js +0 -6
- package/lib/common/mobile/device-emitter.js +0 -4
- package/lib/common/mobile/device-log-emitter.js +0 -1
- package/lib/common/mobile/device-log-provider-base.js +0 -1
- package/lib/common/mobile/device-log-provider.js +0 -23
- package/lib/common/mobile/device-platforms-constants.js +0 -1
- package/lib/common/mobile/emulator-helper.js +0 -3
- package/lib/common/mobile/ios/device/ios-application-manager.js +0 -3
- package/lib/common/mobile/ios/device/ios-device-file-system.js +0 -1
- package/lib/common/mobile/ios/device/ios-device-operations.js +0 -4
- package/lib/common/mobile/ios/device/ios-device.js +0 -4
- package/lib/common/mobile/ios/ios-device-base.js +0 -1
- package/lib/common/mobile/ios/ios-device-product-name-mapper.js +0 -2
- package/lib/common/mobile/ios/ios-log-filter.js +0 -1
- package/lib/common/mobile/ios/simulator/ios-emulator-services.js +0 -4
- package/lib/common/mobile/ios/simulator/ios-sim-resolver.js +0 -1
- package/lib/common/mobile/ios/simulator/ios-simulator-application-manager.js +0 -6
- package/lib/common/mobile/ios/simulator/ios-simulator-device.js +0 -5
- package/lib/common/mobile/ios/simulator/ios-simulator-file-system.js +0 -1
- package/lib/common/mobile/ios/simulator/ios-simulator-log-provider.js +0 -1
- package/lib/common/mobile/local-to-device-path-data-factory.js +0 -1
- package/lib/common/mobile/log-filter.js +0 -2
- package/lib/common/mobile/logging-levels.js +0 -1
- package/lib/common/mobile/mobile-core/android-device-discovery.js +0 -2
- package/lib/common/mobile/mobile-core/android-emulator-discovery.js +0 -3
- package/lib/common/mobile/mobile-core/android-process-service.js +0 -32
- package/lib/common/mobile/mobile-core/device-discovery.js +0 -1
- package/lib/common/mobile/mobile-core/devices-service.js +0 -69
- package/lib/common/mobile/mobile-core/ios-device-discovery.js +0 -2
- package/lib/common/mobile/mobile-core/ios-simulator-discovery.js +0 -3
- package/lib/common/mobile/mobile-helper.js +0 -1
- package/lib/common/mobile/wp8/wp8-emulator-services.js +0 -1
- package/lib/common/opener.js +0 -1
- package/lib/common/os-info.js +0 -1
- package/lib/common/plist-parser.js +0 -1
- package/lib/common/project-helper.js +0 -1
- package/lib/common/prompter.js +1 -9
- package/lib/common/queue.js +0 -1
- package/lib/common/resource-loader.js +0 -1
- package/lib/common/services/auto-completion-service.js +1 -13
- package/lib/common/services/cancellation.js +1 -2
- package/lib/common/services/commands-service.js +6 -17
- package/lib/common/services/help-service.js +3 -11
- package/lib/common/services/hooks-service.js +0 -13
- package/lib/common/services/ios-notification-service.js +0 -1
- package/lib/common/services/json-file-settings-service.js +0 -6
- package/lib/common/services/lock-service.js +0 -6
- package/lib/common/services/message-contract-generator.js +0 -1
- package/lib/common/services/messages-service.js +0 -1
- package/lib/common/services/micro-templating-service.js +0 -6
- package/lib/common/services/net-service.js +0 -3
- package/lib/common/services/project-files-manager.js +0 -5
- package/lib/common/services/project-files-provider-base.js +0 -1
- package/lib/common/services/proxy-service.js +0 -1
- package/lib/common/services/qr.js +0 -1
- package/lib/common/services/settings-service.js +0 -1
- package/lib/common/services/xcode-select-service.js +0 -1
- package/lib/common/utils.js +0 -1
- package/lib/common/validators/project-name-validator.js +0 -1
- package/lib/common/validators/validation-result.js +0 -1
- package/lib/common/verify-node-version.js +1 -8
- package/lib/common/yok.js +11 -32
- package/lib/config.js +1 -22
- package/lib/constants-provider.js +0 -1
- package/lib/constants.js +0 -53
- package/lib/controllers/build-controller.js +3 -4
- package/lib/controllers/debug-controller.js +3 -8
- package/lib/controllers/deploy-controller.js +0 -1
- package/lib/controllers/migrate-controller.js +3 -91
- package/lib/controllers/platform-controller.js +1 -9
- package/lib/controllers/prepare-controller.js +4 -14
- package/lib/controllers/run-controller.js +1 -17
- package/lib/controllers/update-controller-base.js +0 -1
- package/lib/controllers/update-controller.js +0 -11
- package/lib/data/build-data.js +0 -1
- package/lib/data/controller-data-base.js +0 -1
- package/lib/data/debug-data.js +0 -1
- package/lib/data/platform-data.js +0 -1
- package/lib/data/prepare-data.js +0 -1
- package/lib/data/run-data.js +0 -1
- package/lib/detached-processes/cleanup-js-subprocess.js +2 -8
- package/lib/detached-processes/cleanup-process.js +14 -18
- package/lib/detached-processes/file-log-service.js +1 -2
- package/lib/device-path-provider.js +0 -1
- package/lib/device-sockets/ios/app-debug-socket-proxy-factory.js +0 -7
- package/lib/device-sockets/ios/notification.js +0 -3
- package/lib/device-sockets/ios/socket-request-executor.js +0 -3
- package/lib/helpers/android-bundle-validator-helper.js +1 -2
- package/lib/helpers/deploy-command-helper.js +0 -1
- package/lib/helpers/key-command-helper.js +2 -4
- package/lib/helpers/livesync-command-helper.js +1 -4
- package/lib/helpers/network-connectivity-validator.js +0 -1
- package/lib/helpers/options-track-helper.js +2 -3
- package/lib/helpers/package-path-helper.js +0 -1
- package/lib/helpers/platform-command-helper.js +2 -7
- package/lib/helpers/version-validator-helper.js +0 -1
- package/lib/key-commands/bootstrap.js +2 -3
- package/lib/key-commands/index.js +4 -5
- package/lib/nativescript-cli-lib-bootstrap.js +0 -4
- package/lib/nativescript-cli-lib.js +0 -1
- package/lib/nativescript-cli.js +1 -10
- package/lib/node/pbxproj-dom-xcode.js +0 -1
- package/lib/node/xcode.js +0 -1
- package/lib/node-package-manager.js +1 -11
- package/lib/options.js +116 -141
- package/lib/package-installation-manager.js +1 -8
- package/lib/package-manager.js +0 -2
- package/lib/platform-command-param.js +0 -1
- package/lib/pnpm-package-manager.js +1 -4
- package/lib/project-data.js +0 -12
- package/lib/providers/project-files-provider.js +0 -1
- package/lib/resolvers/livesync-service-resolver.js +0 -1
- package/lib/services/analytics/analytics-broker-process.js +6 -10
- package/lib/services/analytics/analytics-broker.js +1 -2
- package/lib/services/analytics/analytics-service.js +25 -29
- package/lib/services/analytics/google-analytics-provider.js +12 -13
- package/lib/services/analytics-settings-service.js +0 -5
- package/lib/services/android/android-bundle-tool-service.js +0 -1
- package/lib/services/android/gradle-build-args-service.js +2 -9
- package/lib/services/android/gradle-build-service.js +0 -1
- package/lib/services/android/gradle-command-service.js +0 -1
- package/lib/services/android-device-debug-service.js +0 -6
- package/lib/services/android-plugin-build-service.js +12 -43
- package/lib/services/android-project-service.js +4 -71
- package/lib/services/android-resources-migration-service.js +0 -7
- package/lib/services/apple-portal/apple-portal-application-service.js +0 -1
- package/lib/services/apple-portal/apple-portal-cookie-service.js +0 -1
- package/lib/services/apple-portal/apple-portal-session-service.js +4 -6
- package/lib/services/assets-generation/assets-generation-service.js +5 -16
- package/lib/services/build-artifacts-service.js +1 -2
- package/lib/services/build-data-service.js +0 -1
- package/lib/services/build-info-file-service.js +0 -1
- package/lib/services/cleanup-service.js +9 -13
- package/lib/services/cocoapods-platform-manager.js +0 -9
- package/lib/services/cocoapods-service.js +1 -21
- package/lib/services/debug-data-service.js +0 -1
- package/lib/services/debug-service-base.js +0 -7
- package/lib/services/device/device-install-app-service.js +1 -2
- package/lib/services/doctor-service.js +6 -21
- package/lib/services/extensibility-service.js +0 -8
- package/lib/services/files-hash-service.js +0 -1
- package/lib/services/hmr-status-service.js +0 -2
- package/lib/services/info-service.js +0 -1
- package/lib/services/initialize-service.js +1 -5
- package/lib/services/ios/export-options-plist-service.js +0 -4
- package/lib/services/ios/ios-signing-service.js +0 -4
- package/lib/services/ios/spm-service.js +0 -9
- package/lib/services/ios/xcodebuild-args-service.js +0 -9
- package/lib/services/ios/xcodebuild-command-service.js +0 -1
- package/lib/services/ios/xcodebuild-service.js +0 -1
- package/lib/services/ios-debugger-port-service.js +0 -1
- package/lib/services/ios-device-debug-service.js +0 -1
- package/lib/services/ios-entitlements-service.js +0 -1
- package/lib/services/ios-extensions-service.js +0 -1
- package/lib/services/ios-log-filter.js +0 -20
- package/lib/services/ios-native-target-service.js +4 -6
- package/lib/services/ios-project-service.js +1 -23
- package/lib/services/ios-provision-service.js +0 -3
- package/lib/services/ios-watch-app-service.js +0 -1
- package/lib/services/ip-service.js +0 -2
- package/lib/services/itmstransporter-service.js +0 -1
- package/lib/services/karma-execution.js +0 -2
- package/lib/services/livesync/android-device-livesync-service-base.js +0 -1
- package/lib/services/livesync/android-device-livesync-service.js +0 -2
- package/lib/services/livesync/android-device-livesync-sockets-service.js +0 -3
- package/lib/services/livesync/android-livesync-service.js +0 -1
- package/lib/services/livesync/android-livesync-tool.js +0 -4
- package/lib/services/livesync/device-livesync-service-base.js +0 -2
- package/lib/services/livesync/ios-device-livesync-service.js +0 -7
- package/lib/services/livesync/ios-livesync-service.js +0 -2
- package/lib/services/livesync/livesync-socket.js +0 -1
- package/lib/services/livesync/platform-livesync-service-base.js +0 -5
- package/lib/services/livesync-process-data-service.js +0 -1
- package/lib/services/log-parser-service.js +0 -1
- package/lib/services/log-source-map-service.js +0 -15
- package/lib/services/marking-mode-service.js +5 -8
- package/lib/services/metadata-filtering-service.js +0 -1
- package/lib/services/npm-config-service.js +0 -4
- package/lib/services/pacote-service.js +0 -7
- package/lib/services/performance-service.js +1 -3
- package/lib/services/platform/add-platform-service.js +2 -47
- package/lib/services/platform/platform-validation-service.js +0 -1
- package/lib/services/platform/prepare-native-platform-service.js +2 -5
- package/lib/services/platform-environment-requirements.js +3 -8
- package/lib/services/platform-project-service-base.js +0 -1
- package/lib/services/platforms-data-service.js +0 -1
- package/lib/services/plugins-service.js +2 -18
- package/lib/services/prepare-data-service.js +0 -1
- package/lib/services/project-backup-service.js +0 -4
- package/lib/services/project-changes-service.js +3 -12
- package/lib/services/project-cleanup-service.js +0 -2
- package/lib/services/project-config-service.js +1 -18
- package/lib/services/project-data-service.js +7 -36
- package/lib/services/project-name-service.js +0 -1
- package/lib/services/project-service.js +0 -10
- package/lib/services/project-templates-service.js +2 -3
- package/lib/services/qr-code-terminal-service.js +0 -1
- package/lib/services/require-service.js +0 -1
- package/lib/services/start-service.js +0 -1
- package/lib/services/temp-service.js +0 -1
- package/lib/services/terminal-spinner-service.js +0 -2
- package/lib/services/test-execution-service.js +2 -9
- package/lib/services/test-initialization-service.js +0 -4
- package/lib/services/timeline-profiler-service.js +0 -1
- package/lib/services/user-settings-service.js +0 -1
- package/lib/services/versions-service.js +4 -6
- package/lib/services/watch-ignore-list-service.js +0 -1
- package/lib/services/webpack/webpack-compiler-service.js +1 -42
- package/lib/services/xcconfig-service.js +0 -2
- package/lib/services/xcproj-service.js +0 -1
- package/lib/shared-event-bus.js +0 -6
- package/lib/sys-info.js +1 -2
- package/lib/tools/config-manipulation/config-transformer.js +0 -12
- package/lib/tools/node-modules/node-modules-builder.js +0 -1
- package/lib/tools/node-modules/node-modules-dependencies-builder.js +0 -6
- package/lib/yarn-package-manager.js +0 -1
- package/lib/yarn2-package-manager.js +0 -3
- package/package.json +1 -1
- package/vendor/aab-tool/README.txt +1 -1
- package/vendor/aab-tool/bundletool.jar +0 -0
- package/vendor/gradle-plugin/build.gradle +21 -15
- package/node_modules/@npmcli/move-file/node_modules/mkdirp/CHANGELOG.md +0 -15
- package/node_modules/rimraf/CHANGELOG.md +0 -65
- package/node_modules/stringify-package/CHANGELOG.md +0 -16
package/lib/common/decorators.js
CHANGED
|
@@ -12,32 +12,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.deprecated = exports.performanceLog = exports.exported = exports.invokeInit = exports.invokeBefore = exports.memoize = exports.cache = void 0;
|
|
13
13
|
const constants_1 = require("../constants");
|
|
14
14
|
const yok_1 = require("./yok");
|
|
15
|
-
/**
|
|
16
|
-
* Caches the result of the first execution of the method and returns it whenever it is called instead of executing it again.
|
|
17
|
-
* Works with methods and getters.
|
|
18
|
-
* @example
|
|
19
|
-
* ```
|
|
20
|
-
* class CacheDecoratorsTest {
|
|
21
|
-
*
|
|
22
|
-
* @cache()
|
|
23
|
-
* public method(num: number): number {
|
|
24
|
-
* return num;
|
|
25
|
-
* }
|
|
26
|
-
*
|
|
27
|
-
* @cache()
|
|
28
|
-
* public get property(): any {
|
|
29
|
-
* // execute some heavy operation.
|
|
30
|
-
* return result;
|
|
31
|
-
* }
|
|
32
|
-
* }
|
|
33
|
-
*
|
|
34
|
-
* const instance = new CacheDecoratorsTest();
|
|
35
|
-
* const result = instance.method(1); // returns 1;
|
|
36
|
-
*
|
|
37
|
-
* // all consecutive calls to instance.method will return 1.
|
|
38
|
-
* const result2 = instance.method(2); // returns 1;
|
|
39
|
-
* ```
|
|
40
|
-
*/
|
|
41
15
|
function cache() {
|
|
42
16
|
return (target, propertyKey, descriptor) => {
|
|
43
17
|
let result;
|
|
@@ -58,7 +32,6 @@ exports.cache = cache;
|
|
|
58
32
|
let memoizeIDCounter = 0;
|
|
59
33
|
function memoize(options) {
|
|
60
34
|
return (target, propertyKey, descriptor) => {
|
|
61
|
-
// todo: remove once surely working as intended.
|
|
62
35
|
const DEBUG = false;
|
|
63
36
|
const memoizeID = memoizeIDCounter++;
|
|
64
37
|
const valueOrGet = descriptor.value ? "value" : "get";
|
|
@@ -79,7 +52,6 @@ function memoize(options) {
|
|
|
79
52
|
cacheMapName,
|
|
80
53
|
hashKey,
|
|
81
54
|
});
|
|
82
|
-
// initialize cache map if not exists
|
|
83
55
|
if (!this.hasOwnProperty(cacheMapName)) {
|
|
84
56
|
DEBUG && console.log("NO CACHE MAP YET, CREATING ONE NOW");
|
|
85
57
|
Object.defineProperty(this, cacheMapName, {
|
|
@@ -94,16 +66,12 @@ function memoize(options) {
|
|
|
94
66
|
console.log({
|
|
95
67
|
cacheMap,
|
|
96
68
|
});
|
|
97
|
-
// check if has memoized value based on hashFn
|
|
98
69
|
if (cacheMap.has(hashKey)) {
|
|
99
70
|
DEBUG && console.log("CACHE HIT");
|
|
100
|
-
// if yes, return cached value
|
|
101
71
|
return cacheMap.get(hashKey);
|
|
102
72
|
}
|
|
103
73
|
DEBUG && console.log("CACHE MISS");
|
|
104
|
-
// if not call original and get result
|
|
105
74
|
const result = originalMethod.apply(this, args);
|
|
106
|
-
// call shouldCache (if passed) with the result or default to true
|
|
107
75
|
let shouldCache = true;
|
|
108
76
|
if (options.shouldCache) {
|
|
109
77
|
shouldCache = options.shouldCache.call(this, result);
|
|
@@ -113,7 +81,6 @@ function memoize(options) {
|
|
|
113
81
|
DEBUG && console.log("CACHING NOW");
|
|
114
82
|
cacheMap.set(hashKey, result);
|
|
115
83
|
}
|
|
116
|
-
// if shouldCache: save result
|
|
117
84
|
DEBUG && console.log("RETURNING", result);
|
|
118
85
|
return result;
|
|
119
86
|
};
|
|
@@ -121,14 +88,6 @@ function memoize(options) {
|
|
|
121
88
|
};
|
|
122
89
|
}
|
|
123
90
|
exports.memoize = memoize;
|
|
124
|
-
/**
|
|
125
|
-
* Calls specific method of the instance before executing the decorated method.
|
|
126
|
-
* This is usable when some of your methods depend on initialize async method, that cannot be invoked in constructor of the class.
|
|
127
|
-
* IMPORTANT: The decorated method must be async.
|
|
128
|
-
* @param {string} methodName The name of the method that will be invoked before calling the decorated method.
|
|
129
|
-
* @param {any[]} methodArgs Args that will be passed to the method that will be invoked before calling the decorated one.
|
|
130
|
-
* @return {any} Result of the decorated method.
|
|
131
|
-
*/
|
|
132
91
|
function invokeBefore(methodName, methodArgs) {
|
|
133
92
|
return (target, propertyKey, descriptor) => {
|
|
134
93
|
const originalValue = descriptor.value;
|
|
@@ -165,7 +124,6 @@ function performanceLog(localInjector) {
|
|
|
165
124
|
const className = target.constructor.name;
|
|
166
125
|
const trackName = `${className}${constants_1.AnalyticsEventLabelDelimiter}${propertyKey}`;
|
|
167
126
|
const performanceService = localInjector.resolve("performanceService");
|
|
168
|
-
//needed for the returned function to have the same name as the original - used in hooks decorator
|
|
169
127
|
const functionWrapper = {
|
|
170
128
|
[originalMethod.name]: function (...args) {
|
|
171
129
|
const start = performanceService.now();
|
|
@@ -191,7 +149,6 @@ function performanceLog(localInjector) {
|
|
|
191
149
|
},
|
|
192
150
|
};
|
|
193
151
|
descriptor.value = functionWrapper[originalMethod.name];
|
|
194
|
-
// used to get parameter names in hooks decorator
|
|
195
152
|
descriptor.value.toString = () => {
|
|
196
153
|
return originalMethod.toString();
|
|
197
154
|
};
|
|
@@ -199,7 +156,6 @@ function performanceLog(localInjector) {
|
|
|
199
156
|
};
|
|
200
157
|
}
|
|
201
158
|
exports.performanceLog = performanceLog;
|
|
202
|
-
// inspired by https://github.com/NativeScript/NativeScript/blob/55dfe25938569edbec89255008e5ad9804901305/tns-core-modules/globals/globals.ts#L121-L137
|
|
203
159
|
function deprecated(additionalInfo, localInjector) {
|
|
204
160
|
const isDeprecatedMessage = " is deprecated.";
|
|
205
161
|
return (target, key, descriptor) => {
|
|
@@ -208,7 +164,6 @@ function deprecated(additionalInfo, localInjector) {
|
|
|
208
164
|
const $logger = localInjector.resolve("logger");
|
|
209
165
|
if (descriptor) {
|
|
210
166
|
if (descriptor.value) {
|
|
211
|
-
// method
|
|
212
167
|
const originalMethod = descriptor.value;
|
|
213
168
|
descriptor.value = function (...args) {
|
|
214
169
|
$logger.warn(`${key.toString()}${isDeprecatedMessage} ${additionalInfo}`);
|
|
@@ -217,7 +172,6 @@ function deprecated(additionalInfo, localInjector) {
|
|
|
217
172
|
return descriptor;
|
|
218
173
|
}
|
|
219
174
|
else {
|
|
220
|
-
// property
|
|
221
175
|
if (descriptor.set) {
|
|
222
176
|
const originalSetter = descriptor.set;
|
|
223
177
|
descriptor.set = function (...args) {
|
|
@@ -236,7 +190,6 @@ function deprecated(additionalInfo, localInjector) {
|
|
|
236
190
|
}
|
|
237
191
|
}
|
|
238
192
|
else {
|
|
239
|
-
// class
|
|
240
193
|
$logger.warn(`${(target &&
|
|
241
194
|
(target.name ||
|
|
242
195
|
(target.constructor && target.constructor.name))) ||
|
|
@@ -246,4 +199,3 @@ function deprecated(additionalInfo, localInjector) {
|
|
|
246
199
|
};
|
|
247
200
|
}
|
|
248
201
|
exports.deprecated = deprecated;
|
|
249
|
-
//# sourceMappingURL=decorators.js.map
|
|
@@ -24,9 +24,7 @@ const yok_1 = require("./yok");
|
|
|
24
24
|
const constants_1 = require("../constants");
|
|
25
25
|
const semver = require("semver");
|
|
26
26
|
class CommandDispatcher {
|
|
27
|
-
constructor($logger,
|
|
28
|
-
// required by the hooksService
|
|
29
|
-
$injector, $cancellation, $commandsService, $staticConfig, $sysInfo, $options, $versionsService, $packageManager, $terminalSpinnerService) {
|
|
27
|
+
constructor($logger, $injector, $cancellation, $commandsService, $staticConfig, $sysInfo, $options, $versionsService, $packageManager, $terminalSpinnerService) {
|
|
30
28
|
this.$logger = $logger;
|
|
31
29
|
this.$injector = $injector;
|
|
32
30
|
this.$cancellation = $cancellation;
|
|
@@ -44,7 +42,6 @@ class CommandDispatcher {
|
|
|
44
42
|
return this.printVersion();
|
|
45
43
|
}
|
|
46
44
|
if (this.$logger.getLevel() === "TRACE" && !this.$options.json) {
|
|
47
|
-
// CommandDispatcher is called from external CLI's only, so pass the path to their package.json
|
|
48
45
|
this.$logger.trace("Collecting system information...");
|
|
49
46
|
const sysInfo = yield this.$sysInfo.getSysInfo({
|
|
50
47
|
pathToNativeScriptCliPackageJson: path.join(__dirname, "..", "..", "package.json"),
|
|
@@ -76,7 +73,6 @@ class CommandDispatcher {
|
|
|
76
73
|
}
|
|
77
74
|
resolveCommand(commandName, commandArguments, argv) {
|
|
78
75
|
return __awaiter(this, void 0, void 0, function* () {
|
|
79
|
-
// just a hook point
|
|
80
76
|
return { commandName, commandArguments, argv };
|
|
81
77
|
});
|
|
82
78
|
}
|
|
@@ -85,7 +81,6 @@ class CommandDispatcher {
|
|
|
85
81
|
if (remaining.length > 0) {
|
|
86
82
|
return remaining[0].toString().toLowerCase();
|
|
87
83
|
}
|
|
88
|
-
// if only <CLI_NAME> is specified on console, show console help
|
|
89
84
|
this.$options.help = true;
|
|
90
85
|
return "";
|
|
91
86
|
}
|
|
@@ -93,8 +88,6 @@ class CommandDispatcher {
|
|
|
93
88
|
return __awaiter(this, void 0, void 0, function* () {
|
|
94
89
|
this.$logger.info(this.$staticConfig.version);
|
|
95
90
|
if (this.$options.json) {
|
|
96
|
-
// we don't check for updates when --json is passed
|
|
97
|
-
// useful for tools that rely on the output of the command
|
|
98
91
|
return;
|
|
99
92
|
}
|
|
100
93
|
const spinner = this.$terminalSpinnerService.createSpinner();
|
|
@@ -122,7 +115,6 @@ class CommandDispatcher {
|
|
|
122
115
|
if (semver.gte(nativescriptCliVersion.currentVersion, nativescriptCliVersion.latestVersion, {
|
|
123
116
|
loose: true,
|
|
124
117
|
})) {
|
|
125
|
-
// up-to-date
|
|
126
118
|
spinner.succeed("Up to date.");
|
|
127
119
|
}
|
|
128
120
|
else {
|
|
@@ -157,4 +149,3 @@ class FutureDispatcher {
|
|
|
157
149
|
}
|
|
158
150
|
}
|
|
159
151
|
yok_1.injector.register("dispatcher", FutureDispatcher, false);
|
|
160
|
-
//# sourceMappingURL=dispatchers.js.map
|
package/lib/common/errors.js
CHANGED
|
@@ -23,9 +23,7 @@ const source_map_1 = require("source-map");
|
|
|
23
23
|
const helpers_1 = require("./helpers");
|
|
24
24
|
const decorators_1 = require("./decorators");
|
|
25
25
|
const yok_1 = require("./yok");
|
|
26
|
-
// we need this to overwrite .stack property (read-only in Error)
|
|
27
26
|
function Exception() {
|
|
28
|
-
/* intentionally left blank */
|
|
29
27
|
}
|
|
30
28
|
Exception.prototype = new Error();
|
|
31
29
|
function resolveCallStack(error) {
|
|
@@ -71,7 +69,6 @@ function resolveCallStack(error) {
|
|
|
71
69
|
})));
|
|
72
70
|
let outputMessage = remapped.join("\n");
|
|
73
71
|
if (outputMessage.indexOf(error.message) === -1) {
|
|
74
|
-
// when fibers throw error in node 0.12.x, the stack does NOT contain the message
|
|
75
72
|
outputMessage = outputMessage.replace(/Error/, "Error: " + error.message);
|
|
76
73
|
}
|
|
77
74
|
return outputMessage;
|
|
@@ -96,9 +93,7 @@ function installUncaughtExceptionListener(actionOnException) {
|
|
|
96
93
|
}
|
|
97
94
|
}
|
|
98
95
|
catch (err) {
|
|
99
|
-
|
|
100
|
-
// We cannot do anything here as even `console.error` may fail. So just exit the process.
|
|
101
|
-
process.exit(131 /* ErrorCodes.UNHANDLED_REJECTION_FAILURE */);
|
|
96
|
+
process.exit(131);
|
|
102
97
|
}
|
|
103
98
|
});
|
|
104
99
|
process.on("uncaughtException", handler);
|
|
@@ -112,7 +107,6 @@ function tryTrackException(error, localInjector) {
|
|
|
112
107
|
disableAnalytics = localInjector.resolve("staticConfig").disableAnalytics;
|
|
113
108
|
}
|
|
114
109
|
catch (err) {
|
|
115
|
-
// We should get here only in our unit tests.
|
|
116
110
|
disableAnalytics = true;
|
|
117
111
|
}
|
|
118
112
|
if (!disableAnalytics) {
|
|
@@ -121,7 +115,6 @@ function tryTrackException(error, localInjector) {
|
|
|
121
115
|
yield analyticsService.trackException(error, error.message);
|
|
122
116
|
}
|
|
123
117
|
catch (e) {
|
|
124
|
-
// Do not replace with logger due to cyclic dependency
|
|
125
118
|
console.error("Error while reporting exception: " + e);
|
|
126
119
|
}
|
|
127
120
|
}
|
|
@@ -160,10 +153,9 @@ class Errors {
|
|
|
160
153
|
exception.message = $messagesService.getMessage.apply($messagesService, [opts.formatStr].concat(argsArray));
|
|
161
154
|
}
|
|
162
155
|
catch (err) {
|
|
163
|
-
// Ignore
|
|
164
156
|
}
|
|
165
157
|
exception.stack = new Error(exception.message).stack;
|
|
166
|
-
exception.errorCode = opts.errorCode || 127
|
|
158
|
+
exception.errorCode = opts.errorCode || 127;
|
|
167
159
|
exception.suggestCommandHelp = suggestCommandHelp;
|
|
168
160
|
exception.proxyAuthenticationRequired = !!opts.proxyAuthenticationRequired;
|
|
169
161
|
exception.printOnStdout = opts.printOnStdout;
|
|
@@ -196,11 +188,10 @@ class Errors {
|
|
|
196
188
|
yield printCommandHelpSuggestion();
|
|
197
189
|
}
|
|
198
190
|
yield tryTrackException(ex, this.$injector);
|
|
199
|
-
process.exit(_.isNumber(ex.errorCode) ? ex.errorCode : 127
|
|
191
|
+
process.exit(_.isNumber(ex.errorCode) ? ex.errorCode : 127);
|
|
200
192
|
}
|
|
201
193
|
});
|
|
202
194
|
}
|
|
203
|
-
// If you want to activate this function, start Node with flags --nouse_idle_notification and --expose_gc
|
|
204
195
|
verifyHeap(message) {
|
|
205
196
|
if (global.gc) {
|
|
206
197
|
console.log("verifyHeap: '%s'", message);
|
|
@@ -213,4 +204,3 @@ __decorate([
|
|
|
213
204
|
], Errors.prototype, "failWithoutHelp", null);
|
|
214
205
|
exports.Errors = Errors;
|
|
215
206
|
yok_1.injector.register("errors", Errors);
|
|
216
|
-
//# sourceMappingURL=errors.js.map
|
|
@@ -30,7 +30,6 @@ const os_1 = require("os");
|
|
|
30
30
|
const detectNewline = require("detect-newline");
|
|
31
31
|
const archiver_1 = require("archiver");
|
|
32
32
|
const stringifyPackage = require("stringify-package");
|
|
33
|
-
// TODO: Add .d.ts for mkdirp module (or use it from @types repo).
|
|
34
33
|
const mkdirp = require("mkdirp");
|
|
35
34
|
let FileSystem = FileSystem_1 = class FileSystem {
|
|
36
35
|
constructor($injector) {
|
|
@@ -38,7 +37,6 @@ let FileSystem = FileSystem_1 = class FileSystem {
|
|
|
38
37
|
}
|
|
39
38
|
zipFiles(zipFile, files, zipPathCallback) {
|
|
40
39
|
return __awaiter(this, void 0, void 0, function* () {
|
|
41
|
-
//we are resolving it here instead of in the constructor, because config has dependency on file system and config shouldn't require logger
|
|
42
40
|
const $logger = this.$injector.resolve("logger");
|
|
43
41
|
const zip = (0, archiver_1.create)("zip", {
|
|
44
42
|
zlib: {
|
|
@@ -77,10 +75,10 @@ let FileSystem = FileSystem_1 = class FileSystem {
|
|
|
77
75
|
proc = (0, path_1.join)(__dirname, "resources/platform-tools/unzip/win32/unzip");
|
|
78
76
|
}
|
|
79
77
|
else if ($hostInfo.isDarwin) {
|
|
80
|
-
proc = "unzip";
|
|
78
|
+
proc = "unzip";
|
|
81
79
|
}
|
|
82
80
|
else if ($hostInfo.isLinux) {
|
|
83
|
-
proc = "unzip";
|
|
81
|
+
proc = "unzip";
|
|
84
82
|
}
|
|
85
83
|
if (!isCaseSensitive) {
|
|
86
84
|
zipFile = this.findFileCaseInsensitive(zipFile);
|
|
@@ -122,7 +120,6 @@ let FileSystem = FileSystem_1 = class FileSystem {
|
|
|
122
120
|
}
|
|
123
121
|
catch (err) {
|
|
124
122
|
if (err && err.code !== "ENOENT") {
|
|
125
|
-
// ignore "file doesn't exist" error
|
|
126
123
|
throw err;
|
|
127
124
|
}
|
|
128
125
|
}
|
|
@@ -161,7 +158,6 @@ let FileSystem = FileSystem_1 = class FileSystem {
|
|
|
161
158
|
}
|
|
162
159
|
});
|
|
163
160
|
if (root) {
|
|
164
|
-
// console.log("root", paths);
|
|
165
161
|
return Array.from(paths.values()).reduce((sum, current) => sum + current, 0);
|
|
166
162
|
}
|
|
167
163
|
};
|
|
@@ -236,8 +232,6 @@ let FileSystem = FileSystem_1 = class FileSystem {
|
|
|
236
232
|
writeFile(filename, data, encoding) {
|
|
237
233
|
this.createDirectory((0, path_1.dirname)(filename));
|
|
238
234
|
if (!data) {
|
|
239
|
-
// node 14 will no longer coerce unsupported input to strings anymore.
|
|
240
|
-
// clean any null or undefined data
|
|
241
235
|
data = "";
|
|
242
236
|
}
|
|
243
237
|
fs.writeFileSync(filename, data, { encoding: encoding });
|
|
@@ -268,8 +262,6 @@ let FileSystem = FileSystem_1 = class FileSystem {
|
|
|
268
262
|
return;
|
|
269
263
|
}
|
|
270
264
|
this.createDirectory((0, path_1.dirname)(destinationFileName));
|
|
271
|
-
// MobileApplication.app is resolved as a directory on Mac,
|
|
272
|
-
// therefore we need to copy it recursively as it's not a single file.
|
|
273
265
|
shelljs.cp("-rf", sourceFileName, destinationFileName);
|
|
274
266
|
const err = shelljs.error();
|
|
275
267
|
if (err) {
|
|
@@ -346,10 +338,8 @@ let FileSystem = FileSystem_1 = class FileSystem {
|
|
|
346
338
|
});
|
|
347
339
|
yield this.futureFromEvent(chown, "close");
|
|
348
340
|
}
|
|
349
|
-
// nothing to do on Windows, as chown does not work on this platform
|
|
350
341
|
});
|
|
351
342
|
}
|
|
352
|
-
// filterCallback: function(path: String, stat: fs.Stats): Boolean
|
|
353
343
|
enumerateFilesInDirectorySync(directoryPath, filterCallback, opts, foundFiles) {
|
|
354
344
|
foundFiles = foundFiles || [];
|
|
355
345
|
if (!this.exists(directoryPath)) {
|
|
@@ -449,4 +439,3 @@ FileSystem = FileSystem_1 = __decorate([
|
|
|
449
439
|
injector.register("fs")
|
|
450
440
|
], FileSystem);
|
|
451
441
|
exports.FileSystem = FileSystem;
|
|
452
|
-
//# sourceMappingURL=file-system.js.map
|
package/lib/common/header.js
CHANGED
|
@@ -13,13 +13,11 @@ 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(" │"),
|
|
17
16
|
].join("");
|
|
18
17
|
const tagLine = [
|
|
19
18
|
color_1.color.dim("│ "),
|
|
20
19
|
color_1.color.dim(" → "),
|
|
21
20
|
color_1.color.whiteBright.bold("Empower JavaScript with native APIs "),
|
|
22
|
-
// color.dim(" │"),
|
|
23
21
|
].join("");
|
|
24
22
|
const headerLength = (0, color_1.stripColors)(header).length;
|
|
25
23
|
const tagLineLength = (0, color_1.stripColors)(tagLine).length;
|
|
@@ -30,4 +28,3 @@ function printHeader() {
|
|
|
30
28
|
console.info(" " + color_1.color.dim("└" + "─".repeat(width - 1) + "┘"));
|
|
31
29
|
}
|
|
32
30
|
exports.printHeader = printHeader;
|
|
33
|
-
//# sourceMappingURL=header.js.map
|
package/lib/common/helpers.js
CHANGED
|
@@ -32,13 +32,6 @@ function doesCurrentNpmCommandMatch(patterns) {
|
|
|
32
32
|
return result;
|
|
33
33
|
}
|
|
34
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
|
-
*/
|
|
42
35
|
function someWithRegExps(array, patterns) {
|
|
43
36
|
return _.some(array, (item) => _.some(patterns, (pattern) => !!item.match(pattern)));
|
|
44
37
|
}
|
|
@@ -51,7 +44,6 @@ function getCurrentNpmCommandArgv() {
|
|
|
51
44
|
result = npmConfigArgv.original || [];
|
|
52
45
|
}
|
|
53
46
|
catch (error) {
|
|
54
|
-
// ignore
|
|
55
47
|
}
|
|
56
48
|
}
|
|
57
49
|
return result;
|
|
@@ -72,7 +64,6 @@ function isInstallingNativeScriptGloballyWithNpm() {
|
|
|
72
64
|
return isInstallCommand && isGlobalCommand && hasNativeScriptPackage;
|
|
73
65
|
}
|
|
74
66
|
function isInstallingNativeScriptGloballyWithYarn() {
|
|
75
|
-
// yarn populates the same env used by npm - npm_config_argv, so check it for yarn specific command
|
|
76
67
|
const isInstallCommand = doesCurrentNpmCommandMatch([/^add$/]);
|
|
77
68
|
const isGlobalCommand = doesCurrentNpmCommandMatch([/^global$/]);
|
|
78
69
|
const hasNativeScriptPackage = doesCurrentNpmCommandMatch([
|
|
@@ -81,13 +72,6 @@ function isInstallingNativeScriptGloballyWithYarn() {
|
|
|
81
72
|
]);
|
|
82
73
|
return isInstallCommand && isGlobalCommand && hasNativeScriptPackage;
|
|
83
74
|
}
|
|
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
|
-
*/
|
|
91
75
|
function createRegExp(input, opts) {
|
|
92
76
|
if (!input || !_.isString(input)) {
|
|
93
77
|
throw new Error("Input must be a string.");
|
|
@@ -96,13 +80,7 @@ function createRegExp(input, opts) {
|
|
|
96
80
|
return new RegExp(escapedSource, opts);
|
|
97
81
|
}
|
|
98
82
|
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
|
-
*/
|
|
104
83
|
function regExpEscape(input) {
|
|
105
|
-
// https://stackoverflow.com/questions/3446170/escape-string-for-use-in-javascript-regex
|
|
106
84
|
return input.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
107
85
|
}
|
|
108
86
|
exports.regExpEscape = regExpEscape;
|
|
@@ -111,7 +89,6 @@ function getShortPluginName(pluginName) {
|
|
|
111
89
|
}
|
|
112
90
|
exports.getShortPluginName = getShortPluginName;
|
|
113
91
|
function sanitizePluginName(pluginName) {
|
|
114
|
-
// avoid long plugin names, exclude the npm module scope (@scope/nativescript-plugin) from the android plugin name
|
|
115
92
|
return pluginName.split("/").pop();
|
|
116
93
|
}
|
|
117
94
|
function executeActionByChunks(initialData, chunkSize, elementAction) {
|
|
@@ -162,13 +139,6 @@ function deferPromise() {
|
|
|
162
139
|
};
|
|
163
140
|
}
|
|
164
141
|
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
|
-
*/
|
|
172
142
|
function settlePromises(promises) {
|
|
173
143
|
return new Promise((resolve, reject) => {
|
|
174
144
|
let settledPromisesCount = 0;
|
|
@@ -184,7 +154,6 @@ function settlePromises(promises) {
|
|
|
184
154
|
results[index] = result;
|
|
185
155
|
})
|
|
186
156
|
.catch((err) => {
|
|
187
|
-
// Accumulate all errors.
|
|
188
157
|
errors.push(err);
|
|
189
158
|
})
|
|
190
159
|
.then(() => {
|
|
@@ -218,14 +187,12 @@ function bashQuote(s) {
|
|
|
218
187
|
if (s[0] === "'" && s[s.length - 1] === "'") {
|
|
219
188
|
return s;
|
|
220
189
|
}
|
|
221
|
-
// replace ' with '"'"' and wrap in ''
|
|
222
190
|
return "'" + s.replace(/'/g, "'\"'\"'") + "'";
|
|
223
191
|
}
|
|
224
192
|
function cmdQuote(s) {
|
|
225
193
|
if (s[0] === '"' && s[s.length - 1] === '"') {
|
|
226
194
|
return s;
|
|
227
195
|
}
|
|
228
|
-
// replace " with \" and wrap in ""
|
|
229
196
|
return '"' + s.replace(/"/g, '\\"') + '"';
|
|
230
197
|
}
|
|
231
198
|
function quoteString(s) {
|
|
@@ -291,9 +258,6 @@ function isInteractive() {
|
|
|
291
258
|
return result;
|
|
292
259
|
}
|
|
293
260
|
exports.isInteractive = isInteractive;
|
|
294
|
-
/**
|
|
295
|
-
* Checks if current process is running in Text Terminal (TTY)
|
|
296
|
-
*/
|
|
297
261
|
function isRunningInTTY() {
|
|
298
262
|
return (process.stdout &&
|
|
299
263
|
process.stdout.isTTY &&
|
|
@@ -301,10 +265,6 @@ function isRunningInTTY() {
|
|
|
301
265
|
process.stdin.isTTY);
|
|
302
266
|
}
|
|
303
267
|
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"
|
|
308
268
|
return !!(process.env && (process.env.CI || process.env.JENKINS_HOME));
|
|
309
269
|
}
|
|
310
270
|
function toBoolean(str) {
|
|
@@ -369,11 +329,11 @@ function getMessageWithBorders(message, spanLength = 3) {
|
|
|
369
329
|
const longestRowLength = message.split("\n").sort((a, b) => {
|
|
370
330
|
return b.length - a.length;
|
|
371
331
|
})[0].length;
|
|
372
|
-
let border = "*".repeat(longestRowLength + 2 * spanLength);
|
|
332
|
+
let border = "*".repeat(longestRowLength + 2 * spanLength);
|
|
373
333
|
if (border.length % 2 === 0) {
|
|
374
|
-
border += "*";
|
|
334
|
+
border += "*";
|
|
375
335
|
}
|
|
376
|
-
border = border.replace(/\*\*/g, "* ");
|
|
336
|
+
border = border.replace(/\*\*/g, "* ");
|
|
377
337
|
const formatRow = function (row) {
|
|
378
338
|
return (_.padEnd("*", spanLength) +
|
|
379
339
|
_.padEnd(row, border.length - 2 * spanLength) +
|
|
@@ -406,11 +366,9 @@ function trimSymbol(str, symbol) {
|
|
|
406
366
|
}
|
|
407
367
|
exports.trimSymbol = trimSymbol;
|
|
408
368
|
function parseJson(data) {
|
|
409
|
-
// Replace BOM from the header of the file if it exists
|
|
410
369
|
return JSON.parse(data.replace(/^\uFEFF/, ""));
|
|
411
370
|
}
|
|
412
371
|
exports.parseJson = parseJson;
|
|
413
|
-
// TODO: Use generic for predicatе predicate: (element: T|T[]) when TypeScript support this.
|
|
414
372
|
function getFuturesResults(promises, predicate) {
|
|
415
373
|
return __awaiter(this, void 0, void 0, function* () {
|
|
416
374
|
const results = yield Promise.all(promises);
|
|
@@ -418,12 +376,6 @@ function getFuturesResults(promises, predicate) {
|
|
|
418
376
|
});
|
|
419
377
|
}
|
|
420
378
|
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
|
-
*/
|
|
427
379
|
function appendZeroesToVersion(version, requiredVersionLength) {
|
|
428
380
|
if (version) {
|
|
429
381
|
const zeroesToAppend = requiredVersionLength - version.split(".").length;
|
|
@@ -589,14 +541,6 @@ function getProjectFilesConfig(opts) {
|
|
|
589
541
|
return projectFilesConfig;
|
|
590
542
|
}
|
|
591
543
|
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
|
-
*/
|
|
600
544
|
function getPidFromiOSSimulatorLogs(applicationIdentifier, logLine) {
|
|
601
545
|
if (logLine) {
|
|
602
546
|
const pidRegExp = new RegExp(`${applicationIdentifier}:\\s?(\\d+)`);
|
|
@@ -648,7 +592,6 @@ function stringify(value, replacer, space) {
|
|
|
648
592
|
return JSON.stringify(value, replacer, space || 2);
|
|
649
593
|
}
|
|
650
594
|
exports.stringify = stringify;
|
|
651
|
-
//2019-01-07 18:29:50.745
|
|
652
595
|
function getFixedLengthDateString() {
|
|
653
596
|
const currentDate = new Date();
|
|
654
597
|
const year = currentDate.getFullYear();
|
|
@@ -674,28 +617,6 @@ function getFormattedMilliseconds(date) {
|
|
|
674
617
|
return milliseconds;
|
|
675
618
|
}
|
|
676
619
|
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.
|
|
699
620
|
const CLASS_NAME = /class\s+([A-Z].+?)(?:\s+.*?)?\{/;
|
|
700
621
|
const CONSTRUCTOR_ARGS = /constructor\s*([^\(]*)\(\s*([^\)]*)\)/m;
|
|
701
622
|
const FN_NAME_AND_ARGS = /^(?:function)?\s*([^\(]*)\(\s*([^\)]*)\)\s*(=>)?\s*[{_]/m;
|
|
@@ -726,11 +647,6 @@ function annotate(fn) {
|
|
|
726
647
|
return $inject;
|
|
727
648
|
}
|
|
728
649
|
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
|
-
*/
|
|
734
650
|
function hasValidAndroidSigning(signingData) {
|
|
735
651
|
const isValid = signingData &&
|
|
736
652
|
signingData.keyStorePath &&
|
|
@@ -740,5 +656,3 @@ function hasValidAndroidSigning(signingData) {
|
|
|
740
656
|
return !!isValid;
|
|
741
657
|
}
|
|
742
658
|
exports.hasValidAndroidSigning = hasValidAndroidSigning;
|
|
743
|
-
//--- end part copied from AngularJS
|
|
744
|
-
//# sourceMappingURL=helpers.js.map
|
package/lib/common/host-info.js
CHANGED
|
@@ -75,9 +75,6 @@ class HostInfo {
|
|
|
75
75
|
catch (err) {
|
|
76
76
|
this.$logger.trace(`Unable to get macOS version from ${systemProfileCommand}. Error is: ${err}`);
|
|
77
77
|
}
|
|
78
|
-
// https://en.wikipedia.org/wiki/Darwin_(operating_system)#Release_history
|
|
79
|
-
// Each macOS version is labeled 10.<version>, where it looks like <versions> is taken from the major version returned by os.release() (16.x.x for example) and subtracting 4 from it.
|
|
80
|
-
// So the version becomes "10.12" in this case.
|
|
81
78
|
const osRelease = this.$osInfo.release();
|
|
82
79
|
const majorVersion = osRelease && _.first(osRelease.split("."));
|
|
83
80
|
macOSVersion = majorVersion && `10.${+majorVersion - 4}`;
|
|
@@ -134,4 +131,3 @@ __decorate([
|
|
|
134
131
|
], HostInfo.prototype, "getMacOSVersion", null);
|
|
135
132
|
exports.HostInfo = HostInfo;
|
|
136
133
|
yok_1.injector.register("hostInfo", HostInfo);
|
|
137
|
-
//# sourceMappingURL=host-info.js.map
|
|
@@ -36,9 +36,6 @@ class HttpClient {
|
|
|
36
36
|
catch (err) {
|
|
37
37
|
if (err.message === HttpClient.STUCK_REQUEST_ERROR_MESSAGE ||
|
|
38
38
|
err.message === HttpClient.STUCK_RESPONSE_ERROR_MESSAGE) {
|
|
39
|
-
// Retry the request immediately because there are at least 10 seconds between the two requests.
|
|
40
|
-
// We have to retry only once the sporadically stuck requests/responses.
|
|
41
|
-
// We can add exponential backoff retry here if we decide that we need to workaround bigger network issues on the client side.
|
|
42
39
|
this.$logger.warn("%s Retrying request to %s...", err.message, options.url || options);
|
|
43
40
|
const retryResult = yield this.httpRequestCore(options, proxySettings);
|
|
44
41
|
return {
|
|
@@ -66,7 +63,6 @@ class HttpClient {
|
|
|
66
63
|
yield this.useProxySettings(proxySettings, cliProxySettings, options, headers, requestProto);
|
|
67
64
|
if (!headers["User-Agent"]) {
|
|
68
65
|
if (!this.defaultUserAgent) {
|
|
69
|
-
//TODO: the user agent client name is also passed explicitly during login and should be kept in sync
|
|
70
66
|
this.defaultUserAgent = `${this.$staticConfig.USER_AGENT_NAME}/${this.$staticConfig.version} (Node.js ${process.versions.node}; ${process.platform}; ${process.arch})`;
|
|
71
67
|
this.$logger.trace("User-Agent: %s", this.defaultUserAgent);
|
|
72
68
|
}
|
|
@@ -95,19 +91,14 @@ class HttpClient {
|
|
|
95
91
|
}).catch((err) => {
|
|
96
92
|
this.$logger.trace("An error occurred while sending the request:", err);
|
|
97
93
|
if (err.response) {
|
|
98
|
-
// The request was made and the server responded with a status code
|
|
99
|
-
// that falls out of the range of 2xx
|
|
100
94
|
const errorMessage = this.getErrorMessage(err.response.status, null);
|
|
101
95
|
err.proxyAuthenticationRequired =
|
|
102
96
|
err.response.status === constants_1.HttpStatusCodes.PROXY_AUTHENTICATION_REQUIRED;
|
|
103
97
|
err.message = errorMessage || err.message;
|
|
104
98
|
}
|
|
105
99
|
else if (err.request) {
|
|
106
|
-
// The request was made but no response was received
|
|
107
|
-
// `err.request` is an instance of XMLHttpRequest in the browser and an instance of
|
|
108
100
|
}
|
|
109
101
|
else {
|
|
110
|
-
// Something happened in setting up the request that triggered an Error
|
|
111
102
|
}
|
|
112
103
|
throw err;
|
|
113
104
|
});
|
|
@@ -154,18 +145,9 @@ class HttpClient {
|
|
|
154
145
|
return body;
|
|
155
146
|
}
|
|
156
147
|
}
|
|
157
|
-
/**
|
|
158
|
-
* This method respects the proxySettings (or proxyCache) by modifying headers and options passed to http(s) module.
|
|
159
|
-
* @param {IProxySettings} proxySettings The settings passed for this specific call.
|
|
160
|
-
* @param {IProxySettings} cliProxySettings The globally set proxy for this CLI.
|
|
161
|
-
* @param {any}options The object that will be passed to http(s) module.
|
|
162
|
-
* @param {any} headers Headers of the current request.
|
|
163
|
-
* @param {string} requestProto The protocol used for the current request - http or https.
|
|
164
|
-
*/
|
|
165
148
|
useProxySettings(proxySettings, cliProxySettings, options, headers, requestProto) {
|
|
166
149
|
return __awaiter(this, void 0, void 0, function* () {
|
|
167
150
|
const isLocalRequest = options.host === "localhost" || options.host === "127.0.0.1";
|
|
168
|
-
// don't use the proxy for requests to localhost
|
|
169
151
|
if (!isLocalRequest && (proxySettings || cliProxySettings)) {
|
|
170
152
|
const proto = (proxySettings && proxySettings.protocol) ||
|
|
171
153
|
cliProxySettings.protocol ||
|
|
@@ -176,7 +158,6 @@ class HttpClient {
|
|
|
176
158
|
if (cliProxySettings.username && cliProxySettings.password) {
|
|
177
159
|
credentialsPart = `${cliProxySettings.username}:${cliProxySettings.password}@`;
|
|
178
160
|
}
|
|
179
|
-
// Note that proto ends with :
|
|
180
161
|
options.proxy = `${proto}//${credentialsPart}${host}:${port}`;
|
|
181
162
|
options.rejectUnauthorized = proxySettings
|
|
182
163
|
? proxySettings.rejectUnauthorized
|
|
@@ -190,4 +171,3 @@ HttpClient.STUCK_REQUEST_ERROR_MESSAGE = "The request can't receive any response
|
|
|
190
171
|
HttpClient.STUCK_RESPONSE_ERROR_MESSAGE = "Can't receive all parts of the response.";
|
|
191
172
|
exports.HttpClient = HttpClient;
|
|
192
173
|
yok_1.injector.register("httpClient", HttpClient);
|
|
193
|
-
//# sourceMappingURL=http-client.js.map
|