nativescript 8.5.3 → 8.5.4-dev.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (227) hide show
  1. package/config/config.json +0 -5
  2. package/lib/.d.ts +2 -37
  3. package/lib/bootstrap.js +1 -12
  4. package/lib/color.js +5 -0
  5. package/lib/commands/build.js +2 -6
  6. package/lib/commands/clean.js +11 -10
  7. package/lib/commands/config.js +6 -5
  8. package/lib/commands/create-project.js +12 -11
  9. package/lib/commands/debug.js +10 -11
  10. package/lib/commands/plugin/list-plugins.js +3 -2
  11. package/lib/commands/post-install.js +3 -5
  12. package/lib/commands/preview.js +4 -3
  13. package/lib/commands/run.js +17 -19
  14. package/lib/commands/test-init.js +14 -15
  15. package/lib/commands/test.js +0 -3
  16. package/lib/commands/update.js +1 -1
  17. package/lib/common/bootstrap.js +0 -1
  18. package/lib/common/child-process.js +3 -3
  19. package/lib/common/codeGeneration/code-printer.js +1 -1
  20. package/lib/common/commands/device/device-log-stream.js +1 -1
  21. package/lib/common/commands/device/list-devices.js +7 -8
  22. package/lib/common/commands/generate-messages.js +1 -1
  23. package/lib/common/constants.js +11 -11
  24. package/lib/common/declarations.d.ts +1 -53
  25. package/lib/common/definitions/commands-service.d.ts +0 -1
  26. package/lib/common/definitions/commands.d.ts +0 -1
  27. package/lib/common/definitions/google-analytics.d.ts +0 -5
  28. package/lib/common/dispatchers.js +0 -5
  29. package/lib/common/file-system.js +18 -22
  30. package/lib/common/host-info.js +4 -4
  31. package/lib/common/http-client.js +2 -2
  32. package/lib/common/logger/layouts/cli-layout.js +6 -2
  33. package/lib/common/logger/logger.js +7 -7
  34. package/lib/common/mobile/android/android-debug-bridge-result-handler.js +1 -1
  35. package/lib/common/mobile/android/android-log-filter.js +5 -5
  36. package/lib/common/mobile/android/android-virtual-device-service.js +2 -2
  37. package/lib/common/mobile/android/genymotion/genymotion-service.js +2 -2
  38. package/lib/common/mobile/android/logcat-helper.js +1 -1
  39. package/lib/common/mobile/device-log-provider.js +8 -8
  40. package/lib/common/mobile/ios/device/ios-device-file-system.js +1 -1
  41. package/lib/common/mobile/ios/simulator/ios-emulator-services.js +1 -1
  42. package/lib/common/mobile/ios/simulator/ios-sim-resolver.js +1 -1
  43. package/lib/common/mobile/mobile-helper.js +1 -1
  44. package/lib/common/mobile/wp8/wp8-emulator-services.js +4 -4
  45. package/lib/common/opener.js +5 -1
  46. package/lib/common/plist-parser.js +3 -3
  47. package/lib/common/project-helper.js +2 -2
  48. package/lib/common/services/analytics/google-analytics-custom-dimensions.d.ts +7 -7
  49. package/lib/common/services/auto-completion-service.js +2 -2
  50. package/lib/common/services/commands-service.js +5 -114
  51. package/lib/common/services/help-service.js +16 -16
  52. package/lib/common/services/hooks-service.js +2 -1
  53. package/lib/common/services/json-file-settings-service.js +3 -3
  54. package/lib/common/services/lock-service.js +5 -5
  55. package/lib/common/services/messages-service.js +6 -6
  56. package/lib/common/services/net-service.js +1 -1
  57. package/lib/common/services/project-files-manager.js +2 -2
  58. package/lib/common/services/settings-service.js +2 -2
  59. package/lib/common/validators/project-name-validator.js +1 -1
  60. package/lib/common/validators/validation-result.js +1 -1
  61. package/lib/common/verify-node-version.js +2 -2
  62. package/lib/config.js +3 -8
  63. package/lib/constants.js +18 -32
  64. package/lib/controllers/build-controller.js +5 -5
  65. package/lib/controllers/debug-controller.js +2 -2
  66. package/lib/controllers/migrate-controller.js +21 -20
  67. package/lib/controllers/update-controller.js +5 -4
  68. package/lib/declarations.d.ts +0 -24
  69. package/lib/definitions/build.d.ts +1 -1
  70. package/lib/definitions/livesync.d.ts +0 -10
  71. package/lib/definitions/project.d.ts +0 -6
  72. package/lib/definitions/xcode.d.ts +1 -1
  73. package/lib/device-sockets/ios/app-debug-socket-proxy-factory.js +15 -4
  74. package/lib/device-sockets/ios/notification.js +1 -1
  75. package/lib/helpers/android-bundle-validator-helper.js +1 -1
  76. package/lib/helpers/network-connectivity-validator.js +1 -1
  77. package/lib/helpers/options-track-helper.js +1 -1
  78. package/lib/nativescript-cli.js +8 -10
  79. package/lib/options.js +61 -21
  80. package/lib/package-installation-manager.js +5 -4
  81. package/lib/project-data.js +9 -10
  82. package/lib/providers/project-files-provider.js +3 -3
  83. package/lib/services/analytics/analytics-broker-process.js +0 -3
  84. package/lib/services/analytics/analytics-broker.js +5 -5
  85. package/lib/services/analytics/analytics-service.js +0 -4
  86. package/lib/services/analytics/analytics.d.ts +1 -8
  87. package/lib/services/analytics/google-analytics-provider.js +1 -21
  88. package/lib/services/analytics-settings-service.js +3 -11
  89. package/lib/services/android-device-debug-service.js +3 -3
  90. package/lib/services/android-plugin-build-service.js +3 -3
  91. package/lib/services/android-resources-migration-service.js +1 -1
  92. package/lib/services/assets-generation/assets-generation-service.js +5 -5
  93. package/lib/services/{build-artefacts-service.js → build-artifacts-service.js} +4 -4
  94. package/lib/services/cocoapods-service.js +1 -1
  95. package/lib/services/device/device-install-app-service.js +3 -3
  96. package/lib/services/doctor-service.js +10 -9
  97. package/lib/services/extensibility-service.js +8 -8
  98. package/lib/services/ios-entitlements-service.js +1 -1
  99. package/lib/services/ios-project-service.js +5 -5
  100. package/lib/services/ios-provision-service.js +7 -7
  101. package/lib/services/ios-watch-app-service.js +1 -1
  102. package/lib/services/ip-service.js +2 -4
  103. package/lib/services/itmstransporter-service.js +2 -2
  104. package/lib/services/livesync/android-device-livesync-sockets-service.js +1 -1
  105. package/lib/services/livesync/android-livesync-tool.js +5 -5
  106. package/lib/services/livesync/ios-device-livesync-service.js +2 -2
  107. package/lib/services/livesync/platform-livesync-service-base.js +2 -1
  108. package/lib/services/log-parser-service.js +1 -5
  109. package/lib/services/log-source-map-service.js +10 -7
  110. package/lib/services/npm-config-service.js +23 -9
  111. package/lib/services/performance-service.js +3 -3
  112. package/lib/services/platform-environment-requirements.js +1 -1
  113. package/lib/services/plugins-service.js +19 -19
  114. package/lib/services/project-backup-service.js +4 -3
  115. package/lib/services/project-cleanup-service.js +4 -3
  116. package/lib/services/test-execution-service.js +2 -2
  117. package/lib/services/timeline-profiler-service.js +4 -1
  118. package/lib/services/user-settings-service.js +4 -4
  119. package/lib/tools/config-manipulation/config-transformer.js +3 -3
  120. package/lib/tools/node-modules/node-modules-builder.js +1 -1
  121. package/node_modules/@npmcli/move-file/LICENSE.md +22 -0
  122. package/node_modules/@npmcli/move-file/README.md +69 -0
  123. package/node_modules/@npmcli/move-file/lib/index.js +185 -0
  124. package/node_modules/@npmcli/move-file/node_modules/mkdirp/CHANGELOG.md +15 -0
  125. package/node_modules/@npmcli/move-file/node_modules/mkdirp/LICENSE +21 -0
  126. package/node_modules/@npmcli/move-file/node_modules/mkdirp/bin/cmd.js +68 -0
  127. package/node_modules/@npmcli/move-file/node_modules/mkdirp/index.js +31 -0
  128. package/node_modules/@npmcli/move-file/node_modules/mkdirp/lib/find-made.js +29 -0
  129. package/node_modules/@npmcli/move-file/node_modules/mkdirp/lib/mkdirp-manual.js +64 -0
  130. package/node_modules/@npmcli/move-file/node_modules/mkdirp/lib/mkdirp-native.js +39 -0
  131. package/node_modules/@npmcli/move-file/node_modules/mkdirp/lib/opts-arg.js +23 -0
  132. package/node_modules/@npmcli/move-file/node_modules/mkdirp/lib/path-arg.js +29 -0
  133. package/node_modules/@npmcli/move-file/node_modules/mkdirp/lib/use-native.js +10 -0
  134. package/node_modules/@npmcli/move-file/node_modules/mkdirp/package.json +44 -0
  135. package/node_modules/@npmcli/move-file/node_modules/mkdirp/readme.markdown +266 -0
  136. package/node_modules/@npmcli/move-file/package.json +47 -0
  137. package/node_modules/balanced-match/.npmignore +5 -0
  138. package/node_modules/balanced-match/LICENSE.md +21 -0
  139. package/node_modules/balanced-match/README.md +91 -0
  140. package/node_modules/balanced-match/index.js +59 -0
  141. package/node_modules/balanced-match/package.json +49 -0
  142. package/node_modules/brace-expansion/LICENSE +21 -0
  143. package/node_modules/brace-expansion/README.md +129 -0
  144. package/node_modules/brace-expansion/index.js +201 -0
  145. package/node_modules/brace-expansion/package.json +47 -0
  146. package/node_modules/concat-map/.travis.yml +4 -0
  147. package/node_modules/concat-map/LICENSE +18 -0
  148. package/node_modules/concat-map/README.markdown +62 -0
  149. package/node_modules/concat-map/example/map.js +6 -0
  150. package/node_modules/concat-map/index.js +13 -0
  151. package/node_modules/concat-map/package.json +43 -0
  152. package/node_modules/concat-map/test/map.js +39 -0
  153. package/node_modules/fs.realpath/LICENSE +43 -0
  154. package/node_modules/fs.realpath/README.md +33 -0
  155. package/node_modules/fs.realpath/index.js +66 -0
  156. package/node_modules/fs.realpath/old.js +303 -0
  157. package/node_modules/fs.realpath/package.json +26 -0
  158. package/node_modules/inflight/LICENSE +15 -0
  159. package/node_modules/inflight/README.md +37 -0
  160. package/node_modules/inflight/inflight.js +54 -0
  161. package/node_modules/inflight/package.json +29 -0
  162. package/node_modules/inherits/LICENSE +16 -0
  163. package/node_modules/inherits/README.md +42 -0
  164. package/node_modules/inherits/inherits.js +9 -0
  165. package/node_modules/inherits/inherits_browser.js +27 -0
  166. package/node_modules/inherits/package.json +29 -0
  167. package/node_modules/once/LICENSE +15 -0
  168. package/node_modules/once/README.md +79 -0
  169. package/node_modules/once/once.js +42 -0
  170. package/node_modules/once/package.json +33 -0
  171. package/node_modules/path-is-absolute/index.js +20 -0
  172. package/node_modules/path-is-absolute/license +21 -0
  173. package/node_modules/path-is-absolute/package.json +43 -0
  174. package/node_modules/path-is-absolute/readme.md +59 -0
  175. package/node_modules/rimraf/CHANGELOG.md +65 -0
  176. package/node_modules/rimraf/LICENSE +15 -0
  177. package/node_modules/rimraf/README.md +101 -0
  178. package/node_modules/rimraf/bin.js +68 -0
  179. package/node_modules/rimraf/node_modules/glob/LICENSE +21 -0
  180. package/node_modules/rimraf/node_modules/glob/README.md +378 -0
  181. package/node_modules/rimraf/node_modules/glob/common.js +238 -0
  182. package/node_modules/rimraf/node_modules/glob/glob.js +790 -0
  183. package/node_modules/rimraf/node_modules/glob/package.json +55 -0
  184. package/node_modules/rimraf/node_modules/glob/sync.js +486 -0
  185. package/node_modules/rimraf/node_modules/minimatch/LICENSE +15 -0
  186. package/node_modules/rimraf/node_modules/minimatch/README.md +230 -0
  187. package/node_modules/rimraf/node_modules/minimatch/minimatch.js +947 -0
  188. package/node_modules/rimraf/node_modules/minimatch/package.json +33 -0
  189. package/node_modules/rimraf/package.json +32 -0
  190. package/node_modules/rimraf/rimraf.js +360 -0
  191. package/node_modules/stringify-package/CHANGELOG.md +16 -0
  192. package/node_modules/stringify-package/LICENSE +13 -0
  193. package/node_modules/stringify-package/README.md +55 -0
  194. package/node_modules/stringify-package/index.js +18 -0
  195. package/node_modules/stringify-package/package.json +38 -0
  196. package/node_modules/wrappy/LICENSE +15 -0
  197. package/node_modules/wrappy/README.md +36 -0
  198. package/node_modules/wrappy/package.json +29 -0
  199. package/node_modules/wrappy/wrappy.js +33 -0
  200. package/package.json +88 -89
  201. package/lib/common/definitions/byline.d.ts +0 -4
  202. package/lib/common/definitions/colors.d.ts +0 -24
  203. package/lib/common/definitions/marked.d.ts +0 -125
  204. package/lib/common/definitions/open.d.ts +0 -5
  205. package/lib/common/definitions/osenv.d.ts +0 -4
  206. package/lib/common/definitions/plist.d.ts +0 -7
  207. package/lib/common/definitions/rimraf.d.ts +0 -9
  208. package/lib/common/definitions/shelljs.d.ts +0 -583
  209. package/lib/common/definitions/simple-plist.d.ts +0 -7
  210. package/lib/common/definitions/xmlhttprequest.d.ts +0 -29
  211. package/lib/controllers/company-insights-controller.js +0 -78
  212. package/lib/controllers/preview-app-controller.js +0 -251
  213. package/lib/definitions/company-insights-controller.d.ts +0 -59
  214. package/lib/definitions/email-validator.d.ts +0 -8
  215. package/lib/definitions/libnpmconfig.d.ts +0 -3
  216. package/lib/definitions/npm.d.ts +0 -12
  217. package/lib/definitions/preview-app-livesync.d.ts +0 -116
  218. package/lib/services/livesync/playground/devices/preview-devices-service.js +0 -67
  219. package/lib/services/livesync/playground/preview-app-constants.js +0 -23
  220. package/lib/services/livesync/playground/preview-app-files-service.js +0 -83
  221. package/lib/services/livesync/playground/preview-app-log-provider.js +0 -14
  222. package/lib/services/livesync/playground/preview-app-plugins-service.js +0 -134
  223. package/lib/services/livesync/playground/preview-qr-code-service.js +0 -109
  224. package/lib/services/livesync/playground/preview-schema-service.js +0 -57
  225. package/lib/services/livesync/playground/preview-sdk-service.js +0 -112
  226. package/lib/services/playground-service.js +0 -65
  227. package/lib/xml-validator.js +0 -47
@@ -1,78 +0,0 @@
1
- "use strict";
2
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
- return c > 3 && r && Object.defineProperty(target, key, r), r;
7
- };
8
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
9
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
10
- return new (P || (P = Promise))(function (resolve, reject) {
11
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
12
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
13
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
14
- step((generator = generator.apply(thisArg, _arguments || [])).next());
15
- });
16
- };
17
- Object.defineProperty(exports, "__esModule", { value: true });
18
- exports.CompanyInsightsController = void 0;
19
- const constants_1 = require("../constants");
20
- const decorators_1 = require("../common/decorators");
21
- const util = require("util");
22
- const _ = require("lodash");
23
- const yok_1 = require("../common/yok");
24
- class CompanyInsightsController {
25
- constructor($config, $httpClient, $ipService, $logger) {
26
- this.$config = $config;
27
- this.$httpClient = $httpClient;
28
- this.$ipService = $ipService;
29
- this.$logger = $logger;
30
- }
31
- getCompanyData() {
32
- return __awaiter(this, void 0, void 0, function* () {
33
- let companyData = null;
34
- let currentPublicIP = null;
35
- try {
36
- currentPublicIP = yield this.$ipService.getCurrentIPv4Address();
37
- }
38
- catch (err) {
39
- this.$logger.trace(`Unable to get current public ip address. Error is: `, err);
40
- }
41
- if (currentPublicIP) {
42
- companyData = yield this.getCompanyDataFromPlaygroundInsightsEndpoint(currentPublicIP);
43
- }
44
- return companyData;
45
- });
46
- }
47
- getCompanyDataFromPlaygroundInsightsEndpoint(ipAddress) {
48
- return __awaiter(this, void 0, void 0, function* () {
49
- let companyData = null;
50
- try {
51
- const url = util.format(this.$config.INSIGHTS_URL_ENDPOINT, encodeURIComponent(ipAddress));
52
- const response = yield this.$httpClient.httpRequest(url);
53
- const data = JSON.parse(response.body);
54
- if (data.company) {
55
- const industries = _.isArray(data.company.industries)
56
- ? data.company.industries.join(constants_1.AnalyticsEventLabelDelimiter)
57
- : null;
58
- companyData = {
59
- name: data.company.name,
60
- country: data.company.country,
61
- revenue: data.company.revenue,
62
- employeeCount: data.company.employeeCount,
63
- industries,
64
- };
65
- }
66
- }
67
- catch (err) {
68
- this.$logger.trace(`Unable to get data for company. Error is: ${err}`);
69
- }
70
- return companyData;
71
- });
72
- }
73
- }
74
- __decorate([
75
- (0, decorators_1.cache)()
76
- ], CompanyInsightsController.prototype, "getCompanyDataFromPlaygroundInsightsEndpoint", null);
77
- exports.CompanyInsightsController = CompanyInsightsController;
78
- yok_1.injector.register("companyInsightsController", CompanyInsightsController);
@@ -1,251 +0,0 @@
1
- "use strict";
2
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
- return c > 3 && r && Object.defineProperty(target, key, r), r;
7
- };
8
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
9
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
10
- return new (P || (P = Promise))(function (resolve, reject) {
11
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
12
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
13
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
14
- step((generator = generator.apply(thisArg, _arguments || [])).next());
15
- });
16
- };
17
- Object.defineProperty(exports, "__esModule", { value: true });
18
- exports.PreviewAppController = void 0;
19
- const constants_1 = require("../constants");
20
- const decorators_1 = require("../common/decorators");
21
- const helpers_1 = require("../common/helpers");
22
- const constants_2 = require("../common/constants");
23
- const events_1 = require("events");
24
- const _ = require("lodash");
25
- const preview_app_constants_1 = require("../services/livesync/playground/preview-app-constants");
26
- const yok_1 = require("../common/yok");
27
- class PreviewAppController extends events_1.EventEmitter {
28
- constructor($analyticsService, $devicePlatformsConstants, $errors, $hmrStatusService, $logger, $hooksService, $pluginsService, $prepareController, $previewAppFilesService, $previewAppPluginsService, $previewDevicesService, $previewQrCodeService, $previewSdkService, $prepareDataService, $projectDataService) {
29
- super();
30
- this.$analyticsService = $analyticsService;
31
- this.$devicePlatformsConstants = $devicePlatformsConstants;
32
- this.$errors = $errors;
33
- this.$hmrStatusService = $hmrStatusService;
34
- this.$logger = $logger;
35
- this.$hooksService = $hooksService;
36
- this.$pluginsService = $pluginsService;
37
- this.$prepareController = $prepareController;
38
- this.$previewAppFilesService = $previewAppFilesService;
39
- this.$previewAppPluginsService = $previewAppPluginsService;
40
- this.$previewDevicesService = $previewDevicesService;
41
- this.$previewQrCodeService = $previewQrCodeService;
42
- this.$previewSdkService = $previewSdkService;
43
- this.$prepareDataService = $prepareDataService;
44
- this.$projectDataService = $projectDataService;
45
- this.prepareReadyEventHandler = null;
46
- this.deviceInitializationPromise = {};
47
- this.devicesLiveSyncChain = {};
48
- this.devicesCanExecuteHmr = {};
49
- this.devicesHmrFiles = {};
50
- this.devicesAppFiles = {};
51
- this.devicesCurrentHmrHash = {};
52
- }
53
- startPreview(data) {
54
- return __awaiter(this, void 0, void 0, function* () {
55
- yield this.previewCore(data);
56
- const url = this.$previewSdkService.getQrCodeUrl({
57
- projectDir: data.projectDir,
58
- useHotModuleReload: data.useHotModuleReload,
59
- });
60
- const result = yield this.$previewQrCodeService.getLiveSyncQrCode(url);
61
- return result;
62
- });
63
- }
64
- stopPreview(data) {
65
- return __awaiter(this, void 0, void 0, function* () {
66
- this.$previewSdkService.stop();
67
- this.$previewDevicesService.updateConnectedDevices([]);
68
- yield this.$prepareController.stopWatchers(data.projectDir, this.$devicePlatformsConstants.Android);
69
- yield this.$prepareController.stopWatchers(data.projectDir, this.$devicePlatformsConstants.iOS);
70
- if (this.prepareReadyEventHandler) {
71
- this.$prepareController.removeListener(constants_1.PREPARE_READY_EVENT_NAME, this.prepareReadyEventHandler);
72
- this.prepareReadyEventHandler = null;
73
- }
74
- });
75
- }
76
- previewCore(data) {
77
- return __awaiter(this, void 0, void 0, function* () {
78
- const projectData = this.$projectDataService.getProjectData(data.projectDir);
79
- yield this.$pluginsService.ensureAllDependenciesAreInstalled(projectData);
80
- yield this.$previewSdkService.initialize(data.projectDir, (device) => __awaiter(this, void 0, void 0, function* () {
81
- try {
82
- if (!device) {
83
- this.$errors.fail("Sending initial preview files without a specified device is not supported.");
84
- }
85
- if (this.deviceInitializationPromise[device.id]) {
86
- return null;
87
- }
88
- this.deviceInitializationPromise[device.id] = true;
89
- if (device.uniqueId) {
90
- yield this.$analyticsService.trackEventActionInGoogleAnalytics({
91
- action: "Preview App Data",
92
- platform: device.platform,
93
- additionalData: device.uniqueId,
94
- });
95
- }
96
- yield this.$hooksService.executeBeforeHooks("preview-sync", {
97
- hookArgs: Object.assign(Object.assign({}, data), { platform: device.platform, projectData }),
98
- });
99
- if (data.useHotModuleReload) {
100
- this.$hmrStatusService.attachToHmrStatusEvent();
101
- this.devicesCanExecuteHmr[device.id] = true;
102
- }
103
- yield this.$previewAppPluginsService.comparePluginsOnDevice(data, device);
104
- if (!this.prepareReadyEventHandler) {
105
- const handler = (currentPrepareData) => __awaiter(this, void 0, void 0, function* () {
106
- yield this.handlePrepareReadyEvent(data, currentPrepareData);
107
- });
108
- this.prepareReadyEventHandler = handler.bind(this);
109
- this.$prepareController.on(constants_1.PREPARE_READY_EVENT_NAME, this.prepareReadyEventHandler);
110
- }
111
- data.env = data.env || {};
112
- data.env.externals = this.$previewAppPluginsService.getExternalPlugins(device);
113
- const prepareData = this.$prepareDataService.getPrepareData(data.projectDir, device.platform.toLowerCase(), Object.assign(Object.assign({}, data), { nativePrepare: { skipNativePrepare: true }, watch: true, watchNative: false }));
114
- yield this.$prepareController.prepare(prepareData);
115
- try {
116
- const payloads = yield this.getInitialFilesForDeviceSafe(data, device);
117
- return payloads;
118
- }
119
- finally {
120
- this.deviceInitializationPromise[device.id] = null;
121
- }
122
- }
123
- catch (error) {
124
- this.$logger.trace(`Error while sending files on device '${device && device.id}'. Error is`, error);
125
- this.emit(preview_app_constants_1.PreviewAppLiveSyncEvents.PREVIEW_APP_LIVE_SYNC_ERROR, {
126
- error,
127
- data,
128
- platform: device.platform,
129
- deviceId: device.id,
130
- });
131
- }
132
- }));
133
- return null;
134
- });
135
- }
136
- handlePrepareReadyEvent(data, currentPrepareData) {
137
- return __awaiter(this, void 0, void 0, function* () {
138
- const { hmrData, files, platform } = currentPrepareData;
139
- const platformHmrData = _.cloneDeep(hmrData) || {};
140
- const connectedDevices = this.$previewDevicesService.getDevicesForPlatform(platform);
141
- if (!connectedDevices || !connectedDevices.length) {
142
- this.$logger.warn(`Unable to find any connected devices for platform '${platform}'. In order to execute livesync, open your Preview app and optionally re-scan the QR code using the Playground app.`);
143
- return;
144
- }
145
- yield Promise.all(_.map(connectedDevices, (device) => __awaiter(this, void 0, void 0, function* () {
146
- const previousSync = this.devicesLiveSyncChain[device.id] || Promise.resolve();
147
- const currentSyncDeferPromise = (0, helpers_1.deferPromise)();
148
- this.devicesLiveSyncChain[device.id] = currentSyncDeferPromise.promise;
149
- this.devicesCurrentHmrHash[device.id] =
150
- this.devicesCurrentHmrHash[device.id] || platformHmrData.hash;
151
- if (data.useHotModuleReload) {
152
- this.devicesHmrFiles[device.id] =
153
- this.devicesHmrFiles[device.id] || [];
154
- this.devicesHmrFiles[device.id].push(...files);
155
- this.devicesAppFiles[device.id] = platformHmrData.fallbackFiles;
156
- }
157
- else {
158
- this.devicesHmrFiles[device.id] = [];
159
- this.devicesAppFiles[device.id] = files;
160
- }
161
- yield previousSync;
162
- try {
163
- let canExecuteHmrSync = false;
164
- const hmrHash = this.devicesCurrentHmrHash[device.id];
165
- this.devicesCurrentHmrHash[device.id] = null;
166
- if (data.useHotModuleReload && hmrHash) {
167
- if (this.devicesCanExecuteHmr[device.id]) {
168
- canExecuteHmrSync = true;
169
- }
170
- }
171
- const filesToSync = canExecuteHmrSync
172
- ? this.devicesHmrFiles[device.id]
173
- : this.devicesAppFiles[device.id];
174
- if (!filesToSync || !filesToSync.length) {
175
- this.$logger.info(`Skipping files sync for device ${this.getDeviceDisplayName(device)}. The changes are already batch transferred in a previous sync.`);
176
- currentSyncDeferPromise.resolve();
177
- return;
178
- }
179
- this.devicesHmrFiles[device.id] = [];
180
- this.devicesAppFiles[device.id] = [];
181
- if (canExecuteHmrSync) {
182
- this.$hmrStatusService.watchHmrStatus(device.id, hmrHash);
183
- yield this.syncFilesForPlatformSafe(data, { filesToSync }, platform, device);
184
- const status = yield this.$hmrStatusService.getHmrStatus(device.id, hmrHash);
185
- if (!status) {
186
- this.devicesCanExecuteHmr[device.id] = false;
187
- this.$logger.warn(`Unable to get LiveSync status from the Preview app for device ${this.getDeviceDisplayName(device)}. Ensure the app is running in order to sync changes.`);
188
- }
189
- else {
190
- this.devicesCanExecuteHmr[device.id] =
191
- status === constants_2.HmrConstants.HMR_SUCCESS_STATUS;
192
- }
193
- }
194
- else {
195
- const noHmrData = _.assign({}, data, { useHotModuleReload: false });
196
- yield this.syncFilesForPlatformSafe(noHmrData, { filesToSync }, platform, device);
197
- this.devicesCanExecuteHmr[device.id] = true;
198
- }
199
- currentSyncDeferPromise.resolve();
200
- }
201
- catch (e) {
202
- currentSyncDeferPromise.resolve();
203
- }
204
- })));
205
- });
206
- }
207
- getDeviceDisplayName(device) {
208
- return `${device.name} (${device.id})`.cyan;
209
- }
210
- getInitialFilesForDeviceSafe(data, device) {
211
- return __awaiter(this, void 0, void 0, function* () {
212
- const platform = device.platform;
213
- this.$logger.info(`Start sending initial files for device ${this.getDeviceDisplayName(device)}.`);
214
- try {
215
- const payloads = this.$previewAppFilesService.getInitialFilesPayload(data, platform);
216
- this.$logger.info(`Successfully sent initial files for device ${this.getDeviceDisplayName(device)}.`);
217
- return payloads;
218
- }
219
- catch (err) {
220
- this.$logger.warn(`Unable to apply changes for device ${this.getDeviceDisplayName(device)}. Error is: ${err}, ${(0, helpers_1.stringify)(err)}`);
221
- }
222
- });
223
- }
224
- syncFilesForPlatformSafe(data, filesData, platform, device) {
225
- return __awaiter(this, void 0, void 0, function* () {
226
- const deviceId = (device && device.id) || "";
227
- try {
228
- const payloads = this.$previewAppFilesService.getFilesPayload(data, filesData, platform);
229
- payloads.deviceId = deviceId;
230
- if (payloads && payloads.files && payloads.files.length) {
231
- this.$logger.info(`Start syncing changes for device ${this.getDeviceDisplayName(device)}.`);
232
- yield this.$previewSdkService.applyChanges(payloads);
233
- this.$logger.info(`Successfully synced '${payloads.files.map((filePayload) => filePayload.file.yellow)}' for device ${this.getDeviceDisplayName(device)}.`);
234
- }
235
- }
236
- catch (error) {
237
- this.$logger.warn(`Unable to apply changes for device ${this.getDeviceDisplayName(device)}. Error is: ${error}, ${JSON.stringify(error, null, 2)}.`);
238
- this.emit(preview_app_constants_1.PreviewAppLiveSyncEvents.PREVIEW_APP_LIVE_SYNC_ERROR, {
239
- error,
240
- data,
241
- deviceId,
242
- });
243
- }
244
- });
245
- }
246
- }
247
- __decorate([
248
- (0, decorators_1.performanceLog)()
249
- ], PreviewAppController.prototype, "handlePrepareReadyEvent", null);
250
- exports.PreviewAppController = PreviewAppController;
251
- yok_1.injector.register("previewAppController", PreviewAppController);
@@ -1,59 +0,0 @@
1
- /**
2
- * Describes the information for a company.
3
- */
4
- interface ICompanyData {
5
- /**
6
- * The name of the company.
7
- */
8
- name: string;
9
-
10
- /**
11
- * The country where the company is located.
12
- */
13
- country: string;
14
-
15
- /**
16
- * The revenue (stringified) of the company.
17
- */
18
- revenue: string;
19
-
20
- /**
21
- * The industries in which the company is determined to work.
22
- * NOTE: The single value contains multiple industries separated with __
23
- */
24
- industries: string;
25
-
26
- /**
27
- * Number of employees in the company (stringified).
28
- */
29
- employeeCount: string;
30
- }
31
-
32
- /**
33
- * Describes information about the company returned by the Playground's /api/insights endpoint.
34
- */
35
- interface IPlaygroundInsightsCompanyData {
36
- name: string;
37
- country: string;
38
- revenue: string;
39
- industries: string[];
40
- employeeCount: string;
41
- }
42
-
43
- /**
44
- * Describes the information returned by the Playground's /api/insights endpoint.
45
- */
46
- interface IPlaygroundInsightsEndpointData {
47
- company: IPlaygroundInsightsCompanyData;
48
- }
49
-
50
- /**
51
- * Describes the service that can be used to get insights about the company using the CLI.
52
- */
53
- interface ICompanyInsightsController {
54
- /**
55
- * Describes information about the company.
56
- * @returns {Promise<ICompanyData>}
57
- */
58
- getCompanyData(): Promise<ICompanyData>;
59
- }
@@ -1,8 +0,0 @@
1
- // Type definitions for email-validator 1.0.3
2
- // Project: https://github.com/Sembiance/email-validator
3
- // Definitions by: Paul Lessing <https://github.com/paullessing>
4
- // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
5
-
6
- declare module "email-validator" {
7
- export function validate(email: String): boolean;
8
- }
@@ -1,3 +0,0 @@
1
- declare module "libnpmconfig" {
2
- export function read(options?: Object): Object;
3
- }
@@ -1,12 +0,0 @@
1
- declare module "npm" {
2
- var cache: any;
3
- var commands: { [index: string]: any };
4
- var prefix: string;
5
- function load(config: Object, callback: (err: any, data: any) => void): void;
6
- module config {
7
- var loaded: boolean;
8
- module sources {
9
- var cli: { data: Object };
10
- }
11
- }
12
- }
@@ -1,116 +0,0 @@
1
- import { FilePayload, Device, FilesPayload } from "nativescript-preview-sdk";
2
- import { EventEmitter } from "events";
3
- import { IEnvOptions } from "../declarations";
4
- import {
5
- IProjectDir,
6
- IQrCodeImageData,
7
- IDictionary,
8
- } from "../common/declarations";
9
-
10
- declare global {
11
- interface IPreviewAppFilesService {
12
- getInitialFilesPayload(
13
- liveSyncData: IPreviewAppLiveSyncData,
14
- platform: string,
15
- deviceId?: string
16
- ): FilesPayload;
17
- getFilesPayload(
18
- liveSyncData: IPreviewAppLiveSyncData,
19
- filesData: IPreviewAppFilesData,
20
- platform: string,
21
- deviceId?: string
22
- ): FilesPayload;
23
- }
24
-
25
- interface IPreviewAppFilesData {
26
- filesToSync: string[];
27
- filesToRemove?: string[];
28
- }
29
-
30
- interface IPreviewAppLiveSyncData
31
- extends IProjectDir,
32
- IHasUseHotModuleReloadOption,
33
- IEnvOptions {}
34
-
35
- interface IPreviewSdkService {
36
- getQrCodeUrl(options: IGetQrCodeUrlOptions): string;
37
- initialize(
38
- projectDir: string,
39
- getInitialFiles: (device: Device) => Promise<FilesPayload>
40
- ): void;
41
- applyChanges(filesPayload: FilesPayload): Promise<void>;
42
- stop(): void;
43
- }
44
-
45
- interface IGetQrCodeUrlOptions
46
- extends IHasUseHotModuleReloadOption,
47
- IProjectDir {}
48
-
49
- interface IPreviewAppPluginsService {
50
- getPluginsUsageWarnings(
51
- data: IPreviewAppLiveSyncData,
52
- device: Device
53
- ): Promise<string[]>;
54
- comparePluginsOnDevice(
55
- data: IPreviewAppLiveSyncData,
56
- device: Device
57
- ): Promise<void>;
58
- getExternalPlugins(device: Device): string[];
59
- }
60
-
61
- interface IPreviewAppLogProvider extends EventEmitter {
62
- logData(log: string, deviceName: string, deviceId: string): void;
63
- }
64
-
65
- interface IPreviewQrCodeService {
66
- getPlaygroundAppQrCode(
67
- options?: IPlaygroundAppQrCodeOptions
68
- ): Promise<IDictionary<IQrCodeImageData>>;
69
- getLiveSyncQrCode(url: string): Promise<IQrCodeImageData>;
70
- printLiveSyncQrCode(options: IPrintLiveSyncOptions): Promise<void>;
71
- }
72
-
73
- interface IPlaygroundAppQrCodeOptions extends IProjectDir {
74
- platform?: string;
75
- }
76
-
77
- interface IPrintLiveSyncOptions extends IGetQrCodeUrlOptions {
78
- /**
79
- * If set to true, a link will be shown on console instead of QR code
80
- * Default value is false.
81
- */
82
- link: boolean;
83
- }
84
-
85
- interface IPreviewDevicesService extends EventEmitter {
86
- getConnectedDevices(): Device[];
87
- updateConnectedDevices(devices: Device[]): void;
88
- getDeviceById(id: string): Device;
89
- getDevicesForPlatform(platform: string): Device[];
90
- getPluginsUsageWarnings(
91
- data: IPreviewAppLiveSyncData,
92
- device: Device
93
- ): Promise<string[]>;
94
- }
95
-
96
- interface IPreviewSchemaService {
97
- getSchemaData(projectDir: string): IPreviewSchemaData;
98
- }
99
-
100
- interface IPreviewSchemaData {
101
- name: string;
102
- scannerAppId: string;
103
- scannerAppStoreId: string;
104
- previewAppId: string;
105
- previewAppStoreId: string;
106
- msvKey: string;
107
- publishKey: string;
108
- subscribeKey: string;
109
- default?: boolean;
110
- }
111
-
112
- interface IPreviewAppController {
113
- startPreview(data: IPreviewAppLiveSyncData): Promise<IQrCodeImageData>;
114
- stopPreview(data: IProjectDir): Promise<void>;
115
- }
116
- }
@@ -1,67 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PreviewDevicesService = void 0;
4
- const events_1 = require("events");
5
- const constants_1 = require("../../../../common/constants");
6
- const _ = require("lodash");
7
- const yok_1 = require("../../../../common/yok");
8
- class PreviewDevicesService extends events_1.EventEmitter {
9
- constructor($previewAppLogProvider, $previewAppPluginsService) {
10
- super();
11
- this.$previewAppLogProvider = $previewAppLogProvider;
12
- this.$previewAppPluginsService = $previewAppPluginsService;
13
- this.connectedDevices = [];
14
- this.deviceLostTimers = {};
15
- this.initialize();
16
- }
17
- getConnectedDevices() {
18
- return this.connectedDevices;
19
- }
20
- updateConnectedDevices(devices) {
21
- _(devices)
22
- .reject((d) => _.some(this.connectedDevices, (device) => d.id === device.id))
23
- .each((device) => this.raiseDeviceFound(device));
24
- _(this.connectedDevices)
25
- .reject((d) => _.some(devices, (device) => d.id === device.id))
26
- .each((device) => this.raiseDeviceLostAfterTimeout(device));
27
- }
28
- getDeviceById(id) {
29
- return _.find(this.connectedDevices, { id });
30
- }
31
- getDevicesForPlatform(platform) {
32
- return _.filter(this.connectedDevices, {
33
- platform: platform.toLowerCase(),
34
- });
35
- }
36
- getPluginsUsageWarnings(data, device) {
37
- return this.$previewAppPluginsService.getPluginsUsageWarnings(data, device);
38
- }
39
- initialize() {
40
- this.$previewAppLogProvider.on(constants_1.DEVICE_LOG_EVENT_NAME, (deviceId, message) => {
41
- this.emit(constants_1.DEVICE_LOG_EVENT_NAME, deviceId, message);
42
- });
43
- }
44
- raiseDeviceFound(device) {
45
- if (this.deviceLostTimers[device.id]) {
46
- clearTimeout(this.deviceLostTimers[device.id]);
47
- this.deviceLostTimers[device.id] = null;
48
- }
49
- this.emit(constants_1.DeviceDiscoveryEventNames.DEVICE_FOUND, device);
50
- this.connectedDevices.push(device);
51
- }
52
- raiseDeviceLost(device) {
53
- this.emit(constants_1.DeviceDiscoveryEventNames.DEVICE_LOST, device);
54
- _.remove(this.connectedDevices, (d) => d.id === device.id);
55
- }
56
- raiseDeviceLostAfterTimeout(device) {
57
- if (!this.deviceLostTimers[device.id]) {
58
- const timeoutId = setTimeout(() => {
59
- this.raiseDeviceLost(device);
60
- clearTimeout(timeoutId);
61
- }, 5 * 1000);
62
- this.deviceLostTimers[device.id] = timeoutId;
63
- }
64
- }
65
- }
66
- exports.PreviewDevicesService = PreviewDevicesService;
67
- yok_1.injector.register("previewDevicesService", PreviewDevicesService);
@@ -1,23 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PreviewAppLiveSyncEvents = exports.PluginComparisonMessages = exports.PubnubKeys = exports.PreviewSdkEventNames = void 0;
4
- class PreviewSdkEventNames {
5
- }
6
- exports.PreviewSdkEventNames = PreviewSdkEventNames;
7
- PreviewSdkEventNames.CHANGE_EVENT_NAME = "change";
8
- PreviewSdkEventNames.UNLINK_EVENT_NAME = "unlink";
9
- class PubnubKeys {
10
- }
11
- exports.PubnubKeys = PubnubKeys;
12
- PubnubKeys.PUBLISH_KEY = "pub-c-d7893276-cc78-4d18-8ab0-becba06e43de";
13
- PubnubKeys.SUBSCRIBE_KEY = "sub-c-3dad1ebe-aaa3-11e8-8027-363023237e0b";
14
- class PluginComparisonMessages {
15
- }
16
- exports.PluginComparisonMessages = PluginComparisonMessages;
17
- PluginComparisonMessages.PLUGIN_NOT_INCLUDED_IN_PREVIEW_APP = "Plugin %s is not included in preview app on device %s and will not work.";
18
- PluginComparisonMessages.LOCAL_PLUGIN_WITH_DIFFERENCE_IN_MAJOR_VERSION = "Local plugin %s differs in major version from plugin in preview app. The local plugin has version %s and the plugin in preview app has version %s. Some features might not work as expected.";
19
- PluginComparisonMessages.LOCAL_PLUGIN_WITH_GREATHER_MINOR_VERSION = "Local plugin %s differs in minor version from plugin in preview app. The local plugin has version %s and the plugin in preview app has version %s. Some features might not work as expected.";
20
- class PreviewAppLiveSyncEvents {
21
- }
22
- exports.PreviewAppLiveSyncEvents = PreviewAppLiveSyncEvents;
23
- PreviewAppLiveSyncEvents.PREVIEW_APP_LIVE_SYNC_ERROR = "previewAppLiveSyncError";