peachsim 0.1.2194 → 0.1.2195
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/README.md +4 -1
- package/cli/commands/control.ts +2 -0
- package/cli/commands/kotlin.ts +10 -3
- package/cli/commands/package.ts +2 -0
- package/cli/native-input.ts +2 -0
- package/cli/outbound-endpoints.ts +1 -1
- package/dist-lib/agent-daemon-client.cjs +1 -1
- package/dist-lib/agent-events.cjs +1 -1
- package/dist-lib/attached-projects.cjs +1 -1
- package/dist-lib/auth/shared-session.cjs +1 -1
- package/dist-lib/backend-origin.cjs +1 -1
- package/dist-lib/beta.cjs +1 -1
- package/dist-lib/beta.mjs +1 -1
- package/dist-lib/bridge-constants.cjs +1 -1
- package/dist-lib/bridge-contract-input.cjs +1 -1
- package/dist-lib/bridge-contract-input.mjs +1 -1
- package/dist-lib/bridge-contract.cjs +1 -1
- package/dist-lib/bridge-contract.mjs +1 -1
- package/dist-lib/bundle-channel.cjs +986 -785
- package/dist-lib/capture-contract.cjs +1 -1
- package/dist-lib/capture-contract.mjs +1 -1
- package/dist-lib/cloud-contract.cjs +1 -1
- package/dist-lib/cloud-contract.mjs +1 -1
- package/dist-lib/cloud-test-args.cjs +1 -1
- package/dist-lib/cloud-test-args.mjs +1 -1
- package/dist-lib/cloud.cjs +1 -1
- package/dist-lib/cloud.mjs +1 -1
- package/dist-lib/config.cjs +1 -1
- package/dist-lib/config.mjs +1 -1
- package/dist-lib/detox/index.cjs +1 -1
- package/dist-lib/dev-bundle-resolution.cjs +1 -1
- package/dist-lib/expo-swift-bundle.cjs +3 -3
- package/dist-lib/expo-swift-metadata.cjs +1 -1
- package/dist-lib/expo-swift-metadata.mjs +1 -1
- package/dist-lib/home-paths.cjs +1 -1
- package/dist-lib/host/bridge-host.cjs +991 -790
- package/dist-lib/host/fetch-proxy-handler.cjs +2 -2
- package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
- package/dist-lib/host/fetch-proxy-overrides.mjs +1 -1
- package/dist-lib/host/replacement-module-handler.cjs +1 -1
- package/dist-lib/host/websocket-proxy.cjs +1 -1
- package/dist-lib/index.cjs +2 -2
- package/dist-lib/jump-to-source-babel.cjs +1 -1
- package/dist-lib/jump-to-source-native.cjs +1 -1
- package/dist-lib/kotlin-host.cjs +82 -13
- package/dist-lib/menu.cjs +1 -1
- package/dist-lib/menu.mjs +1 -1
- package/dist-lib/metro-fingerprint-registry.cjs +1 -1
- package/dist-lib/metro-fingerprint-registry.mjs +1 -1
- package/dist-lib/metro-production-bundle.cjs +1 -1
- package/dist-lib/metro-production-bundle.mjs +1 -1
- package/dist-lib/metro.cjs +2 -2
- package/dist-lib/native-app-identity-project.cjs +1 -1
- package/dist-lib/native-app-identity-project.mjs +1 -1
- package/dist-lib/native-app-identity.cjs +1 -1
- package/dist-lib/native-app-identity.mjs +1 -1
- package/dist-lib/native-firebase-metadata.cjs +1 -1
- package/dist-lib/native-firebase-metadata.mjs +1 -1
- package/dist-lib/pdfium-raster.cjs +1 -1
- package/dist-lib/pdfium-raster.mjs +1 -1
- package/dist-lib/plist.cjs +1 -1
- package/dist-lib/plist.mjs +1 -1
- package/dist-lib/profiles.cjs +1 -1
- package/dist-lib/public-brand.cjs +1 -1
- package/dist-lib/public-origins-lib-esm.json +24 -24
- package/dist-lib/public-origins-lib.json +65 -62
- package/dist-lib/react-native-host-modules.cjs +1 -1
- package/dist-lib/react-native-host-modules.mjs +1 -1
- package/dist-lib/reap-browser.cjs +1 -1
- package/dist-lib/scripts/dev-server-scanner.cjs +1 -1
- package/dist-lib/sdk.cjs +1 -1
- package/dist-lib/sdk.mjs +1 -1
- package/dist-lib/skills.cjs +1513 -1264
- package/dist-lib/swift-compile.cjs +1 -1
- package/dist-lib/swift-compile.mjs +1 -1
- package/dist-lib/swift-package.cjs +1 -1
- package/dist-lib/swift-package.mjs +1 -1
- package/dist-lib/swift-submit.cjs +1 -1
- package/dist-lib/swift-submit.mjs +1 -1
- package/dist-lib/swift-toolchain.cjs +1 -1
- package/dist-lib/swift.cjs +1 -1
- package/dist-lib/vite-swift.cjs +2 -2
- package/dist-lib/vite.cjs +2 -2
- package/dist-lib/worklet-executable.cjs +1 -1
- package/dist-lib/worklet-executable.mjs +1 -1
- package/dist-types/packages/peach-engine/src/engine/types.d.ts +1 -0
- package/kotlin/sdk.tar.gz +0 -0
- package/package.json +1 -1
- package/src/android-bridge-dependencies.ts +93 -0
- package/src/android-bridge-packages.ts +1 -0
- package/src/android-gradle-sources.ts +76 -9
- package/src/androidGradleContract.ts +8 -0
- package/src/expo-kotlin-host.ts +20 -7
- package/src/expoKotlinContract.ts +1 -1
- package/src/java-module-abi.ts +7 -1
- package/src/kotlin-app.ts +120 -63
- package/src/kotlin-host.ts +1 -0
- package/src/kotlinSdkContract.ts +8 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! peach v0.1.
|
|
1
|
+
/*! peach v0.1.2195 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
|
|
2
2
|
let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = '', __sootsim_import_meta_filename = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; __sootsim_import_meta_filename = __filename; } catch {}
|
|
3
3
|
"use strict";
|
|
4
4
|
var __create = Object.create;
|
|
@@ -3119,17 +3119,17 @@ function visit(node, visitor) {
|
|
|
3119
3119
|
} else
|
|
3120
3120
|
visit_(null, node, visitor_, Object.freeze([]));
|
|
3121
3121
|
}
|
|
3122
|
-
function visit_(key2, node, visitor,
|
|
3123
|
-
const ctrl = callVisitor(key2, node, visitor,
|
|
3122
|
+
function visit_(key2, node, visitor, path110) {
|
|
3123
|
+
const ctrl = callVisitor(key2, node, visitor, path110);
|
|
3124
3124
|
if (isNode(ctrl) || isPair(ctrl)) {
|
|
3125
|
-
replaceNode(key2,
|
|
3126
|
-
return visit_(key2, ctrl, visitor,
|
|
3125
|
+
replaceNode(key2, path110, ctrl);
|
|
3126
|
+
return visit_(key2, ctrl, visitor, path110);
|
|
3127
3127
|
}
|
|
3128
3128
|
if (typeof ctrl !== "symbol") {
|
|
3129
3129
|
if (isCollection(node)) {
|
|
3130
|
-
|
|
3130
|
+
path110 = Object.freeze(path110.concat(node));
|
|
3131
3131
|
for (let i = 0; i < node.items.length; ++i) {
|
|
3132
|
-
const ci = visit_(i, node.items[i], visitor,
|
|
3132
|
+
const ci = visit_(i, node.items[i], visitor, path110);
|
|
3133
3133
|
if (typeof ci === "number")
|
|
3134
3134
|
i = ci - 1;
|
|
3135
3135
|
else if (ci === BREAK)
|
|
@@ -3140,13 +3140,13 @@ function visit_(key2, node, visitor, path109) {
|
|
|
3140
3140
|
}
|
|
3141
3141
|
}
|
|
3142
3142
|
} else if (isPair(node)) {
|
|
3143
|
-
|
|
3144
|
-
const ck = visit_("key", node.key, visitor,
|
|
3143
|
+
path110 = Object.freeze(path110.concat(node));
|
|
3144
|
+
const ck = visit_("key", node.key, visitor, path110);
|
|
3145
3145
|
if (ck === BREAK)
|
|
3146
3146
|
return BREAK;
|
|
3147
3147
|
else if (ck === REMOVE)
|
|
3148
3148
|
node.key = null;
|
|
3149
|
-
const cv = visit_("value", node.value, visitor,
|
|
3149
|
+
const cv = visit_("value", node.value, visitor, path110);
|
|
3150
3150
|
if (cv === BREAK)
|
|
3151
3151
|
return BREAK;
|
|
3152
3152
|
else if (cv === REMOVE)
|
|
@@ -3164,17 +3164,17 @@ async function visitAsync(node, visitor) {
|
|
|
3164
3164
|
} else
|
|
3165
3165
|
await visitAsync_(null, node, visitor_, Object.freeze([]));
|
|
3166
3166
|
}
|
|
3167
|
-
async function visitAsync_(key2, node, visitor,
|
|
3168
|
-
const ctrl = await callVisitor(key2, node, visitor,
|
|
3167
|
+
async function visitAsync_(key2, node, visitor, path110) {
|
|
3168
|
+
const ctrl = await callVisitor(key2, node, visitor, path110);
|
|
3169
3169
|
if (isNode(ctrl) || isPair(ctrl)) {
|
|
3170
|
-
replaceNode(key2,
|
|
3171
|
-
return visitAsync_(key2, ctrl, visitor,
|
|
3170
|
+
replaceNode(key2, path110, ctrl);
|
|
3171
|
+
return visitAsync_(key2, ctrl, visitor, path110);
|
|
3172
3172
|
}
|
|
3173
3173
|
if (typeof ctrl !== "symbol") {
|
|
3174
3174
|
if (isCollection(node)) {
|
|
3175
|
-
|
|
3175
|
+
path110 = Object.freeze(path110.concat(node));
|
|
3176
3176
|
for (let i = 0; i < node.items.length; ++i) {
|
|
3177
|
-
const ci = await visitAsync_(i, node.items[i], visitor,
|
|
3177
|
+
const ci = await visitAsync_(i, node.items[i], visitor, path110);
|
|
3178
3178
|
if (typeof ci === "number")
|
|
3179
3179
|
i = ci - 1;
|
|
3180
3180
|
else if (ci === BREAK)
|
|
@@ -3185,13 +3185,13 @@ async function visitAsync_(key2, node, visitor, path109) {
|
|
|
3185
3185
|
}
|
|
3186
3186
|
}
|
|
3187
3187
|
} else if (isPair(node)) {
|
|
3188
|
-
|
|
3189
|
-
const ck = await visitAsync_("key", node.key, visitor,
|
|
3188
|
+
path110 = Object.freeze(path110.concat(node));
|
|
3189
|
+
const ck = await visitAsync_("key", node.key, visitor, path110);
|
|
3190
3190
|
if (ck === BREAK)
|
|
3191
3191
|
return BREAK;
|
|
3192
3192
|
else if (ck === REMOVE)
|
|
3193
3193
|
node.key = null;
|
|
3194
|
-
const cv = await visitAsync_("value", node.value, visitor,
|
|
3194
|
+
const cv = await visitAsync_("value", node.value, visitor, path110);
|
|
3195
3195
|
if (cv === BREAK)
|
|
3196
3196
|
return BREAK;
|
|
3197
3197
|
else if (cv === REMOVE)
|
|
@@ -3218,23 +3218,23 @@ function initVisitor(visitor) {
|
|
|
3218
3218
|
}
|
|
3219
3219
|
return visitor;
|
|
3220
3220
|
}
|
|
3221
|
-
function callVisitor(key2, node, visitor,
|
|
3221
|
+
function callVisitor(key2, node, visitor, path110) {
|
|
3222
3222
|
if (typeof visitor === "function")
|
|
3223
|
-
return visitor(key2, node,
|
|
3223
|
+
return visitor(key2, node, path110);
|
|
3224
3224
|
if (isMap(node))
|
|
3225
|
-
return visitor.Map?.(key2, node,
|
|
3225
|
+
return visitor.Map?.(key2, node, path110);
|
|
3226
3226
|
if (isSeq(node))
|
|
3227
|
-
return visitor.Seq?.(key2, node,
|
|
3227
|
+
return visitor.Seq?.(key2, node, path110);
|
|
3228
3228
|
if (isPair(node))
|
|
3229
|
-
return visitor.Pair?.(key2, node,
|
|
3229
|
+
return visitor.Pair?.(key2, node, path110);
|
|
3230
3230
|
if (isScalar(node))
|
|
3231
|
-
return visitor.Scalar?.(key2, node,
|
|
3231
|
+
return visitor.Scalar?.(key2, node, path110);
|
|
3232
3232
|
if (isAlias(node))
|
|
3233
|
-
return visitor.Alias?.(key2, node,
|
|
3233
|
+
return visitor.Alias?.(key2, node, path110);
|
|
3234
3234
|
return void 0;
|
|
3235
3235
|
}
|
|
3236
|
-
function replaceNode(key2,
|
|
3237
|
-
const parent =
|
|
3236
|
+
function replaceNode(key2, path110, node) {
|
|
3237
|
+
const parent = path110[path110.length - 1];
|
|
3238
3238
|
if (isCollection(parent)) {
|
|
3239
3239
|
parent.items[key2] = node;
|
|
3240
3240
|
} else if (isPair(parent)) {
|
|
@@ -3843,10 +3843,10 @@ var init_createNode = __esm({
|
|
|
3843
3843
|
});
|
|
3844
3844
|
|
|
3845
3845
|
// ../../node_modules/yaml/browser/dist/nodes/Collection.js
|
|
3846
|
-
function collectionFromPath(schema4,
|
|
3846
|
+
function collectionFromPath(schema4, path110, value) {
|
|
3847
3847
|
let v6 = value;
|
|
3848
|
-
for (let i =
|
|
3849
|
-
const k =
|
|
3848
|
+
for (let i = path110.length - 1; i >= 0; --i) {
|
|
3849
|
+
const k = path110[i];
|
|
3850
3850
|
if (typeof k === "number" && Number.isInteger(k) && k >= 0) {
|
|
3851
3851
|
const a = [];
|
|
3852
3852
|
a[k] = v6;
|
|
@@ -3872,7 +3872,7 @@ var init_Collection = __esm({
|
|
|
3872
3872
|
init_createNode();
|
|
3873
3873
|
init_identity();
|
|
3874
3874
|
init_Node();
|
|
3875
|
-
isEmptyPath = (
|
|
3875
|
+
isEmptyPath = (path110) => path110 == null || typeof path110 === "object" && !!path110[Symbol.iterator]().next().done;
|
|
3876
3876
|
Collection = class extends NodeBase {
|
|
3877
3877
|
constructor(type, schema4) {
|
|
3878
3878
|
super(type);
|
|
@@ -3902,11 +3902,11 @@ var init_Collection = __esm({
|
|
|
3902
3902
|
* be a Pair instance or a `{ key, value }` object, which may not have a key
|
|
3903
3903
|
* that already exists in the map.
|
|
3904
3904
|
*/
|
|
3905
|
-
addIn(
|
|
3906
|
-
if (isEmptyPath(
|
|
3905
|
+
addIn(path110, value) {
|
|
3906
|
+
if (isEmptyPath(path110))
|
|
3907
3907
|
this.add(value);
|
|
3908
3908
|
else {
|
|
3909
|
-
const [key2, ...rest] =
|
|
3909
|
+
const [key2, ...rest] = path110;
|
|
3910
3910
|
const node = this.get(key2, true);
|
|
3911
3911
|
if (isCollection(node))
|
|
3912
3912
|
node.addIn(rest, value);
|
|
@@ -3920,8 +3920,8 @@ var init_Collection = __esm({
|
|
|
3920
3920
|
* Removes a value from the collection.
|
|
3921
3921
|
* @returns `true` if the item was found and removed.
|
|
3922
3922
|
*/
|
|
3923
|
-
deleteIn(
|
|
3924
|
-
const [key2, ...rest] =
|
|
3923
|
+
deleteIn(path110) {
|
|
3924
|
+
const [key2, ...rest] = path110;
|
|
3925
3925
|
if (rest.length === 0)
|
|
3926
3926
|
return this.delete(key2);
|
|
3927
3927
|
const node = this.get(key2, true);
|
|
@@ -3935,8 +3935,8 @@ var init_Collection = __esm({
|
|
|
3935
3935
|
* scalar values from their surrounding node; to disable set `keepScalar` to
|
|
3936
3936
|
* `true` (collections are always returned intact).
|
|
3937
3937
|
*/
|
|
3938
|
-
getIn(
|
|
3939
|
-
const [key2, ...rest] =
|
|
3938
|
+
getIn(path110, keepScalar) {
|
|
3939
|
+
const [key2, ...rest] = path110;
|
|
3940
3940
|
const node = this.get(key2, true);
|
|
3941
3941
|
if (rest.length === 0)
|
|
3942
3942
|
return !keepScalar && isScalar(node) ? node.value : node;
|
|
@@ -3954,8 +3954,8 @@ var init_Collection = __esm({
|
|
|
3954
3954
|
/**
|
|
3955
3955
|
* Checks if the collection includes a value with the key `key`.
|
|
3956
3956
|
*/
|
|
3957
|
-
hasIn(
|
|
3958
|
-
const [key2, ...rest] =
|
|
3957
|
+
hasIn(path110) {
|
|
3958
|
+
const [key2, ...rest] = path110;
|
|
3959
3959
|
if (rest.length === 0)
|
|
3960
3960
|
return this.has(key2);
|
|
3961
3961
|
const node = this.get(key2, true);
|
|
@@ -3965,8 +3965,8 @@ var init_Collection = __esm({
|
|
|
3965
3965
|
* Sets a value in this collection. For `!!set`, `value` needs to be a
|
|
3966
3966
|
* boolean to add/remove the item from the set.
|
|
3967
3967
|
*/
|
|
3968
|
-
setIn(
|
|
3969
|
-
const [key2, ...rest] =
|
|
3968
|
+
setIn(path110, value) {
|
|
3969
|
+
const [key2, ...rest] = path110;
|
|
3970
3970
|
if (rest.length === 0) {
|
|
3971
3971
|
this.set(key2, value);
|
|
3972
3972
|
} else {
|
|
@@ -6435,9 +6435,9 @@ var init_Document = __esm({
|
|
|
6435
6435
|
this.contents.add(value);
|
|
6436
6436
|
}
|
|
6437
6437
|
/** Adds a value to the document. */
|
|
6438
|
-
addIn(
|
|
6438
|
+
addIn(path110, value) {
|
|
6439
6439
|
if (assertCollection(this.contents))
|
|
6440
|
-
this.contents.addIn(
|
|
6440
|
+
this.contents.addIn(path110, value);
|
|
6441
6441
|
}
|
|
6442
6442
|
/**
|
|
6443
6443
|
* Create a new `Alias` node, ensuring that the target `node` has the required anchor.
|
|
@@ -6512,14 +6512,14 @@ var init_Document = __esm({
|
|
|
6512
6512
|
* Removes a value from the document.
|
|
6513
6513
|
* @returns `true` if the item was found and removed.
|
|
6514
6514
|
*/
|
|
6515
|
-
deleteIn(
|
|
6516
|
-
if (isEmptyPath(
|
|
6515
|
+
deleteIn(path110) {
|
|
6516
|
+
if (isEmptyPath(path110)) {
|
|
6517
6517
|
if (this.contents == null)
|
|
6518
6518
|
return false;
|
|
6519
6519
|
this.contents = null;
|
|
6520
6520
|
return true;
|
|
6521
6521
|
}
|
|
6522
|
-
return assertCollection(this.contents) ? this.contents.deleteIn(
|
|
6522
|
+
return assertCollection(this.contents) ? this.contents.deleteIn(path110) : false;
|
|
6523
6523
|
}
|
|
6524
6524
|
/**
|
|
6525
6525
|
* Returns item at `key`, or `undefined` if not found. By default unwraps
|
|
@@ -6534,10 +6534,10 @@ var init_Document = __esm({
|
|
|
6534
6534
|
* scalar values from their surrounding node; to disable set `keepScalar` to
|
|
6535
6535
|
* `true` (collections are always returned intact).
|
|
6536
6536
|
*/
|
|
6537
|
-
getIn(
|
|
6538
|
-
if (isEmptyPath(
|
|
6537
|
+
getIn(path110, keepScalar) {
|
|
6538
|
+
if (isEmptyPath(path110))
|
|
6539
6539
|
return !keepScalar && isScalar(this.contents) ? this.contents.value : this.contents;
|
|
6540
|
-
return isCollection(this.contents) ? this.contents.getIn(
|
|
6540
|
+
return isCollection(this.contents) ? this.contents.getIn(path110, keepScalar) : void 0;
|
|
6541
6541
|
}
|
|
6542
6542
|
/**
|
|
6543
6543
|
* Checks if the document includes a value with the key `key`.
|
|
@@ -6548,10 +6548,10 @@ var init_Document = __esm({
|
|
|
6548
6548
|
/**
|
|
6549
6549
|
* Checks if the document includes a value at `path`.
|
|
6550
6550
|
*/
|
|
6551
|
-
hasIn(
|
|
6552
|
-
if (isEmptyPath(
|
|
6551
|
+
hasIn(path110) {
|
|
6552
|
+
if (isEmptyPath(path110))
|
|
6553
6553
|
return this.contents !== void 0;
|
|
6554
|
-
return isCollection(this.contents) ? this.contents.hasIn(
|
|
6554
|
+
return isCollection(this.contents) ? this.contents.hasIn(path110) : false;
|
|
6555
6555
|
}
|
|
6556
6556
|
/**
|
|
6557
6557
|
* Sets a value in this document. For `!!set`, `value` needs to be a
|
|
@@ -6568,13 +6568,13 @@ var init_Document = __esm({
|
|
|
6568
6568
|
* Sets a value in this document. For `!!set`, `value` needs to be a
|
|
6569
6569
|
* boolean to add/remove the item from the set.
|
|
6570
6570
|
*/
|
|
6571
|
-
setIn(
|
|
6572
|
-
if (isEmptyPath(
|
|
6571
|
+
setIn(path110, value) {
|
|
6572
|
+
if (isEmptyPath(path110)) {
|
|
6573
6573
|
this.contents = value;
|
|
6574
6574
|
} else if (this.contents == null) {
|
|
6575
|
-
this.contents = collectionFromPath(this.schema, Array.from(
|
|
6575
|
+
this.contents = collectionFromPath(this.schema, Array.from(path110), value);
|
|
6576
6576
|
} else if (assertCollection(this.contents)) {
|
|
6577
|
-
this.contents.setIn(
|
|
6577
|
+
this.contents.setIn(path110, value);
|
|
6578
6578
|
}
|
|
6579
6579
|
}
|
|
6580
6580
|
/**
|
|
@@ -8498,15 +8498,15 @@ function visit2(cst, visitor) {
|
|
|
8498
8498
|
cst = { start: cst.start, value: cst.value };
|
|
8499
8499
|
_visit(Object.freeze([]), cst, visitor);
|
|
8500
8500
|
}
|
|
8501
|
-
function _visit(
|
|
8502
|
-
let ctrl = visitor(item,
|
|
8501
|
+
function _visit(path110, item, visitor) {
|
|
8502
|
+
let ctrl = visitor(item, path110);
|
|
8503
8503
|
if (typeof ctrl === "symbol")
|
|
8504
8504
|
return ctrl;
|
|
8505
8505
|
for (const field of ["key", "value"]) {
|
|
8506
8506
|
const token = item[field];
|
|
8507
8507
|
if (token && "items" in token) {
|
|
8508
8508
|
for (let i = 0; i < token.items.length; ++i) {
|
|
8509
|
-
const ci = _visit(Object.freeze(
|
|
8509
|
+
const ci = _visit(Object.freeze(path110.concat([[field, i]])), token.items[i], visitor);
|
|
8510
8510
|
if (typeof ci === "number")
|
|
8511
8511
|
i = ci - 1;
|
|
8512
8512
|
else if (ci === BREAK2)
|
|
@@ -8517,10 +8517,10 @@ function _visit(path109, item, visitor) {
|
|
|
8517
8517
|
}
|
|
8518
8518
|
}
|
|
8519
8519
|
if (typeof ctrl === "function" && field === "key")
|
|
8520
|
-
ctrl = ctrl(item,
|
|
8520
|
+
ctrl = ctrl(item, path110);
|
|
8521
8521
|
}
|
|
8522
8522
|
}
|
|
8523
|
-
return typeof ctrl === "function" ? ctrl(item,
|
|
8523
|
+
return typeof ctrl === "function" ? ctrl(item, path110) : ctrl;
|
|
8524
8524
|
}
|
|
8525
8525
|
var BREAK2, SKIP2, REMOVE2;
|
|
8526
8526
|
var init_cst_visit = __esm({
|
|
@@ -8532,9 +8532,9 @@ var init_cst_visit = __esm({
|
|
|
8532
8532
|
visit2.BREAK = BREAK2;
|
|
8533
8533
|
visit2.SKIP = SKIP2;
|
|
8534
8534
|
visit2.REMOVE = REMOVE2;
|
|
8535
|
-
visit2.itemAtPath = (cst,
|
|
8535
|
+
visit2.itemAtPath = (cst, path110) => {
|
|
8536
8536
|
let item = cst;
|
|
8537
|
-
for (const [field, index] of
|
|
8537
|
+
for (const [field, index] of path110) {
|
|
8538
8538
|
const tok = item?.[field];
|
|
8539
8539
|
if (tok && "items" in tok) {
|
|
8540
8540
|
item = tok.items[index];
|
|
@@ -8543,9 +8543,9 @@ var init_cst_visit = __esm({
|
|
|
8543
8543
|
}
|
|
8544
8544
|
return item;
|
|
8545
8545
|
};
|
|
8546
|
-
visit2.parentCollection = (cst,
|
|
8547
|
-
const parent = visit2.itemAtPath(cst,
|
|
8548
|
-
const field =
|
|
8546
|
+
visit2.parentCollection = (cst, path110) => {
|
|
8547
|
+
const parent = visit2.itemAtPath(cst, path110.slice(0, -1));
|
|
8548
|
+
const field = path110[path110.length - 1][0];
|
|
8549
8549
|
const coll = parent?.[field];
|
|
8550
8550
|
if (coll && "items" in coll)
|
|
8551
8551
|
return coll;
|
|
@@ -9852,14 +9852,14 @@ var init_parser = __esm({
|
|
|
9852
9852
|
case "scalar":
|
|
9853
9853
|
case "single-quoted-scalar":
|
|
9854
9854
|
case "double-quoted-scalar": {
|
|
9855
|
-
const
|
|
9855
|
+
const fs86 = this.flowScalar(this.type);
|
|
9856
9856
|
if (atNextItem || it.value) {
|
|
9857
|
-
map2.items.push({ start, key:
|
|
9857
|
+
map2.items.push({ start, key: fs86, sep: [] });
|
|
9858
9858
|
this.onKeyLine = true;
|
|
9859
9859
|
} else if (it.sep) {
|
|
9860
|
-
this.stack.push(
|
|
9860
|
+
this.stack.push(fs86);
|
|
9861
9861
|
} else {
|
|
9862
|
-
Object.assign(it, { key:
|
|
9862
|
+
Object.assign(it, { key: fs86, sep: [] });
|
|
9863
9863
|
this.onKeyLine = true;
|
|
9864
9864
|
}
|
|
9865
9865
|
return;
|
|
@@ -9987,13 +9987,13 @@ var init_parser = __esm({
|
|
|
9987
9987
|
case "scalar":
|
|
9988
9988
|
case "single-quoted-scalar":
|
|
9989
9989
|
case "double-quoted-scalar": {
|
|
9990
|
-
const
|
|
9990
|
+
const fs86 = this.flowScalar(this.type);
|
|
9991
9991
|
if (!it || it.value)
|
|
9992
|
-
fc.items.push({ start: [], key:
|
|
9992
|
+
fc.items.push({ start: [], key: fs86, sep: [] });
|
|
9993
9993
|
else if (it.sep)
|
|
9994
|
-
this.stack.push(
|
|
9994
|
+
this.stack.push(fs86);
|
|
9995
9995
|
else
|
|
9996
|
-
Object.assign(it, { key:
|
|
9996
|
+
Object.assign(it, { key: fs86, sep: [] });
|
|
9997
9997
|
return;
|
|
9998
9998
|
}
|
|
9999
9999
|
case "flow-map-end":
|
|
@@ -10437,8 +10437,8 @@ function metadataValue(value, key2) {
|
|
|
10437
10437
|
if (!value || typeof value !== "object") return void 0;
|
|
10438
10438
|
return Object.getOwnPropertyDescriptor(value, key2)?.value;
|
|
10439
10439
|
}
|
|
10440
|
-
function readProjectJson(
|
|
10441
|
-
const text6 = readProjectMetadata(
|
|
10440
|
+
function readProjectJson(path110, files2 = nodeRepoFileReader) {
|
|
10441
|
+
const text6 = readProjectMetadata(path110, files2);
|
|
10442
10442
|
if (text6 === null) return null;
|
|
10443
10443
|
try {
|
|
10444
10444
|
const value = JSON.parse(text6);
|
|
@@ -12208,7 +12208,7 @@ var init_swift_standin_digest = __esm({
|
|
|
12208
12208
|
STANDIN_DIGEST_ENTRYPOINTS = ["swift-standins.ts", "swift-objc-compile.ts"];
|
|
12209
12209
|
SPECIFIER = /from\s*['"]([^'"]+)['"]|import\s*\(\s*['"]([^'"]+)['"]\s*\)/g;
|
|
12210
12210
|
standinSourceDigest = (srcDir = __sootsim_import_meta_dirname) => sourceClosureDigest(srcDir, STANDIN_DIGEST_ENTRYPOINTS);
|
|
12211
|
-
STANDIN_SOURCE_DIGEST = true ? "
|
|
12211
|
+
STANDIN_SOURCE_DIGEST = true ? "afff2f6ba145885813b507114e72f9218f9a815a257ab2e44f7da376b7bf5cd1" : standinSourceDigest();
|
|
12212
12212
|
}
|
|
12213
12213
|
});
|
|
12214
12214
|
|
|
@@ -12311,9 +12311,9 @@ async function packageTreeDigest(root) {
|
|
|
12311
12311
|
(a, b) => a.name.localeCompare(b.name)
|
|
12312
12312
|
)) {
|
|
12313
12313
|
if (entry.name === "node_modules") continue;
|
|
12314
|
-
const
|
|
12315
|
-
if (entry.isDirectory()) walk3((0, import_node_path66.join)(directory2, entry.name), `${
|
|
12316
|
-
else if (entry.isFile()) files2.push(
|
|
12314
|
+
const path110 = `${relative4}${entry.name}`;
|
|
12315
|
+
if (entry.isDirectory()) walk3((0, import_node_path66.join)(directory2, entry.name), `${path110}/`);
|
|
12316
|
+
else if (entry.isFile()) files2.push(path110);
|
|
12317
12317
|
}
|
|
12318
12318
|
};
|
|
12319
12319
|
walk3(root, "");
|
|
@@ -12490,7 +12490,7 @@ var init_nitro_superset = __esm({
|
|
|
12490
12490
|
init_nitroContract();
|
|
12491
12491
|
init_swift_standin_digest();
|
|
12492
12492
|
NITRO_SUPERSET_ENTRY_NAME = "superset";
|
|
12493
|
-
NITRO_COMPILER_DIGEST = true ? "
|
|
12493
|
+
NITRO_COMPILER_DIGEST = true ? "476dc80dfe13d046b6e1e4401add50aab58adb46496109e4a66c3681a8325ee8" : nitroCompilerSourceDigest(__sootsim_import_meta_dirname, STANDIN_SOURCE_DIGEST2);
|
|
12494
12494
|
nitroSupersetLock = parseLock(nitro_superset_lock_default);
|
|
12495
12495
|
nitroSupersetKey = (inputs) => nativeEntryKey({ ...inputs, compiler: NITRO_COMPILER_DIGEST });
|
|
12496
12496
|
published2 = /* @__PURE__ */ new Map();
|
|
@@ -12878,6 +12878,37 @@ async function resolveAndroidModules(appRoot) {
|
|
|
12878
12878
|
throw new Error("invalid Expo Android autolinking entry");
|
|
12879
12879
|
return resolved.modules;
|
|
12880
12880
|
}
|
|
12881
|
+
async function resolveReactNativeAndroidAutolinking(appRoot) {
|
|
12882
|
+
const config = await reactNativeAutolinkingConfig(appRoot, "android");
|
|
12883
|
+
if (!isRecord(config) || !isRecord(config.dependencies))
|
|
12884
|
+
throw new Error(`${appRoot}: React Native autolinking config has no dependencies`);
|
|
12885
|
+
const linked = [];
|
|
12886
|
+
for (const [name3, dependency] of Object.entries(config.dependencies)) {
|
|
12887
|
+
if (!isRecord(dependency) || !isRecord(dependency.platforms))
|
|
12888
|
+
throw new Error(
|
|
12889
|
+
`${appRoot}: React Native autolinking dependency ${name3} is malformed`
|
|
12890
|
+
);
|
|
12891
|
+
const android = dependency.platforms.android;
|
|
12892
|
+
if (android == null) continue;
|
|
12893
|
+
if (!isRecord(android) || typeof dependency.root !== "string")
|
|
12894
|
+
throw new Error(
|
|
12895
|
+
`${appRoot}: React Native autolinking dependency ${name3} has no Android project`
|
|
12896
|
+
);
|
|
12897
|
+
const string5 = (field) => {
|
|
12898
|
+
const value = android[field];
|
|
12899
|
+
if (value == null || typeof value === "string") return value ?? null;
|
|
12900
|
+
throw new Error(`${appRoot}: Android dependency ${name3} has invalid ${field}`);
|
|
12901
|
+
};
|
|
12902
|
+
linked.push({
|
|
12903
|
+
name: name3,
|
|
12904
|
+
root: dependency.root,
|
|
12905
|
+
sourceDir: string5("sourceDir"),
|
|
12906
|
+
packageImportPath: string5("packageImportPath"),
|
|
12907
|
+
packageInstance: string5("packageInstance")
|
|
12908
|
+
});
|
|
12909
|
+
}
|
|
12910
|
+
return linked;
|
|
12911
|
+
}
|
|
12881
12912
|
var import_node_child_process49, import_node_fs113, import_node_module18, import_node_path115, import_node_util18, run8, resolving;
|
|
12882
12913
|
var init_android_autolinking = __esm({
|
|
12883
12914
|
"src/android-autolinking.ts"() {
|
|
@@ -12897,6 +12928,199 @@ var init_android_autolinking = __esm({
|
|
|
12897
12928
|
}
|
|
12898
12929
|
});
|
|
12899
12930
|
|
|
12931
|
+
// src/android-gradle-sources.ts
|
|
12932
|
+
var android_gradle_sources_exports = {};
|
|
12933
|
+
__export(android_gradle_sources_exports, {
|
|
12934
|
+
resolveAndroidGradleSources: () => resolveAndroidGradleSources
|
|
12935
|
+
});
|
|
12936
|
+
async function resolveAndroidGradleSources(request) {
|
|
12937
|
+
let { root } = request;
|
|
12938
|
+
const { projects: projectDirs, variant: variant2 } = request;
|
|
12939
|
+
if (projectDirs.length === 0) return [];
|
|
12940
|
+
if (!import_node_path116.default.isAbsolute(root) || projectDirs.some((dir) => !import_node_path116.default.isAbsolute(dir)))
|
|
12941
|
+
throw new Error("Android Gradle source selection requires absolute project paths");
|
|
12942
|
+
if (!variant2) throw new Error("Android Gradle source selection requires a variant");
|
|
12943
|
+
root = import_node_fs114.default.realpathSync(root);
|
|
12944
|
+
const projects2 = [...new Set(projectDirs.map((dir) => import_node_fs114.default.realpathSync(dir)))];
|
|
12945
|
+
const parent = import_node_path116.default.join(kotlinHome(), "gradle-sources");
|
|
12946
|
+
import_node_fs114.default.mkdirSync(parent, { recursive: true });
|
|
12947
|
+
const work = import_node_fs114.default.mkdtempSync(import_node_path116.default.join(parent, ".query-"));
|
|
12948
|
+
const task = `peachAndroidSources${(0, import_node_crypto59.randomBytes)(8).toString("hex")}`;
|
|
12949
|
+
const script = import_node_path116.default.join(work, "sources.gradle");
|
|
12950
|
+
const encoded = Buffer.from(
|
|
12951
|
+
JSON.stringify({ root, projects: projects2, variant: variant2, output: work, task })
|
|
12952
|
+
).toString("base64");
|
|
12953
|
+
import_node_fs114.default.writeFileSync(script, modelQuery.replace("__PEACH_REQUEST__", encoded));
|
|
12954
|
+
try {
|
|
12955
|
+
await run9(
|
|
12956
|
+
"bash",
|
|
12957
|
+
[
|
|
12958
|
+
import_node_path116.default.join(root, "gradlew"),
|
|
12959
|
+
"--init-script",
|
|
12960
|
+
script,
|
|
12961
|
+
`${task}All`,
|
|
12962
|
+
"--no-daemon",
|
|
12963
|
+
"--no-configuration-cache",
|
|
12964
|
+
"--no-configure-on-demand",
|
|
12965
|
+
"--max-workers=1",
|
|
12966
|
+
"--console=plain"
|
|
12967
|
+
],
|
|
12968
|
+
{
|
|
12969
|
+
cwd: root,
|
|
12970
|
+
timeout: 3e5,
|
|
12971
|
+
maxBuffer: 8 * 1024 * 1024,
|
|
12972
|
+
env: { ...process.env, [PEACH_FORKED_SCRIPT_ENV]: "1" }
|
|
12973
|
+
}
|
|
12974
|
+
);
|
|
12975
|
+
return projects2.map((projectDir, index) => {
|
|
12976
|
+
const value = JSON.parse(
|
|
12977
|
+
import_node_fs114.default.readFileSync(import_node_path116.default.join(work, `${index}.json`), "utf8")
|
|
12978
|
+
);
|
|
12979
|
+
if (!isRecord(value) || value.projectDir !== projectDir || value.variant !== variant2 || typeof value.projectPath !== "string" || value.applicationId !== null && typeof value.applicationId !== "string" || typeof value.namespace !== "string" || !value.namespace || value.targetSdk !== null && (typeof value.targetSdk !== "number" || !Number.isInteger(value.targetSdk) || value.targetSdk <= 0))
|
|
12980
|
+
throw new Error("Gradle printed an invalid Android project source model");
|
|
12981
|
+
const sources = (field) => {
|
|
12982
|
+
const list2 = value[field];
|
|
12983
|
+
if (!Array.isArray(list2) || !list2.every((file) => typeof file === "string" && import_node_path116.default.isAbsolute(file)))
|
|
12984
|
+
throw new Error(`Gradle printed invalid Android ${field} source paths`);
|
|
12985
|
+
return list2.map(String);
|
|
12986
|
+
};
|
|
12987
|
+
if (!Array.isArray(value.dependencies))
|
|
12988
|
+
throw new Error("Gradle printed invalid Android dependencies");
|
|
12989
|
+
const dependencies = value.dependencies.map(
|
|
12990
|
+
(entry) => {
|
|
12991
|
+
if (isRecord(entry) && typeof entry.name === "string" && entry.name) {
|
|
12992
|
+
if (entry.kind === "module" && typeof entry.group === "string" && entry.group && typeof entry.version === "string" && entry.version)
|
|
12993
|
+
return {
|
|
12994
|
+
kind: entry.kind,
|
|
12995
|
+
group: entry.group,
|
|
12996
|
+
name: entry.name,
|
|
12997
|
+
version: entry.version
|
|
12998
|
+
};
|
|
12999
|
+
if (entry.kind === "project" || entry.kind === "file")
|
|
13000
|
+
return { kind: entry.kind, name: entry.name };
|
|
13001
|
+
}
|
|
13002
|
+
throw new Error("Gradle printed an invalid Android dependency");
|
|
13003
|
+
}
|
|
13004
|
+
);
|
|
13005
|
+
return {
|
|
13006
|
+
projectDir,
|
|
13007
|
+
projectPath: value.projectPath,
|
|
13008
|
+
variant: variant2,
|
|
13009
|
+
applicationId: value.applicationId,
|
|
13010
|
+
namespace: value.namespace,
|
|
13011
|
+
targetSdk: value.targetSdk,
|
|
13012
|
+
kotlin: sources("kotlin"),
|
|
13013
|
+
java: sources("java"),
|
|
13014
|
+
dependencies
|
|
13015
|
+
};
|
|
13016
|
+
});
|
|
13017
|
+
} finally {
|
|
13018
|
+
import_node_fs114.default.rmSync(work, { recursive: true, force: true });
|
|
13019
|
+
}
|
|
13020
|
+
}
|
|
13021
|
+
var import_node_child_process50, import_node_crypto59, import_node_fs114, import_node_path116, import_node_util19, run9, modelQuery;
|
|
13022
|
+
var init_android_gradle_sources = __esm({
|
|
13023
|
+
"src/android-gradle-sources.ts"() {
|
|
13024
|
+
"use strict";
|
|
13025
|
+
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
13026
|
+
import_node_child_process50 = require("node:child_process");
|
|
13027
|
+
import_node_crypto59 = require("node:crypto");
|
|
13028
|
+
import_node_fs114 = __toESM(require("node:fs"), 1);
|
|
13029
|
+
import_node_path116 = __toESM(require("node:path"), 1);
|
|
13030
|
+
import_node_util19 = require("node:util");
|
|
13031
|
+
init_forked_script_contract();
|
|
13032
|
+
init_is_record();
|
|
13033
|
+
init_kotlin_toolchain();
|
|
13034
|
+
run9 = (0, import_node_util19.promisify)(import_node_child_process50.execFile);
|
|
13035
|
+
modelQuery = `
|
|
13036
|
+
import groovy.json.JsonOutput
|
|
13037
|
+
import groovy.json.JsonSlurper
|
|
13038
|
+
import org.gradle.api.artifacts.FileCollectionDependency
|
|
13039
|
+
import org.gradle.api.artifacts.component.ModuleComponentIdentifier
|
|
13040
|
+
import org.gradle.api.artifacts.component.ProjectComponentIdentifier
|
|
13041
|
+
import org.gradle.api.artifacts.result.ResolvedDependencyResult
|
|
13042
|
+
import org.gradle.api.attributes.Category
|
|
13043
|
+
|
|
13044
|
+
def request = new JsonSlurper().parseText(new String(Base64.decoder.decode('__PEACH_REQUEST__'), 'UTF-8'))
|
|
13045
|
+
def selectedVariants = [:]
|
|
13046
|
+
gradle.beforeProject { project ->
|
|
13047
|
+
def directory = project.projectDir.canonicalPath
|
|
13048
|
+
if (project.rootProject.projectDir.canonicalPath != request.root || !request.projects.contains(directory)) return
|
|
13049
|
+
['com.android.application', 'com.android.library'].each { plugin ->
|
|
13050
|
+
project.pluginManager.withPlugin(plugin) {
|
|
13051
|
+
def components = project.extensions.getByName('androidComponents')
|
|
13052
|
+
components.onVariants(components.selector().withName(request.variant)) { variant ->
|
|
13053
|
+
selectedVariants[directory] = variant
|
|
13054
|
+
}
|
|
13055
|
+
}
|
|
13056
|
+
}
|
|
13057
|
+
}
|
|
13058
|
+
gradle.projectsEvaluated {
|
|
13059
|
+
if (gradle.rootProject.projectDir.canonicalPath != request.root) return
|
|
13060
|
+
def selected = []
|
|
13061
|
+
request.projects.eachWithIndex { directory, index ->
|
|
13062
|
+
def matches = gradle.rootProject.allprojects.findAll { it.projectDir.canonicalPath == directory }
|
|
13063
|
+
if (matches.size() != 1) throw new GradleException('Expected one Android project for ' + directory)
|
|
13064
|
+
def project = matches[0]
|
|
13065
|
+
if (project.pluginManager.hasPlugin('org.jetbrains.kotlin.multiplatform')) {
|
|
13066
|
+
throw new GradleException('Kotlin multiplatform source selection is not supported: ' + project.path)
|
|
13067
|
+
}
|
|
13068
|
+
def library = project.pluginManager.hasPlugin('com.android.library')
|
|
13069
|
+
if (!library && !project.pluginManager.hasPlugin('com.android.application')) {
|
|
13070
|
+
throw new GradleException('Project has no Android application or library plugin: ' + project.path)
|
|
13071
|
+
}
|
|
13072
|
+
def variant = selectedVariants[directory]
|
|
13073
|
+
if (variant == null) throw new GradleException('Android variant ' + request.variant + ' is absent: ' + project.path)
|
|
13074
|
+
def generators = []
|
|
13075
|
+
if (project.pluginManager.hasPlugin('com.facebook.react')) {
|
|
13076
|
+
generators.add(project.tasks.named('generateCodegenArtifactsFromSchema'))
|
|
13077
|
+
}
|
|
13078
|
+
def kotlin = project.tasks.findByName('compile' + variant.name.capitalize() + 'Kotlin')
|
|
13079
|
+
def kotlinSources = kotlin == null ? project.files() : kotlin.sources
|
|
13080
|
+
def javaSources = project.tasks.named('compile' + variant.name.capitalize() + 'JavaWithJavac').get().source
|
|
13081
|
+
def query = project.tasks.register(request.task) {
|
|
13082
|
+
dependsOn(generators)
|
|
13083
|
+
dependsOn(kotlinSources.buildDependencies, javaSources.buildDependencies)
|
|
13084
|
+
doLast {
|
|
13085
|
+
def files = (kotlinSources.files + javaSources.files).unique()
|
|
13086
|
+
def unknown = files.find { !it.name.endsWith('.kt') && !it.name.endsWith('.java') }
|
|
13087
|
+
if (unknown != null) throw new GradleException('Unsupported Android source: ' + unknown)
|
|
13088
|
+
def dependencies = [variant.compileConfiguration, variant.runtimeConfiguration].collectMany { configuration ->
|
|
13089
|
+
def modules = configuration.incoming.resolutionResult.rootComponent.get().dependencies.findAll { !it.constraint }.collectMany { dependency ->
|
|
13090
|
+
if (!(dependency instanceof ResolvedDependencyResult)) throw new GradleException('Unresolved Android dependency: ' + dependency.requested, dependency.failure)
|
|
13091
|
+
def category = dependency.resolvedVariant.attributes.getAttribute(Category.CATEGORY_ATTRIBUTE)?.name
|
|
13092
|
+
if (category == Category.REGULAR_PLATFORM || category == Category.ENFORCED_PLATFORM) return []
|
|
13093
|
+
def id = dependency.selected.id
|
|
13094
|
+
if (id instanceof ModuleComponentIdentifier) return [[kind:'module', group:id.group, name:id.module, version:id.version]]
|
|
13095
|
+
if (id instanceof ProjectComponentIdentifier) return [[kind:'project', name:id.displayName]]
|
|
13096
|
+
throw new GradleException('Unsupported Android dependency component: ' + id.displayName)
|
|
13097
|
+
}
|
|
13098
|
+
def local = configuration.allDependencies.withType(FileCollectionDependency).collectMany { dependency ->
|
|
13099
|
+
dependency.files.files.collect { [kind:'file', name:it.absolutePath] }
|
|
13100
|
+
}
|
|
13101
|
+
modules + local
|
|
13102
|
+
}.unique()
|
|
13103
|
+
new File(request.output, index.toString() + '.json').text = JsonOutput.toJson([
|
|
13104
|
+
projectDir:project.projectDir.canonicalPath,
|
|
13105
|
+
projectPath:project.path,
|
|
13106
|
+
variant:variant.name,
|
|
13107
|
+
applicationId:library ? null : variant.applicationId.get(),
|
|
13108
|
+
namespace:variant.namespace.get(),
|
|
13109
|
+
targetSdk:library ? null : variant.targetSdk.apiLevel,
|
|
13110
|
+
kotlin:files.findAll { it.name.endsWith('.kt') }.collect { it.absolutePath }.sort(),
|
|
13111
|
+
java:files.findAll { it.name.endsWith('.java') }.collect { it.absolutePath }.sort(),
|
|
13112
|
+
dependencies:dependencies
|
|
13113
|
+
])
|
|
13114
|
+
}
|
|
13115
|
+
}
|
|
13116
|
+
selected.add(query)
|
|
13117
|
+
}
|
|
13118
|
+
gradle.rootProject.tasks.register(request.task + 'All') { dependsOn(selected) }
|
|
13119
|
+
}
|
|
13120
|
+
`;
|
|
13121
|
+
}
|
|
13122
|
+
});
|
|
13123
|
+
|
|
12900
13124
|
// src/android-bridge-packages.ts
|
|
12901
13125
|
function readBridgeMethod(value) {
|
|
12902
13126
|
if (!isRecord(value) || typeof value.name !== "string" || typeof value.blocking !== "boolean" || value.returns !== null && typeof value.returns !== "string" || !Array.isArray(value.params))
|
|
@@ -12942,27 +13166,27 @@ function readBridgeFiles(output2) {
|
|
|
12942
13166
|
});
|
|
12943
13167
|
}
|
|
12944
13168
|
function androidAppSources(appRoot) {
|
|
12945
|
-
const moduleDir =
|
|
12946
|
-
const gradle = ["build.gradle", "build.gradle.kts"].map((name3) =>
|
|
13169
|
+
const moduleDir = import_node_path117.default.join(appRoot, "android", "app");
|
|
13170
|
+
const gradle = ["build.gradle", "build.gradle.kts"].map((name3) => import_node_path117.default.join(moduleDir, name3)).find((file) => import_node_fs115.default.existsSync(file));
|
|
12947
13171
|
if (!gradle) return null;
|
|
12948
13172
|
const id = /\bapplicationId\s*=?\s*["']([^"']+)["']/.exec(
|
|
12949
|
-
|
|
13173
|
+
import_node_fs115.default.readFileSync(gradle, "utf8")
|
|
12950
13174
|
);
|
|
12951
13175
|
if (!id) throw new Error(`${gradle}: no applicationId`);
|
|
12952
13176
|
const kotlin = [];
|
|
12953
13177
|
const java = [];
|
|
12954
13178
|
const walk3 = (dir) => {
|
|
12955
|
-
if (!
|
|
12956
|
-
for (const child of
|
|
12957
|
-
const file =
|
|
13179
|
+
if (!import_node_fs115.default.existsSync(dir)) return;
|
|
13180
|
+
for (const child of import_node_fs115.default.readdirSync(dir, { withFileTypes: true }).sort((a, b) => a.name.localeCompare(b.name))) {
|
|
13181
|
+
const file = import_node_path117.default.join(dir, child.name);
|
|
12958
13182
|
if (child.isSymbolicLink()) throw new Error(`Android source is a symlink: ${file}`);
|
|
12959
13183
|
if (child.isDirectory()) walk3(file);
|
|
12960
13184
|
else if (child.name.endsWith(".kt")) kotlin.push(file);
|
|
12961
13185
|
else if (child.name.endsWith(".java")) java.push(file);
|
|
12962
13186
|
}
|
|
12963
13187
|
};
|
|
12964
|
-
walk3(
|
|
12965
|
-
walk3(
|
|
13188
|
+
walk3(import_node_path117.default.join(moduleDir, "src", "main", "java"));
|
|
13189
|
+
walk3(import_node_path117.default.join(moduleDir, "src", "main", "kotlin"));
|
|
12966
13190
|
return { applicationId: id[1], kotlin, java };
|
|
12967
13191
|
}
|
|
12968
13192
|
function declares(source, owner, name3) {
|
|
@@ -12971,7 +13195,7 @@ function declares(source, owner, name3) {
|
|
|
12971
13195
|
}
|
|
12972
13196
|
function selectBridgePackages(applicationId, files2, javaFiles) {
|
|
12973
13197
|
const texts = new Map(
|
|
12974
|
-
files2.map((file) => [file.file,
|
|
13198
|
+
files2.map((file) => [file.file, import_node_fs115.default.readFileSync(file.file, "utf8")])
|
|
12975
13199
|
);
|
|
12976
13200
|
const owners = /* @__PURE__ */ new Map();
|
|
12977
13201
|
for (const file of files2)
|
|
@@ -12979,8 +13203,8 @@ function selectBridgePackages(applicationId, files2, javaFiles) {
|
|
|
12979
13203
|
owners.set(name3, [...owners.get(name3) ?? [], file]);
|
|
12980
13204
|
const javaDeclarations = javaFiles.map((file) => ({
|
|
12981
13205
|
file,
|
|
12982
|
-
package: /^\s*package\s+([\w.]+)\s*;/m.exec(
|
|
12983
|
-
name:
|
|
13206
|
+
package: /^\s*package\s+([\w.]+)\s*;/m.exec(import_node_fs115.default.readFileSync(file, "utf8"))?.[1] ?? "",
|
|
13207
|
+
name: import_node_path117.default.basename(file, ".java")
|
|
12984
13208
|
}));
|
|
12985
13209
|
const closure = (root) => {
|
|
12986
13210
|
const seen = /* @__PURE__ */ new Set([root]);
|
|
@@ -13053,65 +13277,15 @@ function moduleName(text6, className2) {
|
|
|
13053
13277
|
);
|
|
13054
13278
|
return match ? match[1] : null;
|
|
13055
13279
|
}
|
|
13056
|
-
var
|
|
13280
|
+
var import_node_fs115, import_node_path117, qualified2;
|
|
13057
13281
|
var init_android_bridge_packages = __esm({
|
|
13058
13282
|
"src/android-bridge-packages.ts"() {
|
|
13059
13283
|
"use strict";
|
|
13060
13284
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
13061
|
-
import_node_fs114 = __toESM(require("node:fs"), 1);
|
|
13062
|
-
import_node_path116 = __toESM(require("node:path"), 1);
|
|
13063
|
-
init_is_record();
|
|
13064
|
-
qualified2 = (file, name3) => file.package ? `${file.package}.${name3}` : name3;
|
|
13065
|
-
}
|
|
13066
|
-
});
|
|
13067
|
-
|
|
13068
|
-
// src/kotlin-module.ts
|
|
13069
|
-
function peachKotlinModuleRoot() {
|
|
13070
|
-
if (!IS_STANDALONE)
|
|
13071
|
-
return import_node_path117.default.resolve(import_node_path117.default.dirname((0, import_node_url9.fileURLToPath)(__sootsim_import_meta_url)), "..", "kotlin");
|
|
13072
|
-
if (installedRoot) return installedRoot;
|
|
13073
|
-
const files2 = __PEACH_BUNDLED_KOTLIN__;
|
|
13074
|
-
const digest3 = (0, import_node_crypto59.createHash)("sha256").update(JSON.stringify(files2)).digest("hex");
|
|
13075
|
-
const parent = import_node_path117.default.join(rnxHomeDir(), "kotlin", "modules");
|
|
13076
|
-
const root = import_node_path117.default.join(parent, digest3);
|
|
13077
|
-
import_node_fs115.default.mkdirSync(parent, { recursive: true });
|
|
13078
|
-
if (!import_node_fs115.default.existsSync(root)) {
|
|
13079
|
-
const pending = import_node_fs115.default.mkdtempSync(import_node_path117.default.join(parent, ".install-"));
|
|
13080
|
-
try {
|
|
13081
|
-
for (const [name3, contents] of Object.entries(files2)) {
|
|
13082
|
-
const file = import_node_path117.default.join(pending, name3);
|
|
13083
|
-
import_node_fs115.default.mkdirSync(import_node_path117.default.dirname(file), { recursive: true });
|
|
13084
|
-
import_node_fs115.default.writeFileSync(file, Buffer.from(contents, "base64"));
|
|
13085
|
-
}
|
|
13086
|
-
try {
|
|
13087
|
-
import_node_fs115.default.renameSync(pending, root);
|
|
13088
|
-
} catch (error) {
|
|
13089
|
-
if (!isRecord(error) || error.code !== "EEXIST" && error.code !== "ENOTEMPTY")
|
|
13090
|
-
throw error;
|
|
13091
|
-
}
|
|
13092
|
-
} finally {
|
|
13093
|
-
import_node_fs115.default.rmSync(pending, { recursive: true, force: true });
|
|
13094
|
-
}
|
|
13095
|
-
}
|
|
13096
|
-
for (const [name3, contents] of Object.entries(files2)) {
|
|
13097
|
-
if (!import_node_fs115.default.readFileSync(import_node_path117.default.join(root, name3)).equals(Buffer.from(contents, "base64")))
|
|
13098
|
-
throw new Error(`packaged Kotlin module differs from this CLI: ${name3}`);
|
|
13099
|
-
}
|
|
13100
|
-
installedRoot = root;
|
|
13101
|
-
return root;
|
|
13102
|
-
}
|
|
13103
|
-
var import_node_crypto59, import_node_fs115, import_node_path117, import_node_url9, installedRoot;
|
|
13104
|
-
var init_kotlin_module = __esm({
|
|
13105
|
-
"src/kotlin-module.ts"() {
|
|
13106
|
-
"use strict";
|
|
13107
|
-
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
13108
|
-
import_node_crypto59 = require("node:crypto");
|
|
13109
13285
|
import_node_fs115 = __toESM(require("node:fs"), 1);
|
|
13110
13286
|
import_node_path117 = __toESM(require("node:path"), 1);
|
|
13111
|
-
import_node_url9 = require("node:url");
|
|
13112
|
-
init_standalone();
|
|
13113
|
-
init_home_paths();
|
|
13114
13287
|
init_is_record();
|
|
13288
|
+
qualified2 = (file, name3) => file.package ? `${file.package}.${name3}` : name3;
|
|
13115
13289
|
}
|
|
13116
13290
|
});
|
|
13117
13291
|
|
|
@@ -13131,7 +13305,7 @@ async function readJavaModuleSpecs(files2, sdkRoot, toolchain) {
|
|
|
13131
13305
|
import_node_fs116.default.writeFileSync(target, bytes);
|
|
13132
13306
|
origins.set(target, file);
|
|
13133
13307
|
}
|
|
13134
|
-
const { stdout } = await
|
|
13308
|
+
const { stdout } = await run10(
|
|
13135
13309
|
import_node_path118.default.join(toolchain.javaHome, "bin", "java"),
|
|
13136
13310
|
[
|
|
13137
13311
|
"-cp",
|
|
@@ -13144,7 +13318,14 @@ async function readJavaModuleSpecs(files2, sdkRoot, toolchain) {
|
|
|
13144
13318
|
...origins.keys()
|
|
13145
13319
|
],
|
|
13146
13320
|
{ maxBuffer: 16 * 1024 * 1024 }
|
|
13147
|
-
)
|
|
13321
|
+
).catch((cause) => {
|
|
13322
|
+
if (!isRecord(cause) || typeof cause.stderr !== "string") throw cause;
|
|
13323
|
+
let diagnostic = cause.stderr;
|
|
13324
|
+
for (const [temporary, original] of origins)
|
|
13325
|
+
diagnostic = diagnostic.replaceAll(temporary, original);
|
|
13326
|
+
throw new Error(`Java module read failed:
|
|
13327
|
+
${diagnostic.trim()}`, { cause });
|
|
13328
|
+
});
|
|
13148
13329
|
const specs = stdout.split("\n").filter(Boolean).map((line) => {
|
|
13149
13330
|
const row = JSON.parse(line);
|
|
13150
13331
|
if (!isRecord(row) || typeof row.file !== "string" || typeof row.className !== "string" || row.name !== null && typeof row.name !== "string" || typeof row.source !== "string" || !Array.isArray(row.methods))
|
|
@@ -13182,7 +13363,7 @@ async function compileJavaModuleAbi(input) {
|
|
|
13182
13363
|
].join("\n")
|
|
13183
13364
|
);
|
|
13184
13365
|
const name3 = `peach-java-abi-${hash}`;
|
|
13185
|
-
await
|
|
13366
|
+
await run10(
|
|
13186
13367
|
toolchain.kotlinc,
|
|
13187
13368
|
[
|
|
13188
13369
|
"-J-Xmx2g",
|
|
@@ -13206,7 +13387,7 @@ async function compileJavaModuleAbi(input) {
|
|
|
13206
13387
|
{ maxBuffer: 16 * 1024 * 1024 }
|
|
13207
13388
|
);
|
|
13208
13389
|
const library = import_node_path118.default.join(directory2, "java-abi.klib");
|
|
13209
|
-
await
|
|
13390
|
+
await run10(
|
|
13210
13391
|
import_node_path118.default.join(toolchain.javaHome, "bin", "java"),
|
|
13211
13392
|
[
|
|
13212
13393
|
"-cp",
|
|
@@ -13223,24 +13404,308 @@ async function compileJavaModuleAbi(input) {
|
|
|
13223
13404
|
);
|
|
13224
13405
|
return library;
|
|
13225
13406
|
}
|
|
13226
|
-
var
|
|
13407
|
+
var import_node_child_process51, import_node_crypto60, import_node_fs116, import_node_path118, import_node_util20, run10, JAVA_BINDINGS_INITIALIZER;
|
|
13227
13408
|
var init_java_module_abi = __esm({
|
|
13228
13409
|
"src/java-module-abi.ts"() {
|
|
13229
13410
|
"use strict";
|
|
13230
13411
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
13231
|
-
|
|
13412
|
+
import_node_child_process51 = require("node:child_process");
|
|
13232
13413
|
import_node_crypto60 = require("node:crypto");
|
|
13233
13414
|
import_node_fs116 = __toESM(require("node:fs"), 1);
|
|
13234
13415
|
import_node_path118 = __toESM(require("node:path"), 1);
|
|
13235
|
-
|
|
13416
|
+
import_node_util20 = require("node:util");
|
|
13236
13417
|
init_android_bridge_packages();
|
|
13237
13418
|
init_is_record();
|
|
13238
13419
|
init_kotlin_toolchain();
|
|
13239
|
-
|
|
13420
|
+
run10 = (0, import_node_util20.promisify)(import_node_child_process51.execFile);
|
|
13240
13421
|
JAVA_BINDINGS_INITIALIZER = "initializeJavaBindings";
|
|
13241
13422
|
}
|
|
13242
13423
|
});
|
|
13243
13424
|
|
|
13425
|
+
// src/kotlinSdkContract.ts
|
|
13426
|
+
function readKotlinSdkManifest(source, compilerSha256) {
|
|
13427
|
+
const value = JSON.parse(source);
|
|
13428
|
+
if (!isRecord(value) || value.format !== 1 || value.abi !== 1 || value.compilerSha256 !== compilerSha256 || typeof value.sourceDigest !== "string" || !/^[a-f0-9]{64}$/.test(value.sourceDigest) || !isRecord(value.files) || Object.keys(value.files).length !== KOTLIN_SDK_FILES.length)
|
|
13429
|
+
throw new Error("Kotlin SDK manifest is incompatible with this compiler");
|
|
13430
|
+
const files2 = {};
|
|
13431
|
+
for (const name3 of KOTLIN_SDK_FILES) {
|
|
13432
|
+
const file = value.files[name3];
|
|
13433
|
+
if (!isRecord(file) || typeof file.sha256 !== "string" || !/^[a-f0-9]{64}$/.test(file.sha256) || typeof file.bytes !== "number" || !Number.isSafeInteger(file.bytes) || file.bytes < 1)
|
|
13434
|
+
throw new Error(`Kotlin SDK has no verified binary ${name3}`);
|
|
13435
|
+
files2[name3] = { sha256: file.sha256, bytes: file.bytes };
|
|
13436
|
+
}
|
|
13437
|
+
return {
|
|
13438
|
+
format: 1,
|
|
13439
|
+
abi: 1,
|
|
13440
|
+
compilerSha256,
|
|
13441
|
+
sourceDigest: value.sourceDigest,
|
|
13442
|
+
files: files2
|
|
13443
|
+
};
|
|
13444
|
+
}
|
|
13445
|
+
var platform, KOTLIN_SDK_PROFILES, KOTLIN_SDK_FILES;
|
|
13446
|
+
var init_kotlinSdkContract = __esm({
|
|
13447
|
+
"src/kotlinSdkContract.ts"() {
|
|
13448
|
+
"use strict";
|
|
13449
|
+
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
13450
|
+
init_is_record();
|
|
13451
|
+
platform = ["Sources", "JniPlatformSources", "JniSources"];
|
|
13452
|
+
KOTLIN_SDK_PROFILES = {
|
|
13453
|
+
core: { compose: false, directories: platform },
|
|
13454
|
+
compose: { compose: true, directories: platform },
|
|
13455
|
+
views: { compose: true, directories: [...platform, "ComposeSources"] },
|
|
13456
|
+
jni: { compose: false, directories: [...platform, "JniTransportSources"] },
|
|
13457
|
+
jniCompose: {
|
|
13458
|
+
compose: true,
|
|
13459
|
+
directories: [...platform, "JniTransportSources"]
|
|
13460
|
+
},
|
|
13461
|
+
jniViews: {
|
|
13462
|
+
compose: true,
|
|
13463
|
+
directories: [...platform, "JniTransportSources", "ComposeSources"]
|
|
13464
|
+
},
|
|
13465
|
+
expo: {
|
|
13466
|
+
compose: false,
|
|
13467
|
+
directories: [...platform, "ExpoSources", "BridgeSources", "AndroidViewSources"]
|
|
13468
|
+
},
|
|
13469
|
+
expoCompose: {
|
|
13470
|
+
compose: true,
|
|
13471
|
+
directories: [
|
|
13472
|
+
...platform,
|
|
13473
|
+
"ExpoSources",
|
|
13474
|
+
"BridgeSources",
|
|
13475
|
+
"AndroidViewSources",
|
|
13476
|
+
"ComposeSources",
|
|
13477
|
+
"AndroidComposeSources",
|
|
13478
|
+
"ExpoComposeSources"
|
|
13479
|
+
]
|
|
13480
|
+
},
|
|
13481
|
+
app: {
|
|
13482
|
+
compose: true,
|
|
13483
|
+
directories: [
|
|
13484
|
+
...platform,
|
|
13485
|
+
"ComposeSources",
|
|
13486
|
+
"AppSources",
|
|
13487
|
+
"AndroidViewSources",
|
|
13488
|
+
"AndroidComposeSources"
|
|
13489
|
+
]
|
|
13490
|
+
}
|
|
13491
|
+
};
|
|
13492
|
+
KOTLIN_SDK_FILES = [
|
|
13493
|
+
"plugin.jar",
|
|
13494
|
+
"tools.jar",
|
|
13495
|
+
...Object.keys(KOTLIN_SDK_PROFILES).map((name3) => `${name3}.klib`)
|
|
13496
|
+
];
|
|
13497
|
+
}
|
|
13498
|
+
});
|
|
13499
|
+
|
|
13500
|
+
// src/kotlin-sdk.ts
|
|
13501
|
+
function verifyKotlinSdkDirectory(root, compilerSha256) {
|
|
13502
|
+
const expectedNames = ["manifest.json", ...KOTLIN_SDK_FILES];
|
|
13503
|
+
const names = import_node_fs117.default.readdirSync(root);
|
|
13504
|
+
if (names.length !== expectedNames.length || names.some((name3) => !expectedNames.includes(name3)))
|
|
13505
|
+
throw new Error("Kotlin SDK directory contains unexpected inputs");
|
|
13506
|
+
const manifestStat = import_node_fs117.default.lstatSync(import_node_path119.default.join(root, "manifest.json"));
|
|
13507
|
+
if (!manifestStat.isFile() || manifestStat.nlink !== 1)
|
|
13508
|
+
throw new Error("Kotlin SDK manifest is not a regular file");
|
|
13509
|
+
const manifest = readKotlinSdkManifest(
|
|
13510
|
+
import_node_fs117.default.readFileSync(import_node_path119.default.join(root, "manifest.json"), "utf8"),
|
|
13511
|
+
compilerSha256
|
|
13512
|
+
);
|
|
13513
|
+
for (const [name3, expected] of Object.entries(manifest.files)) {
|
|
13514
|
+
const target = import_node_path119.default.join(root, name3);
|
|
13515
|
+
const stat2 = import_node_fs117.default.lstatSync(target);
|
|
13516
|
+
if (!stat2.isFile() || stat2.nlink !== 1)
|
|
13517
|
+
throw new Error(`Kotlin SDK binary is not a regular file: ${name3}`);
|
|
13518
|
+
const bytes = import_node_fs117.default.readFileSync(target);
|
|
13519
|
+
if (bytes.length !== expected.bytes || (0, import_node_crypto61.createHash)("sha256").update(bytes).digest("hex") !== expected.sha256)
|
|
13520
|
+
throw new Error(`Kotlin SDK binary differs from its manifest: ${name3}`);
|
|
13521
|
+
}
|
|
13522
|
+
return manifest;
|
|
13523
|
+
}
|
|
13524
|
+
async function installKotlinSdkArchive(archive, compilerSha256) {
|
|
13525
|
+
const sha2564 = (0, import_node_crypto61.createHash)("sha256").update(archive).digest("hex");
|
|
13526
|
+
const parent = import_node_path119.default.join(kotlinHome(), "sdk");
|
|
13527
|
+
const root = import_node_path119.default.join(parent, sha2564);
|
|
13528
|
+
if (import_node_fs117.default.existsSync(root))
|
|
13529
|
+
return { root, sha256: sha2564, manifest: verifyKotlinSdkDirectory(root, compilerSha256) };
|
|
13530
|
+
import_node_fs117.default.mkdirSync(parent, { recursive: true });
|
|
13531
|
+
const work = import_node_fs117.default.mkdtempSync(import_node_path119.default.join(parent, ".install-"));
|
|
13532
|
+
try {
|
|
13533
|
+
const packed = import_node_path119.default.join(work, "sdk.tar.gz");
|
|
13534
|
+
import_node_fs117.default.writeFileSync(packed, archive);
|
|
13535
|
+
const { stdout } = await run11("tar", ["-tzf", packed]);
|
|
13536
|
+
const names = stdout.trim().split("\n");
|
|
13537
|
+
const expected = ["manifest.json", ...KOTLIN_SDK_FILES];
|
|
13538
|
+
if (names.length !== expected.length || new Set(names).size !== names.length || names.some((name3) => !expected.includes(name3)))
|
|
13539
|
+
throw new Error("Kotlin SDK archive contains unexpected inputs");
|
|
13540
|
+
await run11("tar", ["-xzf", packed, "-C", work, "--", ...expected]);
|
|
13541
|
+
import_node_fs117.default.rmSync(packed);
|
|
13542
|
+
const manifest = verifyKotlinSdkDirectory(work, compilerSha256);
|
|
13543
|
+
try {
|
|
13544
|
+
import_node_fs117.default.renameSync(work, root);
|
|
13545
|
+
} catch (error) {
|
|
13546
|
+
if (!import_node_fs117.default.existsSync(root)) throw error;
|
|
13547
|
+
verifyKotlinSdkDirectory(root, compilerSha256);
|
|
13548
|
+
}
|
|
13549
|
+
return { root, sha256: sha2564, manifest };
|
|
13550
|
+
} finally {
|
|
13551
|
+
import_node_fs117.default.rmSync(work, { recursive: true, force: true });
|
|
13552
|
+
}
|
|
13553
|
+
}
|
|
13554
|
+
var import_node_child_process52, import_node_crypto61, import_node_fs117, import_node_path119, import_node_util21, run11;
|
|
13555
|
+
var init_kotlin_sdk = __esm({
|
|
13556
|
+
"src/kotlin-sdk.ts"() {
|
|
13557
|
+
"use strict";
|
|
13558
|
+
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
13559
|
+
import_node_child_process52 = require("node:child_process");
|
|
13560
|
+
import_node_crypto61 = require("node:crypto");
|
|
13561
|
+
import_node_fs117 = __toESM(require("node:fs"), 1);
|
|
13562
|
+
import_node_path119 = __toESM(require("node:path"), 1);
|
|
13563
|
+
import_node_util21 = require("node:util");
|
|
13564
|
+
init_kotlin_toolchain();
|
|
13565
|
+
init_kotlinSdkContract();
|
|
13566
|
+
run11 = (0, import_node_util21.promisify)(import_node_child_process52.execFile);
|
|
13567
|
+
}
|
|
13568
|
+
});
|
|
13569
|
+
|
|
13570
|
+
// src/android-bridge-dependencies.ts
|
|
13571
|
+
async function collectAndroidBridgeDependencies(appRoot, moduleRoot) {
|
|
13572
|
+
const root = import_node_path120.default.join(appRoot, "android");
|
|
13573
|
+
if (!import_node_fs118.default.existsSync(import_node_path120.default.join(root, "gradlew"))) return null;
|
|
13574
|
+
const dependencies = (await resolveReactNativeAndroidAutolinking(appRoot)).flatMap(
|
|
13575
|
+
(dependency) => dependency.sourceDir === null || dependency.packageInstance === null ? [] : [
|
|
13576
|
+
{
|
|
13577
|
+
...dependency,
|
|
13578
|
+
sourceDir: dependency.sourceDir,
|
|
13579
|
+
packageInstance: dependency.packageInstance
|
|
13580
|
+
}
|
|
13581
|
+
]
|
|
13582
|
+
);
|
|
13583
|
+
if (dependencies.length === 0) return null;
|
|
13584
|
+
const models = await resolveAndroidGradleSources({
|
|
13585
|
+
root,
|
|
13586
|
+
projects: [
|
|
13587
|
+
import_node_path120.default.join(root, "app"),
|
|
13588
|
+
...dependencies.map((dependency) => dependency.sourceDir)
|
|
13589
|
+
],
|
|
13590
|
+
variant: "debug"
|
|
13591
|
+
});
|
|
13592
|
+
const applicationId = models[0].applicationId;
|
|
13593
|
+
if (applicationId === null) throw new Error(`${root}/app is not an Android application`);
|
|
13594
|
+
const toolchain = readToolchain(moduleRoot);
|
|
13595
|
+
const [sdk, ready] = await Promise.all([
|
|
13596
|
+
installKotlinSdkArchive(
|
|
13597
|
+
import_node_fs118.default.readFileSync(import_node_path120.default.join(moduleRoot, "sdk.tar.gz")),
|
|
13598
|
+
toolchain.compiler.sha256
|
|
13599
|
+
),
|
|
13600
|
+
ensureToolchain(toolchain)
|
|
13601
|
+
]);
|
|
13602
|
+
const packages = [];
|
|
13603
|
+
for (const dependency of dependencies) {
|
|
13604
|
+
const model = models.find(
|
|
13605
|
+
(entry) => entry.projectDir === import_node_fs118.default.realpathSync(dependency.sourceDir)
|
|
13606
|
+
);
|
|
13607
|
+
try {
|
|
13608
|
+
const className2 = /^import\s+([\w.]+)\s*;$/.exec(
|
|
13609
|
+
dependency.packageImportPath ?? ""
|
|
13610
|
+
)?.[1];
|
|
13611
|
+
const constructor = /^new\s+([\w.]+)\s*\(\s*\)$/.exec(
|
|
13612
|
+
dependency.packageInstance
|
|
13613
|
+
)?.[1];
|
|
13614
|
+
if (!className2 || constructor !== className2 && constructor !== className2.split(".").pop())
|
|
13615
|
+
throw new Error(
|
|
13616
|
+
"native package registration requires a constructor without arguments"
|
|
13617
|
+
);
|
|
13618
|
+
const declarations = await readJavaModuleSpecs(model.java, sdk.root, ready);
|
|
13619
|
+
const modules = declarations.specs.flatMap(
|
|
13620
|
+
(spec) => spec.name === null ? [] : [
|
|
13621
|
+
{
|
|
13622
|
+
className: spec.className,
|
|
13623
|
+
name: spec.name,
|
|
13624
|
+
methods: spec.methods
|
|
13625
|
+
}
|
|
13626
|
+
]
|
|
13627
|
+
);
|
|
13628
|
+
if (modules.length === 0) continue;
|
|
13629
|
+
packages.push({
|
|
13630
|
+
className: className2,
|
|
13631
|
+
modules,
|
|
13632
|
+
sources: model.kotlin,
|
|
13633
|
+
javaSpecs: model.java,
|
|
13634
|
+
unsupported: null
|
|
13635
|
+
});
|
|
13636
|
+
} catch (error) {
|
|
13637
|
+
console.error(
|
|
13638
|
+
`[peach] ${dependency.name} native source is unavailable: ${error instanceof Error ? error.message : String(error)}`
|
|
13639
|
+
);
|
|
13640
|
+
}
|
|
13641
|
+
}
|
|
13642
|
+
return packages.length ? { applicationId, packages } : null;
|
|
13643
|
+
}
|
|
13644
|
+
var import_node_fs118, import_node_path120;
|
|
13645
|
+
var init_android_bridge_dependencies = __esm({
|
|
13646
|
+
"src/android-bridge-dependencies.ts"() {
|
|
13647
|
+
"use strict";
|
|
13648
|
+
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
13649
|
+
import_node_fs118 = __toESM(require("node:fs"), 1);
|
|
13650
|
+
import_node_path120 = __toESM(require("node:path"), 1);
|
|
13651
|
+
init_android_autolinking();
|
|
13652
|
+
init_android_gradle_sources();
|
|
13653
|
+
init_java_module_abi();
|
|
13654
|
+
init_kotlin_sdk();
|
|
13655
|
+
init_kotlin_toolchain();
|
|
13656
|
+
}
|
|
13657
|
+
});
|
|
13658
|
+
|
|
13659
|
+
// src/kotlin-module.ts
|
|
13660
|
+
function peachKotlinModuleRoot() {
|
|
13661
|
+
if (!IS_STANDALONE)
|
|
13662
|
+
return import_node_path121.default.resolve(import_node_path121.default.dirname((0, import_node_url9.fileURLToPath)(__sootsim_import_meta_url)), "..", "kotlin");
|
|
13663
|
+
if (installedRoot) return installedRoot;
|
|
13664
|
+
const files2 = __PEACH_BUNDLED_KOTLIN__;
|
|
13665
|
+
const digest3 = (0, import_node_crypto62.createHash)("sha256").update(JSON.stringify(files2)).digest("hex");
|
|
13666
|
+
const parent = import_node_path121.default.join(rnxHomeDir(), "kotlin", "modules");
|
|
13667
|
+
const root = import_node_path121.default.join(parent, digest3);
|
|
13668
|
+
import_node_fs119.default.mkdirSync(parent, { recursive: true });
|
|
13669
|
+
if (!import_node_fs119.default.existsSync(root)) {
|
|
13670
|
+
const pending = import_node_fs119.default.mkdtempSync(import_node_path121.default.join(parent, ".install-"));
|
|
13671
|
+
try {
|
|
13672
|
+
for (const [name3, contents] of Object.entries(files2)) {
|
|
13673
|
+
const file = import_node_path121.default.join(pending, name3);
|
|
13674
|
+
import_node_fs119.default.mkdirSync(import_node_path121.default.dirname(file), { recursive: true });
|
|
13675
|
+
import_node_fs119.default.writeFileSync(file, Buffer.from(contents, "base64"));
|
|
13676
|
+
}
|
|
13677
|
+
try {
|
|
13678
|
+
import_node_fs119.default.renameSync(pending, root);
|
|
13679
|
+
} catch (error) {
|
|
13680
|
+
if (!isRecord(error) || error.code !== "EEXIST" && error.code !== "ENOTEMPTY")
|
|
13681
|
+
throw error;
|
|
13682
|
+
}
|
|
13683
|
+
} finally {
|
|
13684
|
+
import_node_fs119.default.rmSync(pending, { recursive: true, force: true });
|
|
13685
|
+
}
|
|
13686
|
+
}
|
|
13687
|
+
for (const [name3, contents] of Object.entries(files2)) {
|
|
13688
|
+
if (!import_node_fs119.default.readFileSync(import_node_path121.default.join(root, name3)).equals(Buffer.from(contents, "base64")))
|
|
13689
|
+
throw new Error(`packaged Kotlin module differs from this CLI: ${name3}`);
|
|
13690
|
+
}
|
|
13691
|
+
installedRoot = root;
|
|
13692
|
+
return root;
|
|
13693
|
+
}
|
|
13694
|
+
var import_node_crypto62, import_node_fs119, import_node_path121, import_node_url9, installedRoot;
|
|
13695
|
+
var init_kotlin_module = __esm({
|
|
13696
|
+
"src/kotlin-module.ts"() {
|
|
13697
|
+
"use strict";
|
|
13698
|
+
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
13699
|
+
import_node_crypto62 = require("node:crypto");
|
|
13700
|
+
import_node_fs119 = __toESM(require("node:fs"), 1);
|
|
13701
|
+
import_node_path121 = __toESM(require("node:path"), 1);
|
|
13702
|
+
import_node_url9 = require("node:url");
|
|
13703
|
+
init_standalone();
|
|
13704
|
+
init_home_paths();
|
|
13705
|
+
init_is_record();
|
|
13706
|
+
}
|
|
13707
|
+
});
|
|
13708
|
+
|
|
13244
13709
|
// src/kotlin-instance-source.ts
|
|
13245
13710
|
function bindingNames(pattern) {
|
|
13246
13711
|
if (pattern.type === "Identifier") return [pattern.name];
|
|
@@ -13354,144 +13819,6 @@ var init_kotlin_instance_source = __esm({
|
|
|
13354
13819
|
}
|
|
13355
13820
|
});
|
|
13356
13821
|
|
|
13357
|
-
// src/kotlinSdkContract.ts
|
|
13358
|
-
function readKotlinSdkManifest(source, compilerSha256) {
|
|
13359
|
-
const value = JSON.parse(source);
|
|
13360
|
-
if (!isRecord(value) || value.format !== 1 || value.abi !== 1 || value.compilerSha256 !== compilerSha256 || typeof value.sourceDigest !== "string" || !/^[a-f0-9]{64}$/.test(value.sourceDigest) || !isRecord(value.files) || Object.keys(value.files).length !== KOTLIN_SDK_FILES.length)
|
|
13361
|
-
throw new Error("Kotlin SDK manifest is incompatible with this compiler");
|
|
13362
|
-
const files2 = {};
|
|
13363
|
-
for (const name3 of KOTLIN_SDK_FILES) {
|
|
13364
|
-
const file = value.files[name3];
|
|
13365
|
-
if (!isRecord(file) || typeof file.sha256 !== "string" || !/^[a-f0-9]{64}$/.test(file.sha256) || typeof file.bytes !== "number" || !Number.isSafeInteger(file.bytes) || file.bytes < 1)
|
|
13366
|
-
throw new Error(`Kotlin SDK has no verified binary ${name3}`);
|
|
13367
|
-
files2[name3] = { sha256: file.sha256, bytes: file.bytes };
|
|
13368
|
-
}
|
|
13369
|
-
return {
|
|
13370
|
-
format: 1,
|
|
13371
|
-
abi: 1,
|
|
13372
|
-
compilerSha256,
|
|
13373
|
-
sourceDigest: value.sourceDigest,
|
|
13374
|
-
files: files2
|
|
13375
|
-
};
|
|
13376
|
-
}
|
|
13377
|
-
var platform, KOTLIN_SDK_PROFILES, KOTLIN_SDK_FILES;
|
|
13378
|
-
var init_kotlinSdkContract = __esm({
|
|
13379
|
-
"src/kotlinSdkContract.ts"() {
|
|
13380
|
-
"use strict";
|
|
13381
|
-
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
13382
|
-
init_is_record();
|
|
13383
|
-
platform = ["Sources", "JniPlatformSources", "JniSources"];
|
|
13384
|
-
KOTLIN_SDK_PROFILES = {
|
|
13385
|
-
core: { compose: false, directories: platform },
|
|
13386
|
-
compose: { compose: true, directories: platform },
|
|
13387
|
-
views: { compose: true, directories: [...platform, "ComposeSources"] },
|
|
13388
|
-
jni: { compose: false, directories: [...platform, "JniTransportSources"] },
|
|
13389
|
-
jniCompose: {
|
|
13390
|
-
compose: true,
|
|
13391
|
-
directories: [...platform, "JniTransportSources"]
|
|
13392
|
-
},
|
|
13393
|
-
jniViews: {
|
|
13394
|
-
compose: true,
|
|
13395
|
-
directories: [...platform, "JniTransportSources", "ComposeSources"]
|
|
13396
|
-
},
|
|
13397
|
-
expo: {
|
|
13398
|
-
compose: false,
|
|
13399
|
-
directories: [...platform, "ExpoSources", "BridgeSources", "AndroidViewSources"]
|
|
13400
|
-
},
|
|
13401
|
-
expoCompose: {
|
|
13402
|
-
compose: true,
|
|
13403
|
-
directories: [
|
|
13404
|
-
...platform,
|
|
13405
|
-
"ExpoSources",
|
|
13406
|
-
"BridgeSources",
|
|
13407
|
-
"AndroidViewSources",
|
|
13408
|
-
"ComposeSources",
|
|
13409
|
-
"ExpoComposeSources"
|
|
13410
|
-
]
|
|
13411
|
-
},
|
|
13412
|
-
app: {
|
|
13413
|
-
compose: true,
|
|
13414
|
-
directories: [...platform, "ComposeSources", "AppSources", "AndroidViewSources"]
|
|
13415
|
-
}
|
|
13416
|
-
};
|
|
13417
|
-
KOTLIN_SDK_FILES = [
|
|
13418
|
-
"plugin.jar",
|
|
13419
|
-
"tools.jar",
|
|
13420
|
-
...Object.keys(KOTLIN_SDK_PROFILES).map((name3) => `${name3}.klib`)
|
|
13421
|
-
];
|
|
13422
|
-
}
|
|
13423
|
-
});
|
|
13424
|
-
|
|
13425
|
-
// src/kotlin-sdk.ts
|
|
13426
|
-
function verifyKotlinSdkDirectory(root, compilerSha256) {
|
|
13427
|
-
const expectedNames = ["manifest.json", ...KOTLIN_SDK_FILES];
|
|
13428
|
-
const names = import_node_fs117.default.readdirSync(root);
|
|
13429
|
-
if (names.length !== expectedNames.length || names.some((name3) => !expectedNames.includes(name3)))
|
|
13430
|
-
throw new Error("Kotlin SDK directory contains unexpected inputs");
|
|
13431
|
-
const manifestStat = import_node_fs117.default.lstatSync(import_node_path119.default.join(root, "manifest.json"));
|
|
13432
|
-
if (!manifestStat.isFile() || manifestStat.nlink !== 1)
|
|
13433
|
-
throw new Error("Kotlin SDK manifest is not a regular file");
|
|
13434
|
-
const manifest = readKotlinSdkManifest(
|
|
13435
|
-
import_node_fs117.default.readFileSync(import_node_path119.default.join(root, "manifest.json"), "utf8"),
|
|
13436
|
-
compilerSha256
|
|
13437
|
-
);
|
|
13438
|
-
for (const [name3, expected] of Object.entries(manifest.files)) {
|
|
13439
|
-
const target = import_node_path119.default.join(root, name3);
|
|
13440
|
-
const stat2 = import_node_fs117.default.lstatSync(target);
|
|
13441
|
-
if (!stat2.isFile() || stat2.nlink !== 1)
|
|
13442
|
-
throw new Error(`Kotlin SDK binary is not a regular file: ${name3}`);
|
|
13443
|
-
const bytes = import_node_fs117.default.readFileSync(target);
|
|
13444
|
-
if (bytes.length !== expected.bytes || (0, import_node_crypto61.createHash)("sha256").update(bytes).digest("hex") !== expected.sha256)
|
|
13445
|
-
throw new Error(`Kotlin SDK binary differs from its manifest: ${name3}`);
|
|
13446
|
-
}
|
|
13447
|
-
return manifest;
|
|
13448
|
-
}
|
|
13449
|
-
async function installKotlinSdkArchive(archive, compilerSha256) {
|
|
13450
|
-
const sha2564 = (0, import_node_crypto61.createHash)("sha256").update(archive).digest("hex");
|
|
13451
|
-
const parent = import_node_path119.default.join(kotlinHome(), "sdk");
|
|
13452
|
-
const root = import_node_path119.default.join(parent, sha2564);
|
|
13453
|
-
if (import_node_fs117.default.existsSync(root))
|
|
13454
|
-
return { root, sha256: sha2564, manifest: verifyKotlinSdkDirectory(root, compilerSha256) };
|
|
13455
|
-
import_node_fs117.default.mkdirSync(parent, { recursive: true });
|
|
13456
|
-
const work = import_node_fs117.default.mkdtempSync(import_node_path119.default.join(parent, ".install-"));
|
|
13457
|
-
try {
|
|
13458
|
-
const packed = import_node_path119.default.join(work, "sdk.tar.gz");
|
|
13459
|
-
import_node_fs117.default.writeFileSync(packed, archive);
|
|
13460
|
-
const { stdout } = await run10("tar", ["-tzf", packed]);
|
|
13461
|
-
const names = stdout.trim().split("\n");
|
|
13462
|
-
const expected = ["manifest.json", ...KOTLIN_SDK_FILES];
|
|
13463
|
-
if (names.length !== expected.length || new Set(names).size !== names.length || names.some((name3) => !expected.includes(name3)))
|
|
13464
|
-
throw new Error("Kotlin SDK archive contains unexpected inputs");
|
|
13465
|
-
await run10("tar", ["-xzf", packed, "-C", work, "--", ...expected]);
|
|
13466
|
-
import_node_fs117.default.rmSync(packed);
|
|
13467
|
-
const manifest = verifyKotlinSdkDirectory(work, compilerSha256);
|
|
13468
|
-
try {
|
|
13469
|
-
import_node_fs117.default.renameSync(work, root);
|
|
13470
|
-
} catch (error) {
|
|
13471
|
-
if (!import_node_fs117.default.existsSync(root)) throw error;
|
|
13472
|
-
verifyKotlinSdkDirectory(root, compilerSha256);
|
|
13473
|
-
}
|
|
13474
|
-
return { root, sha256: sha2564, manifest };
|
|
13475
|
-
} finally {
|
|
13476
|
-
import_node_fs117.default.rmSync(work, { recursive: true, force: true });
|
|
13477
|
-
}
|
|
13478
|
-
}
|
|
13479
|
-
var import_node_child_process51, import_node_crypto61, import_node_fs117, import_node_path119, import_node_util20, run10;
|
|
13480
|
-
var init_kotlin_sdk = __esm({
|
|
13481
|
-
"src/kotlin-sdk.ts"() {
|
|
13482
|
-
"use strict";
|
|
13483
|
-
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
13484
|
-
import_node_child_process51 = require("node:child_process");
|
|
13485
|
-
import_node_crypto61 = require("node:crypto");
|
|
13486
|
-
import_node_fs117 = __toESM(require("node:fs"), 1);
|
|
13487
|
-
import_node_path119 = __toESM(require("node:path"), 1);
|
|
13488
|
-
import_node_util20 = require("node:util");
|
|
13489
|
-
init_kotlin_toolchain();
|
|
13490
|
-
init_kotlinSdkContract();
|
|
13491
|
-
run10 = (0, import_node_util20.promisify)(import_node_child_process51.execFile);
|
|
13492
|
-
}
|
|
13493
|
-
});
|
|
13494
|
-
|
|
13495
13822
|
// src/kotlin-view-models.ts
|
|
13496
13823
|
function strings6(value) {
|
|
13497
13824
|
if (!Array.isArray(value) || !value.every((item) => typeof item === "string"))
|
|
@@ -13575,145 +13902,6 @@ var init_kotlin_view_models = __esm({
|
|
|
13575
13902
|
}
|
|
13576
13903
|
});
|
|
13577
13904
|
|
|
13578
|
-
// src/android-gradle-sources.ts
|
|
13579
|
-
var android_gradle_sources_exports = {};
|
|
13580
|
-
__export(android_gradle_sources_exports, {
|
|
13581
|
-
resolveAndroidGradleSources: () => resolveAndroidGradleSources
|
|
13582
|
-
});
|
|
13583
|
-
async function resolveAndroidGradleSources(request) {
|
|
13584
|
-
let { root } = request;
|
|
13585
|
-
const { projects: projectDirs, variant: variant2 } = request;
|
|
13586
|
-
if (projectDirs.length === 0) return [];
|
|
13587
|
-
if (!import_node_path120.default.isAbsolute(root) || projectDirs.some((dir) => !import_node_path120.default.isAbsolute(dir)))
|
|
13588
|
-
throw new Error("Android Gradle source selection requires absolute project paths");
|
|
13589
|
-
if (!variant2) throw new Error("Android Gradle source selection requires a variant");
|
|
13590
|
-
root = import_node_fs118.default.realpathSync(root);
|
|
13591
|
-
const projects2 = [...new Set(projectDirs.map((dir) => import_node_fs118.default.realpathSync(dir)))];
|
|
13592
|
-
const parent = import_node_path120.default.join(kotlinHome(), "gradle-sources");
|
|
13593
|
-
import_node_fs118.default.mkdirSync(parent, { recursive: true });
|
|
13594
|
-
const work = import_node_fs118.default.mkdtempSync(import_node_path120.default.join(parent, ".query-"));
|
|
13595
|
-
const task = `peachAndroidSources${(0, import_node_crypto62.randomBytes)(8).toString("hex")}`;
|
|
13596
|
-
const script = import_node_path120.default.join(work, "sources.gradle");
|
|
13597
|
-
const encoded = Buffer.from(
|
|
13598
|
-
JSON.stringify({ root, projects: projects2, variant: variant2, output: work, task })
|
|
13599
|
-
).toString("base64");
|
|
13600
|
-
import_node_fs118.default.writeFileSync(script, modelQuery.replace("__PEACH_REQUEST__", encoded));
|
|
13601
|
-
try {
|
|
13602
|
-
await run11(
|
|
13603
|
-
"bash",
|
|
13604
|
-
[
|
|
13605
|
-
import_node_path120.default.join(root, "gradlew"),
|
|
13606
|
-
"--init-script",
|
|
13607
|
-
script,
|
|
13608
|
-
`${task}All`,
|
|
13609
|
-
"--no-daemon",
|
|
13610
|
-
"--no-configuration-cache",
|
|
13611
|
-
"--max-workers=1",
|
|
13612
|
-
"--console=plain"
|
|
13613
|
-
],
|
|
13614
|
-
{
|
|
13615
|
-
cwd: root,
|
|
13616
|
-
timeout: 3e5,
|
|
13617
|
-
maxBuffer: 8 * 1024 * 1024,
|
|
13618
|
-
env: { ...process.env, [PEACH_FORKED_SCRIPT_ENV]: "1" }
|
|
13619
|
-
}
|
|
13620
|
-
);
|
|
13621
|
-
return projects2.map((projectDir, index) => {
|
|
13622
|
-
const value = JSON.parse(
|
|
13623
|
-
import_node_fs118.default.readFileSync(import_node_path120.default.join(work, `${index}.json`), "utf8")
|
|
13624
|
-
);
|
|
13625
|
-
if (!isRecord(value) || value.projectDir !== projectDir || value.variant !== variant2 || typeof value.projectPath !== "string" || value.applicationId !== null && typeof value.applicationId !== "string")
|
|
13626
|
-
throw new Error("Gradle printed an invalid Android project source model");
|
|
13627
|
-
const sources = (field) => {
|
|
13628
|
-
const list2 = value[field];
|
|
13629
|
-
if (!Array.isArray(list2) || !list2.every((file) => typeof file === "string" && import_node_path120.default.isAbsolute(file)))
|
|
13630
|
-
throw new Error(`Gradle printed invalid Android ${field} source paths`);
|
|
13631
|
-
return list2.map(String);
|
|
13632
|
-
};
|
|
13633
|
-
return {
|
|
13634
|
-
projectDir,
|
|
13635
|
-
projectPath: value.projectPath,
|
|
13636
|
-
variant: variant2,
|
|
13637
|
-
applicationId: value.applicationId,
|
|
13638
|
-
kotlin: sources("kotlin"),
|
|
13639
|
-
java: sources("java")
|
|
13640
|
-
};
|
|
13641
|
-
});
|
|
13642
|
-
} finally {
|
|
13643
|
-
import_node_fs118.default.rmSync(work, { recursive: true, force: true });
|
|
13644
|
-
}
|
|
13645
|
-
}
|
|
13646
|
-
var import_node_child_process52, import_node_crypto62, import_node_fs118, import_node_path120, import_node_util21, run11, modelQuery;
|
|
13647
|
-
var init_android_gradle_sources = __esm({
|
|
13648
|
-
"src/android-gradle-sources.ts"() {
|
|
13649
|
-
"use strict";
|
|
13650
|
-
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
13651
|
-
import_node_child_process52 = require("node:child_process");
|
|
13652
|
-
import_node_crypto62 = require("node:crypto");
|
|
13653
|
-
import_node_fs118 = __toESM(require("node:fs"), 1);
|
|
13654
|
-
import_node_path120 = __toESM(require("node:path"), 1);
|
|
13655
|
-
import_node_util21 = require("node:util");
|
|
13656
|
-
init_forked_script_contract();
|
|
13657
|
-
init_is_record();
|
|
13658
|
-
init_kotlin_toolchain();
|
|
13659
|
-
run11 = (0, import_node_util21.promisify)(import_node_child_process52.execFile);
|
|
13660
|
-
modelQuery = `
|
|
13661
|
-
import groovy.json.JsonOutput
|
|
13662
|
-
import groovy.json.JsonSlurper
|
|
13663
|
-
|
|
13664
|
-
def request = new JsonSlurper().parseText(new String(Base64.decoder.decode('__PEACH_REQUEST__'), 'UTF-8'))
|
|
13665
|
-
gradle.projectsEvaluated {
|
|
13666
|
-
if (gradle.rootProject.projectDir.canonicalPath != request.root) return
|
|
13667
|
-
def selected = []
|
|
13668
|
-
request.projects.eachWithIndex { directory, index ->
|
|
13669
|
-
def matches = gradle.rootProject.allprojects.findAll { it.projectDir.canonicalPath == directory }
|
|
13670
|
-
if (matches.size() != 1) throw new GradleException('Expected one Android project for ' + directory)
|
|
13671
|
-
def project = matches[0]
|
|
13672
|
-
if (project.pluginManager.hasPlugin('org.jetbrains.kotlin.multiplatform')) {
|
|
13673
|
-
throw new GradleException('Kotlin multiplatform source selection is not supported: ' + project.path)
|
|
13674
|
-
}
|
|
13675
|
-
def library = project.pluginManager.hasPlugin('com.android.library')
|
|
13676
|
-
if (!library && !project.pluginManager.hasPlugin('com.android.application')) {
|
|
13677
|
-
throw new GradleException('Project has no Android application or library plugin: ' + project.path)
|
|
13678
|
-
}
|
|
13679
|
-
def android = project.extensions.getByName('android')
|
|
13680
|
-
def variants = library ? android.libraryVariants : android.applicationVariants
|
|
13681
|
-
def variant = variants.find { it.name == request.variant }
|
|
13682
|
-
if (variant == null) throw new GradleException('Android variant ' + request.variant + ' is absent: ' + project.path)
|
|
13683
|
-
def generators = []
|
|
13684
|
-
def buildConfig = variant.generateBuildConfigProvider
|
|
13685
|
-
if (buildConfig != null) generators.add(buildConfig)
|
|
13686
|
-
if (project.pluginManager.hasPlugin('com.facebook.react')) {
|
|
13687
|
-
generators.add(project.tasks.named('generateCodegenArtifactsFromSchema'))
|
|
13688
|
-
}
|
|
13689
|
-
def kotlin = project.tasks.findByName('compile' + variant.name.capitalize() + 'Kotlin')
|
|
13690
|
-
def kotlinSources = kotlin == null ? project.files() : kotlin.sources
|
|
13691
|
-
def javaSources = variant.javaCompileProvider.get().source
|
|
13692
|
-
def query = project.tasks.register(request.task) {
|
|
13693
|
-
dependsOn(generators)
|
|
13694
|
-
dependsOn(kotlinSources.buildDependencies, javaSources.buildDependencies)
|
|
13695
|
-
doLast {
|
|
13696
|
-
def files = (kotlinSources.files + javaSources.files).unique()
|
|
13697
|
-
def unknown = files.find { !it.name.endsWith('.kt') && !it.name.endsWith('.java') }
|
|
13698
|
-
if (unknown != null) throw new GradleException('Unsupported Android source: ' + unknown)
|
|
13699
|
-
new File(request.output, index.toString() + '.json').text = JsonOutput.toJson([
|
|
13700
|
-
projectDir:project.projectDir.canonicalPath,
|
|
13701
|
-
projectPath:project.path,
|
|
13702
|
-
variant:variant.name,
|
|
13703
|
-
applicationId:library ? null : variant.applicationId,
|
|
13704
|
-
kotlin:files.findAll { it.name.endsWith('.kt') }.collect { it.absolutePath }.sort(),
|
|
13705
|
-
java:files.findAll { it.name.endsWith('.java') }.collect { it.absolutePath }.sort()
|
|
13706
|
-
])
|
|
13707
|
-
}
|
|
13708
|
-
}
|
|
13709
|
-
selected.add(query)
|
|
13710
|
-
}
|
|
13711
|
-
gradle.rootProject.tasks.register(request.task + 'All') { dependsOn(selected) }
|
|
13712
|
-
}
|
|
13713
|
-
`;
|
|
13714
|
-
}
|
|
13715
|
-
});
|
|
13716
|
-
|
|
13717
13905
|
// src/kotlin-host.ts
|
|
13718
13906
|
var kotlin_host_exports = {};
|
|
13719
13907
|
__export(kotlin_host_exports, {
|
|
@@ -13730,16 +13918,16 @@ __export(kotlin_host_exports, {
|
|
|
13730
13918
|
});
|
|
13731
13919
|
function loadKotlinSdk(moduleRoot, toolchain) {
|
|
13732
13920
|
return installKotlinSdkArchive(
|
|
13733
|
-
|
|
13921
|
+
import_node_fs120.default.readFileSync(import_node_path122.default.join(moduleRoot, "sdk.tar.gz")),
|
|
13734
13922
|
toolchain.compiler.sha256
|
|
13735
13923
|
);
|
|
13736
13924
|
}
|
|
13737
13925
|
function appKotlinLanguage(root) {
|
|
13738
|
-
const reactNative =
|
|
13739
|
-
(0, import_node_module19.createRequire)(
|
|
13926
|
+
const reactNative = import_node_path122.default.dirname(
|
|
13927
|
+
(0, import_node_module19.createRequire)(import_node_path122.default.join(root, "package.json")).resolve("react-native/package.json")
|
|
13740
13928
|
);
|
|
13741
|
-
const versions =
|
|
13742
|
-
|
|
13929
|
+
const versions = import_node_fs120.default.readFileSync(
|
|
13930
|
+
import_node_path122.default.join(reactNative, "gradle", "libs.versions.toml"),
|
|
13743
13931
|
"utf8"
|
|
13744
13932
|
);
|
|
13745
13933
|
const match = /^kotlin\s*=\s*"(\d+)\.(\d+)/m.exec(versions);
|
|
@@ -13750,9 +13938,9 @@ function appKotlinLanguage(root) {
|
|
|
13750
13938
|
function kotlinSources(root, skip = SKIP_DIRS) {
|
|
13751
13939
|
const sources = [];
|
|
13752
13940
|
const walk3 = (dir) => {
|
|
13753
|
-
for (const entry of
|
|
13941
|
+
for (const entry of import_node_fs120.default.readdirSync(dir, { withFileTypes: true })) {
|
|
13754
13942
|
if (entry.name.startsWith(".") || skip.has(entry.name)) continue;
|
|
13755
|
-
const full =
|
|
13943
|
+
const full = import_node_path122.default.join(dir, entry.name);
|
|
13756
13944
|
if (entry.isDirectory()) walk3(full);
|
|
13757
13945
|
else if (entry.isFile() && entry.name.endsWith(".kt")) sources.push(full);
|
|
13758
13946
|
}
|
|
@@ -13814,7 +14002,7 @@ function entrySource(ids) {
|
|
|
13814
14002
|
].join("\n");
|
|
13815
14003
|
}
|
|
13816
14004
|
function buildsDir() {
|
|
13817
|
-
return
|
|
14005
|
+
return import_node_path122.default.join(kotlinHome(), "builds");
|
|
13818
14006
|
}
|
|
13819
14007
|
async function kotlinArtifact(root, moduleRoot, origin, target = "app") {
|
|
13820
14008
|
const { kotlinSourceId, nativeSourceContract, renderKotlinSourceGlue } = await import("vxrn/native-source-contract");
|
|
@@ -13827,7 +14015,7 @@ async function kotlinArtifact(root, moduleRoot, origin, target = "app") {
|
|
|
13827
14015
|
const viewIds = [];
|
|
13828
14016
|
let usesCompose = false;
|
|
13829
14017
|
for (const file of sources) {
|
|
13830
|
-
const source =
|
|
14018
|
+
const source = import_node_fs120.default.readFileSync(file, "utf8");
|
|
13831
14019
|
if (/\bandroidx\.compose\./.test(source)) usesCompose = true;
|
|
13832
14020
|
const contract = nativeSourceContract(file, source);
|
|
13833
14021
|
if (contract.modules.length === 0 && contract.views.length === 0) continue;
|
|
@@ -13918,22 +14106,22 @@ function readExpoTypes(output2) {
|
|
|
13918
14106
|
async function scanSources(tool, parse11, toolchain, moduleRoot, files2) {
|
|
13919
14107
|
const digest3 = (0, import_node_crypto63.createHash)("sha256").update(JSON.stringify(toolchain.compiler));
|
|
13920
14108
|
const sdk = await loadKotlinSdk(moduleRoot, toolchain);
|
|
13921
|
-
digest3.update(
|
|
14109
|
+
digest3.update(import_node_fs120.default.readFileSync(import_node_path122.default.join(moduleRoot, "sdk.tar.gz")));
|
|
13922
14110
|
digest3.update(tool);
|
|
13923
|
-
for (const file of files2) digest3.update(`${file}\0${
|
|
14111
|
+
for (const file of files2) digest3.update(`${file}\0${import_node_fs120.default.readFileSync(file, "utf8")}\0`);
|
|
13924
14112
|
const key2 = digest3.digest("hex");
|
|
13925
14113
|
let scan2 = toolScans.get(key2);
|
|
13926
14114
|
if (!scan2) {
|
|
13927
14115
|
scan2 = (async () => {
|
|
13928
14116
|
const { kotlinc } = await ensureToolchain(toolchain);
|
|
13929
14117
|
const { stdout } = await run12(
|
|
13930
|
-
|
|
14118
|
+
import_node_path122.default.join(import_node_path122.default.dirname(kotlinc), "kotlin"),
|
|
13931
14119
|
[
|
|
13932
14120
|
"-cp",
|
|
13933
14121
|
[
|
|
13934
|
-
|
|
13935
|
-
|
|
13936
|
-
].join(
|
|
14122
|
+
import_node_path122.default.resolve(import_node_path122.default.dirname(kotlinc), "../lib/kotlin-compiler.jar"),
|
|
14123
|
+
import_node_path122.default.join(sdk.root, "tools.jar")
|
|
14124
|
+
].join(import_node_path122.default.delimiter),
|
|
13937
14125
|
tool,
|
|
13938
14126
|
...files2
|
|
13939
14127
|
],
|
|
@@ -13951,7 +14139,7 @@ async function scanSources(tool, parse11, toolchain, moduleRoot, files2) {
|
|
|
13951
14139
|
async function scanExpoTypes(toolchain, moduleRoot, sources) {
|
|
13952
14140
|
const candidates = sources.filter(
|
|
13953
14141
|
(file) => /\bRecord\b|\benum\s+class\b|\bExpoComposeView\b|\bExpoView\b|\bComposeProps\b|:\s*(?:[A-Za-z0-9_.]+\.)?(?:View|FrameLayout|LinearLayout|ViewGroup)\b/.test(
|
|
13954
|
-
|
|
14142
|
+
import_node_fs120.default.readFileSync(file, "utf8")
|
|
13955
14143
|
)
|
|
13956
14144
|
);
|
|
13957
14145
|
if (candidates.length === 0) return [];
|
|
@@ -14095,7 +14283,7 @@ function expoTypeSources(files2) {
|
|
|
14095
14283
|
)
|
|
14096
14284
|
];
|
|
14097
14285
|
if (edits.length > 0 || views.length > 0) {
|
|
14098
|
-
let text6 =
|
|
14286
|
+
let text6 = import_node_fs120.default.readFileSync(file.file, "utf8").replaceAll("\r\n", "\n");
|
|
14099
14287
|
for (const { range: range2, owner, field } of edits.sort((a, b) => b.range[0] - a.range[0]))
|
|
14100
14288
|
text6 = `${text6.slice(0, range2[0])}dev.peach.expo.PeachExpoTypes.initial(${owner}::class, ${literal2(field.key)}, ${field.required}) { ${text6.slice(range2[0], range2[1])} }${text6.slice(range2[1])}`;
|
|
14101
14289
|
if (views.length > 0) {
|
|
@@ -14111,7 +14299,7 @@ function expoTypeSources(files2) {
|
|
|
14111
14299
|
`${file.package ? `${file.package}.` : ""}peachExpoViews${index}()`
|
|
14112
14300
|
);
|
|
14113
14301
|
}
|
|
14114
|
-
const name3 = `PeachExpoSource_${index}_${
|
|
14302
|
+
const name3 = `PeachExpoSource_${index}_${import_node_path122.default.basename(file.file)}`;
|
|
14115
14303
|
generated[name3] = text6;
|
|
14116
14304
|
origins[name3] = file.file;
|
|
14117
14305
|
}
|
|
@@ -14153,7 +14341,7 @@ async function expoKotlinArtifact(root, moduleRoot, origin, modules) {
|
|
|
14153
14341
|
const language = appKotlinLanguage(root);
|
|
14154
14342
|
const scanned = await scanExpoTypes(toolchain, moduleRoot, modules.sources);
|
|
14155
14343
|
const usesCompose = scanned.some((file) => file.views.length > 0) || modules.sources.some(
|
|
14156
|
-
(file) => /\bandroidx\.compose\./.test(
|
|
14344
|
+
(file) => /\bandroidx\.compose\./.test(import_node_fs120.default.readFileSync(file, "utf8"))
|
|
14157
14345
|
);
|
|
14158
14346
|
const types = expoTypeSources(scanned);
|
|
14159
14347
|
const rewritten = new Set(Object.values(types.origins));
|
|
@@ -14315,6 +14503,7 @@ async function kotlinAppArtifact(app, moduleRoot, origin) {
|
|
|
14315
14503
|
toolchain,
|
|
14316
14504
|
language: app.language,
|
|
14317
14505
|
sources: app.sources,
|
|
14506
|
+
javaSpecs: app.javaSources,
|
|
14318
14507
|
generated,
|
|
14319
14508
|
sdkProfile: "app",
|
|
14320
14509
|
usesCompose: true,
|
|
@@ -14367,7 +14556,7 @@ function appResourceSources(app) {
|
|
|
14367
14556
|
entries: app.drawables.map((drawable) => ({
|
|
14368
14557
|
name: drawable.name,
|
|
14369
14558
|
init: `listOf(
|
|
14370
|
-
${drawable.files.map((file) => drawableInit(file,
|
|
14559
|
+
${drawable.files.map((file) => drawableInit(file, import_node_path122.default.relative(app.moduleDir, file.file))).join(",\n")}
|
|
14371
14560
|
)`
|
|
14372
14561
|
}))
|
|
14373
14562
|
},
|
|
@@ -14436,7 +14625,7 @@ function drawableInit(drawable, file) {
|
|
|
14436
14625
|
if (drawable.kind === "xml") return `PeachDrawable.Xml(${where})`;
|
|
14437
14626
|
if (drawable.kind === "bitmap")
|
|
14438
14627
|
return `PeachDrawable.Bitmap(${where}, ${drawable.ninePatch}, ${literal2(
|
|
14439
|
-
|
|
14628
|
+
import_node_fs120.default.readFileSync(drawable.file).toString("base64")
|
|
14440
14629
|
)})`;
|
|
14441
14630
|
const vector = drawable.vector;
|
|
14442
14631
|
const float3 = (value) => `${value}f`;
|
|
@@ -14500,8 +14689,8 @@ async function compileKotlin(input, origin) {
|
|
|
14500
14689
|
javaSpecs = []
|
|
14501
14690
|
} = input;
|
|
14502
14691
|
const sdk = await loadKotlinSdk(moduleRoot, toolchain);
|
|
14503
|
-
const plugin =
|
|
14504
|
-
const sdkLibrary =
|
|
14692
|
+
const plugin = import_node_path122.default.join(sdk.root, "plugin.jar");
|
|
14693
|
+
const sdkLibrary = import_node_path122.default.join(sdk.root, `${sdkProfile}.klib`);
|
|
14505
14694
|
const java = javaSpecs.length ? await readJavaModuleSpecs(javaSpecs, sdk.root, await ensureToolchain(toolchain)) : null;
|
|
14506
14695
|
const generated = {
|
|
14507
14696
|
...sourceGenerated,
|
|
@@ -14524,7 +14713,7 @@ async function compileKotlin(input, origin) {
|
|
|
14524
14713
|
};
|
|
14525
14714
|
const inputs = sources.map((file) => ({
|
|
14526
14715
|
file,
|
|
14527
|
-
bytes:
|
|
14716
|
+
bytes: import_node_fs120.default.readFileSync(file)
|
|
14528
14717
|
}));
|
|
14529
14718
|
const digest3 = (0, import_node_crypto63.createHash)("sha256");
|
|
14530
14719
|
digest3.update(
|
|
@@ -14539,7 +14728,7 @@ async function compileKotlin(input, origin) {
|
|
|
14539
14728
|
})
|
|
14540
14729
|
);
|
|
14541
14730
|
for (const { file, bytes } of inputs)
|
|
14542
|
-
digest3.update(
|
|
14731
|
+
digest3.update(import_node_path122.default.relative(root, file)).update("\0").update(bytes).update("\0");
|
|
14543
14732
|
if (viewModels) digest3.update(viewModels.toolClass);
|
|
14544
14733
|
for (const [name3, text6] of Object.entries(generated))
|
|
14545
14734
|
digest3.update(`${name3}\0${text6}\0`);
|
|
@@ -14548,39 +14737,39 @@ async function compileKotlin(input, origin) {
|
|
|
14548
14737
|
url: `${origin}${KOTLIN_ARTIFACT_PREFIX}${hash}/app.mjs`,
|
|
14549
14738
|
hash
|
|
14550
14739
|
};
|
|
14551
|
-
const out =
|
|
14552
|
-
if (
|
|
14740
|
+
const out = import_node_path122.default.join(buildsDir(), hash);
|
|
14741
|
+
if (import_node_fs120.default.existsSync(import_node_path122.default.join(out, "js", "app.wasm"))) return artifact;
|
|
14553
14742
|
const pending = builds.get(hash);
|
|
14554
14743
|
if (pending) return pending;
|
|
14555
14744
|
const build = (async () => {
|
|
14556
14745
|
const ready = await ensureToolchain(toolchain);
|
|
14557
14746
|
const { kotlinc } = ready;
|
|
14558
14747
|
const libraries = [...ready.libraries, sdkLibrary];
|
|
14559
|
-
const composeRuntime =
|
|
14748
|
+
const composeRuntime = import_node_path122.default.join(
|
|
14560
14749
|
kotlinHome(),
|
|
14561
14750
|
toolchain.compiler.version,
|
|
14562
14751
|
toolchain.composeRuntime.name
|
|
14563
14752
|
);
|
|
14564
14753
|
if (usesCompose) {
|
|
14565
14754
|
for (const library of toolchain.composeLibraries) {
|
|
14566
|
-
const target =
|
|
14755
|
+
const target = import_node_path122.default.join(kotlinHome(), toolchain.compiler.version, library.name);
|
|
14567
14756
|
await fetchVerified(library, target);
|
|
14568
14757
|
libraries.push(target);
|
|
14569
14758
|
}
|
|
14570
14759
|
await fetchVerified(toolchain.composeRuntime, composeRuntime);
|
|
14571
14760
|
}
|
|
14572
|
-
|
|
14573
|
-
const work =
|
|
14574
|
-
const javaLibrary = java ?
|
|
14761
|
+
import_node_fs120.default.mkdirSync(buildsDir(), { recursive: true });
|
|
14762
|
+
const work = import_node_fs120.default.mkdtempSync(import_node_path122.default.join(buildsDir(), `${hash}-`));
|
|
14763
|
+
const javaLibrary = java ? import_node_path122.default.join(work, "java-abi", "java-abi.klib") : null;
|
|
14575
14764
|
if (javaLibrary) libraries.push(javaLibrary);
|
|
14576
|
-
const generatedDir =
|
|
14577
|
-
|
|
14765
|
+
const generatedDir = import_node_path122.default.join(work, "generated");
|
|
14766
|
+
import_node_fs120.default.mkdirSync(generatedDir);
|
|
14578
14767
|
for (const [name3, text6] of Object.entries(generated))
|
|
14579
|
-
|
|
14768
|
+
import_node_fs120.default.writeFileSync(import_node_path122.default.join(generatedDir, name3), text6);
|
|
14580
14769
|
const compiledSources = inputs.map(({ file, bytes }, index) => {
|
|
14581
|
-
const target =
|
|
14582
|
-
|
|
14583
|
-
|
|
14770
|
+
const target = import_node_path122.default.join(work, "sources", String(index), import_node_path122.default.basename(file));
|
|
14771
|
+
import_node_fs120.default.mkdirSync(import_node_path122.default.dirname(target), { recursive: true });
|
|
14772
|
+
import_node_fs120.default.writeFileSync(target, bytes);
|
|
14584
14773
|
return { file, target };
|
|
14585
14774
|
});
|
|
14586
14775
|
const common = [
|
|
@@ -14589,19 +14778,19 @@ async function compileKotlin(input, origin) {
|
|
|
14589
14778
|
"-Xallow-kotlin-package",
|
|
14590
14779
|
"-Xwasm-target=js",
|
|
14591
14780
|
"-libraries",
|
|
14592
|
-
libraries.join(
|
|
14781
|
+
libraries.join(import_node_path122.default.delimiter)
|
|
14593
14782
|
];
|
|
14594
14783
|
const compileKlib = (outputDir) => run12(
|
|
14595
14784
|
kotlinc,
|
|
14596
14785
|
[
|
|
14597
14786
|
...common,
|
|
14598
14787
|
`-Xplugin=${plugin}`,
|
|
14599
|
-
`-Xfriend-modules=${[sdkLibrary, ...javaLibrary ? [javaLibrary] : []].join(
|
|
14788
|
+
`-Xfriend-modules=${[sdkLibrary, ...javaLibrary ? [javaLibrary] : []].join(import_node_path122.default.delimiter)}`,
|
|
14600
14789
|
...usesCompose ? [
|
|
14601
|
-
`-Xplugin=${
|
|
14790
|
+
`-Xplugin=${import_node_path122.default.resolve(import_node_path122.default.dirname(kotlinc), "../lib/compose-compiler-plugin.jar")}`
|
|
14602
14791
|
] : [],
|
|
14603
14792
|
...usesSerialization ? [
|
|
14604
|
-
`-Xplugin=${
|
|
14793
|
+
`-Xplugin=${import_node_path122.default.resolve(import_node_path122.default.dirname(kotlinc), "../lib/kotlinx-serialization-compiler-plugin.jar")}`
|
|
14605
14794
|
] : [],
|
|
14606
14795
|
"-language-version",
|
|
14607
14796
|
language,
|
|
@@ -14614,7 +14803,7 @@ async function compileKotlin(input, origin) {
|
|
|
14614
14803
|
"-ir-output-name",
|
|
14615
14804
|
"app",
|
|
14616
14805
|
...compiledSources.map(({ target }) => target),
|
|
14617
|
-
...Object.keys(generated).map((name3) =>
|
|
14806
|
+
...Object.keys(generated).map((name3) => import_node_path122.default.join(generatedDir, name3))
|
|
14618
14807
|
],
|
|
14619
14808
|
{ maxBuffer: 16 * 1024 * 1024 }
|
|
14620
14809
|
);
|
|
@@ -14633,36 +14822,36 @@ async function compileKotlin(input, origin) {
|
|
|
14633
14822
|
if (viewModels && inputs.some(
|
|
14634
14823
|
({ file, bytes }) => sources.includes(file) && bytes.includes("ViewModel")
|
|
14635
14824
|
)) {
|
|
14636
|
-
await compileKlib(
|
|
14825
|
+
await compileKlib(import_node_path122.default.join(work, "abi"));
|
|
14637
14826
|
const { stdout } = await run12(
|
|
14638
|
-
|
|
14827
|
+
import_node_path122.default.join(import_node_path122.default.dirname(kotlinc), "kotlin"),
|
|
14639
14828
|
[
|
|
14640
14829
|
"-cp",
|
|
14641
14830
|
[
|
|
14642
|
-
|
|
14643
|
-
|
|
14644
|
-
].join(
|
|
14831
|
+
import_node_path122.default.resolve(import_node_path122.default.dirname(kotlinc), "../lib/kotlin-compiler.jar"),
|
|
14832
|
+
import_node_path122.default.join(sdk.root, "tools.jar")
|
|
14833
|
+
].join(import_node_path122.default.delimiter),
|
|
14645
14834
|
viewModels.toolClass,
|
|
14646
|
-
|
|
14835
|
+
import_node_path122.default.join(work, "abi")
|
|
14647
14836
|
],
|
|
14648
14837
|
{ maxBuffer: 64 * 1024 * 1024 }
|
|
14649
14838
|
);
|
|
14650
|
-
|
|
14651
|
-
|
|
14839
|
+
import_node_fs120.default.writeFileSync(
|
|
14840
|
+
import_node_path122.default.join(generatedDir, viewModels.file),
|
|
14652
14841
|
viewModels.render(viewModelClasses(readAbiClasses(stdout)))
|
|
14653
14842
|
);
|
|
14654
14843
|
}
|
|
14655
|
-
await compileKlib(
|
|
14844
|
+
await compileKlib(import_node_path122.default.join(work, "klib"));
|
|
14656
14845
|
await run12(
|
|
14657
14846
|
kotlinc,
|
|
14658
14847
|
[
|
|
14659
14848
|
...common,
|
|
14660
14849
|
"-nowarn",
|
|
14661
14850
|
"-Xpartial-linkage-loglevel=error",
|
|
14662
|
-
`-Xinclude=${
|
|
14851
|
+
`-Xinclude=${import_node_path122.default.join(work, "klib")}`,
|
|
14663
14852
|
"-Xir-produce-js",
|
|
14664
14853
|
"-ir-output-dir",
|
|
14665
|
-
|
|
14854
|
+
import_node_path122.default.join(work, "js"),
|
|
14666
14855
|
"-ir-output-name",
|
|
14667
14856
|
"app"
|
|
14668
14857
|
],
|
|
@@ -14675,10 +14864,10 @@ async function compileKotlin(input, origin) {
|
|
|
14675
14864
|
composeRuntime,
|
|
14676
14865
|
"skiko.mjs",
|
|
14677
14866
|
"-d",
|
|
14678
|
-
|
|
14867
|
+
import_node_path122.default.join(work, "js")
|
|
14679
14868
|
]);
|
|
14680
|
-
const skikoPath =
|
|
14681
|
-
const upstream = (0, import_acorn3.parse)(
|
|
14869
|
+
const skikoPath = import_node_path122.default.join(work, "js", "skiko.mjs");
|
|
14870
|
+
const upstream = (0, import_acorn3.parse)(import_node_fs120.default.readFileSync(skikoPath, "utf8"), {
|
|
14682
14871
|
ecmaVersion: "latest",
|
|
14683
14872
|
sourceType: "module"
|
|
14684
14873
|
});
|
|
@@ -14701,7 +14890,7 @@ async function compileKotlin(input, origin) {
|
|
|
14701
14890
|
"GL",
|
|
14702
14891
|
...bindings
|
|
14703
14892
|
];
|
|
14704
|
-
|
|
14893
|
+
import_node_fs120.default.writeFileSync(
|
|
14705
14894
|
skikoPath,
|
|
14706
14895
|
[
|
|
14707
14896
|
"const runtime = globalThis.__peachKotlinSkiko;",
|
|
@@ -14715,10 +14904,10 @@ async function compileKotlin(input, origin) {
|
|
|
14715
14904
|
if (usesCompose) {
|
|
14716
14905
|
for (const library of toolchain.composeJsLibraries) {
|
|
14717
14906
|
let imported = false;
|
|
14718
|
-
for (const file of
|
|
14907
|
+
for (const file of import_node_fs120.default.readdirSync(import_node_path122.default.join(work, "js"))) {
|
|
14719
14908
|
if (!file.endsWith(".mjs")) continue;
|
|
14720
|
-
const target =
|
|
14721
|
-
const source =
|
|
14909
|
+
const target = import_node_path122.default.join(work, "js", file);
|
|
14910
|
+
const source = import_node_fs120.default.readFileSync(target, "utf8");
|
|
14722
14911
|
let next = source;
|
|
14723
14912
|
for (const quote of ["'", '"'])
|
|
14724
14913
|
next = next.replaceAll(
|
|
@@ -14726,11 +14915,11 @@ async function compileKotlin(input, origin) {
|
|
|
14726
14915
|
`from ${quote}./${library.file}${quote}`
|
|
14727
14916
|
);
|
|
14728
14917
|
if (next === source) continue;
|
|
14729
|
-
|
|
14918
|
+
import_node_fs120.default.writeFileSync(target, next);
|
|
14730
14919
|
imported = true;
|
|
14731
14920
|
}
|
|
14732
14921
|
if (!imported) continue;
|
|
14733
|
-
const archive =
|
|
14922
|
+
const archive = import_node_path122.default.join(
|
|
14734
14923
|
kotlinHome(),
|
|
14735
14924
|
toolchain.compiler.version,
|
|
14736
14925
|
library.name
|
|
@@ -14739,19 +14928,19 @@ async function compileKotlin(input, origin) {
|
|
|
14739
14928
|
const { stdout } = await run12("tar", ["-xOf", archive, library.archiveEntry], {
|
|
14740
14929
|
maxBuffer: 16 * 1024 * 1024
|
|
14741
14930
|
});
|
|
14742
|
-
|
|
14931
|
+
import_node_fs120.default.writeFileSync(import_node_path122.default.join(work, "js", library.file), stdout);
|
|
14743
14932
|
}
|
|
14744
14933
|
}
|
|
14745
14934
|
} catch (error) {
|
|
14746
|
-
|
|
14935
|
+
import_node_fs120.default.rmSync(work, { recursive: true, force: true });
|
|
14747
14936
|
let output2 = isRecord(error) ? `${String(error.stderr ?? "")}${String(error.stdout ?? "")}` : "";
|
|
14748
14937
|
for (const [name3, source] of Object.entries(origins))
|
|
14749
|
-
output2 = output2.replaceAll(
|
|
14938
|
+
output2 = output2.replaceAll(import_node_path122.default.join(generatedDir, name3), source);
|
|
14750
14939
|
for (const { file, target } of compiledSources)
|
|
14751
|
-
output2 = output2.replaceAll(target, file).replaceAll(
|
|
14940
|
+
output2 = output2.replaceAll(target, file).replaceAll(import_node_path122.default.relative(process.cwd(), target), file);
|
|
14752
14941
|
for (const [index, spec] of (java?.specs ?? []).entries())
|
|
14753
14942
|
output2 = output2.replaceAll(
|
|
14754
|
-
|
|
14943
|
+
import_node_path122.default.join(work, "java-abi", `Spec${index}.kt`),
|
|
14755
14944
|
spec.file
|
|
14756
14945
|
);
|
|
14757
14946
|
output2 = output2.replace(
|
|
@@ -14766,9 +14955,9 @@ ${output2.trim() || (error instanceof Error ? error.message : String(error))}`
|
|
|
14766
14955
|
const seams = [
|
|
14767
14956
|
["process.release.name", "process.release?.name"]
|
|
14768
14957
|
];
|
|
14769
|
-
const js =
|
|
14958
|
+
const js = import_node_fs120.default.readdirSync(import_node_path122.default.join(work, "js")).filter((file) => file.endsWith(".mjs"));
|
|
14770
14959
|
if (js.some(
|
|
14771
|
-
(file) =>
|
|
14960
|
+
(file) => import_node_fs120.default.readFileSync(import_node_path122.default.join(work, "js", file), "utf8").includes("'kotlinx.coroutines.")
|
|
14772
14961
|
))
|
|
14773
14962
|
seams.push([
|
|
14774
14963
|
"(typeof(window) !== 'undefined' && window != null && typeof(window.addEventListener) === 'function') ? window : null",
|
|
@@ -14777,12 +14966,12 @@ ${output2.trim() || (error instanceof Error ? error.message : String(error))}`
|
|
|
14777
14966
|
for (const [from, to] of seams) {
|
|
14778
14967
|
let patched = 0;
|
|
14779
14968
|
for (const file of js) {
|
|
14780
|
-
const target =
|
|
14781
|
-
const text6 =
|
|
14969
|
+
const target = import_node_path122.default.join(work, "js", file);
|
|
14970
|
+
const text6 = import_node_fs120.default.readFileSync(target, "utf8");
|
|
14782
14971
|
const next = text6.replaceAll(from, to);
|
|
14783
14972
|
if (next !== text6) {
|
|
14784
14973
|
patched++;
|
|
14785
|
-
|
|
14974
|
+
import_node_fs120.default.writeFileSync(target, next);
|
|
14786
14975
|
}
|
|
14787
14976
|
}
|
|
14788
14977
|
if (patched === 0)
|
|
@@ -14790,11 +14979,11 @@ ${output2.trim() || (error instanceof Error ? error.message : String(error))}`
|
|
|
14790
14979
|
`kotlin output no longer contains ${from}; recheck how it detects its host in Peach`
|
|
14791
14980
|
);
|
|
14792
14981
|
}
|
|
14793
|
-
const entry =
|
|
14794
|
-
const entrySource2 =
|
|
14795
|
-
const importsPath =
|
|
14982
|
+
const entry = import_node_path122.default.join(work, "js/app.mjs");
|
|
14983
|
+
const entrySource2 = import_node_fs120.default.readFileSync(entry, "utf8");
|
|
14984
|
+
const importsPath = import_node_path122.default.join(work, "js/app.import-object.mjs");
|
|
14796
14985
|
const importsFactory = kotlinInstanceSource(
|
|
14797
|
-
|
|
14986
|
+
import_node_fs120.default.readFileSync(importsPath, "utf8"),
|
|
14798
14987
|
"createKotlinImportObject"
|
|
14799
14988
|
);
|
|
14800
14989
|
const runtimeFactory = kotlinInstanceSource(
|
|
@@ -14802,9 +14991,9 @@ ${output2.trim() || (error instanceof Error ? error.message : String(error))}`
|
|
|
14802
14991
|
"createKotlinInstance",
|
|
14803
14992
|
/* @__PURE__ */ new Map([["./app.import-object.mjs", "createKotlinImportObject"]])
|
|
14804
14993
|
);
|
|
14805
|
-
|
|
14806
|
-
|
|
14807
|
-
|
|
14994
|
+
import_node_fs120.default.writeFileSync(importsPath, importsFactory.source);
|
|
14995
|
+
import_node_fs120.default.writeFileSync(import_node_path122.default.join(work, "js/app-runtime.mjs"), runtimeFactory.source);
|
|
14996
|
+
import_node_fs120.default.writeFileSync(
|
|
14808
14997
|
entry,
|
|
14809
14998
|
[
|
|
14810
14999
|
"import { createKotlinInstance } from './app-runtime.mjs';",
|
|
@@ -14817,10 +15006,10 @@ ${output2.trim() || (error instanceof Error ? error.message : String(error))}`
|
|
|
14817
15006
|
].join("\n")
|
|
14818
15007
|
);
|
|
14819
15008
|
try {
|
|
14820
|
-
|
|
15009
|
+
import_node_fs120.default.renameSync(work, out);
|
|
14821
15010
|
} catch (error) {
|
|
14822
|
-
if (!
|
|
14823
|
-
|
|
15011
|
+
if (!import_node_fs120.default.existsSync(import_node_path122.default.join(out, "js", "app.wasm"))) throw error;
|
|
15012
|
+
import_node_fs120.default.rmSync(work, { recursive: true, force: true });
|
|
14824
15013
|
}
|
|
14825
15014
|
return artifact;
|
|
14826
15015
|
})().finally(() => builds.delete(hash));
|
|
@@ -14828,24 +15017,24 @@ ${output2.trim() || (error instanceof Error ? error.message : String(error))}`
|
|
|
14828
15017
|
return build;
|
|
14829
15018
|
}
|
|
14830
15019
|
function kotlinArtifactFiles(hash) {
|
|
14831
|
-
const dir =
|
|
14832
|
-
return
|
|
14833
|
-
const contentType2 = CONTENT_TYPES[
|
|
15020
|
+
const dir = import_node_path122.default.join(buildsDir(), hash, "js");
|
|
15021
|
+
return import_node_fs120.default.readdirSync(dir).sort().map((name3) => {
|
|
15022
|
+
const contentType2 = CONTENT_TYPES[import_node_path122.default.extname(name3)];
|
|
14834
15023
|
if (!contentType2) throw new Error(`unexpected kotlin artifact file ${name3}`);
|
|
14835
|
-
return { name: name3, bytes:
|
|
15024
|
+
return { name: name3, bytes: import_node_fs120.default.readFileSync(import_node_path122.default.join(dir, name3)), contentType: contentType2 };
|
|
14836
15025
|
});
|
|
14837
15026
|
}
|
|
14838
15027
|
function serveKotlinArtifact(pathname, res) {
|
|
14839
15028
|
if (!pathname.startsWith(KOTLIN_ARTIFACT_PREFIX)) return false;
|
|
14840
15029
|
const [hash, file, ...rest] = pathname.slice(KOTLIN_ARTIFACT_PREFIX.length).split("/");
|
|
14841
|
-
const type = file ? CONTENT_TYPES[
|
|
15030
|
+
const type = file ? CONTENT_TYPES[import_node_path122.default.extname(file)] : void 0;
|
|
14842
15031
|
if (!hash || !/^[0-9a-f]+$/.test(hash) || !file || rest.length > 0 || !type || file.includes("..")) {
|
|
14843
15032
|
res.statusCode = 404;
|
|
14844
15033
|
res.end("not a kotlin artifact");
|
|
14845
15034
|
return true;
|
|
14846
15035
|
}
|
|
14847
|
-
const target =
|
|
14848
|
-
if (!
|
|
15036
|
+
const target = import_node_path122.default.join(buildsDir(), hash, "js", file);
|
|
15037
|
+
if (!import_node_fs120.default.existsSync(target)) {
|
|
14849
15038
|
res.statusCode = 404;
|
|
14850
15039
|
res.end(`kotlin artifact ${hash}/${file} was not built`);
|
|
14851
15040
|
return true;
|
|
@@ -14853,7 +15042,7 @@ function serveKotlinArtifact(pathname, res) {
|
|
|
14853
15042
|
res.setHeader("access-control-allow-origin", "*");
|
|
14854
15043
|
res.setHeader("content-type", type);
|
|
14855
15044
|
res.setHeader("cache-control", "public, max-age=31536000, immutable");
|
|
14856
|
-
res.end(
|
|
15045
|
+
res.end(import_node_fs120.default.readFileSync(target));
|
|
14857
15046
|
return true;
|
|
14858
15047
|
}
|
|
14859
15048
|
async function serveKotlinRequest(pathname, res, app) {
|
|
@@ -14870,16 +15059,16 @@ async function serveKotlinRequest(pathname, res, app) {
|
|
|
14870
15059
|
}
|
|
14871
15060
|
return true;
|
|
14872
15061
|
}
|
|
14873
|
-
var import_node_child_process53, import_node_crypto63,
|
|
15062
|
+
var import_node_child_process53, import_node_crypto63, import_node_fs120, import_node_module19, import_node_path122, import_node_util22, import_acorn3, run12, KOTLIN_ARTIFACT_PREFIX, SKIP_DIRS, BUILD_FORMAT, builds, toolScans, BRIDGE_PARAMETERS, BRIDGE_CASTS, BRIDGE_RETURNS, bridgeType, JAVA_CLASSES, argb, escapes2, literal2, CONTENT_TYPES, KOTLIN_PACKAGE_PATH;
|
|
14874
15063
|
var init_kotlin_host = __esm({
|
|
14875
15064
|
"src/kotlin-host.ts"() {
|
|
14876
15065
|
"use strict";
|
|
14877
15066
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
14878
15067
|
import_node_child_process53 = require("node:child_process");
|
|
14879
15068
|
import_node_crypto63 = require("node:crypto");
|
|
14880
|
-
|
|
15069
|
+
import_node_fs120 = __toESM(require("node:fs"), 1);
|
|
14881
15070
|
import_node_module19 = require("node:module");
|
|
14882
|
-
|
|
15071
|
+
import_node_path122 = __toESM(require("node:path"), 1);
|
|
14883
15072
|
import_node_util22 = require("node:util");
|
|
14884
15073
|
import_acorn3 = require("acorn");
|
|
14885
15074
|
init_android_bridge_packages();
|
|
@@ -14991,8 +15180,8 @@ async function collectExpoKotlinModules(appRoot) {
|
|
|
14991
15180
|
for (const project2 of entry.projects) {
|
|
14992
15181
|
if (!isRecord(project2) || typeof project2.sourceDir !== "string" || !Array.isArray(project2.modules))
|
|
14993
15182
|
throw new Error("invalid Expo Android project");
|
|
14994
|
-
const sourceDir =
|
|
14995
|
-
const installed = sourceDir.split(
|
|
15183
|
+
const sourceDir = import_node_fs121.default.realpathSync(project2.sourceDir);
|
|
15184
|
+
const installed = sourceDir.split(import_node_path123.default.sep).includes("node_modules");
|
|
14996
15185
|
if (installed) {
|
|
14997
15186
|
if (typeof entry.packageName !== "string") continue;
|
|
14998
15187
|
if (peachAnsweredNativePackages().has(entry.packageName)) {
|
|
@@ -15019,9 +15208,9 @@ async function collectExpoKotlinModules(appRoot) {
|
|
|
15019
15208
|
group.unsupported ??= reason;
|
|
15020
15209
|
};
|
|
15021
15210
|
const walk3 = (dir) => {
|
|
15022
|
-
if (!
|
|
15023
|
-
for (const child of
|
|
15024
|
-
const file =
|
|
15211
|
+
if (!import_node_fs121.default.existsSync(dir)) return;
|
|
15212
|
+
for (const child of import_node_fs121.default.readdirSync(dir, { withFileTypes: true }).sort((a, b) => a.name.localeCompare(b.name))) {
|
|
15213
|
+
const file = import_node_path123.default.join(dir, child.name);
|
|
15025
15214
|
if (child.isSymbolicLink()) reject(`Expo Kotlin source is a symlink: ${file}`);
|
|
15026
15215
|
else if (child.isDirectory()) walk3(file);
|
|
15027
15216
|
else if (child.name.endsWith(".java"))
|
|
@@ -15029,23 +15218,28 @@ async function collectExpoKotlinModules(appRoot) {
|
|
|
15029
15218
|
else if (child.name.endsWith(".kt")) group.sources.push(file);
|
|
15030
15219
|
}
|
|
15031
15220
|
};
|
|
15032
|
-
walk3(
|
|
15033
|
-
walk3(
|
|
15221
|
+
walk3(import_node_path123.default.join(sourceDir, "src", "main", "java"));
|
|
15222
|
+
walk3(import_node_path123.default.join(sourceDir, "src", "main", "kotlin"));
|
|
15034
15223
|
result.push(group);
|
|
15035
15224
|
}
|
|
15036
15225
|
}
|
|
15037
15226
|
return result.length === 0 && !answeredInstalled ? null : result;
|
|
15038
15227
|
}
|
|
15039
15228
|
async function collectBridgePackages(appRoot) {
|
|
15229
|
+
const dependencies = await collectAndroidBridgeDependencies(
|
|
15230
|
+
appRoot,
|
|
15231
|
+
peachKotlinModuleRoot()
|
|
15232
|
+
);
|
|
15040
15233
|
const app = androidAppSources(appRoot);
|
|
15041
15234
|
if (!app || !app.kotlin.some(
|
|
15042
|
-
(file) => /\b(?:Base|Turbo)?ReactPackage\b/.test(
|
|
15235
|
+
(file) => /\b(?:Base|Turbo)?ReactPackage\b/.test(import_node_fs121.default.readFileSync(file, "utf8"))
|
|
15043
15236
|
))
|
|
15044
|
-
return
|
|
15237
|
+
return dependencies;
|
|
15045
15238
|
const { scanBridgeFiles: scanBridgeFiles2 } = await Promise.resolve().then(() => (init_kotlin_host(), kotlin_host_exports));
|
|
15046
15239
|
const files2 = await scanBridgeFiles2(peachKotlinModuleRoot(), app.kotlin);
|
|
15047
15240
|
const selection = selectBridgePackages(app.applicationId, files2, app.java);
|
|
15048
|
-
|
|
15241
|
+
const packages = [...dependencies?.packages ?? [], ...selection.packages];
|
|
15242
|
+
return packages.length ? { applicationId: dependencies?.applicationId ?? selection.applicationId, packages } : null;
|
|
15049
15243
|
}
|
|
15050
15244
|
async function compileExpoKotlinModules(root, origin) {
|
|
15051
15245
|
const expo = await collectExpoKotlinModules(root);
|
|
@@ -15099,20 +15293,26 @@ async function compileExpoKotlinModules(root, origin) {
|
|
|
15099
15293
|
const artifact = await expoKotlinArtifact2(root, peachKotlinModuleRoot(), origin, {
|
|
15100
15294
|
modules,
|
|
15101
15295
|
sources,
|
|
15296
|
+
javaSpecs: [...new Set(hosted.flatMap((entry) => entry.javaSpecs ?? []))],
|
|
15102
15297
|
bridge: selection && { applicationId: selection.applicationId, packages: hosted }
|
|
15103
15298
|
});
|
|
15104
15299
|
return result(artifact);
|
|
15105
15300
|
} catch (error) {
|
|
15106
15301
|
const message = error instanceof Error ? error.message : String(error);
|
|
15107
|
-
const errors = message.match(/^.+\.kt:\d+:\d+: error:.*$/gm);
|
|
15302
|
+
const errors = message.match(/^.+\.(?:kt|java):\d+:\d+: error:.*$/gm);
|
|
15108
15303
|
if (!errors) throw error;
|
|
15109
15304
|
const linesFor = (sources2) => errors.filter((line) => sources2.some((source) => line.startsWith(`${source}:`)));
|
|
15110
|
-
const broken = hosted.filter(
|
|
15305
|
+
const broken = hosted.filter(
|
|
15306
|
+
(entry) => linesFor([...entry.sources, ...entry.javaSpecs ?? []]).length > 0
|
|
15307
|
+
);
|
|
15111
15308
|
const brokenProjects = projects2.filter(
|
|
15112
15309
|
(project2) => project2.installed && linesFor(project2.sources).length > 0
|
|
15113
15310
|
);
|
|
15114
15311
|
if (broken.length > 0 || brokenProjects.length > 0) {
|
|
15115
|
-
drop(
|
|
15312
|
+
drop(
|
|
15313
|
+
broken,
|
|
15314
|
+
(entry) => linesFor([...entry.sources, ...entry.javaSpecs ?? []]).join("\n")
|
|
15315
|
+
);
|
|
15116
15316
|
dropProjects(brokenProjects, (project2) => linesFor(project2.sources).join("\n"));
|
|
15117
15317
|
continue;
|
|
15118
15318
|
}
|
|
@@ -15147,7 +15347,7 @@ async function handleExpoKotlinRequest(req, res) {
|
|
|
15147
15347
|
return true;
|
|
15148
15348
|
}
|
|
15149
15349
|
const root = url.searchParams.get("root");
|
|
15150
|
-
if (!root || !
|
|
15350
|
+
if (!root || !import_node_path123.default.isAbsolute(root)) {
|
|
15151
15351
|
res.writeHead(400);
|
|
15152
15352
|
res.end("missing absolute app root");
|
|
15153
15353
|
return true;
|
|
@@ -15178,14 +15378,15 @@ async function handleExpoKotlinRequest(req, res) {
|
|
|
15178
15378
|
}
|
|
15179
15379
|
return true;
|
|
15180
15380
|
}
|
|
15181
|
-
var
|
|
15381
|
+
var import_node_fs121, import_node_path123, EXPO_KOTLIN_ROUTE, compiling2;
|
|
15182
15382
|
var init_expo_kotlin_host = __esm({
|
|
15183
15383
|
"src/expo-kotlin-host.ts"() {
|
|
15184
15384
|
"use strict";
|
|
15185
15385
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
15186
|
-
|
|
15187
|
-
|
|
15386
|
+
import_node_fs121 = __toESM(require("node:fs"), 1);
|
|
15387
|
+
import_node_path123 = __toESM(require("node:path"), 1);
|
|
15188
15388
|
init_android_autolinking();
|
|
15389
|
+
init_android_bridge_dependencies();
|
|
15189
15390
|
init_android_bridge_packages();
|
|
15190
15391
|
init_answeredNativePackages();
|
|
15191
15392
|
init_backend_origin();
|
|
@@ -15206,14 +15407,14 @@ function sharedDesktopAuthAccounts(user) {
|
|
|
15206
15407
|
function getBaseDir() {
|
|
15207
15408
|
const explicit = process.env[SESSION_FILE_ENV];
|
|
15208
15409
|
if (explicit?.trim()) {
|
|
15209
|
-
return (0,
|
|
15410
|
+
return (0, import_node_path124.dirname)((0, import_node_path124.resolve)(explicit));
|
|
15210
15411
|
}
|
|
15211
15412
|
return electronUserDataDir();
|
|
15212
15413
|
}
|
|
15213
15414
|
function getSharedDesktopAuthFilePath() {
|
|
15214
15415
|
const explicit = process.env[SESSION_FILE_ENV];
|
|
15215
|
-
if (explicit?.trim()) return (0,
|
|
15216
|
-
return (0,
|
|
15416
|
+
if (explicit?.trim()) return (0, import_node_path124.resolve)(explicit);
|
|
15417
|
+
return (0, import_node_path124.join)(getBaseDir(), "desktop-auth.json");
|
|
15217
15418
|
}
|
|
15218
15419
|
function normalizeUser(input) {
|
|
15219
15420
|
if (!input || typeof input !== "object") return null;
|
|
@@ -15263,27 +15464,27 @@ function normalizeSession(input) {
|
|
|
15263
15464
|
}
|
|
15264
15465
|
function readSharedDesktopAuthSession() {
|
|
15265
15466
|
const filepath = getSharedDesktopAuthFilePath();
|
|
15266
|
-
if (!(0,
|
|
15467
|
+
if (!(0, import_node_fs122.existsSync)(filepath)) return null;
|
|
15267
15468
|
try {
|
|
15268
|
-
const parsed = JSON.parse((0,
|
|
15469
|
+
const parsed = JSON.parse((0, import_node_fs122.readFileSync)(filepath, "utf8"));
|
|
15269
15470
|
const normalized = normalizeSession(parsed);
|
|
15270
15471
|
if (!normalized) {
|
|
15271
|
-
(0,
|
|
15472
|
+
(0, import_node_fs122.rmSync)(filepath, { force: true });
|
|
15272
15473
|
return null;
|
|
15273
15474
|
}
|
|
15274
15475
|
return normalized;
|
|
15275
15476
|
} catch {
|
|
15276
|
-
(0,
|
|
15477
|
+
(0, import_node_fs122.rmSync)(filepath, { force: true });
|
|
15277
15478
|
return null;
|
|
15278
15479
|
}
|
|
15279
15480
|
}
|
|
15280
|
-
var
|
|
15481
|
+
var import_node_fs122, import_node_path124, SESSION_VERSION, SESSION_FILE_ENV, DEFAULT_ORIGIN;
|
|
15281
15482
|
var init_shared_session = __esm({
|
|
15282
15483
|
"src/auth/shared-session.ts"() {
|
|
15283
15484
|
"use strict";
|
|
15284
15485
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
15285
|
-
|
|
15286
|
-
|
|
15486
|
+
import_node_fs122 = require("node:fs");
|
|
15487
|
+
import_node_path124 = require("node:path");
|
|
15287
15488
|
init_home_paths();
|
|
15288
15489
|
init_public_brand();
|
|
15289
15490
|
SESSION_VERSION = 1;
|
|
@@ -15319,32 +15520,32 @@ var init_run_rnx = __esm({
|
|
|
15319
15520
|
|
|
15320
15521
|
// cli/secure-file.ts
|
|
15321
15522
|
function writeSecureJsonAtomic(filepath, value) {
|
|
15322
|
-
(0,
|
|
15523
|
+
(0, import_node_fs123.mkdirSync)((0, import_node_path125.dirname)(filepath), { recursive: true });
|
|
15323
15524
|
const temporary = `${filepath}.tmp-${process.pid}-${(0, import_node_crypto64.randomUUID)()}`;
|
|
15324
15525
|
let descriptor = null;
|
|
15325
15526
|
try {
|
|
15326
|
-
descriptor = (0,
|
|
15327
|
-
(0,
|
|
15328
|
-
(0,
|
|
15527
|
+
descriptor = (0, import_node_fs123.openSync)(temporary, "wx", 384);
|
|
15528
|
+
(0, import_node_fs123.fchmodSync)(descriptor, 384);
|
|
15529
|
+
(0, import_node_fs123.writeFileSync)(descriptor, `${JSON.stringify(value, null, 2)}
|
|
15329
15530
|
`);
|
|
15330
|
-
(0,
|
|
15331
|
-
(0,
|
|
15531
|
+
(0, import_node_fs123.fsyncSync)(descriptor);
|
|
15532
|
+
(0, import_node_fs123.closeSync)(descriptor);
|
|
15332
15533
|
descriptor = null;
|
|
15333
|
-
(0,
|
|
15534
|
+
(0, import_node_fs123.renameSync)(temporary, filepath);
|
|
15334
15535
|
} catch (error) {
|
|
15335
|
-
if (descriptor !== null) (0,
|
|
15336
|
-
(0,
|
|
15536
|
+
if (descriptor !== null) (0, import_node_fs123.closeSync)(descriptor);
|
|
15537
|
+
(0, import_node_fs123.rmSync)(temporary, { force: true });
|
|
15337
15538
|
throw error;
|
|
15338
15539
|
}
|
|
15339
15540
|
}
|
|
15340
|
-
var import_node_crypto64,
|
|
15541
|
+
var import_node_crypto64, import_node_fs123, import_node_path125;
|
|
15341
15542
|
var init_secure_file = __esm({
|
|
15342
15543
|
"cli/secure-file.ts"() {
|
|
15343
15544
|
"use strict";
|
|
15344
15545
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
15345
15546
|
import_node_crypto64 = require("node:crypto");
|
|
15346
|
-
|
|
15347
|
-
|
|
15547
|
+
import_node_fs123 = require("node:fs");
|
|
15548
|
+
import_node_path125 = require("node:path");
|
|
15348
15549
|
}
|
|
15349
15550
|
});
|
|
15350
15551
|
|
|
@@ -15393,25 +15594,25 @@ function isCliApiKeySecret(secret) {
|
|
|
15393
15594
|
return secret.startsWith("sk_rnx_");
|
|
15394
15595
|
}
|
|
15395
15596
|
function savedApiKeyFile() {
|
|
15396
|
-
return
|
|
15597
|
+
return import_node_path126.default.join(rnxHomeDir(), "api-key.json");
|
|
15397
15598
|
}
|
|
15398
15599
|
function readApiKeyFile(file) {
|
|
15399
|
-
if (!(0,
|
|
15400
|
-
const secret = (0,
|
|
15600
|
+
if (!(0, import_node_fs124.existsSync)(file)) return null;
|
|
15601
|
+
const secret = (0, import_node_fs124.readFileSync)(file, "utf8").trim();
|
|
15401
15602
|
return isCliApiKeySecret(secret) ? secret : null;
|
|
15402
15603
|
}
|
|
15403
15604
|
function saveApiKey(secret) {
|
|
15404
15605
|
writeSecureJsonAtomic(savedApiKeyFile(), { secret });
|
|
15405
15606
|
}
|
|
15406
15607
|
function forgetApiKey() {
|
|
15407
|
-
if (!(0,
|
|
15408
|
-
(0,
|
|
15608
|
+
if (!(0, import_node_fs124.existsSync)(savedApiKeyFile())) return false;
|
|
15609
|
+
(0, import_node_fs124.rmSync)(savedApiKeyFile());
|
|
15409
15610
|
return true;
|
|
15410
15611
|
}
|
|
15411
15612
|
function readSavedApiKey() {
|
|
15412
|
-
if (!(0,
|
|
15613
|
+
if (!(0, import_node_fs124.existsSync)(savedApiKeyFile())) return null;
|
|
15413
15614
|
const saved = savedKeySchema.safeParse(
|
|
15414
|
-
JSON.parse((0,
|
|
15615
|
+
JSON.parse((0, import_node_fs124.readFileSync)(savedApiKeyFile(), "utf8"))
|
|
15415
15616
|
);
|
|
15416
15617
|
return saved.success && isCliApiKeySecret(saved.data.secret) ? saved.data.secret : null;
|
|
15417
15618
|
}
|
|
@@ -15471,13 +15672,13 @@ function authHeaderOrExit(commandLabel) {
|
|
|
15471
15672
|
);
|
|
15472
15673
|
rnxExit(1);
|
|
15473
15674
|
}
|
|
15474
|
-
var
|
|
15675
|
+
var import_node_fs124, import_node_path126, import_zod, GITHUB_TOKEN_PREFIXES, DOWNLOADED_API_KEY_FILE, savedKeySchema, CHOOSE_ACCOUNT_HINT;
|
|
15475
15676
|
var init_auth = __esm({
|
|
15476
15677
|
"cli/auth.ts"() {
|
|
15477
15678
|
"use strict";
|
|
15478
15679
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
15479
|
-
|
|
15480
|
-
|
|
15680
|
+
import_node_fs124 = require("node:fs");
|
|
15681
|
+
import_node_path126 = __toESM(require("node:path"), 1);
|
|
15481
15682
|
import_zod = require("zod");
|
|
15482
15683
|
init_shared_session();
|
|
15483
15684
|
init_home_paths();
|
|
@@ -17135,8 +17336,8 @@ function metroIosAssetDestRelatives(httpServerLocation, filename) {
|
|
|
17135
17336
|
}
|
|
17136
17337
|
const out = [];
|
|
17137
17338
|
for (const dir of dirs) {
|
|
17138
|
-
const
|
|
17139
|
-
if (!out.includes(
|
|
17339
|
+
const path110 = `${dir}/${filename}`;
|
|
17340
|
+
if (!out.includes(path110)) out.push(path110);
|
|
17140
17341
|
}
|
|
17141
17342
|
if (!out.includes(filename)) out.push(filename);
|
|
17142
17343
|
return out;
|
|
@@ -17841,27 +18042,27 @@ function resolveCloudOrigin(value) {
|
|
|
17841
18042
|
return normalizeCloudOrigin(source);
|
|
17842
18043
|
}
|
|
17843
18044
|
function readImmutableBundleSource(bundlePath, command) {
|
|
17844
|
-
const filepath = (0,
|
|
17845
|
-
if ((0,
|
|
18045
|
+
const filepath = (0, import_node_path127.resolve)(bundlePath);
|
|
18046
|
+
if ((0, import_node_path127.extname)(filepath) === ".hbc") {
|
|
17846
18047
|
const platform2 = filepath.includes("/android/") ? "android" : "ios";
|
|
17847
18048
|
throw new Error(
|
|
17848
18049
|
`${command} cannot preview Hermes bytecode (${bundlePath}). Export plain JavaScript with \`npx expo export --platform ${platform2} --no-bytecode\` and preview the .js bundle instead.`
|
|
17849
18050
|
);
|
|
17850
18051
|
}
|
|
17851
|
-
if ((0,
|
|
18052
|
+
if ((0, import_node_path127.extname)(filepath) !== ".js") {
|
|
17852
18053
|
throw new Error(`${command} requires one local .js bundle`);
|
|
17853
18054
|
}
|
|
17854
|
-
const descriptor = (0,
|
|
18055
|
+
const descriptor = (0, import_node_fs125.openSync)(filepath, "r");
|
|
17855
18056
|
try {
|
|
17856
|
-
const before = (0,
|
|
18057
|
+
const before = (0, import_node_fs125.fstatSync)(descriptor, { bigint: true });
|
|
17857
18058
|
if (!before.isFile()) {
|
|
17858
18059
|
throw new Error(`${command} bundle must be a regular local file`);
|
|
17859
18060
|
}
|
|
17860
18061
|
if (before.size <= 0n) {
|
|
17861
18062
|
throw new Error(`${command} bundle is empty`);
|
|
17862
18063
|
}
|
|
17863
|
-
const bytes = (0,
|
|
17864
|
-
const after = (0,
|
|
18064
|
+
const bytes = (0, import_node_fs125.readFileSync)(descriptor);
|
|
18065
|
+
const after = (0, import_node_fs125.fstatSync)(descriptor, { bigint: true });
|
|
17865
18066
|
if (before.dev !== after.dev || before.ino !== after.ino || before.size !== after.size || before.mtimeNs !== after.mtimeNs || bytes.length !== Number(before.size)) {
|
|
17866
18067
|
throw new Error(`${command} bundle changed while it was being read`);
|
|
17867
18068
|
}
|
|
@@ -17873,7 +18074,7 @@ function readImmutableBundleSource(bundlePath, command) {
|
|
|
17873
18074
|
}
|
|
17874
18075
|
return source;
|
|
17875
18076
|
} finally {
|
|
17876
|
-
(0,
|
|
18077
|
+
(0, import_node_fs125.closeSync)(descriptor);
|
|
17877
18078
|
}
|
|
17878
18079
|
}
|
|
17879
18080
|
async function fetchBundleSource(bundleUrl, command) {
|
|
@@ -17927,15 +18128,15 @@ async function loadBundleSource(bundleInput, command) {
|
|
|
17927
18128
|
return source;
|
|
17928
18129
|
}
|
|
17929
18130
|
function listMetroAssetDest(assetsPath) {
|
|
17930
|
-
const directory2 = (0,
|
|
17931
|
-
if (!(0,
|
|
17932
|
-
const skipNested = (0,
|
|
18131
|
+
const directory2 = (0, import_node_path127.resolve)(assetsPath);
|
|
18132
|
+
if (!(0, import_node_fs125.existsSync)(directory2)) return { directory: directory2, files: [], truncated: false };
|
|
18133
|
+
const skipNested = (0, import_node_fs125.existsSync)((0, import_node_path127.join)(directory2, "package.json"));
|
|
17933
18134
|
const files2 = [];
|
|
17934
18135
|
let truncated = false;
|
|
17935
18136
|
const walk3 = (dir, prefix) => {
|
|
17936
18137
|
let entries;
|
|
17937
18138
|
try {
|
|
17938
|
-
entries = (0,
|
|
18139
|
+
entries = (0, import_node_fs125.readdirSync)(dir, { withFileTypes: true });
|
|
17939
18140
|
} catch {
|
|
17940
18141
|
return;
|
|
17941
18142
|
}
|
|
@@ -17947,7 +18148,7 @@ function listMetroAssetDest(assetsPath) {
|
|
|
17947
18148
|
if (entry.isDirectory()) {
|
|
17948
18149
|
if (entry.name === ".git") continue;
|
|
17949
18150
|
if (skipNested && PROJECT_ONLY_DIRECTORIES.has(entry.name)) continue;
|
|
17950
|
-
walk3((0,
|
|
18151
|
+
walk3((0, import_node_path127.join)(dir, entry.name), prefix ? `${prefix}/${entry.name}` : entry.name);
|
|
17951
18152
|
} else if (entry.isFile()) {
|
|
17952
18153
|
files2.push(prefix ? `${prefix}/${entry.name}` : entry.name);
|
|
17953
18154
|
}
|
|
@@ -17982,7 +18183,7 @@ function distinctByContent(directory2, options) {
|
|
|
17982
18183
|
for (const relative4 of options) {
|
|
17983
18184
|
let bytes;
|
|
17984
18185
|
try {
|
|
17985
|
-
bytes = (0,
|
|
18186
|
+
bytes = (0, import_node_fs125.readFileSync)((0, import_node_path127.join)(directory2, relative4));
|
|
17986
18187
|
} catch {
|
|
17987
18188
|
continue;
|
|
17988
18189
|
}
|
|
@@ -18027,7 +18228,7 @@ function placeMetroDescriptor(listing, descriptor) {
|
|
|
18027
18228
|
let bytes;
|
|
18028
18229
|
try {
|
|
18029
18230
|
bytes = combination.map(
|
|
18030
|
-
(relative4) => (0,
|
|
18231
|
+
(relative4) => (0, import_node_fs125.readFileSync)((0, import_node_path127.join)(listing.directory, relative4))
|
|
18031
18232
|
);
|
|
18032
18233
|
} catch {
|
|
18033
18234
|
continue;
|
|
@@ -18055,10 +18256,10 @@ function unverifiedContentKey(dest, fileDigests) {
|
|
|
18055
18256
|
return JSON.stringify(
|
|
18056
18257
|
dest.placements.map(
|
|
18057
18258
|
(placement) => placement.verified ? null : [...placement.files].map(([scale, relative4]) => {
|
|
18058
|
-
const file = (0,
|
|
18259
|
+
const file = (0, import_node_path127.join)(dest.directory, relative4);
|
|
18059
18260
|
let digest3 = fileDigests.get(file);
|
|
18060
18261
|
if (digest3 === void 0) {
|
|
18061
|
-
digest3 = (0, import_node_crypto65.createHash)("sha256").update((0,
|
|
18262
|
+
digest3 = (0, import_node_crypto65.createHash)("sha256").update((0, import_node_fs125.readFileSync)(file)).digest("hex");
|
|
18062
18263
|
fileDigests.set(file, digest3);
|
|
18063
18264
|
}
|
|
18064
18265
|
return [scale, digest3];
|
|
@@ -18067,42 +18268,42 @@ function unverifiedContentKey(dest, fileDigests) {
|
|
|
18067
18268
|
);
|
|
18068
18269
|
}
|
|
18069
18270
|
function findExpoExportRoot(bundleDirectory) {
|
|
18070
|
-
let directory2 = (0,
|
|
18271
|
+
let directory2 = (0, import_node_path127.resolve)(bundleDirectory);
|
|
18071
18272
|
for (let depth = 0; depth < 6; depth++) {
|
|
18072
|
-
const metadata = (0,
|
|
18073
|
-
if ((0,
|
|
18273
|
+
const metadata = (0, import_node_path127.join)(directory2, "metadata.json");
|
|
18274
|
+
if ((0, import_node_fs125.existsSync)(metadata) && (0, import_node_fs125.existsSync)((0, import_node_path127.join)(directory2, "assets"))) {
|
|
18074
18275
|
try {
|
|
18075
|
-
if ((0,
|
|
18276
|
+
if ((0, import_node_fs125.readFileSync)(metadata, "utf8").includes('"fileMetadata"')) {
|
|
18076
18277
|
return directory2;
|
|
18077
18278
|
}
|
|
18078
18279
|
} catch {
|
|
18079
18280
|
}
|
|
18080
18281
|
}
|
|
18081
|
-
const parent = (0,
|
|
18282
|
+
const parent = (0, import_node_path127.dirname)(directory2);
|
|
18082
18283
|
if (parent === directory2) return null;
|
|
18083
18284
|
directory2 = parent;
|
|
18084
18285
|
}
|
|
18085
18286
|
return null;
|
|
18086
18287
|
}
|
|
18087
18288
|
function searchMetroAssetDest(bundlePath, descriptors, command, assetsDirectory) {
|
|
18088
|
-
const bundleDirectory = (0,
|
|
18289
|
+
const bundleDirectory = (0, import_node_path127.dirname)((0, import_node_path127.resolve)(bundlePath));
|
|
18089
18290
|
const expoRoot = assetsDirectory || isRemoteBundleInput(bundlePath) ? null : findExpoExportRoot(bundleDirectory);
|
|
18090
|
-
const candidates = assetsDirectory ? [(0,
|
|
18091
|
-
...expoRoot ? [(0,
|
|
18092
|
-
(0,
|
|
18291
|
+
const candidates = assetsDirectory ? [(0, import_node_path127.resolve)(assetsDirectory)] : [
|
|
18292
|
+
...expoRoot ? [(0, import_node_path127.join)(expoRoot, "assets")] : [],
|
|
18293
|
+
(0, import_node_path127.join)(bundleDirectory, "assets"),
|
|
18093
18294
|
bundleDirectory,
|
|
18094
|
-
(0,
|
|
18295
|
+
(0, import_node_path127.resolve)(bundleDirectory, "..", "assets")
|
|
18095
18296
|
];
|
|
18096
18297
|
const cwd = process.cwd();
|
|
18097
18298
|
let projectDirectory = null;
|
|
18098
18299
|
for (const start of assetsDirectory ? [] : [bundleDirectory, cwd]) {
|
|
18099
|
-
let directory2 = (0,
|
|
18300
|
+
let directory2 = (0, import_node_path127.resolve)(start);
|
|
18100
18301
|
while (true) {
|
|
18101
18302
|
if (detectProject(directory2)?.hasMetroConfig) {
|
|
18102
18303
|
projectDirectory = directory2;
|
|
18103
18304
|
break;
|
|
18104
18305
|
}
|
|
18105
|
-
const parent = (0,
|
|
18306
|
+
const parent = (0, import_node_path127.dirname)(directory2);
|
|
18106
18307
|
if (parent === directory2) break;
|
|
18107
18308
|
directory2 = parent;
|
|
18108
18309
|
}
|
|
@@ -18110,11 +18311,11 @@ function searchMetroAssetDest(bundlePath, descriptors, command, assetsDirectory)
|
|
|
18110
18311
|
}
|
|
18111
18312
|
if (projectDirectory) {
|
|
18112
18313
|
candidates.push(
|
|
18113
|
-
(0,
|
|
18114
|
-
(0,
|
|
18115
|
-
(0,
|
|
18116
|
-
(0,
|
|
18117
|
-
(0,
|
|
18314
|
+
(0, import_node_path127.join)(projectDirectory, "assets"),
|
|
18315
|
+
(0, import_node_path127.join)(projectDirectory, "dist"),
|
|
18316
|
+
(0, import_node_path127.join)(projectDirectory, "dist", "assets"),
|
|
18317
|
+
(0, import_node_path127.join)(projectDirectory, "build"),
|
|
18318
|
+
(0, import_node_path127.join)(projectDirectory, "build", "assets")
|
|
18118
18319
|
);
|
|
18119
18320
|
}
|
|
18120
18321
|
const searched = [];
|
|
@@ -18122,7 +18323,7 @@ function searchMetroAssetDest(bundlePath, descriptors, command, assetsDirectory)
|
|
|
18122
18323
|
const stale = [];
|
|
18123
18324
|
let truncated = false;
|
|
18124
18325
|
for (const candidate of candidates) {
|
|
18125
|
-
const directory2 = (0,
|
|
18326
|
+
const directory2 = (0, import_node_path127.resolve)(candidate);
|
|
18126
18327
|
if (searched.includes(directory2)) continue;
|
|
18127
18328
|
searched.push(directory2);
|
|
18128
18329
|
const listing = listMetroAssetDest(directory2);
|
|
@@ -18232,7 +18433,7 @@ async function embedBundleAssets(bundlePath, command, assetPolicy, assetsDirecto
|
|
|
18232
18433
|
);
|
|
18233
18434
|
}
|
|
18234
18435
|
const relative4 = placement?.files.get(variant2.scale);
|
|
18235
|
-
if (relative4 && dest) return (0,
|
|
18436
|
+
if (relative4 && dest) return (0, import_node_fs125.readFileSync)((0, import_node_path127.join)(dest.directory, relative4));
|
|
18236
18437
|
if (placement && placement.files.size > 0) return null;
|
|
18237
18438
|
if (placement && placement.ambiguous.length > 0 && dest) {
|
|
18238
18439
|
throw new Error(
|
|
@@ -18261,7 +18462,7 @@ async function embedBundleAssets(bundlePath, command, assetPolicy, assetsDirecto
|
|
|
18261
18462
|
);
|
|
18262
18463
|
const classic = metroIosAssetDestRelatives(variant2.descriptor.httpServerLocation, filename)[0] ?? filename;
|
|
18263
18464
|
throw new Error(
|
|
18264
|
-
`${command} could not read ${(0,
|
|
18465
|
+
`${command} could not read ${(0, import_node_path127.join)(dest?.directory ?? ".", classic)} for ${variant2.descriptor.name}.${variant2.descriptor.type} at scale ${variant2.scale}, and has no stand-in for a .${variant2.descriptor.type} asset. Rebuild with \`react-native bundle --assets-dest\`.`
|
|
18265
18466
|
);
|
|
18266
18467
|
});
|
|
18267
18468
|
return {
|
|
@@ -18407,14 +18608,14 @@ async function createCloudBox(options) {
|
|
|
18407
18608
|
warnings: artifact.warnings
|
|
18408
18609
|
};
|
|
18409
18610
|
}
|
|
18410
|
-
var import_node_crypto65,
|
|
18611
|
+
var import_node_crypto65, import_node_fs125, import_node_path127, import_node_vm, DEFAULT_RNX_CLOUD_ORIGIN, MAX_RNX_CLOUD_BUNDLE_BYTES, REMOTE_COMMAND, PREVIEW_COMMAND, MAX_ASSET_DEST_FILES, ACCOUNT_CHOICE_REFUSALS, PROJECT_ONLY_DIRECTORIES, MAX_PLACEMENT_COMBINATIONS;
|
|
18411
18612
|
var init_cloud_client = __esm({
|
|
18412
18613
|
"cli/cloud-client.ts"() {
|
|
18413
18614
|
"use strict";
|
|
18414
18615
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
18415
18616
|
import_node_crypto65 = require("node:crypto");
|
|
18416
|
-
|
|
18417
|
-
|
|
18617
|
+
import_node_fs125 = require("node:fs");
|
|
18618
|
+
import_node_path127 = require("node:path");
|
|
18418
18619
|
import_node_vm = require("node:vm");
|
|
18419
18620
|
init_metroAssetArtifact();
|
|
18420
18621
|
init_metroCloudArtifact();
|
|
@@ -18580,12 +18781,12 @@ function commandWritesSim(msg) {
|
|
|
18580
18781
|
// src/chromium-admission.ts
|
|
18581
18782
|
init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
|
|
18582
18783
|
function readChromiumQueue(deps, verified2, own) {
|
|
18583
|
-
const { fs:
|
|
18584
|
-
const dir =
|
|
18784
|
+
const { fs: fs86, os: os16, path: path110, childProcess: childProcess2 } = deps;
|
|
18785
|
+
const dir = path110.join(
|
|
18585
18786
|
process.platform === "win32" ? os16.tmpdir() : "/tmp",
|
|
18586
18787
|
"chromium-admission"
|
|
18587
18788
|
);
|
|
18588
|
-
|
|
18789
|
+
fs86.mkdirSync(dir, { recursive: true });
|
|
18589
18790
|
const limit = Math.max(2, Math.floor(os16.cpus().length / 2));
|
|
18590
18791
|
const live = (entry) => {
|
|
18591
18792
|
const match = /^(\d+)-(\d+)-/.exec(entry);
|
|
@@ -18613,10 +18814,10 @@ function readChromiumQueue(deps, verified2, own) {
|
|
|
18613
18814
|
return same;
|
|
18614
18815
|
};
|
|
18615
18816
|
const tickets = [];
|
|
18616
|
-
for (const entry of
|
|
18817
|
+
for (const entry of fs86.readdirSync(dir)) {
|
|
18617
18818
|
if (entry !== own && !live(entry)) {
|
|
18618
18819
|
try {
|
|
18619
|
-
|
|
18820
|
+
fs86.unlinkSync(path110.join(dir, entry));
|
|
18620
18821
|
} catch {
|
|
18621
18822
|
}
|
|
18622
18823
|
continue;
|
|
@@ -18624,7 +18825,7 @@ function readChromiumQueue(deps, verified2, own) {
|
|
|
18624
18825
|
try {
|
|
18625
18826
|
tickets.push({
|
|
18626
18827
|
entry,
|
|
18627
|
-
created:
|
|
18828
|
+
created: fs86.statSync(path110.join(dir, entry), { bigint: true }).ctimeNs
|
|
18628
18829
|
});
|
|
18629
18830
|
} catch {
|
|
18630
18831
|
}
|
|
@@ -21258,7 +21459,7 @@ function scanLocalNative(appDir, pkg, answered, platform2, knownPackages = /* @_
|
|
|
21258
21459
|
expoModule: moduleDir ? (0, import_node_path14.relative)(appDir, moduleDir) || "." : null,
|
|
21259
21460
|
optional: optional3,
|
|
21260
21461
|
swift: moduleDir ? (nativeFilesByModule.get(moduleDir) ?? []).some(
|
|
21261
|
-
(
|
|
21462
|
+
(path110) => path110.endsWith(".swift") && [...(readSmallFile(path110) ?? "").matchAll(/\bName\(\s*"(\w+)"\s*\)/g)].some(
|
|
21262
21463
|
(match) => match[1] === name3
|
|
21263
21464
|
)
|
|
21264
21465
|
) : false,
|
|
@@ -22541,8 +22742,8 @@ export *
|
|
|
22541
22742
|
}`;
|
|
22542
22743
|
}
|
|
22543
22744
|
function swiftPackageIdentity(url) {
|
|
22544
|
-
const
|
|
22545
|
-
return (
|
|
22745
|
+
const path110 = url.endsWith("/") ? url.slice(0, -1) : url;
|
|
22746
|
+
return (path110.split("/").pop() ?? path110).replace(/\.git$/, "").toLowerCase();
|
|
22546
22747
|
}
|
|
22547
22748
|
var withoutGlogModuleMap = (flags) => flags.filter(
|
|
22548
22749
|
(flag) => !(flag.startsWith("-fmodule-map-file=") && flag.endsWith("/glog.modulemap"))
|
|
@@ -23089,8 +23290,8 @@ var import_node_fs28 = require("node:fs");
|
|
|
23089
23290
|
var import_node_path25 = require("node:path");
|
|
23090
23291
|
var Refusal = class extends Error {
|
|
23091
23292
|
};
|
|
23092
|
-
var refuse = (
|
|
23093
|
-
throw new Refusal(`Generated asset symbols are unproven for ${
|
|
23293
|
+
var refuse = (path110, reason) => {
|
|
23294
|
+
throw new Refusal(`Generated asset symbols are unproven for ${path110}: ${reason}`);
|
|
23094
23295
|
};
|
|
23095
23296
|
var isRecord2 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
23096
23297
|
var scope = (source) => ({
|
|
@@ -23378,14 +23579,14 @@ function addAsset(into, asset) {
|
|
|
23378
23579
|
function checkStack(dir, type, devices2) {
|
|
23379
23580
|
const sets = (parent, allowed) => (0, import_node_fs28.readdirSync)(parent, { withFileTypes: true }).flatMap((entry) => {
|
|
23380
23581
|
if (entry.name.startsWith(".") || entry.isFile()) return [];
|
|
23381
|
-
const
|
|
23582
|
+
const path110 = (0, import_node_path25.join)(parent, entry.name);
|
|
23382
23583
|
const extension = (0, import_node_path25.extname)(entry.name);
|
|
23383
23584
|
if (!entry.isDirectory() || !allowed.includes(extension))
|
|
23384
23585
|
return refuse(
|
|
23385
|
-
|
|
23586
|
+
path110,
|
|
23386
23587
|
`image stack content other than ${allowed.join(", ")} is unproven`
|
|
23387
23588
|
);
|
|
23388
|
-
return [{ path:
|
|
23589
|
+
return [{ path: path110, extension }];
|
|
23389
23590
|
});
|
|
23390
23591
|
for (const layer of sets(dir, [`.${type}layer`, ".imageset", ".colorset"])) {
|
|
23391
23592
|
if (layer.extension !== `.${type}layer`) continue;
|
|
@@ -23397,37 +23598,37 @@ function checkStack(dir, type, devices2) {
|
|
|
23397
23598
|
function walk(dir, into, devices2, extensions) {
|
|
23398
23599
|
for (const entry of (0, import_node_fs28.readdirSync)(dir, { withFileTypes: true })) {
|
|
23399
23600
|
if (entry.name.startsWith(".") || entry.isFile()) continue;
|
|
23400
|
-
const
|
|
23401
|
-
if (!entry.isDirectory()) return refuse(
|
|
23601
|
+
const path110 = (0, import_node_path25.join)(dir, entry.name);
|
|
23602
|
+
if (!entry.isDirectory()) return refuse(path110, "it is neither a file nor a directory");
|
|
23402
23603
|
const extension = (0, import_node_path25.extname)(entry.name).slice(1);
|
|
23403
23604
|
const type = extension.toLowerCase();
|
|
23404
23605
|
const base = entry.name.slice(0, entry.name.length - extension.length - 1);
|
|
23405
23606
|
if (type !== extension && knownTypes.has(type))
|
|
23406
|
-
return refuse(
|
|
23607
|
+
return refuse(path110, "its type extension is not lowercase");
|
|
23407
23608
|
if (type === "colorset" || type === "imageset" || type === "symbolset") {
|
|
23408
23609
|
addAsset(into, {
|
|
23409
23610
|
kind: type === "colorset" ? "color" : "image",
|
|
23410
23611
|
name: base,
|
|
23411
|
-
...assetState(
|
|
23612
|
+
...assetState(path110, type, devices2),
|
|
23412
23613
|
extensions,
|
|
23413
|
-
source:
|
|
23614
|
+
source: path110
|
|
23414
23615
|
});
|
|
23415
23616
|
continue;
|
|
23416
23617
|
}
|
|
23417
23618
|
if (silentTypes.has(type)) continue;
|
|
23418
23619
|
if (stackTypes.has(type)) {
|
|
23419
|
-
checkStack(
|
|
23620
|
+
checkStack(path110, type, devices2);
|
|
23420
23621
|
continue;
|
|
23421
23622
|
}
|
|
23422
|
-
if (unprovenTypes.has(type)) return refuse(
|
|
23623
|
+
if (unprovenTypes.has(type)) return refuse(path110, `${type} assets are unproven`);
|
|
23423
23624
|
const name3 = type === "spriteatlas" ? base : entry.name;
|
|
23424
|
-
if (!folderProperties((0, import_node_path25.join)(
|
|
23425
|
-
walk(
|
|
23625
|
+
if (!folderProperties((0, import_node_path25.join)(path110, "Contents.json")).namespace) {
|
|
23626
|
+
walk(path110, into, devices2, extensions);
|
|
23426
23627
|
continue;
|
|
23427
23628
|
}
|
|
23428
|
-
const child = into.namespaces.get(name3) ?? scope(
|
|
23629
|
+
const child = into.namespaces.get(name3) ?? scope(path110);
|
|
23429
23630
|
into.namespaces.set(name3, child);
|
|
23430
|
-
walk(
|
|
23631
|
+
walk(path110, child, devices2, extensions);
|
|
23431
23632
|
}
|
|
23432
23633
|
}
|
|
23433
23634
|
var hasKind = (into, kind) => [...into.assets.values()].some((asset) => asset.kind === kind && asset.included) || [...into.namespaces.values()].some((child) => hasKind(child, kind));
|
|
@@ -23496,11 +23697,11 @@ function members(into, kind, prefix, extensions) {
|
|
|
23496
23697
|
const assets2 = /* @__PURE__ */ new Set();
|
|
23497
23698
|
const out = [];
|
|
23498
23699
|
for (const entry of entries) {
|
|
23499
|
-
const
|
|
23700
|
+
const path110 = `${prefix}${entry.name}`;
|
|
23500
23701
|
const source = entry.child ? entry.child.source : entry.asset.source;
|
|
23501
23702
|
if (Array.from(entry.name).some((char) => char.charCodeAt(0) > 127))
|
|
23502
23703
|
refuse(source, "its name is not ASCII");
|
|
23503
|
-
const named = (text7) => `The \\"${escape(
|
|
23704
|
+
const named = (text7) => `The \\"${escape(path110)}\\" ${text7}`;
|
|
23504
23705
|
if (entry.child) {
|
|
23505
23706
|
const text7 = symbol(entry.name, true);
|
|
23506
23707
|
if (!text7)
|
|
@@ -23523,9 +23724,9 @@ function members(into, kind, prefix, extensions) {
|
|
|
23523
23724
|
namespaces.add(text7);
|
|
23524
23725
|
out.push({
|
|
23525
23726
|
type: "namespace",
|
|
23526
|
-
path:
|
|
23727
|
+
path: path110,
|
|
23527
23728
|
symbol: spelled(text7),
|
|
23528
|
-
members: members(entry.child, kind, `${
|
|
23729
|
+
members: members(entry.child, kind, `${path110}/`, extensions)
|
|
23529
23730
|
});
|
|
23530
23731
|
}
|
|
23531
23732
|
continue;
|
|
@@ -23552,7 +23753,7 @@ function members(into, kind, prefix, extensions) {
|
|
|
23552
23753
|
else if (!omitted)
|
|
23553
23754
|
out.push({
|
|
23554
23755
|
type: "asset",
|
|
23555
|
-
path:
|
|
23756
|
+
path: path110,
|
|
23556
23757
|
name: entry.name,
|
|
23557
23758
|
symbol: spelled(text6),
|
|
23558
23759
|
thinnable: asset.thinnable,
|
|
@@ -24086,11 +24287,11 @@ function catalogDigest(directory2) {
|
|
|
24086
24287
|
for (const entry of (0, import_node_fs29.readdirSync)(dir, { withFileTypes: true }).sort(
|
|
24087
24288
|
(a, b) => a.name.localeCompare(b.name)
|
|
24088
24289
|
)) {
|
|
24089
|
-
const
|
|
24090
|
-
if (entry.isDirectory()) walk3(
|
|
24091
|
-
else if (entry.isFile() && (0, import_node_fs29.statSync)(
|
|
24092
|
-
hashes.push([(0, import_node_path26.relative)(directory2,
|
|
24093
|
-
else throw new Error(`Unsupported asset catalog entry: ${
|
|
24290
|
+
const path110 = (0, import_node_path26.join)(dir, entry.name);
|
|
24291
|
+
if (entry.isDirectory()) walk3(path110);
|
|
24292
|
+
else if (entry.isFile() && (0, import_node_fs29.statSync)(path110).size <= 64 * 1024 * 1024)
|
|
24293
|
+
hashes.push([(0, import_node_path26.relative)(directory2, path110), sha2562((0, import_node_fs29.readFileSync)(path110))]);
|
|
24294
|
+
else throw new Error(`Unsupported asset catalog entry: ${path110}`);
|
|
24094
24295
|
}
|
|
24095
24296
|
};
|
|
24096
24297
|
walk3(directory2);
|
|
@@ -24102,7 +24303,7 @@ function symbolSource(plan, root) {
|
|
|
24102
24303
|
const known = symbolTexts.get(key2);
|
|
24103
24304
|
if (known !== void 0) return { status: "source", text: known };
|
|
24104
24305
|
const source = assetSymbolSource(
|
|
24105
|
-
plan.catalogs.map(({ path:
|
|
24306
|
+
plan.catalogs.map(({ path: path110 }) => (0, import_node_path26.join)(root, path110)),
|
|
24106
24307
|
plan.settings
|
|
24107
24308
|
);
|
|
24108
24309
|
if (source.status === "source") symbolTexts.set(key2, source.text);
|
|
@@ -24160,9 +24361,9 @@ function planAssetSymbols(resources, root, settings) {
|
|
|
24160
24361
|
`Generated asset symbols are proven only for TARGETED_DEVICE_FAMILY 1, 2, 1,2, 1,7, 1,2,6 or 1,2,7; this target resolves to "${families}".`
|
|
24161
24362
|
);
|
|
24162
24363
|
const plan = {
|
|
24163
|
-
catalogs: catalogs.map((
|
|
24164
|
-
path:
|
|
24165
|
-
sha256: catalogDigest((0, import_node_path26.join)(root,
|
|
24364
|
+
catalogs: catalogs.map((path110) => ({
|
|
24365
|
+
path: path110,
|
|
24366
|
+
sha256: catalogDigest((0, import_node_path26.join)(root, path110))
|
|
24166
24367
|
})),
|
|
24167
24368
|
settings: { deployment: target, devices: devices2, extensions: extensions === "YES" }
|
|
24168
24369
|
};
|
|
@@ -26282,10 +26483,10 @@ function synthesizedInterfaceEnums(interfaceText, module2, graphs) {
|
|
|
26282
26483
|
const enclosing = scopes.length > 0 ? scopes[scopes.length - 1].prefix : [];
|
|
26283
26484
|
if (scope2?.[3] === "enum" && opens > 0 && /(^|\s)(public|open)\s/.test(scope2[2] ?? "") && !/\bwhere\b/.test(first.masked) && first.masked[scope2.index + scope2[0].length] !== "<") {
|
|
26284
26485
|
const name3 = scope2[4];
|
|
26285
|
-
const
|
|
26286
|
-
if (!byPath.has(
|
|
26486
|
+
const path110 = scopeOf(name3, enclosing, false);
|
|
26487
|
+
if (!byPath.has(path110.join(".")) && (path110.length === 1 || byPath.has(path110.slice(0, -1).join(".")))) {
|
|
26287
26488
|
const keptAttrs = [...(scope2[1] ?? "").matchAll(/@\w+(?:\([^)]*\))?/g)].map((attr) => attr[0]).filter((attr) => !attr.startsWith("@objc"));
|
|
26288
|
-
const id = `s:peach-synthesized-${module2}-${
|
|
26489
|
+
const id = `s:peach-synthesized-${module2}-${path110.join(".")}`;
|
|
26289
26490
|
const body = [];
|
|
26290
26491
|
let inner = 1;
|
|
26291
26492
|
let closed = false;
|
|
@@ -26340,15 +26541,15 @@ function synthesizedInterfaceEnums(interfaceText, module2, graphs) {
|
|
|
26340
26541
|
symbols.push({
|
|
26341
26542
|
kind: { identifier: "swift.enum" },
|
|
26342
26543
|
identifier: { precise: id },
|
|
26343
|
-
pathComponents:
|
|
26544
|
+
pathComponents: path110,
|
|
26344
26545
|
declarationFragments: fragments,
|
|
26345
26546
|
accessLevel: "public"
|
|
26346
26547
|
});
|
|
26347
|
-
if (
|
|
26548
|
+
if (path110.length > 1)
|
|
26348
26549
|
relationships.push({
|
|
26349
26550
|
kind: "memberOf",
|
|
26350
26551
|
source: id,
|
|
26351
|
-
target: byPath.get(
|
|
26552
|
+
target: byPath.get(path110.slice(0, -1).join("."))
|
|
26352
26553
|
});
|
|
26353
26554
|
for (const kase of cases) {
|
|
26354
26555
|
const memberId = `${id}-${kase.leaf}`;
|
|
@@ -26357,7 +26558,7 @@ function synthesizedInterfaceEnums(interfaceText, module2, graphs) {
|
|
|
26357
26558
|
symbols.push({
|
|
26358
26559
|
kind: { identifier: "swift.enum.case" },
|
|
26359
26560
|
identifier: { precise: memberId },
|
|
26360
|
-
pathComponents: [...
|
|
26561
|
+
pathComponents: [...path110, kase.leaf],
|
|
26361
26562
|
declarationFragments: [
|
|
26362
26563
|
{ kind: "keyword", spelling: "case" },
|
|
26363
26564
|
{ kind: "text", spelling: " " },
|
|
@@ -26373,7 +26574,7 @@ function synthesizedInterfaceEnums(interfaceText, module2, graphs) {
|
|
|
26373
26574
|
symbols.push({
|
|
26374
26575
|
kind: { identifier: "swift.init" },
|
|
26375
26576
|
identifier: { precise: initId },
|
|
26376
|
-
pathComponents: [...
|
|
26577
|
+
pathComponents: [...path110, "init(rawValue:)"],
|
|
26377
26578
|
declarationFragments: [
|
|
26378
26579
|
{ kind: "keyword", spelling: "init" },
|
|
26379
26580
|
{ kind: "text", spelling: "?(" },
|
|
@@ -26442,7 +26643,7 @@ function emitSwiftStandin(sourceGraphs, options) {
|
|
|
26442
26643
|
})
|
|
26443
26644
|
)
|
|
26444
26645
|
);
|
|
26445
|
-
const trap = (
|
|
26646
|
+
const trap = (path110) => `fatalError("${path110} is ${options.placeholder === void 0 ? "a binary framework" : "a placeholder"} peach cannot run")`;
|
|
26446
26647
|
const skipped = [];
|
|
26447
26648
|
const behavior = options.behavior ?? /* @__PURE__ */ new Map();
|
|
26448
26649
|
const used = /* @__PURE__ */ new Set();
|
|
@@ -26792,34 +26993,34 @@ function emitSwiftStandin(sourceGraphs, options) {
|
|
|
26792
26993
|
lines.push(...physical);
|
|
26793
26994
|
owners.push(...physical.map(() => current2));
|
|
26794
26995
|
};
|
|
26795
|
-
const emitAt = (
|
|
26796
|
-
if (omit.has(
|
|
26996
|
+
const emitAt = (path110, line) => {
|
|
26997
|
+
if (omit.has(path110)) return;
|
|
26797
26998
|
const previous = current2;
|
|
26798
|
-
current2 =
|
|
26999
|
+
current2 = path110;
|
|
26799
27000
|
emit(line);
|
|
26800
27001
|
current2 = previous;
|
|
26801
27002
|
};
|
|
26802
27003
|
const emitInertState = (id, indent2, build) => {
|
|
26803
|
-
const
|
|
27004
|
+
const path110 = pathOf(byId.get(id));
|
|
26804
27005
|
emitAt(hiddenInit(id), `${indent2}init(_peachInert: Void) { ${build} }`);
|
|
26805
27006
|
const list2 = conforms.get(id) ?? [];
|
|
26806
27007
|
const has = (name3) => (children.get(id) ?? []).some((member) => leaf(member) === name3);
|
|
26807
27008
|
if (list2.includes("Encodable") && !has("encode(to:)"))
|
|
26808
27009
|
emitAt(
|
|
26809
|
-
`${
|
|
27010
|
+
`${path110}.encode(to:)`,
|
|
26810
27011
|
`${indent2}public func encode(to encoder: Encoder) throws {}`
|
|
26811
27012
|
);
|
|
26812
27013
|
if (list2.includes("Decodable") && !has("init(from:)"))
|
|
26813
27014
|
emitAt(
|
|
26814
|
-
`${
|
|
27015
|
+
`${path110}.init(from:)`,
|
|
26815
27016
|
`${indent2}public init(from decoder: Decoder) throws { self.init(_peachInert: ()) }`
|
|
26816
27017
|
);
|
|
26817
27018
|
};
|
|
26818
27019
|
const scoped = (body) => (symbol2, ...rest) => {
|
|
26819
|
-
const
|
|
26820
|
-
if (omit.has(
|
|
27020
|
+
const path110 = pathOf(symbol2);
|
|
27021
|
+
if (omit.has(path110)) return void skipped.push({ path: path110, reason: omit.get(path110) });
|
|
26821
27022
|
const previous = current2;
|
|
26822
|
-
current2 =
|
|
27023
|
+
current2 = path110;
|
|
26823
27024
|
try {
|
|
26824
27025
|
body(symbol2, ...rest);
|
|
26825
27026
|
} finally {
|
|
@@ -26851,7 +27052,7 @@ function emitSwiftStandin(sourceGraphs, options) {
|
|
|
26851
27052
|
};
|
|
26852
27053
|
const emitMember = scoped(
|
|
26853
27054
|
(member, indent2, context) => {
|
|
26854
|
-
const
|
|
27055
|
+
const path110 = pathOf(member);
|
|
26855
27056
|
if (TYPE_KINDS.has(member.kind.identifier)) {
|
|
26856
27057
|
const origin = origins.get(member.identifier.precise)?.split(".")[0];
|
|
26857
27058
|
const parent = owner.get(member.identifier.precise);
|
|
@@ -26868,7 +27069,7 @@ function emitSwiftStandin(sourceGraphs, options) {
|
|
|
26868
27069
|
))
|
|
26869
27070
|
return;
|
|
26870
27071
|
if (!MEMBER_KINDS.has(member.kind.identifier)) {
|
|
26871
|
-
skipped.push({ path:
|
|
27072
|
+
skipped.push({ path: path110, reason: `unhandled ${member.kind.identifier}` });
|
|
26872
27073
|
return;
|
|
26873
27074
|
}
|
|
26874
27075
|
const { 1: spelledAttrs, 2: rest } = LEADING_ATTRS.exec(text(member));
|
|
@@ -26876,27 +27077,27 @@ function emitSwiftStandin(sourceGraphs, options) {
|
|
|
26876
27077
|
/@(\w+)(?:\([^)]*\))?\s*/g,
|
|
26877
27078
|
(attr, name3) => typeByPath.has(name3) ? "" : attr
|
|
26878
27079
|
) : spelledAttrs;
|
|
26879
|
-
const attrs = options.unobjc?.has(
|
|
27080
|
+
const attrs = options.unobjc?.has(path110) ? wrapped.replace(/@objc(?:\([^)]*\))?\s*/g, "") : wrapped;
|
|
26880
27081
|
const modifiers = /^((?:(?:required|final|override|convenience|unowned(?:\(\w+\))?|weak|lazy|nonisolated|mutating|nonmutating) )*)(.*)$/s.exec(
|
|
26881
27082
|
rest
|
|
26882
27083
|
);
|
|
26883
27084
|
const flags = new Set(
|
|
26884
27085
|
modifiers[1].trim().split(/\s+/).filter(Boolean).map((flag) => flag.replace(/\(.*/, ""))
|
|
26885
27086
|
);
|
|
26886
|
-
const requiredInit = context.inClass && !!options.requiredInits?.has(
|
|
26887
|
-
const restatesRequired = context.inClass &&
|
|
27087
|
+
const requiredInit = context.inClass && !!options.requiredInits?.has(path110);
|
|
27088
|
+
const restatesRequired = context.inClass && path110.endsWith(".init()") && [...superChain(owner.get(member.identifier.precise) ?? "")].some(
|
|
26888
27089
|
(at) => options.requiredInits?.has(`${pathOf(byId.get(at))}.init()`)
|
|
26889
27090
|
);
|
|
26890
27091
|
const required = context.inClass && (flags.has("required") || requiredInit || restatesRequired);
|
|
26891
27092
|
const final = context.inClass && flags.has("final") ? "final " : "";
|
|
26892
27093
|
const mutating = flags.has("mutating") ? "mutating " : flags.has("nonmutating") ? "nonmutating " : "";
|
|
26893
27094
|
let core = `${flags.has("convenience") ? "convenience " : ""}${modifiers[2]}`;
|
|
26894
|
-
const override = context.inClass && !options.plain?.has(
|
|
27095
|
+
const override = context.inClass && !options.plain?.has(path110) && !restatesRequired && (flags.has("override") || overrides.has(member.identifier.precise) || options.forcedOverride?.has(path110) || isObjC(member) && path110.endsWith(".init()")) ? "override " : "";
|
|
26895
27096
|
const head = `${indent2}${attrs}${access(member, context.openOwner)} ${required ? "required " : ""}${final}${override}${mutating}`;
|
|
26896
|
-
const measured = behavior.get(
|
|
26897
|
-
if (measured) used.add(
|
|
27097
|
+
const measured = behavior.get(path110);
|
|
27098
|
+
if (measured) used.add(path110);
|
|
26898
27099
|
const overloadBody = /\basync\b/.test(core) ? measured?.asyncBody : /\bResult</.test(core) ? measured?.resultBody : void 0;
|
|
26899
|
-
const body = overloadBody ?? measured?.body ?? (options.inert ? inertBody(member) : trap(
|
|
27100
|
+
const body = overloadBody ?? measured?.body ?? (options.inert ? inertBody(member) : trap(path110));
|
|
26900
27101
|
switch (member.kind.identifier) {
|
|
26901
27102
|
case "swift.property":
|
|
26902
27103
|
case "swift.type.property":
|
|
@@ -26909,13 +27110,13 @@ function emitSwiftStandin(sourceGraphs, options) {
|
|
|
26909
27110
|
const parameter = !measured && !options.inert && !settable && /:\s*some\s/.test(decl) ? opaqueParameter(member) : void 0;
|
|
26910
27111
|
const getter = parameter ? `return ({ () -> ${parameter} in ${body} })()` : body;
|
|
26911
27112
|
const computed = decl.replace(/^((?:static |class )*)let /, "$1var ");
|
|
26912
|
-
const wrapper = options.projections?.get(
|
|
27113
|
+
const wrapper = options.projections?.get(path110);
|
|
26913
27114
|
if (wrapper) {
|
|
26914
27115
|
const type = /^var\s+`?\w+`?\s*:\s*(.+)$/s.exec(computed)?.[1];
|
|
26915
|
-
const initial = type && inertValue(type, /* @__PURE__ */ new Set(), [
|
|
27116
|
+
const initial = type && inertValue(type, /* @__PURE__ */ new Set(), [path110]);
|
|
26916
27117
|
if (!initial)
|
|
26917
27118
|
return void skipped.push({
|
|
26918
|
-
path:
|
|
27119
|
+
path: path110,
|
|
26919
27120
|
reason: `wrapped by ${wrapper} with no inert initial value`
|
|
26920
27121
|
});
|
|
26921
27122
|
const own = new RegExp(
|
|
@@ -26936,7 +27137,7 @@ function emitSwiftStandin(sourceGraphs, options) {
|
|
|
26936
27137
|
return;
|
|
26937
27138
|
}
|
|
26938
27139
|
emit(
|
|
26939
|
-
`${head}${computed} { get${effects} { ${getter} }${settable && !effects ? ` ${parsed.nonmutating ? "nonmutating " : ""}set { ${measured?.set ?? (options.inert ? "" : trap(
|
|
27140
|
+
`${head}${computed} { get${effects} { ${getter} }${settable && !effects ? ` ${parsed.nonmutating ? "nonmutating " : ""}set { ${measured?.set ?? (options.inert ? "" : trap(path110))} }` : ""} }`
|
|
26940
27141
|
);
|
|
26941
27142
|
return;
|
|
26942
27143
|
}
|
|
@@ -26995,7 +27196,7 @@ function emitSwiftStandin(sourceGraphs, options) {
|
|
|
26995
27196
|
};
|
|
26996
27197
|
const emitType = scoped(
|
|
26997
27198
|
(symbol2, indent2) => {
|
|
26998
|
-
const
|
|
27199
|
+
const path110 = pathOf(symbol2);
|
|
26999
27200
|
const id = symbol2.identifier.precise;
|
|
27000
27201
|
const inner = `${indent2} `;
|
|
27001
27202
|
switch (symbol2.kind.identifier) {
|
|
@@ -27012,10 +27213,10 @@ function emitSwiftStandin(sourceGraphs, options) {
|
|
|
27012
27213
|
case "swift.class": {
|
|
27013
27214
|
const shape = header(symbol2, "class", indent2);
|
|
27014
27215
|
if (!shape)
|
|
27015
|
-
return void skipped.push({ path:
|
|
27016
|
-
const parent = options.superclasses?.get(
|
|
27216
|
+
return void skipped.push({ path: path110, reason: `unparsed class ${text(symbol2)}` });
|
|
27217
|
+
const parent = options.superclasses?.get(path110) ?? superclass.get(id);
|
|
27017
27218
|
const blocked = classBlocked(id);
|
|
27018
|
-
if (blocked) return void skipped.push({ path:
|
|
27219
|
+
if (blocked) return void skipped.push({ path: path110, reason: blocked });
|
|
27019
27220
|
const ancestors = /* @__PURE__ */ new Set();
|
|
27020
27221
|
const inherited = /* @__PURE__ */ new Set();
|
|
27021
27222
|
for (let at = superId.get(id); at; at = superId.get(at)) {
|
|
@@ -27031,7 +27232,7 @@ function emitSwiftStandin(sourceGraphs, options) {
|
|
|
27031
27232
|
"Equatable",
|
|
27032
27233
|
"CustomStringConvertible",
|
|
27033
27234
|
"CustomDebugStringConvertible"
|
|
27034
|
-
].includes(name3)) && !(name3 === nsObjectProtocol && externalRoot(id) === nsObject) && !options.unconformed?.get(
|
|
27235
|
+
].includes(name3)) && !(name3 === nsObjectProtocol && externalRoot(id) === nsObject) && !options.unconformed?.get(path110)?.has(name3)
|
|
27035
27236
|
)
|
|
27036
27237
|
].filter((name3, at, all2) => all2.indexOf(name3) === at);
|
|
27037
27238
|
const parentSymbol = superId.has(id) ? byId.get(superId.get(id)) : void 0;
|
|
@@ -27043,9 +27244,9 @@ function emitSwiftStandin(sourceGraphs, options) {
|
|
|
27043
27244
|
`${indent2}${shape.attrs}${objcName ? `@objc(${objcName}) ` : ""}${shape.final}${open ? "open" : "public"} class ${shape.name}${shape.generics}${list2.length ? `: ${list2.join(", ")}` : ""}${selfConforming(shape.where)} {`
|
|
27044
27245
|
);
|
|
27045
27246
|
const members2 = membersOf(id);
|
|
27046
|
-
const extra = options.behavior?.get(
|
|
27247
|
+
const extra = options.behavior?.get(path110)?.members;
|
|
27047
27248
|
if (extra) {
|
|
27048
|
-
used.add(
|
|
27249
|
+
used.add(path110);
|
|
27049
27250
|
emit(`${inner}${extra}`);
|
|
27050
27251
|
}
|
|
27051
27252
|
for (const member of members2)
|
|
@@ -27101,11 +27302,11 @@ function emitSwiftStandin(sourceGraphs, options) {
|
|
|
27101
27302
|
if (protocol && member.kind.identifier === "swift.method" && leaf(member).endsWith("()") && have.has(`instance|leaf|${leaf(member).slice(0, -2)}`))
|
|
27102
27303
|
propertyWitnesses.push({
|
|
27103
27304
|
owner: current2,
|
|
27104
|
-
head: `extension ${pathOf(protocol)} where Self: ${
|
|
27305
|
+
head: `extension ${pathOf(protocol)} where Self: ${path110} {`,
|
|
27105
27306
|
member,
|
|
27106
|
-
path:
|
|
27307
|
+
path: path110
|
|
27107
27308
|
});
|
|
27108
|
-
else emitWitness(member, inner,
|
|
27309
|
+
else emitWitness(member, inner, path110, open && isObjC(member));
|
|
27109
27310
|
}
|
|
27110
27311
|
}
|
|
27111
27312
|
if (options.inert && designated2 && classBuild(id) === "hidden")
|
|
@@ -27113,13 +27314,13 @@ function emitSwiftStandin(sourceGraphs, options) {
|
|
|
27113
27314
|
const coder = members2.some((member) => leaf(member) === "init(coder:)");
|
|
27114
27315
|
if (designated2 && !coder && externalRoot(id) !== "NSObject" && externalRoot(id) !== null)
|
|
27115
27316
|
emit(
|
|
27116
|
-
`${inner}public required init?(coder: NSCoder) { ${options.inert ? "return nil" : trap(`${
|
|
27317
|
+
`${inner}public required init?(coder: NSCoder) { ${options.inert ? "return nil" : trap(`${path110}.init(coder:)`)} }`
|
|
27117
27318
|
);
|
|
27118
27319
|
if (designated2 && !members2.some((member) => leaf(member) === "init()") && [...superChain(id)].some(
|
|
27119
27320
|
(at) => options.requiredInits?.has(`${pathOf(byId.get(at))}.init()`)
|
|
27120
27321
|
))
|
|
27121
27322
|
emit(
|
|
27122
|
-
`${inner}public required init() { ${options.inert ? superInit(id) : trap(`${
|
|
27323
|
+
`${inner}public required init() { ${options.inert ? superInit(id) : trap(`${path110}.init()`)} }`
|
|
27123
27324
|
);
|
|
27124
27325
|
emit(`${indent2}}`);
|
|
27125
27326
|
return;
|
|
@@ -27127,7 +27328,7 @@ function emitSwiftStandin(sourceGraphs, options) {
|
|
|
27127
27328
|
case "swift.struct": {
|
|
27128
27329
|
const shape = header(symbol2, "struct", indent2);
|
|
27129
27330
|
if (!shape)
|
|
27130
|
-
return void skipped.push({ path:
|
|
27331
|
+
return void skipped.push({ path: path110, reason: `unparsed struct ${text(symbol2)}` });
|
|
27131
27332
|
const members2 = membersOf(id);
|
|
27132
27333
|
const raw2 = rawType(members2);
|
|
27133
27334
|
const list2 = inheritance(id);
|
|
@@ -27168,7 +27369,7 @@ function emitSwiftStandin(sourceGraphs, options) {
|
|
|
27168
27369
|
emitInertState(
|
|
27169
27370
|
id,
|
|
27170
27371
|
inner,
|
|
27171
|
-
raw2 ? `self.rawValue = ${inertValue(raw2, /* @__PURE__ */ new Set(), [
|
|
27372
|
+
raw2 ? `self.rawValue = ${inertValue(raw2, /* @__PURE__ */ new Set(), [path110]) ?? "0"}` : ""
|
|
27172
27373
|
);
|
|
27173
27374
|
emit(`${indent2}}`);
|
|
27174
27375
|
return;
|
|
@@ -27176,7 +27377,7 @@ function emitSwiftStandin(sourceGraphs, options) {
|
|
|
27176
27377
|
case "swift.enum": {
|
|
27177
27378
|
const shape = header(symbol2, "enum", indent2);
|
|
27178
27379
|
if (!shape)
|
|
27179
|
-
return void skipped.push({ path:
|
|
27380
|
+
return void skipped.push({ path: path110, reason: `unparsed enum ${text(symbol2)}` });
|
|
27180
27381
|
const members2 = membersOf(id);
|
|
27181
27382
|
const cases = members2.filter(
|
|
27182
27383
|
(member) => member.kind.identifier === "swift.enum.case"
|
|
@@ -27186,7 +27387,7 @@ function emitSwiftStandin(sourceGraphs, options) {
|
|
|
27186
27387
|
const missing2 = raw2 ? cases.filter((member) => !values.has(member.identifier.precise)) : [];
|
|
27187
27388
|
if (raw2 && (isObjC(symbol2) || /^c:@C?M@[^@]+@E@/.test(id)) && missing2.length > 0)
|
|
27188
27389
|
return void skipped.push({
|
|
27189
|
-
path:
|
|
27390
|
+
path: path110,
|
|
27190
27391
|
reason: `no header value for ${missing2.map(leaf).join(", ")}`
|
|
27191
27392
|
});
|
|
27192
27393
|
const list2 = inheritance(id, raw2 ?? void 0).filter(
|
|
@@ -27226,8 +27427,8 @@ function emitSwiftStandin(sourceGraphs, options) {
|
|
|
27226
27427
|
});
|
|
27227
27428
|
}
|
|
27228
27429
|
if (options.inert) {
|
|
27229
|
-
const value = options.trapped?.has(hiddenInit(id)) ? null : inertValue(
|
|
27230
|
-
emitInertState(id, inner, value === null ? trap(
|
|
27430
|
+
const value = options.trapped?.has(hiddenInit(id)) ? null : inertValue(path110, /* @__PURE__ */ new Set(), []);
|
|
27431
|
+
emitInertState(id, inner, value === null ? trap(path110) : `self = ${value}`);
|
|
27231
27432
|
}
|
|
27232
27433
|
emit(`${indent2}}`);
|
|
27233
27434
|
return;
|
|
@@ -27236,14 +27437,14 @@ function emitSwiftStandin(sourceGraphs, options) {
|
|
|
27236
27437
|
const shape = header(symbol2, "protocol", indent2);
|
|
27237
27438
|
if (!shape)
|
|
27238
27439
|
return void skipped.push({
|
|
27239
|
-
path:
|
|
27440
|
+
path: path110,
|
|
27240
27441
|
reason: `unparsed protocol ${text(symbol2)}`
|
|
27241
27442
|
});
|
|
27242
27443
|
const native = nativeObjcProtocols.has(id);
|
|
27243
27444
|
const objcName = native ? /^c:objc\(pl\)(\w+)$/.exec(id)?.[1] : void 0;
|
|
27244
27445
|
if (native && !objcName)
|
|
27245
27446
|
return void skipped.push({
|
|
27246
|
-
path:
|
|
27447
|
+
path: path110,
|
|
27247
27448
|
reason: `unknown Objective-C protocol identity ${id}`
|
|
27248
27449
|
});
|
|
27249
27450
|
const list2 = [
|
|
@@ -27271,7 +27472,7 @@ function emitSwiftStandin(sourceGraphs, options) {
|
|
|
27271
27472
|
}
|
|
27272
27473
|
emit(`${indent2}}`);
|
|
27273
27474
|
if (defaults.length > 0) {
|
|
27274
|
-
emit(`${indent2}extension ${
|
|
27475
|
+
emit(`${indent2}extension ${path110} {`);
|
|
27275
27476
|
for (const member of defaults) {
|
|
27276
27477
|
const decl = text(member);
|
|
27277
27478
|
if (optional3.has(member.identifier.precise) && member.kind.identifier === "swift.method" && !decl.replace(/\([^)]*\)/g, "").includes("->") && !/ async\b/.test(decl))
|
|
@@ -27363,7 +27564,7 @@ function emitSwiftStandin(sourceGraphs, options) {
|
|
|
27363
27564
|
};
|
|
27364
27565
|
const atWidth = (value, raw2) => (raw2 === "UInt" || raw2 === "Swift.UInt") && value === "18446744073709551615" ? "4294967295" : (raw2 === "Int" || raw2 === "Swift.Int") && value === "9223372036854775807" ? "2147483647" : (raw2 === "Int" || raw2 === "Swift.Int") && value === "-9223372036854775808" ? "-2147483648" : value;
|
|
27365
27566
|
const emitGlobal = scoped((symbol2) => {
|
|
27366
|
-
const
|
|
27567
|
+
const path110 = pathOf(symbol2);
|
|
27367
27568
|
const kind = symbol2.kind.identifier;
|
|
27368
27569
|
if (kind === "swift.func" || kind === "swift.func.op" || kind === "swift.method" || kind === "swift.type.method") {
|
|
27369
27570
|
const { 1: attrs, 2: rest } = LEADING_ATTRS.exec(text(symbol2));
|
|
@@ -27372,20 +27573,20 @@ function emitSwiftStandin(sourceGraphs, options) {
|
|
|
27372
27573
|
if (leaf(symbol2).endsWith("(_:)") && !/^(?:prefix|infix|postfix)\b/.test(spelled2))
|
|
27373
27574
|
spelled2 = `prefix ${spelled2}`;
|
|
27374
27575
|
}
|
|
27375
|
-
const measured = behavior.get(
|
|
27376
|
-
if (measured) used.add(
|
|
27576
|
+
const measured = behavior.get(path110);
|
|
27577
|
+
if (measured) used.add(path110);
|
|
27377
27578
|
const overloadBody = /\basync\b/.test(spelled2) ? measured?.asyncBody : /\bResult</.test(spelled2) ? measured?.resultBody : void 0;
|
|
27378
27579
|
emit(
|
|
27379
|
-
`${attrs}public ${spelled2} { ${overloadBody ?? measured?.body ?? (options.inert ? inertBody(symbol2) : trap(
|
|
27580
|
+
`${attrs}public ${spelled2} { ${overloadBody ?? measured?.body ?? (options.inert ? inertBody(symbol2) : trap(path110))} }`
|
|
27380
27581
|
);
|
|
27381
27582
|
} else if (kind === "swift.var") {
|
|
27382
27583
|
const parsed = splitAccessors(text(symbol2).replace(/^let /, "var "));
|
|
27383
|
-
const measured = behavior.get(
|
|
27384
|
-
if (measured) used.add(
|
|
27584
|
+
const measured = behavior.get(path110);
|
|
27585
|
+
if (measured) used.add(path110);
|
|
27385
27586
|
emit(
|
|
27386
|
-
`public ${parsed.decl} { ${measured?.body ?? (options.inert ? inertBody(symbol2) : trap(
|
|
27587
|
+
`public ${parsed.decl} { ${measured?.body ?? (options.inert ? inertBody(symbol2) : trap(path110))} }`
|
|
27387
27588
|
);
|
|
27388
|
-
} else skipped.push({ path:
|
|
27589
|
+
} else skipped.push({ path: path110, reason: `unhandled top-level ${kind}` });
|
|
27389
27590
|
});
|
|
27390
27591
|
const cExports = new Set(
|
|
27391
27592
|
[...byId.values()].flatMap((symbol2) => {
|
|
@@ -27402,7 +27603,7 @@ function emitSwiftStandin(sourceGraphs, options) {
|
|
|
27402
27603
|
return !name3 || !cExports.has(`${name3}|${text(symbol2)}`);
|
|
27403
27604
|
}).sort((a, b) => pathOf(a).localeCompare(pathOf(b)));
|
|
27404
27605
|
for (const symbol2 of roots) {
|
|
27405
|
-
const
|
|
27606
|
+
const path110 = pathOf(symbol2);
|
|
27406
27607
|
if (TYPE_KINDS.has(symbol2.kind.identifier)) emitType(symbol2, "");
|
|
27407
27608
|
else emitGlobal(symbol2);
|
|
27408
27609
|
}
|
|
@@ -27463,9 +27664,9 @@ function emitSwiftStandin(sourceGraphs, options) {
|
|
|
27463
27664
|
"#endif",
|
|
27464
27665
|
""
|
|
27465
27666
|
];
|
|
27466
|
-
for (const
|
|
27467
|
-
if (!used.has(
|
|
27468
|
-
skipped.push({ path:
|
|
27667
|
+
for (const path110 of behavior.keys())
|
|
27668
|
+
if (!used.has(path110))
|
|
27669
|
+
skipped.push({ path: path110, reason: "behavior names no emitted declaration" });
|
|
27469
27670
|
return {
|
|
27470
27671
|
source: `${[...banner, ...lines].join("\n")}
|
|
27471
27672
|
`,
|
|
@@ -29564,9 +29765,9 @@ var EXCERPT = /^(\s*)(\d+)( \| )(.*)$/;
|
|
|
29564
29765
|
var MARKER = /^(\s*)( \| )(.*)$/;
|
|
29565
29766
|
function designTimeDiagnostic(output2, files2) {
|
|
29566
29767
|
const rewritten = /* @__PURE__ */ new Map();
|
|
29567
|
-
const linesOf = (
|
|
29768
|
+
const linesOf = (path110) => {
|
|
29568
29769
|
const file = Object.keys(files2).find(
|
|
29569
|
-
(name3) => name3.endsWith(".swift") && (
|
|
29770
|
+
(name3) => name3.endsWith(".swift") && (path110 === name3 || path110.endsWith(`/${name3}`))
|
|
29570
29771
|
);
|
|
29571
29772
|
if (file === void 0) return null;
|
|
29572
29773
|
let lines = rewritten.get(file);
|
|
@@ -46364,7 +46565,7 @@ init_package_tree_digest();
|
|
|
46364
46565
|
init_swift_native_pin();
|
|
46365
46566
|
var EXPO_NATIVE_ENTRY_NAME = "ios";
|
|
46366
46567
|
function expoNativeCompilerDigestValue() {
|
|
46367
|
-
return true ? "
|
|
46568
|
+
return true ? "f762ea33a95654cc6dff527029e56f7d981bb2bf78a66b40799cf4af340546c3" : expoNativeCompilerDigest(__sootsim_import_meta_dirname);
|
|
46368
46569
|
}
|
|
46369
46570
|
var IDENTITY_SOURCE_SKIPS = 1 | 4 | 8 | 16 | 32 | 64 | 128 | 4096;
|
|
46370
46571
|
function readSources(value) {
|
|
@@ -47550,7 +47751,7 @@ function resolveSwiftPackages(options) {
|
|
|
47550
47751
|
headers.set(name3, import_node_path71.default.relative(binary2.dir, dir));
|
|
47551
47752
|
};
|
|
47552
47753
|
visit3(pkg, binary2.target);
|
|
47553
|
-
binary2.headerDependencies = [...headers].map(([module2,
|
|
47754
|
+
binary2.headerDependencies = [...headers].map(([module2, path110]) => ({ module: module2, path: path110 }));
|
|
47554
47755
|
}
|
|
47555
47756
|
for (const owner of options.owners ?? []) {
|
|
47556
47757
|
const found = productClosure(owner.products);
|
|
@@ -52570,8 +52771,8 @@ function imagesetFiles(images) {
|
|
|
52570
52771
|
];
|
|
52571
52772
|
}).sort((a, b) => a.scale - b.scale);
|
|
52572
52773
|
}
|
|
52573
|
-
function flatScale(
|
|
52574
|
-
const match = /@([23])x\.[^./]+$/.exec(
|
|
52774
|
+
function flatScale(path110) {
|
|
52775
|
+
const match = /@([23])x\.[^./]+$/.exec(path110);
|
|
52575
52776
|
return match ? Number(match[1]) : 1;
|
|
52576
52777
|
}
|
|
52577
52778
|
function providesNamespace(text6) {
|
|
@@ -52598,8 +52799,8 @@ function catalogEntryName(contentsPath, kind, readText) {
|
|
|
52598
52799
|
}
|
|
52599
52800
|
return segments.join("/");
|
|
52600
52801
|
}
|
|
52601
|
-
function isFlatResourceImage(
|
|
52602
|
-
return
|
|
52802
|
+
function isFlatResourceImage(path110) {
|
|
52803
|
+
return path110.split("/").includes("Resources") && RASTER_EXTENSIONS.has(extOf(path110));
|
|
52603
52804
|
}
|
|
52604
52805
|
function enumerateBundleImages(paths, readText, bundleForFile = () => ".") {
|
|
52605
52806
|
const table = [];
|
|
@@ -52612,7 +52813,7 @@ function enumerateBundleImages(paths, readText, bundleForFile = () => ".") {
|
|
|
52612
52813
|
seen.set(bundlePath, names);
|
|
52613
52814
|
return { bundlePath, names };
|
|
52614
52815
|
};
|
|
52615
|
-
const catalogs = paths.filter((
|
|
52816
|
+
const catalogs = paths.filter((path110) => baseOf(path110) === "Contents.json");
|
|
52616
52817
|
for (const contentsPath of catalogs) {
|
|
52617
52818
|
const name3 = catalogEntryName(contentsPath, ".imageset", readText);
|
|
52618
52819
|
if (name3 === null) continue;
|
|
@@ -52644,13 +52845,13 @@ function enumerateBundleImages(paths, readText, bundleForFile = () => ".") {
|
|
|
52644
52845
|
...intent === "template" || intent === "original" ? { renderingMode: intent } : {}
|
|
52645
52846
|
});
|
|
52646
52847
|
}
|
|
52647
|
-
for (const
|
|
52648
|
-
if (!isFlatResourceImage(
|
|
52649
|
-
const name3 = baseOf(
|
|
52650
|
-
const { bundlePath, names } = namesFor(
|
|
52848
|
+
for (const path110 of paths) {
|
|
52849
|
+
if (!isFlatResourceImage(path110)) continue;
|
|
52850
|
+
const name3 = baseOf(path110).slice(0, -extOf(path110).length);
|
|
52851
|
+
const { bundlePath, names } = namesFor(path110);
|
|
52651
52852
|
if (name3 === "" || names.has(name3)) continue;
|
|
52652
52853
|
names.add(name3);
|
|
52653
|
-
table.push({ name: name3, file:
|
|
52854
|
+
table.push({ name: name3, file: path110, scale: flatScale(path110), bundlePath });
|
|
52654
52855
|
}
|
|
52655
52856
|
return table;
|
|
52656
52857
|
}
|
|
@@ -52685,7 +52886,7 @@ function colorsetValue(color) {
|
|
|
52685
52886
|
}
|
|
52686
52887
|
function enumerateBundleColors(paths, readText) {
|
|
52687
52888
|
const table = {};
|
|
52688
|
-
for (const contentsPath of paths.filter((
|
|
52889
|
+
for (const contentsPath of paths.filter((path110) => baseOf(path110) === "Contents.json")) {
|
|
52689
52890
|
const name3 = catalogEntryName(contentsPath, ".colorset", readText);
|
|
52690
52891
|
if (name3 === null || name3 in table) continue;
|
|
52691
52892
|
let colors;
|
|
@@ -52766,8 +52967,8 @@ function axisExtremes(points) {
|
|
|
52766
52967
|
function pathBounds(d) {
|
|
52767
52968
|
const xs = [];
|
|
52768
52969
|
const ys = [];
|
|
52769
|
-
for (const
|
|
52770
|
-
(0, import_svgpath.default)(
|
|
52970
|
+
for (const path110 of d)
|
|
52971
|
+
(0, import_svgpath.default)(path110).abs().unshort().unarc().iterate((segment, _index, x, y) => {
|
|
52771
52972
|
const [command, ...args] = segment;
|
|
52772
52973
|
if (command === "M" || command === "L") {
|
|
52773
52974
|
xs.push(Number(args[0]));
|
|
@@ -52794,7 +52995,7 @@ function guide(svg, id, axis) {
|
|
|
52794
52995
|
}
|
|
52795
52996
|
function enumerateBundleSymbols(paths, readText, bundleForFile) {
|
|
52796
52997
|
const table = {};
|
|
52797
|
-
for (const contentsPath of paths.filter((
|
|
52998
|
+
for (const contentsPath of paths.filter((path110) => baseOf(path110) === "Contents.json")) {
|
|
52798
52999
|
const name3 = catalogEntryName(contentsPath, ".symbolset", readText);
|
|
52799
53000
|
if (name3 === null) continue;
|
|
52800
53001
|
const bundle = bundleForFile(contentsPath);
|
|
@@ -52853,8 +53054,8 @@ function enumerateBundleSymbols(paths, readText, bundleForFile) {
|
|
|
52853
53054
|
advance,
|
|
52854
53055
|
box: [12 - wide / 2, 12 - tall / 2, wide, tall],
|
|
52855
53056
|
...customLayout ? { customLayout } : {},
|
|
52856
|
-
layers: d.map((
|
|
52857
|
-
d: (0, import_svgpath.default)(
|
|
53057
|
+
layers: d.map((path110) => ({
|
|
53058
|
+
d: (0, import_svgpath.default)(path110).abs().scale(em).translate(translateX, translateY).round(3).toString()
|
|
52858
53059
|
}))
|
|
52859
53060
|
};
|
|
52860
53061
|
table[vectorKey] = vector;
|
|
@@ -52866,18 +53067,18 @@ function enumerateBundleSymbols(paths, readText, bundleForFile) {
|
|
|
52866
53067
|
return table;
|
|
52867
53068
|
}
|
|
52868
53069
|
var COMPILED_EXTENSIONS = /* @__PURE__ */ new Set([".swift", ".metal", ".storyboard", ".xib"]);
|
|
52869
|
-
function isCopiedResource(
|
|
52870
|
-
if (copiedBundle ||
|
|
53070
|
+
function isCopiedResource(path110, copiedBundle) {
|
|
53071
|
+
if (copiedBundle || path110.split("/").some((segment) => /\.(atlasc|bundle|storyboardc|nib)$/.test(segment)))
|
|
52871
53072
|
return true;
|
|
52872
|
-
const ext = extOf(
|
|
53073
|
+
const ext = extOf(path110);
|
|
52873
53074
|
if (ext === ".json" || ext === ".xcstrings") return true;
|
|
52874
|
-
return !RASTER_EXTENSIONS.has(ext) && !COMPILED_EXTENSIONS.has(ext) && !
|
|
53075
|
+
return !RASTER_EXTENSIONS.has(ext) && !COMPILED_EXTENSIONS.has(ext) && !path110.split("/").some((segment) => segment.endsWith(".xcassets"));
|
|
52875
53076
|
}
|
|
52876
53077
|
function enumerateBundleResources(paths, copiedBundle = false) {
|
|
52877
53078
|
const found = [];
|
|
52878
53079
|
const seen = /* @__PURE__ */ new Set();
|
|
52879
53080
|
const ordered = [...paths].filter(
|
|
52880
|
-
(
|
|
53081
|
+
(path110) => path110.split("/").includes("Resources") && path110.split("/").every((segment) => segment !== "" && segment !== "..") && isCopiedResource(path110, copiedBundle)
|
|
52881
53082
|
).sort((a, b) => {
|
|
52882
53083
|
const aDepth = a.split("/").length;
|
|
52883
53084
|
const bDepth = b.split("/").length;
|
|
@@ -52989,31 +53190,31 @@ function tokens(text6) {
|
|
|
52989
53190
|
}
|
|
52990
53191
|
return result;
|
|
52991
53192
|
}
|
|
52992
|
-
function qualified(language, key2,
|
|
52993
|
-
return `(${language}: ${key2}${
|
|
53193
|
+
function qualified(language, key2, path110) {
|
|
53194
|
+
return `(${language}: ${key2}${path110 === "" ? "" : "|==|" + path110})`;
|
|
52994
53195
|
}
|
|
52995
|
-
function requiresNumber(language, key2,
|
|
53196
|
+
function requiresNumber(language, key2, path110) {
|
|
52996
53197
|
return Error(
|
|
52997
|
-
"Plural variation requires referencing the number in the string. To maintain grammatical correctness for strings that do not reference the number of items, use separate top-level strings for one and greater than one. " + qualified(language, key2,
|
|
53198
|
+
"Plural variation requires referencing the number in the string. To maintain grammatical correctness for strings that do not reference the number of items, use separate top-level strings for one and greater than one. " + qualified(language, key2, path110)
|
|
52998
53199
|
);
|
|
52999
53200
|
}
|
|
53000
|
-
function moreThanOne(language, key2,
|
|
53201
|
+
function moreThanOne(language, key2, path110) {
|
|
53001
53202
|
return Error(
|
|
53002
|
-
"Cannot infer format specifier for string group because more than one numerical specifier was found " + qualified(language, key2,
|
|
53203
|
+
"Cannot infer format specifier for string group because more than one numerical specifier was found " + qualified(language, key2, path110)
|
|
53003
53204
|
);
|
|
53004
53205
|
}
|
|
53005
53206
|
function schemaPath(segments) {
|
|
53006
53207
|
return segments.map((segment) => `'${segment}'`).join(" -> ");
|
|
53007
53208
|
}
|
|
53008
|
-
function checkUnitShape(node,
|
|
53209
|
+
function checkUnitShape(node, path110) {
|
|
53009
53210
|
const raw2 = node.stringUnit;
|
|
53010
53211
|
if (raw2 === void 0)
|
|
53011
|
-
throw Error(`Missing required key 'stringUnit' inside ${schemaPath(
|
|
53212
|
+
throw Error(`Missing required key 'stringUnit' inside ${schemaPath(path110)}`);
|
|
53012
53213
|
if (raw2 === null)
|
|
53013
|
-
throw Error(`Missing required value for key 'stringUnit' inside ${schemaPath(
|
|
53214
|
+
throw Error(`Missing required value for key 'stringUnit' inside ${schemaPath(path110)}`);
|
|
53014
53215
|
if (!isRecord3(raw2))
|
|
53015
|
-
throw Error(`Expected dictionary for key 'stringUnit' inside ${schemaPath(
|
|
53016
|
-
const unitPath = [...
|
|
53216
|
+
throw Error(`Expected dictionary for key 'stringUnit' inside ${schemaPath(path110)}`);
|
|
53217
|
+
const unitPath = [...path110, "stringUnit"];
|
|
53017
53218
|
if (!Object.hasOwn(raw2, "state"))
|
|
53018
53219
|
throw Error(`Missing required key 'state' inside ${schemaPath(unitPath)}`);
|
|
53019
53220
|
const state = raw2.state;
|
|
@@ -53030,38 +53231,38 @@ function checkUnitShape(node, path109) {
|
|
|
53030
53231
|
throw Error(`Expected string for key 'value' inside ${schemaPath(unitPath)}`);
|
|
53031
53232
|
return value;
|
|
53032
53233
|
}
|
|
53033
|
-
function checkPluralShape(node,
|
|
53234
|
+
function checkPluralShape(node, path110) {
|
|
53034
53235
|
for (const [category, raw2] of Object.entries(node)) {
|
|
53035
|
-
const categoryPath = [...
|
|
53236
|
+
const categoryPath = [...path110, category];
|
|
53036
53237
|
if (raw2 === null)
|
|
53037
53238
|
throw Error(
|
|
53038
|
-
`Missing required value for key '${category}' inside ${schemaPath(
|
|
53239
|
+
`Missing required value for key '${category}' inside ${schemaPath(path110)}`
|
|
53039
53240
|
);
|
|
53040
53241
|
if (!isRecord3(raw2))
|
|
53041
|
-
throw Error(`Expected dictionary for key '${category}' inside ${schemaPath(
|
|
53242
|
+
throw Error(`Expected dictionary for key '${category}' inside ${schemaPath(path110)}`);
|
|
53042
53243
|
checkUnitShape(raw2, categoryPath);
|
|
53043
53244
|
}
|
|
53044
53245
|
}
|
|
53045
|
-
function checkLocalizationShape(node,
|
|
53246
|
+
function checkLocalizationShape(node, path110, deviceValue = false) {
|
|
53046
53247
|
if (node === null)
|
|
53047
53248
|
throw Error(
|
|
53048
|
-
`Missing required value for key '${
|
|
53249
|
+
`Missing required value for key '${path110[path110.length - 1]}' inside ${schemaPath(path110.slice(0, -1))}`
|
|
53049
53250
|
);
|
|
53050
53251
|
if (!isRecord3(node))
|
|
53051
53252
|
throw Error(
|
|
53052
|
-
`Expected dictionary for key '${
|
|
53253
|
+
`Expected dictionary for key '${path110[path110.length - 1]}' inside ${schemaPath(path110.slice(0, -1))}`
|
|
53053
53254
|
);
|
|
53054
|
-
if (Object.hasOwn(node, "variations")) checkVariationsShape(node.variations,
|
|
53255
|
+
if (Object.hasOwn(node, "variations")) checkVariationsShape(node.variations, path110);
|
|
53055
53256
|
if (!deviceValue && Object.hasOwn(node, "substitutions"))
|
|
53056
|
-
checkSubstitutionsShape(node.substitutions,
|
|
53057
|
-
if (!Object.hasOwn(node, "variations")) checkUnitShape(node,
|
|
53257
|
+
checkSubstitutionsShape(node.substitutions, path110);
|
|
53258
|
+
if (!Object.hasOwn(node, "variations")) checkUnitShape(node, path110);
|
|
53058
53259
|
}
|
|
53059
|
-
function checkVariationsShape(variations,
|
|
53260
|
+
function checkVariationsShape(variations, path110) {
|
|
53060
53261
|
if (variations === null)
|
|
53061
|
-
throw Error(`Missing required value for key 'variations' inside ${schemaPath(
|
|
53262
|
+
throw Error(`Missing required value for key 'variations' inside ${schemaPath(path110)}`);
|
|
53062
53263
|
if (!isRecord3(variations))
|
|
53063
|
-
throw Error(`Expected dictionary for key 'variations' inside ${schemaPath(
|
|
53064
|
-
const variationsPath = [...
|
|
53264
|
+
throw Error(`Expected dictionary for key 'variations' inside ${schemaPath(path110)}`);
|
|
53265
|
+
const variationsPath = [...path110, "variations"];
|
|
53065
53266
|
for (const [type, raw2] of Object.entries(variations)) {
|
|
53066
53267
|
if (raw2 === null)
|
|
53067
53268
|
throw Error(
|
|
@@ -53087,11 +53288,11 @@ function checkVariationsShape(variations, path109) {
|
|
|
53087
53288
|
}
|
|
53088
53289
|
}
|
|
53089
53290
|
}
|
|
53090
|
-
function checkSubstitutionsShape(substitutions,
|
|
53291
|
+
function checkSubstitutionsShape(substitutions, path110) {
|
|
53091
53292
|
if (substitutions === null) return;
|
|
53092
53293
|
if (!isRecord3(substitutions))
|
|
53093
|
-
throw Error(`Expected dictionary for key 'substitutions' inside ${schemaPath(
|
|
53094
|
-
const substitutionsPath = [...
|
|
53294
|
+
throw Error(`Expected dictionary for key 'substitutions' inside ${schemaPath(path110)}`);
|
|
53295
|
+
const substitutionsPath = [...path110, "substitutions"];
|
|
53095
53296
|
for (const [name3, raw2] of Object.entries(substitutions)) {
|
|
53096
53297
|
const subPath = [...substitutionsPath, name3];
|
|
53097
53298
|
if (raw2 === null)
|
|
@@ -53133,10 +53334,10 @@ function scanSpecs(forms) {
|
|
|
53133
53334
|
}
|
|
53134
53335
|
return specs;
|
|
53135
53336
|
}
|
|
53136
|
-
function inferPlural(forms, language, key2,
|
|
53337
|
+
function inferPlural(forms, language, key2, path110) {
|
|
53137
53338
|
const specs = scanSpecs(forms);
|
|
53138
|
-
if (specs.size === 0) throw requiresNumber(language, key2,
|
|
53139
|
-
if (specs.size > 1) throw moreThanOne(language, key2,
|
|
53339
|
+
if (specs.size === 0) throw requiresNumber(language, key2, path110);
|
|
53340
|
+
if (specs.size > 1) throw moreThanOne(language, key2, path110);
|
|
53140
53341
|
return [...specs.values()][0] ?? { specifier: "", argument: 0 };
|
|
53141
53342
|
}
|
|
53142
53343
|
function unit(value) {
|
|
@@ -53968,8 +54169,8 @@ function plist4(value, depth) {
|
|
|
53968
54169
|
}
|
|
53969
54170
|
function compileStringCatalog(source, name3) {
|
|
53970
54171
|
return Object.fromEntries(
|
|
53971
|
-
Object.entries(compileCatalogTables(source, name3)).map(([
|
|
53972
|
-
|
|
54172
|
+
Object.entries(compileCatalogTables(source, name3)).map(([path110, table]) => [
|
|
54173
|
+
path110,
|
|
53973
54174
|
'<?xml version="1.0" encoding="UTF-8"?>\n<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">\n<plist version="1.0">\n' + plist4(table, 0) + "</plist>\n"
|
|
53974
54175
|
])
|
|
53975
54176
|
);
|
|
@@ -54795,8 +54996,8 @@ function sourceEntryPath() {
|
|
|
54795
54996
|
return null;
|
|
54796
54997
|
}
|
|
54797
54998
|
}
|
|
54798
|
-
function isCliEntry(
|
|
54799
|
-
const name3 = (0, import_node_path81.basename)(
|
|
54999
|
+
function isCliEntry(path110) {
|
|
55000
|
+
const name3 = (0, import_node_path81.basename)(path110);
|
|
54800
55001
|
return name3 === "bin.ts" || name3 === "bin.js";
|
|
54801
55002
|
}
|
|
54802
55003
|
function rnxSelfInvocation() {
|
|
@@ -59465,11 +59666,11 @@ function stringList(value) {
|
|
|
59465
59666
|
function externalSpecMembers(root, requested) {
|
|
59466
59667
|
const children = (spec) => Array.isArray(spec.subspecs) ? spec.subspecs.filter(object5) : [];
|
|
59467
59668
|
const chains = /* @__PURE__ */ new Map();
|
|
59468
|
-
const select = (
|
|
59469
|
-
const key2 =
|
|
59669
|
+
const select = (path110) => {
|
|
59670
|
+
const key2 = path110.join("/");
|
|
59470
59671
|
if (chains.has(key2)) return;
|
|
59471
59672
|
const chain = [root];
|
|
59472
|
-
for (const part of
|
|
59673
|
+
for (const part of path110) {
|
|
59473
59674
|
const child = children(chain.at(-1)).find((sub) => sub.name === part);
|
|
59474
59675
|
if (!child) throw new Error(`${String(root.name)} has no subspec ${key2}`);
|
|
59475
59676
|
chain.push(child);
|
|
@@ -59478,7 +59679,7 @@ function externalSpecMembers(root, requested) {
|
|
|
59478
59679
|
const spec = chain.at(-1);
|
|
59479
59680
|
const defaults = stringList(spec.default_subspecs ?? spec.default_subspec);
|
|
59480
59681
|
const activated = defaults[0] === "none" ? [] : defaults.length > 0 ? defaults : children(spec).map((sub) => String(sub.name));
|
|
59481
|
-
for (const name3 of activated) select([...
|
|
59682
|
+
for (const name3 of activated) select([...path110, ...name3.split("/")]);
|
|
59482
59683
|
for (const member of chain)
|
|
59483
59684
|
for (const dependencies of [member.dependencies, iosOf(member)?.dependencies])
|
|
59484
59685
|
for (const dependency of object5(dependencies) ? Object.keys(dependencies) : []) {
|
|
@@ -66638,9 +66839,9 @@ function safeChildPlistName(value) {
|
|
|
66638
66839
|
name: file.toLowerCase().endsWith(".plist") ? file : `${file}.plist`
|
|
66639
66840
|
};
|
|
66640
66841
|
}
|
|
66641
|
-
async function readableSettingsBundle(
|
|
66842
|
+
async function readableSettingsBundle(path110) {
|
|
66642
66843
|
try {
|
|
66643
|
-
const root = await (0, import_promises10.stat)((0, import_node_path102.join)(
|
|
66844
|
+
const root = await (0, import_promises10.stat)((0, import_node_path102.join)(path110, "Root.plist"));
|
|
66644
66845
|
return root.isFile() && root.size <= MAX_PLIST_BYTES;
|
|
66645
66846
|
} catch {
|
|
66646
66847
|
return false;
|
|
@@ -66685,11 +66886,11 @@ async function settingsBundleFingerprint(bundlePath) {
|
|
|
66685
66886
|
return null;
|
|
66686
66887
|
}
|
|
66687
66888
|
}
|
|
66688
|
-
async function parsePlistRecord(
|
|
66889
|
+
async function parsePlistRecord(path110) {
|
|
66689
66890
|
try {
|
|
66690
|
-
const metadata = await (0, import_promises10.stat)(
|
|
66891
|
+
const metadata = await (0, import_promises10.stat)(path110);
|
|
66691
66892
|
if (!metadata.isFile() || metadata.size > MAX_PLIST_BYTES) return null;
|
|
66692
|
-
const source = await (0, import_promises10.readFile)(
|
|
66893
|
+
const source = await (0, import_promises10.readFile)(path110, "utf8");
|
|
66693
66894
|
const parsed = parsePlistSource(source);
|
|
66694
66895
|
return isRecord(parsed) ? parsed : null;
|
|
66695
66896
|
} catch {
|
|
@@ -67128,7 +67329,7 @@ async function tcpPing(port, timeout = TCP_GATE_MS) {
|
|
|
67128
67329
|
return null;
|
|
67129
67330
|
}
|
|
67130
67331
|
}
|
|
67131
|
-
function httpGet(hostname, port,
|
|
67332
|
+
function httpGet(hostname, port, path110, method = "GET", timeout = TIMEOUT_MS, headers = {}) {
|
|
67132
67333
|
return new Promise((resolve7) => {
|
|
67133
67334
|
let settled = false;
|
|
67134
67335
|
let killing = false;
|
|
@@ -67137,7 +67338,7 @@ function httpGet(hostname, port, path109, method = "GET", timeout = TIMEOUT_MS,
|
|
|
67137
67338
|
settled = true;
|
|
67138
67339
|
resolve7(value);
|
|
67139
67340
|
};
|
|
67140
|
-
const req = import_http.default.request({ hostname, port, path:
|
|
67341
|
+
const req = import_http.default.request({ hostname, port, path: path110, method, headers }, (res) => {
|
|
67141
67342
|
let body = "";
|
|
67142
67343
|
res.on("data", (c) => body += c.toString());
|
|
67143
67344
|
const contentType2 = (() => {
|