@absolutejs/absolute 0.20.0-beta.35 → 0.20.0-beta.37

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.
@@ -2,6 +2,32 @@
2
2
  // src/dev/serverBootstrap.ts
3
3
  import { copyFileSync, existsSync, readdirSync, unlinkSync } from "fs";
4
4
  import { dirname, extname, join, resolve } from "path";
5
+
6
+ // src/dev/serverEntryCopies.ts
7
+ var ENTRY_COPY_OWNER_PATTERN = /^\.absolutejs-hmr-(\d+)-(?:bootstrap-)?\d+\.[^.]+$/;
8
+ var absoluteServerEntryCopyOwnerPid = (name) => {
9
+ const match = ENTRY_COPY_OWNER_PATTERN.exec(name);
10
+ if (!match)
11
+ return null;
12
+ const pid = Number(match[1]);
13
+ return Number.isSafeInteger(pid) && pid > 0 ? pid : null;
14
+ };
15
+ var isProcessAlive = (pid) => {
16
+ try {
17
+ process.kill(pid, 0);
18
+ return true;
19
+ } catch (error) {
20
+ return !(error instanceof Error && ("code" in error) && error.code === "ESRCH");
21
+ }
22
+ };
23
+ var isStaleAbsoluteServerEntryCopy = (name, currentPid = process.pid, ownerIsAlive = isProcessAlive) => {
24
+ const ownerPid = absoluteServerEntryCopyOwnerPid(name);
25
+ if (ownerPid === null)
26
+ return false;
27
+ return ownerPid === currentPid || !ownerIsAlive(ownerPid);
28
+ };
29
+
30
+ // src/dev/serverBootstrap.ts
5
31
  var originalEntry = process.env.ABSOLUTE_SERVER_ENTRY;
6
32
  if (!originalEntry) {
7
33
  throw new Error("ABSOLUTE_SERVER_ENTRY is required by the AbsoluteJS dev bootstrap");
@@ -24,6 +50,8 @@ if (!isHotReevaluation) {
24
50
  if (!name.startsWith(copyPrefix) || !name.endsWith(entryExtension)) {
25
51
  continue;
26
52
  }
53
+ if (!isStaleAbsoluteServerEntryCopy(name))
54
+ continue;
27
55
  removeEntryCopy(join(entryDir, name));
28
56
  }
29
57
  }
@@ -2313,23 +2313,23 @@ var ignoredFingerprintDirectories = new Set([
2313
2313
  "build",
2314
2314
  "xcuserdata"
2315
2315
  ]);
2316
- var fingerprintFiles = async (root, current = root) => {
2316
+ var fingerprintFiles = async (root, current = root, options = {}) => {
2317
2317
  const entries = await readdir3(current, { withFileTypes: true });
2318
2318
  const nested = await Promise.all(entries.sort((left, right) => left.name.localeCompare(right.name)).map(async (entry) => {
2319
2319
  const path = join5(current, entry.name);
2320
2320
  const projectRelative = relative4(root, path).replaceAll("\\", "/");
2321
- const ignored = entry.isDirectory() && (ignoredFingerprintDirectories.has(entry.name) || projectRelative === "App/App/public");
2321
+ const ignored = entry.isDirectory() && (ignoredFingerprintDirectories.has(entry.name) || projectRelative === "App/App/public" && options.includePublicBundle !== true);
2322
2322
  if (ignored)
2323
2323
  return [];
2324
2324
  if (entry.isDirectory())
2325
- return fingerprintFiles(root, path);
2325
+ return fingerprintFiles(root, path, options);
2326
2326
  return entry.isFile() ? [path] : [];
2327
2327
  }));
2328
2328
  return nested.flat();
2329
2329
  };
2330
- var fingerprintAbsoluteIosNativeProject = async (nativeDirectory) => {
2330
+ var fingerprintAbsoluteIosNativeProject = async (nativeDirectory, options = {}) => {
2331
2331
  const hasher = createHash5("sha256");
2332
- const files = await fingerprintFiles(nativeDirectory);
2332
+ const files = await fingerprintFiles(nativeDirectory, nativeDirectory, options);
2333
2333
  const contents = await Promise.all(files.map((file) => readFile5(file)));
2334
2334
  files.forEach((file, index) => {
2335
2335
  hasher.update(relative4(nativeDirectory, file).replaceAll("\\", "/"));
@@ -3095,7 +3095,7 @@ var writeNativeCache = async (projectRoot, cache) => {
3095
3095
  });
3096
3096
  }
3097
3097
  };
3098
- var fingerprintAbsoluteIosDevProject = async (project) => fingerprintAbsoluteIosNativeProject(project.nativeDirectory);
3098
+ var fingerprintAbsoluteIosDevProject = async (project, options = {}) => fingerprintAbsoluteIosNativeProject(project.nativeDirectory, options);
3099
3099
  var simulatorInventory = (xcrun, capture) => {
3100
3100
  const result = capture([
3101
3101
  xcrun,
@@ -3503,10 +3503,13 @@ var startAbsoluteIosDevSession = async (options) => {
3503
3503
  transition("syncing");
3504
3504
  await requireSuccess2([project.cap, "sync", "ios"], "Capacitor iOS synchronization", run, { cwd: project.projectRoot, signal: options.signal });
3505
3505
  transition("configuring");
3506
- await writeDevProjection(project, options.port, options.https === true, serverHost);
3506
+ if (options.embeddedBundle !== true)
3507
+ await writeDevProjection(project, options.port, options.https === true, serverHost);
3507
3508
  throwIfAborted2(options.signal);
3508
3509
  const fingerprintStartedAt = performance.now();
3509
- const fingerprintPromise = fingerprintAbsoluteIosDevProject(project).then((fingerprint2) => {
3510
+ const fingerprintPromise = fingerprintAbsoluteIosDevProject(project, {
3511
+ includePublicBundle: options.embeddedBundle === true
3512
+ }).then((fingerprint2) => {
3510
3513
  timings.fingerprinting = performance.now() - fingerprintStartedAt;
3511
3514
  return fingerprint2;
3512
3515
  });
@@ -3567,7 +3570,7 @@ var startAbsoluteIosDevSession = async (options) => {
3567
3570
  await requireSuccess2(iosLaunchCommand(project, udid, deviceIdentifier !== undefined), "iOS app launch", run, { signal: options.signal });
3568
3571
  transition("ready");
3569
3572
  timings.total = performance.now() - startedAt;
3570
- log(`iOS ${targetKind} connected with HMR on port ${options.port} in ${getDurationString(timings.total)} (${nativeCacheHit ? "native cache hit" : "native build installed"}).`);
3573
+ log(options.embeddedBundle === true ? `iOS ${targetKind} connected with the embedded bundle and backend on port ${options.port} in ${getDurationString(timings.total)} (${nativeCacheHit ? "native cache hit" : "native build installed"}).` : `iOS ${targetKind} connected with HMR on port ${options.port} in ${getDurationString(timings.total)} (${nativeCacheHit ? "native cache hit" : "native build installed"}).`);
3571
3574
  log(`iOS startup: ${timingSummary(timings)}.`);
3572
3575
  let closed = false;
3573
3576
  const close = async () => {
@@ -7820,5 +7823,5 @@ export {
7820
7823
  ABSOLUTE_ANDROID_RELEASE_FORMAT
7821
7824
  };
7822
7825
 
7823
- //# debugId=D998DAA8591F90D464756E2164756E21
7826
+ //# debugId=4CA02552B071DAEC64756E2164756E21
7824
7827
  //# sourceMappingURL=index.js.map