@absolutejs/absolute 0.20.0-beta.116 → 0.20.0-beta.118
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/CHANGELOG.md +17 -0
- package/changelog.json +34 -1
- package/dist/angular/components/core/streamingSlotRegistrar.js +1 -1
- package/dist/angular/components/core/streamingSlotRegistry.js +2 -2
- package/dist/build.js +12 -10
- package/dist/build.js.map +7 -6
- package/dist/cli/{androidEmulatorController-nybhzc6c.js → androidEmulatorController-v6chbhem.js} +2 -2
- package/dist/cli/{androidNativeWatcher-2930tb8c.js → androidNativeWatcher-mgqws6ag.js} +2 -2
- package/dist/cli/{compile-kbhxgjat.js → compile-5m830csy.js} +2 -2
- package/dist/cli/{dev-daa7tdht.js → dev-ww30tdrv.js} +10 -7
- package/dist/cli/{expoProject-kcfcmfba.js → expoProject-w2pzjwnx.js} +1 -1
- package/dist/cli/{index-28pbrd3q.js → index-18q9qc7f.js} +15 -2
- package/dist/cli/{index-vjepnxr0.js → index-5268nwjx.js} +1 -1
- package/dist/cli/{index-5skbydh0.js → index-hneb973j.js} +1 -1
- package/dist/cli/{index-82wpxhvv.js → index-k8r00xh9.js} +1 -1
- package/dist/cli/{index-bhcxtf1x.js → index-nxcwg9ma.js} +268 -141
- package/dist/cli/{index-qr0pc777.js → index-wtyg9cy0.js} +1 -1
- package/dist/cli/index.js +5 -5
- package/dist/cli/{iosNativeWatcher-t6gv0p1w.js → iosNativeWatcher-8w1gawg4.js} +2 -2
- package/dist/cli/{iosSimulatorController-5n2a9fxv.js → iosSimulatorController-5vhqvhg6.js} +2 -2
- package/dist/cli/{mobile-03zwncxx.js → mobile-21vsmrjd.js} +28 -39
- package/dist/cli/{start-r606d5v9.js → start-3bhf56tj.js} +3 -3
- package/dist/index.js +15 -12
- package/dist/index.js.map +8 -7
- package/dist/mobile/index.js +207 -100
- package/dist/mobile/index.js.map +6 -5
- package/dist/mobile/remoteMacAgentEntry.js +251 -184
- package/dist/src/dev/serverEntryCopies.d.ts +2 -0
- package/dist/src/mobile/capacitorProject.d.ts +4 -0
- package/dist/src/mobile/nativePackages.d.ts +10 -0
- package/package.json +5 -3
|
@@ -16,17 +16,80 @@ import {
|
|
|
16
16
|
mkdir as mkdir2,
|
|
17
17
|
mkdtemp,
|
|
18
18
|
readdir,
|
|
19
|
-
readFile as
|
|
19
|
+
readFile as readFile3,
|
|
20
20
|
rename as rename2,
|
|
21
21
|
rm as rm2,
|
|
22
22
|
writeFile as writeFile2
|
|
23
23
|
} from "fs/promises";
|
|
24
24
|
import { createHash as createHash3 } from "crypto";
|
|
25
|
-
import { basename, dirname as
|
|
25
|
+
import { basename, dirname as dirname4, join as join8, relative as relative3, resolve as resolve5, sep } from "path";
|
|
26
|
+
|
|
27
|
+
// src/mobile/nativePackages.ts
|
|
28
|
+
import { readFile } from "fs/promises";
|
|
29
|
+
import { dirname, join, resolve } from "path";
|
|
30
|
+
var ABSOLUTE_CAPACITOR_DEVICES_VERSION = "0.8.0";
|
|
31
|
+
var ABSOLUTE_CAPACITOR_SYNC_VERSION = "0.9.3";
|
|
32
|
+
var ABSOLUTE_DEVICES_VERSION = "0.7.0";
|
|
33
|
+
var ABSOLUTE_EXPO_DEVICES_VERSION = "0.0.11";
|
|
34
|
+
var ABSOLUTE_NATIVE_EXACT_PACKAGES = new Set([
|
|
35
|
+
"@absolutejs/devices",
|
|
36
|
+
"@absolutejs/devices-capacitor",
|
|
37
|
+
"@absolutejs/sync-capacitor"
|
|
38
|
+
]);
|
|
39
|
+
var CAPACITOR_PACKAGE_SPECS = [
|
|
40
|
+
"@capacitor/core@8.5.0",
|
|
41
|
+
"@capacitor/app@8.1.1",
|
|
42
|
+
"@capacitor/browser@8.0.4",
|
|
43
|
+
"@capacitor/network@8.0.1",
|
|
44
|
+
"@capacitor/preferences@8.0.1",
|
|
45
|
+
"@capacitor/cli@8.5.0",
|
|
46
|
+
"@capacitor/android@8.5.0",
|
|
47
|
+
"@capacitor/ios@8.5.0",
|
|
48
|
+
`@absolutejs/devices@${ABSOLUTE_DEVICES_VERSION}`,
|
|
49
|
+
`@absolutejs/devices-capacitor@${ABSOLUTE_CAPACITOR_DEVICES_VERSION}`
|
|
50
|
+
];
|
|
51
|
+
var CAPACITOR_SYNC_PACKAGE_SPECS = [
|
|
52
|
+
`@absolutejs/sync-capacitor@${ABSOLUTE_CAPACITOR_SYNC_VERSION}`,
|
|
53
|
+
"@capacitor-community/sqlite@8.1.1"
|
|
54
|
+
];
|
|
55
|
+
var resolvedPackageVersion = async (projectRoot, name) => {
|
|
56
|
+
const directory = resolve(projectRoot);
|
|
57
|
+
let source;
|
|
58
|
+
try {
|
|
59
|
+
source = await readFile(join(directory, "node_modules", name, "package.json"), "utf8");
|
|
60
|
+
} catch (error) {
|
|
61
|
+
if (!(error instanceof Error) || !("code" in error) || error.code !== "ENOENT")
|
|
62
|
+
return;
|
|
63
|
+
const parent = dirname(directory);
|
|
64
|
+
return parent === directory ? undefined : resolvedPackageVersion(parent, name);
|
|
65
|
+
}
|
|
66
|
+
try {
|
|
67
|
+
const manifest = JSON.parse(source);
|
|
68
|
+
return typeof manifest === "object" && manifest !== null ? Reflect.get(manifest, "version") : undefined;
|
|
69
|
+
} catch {
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
var assertNativePackageVersions = async (projectRoot, specs, exactPackages) => {
|
|
74
|
+
const stale = await packagesNeedingExactInstall(projectRoot, specs, new Set(specs.map(packageNameFromSpec)), exactPackages);
|
|
75
|
+
if (stale.length > 0)
|
|
76
|
+
throw new TypeError(`Native dependency installation did not resolve the tested versions: ${stale.join(", ")}. A stale workspace-local installation may be shadowing hoisted packages. Restore a clean dependency installation for this app/workspace with your package manager, then retry absolute mobile init or sync. A forced install alone may leave obsolete workspace-local copies in place.`);
|
|
77
|
+
};
|
|
78
|
+
var packageNameFromSpec = (spec) => spec.slice(0, spec.lastIndexOf("@"));
|
|
79
|
+
var packagesNeedingExactInstall = async (projectRoot, specs, installed, exactPackages) => (await Promise.all(specs.map(async (spec) => {
|
|
80
|
+
const name = packageNameFromSpec(spec);
|
|
81
|
+
if (!installed.has(name))
|
|
82
|
+
return spec;
|
|
83
|
+
if (!exactPackages.has(name))
|
|
84
|
+
return;
|
|
85
|
+
if (await resolvedPackageVersion(projectRoot, name) === spec.slice(spec.lastIndexOf("@") + 1))
|
|
86
|
+
return;
|
|
87
|
+
return spec;
|
|
88
|
+
}))).filter((spec) => spec !== undefined);
|
|
26
89
|
|
|
27
90
|
// src/mobile/syncSchema.ts
|
|
28
91
|
import { readFileSync } from "fs";
|
|
29
|
-
import { dirname, join, resolve } from "path";
|
|
92
|
+
import { dirname as dirname2, join as join2, resolve as resolve2 } from "path";
|
|
30
93
|
|
|
31
94
|
// node_modules/@absolutejs/sync/dist/client/index.js
|
|
32
95
|
var RUNTIME_TRANSPORT = Symbol.for("@absolutejs/sync/client-runtime-transport");
|
|
@@ -183,13 +246,13 @@ var localSchemaMetadata = (manifest) => {
|
|
|
183
246
|
return Reflect.get(sync, "localSchema");
|
|
184
247
|
};
|
|
185
248
|
var packageManifestPath = (projectRoot, packageName) => {
|
|
186
|
-
let directory =
|
|
249
|
+
let directory = resolve2(projectRoot);
|
|
187
250
|
while (true) {
|
|
188
|
-
const candidate =
|
|
251
|
+
const candidate = join2(directory, "node_modules", packageName, "package.json");
|
|
189
252
|
const manifest = manifestAt(candidate);
|
|
190
253
|
if (manifest && Reflect.get(manifest, "name") === packageName)
|
|
191
254
|
return candidate;
|
|
192
|
-
const parent =
|
|
255
|
+
const parent = dirname2(directory);
|
|
193
256
|
if (parent === directory)
|
|
194
257
|
return;
|
|
195
258
|
directory = parent;
|
|
@@ -428,7 +491,7 @@ var dependencyNames = (manifest) => [
|
|
|
428
491
|
Reflect.get(manifest, "peerDependencies")
|
|
429
492
|
].flatMap((dependencies) => object(dependencies) ? Object.keys(dependencies) : []).filter((name, index, names) => names.indexOf(name) === index).sort();
|
|
430
493
|
var discoverAbsoluteSyncSchema = (projectRoot) => {
|
|
431
|
-
const appManifestPath =
|
|
494
|
+
const appManifestPath = join2(resolve2(projectRoot), "package.json");
|
|
432
495
|
const appManifest = manifestAt(appManifestPath);
|
|
433
496
|
if (!appManifest)
|
|
434
497
|
return {
|
|
@@ -469,7 +532,7 @@ var discoverAbsoluteSyncSchema = (projectRoot) => {
|
|
|
469
532
|
|
|
470
533
|
// src/mobile/deviceCapabilities.ts
|
|
471
534
|
import { existsSync, readFileSync as readFileSync2 } from "fs";
|
|
472
|
-
import { extname, join as
|
|
535
|
+
import { extname, join as join3, relative, resolve as resolve3 } from "path";
|
|
473
536
|
import { fileURLToPath } from "url";
|
|
474
537
|
import ts from "typescript";
|
|
475
538
|
var DEVICES_PACKAGE = "@absolutejs/devices";
|
|
@@ -644,7 +707,7 @@ var absoluteDeviceNativeRequirements = (plan) => {
|
|
|
644
707
|
};
|
|
645
708
|
var loadAbsoluteDeviceCapabilityProviders = (projectRoot, provider = "capacitor") => {
|
|
646
709
|
const adapter = ADAPTERS[provider];
|
|
647
|
-
let path =
|
|
710
|
+
let path = join3(resolve3(projectRoot), "node_modules", adapter, "package.json");
|
|
648
711
|
try {
|
|
649
712
|
readFileSync2(path, "utf8");
|
|
650
713
|
} catch {
|
|
@@ -702,7 +765,7 @@ var assertAbsoluteDeviceCapabilityPackages = (projectRoot, plan) => {
|
|
|
702
765
|
if (missing.includes(spec))
|
|
703
766
|
return false;
|
|
704
767
|
try {
|
|
705
|
-
return readJson(
|
|
768
|
+
return readJson(join3(resolve3(projectRoot), "node_modules", packageName, "package.json")).version !== spec.slice(separator + 1);
|
|
706
769
|
} catch {
|
|
707
770
|
return true;
|
|
708
771
|
}
|
|
@@ -712,7 +775,7 @@ var assertAbsoluteDeviceCapabilityPackages = (projectRoot, plan) => {
|
|
|
712
775
|
throw new TypeError(`Device capabilities ${plan.capabilities.join(", ")} require ${unmet.join(", ")}. Run absolute mobile sync and approve the detected capability plugins.`);
|
|
713
776
|
};
|
|
714
777
|
var directAbsoluteProjectPackages = (projectRoot) => {
|
|
715
|
-
const manifest = readJson(
|
|
778
|
+
const manifest = readJson(join3(resolve3(projectRoot), "package.json"));
|
|
716
779
|
const packages = new Set;
|
|
717
780
|
for (const field of ["dependencies", "devDependencies"]) {
|
|
718
781
|
const dependencies = manifest[field];
|
|
@@ -723,16 +786,16 @@ var directAbsoluteProjectPackages = (projectRoot) => {
|
|
|
723
786
|
return packages;
|
|
724
787
|
};
|
|
725
788
|
var discoverAbsoluteDeviceCapabilities = (projectRoot, providers = loadAbsoluteDeviceCapabilityProviders(projectRoot)) => {
|
|
726
|
-
const root =
|
|
789
|
+
const root = resolve3(projectRoot);
|
|
727
790
|
if (!existsSync(root))
|
|
728
791
|
return [];
|
|
729
792
|
const known = new Set(Object.keys(providers));
|
|
730
793
|
const capabilities = new Set;
|
|
731
794
|
for (const path of SOURCE_GLOB.scanSync({ cwd: root })) {
|
|
732
|
-
const portable = relative(root,
|
|
795
|
+
const portable = relative(root, resolve3(root, path)).replaceAll("\\", "/");
|
|
733
796
|
if (isIgnored(portable))
|
|
734
797
|
continue;
|
|
735
|
-
const source = readFileSync2(
|
|
798
|
+
const source = readFileSync2(resolve3(root, portable), "utf8");
|
|
736
799
|
for (const name of importedCapabilities(source, portable))
|
|
737
800
|
if (known.has(name))
|
|
738
801
|
capabilities.add(name);
|
|
@@ -931,7 +994,7 @@ var resolveAbsoluteMobileUpdateRuntime = (config, projectRoot) => {
|
|
|
931
994
|
};
|
|
932
995
|
|
|
933
996
|
// src/mobile/expoNativeObservability.ts
|
|
934
|
-
import { join as
|
|
997
|
+
import { join as join4 } from "path";
|
|
935
998
|
var HEADER = `// Generated by AbsoluteJS. Edit absolute.config.ts, then run absolute mobile sync.
|
|
936
999
|
`;
|
|
937
1000
|
var XML_HEADER = `<!-- Generated by AbsoluteJS. Edit absolute.config.ts, then run absolute mobile sync. -->
|
|
@@ -1373,31 +1436,31 @@ export const enqueueAbsoluteExpoNativeObservabilityForTesting = async (testId: s
|
|
|
1373
1436
|
`;
|
|
1374
1437
|
var absoluteExpoNativeObservabilityFiles = (project) => new Map([
|
|
1375
1438
|
[
|
|
1376
|
-
|
|
1439
|
+
join4(project, "modules/absolute-mobile-observability/expo-module.config.json"),
|
|
1377
1440
|
moduleConfig
|
|
1378
1441
|
],
|
|
1379
1442
|
[
|
|
1380
|
-
|
|
1443
|
+
join4(project, "modules/absolute-mobile-observability/ios/AbsoluteMobileObservability.podspec"),
|
|
1381
1444
|
podspec
|
|
1382
1445
|
],
|
|
1383
1446
|
[
|
|
1384
|
-
|
|
1447
|
+
join4(project, "modules/absolute-mobile-observability/ios/AbsoluteMobileObservabilityModule.swift"),
|
|
1385
1448
|
iosModule
|
|
1386
1449
|
],
|
|
1387
1450
|
[
|
|
1388
|
-
|
|
1451
|
+
join4(project, "modules/absolute-mobile-observability/android/build.gradle"),
|
|
1389
1452
|
androidBuild
|
|
1390
1453
|
],
|
|
1391
1454
|
[
|
|
1392
|
-
|
|
1455
|
+
join4(project, "modules/absolute-mobile-observability/android/src/main/AndroidManifest.xml"),
|
|
1393
1456
|
androidManifest
|
|
1394
1457
|
],
|
|
1395
1458
|
[
|
|
1396
|
-
|
|
1459
|
+
join4(project, "modules/absolute-mobile-observability/android/src/main/java/expo/modules/absolutemobileobservability/AbsoluteMobileObservabilityModule.kt"),
|
|
1397
1460
|
androidModule
|
|
1398
1461
|
],
|
|
1399
1462
|
[
|
|
1400
|
-
|
|
1463
|
+
join4(project, "src/generated/AbsoluteNativeObservability.ts"),
|
|
1401
1464
|
expoNativeObservabilityRuntimeSource
|
|
1402
1465
|
]
|
|
1403
1466
|
]);
|
|
@@ -1406,7 +1469,7 @@ var absoluteExpoNativeObservabilityPaths = (project) => [
|
|
|
1406
1469
|
];
|
|
1407
1470
|
|
|
1408
1471
|
// src/mobile/expoActivityResultRecovery.ts
|
|
1409
|
-
import { join as
|
|
1472
|
+
import { join as join5 } from "path";
|
|
1410
1473
|
var HEADER2 = `// Generated by AbsoluteJS. Edit absolute.config.ts, then run absolute mobile sync.
|
|
1411
1474
|
`;
|
|
1412
1475
|
var XML_HEADER2 = `<!-- Generated by AbsoluteJS. Edit absolute.config.ts, then run absolute mobile sync. -->
|
|
@@ -1643,37 +1706,37 @@ export const takeAbsoluteActivityResultCancellation = () =>
|
|
|
1643
1706
|
`;
|
|
1644
1707
|
var absoluteExpoActivityResultRecoveryFiles = (project) => new Map([
|
|
1645
1708
|
[
|
|
1646
|
-
|
|
1709
|
+
join5(project, "modules/absolute-activity-result-recovery/expo-module.config.json"),
|
|
1647
1710
|
moduleConfig2
|
|
1648
1711
|
],
|
|
1649
1712
|
[
|
|
1650
|
-
|
|
1713
|
+
join5(project, "modules/absolute-activity-result-recovery/ios/AbsoluteActivityResultRecovery.podspec"),
|
|
1651
1714
|
podspec2
|
|
1652
1715
|
],
|
|
1653
1716
|
[
|
|
1654
|
-
|
|
1717
|
+
join5(project, "modules/absolute-activity-result-recovery/ios/AbsoluteActivityResultRecoveryModule.swift"),
|
|
1655
1718
|
iosModule2
|
|
1656
1719
|
],
|
|
1657
1720
|
[
|
|
1658
|
-
|
|
1721
|
+
join5(project, "modules/absolute-activity-result-recovery/android/build.gradle"),
|
|
1659
1722
|
androidBuild2
|
|
1660
1723
|
],
|
|
1661
1724
|
[
|
|
1662
|
-
|
|
1725
|
+
join5(project, "modules/absolute-activity-result-recovery/android/src/main/AndroidManifest.xml"),
|
|
1663
1726
|
androidManifest2
|
|
1664
1727
|
],
|
|
1665
1728
|
[
|
|
1666
|
-
|
|
1729
|
+
join5(project, "modules/absolute-activity-result-recovery/android/src/main/java/expo/modules/absoluteactivityresultrecovery/AbsoluteActivityResultRecoveryModule.kt"),
|
|
1667
1730
|
androidModule2
|
|
1668
1731
|
],
|
|
1669
1732
|
[
|
|
1670
|
-
|
|
1733
|
+
join5(project, "src/generated/AbsoluteActivityResultRecovery.ts"),
|
|
1671
1734
|
runtime
|
|
1672
1735
|
]
|
|
1673
1736
|
]);
|
|
1674
1737
|
|
|
1675
1738
|
// src/mobile/expoEmbeddedAssets.ts
|
|
1676
|
-
import { join as
|
|
1739
|
+
import { join as join6 } from "path";
|
|
1677
1740
|
var header = `// Generated by AbsoluteJS. Edit absolute.config.ts, then run absolute mobile sync.
|
|
1678
1741
|
`;
|
|
1679
1742
|
var android = `${header}package expo.modules.absoluteembeddedassets
|
|
@@ -1887,10 +1950,10 @@ export const registerAbsoluteEmbeddedBundle = async (rootUri: string, paths: str
|
|
|
1887
1950
|
};
|
|
1888
1951
|
`;
|
|
1889
1952
|
var absoluteExpoEmbeddedAssetsFiles = (project) => {
|
|
1890
|
-
const root =
|
|
1953
|
+
const root = join6(project, "modules/absolute-embedded-assets");
|
|
1891
1954
|
return new Map([
|
|
1892
1955
|
[
|
|
1893
|
-
|
|
1956
|
+
join6(root, "expo-module.config.json"),
|
|
1894
1957
|
`${JSON.stringify({
|
|
1895
1958
|
android: {
|
|
1896
1959
|
modules: [
|
|
@@ -1902,7 +1965,7 @@ var absoluteExpoEmbeddedAssetsFiles = (project) => {
|
|
|
1902
1965
|
`
|
|
1903
1966
|
],
|
|
1904
1967
|
[
|
|
1905
|
-
|
|
1968
|
+
join6(root, "android/build.gradle"),
|
|
1906
1969
|
`${header}plugins { id 'com.android.library'; id 'expo-module-gradle-plugin' }
|
|
1907
1970
|
group = 'expo.modules.absoluteembeddedassets'
|
|
1908
1971
|
version = '0.0.1'
|
|
@@ -1918,16 +1981,16 @@ dependencies {
|
|
|
1918
1981
|
`
|
|
1919
1982
|
],
|
|
1920
1983
|
[
|
|
1921
|
-
|
|
1984
|
+
join6(root, "android/src/main/AndroidManifest.xml"),
|
|
1922
1985
|
`<manifest xmlns:android="http://schemas.android.com/apk/res/android" />
|
|
1923
1986
|
`
|
|
1924
1987
|
],
|
|
1925
1988
|
[
|
|
1926
|
-
|
|
1989
|
+
join6(root, "android/src/main/java/expo/modules/absoluteembeddedassets/AbsoluteEmbeddedAssetsModule.kt"),
|
|
1927
1990
|
android
|
|
1928
1991
|
],
|
|
1929
|
-
[
|
|
1930
|
-
[
|
|
1992
|
+
[join6(project, "plugins/withAbsoluteEmbeddedAssets.js"), plugin],
|
|
1993
|
+
[join6(project, "src/generated/AbsoluteEmbeddedAssets.ts"), runtime2]
|
|
1931
1994
|
]);
|
|
1932
1995
|
};
|
|
1933
1996
|
|
|
@@ -1937,12 +2000,12 @@ import {
|
|
|
1937
2000
|
access,
|
|
1938
2001
|
copyFile,
|
|
1939
2002
|
mkdir,
|
|
1940
|
-
readFile,
|
|
2003
|
+
readFile as readFile2,
|
|
1941
2004
|
rename,
|
|
1942
2005
|
rm,
|
|
1943
2006
|
writeFile
|
|
1944
2007
|
} from "fs/promises";
|
|
1945
|
-
import { dirname as
|
|
2008
|
+
import { dirname as dirname3, join as join7, relative as relative2, resolve as resolve4 } from "path";
|
|
1946
2009
|
var ABSOLUTE_MOBILE_BRANDING_FORMAT = 1;
|
|
1947
2010
|
var ABSOLUTE_CAPACITOR_ASSETS_VERSION = "3.0.5";
|
|
1948
2011
|
var ABSOLUTE_CAPACITOR_ASSETS_SPEC = `@capacitor/assets@${ABSOLUTE_CAPACITOR_ASSETS_VERSION}`;
|
|
@@ -1966,7 +2029,7 @@ var exists = async (path) => {
|
|
|
1966
2029
|
}
|
|
1967
2030
|
};
|
|
1968
2031
|
var portableRelative = (root, path) => relative2(root, path).replaceAll("\\", "/");
|
|
1969
|
-
var absoluteMobileBrandingManifestPath = (projectRoot) =>
|
|
2032
|
+
var absoluteMobileBrandingManifestPath = (projectRoot) => join7(resolve4(projectRoot), ".absolutejs", "mobile", "branding", "manifest.json");
|
|
1970
2033
|
var brandingEntries = (branding) => [
|
|
1971
2034
|
{ kind: "icon", path: branding.icon, size: ICON_SIZE },
|
|
1972
2035
|
branding.android.foreground ? {
|
|
@@ -2006,7 +2069,7 @@ var brandingEntries = (branding) => [
|
|
|
2006
2069
|
} : undefined
|
|
2007
2070
|
].filter((entry) => entry !== undefined);
|
|
2008
2071
|
var inspectSource = async (projectRoot, entry) => {
|
|
2009
|
-
const buffer = await
|
|
2072
|
+
const buffer = await readFile2(entry.path);
|
|
2010
2073
|
if (buffer.byteLength > MAX_SOURCE_BYTES)
|
|
2011
2074
|
throw new TypeError(`mobile.branding ${entry.kind} exceeds the 32 MiB source limit.`);
|
|
2012
2075
|
let metadata;
|
|
@@ -2059,7 +2122,7 @@ var createAbsoluteMobileBrandingManifest = async (config, projectRoot) => {
|
|
|
2059
2122
|
};
|
|
2060
2123
|
var writeManifest = async (projectRoot, manifest) => {
|
|
2061
2124
|
const destination = absoluteMobileBrandingManifestPath(projectRoot);
|
|
2062
|
-
await mkdir(
|
|
2125
|
+
await mkdir(dirname3(destination), { recursive: true });
|
|
2063
2126
|
const temporary = `${destination}.${crypto.randomUUID()}.tmp`;
|
|
2064
2127
|
await writeFile(temporary, `${JSON.stringify(manifest, null, 2)}
|
|
2065
2128
|
`, {
|
|
@@ -2069,7 +2132,7 @@ var writeManifest = async (projectRoot, manifest) => {
|
|
|
2069
2132
|
return destination;
|
|
2070
2133
|
};
|
|
2071
2134
|
var copyManaged = async (source, destination) => {
|
|
2072
|
-
await mkdir(
|
|
2135
|
+
await mkdir(dirname3(destination), { recursive: true });
|
|
2073
2136
|
await copyFile(source, destination);
|
|
2074
2137
|
};
|
|
2075
2138
|
var absoluteExpoBrandingConfig = (config) => {
|
|
@@ -2113,10 +2176,10 @@ var writeAbsoluteExpoBrandingInputs = async (config, projectRoot) => {
|
|
|
2113
2176
|
if (!branding)
|
|
2114
2177
|
return;
|
|
2115
2178
|
const manifest = await createAbsoluteMobileBrandingManifest(config, projectRoot);
|
|
2116
|
-
const destination =
|
|
2179
|
+
const destination = join7(config.nativeProjectDirectory, "assets", "absolute-branding");
|
|
2117
2180
|
await rm(destination, { force: true, recursive: true });
|
|
2118
2181
|
await mkdir(destination, { recursive: true });
|
|
2119
|
-
await copyManaged(branding.icon,
|
|
2182
|
+
await copyManaged(branding.icon, join7(destination, "icon.png"));
|
|
2120
2183
|
const copies = [
|
|
2121
2184
|
[branding.android.backgroundImage, "android-background.png"],
|
|
2122
2185
|
[branding.android.foreground, "android-foreground.png"],
|
|
@@ -2126,19 +2189,19 @@ var writeAbsoluteExpoBrandingInputs = async (config, projectRoot) => {
|
|
|
2126
2189
|
[branding.splash.image, "splash-light.png"],
|
|
2127
2190
|
[branding.splash.darkImage, "splash-dark.png"]
|
|
2128
2191
|
];
|
|
2129
|
-
await Promise.all(copies.map(([source, name]) => source ? copyManaged(source,
|
|
2192
|
+
await Promise.all(copies.map(([source, name]) => source ? copyManaged(source, join7(destination, name)) : undefined));
|
|
2130
2193
|
await writeManifest(projectRoot, manifest);
|
|
2131
2194
|
return { manifest, path: destination };
|
|
2132
2195
|
};
|
|
2133
2196
|
var stageCapacitorInputs = async (branding, projectRoot) => {
|
|
2134
|
-
const destination =
|
|
2197
|
+
const destination = join7(projectRoot, ".absolutejs", "mobile", "branding", "input");
|
|
2135
2198
|
await rm(destination, { force: true, recursive: true });
|
|
2136
2199
|
await mkdir(destination, { recursive: true });
|
|
2137
|
-
await copyManaged(branding.icon,
|
|
2200
|
+
await copyManaged(branding.icon, join7(destination, "logo.png"));
|
|
2138
2201
|
if (branding.splash.image)
|
|
2139
|
-
await copyManaged(branding.splash.image,
|
|
2202
|
+
await copyManaged(branding.splash.image, join7(destination, "splash.png"));
|
|
2140
2203
|
if (branding.splash.darkImage)
|
|
2141
|
-
await copyManaged(branding.splash.darkImage,
|
|
2204
|
+
await copyManaged(branding.splash.darkImage, join7(destination, "splash-dark.png"));
|
|
2142
2205
|
return destination;
|
|
2143
2206
|
};
|
|
2144
2207
|
var defaultRunner = async (command, options) => {
|
|
@@ -2164,21 +2227,21 @@ ${stderr}`))
|
|
|
2164
2227
|
throw new TypeError("Capacitor asset generation reported an incomplete projection.");
|
|
2165
2228
|
};
|
|
2166
2229
|
var resizePng = async (source, destination, size) => {
|
|
2167
|
-
const output = await new Bun.Image(await
|
|
2168
|
-
await mkdir(
|
|
2230
|
+
const output = await new Bun.Image(await readFile2(source)).resize(size, size).png({ compressionLevel: 9 }).toBuffer();
|
|
2231
|
+
await mkdir(dirname3(destination), { recursive: true });
|
|
2169
2232
|
await writeFile(destination, output);
|
|
2170
2233
|
};
|
|
2171
2234
|
var applyAndroidLayers = async (branding, nativeDirectory) => {
|
|
2172
|
-
const resources =
|
|
2235
|
+
const resources = join7(nativeDirectory, "android", "app", "src", "main", "res");
|
|
2173
2236
|
await Promise.all(ANDROID_ADAPTIVE_SIZES.flatMap(([density, size]) => [
|
|
2174
2237
|
...branding.android.foreground ? [
|
|
2175
|
-
resizePng(branding.android.foreground,
|
|
2238
|
+
resizePng(branding.android.foreground, join7(resources, `mipmap-${density}`, "ic_launcher_foreground.png"), size)
|
|
2176
2239
|
] : [],
|
|
2177
2240
|
...branding.android.backgroundImage ? [
|
|
2178
|
-
resizePng(branding.android.backgroundImage,
|
|
2241
|
+
resizePng(branding.android.backgroundImage, join7(resources, `mipmap-${density}`, "ic_launcher_background.png"), size)
|
|
2179
2242
|
] : [],
|
|
2180
2243
|
...branding.android.monochrome ? [
|
|
2181
|
-
resizePng(branding.android.monochrome,
|
|
2244
|
+
resizePng(branding.android.monochrome, join7(resources, `mipmap-${density}`, "ic_launcher_monochrome.png"), size)
|
|
2182
2245
|
] : []
|
|
2183
2246
|
]));
|
|
2184
2247
|
if (!branding.android.monochrome)
|
|
@@ -2190,14 +2253,14 @@ var applyAndroidLayers = async (branding, nativeDirectory) => {
|
|
|
2190
2253
|
<monochrome android:drawable="@mipmap/ic_launcher_monochrome" />
|
|
2191
2254
|
</adaptive-icon>
|
|
2192
2255
|
`;
|
|
2193
|
-
await Promise.all(["ic_launcher.xml", "ic_launcher_round.xml"].map((name) => writeFile(
|
|
2256
|
+
await Promise.all(["ic_launcher.xml", "ic_launcher_round.xml"].map((name) => writeFile(join7(resources, "mipmap-anydpi-v26", name), iconXml)));
|
|
2194
2257
|
};
|
|
2195
2258
|
var applyIosAppearances = async (branding, nativeDirectory) => {
|
|
2196
2259
|
if (!branding.ios.darkIcon && !branding.ios.tintedIcon)
|
|
2197
2260
|
return;
|
|
2198
|
-
const assetSet =
|
|
2199
|
-
const contentsPath =
|
|
2200
|
-
const contents = JSON.parse(await
|
|
2261
|
+
const assetSet = join7(nativeDirectory, "ios", "App", "App", "Assets.xcassets", "AppIcon.appiconset");
|
|
2262
|
+
const contentsPath = join7(assetSet, "Contents.json");
|
|
2263
|
+
const contents = JSON.parse(await readFile2(contentsPath, "utf8"));
|
|
2201
2264
|
const images = typeof contents === "object" && contents !== null ? Reflect.get(contents, "images") : undefined;
|
|
2202
2265
|
if (typeof contents !== "object" || contents === null || !Array.isArray(images))
|
|
2203
2266
|
throw new TypeError("Generated iOS AppIcon Contents.json is invalid.");
|
|
@@ -2209,7 +2272,7 @@ var applyIosAppearances = async (branding, nativeDirectory) => {
|
|
|
2209
2272
|
if (!source)
|
|
2210
2273
|
return;
|
|
2211
2274
|
const filename = `AppIcon-1024-${appearance}.png`;
|
|
2212
|
-
await resizePng(source,
|
|
2275
|
+
await resizePng(source, join7(assetSet, filename), ICON_SIZE);
|
|
2213
2276
|
return {
|
|
2214
2277
|
appearances: [{ appearance: "luminosity", value: appearance }],
|
|
2215
2278
|
filename,
|
|
@@ -2231,7 +2294,7 @@ var applyIosAppearances = async (branding, nativeDirectory) => {
|
|
|
2231
2294
|
await writeFile(contentsPath, `${JSON.stringify(contents, null, 2)}
|
|
2232
2295
|
`);
|
|
2233
2296
|
};
|
|
2234
|
-
var nativeBrandingSentinels = (config, platforms) => platforms.map((platform) => platform === "android" ?
|
|
2297
|
+
var nativeBrandingSentinels = (config, platforms) => platforms.map((platform) => platform === "android" ? join7(config.nativeProjectDirectory, "android", "app", "src", "main", "res", "mipmap-xxxhdpi", "ic_launcher.png") : join7(config.nativeProjectDirectory, "ios", "App", "App", "Assets.xcassets", "AppIcon.appiconset", "AppIcon-512@2x.png"));
|
|
2235
2298
|
var requireGeneratedBranding = async (config, platforms) => {
|
|
2236
2299
|
const missing = (await Promise.all(nativeBrandingSentinels(config, platforms).map(async (path) => ({
|
|
2237
2300
|
path,
|
|
@@ -2251,7 +2314,7 @@ var reusableManifestPlatforms = (value, fingerprint) => {
|
|
|
2251
2314
|
var completedManifestPlatforms = async (manifest, manifestPath, generated) => {
|
|
2252
2315
|
let previousPlatforms = [];
|
|
2253
2316
|
try {
|
|
2254
|
-
const previous = JSON.parse(await
|
|
2317
|
+
const previous = JSON.parse(await readFile2(manifestPath, "utf8"));
|
|
2255
2318
|
previousPlatforms = reusableManifestPlatforms(previous, manifest.fingerprint);
|
|
2256
2319
|
} catch {}
|
|
2257
2320
|
const completed = new Set([...generated, ...previousPlatforms]);
|
|
@@ -2276,9 +2339,9 @@ var generateAbsoluteCapacitorBranding = async (config, projectRoot, options = {}
|
|
|
2276
2339
|
"--assetPath",
|
|
2277
2340
|
portableRelative(projectRoot, input),
|
|
2278
2341
|
"--androidProject",
|
|
2279
|
-
portableRelative(projectRoot,
|
|
2342
|
+
portableRelative(projectRoot, join7(config.nativeProjectDirectory, "android")),
|
|
2280
2343
|
"--iosProject",
|
|
2281
|
-
portableRelative(projectRoot,
|
|
2344
|
+
portableRelative(projectRoot, join7(config.nativeProjectDirectory, "ios", "App")),
|
|
2282
2345
|
"--iconBackgroundColor",
|
|
2283
2346
|
branding.android.backgroundColor,
|
|
2284
2347
|
"--splashBackgroundColor",
|
|
@@ -2340,7 +2403,7 @@ var inspectAbsoluteMobileBranding = async (config, projectRoot) => {
|
|
|
2340
2403
|
});
|
|
2341
2404
|
}
|
|
2342
2405
|
try {
|
|
2343
|
-
const current = parseManifestState(JSON.parse(await
|
|
2406
|
+
const current = parseManifestState(JSON.parse(await readFile2(manifestPath, "utf8")));
|
|
2344
2407
|
if (current.fingerprint !== expected.fingerprint)
|
|
2345
2408
|
return brandingInspection({
|
|
2346
2409
|
configured: true,
|
|
@@ -2359,7 +2422,7 @@ var inspectAbsoluteMobileBranding = async (config, projectRoot) => {
|
|
|
2359
2422
|
status: "stale"
|
|
2360
2423
|
});
|
|
2361
2424
|
const nativeSentinels = config.engine === "expo" ? [
|
|
2362
|
-
|
|
2425
|
+
join7(config.nativeProjectDirectory, "assets", "absolute-branding", "icon.png")
|
|
2363
2426
|
] : nativeBrandingSentinels(config, config.platforms);
|
|
2364
2427
|
if ((await Promise.all(nativeSentinels.map((path) => exists(path)))).some((present) => !present))
|
|
2365
2428
|
return brandingInspection({
|
|
@@ -2392,8 +2455,8 @@ var renderAbsoluteMobileBrandingPreview = async (config, projectRoot) => {
|
|
|
2392
2455
|
const { branding } = config;
|
|
2393
2456
|
if (!branding)
|
|
2394
2457
|
throw new TypeError("mobile.branding is not configured.");
|
|
2395
|
-
const destination =
|
|
2396
|
-
const icon = `data:image/png;base64,${(await
|
|
2458
|
+
const destination = join7(projectRoot, ".absolutejs", "mobile", "branding", "preview.html");
|
|
2459
|
+
const icon = `data:image/png;base64,${(await readFile2(branding.icon)).toString("base64")}`;
|
|
2397
2460
|
const appName = escapeHtml(config.appName);
|
|
2398
2461
|
const html = `<!doctype html>
|
|
2399
2462
|
<meta charset="utf-8">
|
|
@@ -2402,7 +2465,7 @@ var renderAbsoluteMobileBrandingPreview = async (config, projectRoot) => {
|
|
|
2402
2465
|
<style>body{font:16px system-ui;margin:2rem;background:#eee;color:#111}main{display:flex;flex-wrap:wrap;gap:2rem}.card{background:white;border-radius:20px;padding:1.5rem;box-shadow:0 8px 30px #0002}.icon{width:192px;height:192px;object-fit:cover}.circle{border-radius:50%}.squircle{border-radius:24%}.splash{width:240px;height:480px;display:grid;place-items:center;background:${branding.splash.backgroundColor}}.splash img{width:${branding.splash.logoScale * 100}%}code{display:block;margin-top:1rem}</style>
|
|
2403
2466
|
<h1>${appName}</h1><main><section class="card"><img class="icon squircle" src="${icon}" alt="Square app icon preview"><code>Apple / legacy Android</code></section><section class="card"><img class="icon circle" src="${icon}" alt="Circular Android icon preview"><code>Android circular mask</code></section><section class="card splash"><img src="${icon}" alt="Launch screen preview"></section></main><p>Fingerprint: <code>${manifest.fingerprint}</code></p>
|
|
2404
2467
|
`;
|
|
2405
|
-
await mkdir(
|
|
2468
|
+
await mkdir(dirname3(destination), { recursive: true });
|
|
2406
2469
|
await writeFile(destination, html);
|
|
2407
2470
|
return destination;
|
|
2408
2471
|
};
|
|
@@ -2487,15 +2550,15 @@ var routeSegments = (route) => {
|
|
|
2487
2550
|
return segment;
|
|
2488
2551
|
});
|
|
2489
2552
|
};
|
|
2490
|
-
var routeFile = (project, route) =>
|
|
2553
|
+
var routeFile = (project, route) => join8(project, "app", ...routeSegments(route), "index.tsx");
|
|
2491
2554
|
var packageDependencies = (plan) => Object.fromEntries(plan.requiredPackages.map((spec) => {
|
|
2492
2555
|
const separator = spec.lastIndexOf("@");
|
|
2493
2556
|
return [spec.slice(0, separator), spec.slice(separator + 1)];
|
|
2494
2557
|
}));
|
|
2495
2558
|
var expoPackage = (auth, branding, sync, devices, updates) => ({
|
|
2496
2559
|
dependencies: {
|
|
2497
|
-
"@absolutejs/devices":
|
|
2498
|
-
"@absolutejs/devices-expo":
|
|
2560
|
+
"@absolutejs/devices": ABSOLUTE_DEVICES_VERSION,
|
|
2561
|
+
"@absolutejs/devices-expo": ABSOLUTE_EXPO_DEVICES_VERSION,
|
|
2499
2562
|
...auth ? {
|
|
2500
2563
|
"@absolutejs/auth": ABSOLUTE_EXPO_AUTH_CORE_VERSION,
|
|
2501
2564
|
[ABSOLUTE_EXPO_AUTH_PACKAGE]: ABSOLUTE_EXPO_AUTH_VERSION
|
|
@@ -3096,7 +3159,7 @@ import {
|
|
|
3096
3159
|
installExpoSyncLifecycle,
|
|
3097
3160
|
registerExpoSyncBackgroundTask
|
|
3098
3161
|
} from '@absolutejs/sync-expo';
|
|
3099
|
-
import
|
|
3162
|
+
import { reloadAppAsync } from 'expo';
|
|
3100
3163
|
import { absoluteExpoAuth, startAbsoluteExpoAuth } from './AbsoluteAuth';
|
|
3101
3164
|
|
|
3102
3165
|
const BACKGROUND_TASK = ${JSON.stringify(backgroundTask)};
|
|
@@ -3155,37 +3218,98 @@ absoluteExpoAuth.onPrincipalChange(principal => {
|
|
|
3155
3218
|
if (!started || principal?.namespace === activeNamespace) return;
|
|
3156
3219
|
const previousNamespace = activeNamespace;
|
|
3157
3220
|
installRuntimeTransport(principal);
|
|
3158
|
-
if (previousNamespace !== undefined) void
|
|
3221
|
+
if (previousNamespace !== undefined) void reloadAppAsync('absolutejs-auth-principal-changed').catch(() => {
|
|
3222
|
+
console.warn('AbsoluteJS could not reset the account runtime. Restart the app before continuing.');
|
|
3223
|
+
});
|
|
3159
3224
|
});
|
|
3160
3225
|
|
|
3161
3226
|
export const createAbsoluteExpoSyncBridge = async (
|
|
3162
3227
|
emit: (event: 'sync.socket' | 'sync.wake', payload: Record<string, unknown>) => void
|
|
3163
3228
|
) => {
|
|
3164
3229
|
await startAbsoluteExpoSync();
|
|
3165
|
-
const
|
|
3166
|
-
|
|
3167
|
-
|
|
3168
|
-
|
|
3230
|
+
const bind = (namespace: string, generation: number) => {
|
|
3231
|
+
const emitCurrent = (event: 'sync.socket' | 'sync.wake', payload: Record<string, unknown>) => {
|
|
3232
|
+
if (!closed && generation === revision) emit(event, payload);
|
|
3233
|
+
};
|
|
3234
|
+
const transactions = createExpoSyncBridgeHost({ createId: expoSyncRandomId, namespace, store });
|
|
3235
|
+
const sockets = createExpoSyncSocketBridgeHost({
|
|
3236
|
+
allowedOrigin: PRODUCTION_ORIGIN,
|
|
3237
|
+
emit: payload => emitCurrent('sync.socket', payload),
|
|
3238
|
+
socketTicket: async audience => {
|
|
3239
|
+
if (closed || generation !== revision) throw new Error('Expo Sync principal changed.');
|
|
3240
|
+
const ticket = await absoluteExpoAuth.socketTicket(audience);
|
|
3241
|
+
if (closed || generation !== revision) throw new Error('Expo Sync principal changed.');
|
|
3242
|
+
return ticket;
|
|
3243
|
+
}
|
|
3244
|
+
});
|
|
3245
|
+
const removeLifecycle = installExpoSyncLifecycle({
|
|
3246
|
+
client: { reconnect: () => emitCurrent('sync.wake', {}) }
|
|
3247
|
+
});
|
|
3248
|
+
return {
|
|
3249
|
+
close: async () => {
|
|
3250
|
+
removeLifecycle();
|
|
3251
|
+
await Promise.all([transactions.close(), sockets.close()]);
|
|
3252
|
+
},
|
|
3253
|
+
request: (method: string, params: Record<string, unknown>) =>
|
|
3254
|
+
method.startsWith('sync.socket.') ? sockets.request(method, params) : transactions.request(method, params)
|
|
3255
|
+
};
|
|
3169
3256
|
};
|
|
3170
|
-
|
|
3171
|
-
|
|
3172
|
-
|
|
3173
|
-
|
|
3174
|
-
|
|
3175
|
-
|
|
3176
|
-
const
|
|
3177
|
-
|
|
3178
|
-
|
|
3257
|
+
let closed = false;
|
|
3258
|
+
let revoked = false;
|
|
3259
|
+
let boundNamespace: string | undefined;
|
|
3260
|
+
let revision = 0;
|
|
3261
|
+
let bridge: ReturnType<typeof bind> | undefined;
|
|
3262
|
+
let ready = Promise.resolve();
|
|
3263
|
+
const replace = (principal: Awaited<ReturnType<typeof absoluteExpoAuth.principal>>) => {
|
|
3264
|
+
if (closed) return;
|
|
3265
|
+
// A mounted page may bind its first login, but must never inherit another
|
|
3266
|
+
// account's authority. Account changes require the existing runtime reload.
|
|
3267
|
+
if (boundNamespace !== undefined && principal?.namespace !== boundNamespace) revoked = true;
|
|
3268
|
+
const generation = ++revision;
|
|
3269
|
+
const previous = bridge;
|
|
3270
|
+
bridge = undefined;
|
|
3271
|
+
ready = ready.then(async () => {
|
|
3272
|
+
await previous?.close();
|
|
3273
|
+
if (!closed && !revoked && generation === revision && principal) {
|
|
3274
|
+
boundNamespace = principal.namespace;
|
|
3275
|
+
bridge = bind(principal.namespace, generation);
|
|
3276
|
+
}
|
|
3277
|
+
});
|
|
3278
|
+
// Keep background transitions handled; requests still observe setup failures.
|
|
3279
|
+
void ready.catch(() => undefined);
|
|
3280
|
+
};
|
|
3281
|
+
const stop = absoluteExpoAuth.onPrincipalChange(replace);
|
|
3282
|
+
try {
|
|
3283
|
+
const initialRevision = revision;
|
|
3284
|
+
const principal = await absoluteExpoAuth.principal();
|
|
3285
|
+
if (revision === initialRevision) replace(principal);
|
|
3286
|
+
await ready;
|
|
3287
|
+
} catch (error) {
|
|
3288
|
+
stop();
|
|
3289
|
+
closed = true;
|
|
3290
|
+
await bridge?.close();
|
|
3291
|
+
throw error;
|
|
3292
|
+
}
|
|
3179
3293
|
|
|
3180
3294
|
return {
|
|
3181
3295
|
close: async () => {
|
|
3182
|
-
|
|
3183
|
-
|
|
3296
|
+
if (closed) return;
|
|
3297
|
+
closed = true;
|
|
3298
|
+
++revision;
|
|
3299
|
+
stop();
|
|
3300
|
+
const previous = bridge;
|
|
3301
|
+
bridge = undefined;
|
|
3302
|
+
await Promise.all([ready, previous?.close()]);
|
|
3184
3303
|
},
|
|
3185
|
-
request: (method: string, params: Record<string, unknown>) =>
|
|
3186
|
-
|
|
3187
|
-
|
|
3188
|
-
|
|
3304
|
+
request: async (method: string, params: Record<string, unknown>) => {
|
|
3305
|
+
const generation = revision;
|
|
3306
|
+
await ready;
|
|
3307
|
+
if (closed || revoked || generation !== revision) throw new Error('Expo Sync principal changed.');
|
|
3308
|
+
if (!bridge) throw new Error('Expo Sync requires an authenticated principal.');
|
|
3309
|
+
const result = await bridge.request(method, params);
|
|
3310
|
+
if (closed || revoked || generation !== revision) throw new Error('Expo Sync principal changed.');
|
|
3311
|
+
return result;
|
|
3312
|
+
}
|
|
3189
3313
|
};
|
|
3190
3314
|
};
|
|
3191
3315
|
`;
|
|
@@ -3399,10 +3523,13 @@ export function AbsoluteWebHost({ path }: AbsoluteWebHostProps = {}) {
|
|
|
3399
3523
|
webView.current?.injectJavaScript(\`globalThis.__absoluteExpoReceive(\${JSON.stringify(source)}); true;\`);
|
|
3400
3524
|
});
|
|
3401
3525
|
void ${sync ? "startAbsoluteExpoSync" : "startAbsoluteExpoAuth"}().then(async () => {
|
|
3402
|
-
${sync ? `
|
|
3526
|
+
${sync ? `const bridge = await createAbsoluteExpoSyncBridge((event, payload) => {
|
|
3527
|
+
if (!active) return;
|
|
3403
3528
|
const source = JSON.stringify({ event, format: BRIDGE_FORMAT, kind: 'event', path: activeWebPath.current, payload });
|
|
3404
3529
|
webView.current?.injectJavaScript(\`globalThis.__absoluteExpoReceive(\${JSON.stringify(source)}); true;\`);
|
|
3405
|
-
})
|
|
3530
|
+
});
|
|
3531
|
+
if (!active) { await bridge.close(); return; }
|
|
3532
|
+
syncBridge.current = bridge;` : ""}
|
|
3406
3533
|
if (active) setRuntimeReady(true);
|
|
3407
3534
|
});
|
|
3408
3535
|
return () => {
|
|
@@ -3770,8 +3897,8 @@ const styles = StyleSheet.create({
|
|
|
3770
3897
|
error: { color: '#b91c1c', fontSize: 16, textAlign: 'center' }
|
|
3771
3898
|
});
|
|
3772
3899
|
`;
|
|
3773
|
-
var nativeWrapperSource = (wrapper, module, runtime3, route) => `${EXPO_GENERATED_HEADER}import ApplicationNativeRoute from ${JSON.stringify(portableRelative2(
|
|
3774
|
-
import { createAbsoluteNativeRoute, createAbsoluteNativeRouteErrorBoundary } from ${JSON.stringify(portableRelative2(
|
|
3900
|
+
var nativeWrapperSource = (wrapper, module, runtime3, route) => `${EXPO_GENERATED_HEADER}import ApplicationNativeRoute from ${JSON.stringify(portableRelative2(dirname4(wrapper), module).replace(/\.(?:[cm]?[jt]sx?)$/u, ""))};
|
|
3901
|
+
import { createAbsoluteNativeRoute, createAbsoluteNativeRouteErrorBoundary } from ${JSON.stringify(portableRelative2(dirname4(wrapper), runtime3).replace(/\.(?:[cm]?[jt]sx?)$/u, ""))};
|
|
3775
3902
|
|
|
3776
3903
|
export const ErrorBoundary = createAbsoluteNativeRouteErrorBoundary(${JSON.stringify(route)});
|
|
3777
3904
|
export default createAbsoluteNativeRoute(ApplicationNativeRoute, ${JSON.stringify(route)});
|
|
@@ -3813,9 +3940,9 @@ var expoTsConfig = (projectRoot, project, auth, sync) => ({
|
|
|
3813
3940
|
extends: "expo/tsconfig.base"
|
|
3814
3941
|
});
|
|
3815
3942
|
var writeManagedFile = async (path, source, force) => {
|
|
3816
|
-
await mkdir2(
|
|
3943
|
+
await mkdir2(dirname4(path), { recursive: true });
|
|
3817
3944
|
if (await exists2(path)) {
|
|
3818
|
-
const current = await
|
|
3945
|
+
const current = await readFile3(path, "utf8");
|
|
3819
3946
|
if (current === source)
|
|
3820
3947
|
return false;
|
|
3821
3948
|
if (!force && !current.startsWith(EXPO_GENERATED_HEADER)) {
|
|
@@ -3831,7 +3958,7 @@ var pruneManagedFiles = async (paths) => {
|
|
|
3831
3958
|
const removed = await Promise.all(paths.map(async (path) => {
|
|
3832
3959
|
if (!await exists2(path))
|
|
3833
3960
|
return false;
|
|
3834
|
-
const source = await
|
|
3961
|
+
const source = await readFile3(path, "utf8");
|
|
3835
3962
|
if (!source.startsWith(EXPO_GENERATED_HEADER) && !path.endsWith("expo-module.config.json"))
|
|
3836
3963
|
return false;
|
|
3837
3964
|
await rm2(path, { force: true });
|
|
@@ -3840,12 +3967,12 @@ var pruneManagedFiles = async (paths) => {
|
|
|
3840
3967
|
return removed.filter(Boolean).length;
|
|
3841
3968
|
};
|
|
3842
3969
|
var pruneStaleManagedExpoRoutes = async (project, expected) => {
|
|
3843
|
-
const appDirectory =
|
|
3970
|
+
const appDirectory = join8(project, "app");
|
|
3844
3971
|
if (!await exists2(appDirectory))
|
|
3845
3972
|
return 0;
|
|
3846
3973
|
const files = await walkFiles(appDirectory);
|
|
3847
3974
|
const stale = (await Promise.all(files.map(async (path) => ({
|
|
3848
|
-
managed: path.endsWith(".tsx") && (await
|
|
3975
|
+
managed: path.endsWith(".tsx") && (await readFile3(path, "utf8")).startsWith(EXPO_GENERATED_HEADER),
|
|
3849
3976
|
path
|
|
3850
3977
|
})))).filter(({ managed, path }) => managed && !expected.has(path));
|
|
3851
3978
|
await Promise.all(stale.map(({ path }) => rm2(path, { force: true })));
|
|
@@ -3871,7 +3998,7 @@ export const ABSOLUTE_MOBILE_MANIFEST: AbsoluteMobileManifest | undefined = unde
|
|
|
3871
3998
|
var writeAbsoluteExpoProject = async (config, options) => {
|
|
3872
3999
|
if (config.engine !== "expo")
|
|
3873
4000
|
throw new TypeError("Expo project generation requires mobile.engine: expo.");
|
|
3874
|
-
const projectRoot =
|
|
4001
|
+
const projectRoot = resolve5(options.projectRoot);
|
|
3875
4002
|
const project = config.nativeProjectDirectory;
|
|
3876
4003
|
const auth = resolveAbsoluteMobileAuthManifest(projectRoot, config);
|
|
3877
4004
|
const devices = resolveAbsoluteDeviceCapabilityPlan(projectRoot, "expo");
|
|
@@ -3888,7 +4015,7 @@ var writeAbsoluteExpoProject = async (config, options) => {
|
|
|
3888
4015
|
if (missing) {
|
|
3889
4016
|
throw new TypeError(`Expo native route ${missing.route} references missing module ${missing.module}.`);
|
|
3890
4017
|
}
|
|
3891
|
-
const marker =
|
|
4018
|
+
const marker = join8(project, EXPO_PROJECT_MARKER);
|
|
3892
4019
|
if (await exists2(project) && !await exists2(marker)) {
|
|
3893
4020
|
const entries = await readdir(project);
|
|
3894
4021
|
if (entries.length > 0 && !options.force) {
|
|
@@ -3901,7 +4028,7 @@ var writeAbsoluteExpoProject = async (config, options) => {
|
|
|
3901
4028
|
const authEnabled = Boolean(auth);
|
|
3902
4029
|
const files = new Map([
|
|
3903
4030
|
[
|
|
3904
|
-
|
|
4031
|
+
join8(project, ".gitignore"),
|
|
3905
4032
|
`.expo/
|
|
3906
4033
|
android/
|
|
3907
4034
|
ios/
|
|
@@ -3909,45 +4036,45 @@ node_modules/
|
|
|
3909
4036
|
`
|
|
3910
4037
|
],
|
|
3911
4038
|
[
|
|
3912
|
-
|
|
4039
|
+
join8(project, "app.json"),
|
|
3913
4040
|
jsonSource(expoAppConfig(config, authEnabled, syncEnabled, devices, runtimeFingerprint))
|
|
3914
4041
|
],
|
|
3915
|
-
[
|
|
4042
|
+
[join8(project, "app.config.js"), expoDynamicAppConfig],
|
|
3916
4043
|
[
|
|
3917
|
-
|
|
4044
|
+
join8(project, "package.json"),
|
|
3918
4045
|
jsonSource(expoPackage(authEnabled, config.branding !== undefined, syncEnabled, devices, config.updates !== undefined))
|
|
3919
4046
|
],
|
|
3920
|
-
[
|
|
4047
|
+
[join8(project, "metro.config.js"), metroConfig(projectRoot)],
|
|
3921
4048
|
[
|
|
3922
|
-
|
|
4049
|
+
join8(project, "plugins", "withAbsoluteDevelopmentCa.js"),
|
|
3923
4050
|
expoDevelopmentCaPlugin
|
|
3924
4051
|
],
|
|
3925
4052
|
[
|
|
3926
|
-
|
|
4053
|
+
join8(project, "plugins", "withAbsoluteActivityResultRecovery.js"),
|
|
3927
4054
|
expoActivityResultRecoveryPlugin
|
|
3928
4055
|
],
|
|
3929
4056
|
[
|
|
3930
|
-
|
|
4057
|
+
join8(project, "tsconfig.json"),
|
|
3931
4058
|
jsonSource(expoTsConfig(projectRoot, project, authEnabled, syncEnabled))
|
|
3932
4059
|
],
|
|
3933
4060
|
[
|
|
3934
|
-
|
|
4061
|
+
join8(project, "app", "_layout.tsx"),
|
|
3935
4062
|
layoutSource(authEnabled, syncEnabled, config.updates !== undefined, config.observability !== undefined)
|
|
3936
4063
|
],
|
|
3937
4064
|
[
|
|
3938
|
-
|
|
4065
|
+
join8(project, "app", "__absolute", "native", "index.tsx"),
|
|
3939
4066
|
nativeDiagnosticSource
|
|
3940
4067
|
],
|
|
3941
4068
|
[
|
|
3942
|
-
|
|
4069
|
+
join8(project, "src", "generated", "AbsoluteDevices.ts"),
|
|
3943
4070
|
devicesRuntimeSource(config, devices, authEnabled)
|
|
3944
4071
|
],
|
|
3945
4072
|
[
|
|
3946
|
-
|
|
4073
|
+
join8(project, "src", "generated", "AbsoluteNativeRoute.tsx"),
|
|
3947
4074
|
nativeRouteRuntimeSource(authEnabled)
|
|
3948
4075
|
],
|
|
3949
4076
|
[
|
|
3950
|
-
|
|
4077
|
+
join8(project, "src", "generated", "AbsoluteWebHost.tsx"),
|
|
3951
4078
|
webHostSource(config, auth, syncEnabled)
|
|
3952
4079
|
]
|
|
3953
4080
|
]);
|
|
@@ -3960,31 +4087,31 @@ node_modules/
|
|
|
3960
4087
|
files.set(path, source);
|
|
3961
4088
|
}
|
|
3962
4089
|
if (config.updates) {
|
|
3963
|
-
files.set(
|
|
4090
|
+
files.set(join8(project, "src", "generated", "AbsoluteUpdates.ts"), updatesRuntimeSource(config));
|
|
3964
4091
|
}
|
|
3965
4092
|
const expoCodeSigning = config.updates?.expoCodeSigning;
|
|
3966
4093
|
if (expoCodeSigning)
|
|
3967
|
-
files.set(
|
|
4094
|
+
files.set(join8(project, "certs", "absolute-mobile-update.pem"), expoCodeSigning.certificatePem);
|
|
3968
4095
|
if (auth) {
|
|
3969
|
-
files.set(
|
|
4096
|
+
files.set(join8(project, "src", "generated", "AbsoluteAuth.ts"), authRuntimeSource(auth, config.appId));
|
|
3970
4097
|
}
|
|
3971
4098
|
if (syncSchema) {
|
|
3972
|
-
files.set(
|
|
4099
|
+
files.set(join8(project, "src", "generated", "AbsoluteSync.ts"), syncRuntimeSource(config, syncSchema));
|
|
3973
4100
|
}
|
|
3974
|
-
const webAssetsPath =
|
|
4101
|
+
const webAssetsPath = join8(project, "src", "generated", "webAssets.ts");
|
|
3975
4102
|
if (!await exists2(webAssetsPath)) {
|
|
3976
4103
|
files.set(webAssetsPath, emptyWebAssetsSource);
|
|
3977
4104
|
}
|
|
3978
4105
|
if (!config.expoNativeRoutes["/"]) {
|
|
3979
|
-
files.set(
|
|
4106
|
+
files.set(join8(project, "app", "index.tsx"), webRouteSource);
|
|
3980
4107
|
}
|
|
3981
|
-
files.set(
|
|
3982
|
-
const nativeRouteRuntime =
|
|
4108
|
+
files.set(join8(project, "app", "[...absolute].tsx"), catchAllRouteSource);
|
|
4109
|
+
const nativeRouteRuntime = join8(project, "src", "generated", "AbsoluteNativeRoute.tsx");
|
|
3983
4110
|
for (const [route, module] of routeModules) {
|
|
3984
|
-
const wrapper = route === "/" ?
|
|
4111
|
+
const wrapper = route === "/" ? join8(project, "app", "index.tsx") : routeFile(project, route);
|
|
3985
4112
|
files.set(wrapper, nativeWrapperSource(wrapper, module, nativeRouteRuntime, route));
|
|
3986
4113
|
}
|
|
3987
|
-
const removedRoutes = await pruneStaleManagedExpoRoutes(project, new Set([...files.keys()].filter((path) => path.startsWith(`${
|
|
4114
|
+
const removedRoutes = await pruneStaleManagedExpoRoutes(project, new Set([...files.keys()].filter((path) => path.startsWith(`${join8(project, "app")}${sep}`))));
|
|
3988
4115
|
const removedObservability = config.observability ? 0 : await pruneManagedFiles(absoluteExpoNativeObservabilityPaths(project));
|
|
3989
4116
|
const changes = await Promise.all([...files].map(([path, source]) => writeManagedFile(path, source, true)));
|
|
3990
4117
|
await writeAbsoluteExpoBrandingInputs(config, projectRoot);
|
|
@@ -3994,7 +4121,7 @@ node_modules/
|
|
|
3994
4121
|
var walkFiles = async (root, directory = root) => {
|
|
3995
4122
|
const entries = await readdir(directory, { withFileTypes: true });
|
|
3996
4123
|
const nested = await Promise.all(entries.map((entry) => {
|
|
3997
|
-
const path =
|
|
4124
|
+
const path = join8(directory, entry.name);
|
|
3998
4125
|
if (entry.isDirectory())
|
|
3999
4126
|
return walkFiles(root, path);
|
|
4000
4127
|
if (entry.isFile())
|
|
@@ -4111,17 +4238,17 @@ export const materializeAbsoluteWebBundle = async () => {
|
|
|
4111
4238
|
var syncAbsoluteExpoWebAssets = async (config) => {
|
|
4112
4239
|
if (config.engine !== "expo")
|
|
4113
4240
|
throw new TypeError("Expo asset sync requires mobile.engine: expo.");
|
|
4114
|
-
const marker =
|
|
4241
|
+
const marker = join8(config.nativeProjectDirectory, EXPO_PROJECT_MARKER);
|
|
4115
4242
|
if (!await exists2(marker)) {
|
|
4116
4243
|
throw new TypeError("Expo asset sync requires an AbsoluteJS-managed Expo project. Run mobile init first.");
|
|
4117
4244
|
}
|
|
4118
|
-
const manifestPath =
|
|
4119
|
-
const manifest = JSON.parse(await
|
|
4245
|
+
const manifestPath = join8(config.bundleDirectory, "absolute-mobile-manifest.json");
|
|
4246
|
+
const manifest = JSON.parse(await readFile3(manifestPath, "utf8"));
|
|
4120
4247
|
const nativeDataManifest = expoNativeDataManifest(manifest);
|
|
4121
4248
|
const { appBuild } = nativeDataManifest;
|
|
4122
4249
|
const files = await walkFiles(config.bundleDirectory);
|
|
4123
4250
|
const bundleHash = createHash3("sha256");
|
|
4124
|
-
const filesWithContents = await Promise.all(files.map(async (file) => ({ contents: await
|
|
4251
|
+
const filesWithContents = await Promise.all(files.map(async (file) => ({ contents: await readFile3(file), file })));
|
|
4125
4252
|
filesWithContents.forEach(({ contents, file }) => {
|
|
4126
4253
|
bundleHash.update(relative3(config.bundleDirectory, file).replaceAll("\\", "/"));
|
|
4127
4254
|
bundleHash.update("\x00");
|
|
@@ -4129,9 +4256,9 @@ var syncAbsoluteExpoWebAssets = async (config) => {
|
|
|
4129
4256
|
bundleHash.update("\x00");
|
|
4130
4257
|
});
|
|
4131
4258
|
const bundleId = `amexpo_${bundleHash.digest("hex")}`;
|
|
4132
|
-
const destination =
|
|
4133
|
-
await mkdir2(
|
|
4134
|
-
const staging = await mkdtemp(
|
|
4259
|
+
const destination = join8(config.nativeProjectDirectory, "assets", "absolute");
|
|
4260
|
+
await mkdir2(dirname4(destination), { recursive: true });
|
|
4261
|
+
const staging = await mkdtemp(join8(dirname4(destination), `.${basename(destination)}.stage-`));
|
|
4135
4262
|
let assets;
|
|
4136
4263
|
let archiveAsset;
|
|
4137
4264
|
let archiveMd5;
|
|
@@ -4150,16 +4277,16 @@ var syncAbsoluteExpoWebAssets = async (config) => {
|
|
|
4150
4277
|
const name = `bundle${EXPO_ASSET_EXTENSION}`;
|
|
4151
4278
|
const archiveContents = Buffer.concat(filesWithContents.map(({ contents }) => contents));
|
|
4152
4279
|
archiveMd5 = createHash3("md5").update(archiveContents).digest("hex");
|
|
4153
|
-
await writeFile2(
|
|
4154
|
-
archiveAsset = portableRelative2(
|
|
4280
|
+
await writeFile2(join8(staging, name), archiveContents);
|
|
4281
|
+
archiveAsset = portableRelative2(join8(config.nativeProjectDirectory, "src", "generated"), join8(destination, name));
|
|
4155
4282
|
await installStagedDirectory(staging, destination);
|
|
4156
4283
|
} catch (error) {
|
|
4157
4284
|
await rm2(staging, { force: true, recursive: true });
|
|
4158
4285
|
throw error;
|
|
4159
4286
|
}
|
|
4160
|
-
const generated =
|
|
4287
|
+
const generated = join8(config.nativeProjectDirectory, "src", "generated", "webAssets.ts");
|
|
4161
4288
|
await writeManagedFile(generated, assetModuleSource(assets, archiveAsset, bundleId, archiveMd5, nativeDataManifest), true);
|
|
4162
4289
|
return { appBuild, assets: assets.length, bundleId, path: destination };
|
|
4163
4290
|
};
|
|
4164
4291
|
|
|
4165
|
-
export { discoverAbsoluteSyncSchema, absoluteDeviceNativeRequirements, assertAbsoluteDeviceCapabilityPackages, resolveAbsoluteDeviceCapabilityPlan, ABSOLUTE_MOBILE_UPDATE_FORMAT, absoluteMobileUpdateSigningPayload, canonicalizeAbsoluteMobileUpdate, parseAbsoluteMobileUpdateManifest, unsignedAbsoluteMobileUpdate, resolveAbsoluteMobileUpdateRuntime, ABSOLUTE_CAPACITOR_ASSETS_SPEC, generateAbsoluteCapacitorBranding, inspectAbsoluteMobileBranding, renderAbsoluteMobileBrandingPreview, writeAbsoluteExpoProject, syncAbsoluteExpoWebAssets };
|
|
4292
|
+
export { ABSOLUTE_NATIVE_EXACT_PACKAGES, CAPACITOR_PACKAGE_SPECS, CAPACITOR_SYNC_PACKAGE_SPECS, assertNativePackageVersions, packageNameFromSpec, packagesNeedingExactInstall, discoverAbsoluteSyncSchema, absoluteDeviceNativeRequirements, assertAbsoluteDeviceCapabilityPackages, resolveAbsoluteDeviceCapabilityPlan, ABSOLUTE_MOBILE_UPDATE_FORMAT, absoluteMobileUpdateSigningPayload, canonicalizeAbsoluteMobileUpdate, parseAbsoluteMobileUpdateManifest, unsignedAbsoluteMobileUpdate, resolveAbsoluteMobileUpdateRuntime, ABSOLUTE_CAPACITOR_ASSETS_SPEC, generateAbsoluteCapacitorBranding, inspectAbsoluteMobileBranding, renderAbsoluteMobileBrandingPreview, writeAbsoluteExpoProject, syncAbsoluteExpoWebAssets };
|