nativescript 9.1.0-alpha.1 → 9.1.0-alpha.10
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/commands/prepare.js +5 -0
- package/lib/common/definitions/mobile.d.ts +15 -10
- package/lib/common/mobile/android/android-emulator-services.js +11 -3
- package/lib/common/mobile/emulator-helper.js +1 -0
- package/lib/common/mobile/ios/device/ios-device-file-system.js +29 -1
- package/lib/controllers/prepare-controller.js +53 -11
- package/lib/controllers/run-controller.js +200 -13
- package/lib/data/prepare-data.js +4 -0
- package/lib/declarations.d.ts +38 -42
- package/lib/definitions/project.d.ts +16 -0
- package/lib/options.js +1 -0
- package/lib/services/android-plugin-build-service.js +20 -12
- package/lib/services/bundler/bundler-compiler-service.js +160 -2
- package/lib/services/ios/xcodebuild-args-service.js +26 -0
- package/lib/services/ios-project-service.js +28 -4
- package/lib/services/livesync/ios-livesync-service.js +113 -2
- package/lib/services/plugins-service.js +12 -4
- package/lib/services/project-data-service.js +14 -11
- package/node_modules/debug/LICENSE +20 -0
- package/node_modules/debug/README.md +481 -0
- package/node_modules/debug/package.json +64 -0
- package/node_modules/debug/src/browser.js +272 -0
- package/node_modules/debug/src/common.js +292 -0
- package/node_modules/debug/src/index.js +10 -0
- package/node_modules/debug/src/node.js +263 -0
- package/node_modules/ms/index.js +162 -0
- package/node_modules/ms/license.md +21 -0
- package/node_modules/ms/package.json +38 -0
- package/node_modules/ms/readme.md +59 -0
- package/node_modules/universal-analytics/.travis.yml +11 -0
- package/node_modules/universal-analytics/AcceptableParams.md +757 -0
- package/node_modules/universal-analytics/HISTORY.md +170 -0
- package/node_modules/universal-analytics/Makefile +5 -0
- package/node_modules/universal-analytics/README.md +651 -0
- package/node_modules/universal-analytics/index.js +2 -0
- package/node_modules/universal-analytics/lib/config.js +171 -0
- package/node_modules/universal-analytics/lib/index.js +563 -0
- package/node_modules/universal-analytics/lib/request.js +73 -0
- package/node_modules/universal-analytics/lib/utils.js +29 -0
- package/node_modules/universal-analytics/package.json +33 -0
- package/node_modules/universal-analytics/test/_enqueue.js +144 -0
- package/node_modules/universal-analytics/test/event.js +346 -0
- package/node_modules/universal-analytics/test/exception.js +233 -0
- package/node_modules/universal-analytics/test/index.js +141 -0
- package/node_modules/universal-analytics/test/item.js +550 -0
- package/node_modules/universal-analytics/test/middleware.js +119 -0
- package/node_modules/universal-analytics/test/mocha.opts +3 -0
- package/node_modules/universal-analytics/test/pageview.js +286 -0
- package/node_modules/universal-analytics/test/send.js +232 -0
- package/node_modules/universal-analytics/test/set.js +68 -0
- package/node_modules/universal-analytics/test/timing.js +363 -0
- package/node_modules/universal-analytics/test/transaction.js +371 -0
- package/node_modules/uuid/LICENSE.md +9 -0
- package/node_modules/uuid/README.md +510 -0
- package/node_modules/uuid/dist/cjs/index.d.ts +15 -0
- package/node_modules/uuid/dist/cjs/index.js +31 -0
- package/node_modules/uuid/dist/cjs/max.d.ts +2 -0
- package/node_modules/uuid/dist/cjs/max.js +3 -0
- package/node_modules/uuid/dist/cjs/md5.d.ts +4 -0
- package/node_modules/uuid/dist/cjs/md5.js +13 -0
- package/node_modules/uuid/dist/cjs/native.d.ts +6 -0
- package/node_modules/uuid/dist/cjs/native.js +4 -0
- package/node_modules/uuid/dist/cjs/nil.d.ts +2 -0
- package/node_modules/uuid/dist/cjs/nil.js +3 -0
- package/node_modules/uuid/dist/cjs/package.json +1 -0
- package/node_modules/uuid/dist/cjs/parse.d.ts +2 -0
- package/node_modules/uuid/dist/cjs/parse.js +11 -0
- package/node_modules/uuid/dist/cjs/regex.d.ts +2 -0
- package/node_modules/uuid/dist/cjs/regex.js +3 -0
- package/node_modules/uuid/dist/cjs/rng.d.ts +1 -0
- package/node_modules/uuid/dist/cjs/rng.js +13 -0
- package/node_modules/uuid/dist/cjs/sha1.d.ts +4 -0
- package/node_modules/uuid/dist/cjs/sha1.js +13 -0
- package/node_modules/uuid/dist/cjs/stringify.d.ts +3 -0
- package/node_modules/uuid/dist/cjs/stringify.js +39 -0
- package/node_modules/uuid/dist/cjs/types.d.ts +21 -0
- package/node_modules/uuid/dist/cjs/types.js +2 -0
- package/node_modules/uuid/dist/cjs/uuid-bin.d.ts +1 -0
- package/node_modules/uuid/dist/cjs/uuid-bin.js +72 -0
- package/node_modules/uuid/dist/cjs/v1.d.ts +11 -0
- package/node_modules/uuid/dist/cjs/v1.js +87 -0
- package/node_modules/uuid/dist/cjs/v1ToV6.d.ts +2 -0
- package/node_modules/uuid/dist/cjs/v1ToV6.js +13 -0
- package/node_modules/uuid/dist/cjs/v3.d.ts +9 -0
- package/node_modules/uuid/dist/cjs/v3.js +14 -0
- package/node_modules/uuid/dist/cjs/v35.d.ts +7 -0
- package/node_modules/uuid/dist/cjs/v35.js +41 -0
- package/node_modules/uuid/dist/cjs/v4.d.ts +4 -0
- package/node_modules/uuid/dist/cjs/v4.js +29 -0
- package/node_modules/uuid/dist/cjs/v5.d.ts +9 -0
- package/node_modules/uuid/dist/cjs/v5.js +14 -0
- package/node_modules/uuid/dist/cjs/v6.d.ts +4 -0
- package/node_modules/uuid/dist/cjs/v6.js +19 -0
- package/node_modules/uuid/dist/cjs/v6ToV1.d.ts +2 -0
- package/node_modules/uuid/dist/cjs/v6ToV1.js +13 -0
- package/node_modules/uuid/dist/cjs/v7.d.ts +9 -0
- package/node_modules/uuid/dist/cjs/v7.js +69 -0
- package/node_modules/uuid/dist/cjs/validate.d.ts +2 -0
- package/node_modules/uuid/dist/cjs/validate.js +7 -0
- package/node_modules/uuid/dist/cjs/version.d.ts +2 -0
- package/node_modules/uuid/dist/cjs/version.js +10 -0
- package/node_modules/uuid/dist/cjs-browser/index.d.ts +15 -0
- package/node_modules/uuid/dist/cjs-browser/index.js +31 -0
- package/node_modules/uuid/dist/cjs-browser/max.d.ts +2 -0
- package/node_modules/uuid/dist/cjs-browser/max.js +3 -0
- package/node_modules/uuid/dist/cjs-browser/md5.d.ts +2 -0
- package/node_modules/uuid/dist/cjs-browser/md5.js +137 -0
- package/node_modules/uuid/dist/cjs-browser/native.d.ts +4 -0
- package/node_modules/uuid/dist/cjs-browser/native.js +4 -0
- package/node_modules/uuid/dist/cjs-browser/nil.d.ts +2 -0
- package/node_modules/uuid/dist/cjs-browser/nil.js +3 -0
- package/node_modules/uuid/dist/cjs-browser/package.json +1 -0
- package/node_modules/uuid/dist/cjs-browser/parse.d.ts +2 -0
- package/node_modules/uuid/dist/cjs-browser/parse.js +11 -0
- package/node_modules/uuid/dist/cjs-browser/regex.d.ts +2 -0
- package/node_modules/uuid/dist/cjs-browser/regex.js +3 -0
- package/node_modules/uuid/dist/cjs-browser/rng.d.ts +1 -0
- package/node_modules/uuid/dist/cjs-browser/rng.js +14 -0
- package/node_modules/uuid/dist/cjs-browser/sha1.d.ts +2 -0
- package/node_modules/uuid/dist/cjs-browser/sha1.js +72 -0
- package/node_modules/uuid/dist/cjs-browser/stringify.d.ts +3 -0
- package/node_modules/uuid/dist/cjs-browser/stringify.js +39 -0
- package/node_modules/uuid/dist/cjs-browser/types.d.ts +21 -0
- package/node_modules/uuid/dist/cjs-browser/types.js +2 -0
- package/node_modules/uuid/dist/cjs-browser/uuid-bin.d.ts +1 -0
- package/node_modules/uuid/dist/cjs-browser/uuid-bin.js +72 -0
- package/node_modules/uuid/dist/cjs-browser/v1.d.ts +11 -0
- package/node_modules/uuid/dist/cjs-browser/v1.js +87 -0
- package/node_modules/uuid/dist/cjs-browser/v1ToV6.d.ts +2 -0
- package/node_modules/uuid/dist/cjs-browser/v1ToV6.js +13 -0
- package/node_modules/uuid/dist/cjs-browser/v3.d.ts +9 -0
- package/node_modules/uuid/dist/cjs-browser/v3.js +14 -0
- package/node_modules/uuid/dist/cjs-browser/v35.d.ts +7 -0
- package/node_modules/uuid/dist/cjs-browser/v35.js +41 -0
- package/node_modules/uuid/dist/cjs-browser/v4.d.ts +4 -0
- package/node_modules/uuid/dist/cjs-browser/v4.js +29 -0
- package/node_modules/uuid/dist/cjs-browser/v5.d.ts +9 -0
- package/node_modules/uuid/dist/cjs-browser/v5.js +14 -0
- package/node_modules/uuid/dist/cjs-browser/v6.d.ts +4 -0
- package/node_modules/uuid/dist/cjs-browser/v6.js +19 -0
- package/node_modules/uuid/dist/cjs-browser/v6ToV1.d.ts +2 -0
- package/node_modules/uuid/dist/cjs-browser/v6ToV1.js +13 -0
- package/node_modules/uuid/dist/cjs-browser/v7.d.ts +9 -0
- package/node_modules/uuid/dist/cjs-browser/v7.js +69 -0
- package/node_modules/uuid/dist/cjs-browser/validate.d.ts +2 -0
- package/node_modules/uuid/dist/cjs-browser/validate.js +7 -0
- package/node_modules/uuid/dist/cjs-browser/version.d.ts +2 -0
- package/node_modules/uuid/dist/cjs-browser/version.js +10 -0
- package/node_modules/uuid/dist/esm/bin/uuid +2 -0
- package/node_modules/uuid/dist/esm/index.d.ts +15 -0
- package/node_modules/uuid/dist/esm/index.js +14 -0
- package/node_modules/uuid/dist/esm/max.d.ts +2 -0
- package/node_modules/uuid/dist/esm/max.js +1 -0
- package/node_modules/uuid/dist/esm/md5.d.ts +4 -0
- package/node_modules/uuid/dist/esm/md5.js +11 -0
- package/node_modules/uuid/dist/esm/native.d.ts +6 -0
- package/node_modules/uuid/dist/esm/native.js +2 -0
- package/node_modules/uuid/dist/esm/nil.d.ts +2 -0
- package/node_modules/uuid/dist/esm/nil.js +1 -0
- package/node_modules/uuid/dist/esm/parse.d.ts +2 -0
- package/node_modules/uuid/dist/esm/parse.js +9 -0
- package/node_modules/uuid/dist/esm/regex.d.ts +2 -0
- package/node_modules/uuid/dist/esm/regex.js +1 -0
- package/node_modules/uuid/dist/esm/rng.d.ts +1 -0
- package/node_modules/uuid/dist/esm/rng.js +10 -0
- package/node_modules/uuid/dist/esm/sha1.d.ts +4 -0
- package/node_modules/uuid/dist/esm/sha1.js +11 -0
- package/node_modules/uuid/dist/esm/stringify.d.ts +3 -0
- package/node_modules/uuid/dist/esm/stringify.js +35 -0
- package/node_modules/uuid/dist/esm/types.d.ts +21 -0
- package/node_modules/uuid/dist/esm/types.js +1 -0
- package/node_modules/uuid/dist/esm/uuid-bin.d.ts +1 -0
- package/node_modules/uuid/dist/esm/uuid-bin.js +70 -0
- package/node_modules/uuid/dist/esm/v1.d.ts +11 -0
- package/node_modules/uuid/dist/esm/v1.js +83 -0
- package/node_modules/uuid/dist/esm/v1ToV6.d.ts +2 -0
- package/node_modules/uuid/dist/esm/v1ToV6.js +10 -0
- package/node_modules/uuid/dist/esm/v3.d.ts +9 -0
- package/node_modules/uuid/dist/esm/v3.js +9 -0
- package/node_modules/uuid/dist/esm/v35.d.ts +7 -0
- package/node_modules/uuid/dist/esm/v35.js +36 -0
- package/node_modules/uuid/dist/esm/v4.d.ts +4 -0
- package/node_modules/uuid/dist/esm/v4.js +27 -0
- package/node_modules/uuid/dist/esm/v5.d.ts +9 -0
- package/node_modules/uuid/dist/esm/v5.js +9 -0
- package/node_modules/uuid/dist/esm/v6.d.ts +4 -0
- package/node_modules/uuid/dist/esm/v6.js +17 -0
- package/node_modules/uuid/dist/esm/v6ToV1.d.ts +2 -0
- package/node_modules/uuid/dist/esm/v6ToV1.js +10 -0
- package/node_modules/uuid/dist/esm/v7.d.ts +9 -0
- package/node_modules/uuid/dist/esm/v7.js +65 -0
- package/node_modules/uuid/dist/esm/validate.d.ts +2 -0
- package/node_modules/uuid/dist/esm/validate.js +5 -0
- package/node_modules/uuid/dist/esm/version.d.ts +2 -0
- package/node_modules/uuid/dist/esm/version.js +8 -0
- package/node_modules/uuid/dist/esm-browser/index.d.ts +15 -0
- package/node_modules/uuid/dist/esm-browser/index.js +14 -0
- package/node_modules/uuid/dist/esm-browser/max.d.ts +2 -0
- package/node_modules/uuid/dist/esm-browser/max.js +1 -0
- package/node_modules/uuid/dist/esm-browser/md5.d.ts +2 -0
- package/node_modules/uuid/dist/esm-browser/md5.js +135 -0
- package/node_modules/uuid/dist/esm-browser/native.d.ts +4 -0
- package/node_modules/uuid/dist/esm-browser/native.js +2 -0
- package/node_modules/uuid/dist/esm-browser/nil.d.ts +2 -0
- package/node_modules/uuid/dist/esm-browser/nil.js +1 -0
- package/node_modules/uuid/dist/esm-browser/parse.d.ts +2 -0
- package/node_modules/uuid/dist/esm-browser/parse.js +9 -0
- package/node_modules/uuid/dist/esm-browser/regex.d.ts +2 -0
- package/node_modules/uuid/dist/esm-browser/regex.js +1 -0
- package/node_modules/uuid/dist/esm-browser/rng.d.ts +1 -0
- package/node_modules/uuid/dist/esm-browser/rng.js +11 -0
- package/node_modules/uuid/dist/esm-browser/sha1.d.ts +2 -0
- package/node_modules/uuid/dist/esm-browser/sha1.js +70 -0
- package/node_modules/uuid/dist/esm-browser/stringify.d.ts +3 -0
- package/node_modules/uuid/dist/esm-browser/stringify.js +35 -0
- package/node_modules/uuid/dist/esm-browser/types.d.ts +21 -0
- package/node_modules/uuid/dist/esm-browser/types.js +1 -0
- package/node_modules/uuid/dist/esm-browser/uuid-bin.d.ts +1 -0
- package/node_modules/uuid/dist/esm-browser/uuid-bin.js +70 -0
- package/node_modules/uuid/dist/esm-browser/v1.d.ts +11 -0
- package/node_modules/uuid/dist/esm-browser/v1.js +83 -0
- package/node_modules/uuid/dist/esm-browser/v1ToV6.d.ts +2 -0
- package/node_modules/uuid/dist/esm-browser/v1ToV6.js +10 -0
- package/node_modules/uuid/dist/esm-browser/v3.d.ts +9 -0
- package/node_modules/uuid/dist/esm-browser/v3.js +9 -0
- package/node_modules/uuid/dist/esm-browser/v35.d.ts +7 -0
- package/node_modules/uuid/dist/esm-browser/v35.js +36 -0
- package/node_modules/uuid/dist/esm-browser/v4.d.ts +4 -0
- package/node_modules/uuid/dist/esm-browser/v4.js +27 -0
- package/node_modules/uuid/dist/esm-browser/v5.d.ts +9 -0
- package/node_modules/uuid/dist/esm-browser/v5.js +9 -0
- package/node_modules/uuid/dist/esm-browser/v6.d.ts +4 -0
- package/node_modules/uuid/dist/esm-browser/v6.js +17 -0
- package/node_modules/uuid/dist/esm-browser/v6ToV1.d.ts +2 -0
- package/node_modules/uuid/dist/esm-browser/v6ToV1.js +10 -0
- package/node_modules/uuid/dist/esm-browser/v7.d.ts +9 -0
- package/node_modules/uuid/dist/esm-browser/v7.js +65 -0
- package/node_modules/uuid/dist/esm-browser/validate.d.ts +2 -0
- package/node_modules/uuid/dist/esm-browser/validate.js +5 -0
- package/node_modules/uuid/dist/esm-browser/version.d.ts +2 -0
- package/node_modules/uuid/dist/esm-browser/version.js +8 -0
- package/node_modules/uuid/package.json +132 -0
- package/package.json +8 -4
package/lib/commands/prepare.js
CHANGED
|
@@ -22,6 +22,11 @@ class PrepareCommand extends command_base_1.ValidatePlatformCommandBase {
|
|
|
22
22
|
hasSensitiveValue: false,
|
|
23
23
|
},
|
|
24
24
|
hmr: { type: "boolean" /* OptionType.Boolean */, default: false, hasSensitiveValue: false },
|
|
25
|
+
skipNative: {
|
|
26
|
+
type: "boolean" /* OptionType.Boolean */,
|
|
27
|
+
default: false,
|
|
28
|
+
hasSensitiveValue: false,
|
|
29
|
+
},
|
|
25
30
|
whatever: {
|
|
26
31
|
type: "boolean" /* OptionType.Boolean */,
|
|
27
32
|
default: false,
|
|
@@ -258,8 +258,7 @@ declare global {
|
|
|
258
258
|
* Describes different options for filtering device logs.
|
|
259
259
|
*/
|
|
260
260
|
interface IDeviceLogOptions
|
|
261
|
-
extends IDictionary<string | boolean>,
|
|
262
|
-
Partial<IProjectDir> {
|
|
261
|
+
extends IDictionary<string | boolean>, Partial<IProjectDir> {
|
|
263
262
|
/**
|
|
264
263
|
* Process id of the application on the device.
|
|
265
264
|
*/
|
|
@@ -284,8 +283,7 @@ declare global {
|
|
|
284
283
|
* Describes required methods for getting iOS Simulator's logs.
|
|
285
284
|
*/
|
|
286
285
|
interface IiOSSimulatorLogProvider
|
|
287
|
-
extends NodeJS.EventEmitter,
|
|
288
|
-
IShouldDispose {
|
|
286
|
+
extends NodeJS.EventEmitter, IShouldDispose {
|
|
289
287
|
/**
|
|
290
288
|
* Starts the process for getting simulator logs and emits and DEVICE_LOG_EVENT_NAME event.
|
|
291
289
|
* @param {string} deviceId The unique identifier of the device.
|
|
@@ -429,6 +427,16 @@ declare global {
|
|
|
429
427
|
|
|
430
428
|
interface IDeviceFileSystem {
|
|
431
429
|
listFiles(devicePath: string, appIdentifier?: string): Promise<any>;
|
|
430
|
+
/**
|
|
431
|
+
* Returns the entries of a directory inside the application's
|
|
432
|
+
* sandbox, or null when the directory cannot be read. Currently
|
|
433
|
+
* implemented only for physical iOS devices (AFC), where it backs
|
|
434
|
+
* the post-transfer livesync verification.
|
|
435
|
+
*/
|
|
436
|
+
getDirectoryEntries?(
|
|
437
|
+
devicePath: string,
|
|
438
|
+
appIdentifier: string,
|
|
439
|
+
): Promise<string[] | null>;
|
|
432
440
|
getFile(
|
|
433
441
|
deviceFilePath: string,
|
|
434
442
|
appIdentifier: string,
|
|
@@ -533,8 +541,7 @@ declare global {
|
|
|
533
541
|
/**
|
|
534
542
|
* Describes options that can be passed to devices service's initialization method.
|
|
535
543
|
*/
|
|
536
|
-
interface IDevicesServicesInitializationOptions
|
|
537
|
-
extends Partial<IDeviceLookingOptions> {
|
|
544
|
+
interface IDevicesServicesInitializationOptions extends Partial<IDeviceLookingOptions> {
|
|
538
545
|
/**
|
|
539
546
|
* If passed will start an emulator if necesasry.
|
|
540
547
|
*/
|
|
@@ -1261,8 +1268,7 @@ declare global {
|
|
|
1261
1268
|
}
|
|
1262
1269
|
|
|
1263
1270
|
interface IDeviceLookingOptions
|
|
1264
|
-
extends IHasEmulatorOption,
|
|
1265
|
-
IHasDetectionInterval {
|
|
1271
|
+
extends IHasEmulatorOption, IHasDetectionInterval {
|
|
1266
1272
|
shouldReturnImmediateResult: boolean;
|
|
1267
1273
|
platform: string;
|
|
1268
1274
|
fullDiscovery?: boolean;
|
|
@@ -1388,8 +1394,7 @@ declare global {
|
|
|
1388
1394
|
/**
|
|
1389
1395
|
* Describes information about application on device.
|
|
1390
1396
|
*/
|
|
1391
|
-
interface IDeviceApplicationInformation
|
|
1392
|
-
extends IDeviceApplicationInformationBase {
|
|
1397
|
+
interface IDeviceApplicationInformation extends IDeviceApplicationInformationBase {
|
|
1393
1398
|
/**
|
|
1394
1399
|
* The framework of the project (Cordova or NativeScript).
|
|
1395
1400
|
*/
|
|
@@ -9,7 +9,7 @@ const constants_2 = require("../../../constants");
|
|
|
9
9
|
const yok_1 = require("../../yok");
|
|
10
10
|
const semver = require("semver");
|
|
11
11
|
class AndroidEmulatorServices {
|
|
12
|
-
constructor($androidGenymotionService, $androidVirtualDeviceService, $adb, $childProcess, $emulatorHelper, $logger, $utils) {
|
|
12
|
+
constructor($androidGenymotionService, $androidVirtualDeviceService, $adb, $childProcess, $emulatorHelper, $logger, $utils, $userSettingsService) {
|
|
13
13
|
this.$androidGenymotionService = $androidGenymotionService;
|
|
14
14
|
this.$androidVirtualDeviceService = $androidVirtualDeviceService;
|
|
15
15
|
this.$adb = $adb;
|
|
@@ -17,6 +17,7 @@ class AndroidEmulatorServices {
|
|
|
17
17
|
this.$emulatorHelper = $emulatorHelper;
|
|
18
18
|
this.$logger = $logger;
|
|
19
19
|
this.$utils = $utils;
|
|
20
|
+
this.$userSettingsService = $userSettingsService;
|
|
20
21
|
}
|
|
21
22
|
async getEmulatorImages() {
|
|
22
23
|
const adbDevicesOutput = await this.$adb.getDevicesSafe();
|
|
@@ -90,7 +91,7 @@ class AndroidEmulatorServices {
|
|
|
90
91
|
endTimeEpoch,
|
|
91
92
|
};
|
|
92
93
|
}
|
|
93
|
-
this.spawnEmulator(emulator);
|
|
94
|
+
await this.spawnEmulator(emulator);
|
|
94
95
|
const isInfiniteWait = this.$utils.getMilliSecondsTimeout(timeout) === 0;
|
|
95
96
|
let hasTimeLeft = (0, helpers_1.getCurrentEpochTime)() < endTimeEpoch;
|
|
96
97
|
while (hasTimeLeft || isInfiniteWait) {
|
|
@@ -114,13 +115,20 @@ class AndroidEmulatorServices {
|
|
|
114
115
|
};
|
|
115
116
|
}
|
|
116
117
|
}
|
|
117
|
-
spawnEmulator(emulator) {
|
|
118
|
+
async spawnEmulator(emulator) {
|
|
118
119
|
let pathToEmulatorExecutable = null;
|
|
119
120
|
let startEmulatorArgs = null;
|
|
120
121
|
if (emulator.vendor === constants_1.AndroidVirtualDevice.AVD_VENDOR_NAME) {
|
|
121
122
|
pathToEmulatorExecutable =
|
|
122
123
|
this.$androidVirtualDeviceService.pathToEmulatorExecutable;
|
|
123
124
|
startEmulatorArgs = this.$androidVirtualDeviceService.startEmulatorArgs(emulator.imageIdentifier);
|
|
125
|
+
try {
|
|
126
|
+
const additionalArgs = await this.$userSettingsService.getSettingValue("androidEmulatorStartArgs");
|
|
127
|
+
if (additionalArgs === null || additionalArgs === void 0 ? void 0 : additionalArgs.length) {
|
|
128
|
+
startEmulatorArgs.push(...additionalArgs);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
catch (error) { }
|
|
124
132
|
}
|
|
125
133
|
else if (emulator.vendor === constants_1.AndroidVirtualDevice.GENYMOTION_VENDOR_NAME) {
|
|
126
134
|
pathToEmulatorExecutable =
|
|
@@ -9,6 +9,7 @@ class EmulatorHelper {
|
|
|
9
9
|
// https://developer.android.com/guide/topics/manifest/uses-sdk-element
|
|
10
10
|
this.mapAndroidApiLevelToVersion = {
|
|
11
11
|
"android-36": "16.0.0",
|
|
12
|
+
"android-36.1": "16.0.0",
|
|
12
13
|
"android-35": "15.0.0",
|
|
13
14
|
"android-34": "14.0.0",
|
|
14
15
|
"android-33": "13.0.0",
|
|
@@ -23,6 +23,24 @@ class IOSDeviceFileSystem {
|
|
|
23
23
|
children = result[deviceIdentifier][0].response;
|
|
24
24
|
this.$logger.info(children.join(os_1.EOL));
|
|
25
25
|
}
|
|
26
|
+
async getDirectoryEntries(devicePath, appIdentifier) {
|
|
27
|
+
var _a, _b;
|
|
28
|
+
try {
|
|
29
|
+
const result = await this.$iosDeviceOperations.listDirectory([
|
|
30
|
+
{
|
|
31
|
+
deviceId: this.device.deviceInfo.identifier,
|
|
32
|
+
path: devicePath,
|
|
33
|
+
appId: appIdentifier,
|
|
34
|
+
},
|
|
35
|
+
]);
|
|
36
|
+
const entries = (_b = (_a = result === null || result === void 0 ? void 0 : result[this.device.deviceInfo.identifier]) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.response;
|
|
37
|
+
return Array.isArray(entries) ? entries : null;
|
|
38
|
+
}
|
|
39
|
+
catch (err) {
|
|
40
|
+
this.$logger.trace(`Unable to list directory '${devicePath}' for application ${appIdentifier}: ${err.message}`);
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
26
44
|
async getFile(deviceFilePath, appIdentifier, outputFilePath) {
|
|
27
45
|
if (outputFilePath) {
|
|
28
46
|
await this.$iosDeviceOperations.downloadFiles([
|
|
@@ -96,9 +114,19 @@ class IOSDeviceFileSystem {
|
|
|
96
114
|
}
|
|
97
115
|
async uploadFilesCore(filesToUpload) {
|
|
98
116
|
await this.$iosDeviceOperations.uploadFiles(filesToUpload, (err) => {
|
|
99
|
-
|
|
117
|
+
// Previously an error whose deviceId did not exactly match was
|
|
118
|
+
// dropped on the floor — including errors with NO deviceId at
|
|
119
|
+
// all (some ios-device-lib error paths don't attribute one).
|
|
120
|
+
// That left "Successfully synced" printed over a failed
|
|
121
|
+
// transfer and the app silently running stale JavaScript.
|
|
122
|
+
// Rethrow unless the error is positively attributed to a
|
|
123
|
+
// DIFFERENT device; surface even those at warn level so a
|
|
124
|
+
// failed upload is never invisible.
|
|
125
|
+
if (!err.deviceId ||
|
|
126
|
+
err.deviceId === this.device.deviceInfo.identifier) {
|
|
100
127
|
throw err;
|
|
101
128
|
}
|
|
129
|
+
this.$logger.warn(`File upload error reported for another device (${err.deviceId}): ${err.message}`);
|
|
102
130
|
});
|
|
103
131
|
}
|
|
104
132
|
}
|
|
@@ -15,6 +15,7 @@ const decorators_1 = require("../common/decorators");
|
|
|
15
15
|
const helpers_1 = require("../common/helpers");
|
|
16
16
|
const yok_1 = require("../common/yok");
|
|
17
17
|
const constants_1 = require("../constants");
|
|
18
|
+
const resolve_package_path_1 = require("@rigor789/resolve-package-path");
|
|
18
19
|
class PrepareController extends events_1.EventEmitter {
|
|
19
20
|
constructor($platformController, $hooksService, $fs, $logger, $options, $mobileHelper, $nodeModulesDependenciesBuilder, $platformsDataService, $pluginsService, $prepareNativePlatformService, $projectChangesService, $projectDataService, $bundlerCompilerService, $watchIgnoreListService, $analyticsService, $markingModeService, $projectConfigService, $projectService) {
|
|
20
21
|
super();
|
|
@@ -229,28 +230,69 @@ class PrepareController extends events_1.EventEmitter {
|
|
|
229
230
|
* TODO: move this logic to the webpack side of things - WIP and deprecate here with a webpack version check...
|
|
230
231
|
*/
|
|
231
232
|
async writeRuntimePackageJson(projectData, platformData, prepareData = null) {
|
|
233
|
+
var _a, _b, _c, _d, _e;
|
|
232
234
|
const configInfo = this.$projectConfigService.detectProjectConfigs(projectData.projectDir);
|
|
233
235
|
if (configInfo.usingNSConfig) {
|
|
234
236
|
return;
|
|
235
237
|
}
|
|
236
238
|
this.$logger.info("Updating runtime package.json with configuration values...");
|
|
237
|
-
|
|
239
|
+
// Tolerate a missing/unreadable config — prior to the destructure this
|
|
240
|
+
// was a plain object spread, where `undefined` is a legal no-op.
|
|
241
|
+
const { hooks, ignoredNativeDependencies, webpackPackageName, webpackConfigPath, appResourcesPath, buildPath, appPath, ...nsConfig } = (_a = this.$projectConfigService.readConfig(projectData.projectDir)) !== null && _a !== void 0 ? _a : {};
|
|
242
|
+
const platform = platformData.platformNameLowerCase;
|
|
243
|
+
let installedRuntimePackageJSON;
|
|
244
|
+
let runtimePackageName;
|
|
245
|
+
if (platform === "ios" /* PlatformTypes.ios */) {
|
|
246
|
+
runtimePackageName =
|
|
247
|
+
((_c = (_b = projectData.nsConfig) === null || _b === void 0 ? void 0 : _b.ios) === null || _c === void 0 ? void 0 : _c.runtimePackageName) ||
|
|
248
|
+
constants_1.SCOPED_IOS_RUNTIME_NAME;
|
|
249
|
+
}
|
|
250
|
+
else if (platform === "android" /* PlatformTypes.android */) {
|
|
251
|
+
runtimePackageName =
|
|
252
|
+
((_e = (_d = projectData.nsConfig) === null || _d === void 0 ? void 0 : _d.android) === null || _e === void 0 ? void 0 : _e.runtimePackageName) ||
|
|
253
|
+
constants_1.SCOPED_ANDROID_RUNTIME_NAME;
|
|
254
|
+
}
|
|
255
|
+
// try reading from installed runtime first before reading from the npm registry...
|
|
256
|
+
const installedRuntimePackageJSONPath = (0, resolve_package_path_1.resolvePackageJSONPath)(runtimePackageName, {
|
|
257
|
+
paths: [projectData.projectDir],
|
|
258
|
+
});
|
|
259
|
+
if (installedRuntimePackageJSONPath) {
|
|
260
|
+
installedRuntimePackageJSON = this.$fs.readJson(installedRuntimePackageJSONPath);
|
|
261
|
+
}
|
|
238
262
|
const packageData = {
|
|
239
263
|
..._.pick(projectData.packageJsonData, ["name"]),
|
|
240
264
|
...nsConfig,
|
|
241
265
|
main: "bundle",
|
|
266
|
+
...(installedRuntimePackageJSON ? {} : {}),
|
|
242
267
|
};
|
|
243
|
-
if (
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
268
|
+
if (platform === "ios" /* PlatformTypes.ios */) {
|
|
269
|
+
if (installedRuntimePackageJSON) {
|
|
270
|
+
packageData.ios = packageData.ios || {};
|
|
271
|
+
packageData.ios.runtime = {
|
|
272
|
+
version: installedRuntimePackageJSON.version,
|
|
273
|
+
};
|
|
274
|
+
}
|
|
275
|
+
if (packageData.ios && packageData.ios.discardUncaughtJsExceptions) {
|
|
276
|
+
packageData.discardUncaughtJsExceptions =
|
|
277
|
+
packageData.ios.discardUncaughtJsExceptions;
|
|
278
|
+
}
|
|
279
|
+
delete packageData.android;
|
|
248
280
|
}
|
|
249
|
-
if (
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
281
|
+
if (platform === "android" /* PlatformTypes.android */) {
|
|
282
|
+
if (installedRuntimePackageJSON) {
|
|
283
|
+
packageData.android = packageData.android || {};
|
|
284
|
+
packageData.android.runtime = {
|
|
285
|
+
version: installedRuntimePackageJSON.version,
|
|
286
|
+
version_info: installedRuntimePackageJSON.version_info,
|
|
287
|
+
gradle: installedRuntimePackageJSON.gradle,
|
|
288
|
+
};
|
|
289
|
+
}
|
|
290
|
+
if (packageData.android &&
|
|
291
|
+
packageData.android.discardUncaughtJsExceptions) {
|
|
292
|
+
packageData.discardUncaughtJsExceptions =
|
|
293
|
+
packageData.android.discardUncaughtJsExceptions;
|
|
294
|
+
}
|
|
295
|
+
delete packageData.ios;
|
|
254
296
|
}
|
|
255
297
|
let packagePath;
|
|
256
298
|
if (this.$mobileHelper.isApplePlatform(platformData.platformNameLowerCase)) {
|
|
@@ -15,7 +15,7 @@ const util = require("util");
|
|
|
15
15
|
const _ = require("lodash");
|
|
16
16
|
const yok_1 = require("../common/yok");
|
|
17
17
|
class RunController extends events_1.EventEmitter {
|
|
18
|
-
constructor($analyticsService, $buildController, $debugController, $deviceInstallAppService, $devicesService, $errors, $injector, $hmrStatusService, $hooksService, $liveSyncServiceResolver, $liveSyncProcessDataService, $logger, $mobileHelper, $platformsDataService, $pluginsService, $prepareController, $prepareDataService, $prepareNativePlatformService, $projectChangesService, $projectDataService) {
|
|
18
|
+
constructor($analyticsService, $buildController, $debugController, $deviceInstallAppService, $devicesService, $errors, $injector, $hmrStatusService, $hooksService, $liveSyncServiceResolver, $liveSyncProcessDataService, $logger, $mobileHelper, $platformsDataService, $pluginsService, $prepareController, $prepareDataService, $prepareNativePlatformService, $projectChangesService, $projectDataService, $staticConfig) {
|
|
19
19
|
super();
|
|
20
20
|
this.$analyticsService = $analyticsService;
|
|
21
21
|
this.$buildController = $buildController;
|
|
@@ -37,7 +37,10 @@ class RunController extends events_1.EventEmitter {
|
|
|
37
37
|
this.$prepareNativePlatformService = $prepareNativePlatformService;
|
|
38
38
|
this.$projectChangesService = $projectChangesService;
|
|
39
39
|
this.$projectDataService = $projectDataService;
|
|
40
|
+
this.$staticConfig = $staticConfig;
|
|
40
41
|
this.prepareReadyEventHandler = null;
|
|
42
|
+
this._syncInProgress = false;
|
|
43
|
+
this._pendingSyncs = new Map();
|
|
41
44
|
}
|
|
42
45
|
async run(runData) {
|
|
43
46
|
const { liveSyncInfo, deviceDescriptors } = runData;
|
|
@@ -60,13 +63,11 @@ class RunController extends events_1.EventEmitter {
|
|
|
60
63
|
const platformData = this.$platformsDataService.getPlatformData(data.platform, projectData);
|
|
61
64
|
const prepareData = this.$prepareDataService.getPrepareData(liveSyncInfo.projectDir, data.platform, { ...liveSyncInfo, watch: !liveSyncInfo.skipWatcher });
|
|
62
65
|
const changesInfo = await this.$projectChangesService.checkForChanges(platformData, projectData, prepareData);
|
|
63
|
-
if (changesInfo.hasChanges) {
|
|
64
|
-
|
|
66
|
+
if (!changesInfo.hasChanges) {
|
|
67
|
+
return;
|
|
65
68
|
}
|
|
66
69
|
}
|
|
67
|
-
|
|
68
|
-
await this.syncChangedDataOnDevices(data, projectData, liveSyncInfo);
|
|
69
|
-
}
|
|
70
|
+
this.scheduleSyncOnDevices(data, projectData, liveSyncInfo);
|
|
70
71
|
};
|
|
71
72
|
this.prepareReadyEventHandler = handler.bind(this);
|
|
72
73
|
this.$prepareController.on(constants_2.PREPARE_READY_EVENT_NAME, this.prepareReadyEventHandler);
|
|
@@ -277,6 +278,14 @@ class RunController extends events_1.EventEmitter {
|
|
|
277
278
|
},
|
|
278
279
|
watch: !liveSyncInfo.skipWatcher,
|
|
279
280
|
});
|
|
281
|
+
// For Android + Vite HMR, own the `adb reverse` ourselves —
|
|
282
|
+
// with our SDK-resolved adb, scoped to this exact serial, and
|
|
283
|
+
// only after the device is up — then hand the bundler the
|
|
284
|
+
// result via env vars. This MUST run before `prepare` (which
|
|
285
|
+
// spawns the Vite bundler that inherits `process.env`) so the
|
|
286
|
+
// bundler trusts the tunnel instead of racing us to spawn its
|
|
287
|
+
// own adb during config-load. See packages/vite hardening.
|
|
288
|
+
await this.setupAndroidViteHmrReverse(device, projectData, liveSyncInfo, "pre-build");
|
|
280
289
|
const prepareResultData = await this.$prepareController.prepare(prepareData);
|
|
281
290
|
const buildData = {
|
|
282
291
|
...deviceDescriptor.buildData,
|
|
@@ -327,6 +336,11 @@ class RunController extends events_1.EventEmitter {
|
|
|
327
336
|
watch: !skipWatcher,
|
|
328
337
|
liveSyncDeviceData: deviceDescriptor,
|
|
329
338
|
});
|
|
339
|
+
// Re-establish the adb reverse on the CURRENT transport right
|
|
340
|
+
// before launch — the transport can change during build/install
|
|
341
|
+
// and drop the mapping set in `pre-build`, which would leave the
|
|
342
|
+
// app unable to reach the Vite dev server at 127.0.0.1.
|
|
343
|
+
await this.setupAndroidViteHmrReverse(device, projectData, liveSyncInfo, "pre-launch");
|
|
330
344
|
await this.refreshApplication(projectData, liveSyncResultInfo, null, deviceDescriptor);
|
|
331
345
|
this.$logger.info(`Successfully synced application ${liveSyncResultInfo.deviceAppData.appIdentifier} on device ${liveSyncResultInfo.deviceAppData.device.deviceInfo.identifier}.`);
|
|
332
346
|
this.emitCore(constants_2.RunOnDeviceEvents.runOnDeviceStarted, {
|
|
@@ -353,6 +367,134 @@ class RunController extends events_1.EventEmitter {
|
|
|
353
367
|
};
|
|
354
368
|
await this.addActionToChain(projectData.projectDir, () => this.$devicesService.execute(deviceAction, (device) => _.some(deviceDescriptors, (deviceDescriptor) => deviceDescriptor.identifier === device.deviceInfo.identifier)));
|
|
355
369
|
}
|
|
370
|
+
/**
|
|
371
|
+
* Set up `adb reverse tcp:<port> tcp:<port>` for an Android device
|
|
372
|
+
* when the project bundles with Vite in HMR/watch mode, then export
|
|
373
|
+
* the result to the bundler subprocess via environment variables.
|
|
374
|
+
*
|
|
375
|
+
* The Vite dev-host helper prefers an ADB tunnel (device-side
|
|
376
|
+
* `127.0.0.1:<port>` → host) over the emulator's flaky slirp NAT
|
|
377
|
+
* (`10.0.2.2`). Historically the bundler tried to wire that tunnel
|
|
378
|
+
* itself at config-load time, racing this CLI's device discovery
|
|
379
|
+
* over the single global adb daemon and intermittently freezing the
|
|
380
|
+
* run at "Searching for devices…". The CLI is the right owner: it
|
|
381
|
+
* knows the exact target serial and when the device is ready, and it
|
|
382
|
+
* already drives a single, version-matched adb. We do the reverse
|
|
383
|
+
* here and signal the bundler with `NS_ADB_REVERSE_READY=1` so it
|
|
384
|
+
* never spawns adb on its own.
|
|
385
|
+
*
|
|
386
|
+
* Best-effort: any failure is logged at trace level and swallowed.
|
|
387
|
+
* The bundler then falls back to its own (now hardened) adb path, or
|
|
388
|
+
* ultimately to `10.0.2.2`, so a reverse hiccup never fails the run.
|
|
389
|
+
*/
|
|
390
|
+
async setupAndroidViteHmrReverse(device, projectData, liveSyncInfo, phase) {
|
|
391
|
+
try {
|
|
392
|
+
if (!this.$mobileHelper.isAndroidPlatform(device.deviceInfo.platform)) {
|
|
393
|
+
return;
|
|
394
|
+
}
|
|
395
|
+
if (projectData.bundler !== "vite") {
|
|
396
|
+
return;
|
|
397
|
+
}
|
|
398
|
+
// HMR over the tunnel only matters for a live watch session.
|
|
399
|
+
if (liveSyncInfo.skipWatcher || !liveSyncInfo.useHotModuleReload) {
|
|
400
|
+
return;
|
|
401
|
+
}
|
|
402
|
+
// Respect the user's explicit opt-out — they want the
|
|
403
|
+
// `10.0.2.2` / LAN path, so don't create a tunnel or claim one
|
|
404
|
+
// exists.
|
|
405
|
+
if (this.isTruthyEnvFlag(process.env.NS_HMR_NO_ADB_REVERSE)) {
|
|
406
|
+
return;
|
|
407
|
+
}
|
|
408
|
+
// `NS_HMR_PREFER_LAN_HOST` means the dev wants LAN routing
|
|
409
|
+
// (physical device over Wi-Fi); the dev-host resolver suppresses
|
|
410
|
+
// the adb-reverse path for it, so don't bother wiring one.
|
|
411
|
+
if (this.isTruthyEnvFlag(process.env.NS_HMR_PREFER_LAN_HOST)) {
|
|
412
|
+
return;
|
|
413
|
+
}
|
|
414
|
+
const serial = device.deviceInfo.identifier;
|
|
415
|
+
const port = this.getViteHmrPort();
|
|
416
|
+
if (phase === "pre-build") {
|
|
417
|
+
// Decide the origin baked into bundle.mjs. Hand the bundler our
|
|
418
|
+
// exact adb (so any self-managed fallback can't version-mismatch
|
|
419
|
+
// the daemon) and, if the tunnel comes up, tell it to emit
|
|
420
|
+
// `127.0.0.1` and skip adb entirely.
|
|
421
|
+
process.env.NS_ADB_PATH = await this.$staticConfig.getAdbFilePath();
|
|
422
|
+
process.env.NS_DEVICE_SERIAL = serial;
|
|
423
|
+
const ok = await this.ensureAndroidReverse(device, serial, port);
|
|
424
|
+
if (ok) {
|
|
425
|
+
process.env.NS_ADB_REVERSE_READY = "1";
|
|
426
|
+
this.$logger.info(`Set up adb reverse tcp:${port} tcp:${port} for ${serial} (Vite HMR routes device-side 127.0.0.1:${port} through ADB).`);
|
|
427
|
+
}
|
|
428
|
+
else {
|
|
429
|
+
this.$logger.warn(`Could not confirm 'adb reverse tcp:${port}' on ${serial} (device adbd slow/unresponsive). Vite HMR will fall back to 10.0.2.2. If this persists, cold-boot/wipe the emulator, or set NS_HMR_NO_ADB_REVERSE=1.`);
|
|
430
|
+
}
|
|
431
|
+
return;
|
|
432
|
+
}
|
|
433
|
+
// phase === "pre-launch": re-establish the mapping right before the
|
|
434
|
+
// app boots. `adb reverse` mappings are bound to the device's adb
|
|
435
|
+
// transport, and that transport can change during the (long) build
|
|
436
|
+
// + install (fresh emulators reconnect as they settle), silently
|
|
437
|
+
// dropping the early mapping. We only bother when we actually told
|
|
438
|
+
// the bundle to use `127.0.0.1` (READY set during pre-build).
|
|
439
|
+
if (!this.isTruthyEnvFlag(process.env.NS_ADB_REVERSE_READY)) {
|
|
440
|
+
return;
|
|
441
|
+
}
|
|
442
|
+
const ok = await this.ensureAndroidReverse(device, serial, port);
|
|
443
|
+
if (!ok) {
|
|
444
|
+
this.$logger.warn(`adb reverse tcp:${port} was not active before launch on ${serial}; the app may fail to reach the Vite dev server at 127.0.0.1:${port}.`);
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
catch (err) {
|
|
448
|
+
this.$logger.trace(`Setting up adb reverse for Vite HMR (${phase}) failed; leaving it to the bundler fallback. Error: ${err}`);
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
/**
|
|
452
|
+
* Apply `adb reverse tcp:<port> tcp:<port>` to the device and confirm
|
|
453
|
+
* via `adb reverse --list` that it actually landed, retrying a few
|
|
454
|
+
* times. Every device-side call is bounded with a Node `spawn` timeout
|
|
455
|
+
* + `SIGKILL` so a wedged/slow adbd (observed blocking 90s+ on some
|
|
456
|
+
* fresh-boot / API-36 arm64 emulators) can never hang the run — the
|
|
457
|
+
* hung adb child is reaped, not orphaned. Returns whether the mapping
|
|
458
|
+
* is confirmed present.
|
|
459
|
+
*/
|
|
460
|
+
async ensureAndroidReverse(device, serial, port) {
|
|
461
|
+
var _a, _b, _c;
|
|
462
|
+
const adb = device.adb;
|
|
463
|
+
const ADB_WAIT_MS = 15000;
|
|
464
|
+
const ADB_REVERSE_MS = 20000;
|
|
465
|
+
const bounded = (timeout) => ({
|
|
466
|
+
deviceIdentifier: serial,
|
|
467
|
+
treatErrorsAsWarnings: true,
|
|
468
|
+
childProcessOptions: { timeout, killSignal: "SIGKILL" },
|
|
469
|
+
});
|
|
470
|
+
// `wait-for-device` only blocks until the transport is up; bounded so a
|
|
471
|
+
// never-ready device can't stall us.
|
|
472
|
+
await adb.executeCommand(["wait-for-device"], bounded(ADB_WAIT_MS));
|
|
473
|
+
for (let attempt = 1; attempt <= 3; attempt++) {
|
|
474
|
+
await adb.executeCommand(["reverse", `tcp:${port}`, `tcp:${port}`], bounded(ADB_REVERSE_MS));
|
|
475
|
+
// Verify it landed (a SIGKILL'd-on-timeout reverse resolves rather
|
|
476
|
+
// than throws, so success of the call isn't proof).
|
|
477
|
+
const list = (_c = (_b = (_a = (await adb.executeCommand(["reverse", "--list"], bounded(ADB_WAIT_MS)))) === null || _a === void 0 ? void 0 : _a.toString) === null || _b === void 0 ? void 0 : _b.call(_a)) !== null && _c !== void 0 ? _c : "";
|
|
478
|
+
if (list.includes(`tcp:${port}`)) {
|
|
479
|
+
return true;
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
return false;
|
|
483
|
+
}
|
|
484
|
+
getViteHmrPort() {
|
|
485
|
+
// The Vite dev server defaults to 5173; the bundler reads the same
|
|
486
|
+
// default. If a project runs Vite on a different port, the dev sets
|
|
487
|
+
// `NS_HMR_PORT` so the CLI reverses the matching port.
|
|
488
|
+
const fromEnv = Number(process.env.NS_HMR_PORT);
|
|
489
|
+
return Number.isFinite(fromEnv) && fromEnv > 0 ? fromEnv : 5173;
|
|
490
|
+
}
|
|
491
|
+
isTruthyEnvFlag(value) {
|
|
492
|
+
if (typeof value !== "string") {
|
|
493
|
+
return false;
|
|
494
|
+
}
|
|
495
|
+
const v = value.trim().toLowerCase();
|
|
496
|
+
return !!v && v !== "0" && v !== "false" && v !== "off" && v !== "no";
|
|
497
|
+
}
|
|
356
498
|
async syncChangedDataOnDevices(data, projectData, liveSyncInfo) {
|
|
357
499
|
const successfullySyncedMessageFormat = `Successfully synced application %s on device %s.`;
|
|
358
500
|
const rebuiltInformation = {};
|
|
@@ -476,18 +618,13 @@ class RunController extends events_1.EventEmitter {
|
|
|
476
618
|
}
|
|
477
619
|
}
|
|
478
620
|
catch (err) {
|
|
479
|
-
this.$logger.warn(`Unable to apply changes for device: ${device.deviceInfo.identifier}. Error is: ${err && err.message}.`);
|
|
621
|
+
this.$logger.warn(`Unable to apply changes for device: ${device.deviceInfo.identifier}. Error is: ${err && err.message}. Will retry on next change.`);
|
|
480
622
|
this.emitCore(constants_2.RunOnDeviceEvents.runOnDeviceError, {
|
|
481
623
|
projectDir: projectData.projectDir,
|
|
482
624
|
deviceIdentifier: device.deviceInfo.identifier,
|
|
483
625
|
applicationIdentifier: projectData.projectIdentifiers[device.deviceInfo.platform.toLowerCase()],
|
|
484
626
|
error: err,
|
|
485
627
|
});
|
|
486
|
-
await this.stop({
|
|
487
|
-
projectDir: projectData.projectDir,
|
|
488
|
-
deviceIdentifiers: [device.deviceInfo.identifier],
|
|
489
|
-
stopOptions: { shouldAwaitAllActions: false },
|
|
490
|
-
});
|
|
491
628
|
}
|
|
492
629
|
};
|
|
493
630
|
await this.addActionToChain(projectData.projectDir, () => this.$devicesService.execute(deviceAction, (device) => {
|
|
@@ -498,15 +635,65 @@ class RunController extends events_1.EventEmitter {
|
|
|
498
635
|
_.some(liveSyncProcessInfo.deviceDescriptors, (deviceDescriptor) => deviceDescriptor.identifier === device.deviceInfo.identifier));
|
|
499
636
|
}));
|
|
500
637
|
}
|
|
638
|
+
scheduleSyncOnDevices(data, projectData, liveSyncInfo) {
|
|
639
|
+
if (this._syncInProgress) {
|
|
640
|
+
const platform = data.platform;
|
|
641
|
+
const existing = this._pendingSyncs.get(platform);
|
|
642
|
+
if (existing) {
|
|
643
|
+
existing.data = this.mergeFilesChangeEvents(existing.data, data);
|
|
644
|
+
}
|
|
645
|
+
else {
|
|
646
|
+
this._pendingSyncs.set(platform, { data, projectData, liveSyncInfo });
|
|
647
|
+
}
|
|
648
|
+
return;
|
|
649
|
+
}
|
|
650
|
+
this.executeSyncOnDevices(data, projectData, liveSyncInfo);
|
|
651
|
+
}
|
|
652
|
+
async executeSyncOnDevices(data, projectData, liveSyncInfo) {
|
|
653
|
+
this._syncInProgress = true;
|
|
654
|
+
try {
|
|
655
|
+
await this.syncChangedDataOnDevices(data, projectData, liveSyncInfo);
|
|
656
|
+
}
|
|
657
|
+
catch (err) {
|
|
658
|
+
this.$logger.trace(`Error during sync on devices: ${err.message || err}`);
|
|
659
|
+
}
|
|
660
|
+
finally {
|
|
661
|
+
const nextEntry = this._pendingSyncs.entries().next();
|
|
662
|
+
if (!nextEntry.done) {
|
|
663
|
+
const [platform, pending] = nextEntry.value;
|
|
664
|
+
this._pendingSyncs.delete(platform);
|
|
665
|
+
this.executeSyncOnDevices(pending.data, pending.projectData, pending.liveSyncInfo);
|
|
666
|
+
}
|
|
667
|
+
else {
|
|
668
|
+
this._syncInProgress = false;
|
|
669
|
+
}
|
|
670
|
+
}
|
|
671
|
+
}
|
|
672
|
+
mergeFilesChangeEvents(a, b) {
|
|
673
|
+
return {
|
|
674
|
+
files: [...new Set([...a.files, ...b.files])],
|
|
675
|
+
staleFiles: [
|
|
676
|
+
...new Set([...(a.staleFiles || []), ...(b.staleFiles || [])]),
|
|
677
|
+
],
|
|
678
|
+
hasOnlyHotUpdateFiles: a.hasOnlyHotUpdateFiles && b.hasOnlyHotUpdateFiles,
|
|
679
|
+
hasNativeChanges: a.hasNativeChanges || b.hasNativeChanges,
|
|
680
|
+
hmrData: b.hmrData,
|
|
681
|
+
platform: b.platform,
|
|
682
|
+
};
|
|
683
|
+
}
|
|
501
684
|
async addActionToChain(projectDir, action) {
|
|
502
685
|
const liveSyncInfo = this.$liveSyncProcessDataService.getPersistedData(projectDir);
|
|
503
686
|
if (liveSyncInfo) {
|
|
504
|
-
liveSyncInfo.actionsChain = liveSyncInfo.actionsChain
|
|
687
|
+
liveSyncInfo.actionsChain = liveSyncInfo.actionsChain
|
|
688
|
+
.then(async () => {
|
|
505
689
|
if (!liveSyncInfo.isStopped) {
|
|
506
690
|
liveSyncInfo.currentSyncAction = action();
|
|
507
691
|
const res = await liveSyncInfo.currentSyncAction;
|
|
508
692
|
return res;
|
|
509
693
|
}
|
|
694
|
+
})
|
|
695
|
+
.catch((err) => {
|
|
696
|
+
this.$logger.warn(`Error in action chain: ${err.message || err}`);
|
|
510
697
|
});
|
|
511
698
|
const result = await liveSyncInfo.actionsChain;
|
|
512
699
|
return result;
|
package/lib/data/prepare-data.js
CHANGED
|
@@ -33,6 +33,10 @@ class PrepareData extends controller_data_base_1.ControllerDataBase {
|
|
|
33
33
|
this.watchNative = data.watchNative;
|
|
34
34
|
}
|
|
35
35
|
this.hostProjectPath = data.hostProjectPath;
|
|
36
|
+
if (data.skipNative) {
|
|
37
|
+
this.nativePrepare = { skipNativePrepare: true };
|
|
38
|
+
this.watchNative = false;
|
|
39
|
+
}
|
|
36
40
|
this.uniqueBundle = !this.watch && data.uniqueBundle ? Date.now() : 0;
|
|
37
41
|
}
|
|
38
42
|
}
|