nativescript 9.1.0-alpha.7 → 9.1.0-alpha.9

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.
@@ -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
  */
@@ -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
- if (err.deviceId === this.device.deviceInfo.identifier) {
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
- const nsConfig = this.$projectConfigService.readConfig(projectData.projectDir);
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 (platformData.platformNameLowerCase === "ios" &&
244
- packageData.ios &&
245
- packageData.ios.discardUncaughtJsExceptions) {
246
- packageData.discardUncaughtJsExceptions =
247
- packageData.ios.discardUncaughtJsExceptions;
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 (platformData.platformNameLowerCase === "android" &&
250
- packageData.android &&
251
- packageData.android.discardUncaughtJsExceptions) {
252
- packageData.discardUncaughtJsExceptions =
253
- packageData.android.discardUncaughtJsExceptions;
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)) {
@@ -130,6 +130,10 @@ interface INsConfigIOS extends INsConfigPlaform {
130
130
  * List packages to be included in the iOS build.
131
131
  */
132
132
  SPMPackages?: Array<IOSSPMPackage>;
133
+ /**
134
+ * Custom runtime package name
135
+ */
136
+ runtimePackageName?: string;
133
137
  }
134
138
 
135
139
  interface INSConfigVisionOS extends INsConfigIOS {}
@@ -168,6 +172,11 @@ interface INsConfigAndroid extends INsConfigPlaform {
168
172
  enableLineBreakpoints?: boolean;
169
173
 
170
174
  enableMultithreadedJavascript?: boolean;
175
+
176
+ /**
177
+ * Custom runtime package name
178
+ */
179
+ runtimePackageName?: string;
171
180
  }
172
181
 
173
182
  interface INsConfigHooks {
@@ -191,6 +200,13 @@ interface INsConfig {
191
200
  ignoredNativeDependencies?: string[];
192
201
  hooks?: INsConfigHooks[];
193
202
  projectName?: string;
203
+ /**
204
+ * Legacy keys still found in user configs. Declared so the
205
+ * runtime-package.json generation (PrepareController) can strip them
206
+ * via destructuring without losing type safety.
207
+ */
208
+ webpackPackageName?: string;
209
+ buildPath?: string;
194
210
  }
195
211
 
196
212
  interface IProjectData extends ICreateProjectData {
@@ -276,31 +276,37 @@ class AndroidPluginBuildService {
276
276
  }
277
277
  if (!runtimeGradleVersions) {
278
278
  const latestRuntimeVersion = await this.getLatestRuntimeVersion();
279
- runtimeGradleVersions = await this.getGradleVersions(latestRuntimeVersion);
279
+ runtimeGradleVersions =
280
+ await this.getGradleVersions(latestRuntimeVersion);
280
281
  this.$logger.trace(`Got gradle versions ${JSON.stringify(runtimeGradleVersions)} from the latest runtime v${latestRuntimeVersion}`);
281
282
  }
282
283
  return runtimeGradleVersions || {};
283
284
  }
284
285
  async getLatestRuntimeVersion() {
285
- var _a;
286
+ var _a, _b, _c;
286
287
  let runtimeVersion = null;
288
+ const packageName = ((_b = (_a = this.$projectData.nsConfig) === null || _a === void 0 ? void 0 : _a.android) === null || _b === void 0 ? void 0 : _b.runtimePackageName) ||
289
+ constants_1.SCOPED_ANDROID_RUNTIME_NAME;
287
290
  try {
288
- let result = await this.$packageManager.view(constants_1.SCOPED_ANDROID_RUNTIME_NAME, {
291
+ let result = await this.$packageManager.view(packageName, {
289
292
  "dist-tags": true,
290
293
  });
291
- result = (_a = result === null || result === void 0 ? void 0 : result["dist-tags"]) !== null && _a !== void 0 ? _a : result;
294
+ result = (_c = result === null || result === void 0 ? void 0 : result["dist-tags"]) !== null && _c !== void 0 ? _c : result;
292
295
  runtimeVersion = result.latest;
293
296
  }
294
297
  catch (err) {
295
298
  this.$logger.trace(`Error while getting latest android runtime version from view command: ${err}`);
296
- const registryData = await this.$packageManager.getRegistryPackageData(constants_1.SCOPED_ANDROID_RUNTIME_NAME);
299
+ const registryData = await this.$packageManager.getRegistryPackageData(packageName);
297
300
  runtimeVersion = registryData["dist-tags"].latest;
298
301
  }
299
302
  return runtimeVersion;
300
303
  }
301
304
  getLocalGradleVersions() {
305
+ var _a, _b;
306
+ const packageName = ((_b = (_a = this.$projectData.nsConfig) === null || _a === void 0 ? void 0 : _a.android) === null || _b === void 0 ? void 0 : _b.runtimePackageName) ||
307
+ constants_1.SCOPED_ANDROID_RUNTIME_NAME;
302
308
  // try reading from installed runtime first before reading from the npm registry...
303
- const installedRuntimePackageJSONPath = (0, resolve_package_path_1.resolvePackageJSONPath)(constants_1.SCOPED_ANDROID_RUNTIME_NAME, {
309
+ const installedRuntimePackageJSONPath = (0, resolve_package_path_1.resolvePackageJSONPath)(packageName, {
304
310
  paths: [this.$projectData.projectDir],
305
311
  });
306
312
  if (!installedRuntimePackageJSONPath) {
@@ -327,16 +333,18 @@ class AndroidPluginBuildService {
327
333
  return null;
328
334
  }
329
335
  async getGradleVersions(runtimeVersion) {
330
- var _a, _b;
336
+ var _a, _b, _c, _d;
331
337
  let runtimeGradleVersions = null;
332
338
  const localVersionInfo = this.getLocalGradleVersions();
333
339
  if (localVersionInfo) {
334
340
  return localVersionInfo;
335
341
  }
342
+ const packageName = ((_b = (_a = this.$projectData.nsConfig) === null || _a === void 0 ? void 0 : _a.android) === null || _b === void 0 ? void 0 : _b.runtimePackageName) ||
343
+ constants_1.SCOPED_ANDROID_RUNTIME_NAME;
336
344
  // fallback to reading from npm...
337
345
  try {
338
- let output = await this.$packageManager.view(`${constants_1.SCOPED_ANDROID_RUNTIME_NAME}@${runtimeVersion}`, { version_info: true });
339
- output = (_a = output === null || output === void 0 ? void 0 : output["version_info"]) !== null && _a !== void 0 ? _a : output;
346
+ let output = await this.$packageManager.view(`${packageName}@${runtimeVersion}`, { version_info: true });
347
+ output = (_c = output === null || output === void 0 ? void 0 : output["version_info"]) !== null && _c !== void 0 ? _c : output;
340
348
  if (!output) {
341
349
  /**
342
350
  * fallback to the old 'gradle' key in package.json
@@ -346,8 +354,8 @@ class AndroidPluginBuildService {
346
354
  * gradle: { version: '6.4', android: '3.6.4' }
347
355
  *
348
356
  */
349
- output = await this.$packageManager.view(`${constants_1.SCOPED_ANDROID_RUNTIME_NAME}@${runtimeVersion}`, { gradle: true });
350
- output = (_b = output === null || output === void 0 ? void 0 : output["gradle"]) !== null && _b !== void 0 ? _b : output;
357
+ output = await this.$packageManager.view(`${packageName}@${runtimeVersion}`, { gradle: true });
358
+ output = (_d = output === null || output === void 0 ? void 0 : output["gradle"]) !== null && _d !== void 0 ? _d : output;
351
359
  const { version, android } = output;
352
360
  // covert output to the new format...
353
361
  output = {
@@ -359,7 +367,7 @@ class AndroidPluginBuildService {
359
367
  }
360
368
  catch (err) {
361
369
  this.$logger.trace(`Error while getting gradle data for android runtime from view command: ${err}`);
362
- const registryData = await this.$packageManager.getRegistryPackageData(constants_1.SCOPED_ANDROID_RUNTIME_NAME);
370
+ const registryData = await this.$packageManager.getRegistryPackageData(packageName);
363
371
  runtimeGradleVersions = registryData.versions[runtimeVersion];
364
372
  }
365
373
  const result = this.getGradleVersionsCore(runtimeGradleVersions);
@@ -11,6 +11,7 @@ const path = require("path");
11
11
  const ios_device_livesync_service_1 = require("./ios-device-livesync-service");
12
12
  const platform_livesync_service_base_1 = require("./platform-livesync-service-base");
13
13
  const constants_1 = require("../../constants");
14
+ const constants_2 = require("../../common/constants");
14
15
  const decorators_1 = require("../../common/decorators");
15
16
  const yok_1 = require("../../common/yok");
16
17
  class IOSLiveSyncService extends platform_livesync_service_base_1.PlatformLiveSyncServiceBase {
@@ -40,14 +41,124 @@ class IOSLiveSyncService extends platform_livesync_service_base_1.PlatformLiveSy
40
41
  await this.$fs.zipFiles(tempZip, filesToTransfer, (res) => {
41
42
  return path.join(constants_1.APP_FOLDER_NAME, path.relative(projectFilesPath, res));
42
43
  });
43
- await device.fileSystem.transferFiles(deviceAppData, [
44
+ const deviceProjectRootPath = await deviceAppData.getDeviceProjectRootPath();
45
+ const transferSyncZip = () => device.fileSystem.transferFiles(deviceAppData, [
44
46
  {
45
47
  getLocalPath: () => tempZip,
46
48
  getDevicePath: () => deviceAppData.deviceSyncZipPath,
47
49
  getRelativeToProjectBasePath: () => "../sync.zip",
48
- deviceProjectRootPath: await deviceAppData.getDeviceProjectRootPath(),
50
+ deviceProjectRootPath,
49
51
  },
50
52
  ]);
53
+ // ── Fail-closed delivery verification ──────────────────────────
54
+ //
55
+ // The AFC transfer has been observed to fail without surfacing an
56
+ // error, leaving the app to boot the stale JavaScript baked into
57
+ // the installed .app payload with no indication anywhere that the
58
+ // sync was lost. After the transfer we therefore confirm the zip
59
+ // is actually present in the app sandbox; one retry covers
60
+ // transient AFC hiccups, and an unconfirmed delivery fails the
61
+ // sync loudly instead of printing "Successfully synced" over
62
+ // stale code (the run-controller surfaces the error; --clean
63
+ // reinstalls the full package).
64
+ //
65
+ // Presence alone is NOT sufficient evidence: a previous run that
66
+ // transferred the zip but aborted before the app restarted leaves
67
+ // a LEFTOVER sync.zip behind (the runtime only consumes it at
68
+ // boot), which would satisfy the check even when THIS upload
69
+ // failed. So any pre-existing zip is deleted up front — after
70
+ // that, post-transfer presence can only be produced by this run's
71
+ // upload.
72
+ //
73
+ // NOTE: deviceProjectRootPath is `.../LiveSync/app` (the extracted
74
+ // app folder); the zip is uploaded one level up, at the LiveSync
75
+ // root — the listing targets THAT directory.
76
+ //
77
+ // Escape hatch: NS_SKIP_IOS_SYNC_VERIFICATION=1 disables the
78
+ // whole verification for exotic setups where directory listing
79
+ // misbehaves but uploads are known-good.
80
+ const syncZipDevicePath = deviceAppData.deviceSyncZipPath;
81
+ const verificationSupported = !!device.fileSystem.getDirectoryEntries &&
82
+ process.env.NS_SKIP_IOS_SYNC_VERIFICATION !== "1";
83
+ const listLiveSyncRoot = () => device.fileSystem.getDirectoryEntries(constants_2.LiveSyncPaths.IOS_DEVICE_PROJECT_ROOT_PATH, deviceAppData.appIdentifier);
84
+ // Entry shape: ios-device-lib's native `read_dir` recursively joins
85
+ // `<requested dir>/<entry>` and returns FULL paths rooted at the
86
+ // requested directory (verified against IOSDeviceLib.cpp and live
87
+ // device output), so the canonical match is exact equality with
88
+ // `Library/Application Support/LiveSync/sync.zip`. The bare
89
+ // `"sync.zip"` equality is defensive cover for listing
90
+ // implementations that return root-relative names. Deliberately NO
91
+ // suffix matching — `endsWith("/sync.zip")` would false-positively
92
+ // accept a nested app asset like `.../LiveSync/app/sync.zip`.
93
+ const containsSyncZip = (entries) => entries.some((entry) => entry === syncZipDevicePath || entry === "sync.zip");
94
+ // "delivered" / "missing" are definitive listings; "unknown" means
95
+ // the listing itself could not be read (after one retry).
96
+ const checkDelivery = async () => {
97
+ let entries = await listLiveSyncRoot();
98
+ if (entries === null) {
99
+ entries = await listLiveSyncRoot();
100
+ }
101
+ if (entries === null) {
102
+ return "unknown";
103
+ }
104
+ return containsSyncZip(entries) ? "delivered" : "missing";
105
+ };
106
+ let preListingAvailable = false;
107
+ let leftoverZipPresent = false;
108
+ if (verificationSupported) {
109
+ // Clear any leftover zip so the post-transfer check attributes
110
+ // presence to this run. Best-effort: AFC "file not found" is
111
+ // tolerated inside deleteFile.
112
+ await device.fileSystem.deleteFile(syncZipDevicePath, deviceAppData.appIdentifier);
113
+ const preEntries = await listLiveSyncRoot();
114
+ preListingAvailable = Array.isArray(preEntries);
115
+ leftoverZipPresent = preListingAvailable && containsSyncZip(preEntries);
116
+ }
117
+ await transferSyncZip();
118
+ if (verificationSupported) {
119
+ if (leftoverZipPresent) {
120
+ // The pre-transfer delete did not take effect, so presence
121
+ // can no longer be attributed to this run. Most likely the
122
+ // upload succeeded too, but say so explicitly rather than
123
+ // claim verification.
124
+ this.$logger.warn("A leftover sync.zip from a previous run could not be removed — delivery verification for this sync is inconclusive. " +
125
+ "If the app runs stale code, re-run the command or use a clean rebuild (--clean).");
126
+ }
127
+ else {
128
+ let state = await checkDelivery();
129
+ if (state === "missing") {
130
+ this.$logger.warn("sync.zip was not found on the device after transfer — retrying once...");
131
+ await transferSyncZip();
132
+ state = await checkDelivery();
133
+ if (state === "delivered") {
134
+ this.$logger.info("sync.zip delivered on retry.");
135
+ }
136
+ }
137
+ if (state === "missing") {
138
+ throw new Error(`Unable to deliver the application payload (sync.zip) to device ${device.deviceInfo.identifier}. ` +
139
+ `The app would run stale JavaScript without it. ` +
140
+ `Re-run the command, or use a clean rebuild (--clean) to reinstall the full application package.`);
141
+ }
142
+ if (state === "unknown") {
143
+ if (preListingAvailable) {
144
+ // The listing worked moments before the upload and
145
+ // broke right after it — the AFC session is
146
+ // misbehaving at exactly the point where the upload
147
+ // itself is suspect. Fail closed.
148
+ throw new Error(`Unable to confirm delivery of the application payload (sync.zip) to device ${device.deviceInfo.identifier}: ` +
149
+ `the device directory listing failed right after the transfer. ` +
150
+ `Re-run the command, or use a clean rebuild (--clean) to reinstall the full application package. ` +
151
+ `(Set NS_SKIP_IOS_SYNC_VERIFICATION=1 to bypass delivery verification.)`);
152
+ }
153
+ // Listing was unavailable both before and after the
154
+ // transfer — verification is unsupported for this
155
+ // device/session. This is the single fail-open path,
156
+ // and it is loud rather than silent.
157
+ this.$logger.warn("Could not verify sync.zip delivery (device directory listing unavailable). " +
158
+ "If the transfer failed, the app will run stale JavaScript — re-run the command or use a clean rebuild (--clean).");
159
+ }
160
+ }
161
+ }
51
162
  await deviceAppData.device.applicationManager.setTransferredAppFiles(filesToTransfer);
52
163
  return {
53
164
  deviceAppData,
@@ -18,10 +18,11 @@ const yok_1 = require("../common/yok");
18
18
  const semver = require("semver");
19
19
  const package_path_helper_1 = require("../helpers/package-path-helper");
20
20
  class ProjectDataService {
21
- constructor($fs, $staticConfig, $logger, $devicePlatformsConstants, $androidResourcesMigrationService, $injector) {
21
+ constructor($fs, $staticConfig, $logger, $projectData, $devicePlatformsConstants, $androidResourcesMigrationService, $injector) {
22
22
  this.$fs = $fs;
23
23
  this.$staticConfig = $staticConfig;
24
24
  this.$logger = $logger;
25
+ this.$projectData = $projectData;
25
26
  this.$devicePlatformsConstants = $devicePlatformsConstants;
26
27
  this.$androidResourcesMigrationService = $androidResourcesMigrationService;
27
28
  this.$injector = $injector;
@@ -373,20 +374,20 @@ class ProjectDataService {
373
374
  return this.getInstalledRuntimePackage(projectDir, platform);
374
375
  }
375
376
  getInstalledRuntimePackage(projectDir, platform) {
377
+ var _a, _b, _c, _d;
376
378
  const runtimePackage = this.$pluginsService
377
379
  .getDependenciesFromPackageJson(projectDir)
378
380
  .devDependencies.find((d) => {
381
+ var _a, _b, _c, _d;
379
382
  if (platform === "ios" /* constants.PlatformTypes.ios */) {
380
- return [
381
- constants.SCOPED_IOS_RUNTIME_NAME,
382
- constants.TNS_IOS_RUNTIME_NAME,
383
- ].includes(d.name);
383
+ const packageName = ((_b = (_a = this.$projectData.nsConfig) === null || _a === void 0 ? void 0 : _a.ios) === null || _b === void 0 ? void 0 : _b.runtimePackageName) ||
384
+ constants.SCOPED_IOS_RUNTIME_NAME;
385
+ return [packageName, constants.TNS_IOS_RUNTIME_NAME].includes(d.name);
384
386
  }
385
387
  else if (platform === "android" /* constants.PlatformTypes.android */) {
386
- return [
387
- constants.SCOPED_ANDROID_RUNTIME_NAME,
388
- constants.TNS_ANDROID_RUNTIME_NAME,
389
- ].includes(d.name);
388
+ const packageName = ((_d = (_c = this.$projectData.nsConfig) === null || _c === void 0 ? void 0 : _c.android) === null || _d === void 0 ? void 0 : _d.runtimePackageName) ||
389
+ constants.SCOPED_ANDROID_RUNTIME_NAME;
390
+ return [packageName, constants.TNS_ANDROID_RUNTIME_NAME].includes(d.name);
390
391
  }
391
392
  else if (platform === "visionos" /* constants.PlatformTypes.visionos */) {
392
393
  return d.name === constants.SCOPED_VISIONOS_RUNTIME_NAME;
@@ -424,13 +425,15 @@ class ProjectDataService {
424
425
  this.$logger.trace("Could not find an installed runtime, falling back to default runtimes");
425
426
  if (platform === "ios" /* constants.PlatformTypes.ios */) {
426
427
  return {
427
- name: constants.SCOPED_IOS_RUNTIME_NAME,
428
+ name: ((_b = (_a = this.$projectData.nsConfig) === null || _a === void 0 ? void 0 : _a.ios) === null || _b === void 0 ? void 0 : _b.runtimePackageName) ||
429
+ constants.SCOPED_IOS_RUNTIME_NAME,
428
430
  version: null,
429
431
  };
430
432
  }
431
433
  else if (platform === "android" /* constants.PlatformTypes.android */) {
432
434
  return {
433
- name: constants.SCOPED_ANDROID_RUNTIME_NAME,
435
+ name: ((_d = (_c = this.$projectData.nsConfig) === null || _c === void 0 ? void 0 : _c.android) === null || _d === void 0 ? void 0 : _d.runtimePackageName) ||
436
+ constants.SCOPED_ANDROID_RUNTIME_NAME,
434
437
  version: null,
435
438
  };
436
439
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "nativescript",
3
3
  "main": "./lib/nativescript-cli-lib.js",
4
- "version": "9.1.0-alpha.7",
4
+ "version": "9.1.0-alpha.9",
5
5
  "author": "NativeScript <oss@nativescript.org>",
6
6
  "description": "Command-line interface for building NativeScript projects",
7
7
  "bin": {