nativescript 9.1.0-alpha.11 → 9.1.0-alpha.13

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.
@@ -201,7 +201,10 @@ class AndroidProjectService extends projectServiceBaseLib.PlatformProjectService
201
201
  };
202
202
  }
203
203
  async createProject(frameworkDir, frameworkVersion, projectData) {
204
- if (semver.lt(frameworkVersion, AndroidProjectService.MIN_RUNTIME_VERSION_WITH_GRADLE)) {
204
+ var _a;
205
+ const packageName = ((_a = projectData.nsConfig.android) === null || _a === void 0 ? void 0 : _a.runtimePackageName) || constants.SCOPED_ANDROID_RUNTIME_NAME;
206
+ if (packageName === constants.SCOPED_ANDROID_RUNTIME_NAME &&
207
+ semver.lt(frameworkVersion, AndroidProjectService.MIN_RUNTIME_VERSION_WITH_GRADLE)) {
205
208
  this.$errors.fail(`The NativeScript CLI requires Android runtime ${AndroidProjectService.MIN_RUNTIME_VERSION_WITH_GRADLE} or later to work properly.`);
206
209
  }
207
210
  this.$fs.ensureDirectoryExists(this.getPlatformData(projectData).projectRoot);
@@ -288,7 +291,10 @@ class AndroidProjectService extends projectServiceBaseLib.PlatformProjectService
288
291
  return null;
289
292
  }
290
293
  async updatePlatform(currentVersion, newVersion, canUpdate, projectData, addPlatform, removePlatforms) {
291
- if (semver.eq(newVersion, AndroidProjectService.MIN_RUNTIME_VERSION_WITH_GRADLE)) {
294
+ var _a;
295
+ const packageName = ((_a = projectData.nsConfig.android) === null || _a === void 0 ? void 0 : _a.runtimePackageName) || constants.SCOPED_ANDROID_RUNTIME_NAME;
296
+ if (packageName === constants.SCOPED_ANDROID_RUNTIME_NAME &&
297
+ semver.eq(newVersion, AndroidProjectService.MIN_RUNTIME_VERSION_WITH_GRADLE)) {
292
298
  const platformLowercase = this.getPlatformData(projectData).normalizedPlatformName.toLowerCase();
293
299
  await removePlatforms([platformLowercase.split("@")[0]]);
294
300
  await addPlatform(platformLowercase);
@@ -56,10 +56,15 @@ class BundlerCompilerService extends events_1.EventEmitter {
56
56
  // HMR updates from. No-op unless bundler is vite + hmr + watch.
57
57
  // Fired in parallel with the build watcher; both child processes
58
58
  // inherit the adb-reverse env the run-controller set before
59
- // prepare, so neither one spawns adb on its own. Intentionally not
60
- // awaited — the device only connects to it at app launch, well
61
- // after the first build.
62
- this.startViteDevServer(platformData, projectData, prepareData);
59
+ // prepare, so neither one spawns adb on its own. Not awaited HERE
60
+ // — but the first-build resolution below gates on it, because the
61
+ // app is (re)started as soon as `compileWithWatch` resolves and its
62
+ // very first HTTP module fetch dies on connection-refused if the
63
+ // server hasn't bound yet (a cold `vite serve` config load + vendor
64
+ // prebuild competes with this build watcher for CPU and can take
65
+ // 10-30s). Running both in parallel keeps the happy-path wall time
66
+ // at max(first build, server bind) instead of their sum.
67
+ const viteDevServerStartup = this.startViteDevServer(platformData, projectData, prepareData);
63
68
  try {
64
69
  const childProcess = await this.startBundleProcess(platformData, projectData, prepareData);
65
70
  // Handle Vite differently from webpack
@@ -105,13 +110,18 @@ class BundlerCompilerService extends events_1.EventEmitter {
105
110
  }
106
111
  this.copyViteBundleToNative(distOutput, destDir);
107
112
  }
108
- // Resolve the promise on first build completion
113
+ // Resolve the promise on first build completion — gated on
114
+ // the HMR dev server being reachable (no-op resolve for
115
+ // non-HMR runs). `startViteDevServer` never rejects and its
116
+ // readiness probe is bounded, so this cannot hang the run;
117
+ // on probe timeout we proceed and the device's own retry
118
+ // handles any residual gap.
109
119
  if (isFirstBundlerWatchCompilation) {
110
120
  isFirstBundlerWatchCompilation = false;
111
121
  if (debugLog) {
112
122
  console.log("Vite first build completed, resolving compileWithWatch");
113
123
  }
114
- resolve(childProcess);
124
+ viteDevServerStartup.then(() => resolve(childProcess));
115
125
  return;
116
126
  }
117
127
  // Transform Vite message to match webpack format
@@ -454,7 +464,11 @@ class BundlerCompilerService extends events_1.EventEmitter {
454
464
  this.$logger.info(`Vite dev server ready on port ${port} (HMR for ${key}).`);
455
465
  }
456
466
  else {
457
- this.$logger.trace(`Vite dev server port ${port} not observed open within the readiness probe window; continuing (it may bind shortly).`);
467
+ // Warn (not trace): the first-build resolution in
468
+ // `compileWithWatch` gates on this method, so a probe timeout
469
+ // means the app will be deployed against a server that may not
470
+ // be up yet — the user should see why a boot might stall.
471
+ this.$logger.warn(`Vite dev server port ${port} not observed open within the readiness probe window; continuing (it may bind shortly).`);
458
472
  }
459
473
  }
460
474
  catch (err) {
@@ -128,7 +128,7 @@ class SPMService {
128
128
  let lineBuffer = "";
129
129
  const render = () => {
130
130
  const elapsed = Math.round((Date.now() - startedAt) / 1000);
131
- spinner.text = `${activity}… ${color_1.color.dim(`(${elapsed}s)`)}`;
131
+ spinner.text = `${activity}… ${color_1.color.dim(`(${this.formatElapsed(elapsed)})`)}`;
132
132
  };
133
133
  // keep the elapsed timer ticking even when xcodebuild is silent (e.g.
134
134
  // while a binary artifact downloads) so the user can see it's alive.
@@ -207,10 +207,10 @@ class SPMService {
207
207
  return "Downloading Swift Package binaries (first build only)";
208
208
  }
209
209
  if (/^Fetching\b/i.test(trimmed)) {
210
- return `Fetching ${this.shortenPackageRef(trimmed)}`;
210
+ return this.describePackageActivity("Fetching", trimmed);
211
211
  }
212
212
  if (/^Cloning\b/i.test(trimmed)) {
213
- return `Cloning ${this.shortenPackageRef(trimmed)}`;
213
+ return this.describePackageActivity("Cloning", trimmed);
214
214
  }
215
215
  if (/Computing version for/i.test(trimmed)) {
216
216
  return "Computing package versions";
@@ -223,17 +223,36 @@ class SPMService {
223
223
  }
224
224
  return null;
225
225
  }
226
- /** Extracts a short, readable name from a SwiftPM repo URL/log line. */
226
+ /**
227
+ * Builds a stable, self-explanatory activity label with the package being
228
+ * worked on in parentheses, e.g. "Fetching Swift Packages (Auth0.swift)".
229
+ */
230
+ describePackageActivity(verb, line) {
231
+ const packageRef = this.shortenPackageRef(line);
232
+ return packageRef
233
+ ? `${verb} Swift Packages (${packageRef})`
234
+ : `${verb} Swift Packages`;
235
+ }
236
+ /**
237
+ * Extracts a short, readable name from a SwiftPM repo URL/log line, or null
238
+ * when the line contains no URL to name the package by.
239
+ */
227
240
  shortenPackageRef(line) {
228
241
  const match = line.match(/https?:\/\/\S+/);
229
242
  if (!match) {
230
- return "Swift Packages";
243
+ return null;
231
244
  }
232
245
  return path
233
246
  .basename(match[0])
234
247
  .replace(/\.git$/, "")
235
248
  .replace(/[)\s].*$/, "");
236
249
  }
250
+ /** Formats an elapsed duration in whole seconds as "5m 15s". */
251
+ formatElapsed(totalSeconds) {
252
+ const minutes = Math.floor(totalSeconds / 60);
253
+ const seconds = totalSeconds % 60;
254
+ return `${minutes}m ${seconds}s`;
255
+ }
237
256
  /** True when the Xcode project references any Swift packages. */
238
257
  hasSPMReferences(platformData, projectData) {
239
258
  const pbxprojPath = path.join(platformData.projectRoot, `${projectData.projectName}.xcodeproj`, "project.pbxproj");
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.11",
4
+ "version": "9.1.0-alpha.13",
5
5
  "author": "NativeScript <oss@nativescript.org>",
6
6
  "description": "Command-line interface for building NativeScript projects",
7
7
  "bin": {