peachsim 0.1.1655 → 0.1.1660
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/cli/app-config.ts +4 -0
- package/cli/app-stubs.ts +43 -6
- package/cli/commands/inspect/shared.ts +5 -2
- package/cli/commands/inspect/url.ts +2 -1
- package/cli/commands/screenshot.ts +5 -5
- package/cli/commands/state.ts +9 -6
- package/cli/outbound-endpoints.ts +9 -1
- package/cli/output-redaction.ts +49 -0
- package/detox/index.ts +0 -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 +12772 -1132
- 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 +29 -5
- package/dist-lib/config.mjs +29 -5
- package/dist-lib/detox/index.cjs +19 -6
- package/dist-lib/dev-bundle-resolution.cjs +1 -1
- package/dist-lib/expo-swift-bundle.cjs +10411 -73
- 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 +11220 -670
- package/dist-lib/host/fetch-proxy-handler.cjs +260 -197
- 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 +653 -338
- 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 +443 -312
- 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 +548 -163
- package/dist-lib/native-app-identity-project.cjs +179 -33
- package/dist-lib/native-app-identity-project.mjs +179 -33
- 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/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 +23 -23
- package/dist-lib/public-origins-lib.json +96 -63
- package/dist-lib/react-native-host-modules.cjs +1 -1
- package/dist-lib/react-native-host-modules.mjs +1 -1
- package/dist-lib/scripts/dev-server-scanner.cjs +2 -2
- package/dist-lib/sdk.cjs +1 -1
- package/dist-lib/sdk.mjs +1 -1
- package/dist-lib/skills.cjs +12193 -1448
- package/dist-lib/swift-compile.cjs +10348 -172
- package/dist-lib/swift-compile.mjs +10348 -172
- 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 +10411 -73
- package/dist-lib/vite.cjs +149 -163
- package/dist-lib/worklet-executable.cjs +1 -1
- package/dist-lib/worklet-executable.mjs +1 -1
- package/dist-types/packages/peach-compat/src/stubs/native-seams/react-native-gesture-handler.d.ts +2 -0
- package/dist-types/packages/peach-engine/src/engine/app-font-registry.d.ts +14 -0
- package/dist-types/packages/peach-engine/src/engine/image-loader.d.ts +8 -0
- package/dist-types/packages/peach-engine/src/engine/node.d.ts +3 -0
- package/dist-types/packages/peach-engine/src/render-worker/compositor-protocol.d.ts +21 -0
- package/dist-types/packages/peach-engine/src/render-worker/gesture-seam-protocol.d.ts +2 -1
- package/dist-types/packages/peach-engine/src/render-worker/test-bridge-protocol.d.ts +1 -1
- package/dist-types/packages/peach-engine/src/rolldown-bundle-inventory.d.ts +1 -0
- package/dist-types/packages/peach-globals/src/index.d.ts +34 -0
- package/kotlin/README.md +38 -23
- package/kotlin/sdk.tar.gz +0 -0
- package/package.json +2 -12
- package/runtime-companion.json +1 -1
- package/src/bundleGlobalFooter.ts +0 -2
- package/src/config.ts +54 -2
- package/src/configured-bundle-producer.ts +7 -1
- package/src/host/fetch-proxy-handler.ts +14 -50
- package/src/host/rolldown-bundle-forward.ts +71 -0
- package/src/installed-package-versions.ts +54 -2
- package/src/kotlin-host.ts +138 -285
- package/src/kotlin-module.ts +4 -7
- package/src/kotlin-sdk.ts +81 -0
- package/src/kotlin-toolchain.ts +152 -0
- package/src/kotlin-view-models.ts +1 -1
- package/src/kotlinSdkContract.ts +113 -0
- package/src/nitro-adapter.lock.json +3 -3
- package/src/nitro-bundle.ts +18 -4
- package/src/nitro-compile.ts +5 -1
- package/src/nitro-source.ts +112 -28
- package/src/nitroContract.ts +16 -4
- package/src/stub-pattern-matcher.ts +4 -0
- package/src/swift-compile.ts +44 -14
- package/src/swift-host.ts +2 -1
- package/src/swift-objc-compile.ts +117 -4
- package/src/swift-objc-sdk.ts +10215 -59
- package/src/swift-objc-standin.ts +5 -2
- package/src/vite-plugin-one.ts +73 -134
- package/src/worker-system-chunks.ts +14 -4
- package/src/xcode-project.ts +261 -34
- package/kotlin/AndroidViewSources/android/content/Context.kt +0 -22
- package/kotlin/AndroidViewSources/android/content/res/Configuration.kt +0 -25
- package/kotlin/AndroidViewSources/android/content/res/Resources.kt +0 -72
- package/kotlin/AndroidViewSources/android/graphics/Canvas.kt +0 -22
- package/kotlin/AndroidViewSources/android/graphics/Color.kt +0 -13
- package/kotlin/AndroidViewSources/android/graphics/Paint.kt +0 -18
- package/kotlin/AndroidViewSources/android/util/DisplayMetrics.kt +0 -12
- package/kotlin/AndroidViewSources/android/view/View.kt +0 -211
- package/kotlin/AndroidViewSources/android/widget/FrameLayout.kt +0 -61
- package/kotlin/AndroidViewSources/android/widget/LinearLayout.kt +0 -49
- package/kotlin/AndroidViewSources/dev/peach/app/JavaFormat.kt +0 -272
- package/kotlin/AppSources/android/app/Activity.kt +0 -174
- package/kotlin/AppSources/android/app/Application.kt +0 -11
- package/kotlin/AppSources/android/app/UiModeManager.kt +0 -9
- package/kotlin/AppSources/android/content/Intent.kt +0 -16
- package/kotlin/AppSources/android/os/Bundle.kt +0 -11
- package/kotlin/AppSources/android/util/SuperNotCalledException.kt +0 -3
- package/kotlin/AppSources/android/view/Window.kt +0 -182
- package/kotlin/AppSources/android/view/WindowInsets.kt +0 -9
- package/kotlin/AppSources/android/view/WindowInsetsController.kt +0 -17
- package/kotlin/AppSources/android/view/WindowManager.kt +0 -16
- package/kotlin/AppSources/android/window/BackEvent.kt +0 -24
- package/kotlin/AppSources/android/window/OnBackAnimationCallback.kt +0 -7
- package/kotlin/AppSources/android/window/OnBackInvokedDispatcher.kt +0 -84
- package/kotlin/AppSources/androidx/activity/ActivityFlags.kt +0 -9
- package/kotlin/AppSources/androidx/activity/ActivityViewModelLazy.kt +0 -21
- package/kotlin/AppSources/androidx/activity/BackEventCompat.kt +0 -43
- package/kotlin/AppSources/androidx/activity/ComponentActivity.kt +0 -122
- package/kotlin/AppSources/androidx/activity/EdgeToEdge.kt +0 -75
- package/kotlin/AppSources/androidx/activity/ExperimentalActivityApi.kt +0 -6
- package/kotlin/AppSources/androidx/activity/OnBackPressedCallback.kt +0 -69
- package/kotlin/AppSources/androidx/activity/OnBackPressedDispatcher.kt +0 -144
- package/kotlin/AppSources/androidx/activity/OnBackPressedDispatcherOwner.kt +0 -7
- package/kotlin/AppSources/androidx/activity/compose/BackHandler.kt +0 -86
- package/kotlin/AppSources/androidx/activity/compose/ComponentActivity.kt +0 -29
- package/kotlin/AppSources/androidx/activity/compose/internal/BackHandlerCompat.kt +0 -38
- package/kotlin/AppSources/androidx/activity/compose/internal/BackHandlerDispatcherCompat.kt +0 -27
- package/kotlin/AppSources/androidx/compose/foundation/layout/WindowInsets.kt +0 -15
- package/kotlin/AppSources/androidx/compose/ui/platform/AndroidCompositionLocals.kt +0 -27
- package/kotlin/AppSources/androidx/compose/ui/platform/ComposeView.kt +0 -68
- package/kotlin/AppSources/androidx/compose/ui/res/ColorResources.kt +0 -16
- package/kotlin/AppSources/androidx/compose/ui/res/PainterResources.kt +0 -70
- package/kotlin/AppSources/androidx/compose/ui/res/StringResources.kt +0 -38
- package/kotlin/AppSources/androidx/core/view/WindowCompat.kt +0 -32
- package/kotlin/AppSources/androidx/lifecycle/AndroidViewModel.kt +0 -10
- package/kotlin/AppSources/dev/peach/app/PeachApp.kt +0 -388
- package/kotlin/AppSources/dev/peach/app/PeachDrawable.kt +0 -102
- package/kotlin/AppSources/dev/peach/app/PeachWindowHost.kt +0 -14
- package/kotlin/CompilerSources/META-INF/services/org.jetbrains.kotlin.compiler.plugin.CompilerPluginRegistrar +0 -1
- package/kotlin/CompilerSources/PeachJniIncoming.kt +0 -243
- package/kotlin/CompilerSources/PeachJniPlugin.kt +0 -116
- package/kotlin/ComposeSources/PeachComposeHost.kt +0 -724
- package/kotlin/ComposeSources/PeachMagnifier.kt +0 -185
- package/kotlin/ComposeSources/PeachSemantics.kt +0 -127
- package/kotlin/ExpoComposeSources/PeachAndroidView.kt +0 -103
- package/kotlin/ExpoComposeSources/PeachExpoViewMount.kt +0 -24
- package/kotlin/ExpoComposeSources/dev/peach/expo/PeachExpoCompose.kt +0 -28
- package/kotlin/ExpoComposeSources/expo/modules/kotlin/views/ExpoComposeView.kt +0 -70
- package/kotlin/ExpoSources/dev/peach/expo/PeachExpoRuntime.kt +0 -516
- package/kotlin/ExpoSources/dev/peach/expo/PeachExpoTypes.kt +0 -173
- package/kotlin/ExpoSources/expo/modules/kotlin/AppContext.kt +0 -20
- package/kotlin/ExpoSources/expo/modules/kotlin/Promise.kt +0 -19
- package/kotlin/ExpoSources/expo/modules/kotlin/classcomponent/ClassComponentBuilder.kt +0 -198
- package/kotlin/ExpoSources/expo/modules/kotlin/exception/CodedException.kt +0 -126
- package/kotlin/ExpoSources/expo/modules/kotlin/functions/Functions.kt +0 -132
- package/kotlin/ExpoSources/expo/modules/kotlin/jni/JavaScriptTypedArray.kt +0 -81
- package/kotlin/ExpoSources/expo/modules/kotlin/modules/Module.kt +0 -98
- package/kotlin/ExpoSources/expo/modules/kotlin/objects/ObjectDefinitionBuilder.kt +0 -236
- package/kotlin/ExpoSources/expo/modules/kotlin/records/Record.kt +0 -12
- package/kotlin/ExpoSources/expo/modules/kotlin/runtime/Runtime.kt +0 -9
- package/kotlin/ExpoSources/expo/modules/kotlin/sharedobjects/SharedObject.kt +0 -50
- package/kotlin/ExpoSources/expo/modules/kotlin/sharedobjects/SharedObjectRegistry.kt +0 -57
- package/kotlin/ExpoSources/expo/modules/kotlin/sharedobjects/SharedRef.kt +0 -19
- package/kotlin/ExpoSources/expo/modules/kotlin/typedarray/ConcreteTypedArrays.kt +0 -158
- package/kotlin/ExpoSources/expo/modules/kotlin/typedarray/GenericTypedArray.kt +0 -8
- package/kotlin/ExpoSources/expo/modules/kotlin/typedarray/TypedArray.kt +0 -29
- package/kotlin/ExpoSources/expo/modules/kotlin/typedarray/TypedArrayIterator.kt +0 -9
- package/kotlin/ExpoSources/expo/modules/kotlin/types/AnyType.kt +0 -155
- package/kotlin/ExpoSources/expo/modules/kotlin/types/Either.kt +0 -91
- package/kotlin/ExpoSources/expo/modules/kotlin/types/Enumerable.kt +0 -6
- package/kotlin/ExpoSources/expo/modules/kotlin/viewevent/ViewEvent.kt +0 -68
- package/kotlin/ExpoSources/expo/modules/kotlin/views/ExpoView.kt +0 -20
- package/kotlin/ExpoSources/expo/modules/kotlin/views/ViewDefinitionBuilder.kt +0 -72
- package/kotlin/ExpoSources/expo/modules/kotlin/views/ViewProps.kt +0 -36
- package/kotlin/JniPlatformSources/androidx/annotation/CallSuper.kt +0 -5
- package/kotlin/JniPlatformSources/com/facebook/proguard/annotations/DoNotStrip.kt +0 -5
- package/kotlin/JniPlatformSources/dalvik/annotation/optimization/FastNative.kt +0 -5
- package/kotlin/JniPlatformSources/kotlin/Synchronized.kt +0 -6
- package/kotlin/JniPlatformSources/kotlin/jvm/JvmField.kt +0 -5
- package/kotlin/JniPlatformSources/kotlin/jvm/JvmStatic.kt +0 -5
- package/kotlin/JniSources/com/facebook/jni/HybridData.kt +0 -66
- package/kotlin/JniSources/dev/peach/jni/IncomingBindings.kt +0 -157
- package/kotlin/JniSources/dev/peach/jni/NativeBindings.kt +0 -77
- package/kotlin/JniTransportSources/dev/peach/jni/integration/JniTransport.kt +0 -89
- package/kotlin/Sources/android/os/Build.kt +0 -17
- package/kotlin/Sources/android/os/Handler.kt +0 -35
- package/kotlin/Sources/android/os/Looper.kt +0 -17
- package/kotlin/Sources/android/os/MessageQueue.kt +0 -56
- package/kotlin/Sources/android/os/SystemClock.kt +0 -14
- package/kotlin/Sources/android/util/Log.kt +0 -64
- package/kotlin/Sources/androidx/annotation/DrawableRes.kt +0 -14
- package/kotlin/Sources/androidx/annotation/Keep.kt +0 -4
- package/kotlin/Sources/dev/onejs/one/OneNativeSourceDispatch.kt +0 -7
- package/kotlin/Sources/dev/onejs/one/OneNativeSourceViewDispatch.kt +0 -13
- package/kotlin/Sources/dev/onejs/one/source/OneModule.kt +0 -4
- package/kotlin/Sources/java/lang/Runnable.kt +0 -6
- package/kotlin/Sources/java/security/MessageDigest.kt +0 -114
- package/kotlin/Sources/java/util/IllegalFormatCodePointException.kt +0 -10
- package/kotlin/Sources/java/util/IllegalFormatException.kt +0 -5
- package/kotlin/Sources/kotlin/text/StringFormat.kt +0 -9
- package/kotlin/Sources/org/json/JSON.kt +0 -307
- package/kotlin/tools/abi-classes.main.kts +0 -41
- package/kotlin/tools/expo-types.main.kts +0 -127
package/dist-lib/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! peach v0.1.
|
|
1
|
+
/*! peach v0.1.1660 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
|
|
2
2
|
let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; } catch {}
|
|
3
3
|
"use strict";
|
|
4
4
|
var __create = Object.create;
|
|
@@ -81,11 +81,9 @@ ${prefix2}${json}${suffix}`;
|
|
|
81
81
|
const identity = findBundleFooter(source, "globalThis.__sootsimModulePaths=");
|
|
82
82
|
return identity < 0 ? source + footer : source.slice(0, identity) + footer + source.slice(identity);
|
|
83
83
|
}
|
|
84
|
-
var ROLLDOWN_INVENTORY_HEADER;
|
|
85
84
|
var init_bundleGlobalFooter = __esm({
|
|
86
85
|
"src/bundleGlobalFooter.ts"() {
|
|
87
86
|
"use strict";
|
|
88
|
-
ROLLDOWN_INVENTORY_HEADER = "X-Peach-Rolldown-Inventory";
|
|
89
87
|
}
|
|
90
88
|
});
|
|
91
89
|
|
|
@@ -93,7 +91,7 @@ var init_bundleGlobalFooter = __esm({
|
|
|
93
91
|
var runtime_companion_default;
|
|
94
92
|
var init_runtime_companion = __esm({
|
|
95
93
|
"runtime-companion.json"() {
|
|
96
|
-
runtime_companion_default = { abi: 1, sha256: "
|
|
94
|
+
runtime_companion_default = { abi: 1, sha256: "a0c90fd4b5bf7e03f5705f9f4eba0fa945d8fc7834bfc5505f6e1cf6244d0931", file: "node/cli-a0c90fd4b5bf7e03f5705f9f4eba0fa945d8fc7834bfc5505f6e1cf6244d0931.cjs" };
|
|
97
95
|
}
|
|
98
96
|
});
|
|
99
97
|
|
|
@@ -1711,17 +1709,17 @@ function visit(node, visitor) {
|
|
|
1711
1709
|
} else
|
|
1712
1710
|
visit_(null, node, visitor_, Object.freeze([]));
|
|
1713
1711
|
}
|
|
1714
|
-
function visit_(key, node, visitor,
|
|
1715
|
-
const ctrl = callVisitor(key, node, visitor,
|
|
1712
|
+
function visit_(key, node, visitor, path21) {
|
|
1713
|
+
const ctrl = callVisitor(key, node, visitor, path21);
|
|
1716
1714
|
if (isNode(ctrl) || isPair(ctrl)) {
|
|
1717
|
-
replaceNode(key,
|
|
1718
|
-
return visit_(key, ctrl, visitor,
|
|
1715
|
+
replaceNode(key, path21, ctrl);
|
|
1716
|
+
return visit_(key, ctrl, visitor, path21);
|
|
1719
1717
|
}
|
|
1720
1718
|
if (typeof ctrl !== "symbol") {
|
|
1721
1719
|
if (isCollection(node)) {
|
|
1722
|
-
|
|
1720
|
+
path21 = Object.freeze(path21.concat(node));
|
|
1723
1721
|
for (let i = 0; i < node.items.length; ++i) {
|
|
1724
|
-
const ci = visit_(i, node.items[i], visitor,
|
|
1722
|
+
const ci = visit_(i, node.items[i], visitor, path21);
|
|
1725
1723
|
if (typeof ci === "number")
|
|
1726
1724
|
i = ci - 1;
|
|
1727
1725
|
else if (ci === BREAK)
|
|
@@ -1732,13 +1730,13 @@ function visit_(key, node, visitor, path20) {
|
|
|
1732
1730
|
}
|
|
1733
1731
|
}
|
|
1734
1732
|
} else if (isPair(node)) {
|
|
1735
|
-
|
|
1736
|
-
const ck = visit_("key", node.key, visitor,
|
|
1733
|
+
path21 = Object.freeze(path21.concat(node));
|
|
1734
|
+
const ck = visit_("key", node.key, visitor, path21);
|
|
1737
1735
|
if (ck === BREAK)
|
|
1738
1736
|
return BREAK;
|
|
1739
1737
|
else if (ck === REMOVE)
|
|
1740
1738
|
node.key = null;
|
|
1741
|
-
const cv = visit_("value", node.value, visitor,
|
|
1739
|
+
const cv = visit_("value", node.value, visitor, path21);
|
|
1742
1740
|
if (cv === BREAK)
|
|
1743
1741
|
return BREAK;
|
|
1744
1742
|
else if (cv === REMOVE)
|
|
@@ -1756,17 +1754,17 @@ async function visitAsync(node, visitor) {
|
|
|
1756
1754
|
} else
|
|
1757
1755
|
await visitAsync_(null, node, visitor_, Object.freeze([]));
|
|
1758
1756
|
}
|
|
1759
|
-
async function visitAsync_(key, node, visitor,
|
|
1760
|
-
const ctrl = await callVisitor(key, node, visitor,
|
|
1757
|
+
async function visitAsync_(key, node, visitor, path21) {
|
|
1758
|
+
const ctrl = await callVisitor(key, node, visitor, path21);
|
|
1761
1759
|
if (isNode(ctrl) || isPair(ctrl)) {
|
|
1762
|
-
replaceNode(key,
|
|
1763
|
-
return visitAsync_(key, ctrl, visitor,
|
|
1760
|
+
replaceNode(key, path21, ctrl);
|
|
1761
|
+
return visitAsync_(key, ctrl, visitor, path21);
|
|
1764
1762
|
}
|
|
1765
1763
|
if (typeof ctrl !== "symbol") {
|
|
1766
1764
|
if (isCollection(node)) {
|
|
1767
|
-
|
|
1765
|
+
path21 = Object.freeze(path21.concat(node));
|
|
1768
1766
|
for (let i = 0; i < node.items.length; ++i) {
|
|
1769
|
-
const ci = await visitAsync_(i, node.items[i], visitor,
|
|
1767
|
+
const ci = await visitAsync_(i, node.items[i], visitor, path21);
|
|
1770
1768
|
if (typeof ci === "number")
|
|
1771
1769
|
i = ci - 1;
|
|
1772
1770
|
else if (ci === BREAK)
|
|
@@ -1777,13 +1775,13 @@ async function visitAsync_(key, node, visitor, path20) {
|
|
|
1777
1775
|
}
|
|
1778
1776
|
}
|
|
1779
1777
|
} else if (isPair(node)) {
|
|
1780
|
-
|
|
1781
|
-
const ck = await visitAsync_("key", node.key, visitor,
|
|
1778
|
+
path21 = Object.freeze(path21.concat(node));
|
|
1779
|
+
const ck = await visitAsync_("key", node.key, visitor, path21);
|
|
1782
1780
|
if (ck === BREAK)
|
|
1783
1781
|
return BREAK;
|
|
1784
1782
|
else if (ck === REMOVE)
|
|
1785
1783
|
node.key = null;
|
|
1786
|
-
const cv = await visitAsync_("value", node.value, visitor,
|
|
1784
|
+
const cv = await visitAsync_("value", node.value, visitor, path21);
|
|
1787
1785
|
if (cv === BREAK)
|
|
1788
1786
|
return BREAK;
|
|
1789
1787
|
else if (cv === REMOVE)
|
|
@@ -1810,23 +1808,23 @@ function initVisitor(visitor) {
|
|
|
1810
1808
|
}
|
|
1811
1809
|
return visitor;
|
|
1812
1810
|
}
|
|
1813
|
-
function callVisitor(key, node, visitor,
|
|
1811
|
+
function callVisitor(key, node, visitor, path21) {
|
|
1814
1812
|
if (typeof visitor === "function")
|
|
1815
|
-
return visitor(key, node,
|
|
1813
|
+
return visitor(key, node, path21);
|
|
1816
1814
|
if (isMap(node))
|
|
1817
|
-
return visitor.Map?.(key, node,
|
|
1815
|
+
return visitor.Map?.(key, node, path21);
|
|
1818
1816
|
if (isSeq(node))
|
|
1819
|
-
return visitor.Seq?.(key, node,
|
|
1817
|
+
return visitor.Seq?.(key, node, path21);
|
|
1820
1818
|
if (isPair(node))
|
|
1821
|
-
return visitor.Pair?.(key, node,
|
|
1819
|
+
return visitor.Pair?.(key, node, path21);
|
|
1822
1820
|
if (isScalar(node))
|
|
1823
|
-
return visitor.Scalar?.(key, node,
|
|
1821
|
+
return visitor.Scalar?.(key, node, path21);
|
|
1824
1822
|
if (isAlias(node))
|
|
1825
|
-
return visitor.Alias?.(key, node,
|
|
1823
|
+
return visitor.Alias?.(key, node, path21);
|
|
1826
1824
|
return void 0;
|
|
1827
1825
|
}
|
|
1828
|
-
function replaceNode(key,
|
|
1829
|
-
const parent =
|
|
1826
|
+
function replaceNode(key, path21, node) {
|
|
1827
|
+
const parent = path21[path21.length - 1];
|
|
1830
1828
|
if (isCollection(parent)) {
|
|
1831
1829
|
parent.items[key] = node;
|
|
1832
1830
|
} else if (isPair(parent)) {
|
|
@@ -2377,10 +2375,10 @@ var init_createNode = __esm({
|
|
|
2377
2375
|
});
|
|
2378
2376
|
|
|
2379
2377
|
// ../../node_modules/yaml/browser/dist/nodes/Collection.js
|
|
2380
|
-
function collectionFromPath(schema4,
|
|
2378
|
+
function collectionFromPath(schema4, path21, value) {
|
|
2381
2379
|
let v = value;
|
|
2382
|
-
for (let i =
|
|
2383
|
-
const k =
|
|
2380
|
+
for (let i = path21.length - 1; i >= 0; --i) {
|
|
2381
|
+
const k = path21[i];
|
|
2384
2382
|
if (typeof k === "number" && Number.isInteger(k) && k >= 0) {
|
|
2385
2383
|
const a = [];
|
|
2386
2384
|
a[k] = v;
|
|
@@ -2405,7 +2403,7 @@ var init_Collection = __esm({
|
|
|
2405
2403
|
init_createNode();
|
|
2406
2404
|
init_identity();
|
|
2407
2405
|
init_Node();
|
|
2408
|
-
isEmptyPath = (
|
|
2406
|
+
isEmptyPath = (path21) => path21 == null || typeof path21 === "object" && !!path21[Symbol.iterator]().next().done;
|
|
2409
2407
|
Collection = class extends NodeBase {
|
|
2410
2408
|
constructor(type, schema4) {
|
|
2411
2409
|
super(type);
|
|
@@ -2435,11 +2433,11 @@ var init_Collection = __esm({
|
|
|
2435
2433
|
* be a Pair instance or a `{ key, value }` object, which may not have a key
|
|
2436
2434
|
* that already exists in the map.
|
|
2437
2435
|
*/
|
|
2438
|
-
addIn(
|
|
2439
|
-
if (isEmptyPath(
|
|
2436
|
+
addIn(path21, value) {
|
|
2437
|
+
if (isEmptyPath(path21))
|
|
2440
2438
|
this.add(value);
|
|
2441
2439
|
else {
|
|
2442
|
-
const [key, ...rest] =
|
|
2440
|
+
const [key, ...rest] = path21;
|
|
2443
2441
|
const node = this.get(key, true);
|
|
2444
2442
|
if (isCollection(node))
|
|
2445
2443
|
node.addIn(rest, value);
|
|
@@ -2453,8 +2451,8 @@ var init_Collection = __esm({
|
|
|
2453
2451
|
* Removes a value from the collection.
|
|
2454
2452
|
* @returns `true` if the item was found and removed.
|
|
2455
2453
|
*/
|
|
2456
|
-
deleteIn(
|
|
2457
|
-
const [key, ...rest] =
|
|
2454
|
+
deleteIn(path21) {
|
|
2455
|
+
const [key, ...rest] = path21;
|
|
2458
2456
|
if (rest.length === 0)
|
|
2459
2457
|
return this.delete(key);
|
|
2460
2458
|
const node = this.get(key, true);
|
|
@@ -2468,8 +2466,8 @@ var init_Collection = __esm({
|
|
|
2468
2466
|
* scalar values from their surrounding node; to disable set `keepScalar` to
|
|
2469
2467
|
* `true` (collections are always returned intact).
|
|
2470
2468
|
*/
|
|
2471
|
-
getIn(
|
|
2472
|
-
const [key, ...rest] =
|
|
2469
|
+
getIn(path21, keepScalar) {
|
|
2470
|
+
const [key, ...rest] = path21;
|
|
2473
2471
|
const node = this.get(key, true);
|
|
2474
2472
|
if (rest.length === 0)
|
|
2475
2473
|
return !keepScalar && isScalar(node) ? node.value : node;
|
|
@@ -2487,8 +2485,8 @@ var init_Collection = __esm({
|
|
|
2487
2485
|
/**
|
|
2488
2486
|
* Checks if the collection includes a value with the key `key`.
|
|
2489
2487
|
*/
|
|
2490
|
-
hasIn(
|
|
2491
|
-
const [key, ...rest] =
|
|
2488
|
+
hasIn(path21) {
|
|
2489
|
+
const [key, ...rest] = path21;
|
|
2492
2490
|
if (rest.length === 0)
|
|
2493
2491
|
return this.has(key);
|
|
2494
2492
|
const node = this.get(key, true);
|
|
@@ -2498,8 +2496,8 @@ var init_Collection = __esm({
|
|
|
2498
2496
|
* Sets a value in this collection. For `!!set`, `value` needs to be a
|
|
2499
2497
|
* boolean to add/remove the item from the set.
|
|
2500
2498
|
*/
|
|
2501
|
-
setIn(
|
|
2502
|
-
const [key, ...rest] =
|
|
2499
|
+
setIn(path21, value) {
|
|
2500
|
+
const [key, ...rest] = path21;
|
|
2503
2501
|
if (rest.length === 0) {
|
|
2504
2502
|
this.set(key, value);
|
|
2505
2503
|
} else {
|
|
@@ -4418,15 +4416,15 @@ function visit2(cst, visitor) {
|
|
|
4418
4416
|
cst = { start: cst.start, value: cst.value };
|
|
4419
4417
|
_visit(Object.freeze([]), cst, visitor);
|
|
4420
4418
|
}
|
|
4421
|
-
function _visit(
|
|
4422
|
-
let ctrl = visitor(item,
|
|
4419
|
+
function _visit(path21, item, visitor) {
|
|
4420
|
+
let ctrl = visitor(item, path21);
|
|
4423
4421
|
if (typeof ctrl === "symbol")
|
|
4424
4422
|
return ctrl;
|
|
4425
4423
|
for (const field of ["key", "value"]) {
|
|
4426
4424
|
const token = item[field];
|
|
4427
4425
|
if (token && "items" in token) {
|
|
4428
4426
|
for (let i = 0; i < token.items.length; ++i) {
|
|
4429
|
-
const ci = _visit(Object.freeze(
|
|
4427
|
+
const ci = _visit(Object.freeze(path21.concat([[field, i]])), token.items[i], visitor);
|
|
4430
4428
|
if (typeof ci === "number")
|
|
4431
4429
|
i = ci - 1;
|
|
4432
4430
|
else if (ci === BREAK2)
|
|
@@ -4437,10 +4435,10 @@ function _visit(path20, item, visitor) {
|
|
|
4437
4435
|
}
|
|
4438
4436
|
}
|
|
4439
4437
|
if (typeof ctrl === "function" && field === "key")
|
|
4440
|
-
ctrl = ctrl(item,
|
|
4438
|
+
ctrl = ctrl(item, path21);
|
|
4441
4439
|
}
|
|
4442
4440
|
}
|
|
4443
|
-
return typeof ctrl === "function" ? ctrl(item,
|
|
4441
|
+
return typeof ctrl === "function" ? ctrl(item, path21) : ctrl;
|
|
4444
4442
|
}
|
|
4445
4443
|
var BREAK2, SKIP2, REMOVE2;
|
|
4446
4444
|
var init_cst_visit = __esm({
|
|
@@ -4451,9 +4449,9 @@ var init_cst_visit = __esm({
|
|
|
4451
4449
|
visit2.BREAK = BREAK2;
|
|
4452
4450
|
visit2.SKIP = SKIP2;
|
|
4453
4451
|
visit2.REMOVE = REMOVE2;
|
|
4454
|
-
visit2.itemAtPath = (cst,
|
|
4452
|
+
visit2.itemAtPath = (cst, path21) => {
|
|
4455
4453
|
let item = cst;
|
|
4456
|
-
for (const [field, index] of
|
|
4454
|
+
for (const [field, index] of path21) {
|
|
4457
4455
|
const tok = item?.[field];
|
|
4458
4456
|
if (tok && "items" in tok) {
|
|
4459
4457
|
item = tok.items[index];
|
|
@@ -4462,9 +4460,9 @@ var init_cst_visit = __esm({
|
|
|
4462
4460
|
}
|
|
4463
4461
|
return item;
|
|
4464
4462
|
};
|
|
4465
|
-
visit2.parentCollection = (cst,
|
|
4466
|
-
const parent = visit2.itemAtPath(cst,
|
|
4467
|
-
const field =
|
|
4463
|
+
visit2.parentCollection = (cst, path21) => {
|
|
4464
|
+
const parent = visit2.itemAtPath(cst, path21.slice(0, -1));
|
|
4465
|
+
const field = path21[path21.length - 1][0];
|
|
4468
4466
|
const coll = parent?.[field];
|
|
4469
4467
|
if (coll && "items" in coll)
|
|
4470
4468
|
return coll;
|
|
@@ -4626,8 +4624,8 @@ function metadataValue(value, key) {
|
|
|
4626
4624
|
if (!value || typeof value !== "object") return void 0;
|
|
4627
4625
|
return Object.getOwnPropertyDescriptor(value, key)?.value;
|
|
4628
4626
|
}
|
|
4629
|
-
function readProjectJson(
|
|
4630
|
-
const text2 = readProjectMetadata(
|
|
4627
|
+
function readProjectJson(path21, files = nodeRepoFileReader) {
|
|
4628
|
+
const text2 = readProjectMetadata(path21, files);
|
|
4631
4629
|
if (text2 === null) return null;
|
|
4632
4630
|
try {
|
|
4633
4631
|
const value = JSON.parse(text2);
|
|
@@ -5165,6 +5163,93 @@ var init_replacement_module_handler = __esm({
|
|
|
5165
5163
|
}
|
|
5166
5164
|
});
|
|
5167
5165
|
|
|
5166
|
+
// src/swift-source-file.ts
|
|
5167
|
+
function readPackageFile(root, file, maxBytes) {
|
|
5168
|
+
const canonicalRoot = import_node_fs10.default.realpathSync(root);
|
|
5169
|
+
const relative3 = import_node_path9.default.relative(canonicalRoot, import_node_fs10.default.realpathSync(file));
|
|
5170
|
+
if (relative3 === ".." || relative3.startsWith(`..${import_node_path9.default.sep}`) || import_node_path9.default.isAbsolute(relative3)) {
|
|
5171
|
+
throw new Error(`swift input escapes the selected package: ${file}`);
|
|
5172
|
+
}
|
|
5173
|
+
let ancestor = import_node_path9.default.resolve(file);
|
|
5174
|
+
while (ancestor !== canonicalRoot) {
|
|
5175
|
+
if (import_node_fs10.default.lstatSync(ancestor).isSymbolicLink()) {
|
|
5176
|
+
throw new Error(`swift input is a symlink: ${ancestor}`);
|
|
5177
|
+
}
|
|
5178
|
+
const parent = import_node_path9.default.dirname(ancestor);
|
|
5179
|
+
if (parent === ancestor)
|
|
5180
|
+
throw new Error(`swift input escapes the selected package: ${file}`);
|
|
5181
|
+
ancestor = parent;
|
|
5182
|
+
}
|
|
5183
|
+
const expected = import_node_fs10.default.statSync(file);
|
|
5184
|
+
const fd = import_node_fs10.default.openSync(file, import_node_fs10.default.constants.O_RDONLY | import_node_fs10.default.constants.O_NOFOLLOW);
|
|
5185
|
+
try {
|
|
5186
|
+
const stat = import_node_fs10.default.fstatSync(fd);
|
|
5187
|
+
if (stat.dev !== expected.dev || stat.ino !== expected.ino) {
|
|
5188
|
+
throw new Error(`swift input changed while opening: ${file}`);
|
|
5189
|
+
}
|
|
5190
|
+
if (!stat.isFile() || stat.size > maxBytes) {
|
|
5191
|
+
throw new Error(`swift input exceeds ${maxBytes} bytes: ${file}`);
|
|
5192
|
+
}
|
|
5193
|
+
const bytes = Buffer.alloc(stat.size + 1);
|
|
5194
|
+
let offset = 0;
|
|
5195
|
+
while (offset < bytes.length) {
|
|
5196
|
+
const count = import_node_fs10.default.readSync(fd, bytes, offset, bytes.length - offset, null);
|
|
5197
|
+
if (count === 0) break;
|
|
5198
|
+
offset += count;
|
|
5199
|
+
}
|
|
5200
|
+
if (offset !== stat.size || import_node_fs10.default.fstatSync(fd).size !== stat.size) {
|
|
5201
|
+
throw new Error(`swift input changed while reading: ${file}`);
|
|
5202
|
+
}
|
|
5203
|
+
return bytes.subarray(0, offset);
|
|
5204
|
+
} finally {
|
|
5205
|
+
import_node_fs10.default.closeSync(fd);
|
|
5206
|
+
}
|
|
5207
|
+
}
|
|
5208
|
+
var import_node_fs10, import_node_path9;
|
|
5209
|
+
var init_swift_source_file = __esm({
|
|
5210
|
+
"src/swift-source-file.ts"() {
|
|
5211
|
+
"use strict";
|
|
5212
|
+
import_node_fs10 = __toESM(require("node:fs"), 1);
|
|
5213
|
+
import_node_path9 = __toESM(require("node:path"), 1);
|
|
5214
|
+
}
|
|
5215
|
+
});
|
|
5216
|
+
|
|
5217
|
+
// src/assetCatalogContract.ts
|
|
5218
|
+
var init_assetCatalogContract = __esm({
|
|
5219
|
+
"src/assetCatalogContract.ts"() {
|
|
5220
|
+
"use strict";
|
|
5221
|
+
}
|
|
5222
|
+
});
|
|
5223
|
+
|
|
5224
|
+
// src/swiftContract.ts
|
|
5225
|
+
var init_swiftContract = __esm({
|
|
5226
|
+
"src/swiftContract.ts"() {
|
|
5227
|
+
"use strict";
|
|
5228
|
+
init_assetCatalogContract();
|
|
5229
|
+
}
|
|
5230
|
+
});
|
|
5231
|
+
|
|
5232
|
+
// src/swift-submit.ts
|
|
5233
|
+
var SWIFT_PACKAGE_PATH, SWIFT_HMR_PATH, DEFAULT_SWIFT_COMPILE_BUILD_MS, MAX_SWIFT_COMPILE_BUILD_MS, MAX_SWIFT_COMPILE_SOURCE_BYTES, MAX_SWIFT_COMPILE_RESOURCE_BYTES, MAX_SWIFT_COMPILE_RESOURCE_TOTAL_BYTES, MAX_SWIFT_COMPILE_METAL_BYTES, MAX_SWIFT_COMPILE_METAL_TOTAL_BYTES, MAX_SWIFT_COMPILE_IMAGE_BYTES, MAX_SWIFT_COMPILE_IMAGE_TOTAL_BYTES;
|
|
5234
|
+
var init_swift_submit = __esm({
|
|
5235
|
+
"src/swift-submit.ts"() {
|
|
5236
|
+
"use strict";
|
|
5237
|
+
init_is_record();
|
|
5238
|
+
init_swiftContract();
|
|
5239
|
+
SWIFT_PACKAGE_PATH = "/__peach/swift-package/";
|
|
5240
|
+
SWIFT_HMR_PATH = "/__peach/swift-hmr";
|
|
5241
|
+
DEFAULT_SWIFT_COMPILE_BUILD_MS = 10 * 6e4;
|
|
5242
|
+
MAX_SWIFT_COMPILE_BUILD_MS = 60 * 6e4;
|
|
5243
|
+
MAX_SWIFT_COMPILE_SOURCE_BYTES = 2 * 1024 * 1024;
|
|
5244
|
+
MAX_SWIFT_COMPILE_RESOURCE_BYTES = 2 * 1024 * 1024;
|
|
5245
|
+
MAX_SWIFT_COMPILE_RESOURCE_TOTAL_BYTES = 8 * 1024 * 1024;
|
|
5246
|
+
MAX_SWIFT_COMPILE_METAL_BYTES = 2 * 1024 * 1024;
|
|
5247
|
+
MAX_SWIFT_COMPILE_METAL_TOTAL_BYTES = 8 * 1024 * 1024;
|
|
5248
|
+
MAX_SWIFT_COMPILE_IMAGE_BYTES = 4 * 1024 * 1024;
|
|
5249
|
+
MAX_SWIFT_COMPILE_IMAGE_TOTAL_BYTES = 16 * 1024 * 1024;
|
|
5250
|
+
}
|
|
5251
|
+
});
|
|
5252
|
+
|
|
5168
5253
|
// cli/app-project.ts
|
|
5169
5254
|
function firstNamedFile(dir, names) {
|
|
5170
5255
|
for (const name2 of names) {
|
|
@@ -5266,6 +5351,19 @@ function readNativeRenderer(value) {
|
|
|
5266
5351
|
if (value === "paper" || value === "fabric") return value;
|
|
5267
5352
|
throw new Error("nativeRenderer must be paper or fabric");
|
|
5268
5353
|
}
|
|
5354
|
+
function isHybridObjectAnswer(answer) {
|
|
5355
|
+
return answer === "unsupported" || isRecord(answer) && typeof answer.file === "string" && answer.file.length > 0;
|
|
5356
|
+
}
|
|
5357
|
+
function isHybridObjects(value) {
|
|
5358
|
+
return isRecord(value) && Object.entries(value).every(
|
|
5359
|
+
([name2, answer]) => name2.length > 0 && isHybridObjectAnswer(answer)
|
|
5360
|
+
);
|
|
5361
|
+
}
|
|
5362
|
+
function isPackageHybridObjects(value) {
|
|
5363
|
+
return isRecord(value) && Object.entries(value).every(
|
|
5364
|
+
([name2, answer]) => name2.length > 0 && typeof answer === "string" && answer.length > 0 && answer !== "noop"
|
|
5365
|
+
);
|
|
5366
|
+
}
|
|
5269
5367
|
function isPackageStubs(value) {
|
|
5270
5368
|
if (value === "noop") return true;
|
|
5271
5369
|
if (!isRecord(value)) return false;
|
|
@@ -5273,12 +5371,18 @@ function isPackageStubs(value) {
|
|
|
5273
5371
|
(stub) => typeof stub === "string" && stub.length > 0
|
|
5274
5372
|
)) && (value.views === void 0 || isRecord(value.views) && Object.values(value.views).every(
|
|
5275
5373
|
(stub) => typeof stub === "string" && stub.length > 0 || isNativeViewSource(stub)
|
|
5276
|
-
));
|
|
5374
|
+
)) && (value.hybridObjects === void 0 || isPackageHybridObjects(value.hybridObjects));
|
|
5277
5375
|
}
|
|
5278
5376
|
function collectConfiguredFileModules(config) {
|
|
5279
5377
|
return [
|
|
5280
5378
|
...new Set(
|
|
5281
|
-
[
|
|
5379
|
+
[
|
|
5380
|
+
"modules",
|
|
5381
|
+
"turboModules",
|
|
5382
|
+
"nativeModules",
|
|
5383
|
+
"nativeViews",
|
|
5384
|
+
"nativeHybridObjects"
|
|
5385
|
+
].flatMap((key) => {
|
|
5282
5386
|
const entries = config && Reflect.get(config, key);
|
|
5283
5387
|
if (!isRecord(entries)) return [];
|
|
5284
5388
|
return Object.values(entries).flatMap(
|
|
@@ -5296,12 +5400,13 @@ function isPeachConfig(value) {
|
|
|
5296
5400
|
"turboModules",
|
|
5297
5401
|
"nativeModules",
|
|
5298
5402
|
"nativeViews",
|
|
5403
|
+
"nativeHybridObjects",
|
|
5299
5404
|
"env",
|
|
5300
5405
|
"network",
|
|
5301
5406
|
"settings",
|
|
5302
5407
|
"initialProps",
|
|
5303
5408
|
"initialState"
|
|
5304
|
-
].every((key) => value[key] === void 0 || isRecord(value[key])) && (value.packages === void 0 || isRecord(value.packages) && Object.values(value.packages).every(isPackageStubs)) && (value.nativeViews === void 0 || isRecord(value.nativeViews) && Object.values(value.nativeViews).every(
|
|
5409
|
+
].every((key) => value[key] === void 0 || isRecord(value[key])) && (value.packages === void 0 || isRecord(value.packages) && Object.values(value.packages).every(isPackageStubs)) && (value.nativeHybridObjects === void 0 || isHybridObjects(value.nativeHybridObjects)) && (value.nativeViews === void 0 || isRecord(value.nativeViews) && Object.values(value.nativeViews).every(
|
|
5305
5410
|
(entry) => entry === "noop" || isNativeViewSource(entry) || isRecord(entry) && typeof entry.file === "string" && entry.file.length > 0
|
|
5306
5411
|
));
|
|
5307
5412
|
}
|
|
@@ -5346,7 +5451,7 @@ function hasOwnKeys(value) {
|
|
|
5346
5451
|
}
|
|
5347
5452
|
function hasPeachConfig(config) {
|
|
5348
5453
|
if (!config) return false;
|
|
5349
|
-
return config.nativeRenderer !== void 0 || config.mapKit !== void 0 || typeof config.runtimeVersion === "string" && config.runtimeVersion.length > 0 || hasOwnKeys(config.modules) || hasOwnKeys(config.turboModules) || hasOwnKeys(config.nativeModules) || hasOwnKeys(config.nativeViews) || hasOwnKeys(config.env) || hasOwnKeys(config.network?.remap) || hasOwnKeys(config.settings) || hasOwnKeys(config.initialProps) || hasOwnKeys(config.initialState);
|
|
5454
|
+
return config.nativeRenderer !== void 0 || config.mapKit !== void 0 || typeof config.runtimeVersion === "string" && config.runtimeVersion.length > 0 || hasOwnKeys(config.modules) || hasOwnKeys(config.turboModules) || hasOwnKeys(config.nativeModules) || hasOwnKeys(config.nativeViews) || hasOwnKeys(config.nativeHybridObjects) || hasOwnKeys(config.env) || hasOwnKeys(config.network?.remap) || hasOwnKeys(config.settings) || hasOwnKeys(config.initialProps) || hasOwnKeys(config.initialState);
|
|
5350
5455
|
}
|
|
5351
5456
|
function mergePeachConfig(base, override) {
|
|
5352
5457
|
if (!hasPeachConfig(base) && !hasPeachConfig(override)) return void 0;
|
|
@@ -5363,6 +5468,10 @@ function mergePeachConfig(base, override) {
|
|
|
5363
5468
|
...override.nativeModules || {}
|
|
5364
5469
|
},
|
|
5365
5470
|
nativeViews: { ...base.nativeViews || {}, ...override.nativeViews || {} },
|
|
5471
|
+
nativeHybridObjects: {
|
|
5472
|
+
...base.nativeHybridObjects || {},
|
|
5473
|
+
...override.nativeHybridObjects || {}
|
|
5474
|
+
},
|
|
5366
5475
|
env: { ...base.env || {}, ...override.env || {} },
|
|
5367
5476
|
network: {
|
|
5368
5477
|
remap: { ...base.network?.remap || {}, ...override.network?.remap || {} }
|
|
@@ -5412,6 +5521,100 @@ var init_config = __esm({
|
|
|
5412
5521
|
}
|
|
5413
5522
|
});
|
|
5414
5523
|
|
|
5524
|
+
// src/nitro-source.ts
|
|
5525
|
+
function object(value) {
|
|
5526
|
+
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
5527
|
+
}
|
|
5528
|
+
function readJson(root, relative3) {
|
|
5529
|
+
return JSON.parse(
|
|
5530
|
+
readPackageFile(
|
|
5531
|
+
root,
|
|
5532
|
+
import_node_path17.default.join(root, relative3),
|
|
5533
|
+
MAX_SWIFT_COMPILE_SOURCE_BYTES
|
|
5534
|
+
).toString("utf8")
|
|
5535
|
+
);
|
|
5536
|
+
}
|
|
5537
|
+
function registrations(root) {
|
|
5538
|
+
const directory = import_node_path17.default.join(root, "nitrogen/generated/ios");
|
|
5539
|
+
const initializers = import_node_fs17.default.readdirSync(directory).filter((file) => file.endsWith("Autolinking.mm"));
|
|
5540
|
+
if (initializers.length !== 1)
|
|
5541
|
+
throw new Error(`${root}: expected one generated Nitro iOS initializer`);
|
|
5542
|
+
const source = readPackageFile(
|
|
5543
|
+
root,
|
|
5544
|
+
import_node_path17.default.join(directory, initializers[0]),
|
|
5545
|
+
MAX_SWIFT_COMPILE_SOURCE_BYTES
|
|
5546
|
+
).toString("utf8");
|
|
5547
|
+
const namespaces = [
|
|
5548
|
+
...source.matchAll(/\busing namespace (margelo::nitro(?:::[A-Za-z_]\w*)*)\s*;/g)
|
|
5549
|
+
];
|
|
5550
|
+
const namespace = namespaces[1]?.[1];
|
|
5551
|
+
if (namespaces.length !== 2 || namespaces[0]?.[1] !== "margelo::nitro" || !namespace)
|
|
5552
|
+
throw new Error(`${root}: invalid generated Nitro C++ namespace`);
|
|
5553
|
+
const classes = [];
|
|
5554
|
+
let swiftModule = null;
|
|
5555
|
+
for (const registration of source.matchAll(
|
|
5556
|
+
/\bHybridObjectRegistry::registerHybridObjectConstructor\(\s*("(?:[^"\\]|\\.)*")\s*,\s*\[\]\(\)\s*->\s*std::shared_ptr<HybridObject>\s*\{([\s\S]*?)\}\s*\);/g
|
|
5557
|
+
)) {
|
|
5558
|
+
const name2 = JSON.parse(registration[1]);
|
|
5559
|
+
const body = registration[2];
|
|
5560
|
+
if (typeof name2 !== "string" || name2.length === 0)
|
|
5561
|
+
throw new Error(`${root}: invalid generated Nitro registration name`);
|
|
5562
|
+
const cpp = /return\s+std::make_shared<([A-Za-z_]\w*)>\(\);/.exec(body);
|
|
5563
|
+
const swift = /=\s*([A-Za-z_]\w*)::([A-Za-z_]\w*)::create([A-Za-z_]\w*)\(\);\s*return hybridObject;/.exec(
|
|
5564
|
+
body
|
|
5565
|
+
);
|
|
5566
|
+
if (cpp && !swift) {
|
|
5567
|
+
classes.push({ name: name2, implementation: cpp[1], language: "c++" });
|
|
5568
|
+
} else if (swift && !cpp && swift[2] === `${swift[1]}Autolinking` && swift[3] === name2 && (swiftModule === null || swiftModule === swift[1])) {
|
|
5569
|
+
swiftModule = swift[1];
|
|
5570
|
+
classes.push({ name: name2, language: "swift" });
|
|
5571
|
+
} else {
|
|
5572
|
+
throw new Error(`${root}: unsupported generated Nitro iOS registration ${name2}`);
|
|
5573
|
+
}
|
|
5574
|
+
}
|
|
5575
|
+
const count = [
|
|
5576
|
+
...source.matchAll(/\bHybridObjectRegistry::registerHybridObjectConstructor\s*\(/g)
|
|
5577
|
+
].length;
|
|
5578
|
+
if (classes.length === 0 || classes.length !== count)
|
|
5579
|
+
throw new Error(`${root}: incomplete generated Nitro iOS registrations`);
|
|
5580
|
+
if (new Set(classes.map(({ name: name2 }) => name2)).size !== classes.length)
|
|
5581
|
+
throw new Error(`${root}: duplicate generated Nitro iOS registration`);
|
|
5582
|
+
classes.sort((a, b) => a.name.localeCompare(b.name));
|
|
5583
|
+
return { namespace, swiftModule, classes, views: viewNames(root, classes) };
|
|
5584
|
+
}
|
|
5585
|
+
function viewNames(root, classes) {
|
|
5586
|
+
const directory = import_node_path17.default.join(root, "nitrogen/generated/shared/json");
|
|
5587
|
+
if (!import_node_fs17.default.existsSync(directory)) return /* @__PURE__ */ new Set();
|
|
5588
|
+
const views = /* @__PURE__ */ new Set();
|
|
5589
|
+
for (const file of import_node_fs17.default.readdirSync(directory)) {
|
|
5590
|
+
if (!file.endsWith("Config.json")) continue;
|
|
5591
|
+
const config = readJson(root, import_node_path17.default.join("nitrogen/generated/shared/json", file));
|
|
5592
|
+
const name2 = object(config) ? config.uiViewClassName : void 0;
|
|
5593
|
+
if (typeof name2 === "string" && classes.some((entry) => entry.name === name2))
|
|
5594
|
+
views.add(name2);
|
|
5595
|
+
}
|
|
5596
|
+
return views;
|
|
5597
|
+
}
|
|
5598
|
+
function hasNitroIosInitializer(root) {
|
|
5599
|
+
const generated = import_node_path17.default.join(root, "nitrogen/generated/ios");
|
|
5600
|
+
return import_node_fs17.default.existsSync(generated) && import_node_fs17.default.readdirSync(generated).some((file) => file.endsWith("Autolinking.mm"));
|
|
5601
|
+
}
|
|
5602
|
+
function nitroRegisteredNames(root) {
|
|
5603
|
+
if (!hasNitroIosInitializer(root)) return null;
|
|
5604
|
+
const { classes, views } = registrations(root);
|
|
5605
|
+
return { names: classes.map(({ name: name2 }) => name2), views: [...views].sort() };
|
|
5606
|
+
}
|
|
5607
|
+
var import_node_fs17, import_node_path17;
|
|
5608
|
+
var init_nitro_source = __esm({
|
|
5609
|
+
"src/nitro-source.ts"() {
|
|
5610
|
+
"use strict";
|
|
5611
|
+
import_node_fs17 = __toESM(require("node:fs"), 1);
|
|
5612
|
+
import_node_path17 = __toESM(require("node:path"), 1);
|
|
5613
|
+
init_swift_source_file();
|
|
5614
|
+
init_swift_submit();
|
|
5615
|
+
}
|
|
5616
|
+
});
|
|
5617
|
+
|
|
5415
5618
|
// src/visit-parsed-program.ts
|
|
5416
5619
|
function visitParsedProgram(program, visitor) {
|
|
5417
5620
|
function visit3(value) {
|
|
@@ -5461,10 +5664,10 @@ function resolveAppStubs(appDir, config, configDir) {
|
|
|
5461
5664
|
const target = stubTarget ?? name2;
|
|
5462
5665
|
const field = installed.peach;
|
|
5463
5666
|
const versions = isRecord(field) ? field.versions : void 0;
|
|
5464
|
-
const stubs2 = isRecord(field) ? { modules: field.modules, views: field.views } : field;
|
|
5667
|
+
const stubs2 = isRecord(field) ? { modules: field.modules, views: field.views, hybridObjects: field.hybridObjects } : field;
|
|
5465
5668
|
if (!isPackageStubs(stubs2) || versions !== void 0 && typeof versions !== "string")
|
|
5466
5669
|
throw new Error(
|
|
5467
|
-
`${name2}'s package.json "peach" field must be "noop" or { versions?, modules?, views? } whose values are "noop" or file paths`
|
|
5670
|
+
`${name2}'s package.json "peach" field must be "noop" or { versions?, modules?, views?, hybridObjects? } whose values are "noop" or file paths ("unsupported" or a file path for hybridObjects, never "noop")`
|
|
5468
5671
|
);
|
|
5469
5672
|
const providerVersion = typeof installed.version === "string" ? installed.version : null;
|
|
5470
5673
|
const targetDir = stubTarget ? installedPackageDir(appDir, target) : dir;
|
|
@@ -5521,9 +5724,13 @@ function resolveAppStubs(appDir, config, configDir) {
|
|
|
5521
5724
|
sources.sort((a, b) => ORDER[a.origin] - ORDER[b.origin]);
|
|
5522
5725
|
const nativeModules = {};
|
|
5523
5726
|
const nativeViews = {};
|
|
5727
|
+
const nativeHybridObjects = {};
|
|
5524
5728
|
const applied = [];
|
|
5525
5729
|
for (const source of sources) {
|
|
5526
|
-
const { modules, views } = expandStubs(appDir, source);
|
|
5730
|
+
const { modules, views, hybridObjects } = expandStubs(appDir, source);
|
|
5731
|
+
assertRegisteredHybridObjects(appDir, source, hybridObjects);
|
|
5732
|
+
for (const [name2, answer] of Object.entries(hybridObjects))
|
|
5733
|
+
nativeHybridObjects[name2] = answer === "unsupported" ? answer : { file: (0, import_node_path18.resolve)(source.baseDir, answer) };
|
|
5527
5734
|
for (const [name2, stub] of Object.entries(modules))
|
|
5528
5735
|
nativeModules[name2] = lowerStub(stub, source.baseDir);
|
|
5529
5736
|
for (const [name2, stub] of Object.entries(views))
|
|
@@ -5546,13 +5753,22 @@ function resolveAppStubs(appDir, config, configDir) {
|
|
|
5546
5753
|
}
|
|
5547
5754
|
const stubs = { applied, skipped };
|
|
5548
5755
|
if (!config && applied.length === 0) return { config, stubs };
|
|
5549
|
-
const lowered = {
|
|
5756
|
+
const lowered = {
|
|
5757
|
+
...config,
|
|
5758
|
+
nativeModules,
|
|
5759
|
+
nativeViews,
|
|
5760
|
+
nativeHybridObjects
|
|
5761
|
+
};
|
|
5550
5762
|
delete lowered.packages;
|
|
5551
5763
|
return { config: lowered, stubs };
|
|
5552
5764
|
}
|
|
5553
5765
|
function expandStubs(appDir, source) {
|
|
5554
5766
|
if (source.stubs !== "noop")
|
|
5555
|
-
return {
|
|
5767
|
+
return {
|
|
5768
|
+
modules: source.stubs.modules ?? {},
|
|
5769
|
+
views: source.stubs.views ?? {},
|
|
5770
|
+
hybridObjects: source.stubs.hybridObjects ?? {}
|
|
5771
|
+
};
|
|
5556
5772
|
const dir = installedPackageDir(appDir, source.target);
|
|
5557
5773
|
if (!dir)
|
|
5558
5774
|
throw new Error(
|
|
@@ -5564,13 +5780,24 @@ function expandStubs(appDir, source) {
|
|
|
5564
5780
|
if (request.kind === "module") modules[request.name] = "noop";
|
|
5565
5781
|
else views[request.name] = "noop";
|
|
5566
5782
|
}
|
|
5567
|
-
return { modules, views };
|
|
5783
|
+
return { modules, views, hybridObjects: {} };
|
|
5784
|
+
}
|
|
5785
|
+
function assertRegisteredHybridObjects(appDir, source, hybridObjects) {
|
|
5786
|
+
const declared = Object.keys(hybridObjects);
|
|
5787
|
+
if (declared.length === 0) return;
|
|
5788
|
+
const dir = installedPackageDir(appDir, source.target);
|
|
5789
|
+
const registered = dir && nitroRegisteredNames(dir)?.names || [];
|
|
5790
|
+
for (const name2 of declared)
|
|
5791
|
+
if (!registered.includes(name2))
|
|
5792
|
+
throw new Error(
|
|
5793
|
+
`packages[${JSON.stringify(source.target)}].hybridObjects: ${source.target} does not register the Nitro HybridObject ${JSON.stringify(name2)} for iOS (registered: ${registered.join(", ") || "none"})`
|
|
5794
|
+
);
|
|
5568
5795
|
}
|
|
5569
5796
|
function lowerStub(stub, baseDir) {
|
|
5570
|
-
return stub === "noop" ? stub : { file: (0,
|
|
5797
|
+
return stub === "noop" ? stub : { file: (0, import_node_path18.resolve)(baseDir, stub) };
|
|
5571
5798
|
}
|
|
5572
5799
|
function readPackageJson(dir) {
|
|
5573
|
-
const text2 = readSmallFile((0,
|
|
5800
|
+
const text2 = readSmallFile((0, import_node_path18.join)(dir, "package.json"));
|
|
5574
5801
|
if (!text2) return null;
|
|
5575
5802
|
try {
|
|
5576
5803
|
const parsed = JSON.parse(text2);
|
|
@@ -5582,9 +5809,9 @@ function readPackageJson(dir) {
|
|
|
5582
5809
|
function installedPackageDir(appDir, name2) {
|
|
5583
5810
|
let current = appDir;
|
|
5584
5811
|
while (true) {
|
|
5585
|
-
const dir = (0,
|
|
5586
|
-
if ((0,
|
|
5587
|
-
const parent = (0,
|
|
5812
|
+
const dir = (0, import_node_path18.join)(current, "node_modules", name2);
|
|
5813
|
+
if ((0, import_node_fs18.existsSync)((0, import_node_path18.join)(dir, "package.json"))) return (0, import_node_fs18.realpathSync)(dir);
|
|
5814
|
+
const parent = (0, import_node_path18.dirname)(current);
|
|
5588
5815
|
if (parent === current) return null;
|
|
5589
5816
|
current = parent;
|
|
5590
5817
|
}
|
|
@@ -5676,7 +5903,7 @@ function mergeRequests(previous, next) {
|
|
|
5676
5903
|
function packageNativeRequests(dir) {
|
|
5677
5904
|
const found = /* @__PURE__ */ new Map();
|
|
5678
5905
|
const directories = scanRepository(dir).directories.filter((sub) => {
|
|
5679
|
-
const segments = (0,
|
|
5906
|
+
const segments = (0, import_node_path18.relative)(dir, sub).split("/");
|
|
5680
5907
|
return !NATIVE_SOURCE_DIRS.has(segments[0]) && !segments.some((segment) => PACKAGE_SKIP_DIRS.has(segment));
|
|
5681
5908
|
});
|
|
5682
5909
|
let files = 0;
|
|
@@ -5684,7 +5911,7 @@ function packageNativeRequests(dir) {
|
|
|
5684
5911
|
for (const name2 of listDir(sub)) {
|
|
5685
5912
|
if (!SOURCE_FILE.test(name2) || name2.endsWith(".d.ts") || files >= 2e3) continue;
|
|
5686
5913
|
files++;
|
|
5687
|
-
const file = (0,
|
|
5914
|
+
const file = (0, import_node_path18.join)(sub, name2);
|
|
5688
5915
|
const text2 = readSmallFile(file);
|
|
5689
5916
|
if (!text2) continue;
|
|
5690
5917
|
for (const { line: _line, ...request } of sourceNativeRequests(file, text2, true))
|
|
@@ -5803,27 +6030,27 @@ function wireSlotMigration(appDir, configPath, wire, kept = []) {
|
|
|
5803
6030
|
}
|
|
5804
6031
|
function listDir(dir) {
|
|
5805
6032
|
try {
|
|
5806
|
-
return (0,
|
|
6033
|
+
return (0, import_node_fs18.readdirSync)(dir);
|
|
5807
6034
|
} catch {
|
|
5808
6035
|
return [];
|
|
5809
6036
|
}
|
|
5810
6037
|
}
|
|
5811
6038
|
function readSmallFile(file) {
|
|
5812
6039
|
try {
|
|
5813
|
-
return (0,
|
|
6040
|
+
return (0, import_node_fs18.statSync)(file).size <= 1024 * 1024 ? (0, import_node_fs18.readFileSync)(file, "utf8") : null;
|
|
5814
6041
|
} catch {
|
|
5815
6042
|
return null;
|
|
5816
6043
|
}
|
|
5817
6044
|
}
|
|
5818
6045
|
function hasNativeCode(dir, platform) {
|
|
5819
|
-
const expoConfig = (0,
|
|
6046
|
+
const expoConfig = (0, import_node_path18.join)(dir, "expo-module.config.json");
|
|
5820
6047
|
const platforms = metadataValue(readProjectJson(expoConfig), "platforms");
|
|
5821
6048
|
if (Array.isArray(platforms))
|
|
5822
6049
|
return platforms.includes(platform) || platform === "ios" && platforms.includes("apple");
|
|
5823
|
-
if ([platform, "expo-module.config.json"].some((entry) => (0,
|
|
6050
|
+
if ([platform, "expo-module.config.json"].some((entry) => (0, import_node_fs18.existsSync)((0, import_node_path18.join)(dir, entry))))
|
|
5824
6051
|
return true;
|
|
5825
6052
|
if (listDir(dir).some((name2) => name2.endsWith(".podspec"))) return true;
|
|
5826
|
-
const manifest = readSmallFile((0,
|
|
6053
|
+
const manifest = readSmallFile((0, import_node_path18.join)(dir, "package.json"));
|
|
5827
6054
|
return manifest !== null && manifest.includes('"codegenConfig"');
|
|
5828
6055
|
}
|
|
5829
6056
|
function scanLocalNative(appDir, pkg, answered, platform, knownPackages = /* @__PURE__ */ new Set(), includeLegacy = false, providers) {
|
|
@@ -5836,7 +6063,7 @@ function scanLocalNative(appDir, pkg, answered, platform, knownPackages = /* @__
|
|
|
5836
6063
|
(excluded) => dir === excluded || dir.startsWith(`${excluded}/`)
|
|
5837
6064
|
))
|
|
5838
6065
|
continue;
|
|
5839
|
-
if ((0,
|
|
6066
|
+
if ((0, import_node_fs18.existsSync)((0, import_node_path18.join)(dir, "expo-module.config.json"))) {
|
|
5840
6067
|
if (platform && !hasNativeCode(dir, platform)) {
|
|
5841
6068
|
excludedModuleDirs.push(dir);
|
|
5842
6069
|
continue;
|
|
@@ -5845,7 +6072,7 @@ function scanLocalNative(appDir, pkg, answered, platform, knownPackages = /* @__
|
|
|
5845
6072
|
}
|
|
5846
6073
|
for (const name2 of listDir(dir)) {
|
|
5847
6074
|
if (SOURCE_FILE.test(name2) && !name2.endsWith(".d.ts"))
|
|
5848
|
-
sourceFiles.push((0,
|
|
6075
|
+
sourceFiles.push((0, import_node_path18.join)(dir, name2));
|
|
5849
6076
|
}
|
|
5850
6077
|
}
|
|
5851
6078
|
}
|
|
@@ -5855,7 +6082,7 @@ function scanLocalNative(appDir, pkg, answered, platform, knownPackages = /* @__
|
|
|
5855
6082
|
scanRepository(dir).directories.flatMap(
|
|
5856
6083
|
(sub) => listDir(sub).filter(
|
|
5857
6084
|
(name2) => NATIVE_SOURCE_FILE.test(name2) && (!platform || (platform === "ios" ? name2.endsWith(".swift") : name2.endsWith(".kt")))
|
|
5858
|
-
).map((name2) => (0,
|
|
6085
|
+
).map((name2) => (0, import_node_path18.join)(sub, name2))
|
|
5859
6086
|
)
|
|
5860
6087
|
])
|
|
5861
6088
|
);
|
|
@@ -5864,7 +6091,7 @@ function scanLocalNative(appDir, pkg, answered, platform, knownPackages = /* @__
|
|
|
5864
6091
|
const known = owners.get(dir);
|
|
5865
6092
|
if (known) return known;
|
|
5866
6093
|
const name2 = readPackageJson(dir)?.name;
|
|
5867
|
-
const parent = (0,
|
|
6094
|
+
const parent = (0, import_node_path18.dirname)(dir);
|
|
5868
6095
|
const result = typeof name2 === "string" ? name2 : parent === dir ? pkg.name ?? "app" : owner(parent);
|
|
5869
6096
|
owners.set(dir, result);
|
|
5870
6097
|
return result;
|
|
@@ -5878,18 +6105,18 @@ function scanLocalNative(appDir, pkg, answered, platform, knownPackages = /* @__
|
|
|
5878
6105
|
return;
|
|
5879
6106
|
}
|
|
5880
6107
|
providers ??= dependencyNativeOwners(appDir, pkg);
|
|
5881
|
-
const packageName = providers.get(key) ?? owner((0,
|
|
6108
|
+
const packageName = providers.get(key) ?? owner((0, import_node_path18.dirname)(file));
|
|
5882
6109
|
if (knownPackages.has(packageName)) return;
|
|
5883
6110
|
const moduleDir = expoModuleDirs.find((dir) => file.startsWith(`${dir}/`)) ?? null;
|
|
5884
6111
|
found.set(key, {
|
|
5885
6112
|
kind,
|
|
5886
6113
|
name: name2,
|
|
5887
6114
|
package: packageName,
|
|
5888
|
-
path: `${(0,
|
|
5889
|
-
expoModule: moduleDir ? (0,
|
|
6115
|
+
path: `${(0, import_node_path18.relative)(appDir, file)}:${line}`,
|
|
6116
|
+
expoModule: moduleDir ? (0, import_node_path18.relative)(appDir, moduleDir) || "." : null,
|
|
5890
6117
|
optional,
|
|
5891
6118
|
swift: moduleDir ? (nativeFilesByModule.get(moduleDir) ?? []).some(
|
|
5892
|
-
(
|
|
6119
|
+
(path21) => path21.endsWith(".swift") && [...(readSmallFile(path21) ?? "").matchAll(/\bName\(\s*"(\w+)"\s*\)/g)].some(
|
|
5893
6120
|
(match) => match[1] === name2
|
|
5894
6121
|
)
|
|
5895
6122
|
) : false,
|
|
@@ -5930,34 +6157,35 @@ function workspacePackageDirs(appDir, pkg) {
|
|
|
5930
6157
|
for (const name2 of Object.keys({ ...pkg.dependencies, ...pkg.devDependencies })) {
|
|
5931
6158
|
let current = appDir;
|
|
5932
6159
|
while (true) {
|
|
5933
|
-
const link = (0,
|
|
5934
|
-
if ((0,
|
|
5935
|
-
if ((0,
|
|
5936
|
-
const target = (0,
|
|
6160
|
+
const link = (0, import_node_path18.join)(current, "node_modules", name2);
|
|
6161
|
+
if ((0, import_node_fs18.existsSync)(link)) {
|
|
6162
|
+
if ((0, import_node_fs18.lstatSync)(link).isSymbolicLink()) {
|
|
6163
|
+
const target = (0, import_node_fs18.realpathSync)(link);
|
|
5937
6164
|
if (!target.split("/").includes("node_modules") && !target.startsWith(`${appDir}/`)) {
|
|
5938
6165
|
dirs.add(target);
|
|
5939
6166
|
}
|
|
5940
6167
|
}
|
|
5941
6168
|
break;
|
|
5942
6169
|
}
|
|
5943
|
-
const parent = (0,
|
|
6170
|
+
const parent = (0, import_node_path18.dirname)(current);
|
|
5944
6171
|
if (parent === current) break;
|
|
5945
6172
|
current = parent;
|
|
5946
6173
|
}
|
|
5947
6174
|
}
|
|
5948
6175
|
return [...dirs];
|
|
5949
6176
|
}
|
|
5950
|
-
var
|
|
6177
|
+
var import_node_fs18, import_node_path18, import_version_range, import_oxc_parser2, import_sucrase, SOURCE_FILE, NATIVE_LOOKUP, NATIVE_SOURCE_DIRS, PACKAGE_SKIP_DIRS, NATIVE_SOURCE_FILE;
|
|
5951
6178
|
var init_app_stubs = __esm({
|
|
5952
6179
|
"cli/app-stubs.ts"() {
|
|
5953
6180
|
"use strict";
|
|
5954
|
-
|
|
5955
|
-
|
|
6181
|
+
import_node_fs18 = require("node:fs");
|
|
6182
|
+
import_node_path18 = require("node:path");
|
|
5956
6183
|
import_version_range = require("@peach/compat/version-range");
|
|
5957
6184
|
import_oxc_parser2 = require("oxc-parser");
|
|
5958
6185
|
import_sucrase = require("sucrase");
|
|
5959
6186
|
init_config();
|
|
5960
6187
|
init_is_record();
|
|
6188
|
+
init_nitro_source();
|
|
5961
6189
|
init_public_brand();
|
|
5962
6190
|
init_visit_parsed_program();
|
|
5963
6191
|
init_detect();
|
|
@@ -5987,12 +6215,12 @@ function resolveFileEntries(entries, configDir) {
|
|
|
5987
6215
|
return Object.fromEntries(
|
|
5988
6216
|
Object.entries(entries).map(([name2, resolution]) => [
|
|
5989
6217
|
name2,
|
|
5990
|
-
resolution && typeof resolution === "object" && "file" in resolution && typeof resolution.file === "string" ? { ...resolution, file:
|
|
6218
|
+
resolution && typeof resolution === "object" && "file" in resolution && typeof resolution.file === "string" ? { ...resolution, file: import_node_path19.default.resolve(configDir, resolution.file) } : resolution
|
|
5991
6219
|
])
|
|
5992
6220
|
);
|
|
5993
6221
|
}
|
|
5994
6222
|
function resolveConfigReplacementFiles(config, configPath) {
|
|
5995
|
-
const configDir =
|
|
6223
|
+
const configDir = import_node_path19.default.dirname(configPath);
|
|
5996
6224
|
return {
|
|
5997
6225
|
...config,
|
|
5998
6226
|
modules: resolveFileEntries(config.modules, configDir)
|
|
@@ -6008,7 +6236,7 @@ async function loadRNXAppStubs(project) {
|
|
|
6008
6236
|
return resolveAppStubs(
|
|
6009
6237
|
project.appDir,
|
|
6010
6238
|
config,
|
|
6011
|
-
project.configPath ?
|
|
6239
|
+
project.configPath ? import_node_path19.default.dirname(project.configPath) : project.appDir
|
|
6012
6240
|
);
|
|
6013
6241
|
} catch (error) {
|
|
6014
6242
|
const message = error instanceof Error ? error.message : String(error);
|
|
@@ -6027,10 +6255,14 @@ async function loadConfigFile(project) {
|
|
|
6027
6255
|
[`${rnxPublicBrand.packageName}/config`]: config_exports
|
|
6028
6256
|
}
|
|
6029
6257
|
});
|
|
6030
|
-
const loaded3 = project.configPath.endsWith(".json") ? JSON.parse((0,
|
|
6258
|
+
const loaded3 = project.configPath.endsWith(".json") ? JSON.parse((0, import_node_fs19.readFileSync)(project.configPath, "utf8")) : await jiti.import(project.configPath, { default: true });
|
|
6031
6259
|
if (!isPeachConfig(loaded3)) {
|
|
6032
6260
|
throw new Error("the default export must be a peach config object");
|
|
6033
6261
|
}
|
|
6262
|
+
if (loaded3.nativeHybridObjects !== void 0)
|
|
6263
|
+
throw new Error(
|
|
6264
|
+
'nativeHybridObjects moved under packages, keyed by the package that registers each name: packages: { "<package>": { hybridObjects: { <Name>: "unsupported" | "./file.ts" } } }'
|
|
6265
|
+
);
|
|
6034
6266
|
const wire = WIRE_SLOTS.filter((slot) => loaded3[slot] !== void 0);
|
|
6035
6267
|
if (wire.length > 0) {
|
|
6036
6268
|
const slots = WIRE_SLOTS;
|
|
@@ -6059,12 +6291,12 @@ async function resolveRNXAppConfig(startDir = process.cwd()) {
|
|
|
6059
6291
|
const project = resolveAppProject(startDir);
|
|
6060
6292
|
return { project, ...await loadRNXAppStubs(project) };
|
|
6061
6293
|
}
|
|
6062
|
-
var
|
|
6294
|
+
var import_node_fs19, import_node_path19, import_jiti, WIRE_SLOTS;
|
|
6063
6295
|
var init_app_config = __esm({
|
|
6064
6296
|
"cli/app-config.ts"() {
|
|
6065
6297
|
"use strict";
|
|
6066
|
-
|
|
6067
|
-
|
|
6298
|
+
import_node_fs19 = require("node:fs");
|
|
6299
|
+
import_node_path19 = __toESM(require("node:path"), 1);
|
|
6068
6300
|
import_jiti = require("jiti");
|
|
6069
6301
|
init_config();
|
|
6070
6302
|
init_config();
|
|
@@ -6160,14 +6392,14 @@ async function produceConfiguredBundle(source, config, runtimePackages) {
|
|
|
6160
6392
|
const neededPackages = /* @__PURE__ */ new Set();
|
|
6161
6393
|
const factories = [];
|
|
6162
6394
|
const visit3 = (filePath) => {
|
|
6163
|
-
const real =
|
|
6395
|
+
const real = import_node_fs20.default.realpathSync(filePath);
|
|
6164
6396
|
const previous = files.get(real);
|
|
6165
6397
|
if (previous !== void 0) return previous;
|
|
6166
6398
|
const id = "peach-config-file:" + files.size;
|
|
6167
6399
|
files.set(real, id);
|
|
6168
6400
|
const compiled = compileReplacementModule({
|
|
6169
6401
|
filePath: real,
|
|
6170
|
-
source:
|
|
6402
|
+
source: import_node_fs20.default.readFileSync(real, "utf8"),
|
|
6171
6403
|
runtimePackages,
|
|
6172
6404
|
localModuleUrl: (specifier) => visit3(resolveReplacementModuleFile(real, specifier))
|
|
6173
6405
|
});
|
|
@@ -6180,12 +6412,18 @@ async function produceConfiguredBundle(source, config, runtimePackages) {
|
|
|
6180
6412
|
);
|
|
6181
6413
|
return id;
|
|
6182
6414
|
};
|
|
6183
|
-
for (const key of [
|
|
6415
|
+
for (const key of [
|
|
6416
|
+
"modules",
|
|
6417
|
+
"turboModules",
|
|
6418
|
+
"nativeModules",
|
|
6419
|
+
"nativeViews",
|
|
6420
|
+
"nativeHybridObjects"
|
|
6421
|
+
]) {
|
|
6184
6422
|
const entries = Reflect.get(packagedConfig, key);
|
|
6185
6423
|
if (!entries || typeof entries !== "object") continue;
|
|
6186
6424
|
for (const resolution of Object.values(entries)) {
|
|
6187
6425
|
if (resolution && typeof resolution === "object" && "file" in resolution && typeof resolution.file === "string") {
|
|
6188
|
-
resolution.file = visit3(
|
|
6426
|
+
resolution.file = visit3(import_node_path20.default.resolve(resolution.file));
|
|
6189
6427
|
}
|
|
6190
6428
|
}
|
|
6191
6429
|
}
|
|
@@ -6209,12 +6447,12 @@ async function produceConfiguredBundle(source, config, runtimePackages) {
|
|
|
6209
6447
|
const identityStart = findBundleFooter(source, "globalThis.__sootsimModulePaths=");
|
|
6210
6448
|
return prefix2 + (identityStart < 0 ? source + footer : source.slice(0, identityStart) + footer + source.slice(identityStart));
|
|
6211
6449
|
}
|
|
6212
|
-
var
|
|
6450
|
+
var import_node_fs20, import_node_path20, import_sucrase2, import_terser;
|
|
6213
6451
|
var init_configured_bundle_producer = __esm({
|
|
6214
6452
|
"src/configured-bundle-producer.ts"() {
|
|
6215
6453
|
"use strict";
|
|
6216
|
-
|
|
6217
|
-
|
|
6454
|
+
import_node_fs20 = __toESM(require("node:fs"), 1);
|
|
6455
|
+
import_node_path20 = __toESM(require("node:path"), 1);
|
|
6218
6456
|
import_sucrase2 = require("sucrase");
|
|
6219
6457
|
import_terser = require("terser");
|
|
6220
6458
|
init_dependencies();
|
|
@@ -10662,10 +10900,12 @@ function isRnxCaptureRegionAtlas(value) {
|
|
|
10662
10900
|
// src/vite-plugin-one.ts
|
|
10663
10901
|
var import_fs5 = __toESM(require("fs"), 1);
|
|
10664
10902
|
var import_node_crypto6 = require("node:crypto");
|
|
10903
|
+
var import_node_http = __toESM(require("node:http"), 1);
|
|
10904
|
+
var import_node_https = __toESM(require("node:https"), 1);
|
|
10665
10905
|
var import_node_url = require("node:url");
|
|
10666
10906
|
var import_path4 = __toESM(require("path"), 1);
|
|
10907
|
+
var import_promises3 = require("stream/promises");
|
|
10667
10908
|
var import_ws2 = require("ws");
|
|
10668
|
-
init_bundleGlobalFooter();
|
|
10669
10909
|
init_cli_runtime();
|
|
10670
10910
|
|
|
10671
10911
|
// src/dev-server-open.ts
|
|
@@ -10742,6 +10982,56 @@ function launchRnxDesktop(bundleUrl, appName) {
|
|
|
10742
10982
|
init_home_paths();
|
|
10743
10983
|
init_replacement_module_handler();
|
|
10744
10984
|
|
|
10985
|
+
// src/host/rolldown-bundle-forward.ts
|
|
10986
|
+
var import_stream = require("stream");
|
|
10987
|
+
var import_promises2 = require("stream/promises");
|
|
10988
|
+
init_cli_runtime();
|
|
10989
|
+
var ROLLDOWN_INVENTORY_HEADER = "x-peach-rolldown-inventory";
|
|
10990
|
+
async function forwardRolldownBundleResponse(upstream, res) {
|
|
10991
|
+
res.setHeader(ROLLDOWN_INVENTORY_HEADER, "1");
|
|
10992
|
+
if (upstream.headers[ROLLDOWN_INVENTORY_HEADER] === "1") {
|
|
10993
|
+
await (0, import_promises2.pipeline)(upstream, res);
|
|
10994
|
+
return;
|
|
10995
|
+
}
|
|
10996
|
+
const contentType = typeof upstream.headers["content-type"] === "string" ? upstream.headers["content-type"] : "";
|
|
10997
|
+
const inventory = getCliRuntime().rolldown_bundle_inventory;
|
|
10998
|
+
res.removeHeader("content-length");
|
|
10999
|
+
const annotate = async function* () {
|
|
11000
|
+
const decoder = new TextDecoder();
|
|
11001
|
+
let payload = "";
|
|
11002
|
+
let sent = 0;
|
|
11003
|
+
let bundleStarted = false;
|
|
11004
|
+
for await (const chunk of upstream) {
|
|
11005
|
+
payload += decoder.decode(chunk, { stream: true });
|
|
11006
|
+
if (bundleStarted) continue;
|
|
11007
|
+
const releasable = inventory.releasableMultipartPrefix(payload, contentType);
|
|
11008
|
+
bundleStarted = releasable.bundleStarted;
|
|
11009
|
+
if (releasable.length > sent) {
|
|
11010
|
+
yield Buffer.from(payload.slice(sent, releasable.length), "utf8");
|
|
11011
|
+
sent = releasable.length;
|
|
11012
|
+
}
|
|
11013
|
+
}
|
|
11014
|
+
payload += decoder.decode();
|
|
11015
|
+
let annotated;
|
|
11016
|
+
try {
|
|
11017
|
+
annotated = await inventory.attachRolldownBundleHttpPayload(payload, contentType);
|
|
11018
|
+
} catch (error) {
|
|
11019
|
+
const message = `could not attach the rolldown bundle inventory: ${error instanceof Error ? error.message : String(error)}`;
|
|
11020
|
+
console.error(`[peach] ${message}`);
|
|
11021
|
+
if (contentType.toLowerCase().includes("multipart/mixed")) {
|
|
11022
|
+
yield Buffer.from(inventory.multipartFailurePart(contentType, message), "utf8");
|
|
11023
|
+
return;
|
|
11024
|
+
}
|
|
11025
|
+
res.statusCode = 500;
|
|
11026
|
+
res.setHeader("content-type", "application/json");
|
|
11027
|
+
yield Buffer.from(JSON.stringify({ message }), "utf8");
|
|
11028
|
+
return;
|
|
11029
|
+
}
|
|
11030
|
+
yield Buffer.from(annotated.slice(sent), "utf8");
|
|
11031
|
+
};
|
|
11032
|
+
await (0, import_promises2.pipeline)(import_stream.Readable.from(annotate(), { objectMode: false }), res);
|
|
11033
|
+
}
|
|
11034
|
+
|
|
10745
11035
|
// src/installed-package-versions.ts
|
|
10746
11036
|
var import_fs4 = __toESM(require("fs"), 1);
|
|
10747
11037
|
var import_path3 = __toESM(require("path"), 1);
|
|
@@ -13768,66 +14058,9 @@ function isHomeWidgetFamily(value) {
|
|
|
13768
14058
|
return HOME_WIDGET_FAMILIES.some((family) => family === value);
|
|
13769
14059
|
}
|
|
13770
14060
|
|
|
13771
|
-
// src/swift-source-file.ts
|
|
13772
|
-
var import_node_fs10 = __toESM(require("node:fs"), 1);
|
|
13773
|
-
var import_node_path9 = __toESM(require("node:path"), 1);
|
|
13774
|
-
function readPackageFile(root, file, maxBytes) {
|
|
13775
|
-
const canonicalRoot = import_node_fs10.default.realpathSync(root);
|
|
13776
|
-
const relative3 = import_node_path9.default.relative(canonicalRoot, import_node_fs10.default.realpathSync(file));
|
|
13777
|
-
if (relative3 === ".." || relative3.startsWith(`..${import_node_path9.default.sep}`) || import_node_path9.default.isAbsolute(relative3)) {
|
|
13778
|
-
throw new Error(`swift input escapes the selected package: ${file}`);
|
|
13779
|
-
}
|
|
13780
|
-
let ancestor = import_node_path9.default.resolve(file);
|
|
13781
|
-
while (ancestor !== canonicalRoot) {
|
|
13782
|
-
if (import_node_fs10.default.lstatSync(ancestor).isSymbolicLink()) {
|
|
13783
|
-
throw new Error(`swift input is a symlink: ${ancestor}`);
|
|
13784
|
-
}
|
|
13785
|
-
const parent = import_node_path9.default.dirname(ancestor);
|
|
13786
|
-
if (parent === ancestor)
|
|
13787
|
-
throw new Error(`swift input escapes the selected package: ${file}`);
|
|
13788
|
-
ancestor = parent;
|
|
13789
|
-
}
|
|
13790
|
-
const expected = import_node_fs10.default.statSync(file);
|
|
13791
|
-
const fd = import_node_fs10.default.openSync(file, import_node_fs10.default.constants.O_RDONLY | import_node_fs10.default.constants.O_NOFOLLOW);
|
|
13792
|
-
try {
|
|
13793
|
-
const stat = import_node_fs10.default.fstatSync(fd);
|
|
13794
|
-
if (stat.dev !== expected.dev || stat.ino !== expected.ino) {
|
|
13795
|
-
throw new Error(`swift input changed while opening: ${file}`);
|
|
13796
|
-
}
|
|
13797
|
-
if (!stat.isFile() || stat.size > maxBytes) {
|
|
13798
|
-
throw new Error(`swift input exceeds ${maxBytes} bytes: ${file}`);
|
|
13799
|
-
}
|
|
13800
|
-
const bytes = Buffer.alloc(stat.size + 1);
|
|
13801
|
-
let offset = 0;
|
|
13802
|
-
while (offset < bytes.length) {
|
|
13803
|
-
const count = import_node_fs10.default.readSync(fd, bytes, offset, bytes.length - offset, null);
|
|
13804
|
-
if (count === 0) break;
|
|
13805
|
-
offset += count;
|
|
13806
|
-
}
|
|
13807
|
-
if (offset !== stat.size || import_node_fs10.default.fstatSync(fd).size !== stat.size) {
|
|
13808
|
-
throw new Error(`swift input changed while reading: ${file}`);
|
|
13809
|
-
}
|
|
13810
|
-
return bytes.subarray(0, offset);
|
|
13811
|
-
} finally {
|
|
13812
|
-
import_node_fs10.default.closeSync(fd);
|
|
13813
|
-
}
|
|
13814
|
-
}
|
|
13815
|
-
|
|
13816
|
-
// src/swift-submit.ts
|
|
13817
|
-
init_is_record();
|
|
13818
|
-
var SWIFT_PACKAGE_PATH = "/__peach/swift-package/";
|
|
13819
|
-
var SWIFT_HMR_PATH = "/__peach/swift-hmr";
|
|
13820
|
-
var DEFAULT_SWIFT_COMPILE_BUILD_MS = 10 * 6e4;
|
|
13821
|
-
var MAX_SWIFT_COMPILE_BUILD_MS = 60 * 6e4;
|
|
13822
|
-
var MAX_SWIFT_COMPILE_SOURCE_BYTES = 2 * 1024 * 1024;
|
|
13823
|
-
var MAX_SWIFT_COMPILE_RESOURCE_BYTES = 2 * 1024 * 1024;
|
|
13824
|
-
var MAX_SWIFT_COMPILE_RESOURCE_TOTAL_BYTES = 8 * 1024 * 1024;
|
|
13825
|
-
var MAX_SWIFT_COMPILE_METAL_BYTES = 2 * 1024 * 1024;
|
|
13826
|
-
var MAX_SWIFT_COMPILE_METAL_TOTAL_BYTES = 8 * 1024 * 1024;
|
|
13827
|
-
var MAX_SWIFT_COMPILE_IMAGE_BYTES = 4 * 1024 * 1024;
|
|
13828
|
-
var MAX_SWIFT_COMPILE_IMAGE_TOTAL_BYTES = 16 * 1024 * 1024;
|
|
13829
|
-
|
|
13830
14061
|
// src/one-widget-metadata.ts
|
|
14062
|
+
init_swift_source_file();
|
|
14063
|
+
init_swift_submit();
|
|
13831
14064
|
var run = (0, import_node_util.promisify)(import_node_child_process3.execFile);
|
|
13832
14065
|
var configs = /* @__PURE__ */ new Map();
|
|
13833
14066
|
var reads = /* @__PURE__ */ new Map();
|
|
@@ -13987,12 +14220,14 @@ async function configuredOneWidget(appRoot, bundleUrl) {
|
|
|
13987
14220
|
|
|
13988
14221
|
// src/vite-plugin-one.ts
|
|
13989
14222
|
init_runtime_assets();
|
|
14223
|
+
init_swift_submit();
|
|
13990
14224
|
function exposeHeader(res, name2) {
|
|
13991
14225
|
const exposed = res.getHeader("access-control-expose-headers");
|
|
13992
14226
|
const names = typeof exposed === "string" && exposed ? exposed.split(/,\s*/) : [];
|
|
13993
14227
|
if (!names.includes(name2))
|
|
13994
14228
|
res.setHeader("access-control-expose-headers", [...names, name2].join(", "));
|
|
13995
14229
|
}
|
|
14230
|
+
var BUNDLE_SOURCE_REQUEST_HEADER = "x-peach-bundle-source";
|
|
13996
14231
|
var SWIFT_ROUTE_PREFIX = "/__peach/swift";
|
|
13997
14232
|
var swiftHost;
|
|
13998
14233
|
var loadSwiftHost = () => swiftHost ??= import("peachsim/vite-swift");
|
|
@@ -14044,122 +14279,52 @@ function peachPlugin(options = {}) {
|
|
|
14044
14279
|
JSON.stringify(readInstalledNativePackageVersions(server.config.root))
|
|
14045
14280
|
);
|
|
14046
14281
|
exposeHeader(res, PACKAGE_VERSIONS_HEADER);
|
|
14047
|
-
|
|
14048
|
-
|
|
14049
|
-
|
|
14050
|
-
|
|
14051
|
-
const
|
|
14052
|
-
|
|
14053
|
-
|
|
14054
|
-
|
|
14055
|
-
|
|
14056
|
-
|
|
14057
|
-
|
|
14058
|
-
|
|
14059
|
-
|
|
14060
|
-
|
|
14061
|
-
|
|
14062
|
-
|
|
14282
|
+
if (req.method !== "GET" || req.headers[BUNDLE_SOURCE_REQUEST_HEADER]) {
|
|
14283
|
+
next();
|
|
14284
|
+
return;
|
|
14285
|
+
}
|
|
14286
|
+
const address = server.httpServer?.address();
|
|
14287
|
+
if (!address || typeof address !== "object") {
|
|
14288
|
+
next();
|
|
14289
|
+
return;
|
|
14290
|
+
}
|
|
14291
|
+
const loopback = address.address === "::" || address.address === "0.0.0.0" ? "127.0.0.1" : address.address;
|
|
14292
|
+
const authority = req.headers[":authority"];
|
|
14293
|
+
const options2 = {
|
|
14294
|
+
host: loopback,
|
|
14295
|
+
port: address.port,
|
|
14296
|
+
path: req.url,
|
|
14297
|
+
method: "GET",
|
|
14298
|
+
headers: {
|
|
14299
|
+
...Object.fromEntries(
|
|
14300
|
+
Object.entries(req.headers).filter(([key]) => !key.startsWith(":"))
|
|
14301
|
+
),
|
|
14302
|
+
host: req.headers.host ?? (typeof authority === "string" ? authority : void 0),
|
|
14303
|
+
"accept-encoding": "identity",
|
|
14304
|
+
[BUNDLE_SOURCE_REQUEST_HEADER]: "1"
|
|
14305
|
+
},
|
|
14306
|
+
rejectUnauthorized: false
|
|
14063
14307
|
};
|
|
14064
|
-
|
|
14065
|
-
res
|
|
14066
|
-
|
|
14067
|
-
|
|
14068
|
-
|
|
14069
|
-
|
|
14070
|
-
if (typeof statusMessage === "string") pendingMessage = statusMessage;
|
|
14071
|
-
const hdrs = typeof statusMessage === "object" && statusMessage !== null ? statusMessage : headers;
|
|
14072
|
-
if (hdrs && typeof hdrs === "object" && !Array.isArray(hdrs)) {
|
|
14073
|
-
for (const [key, value] of Object.entries(hdrs)) {
|
|
14074
|
-
if (key.toLowerCase() === "content-length") continue;
|
|
14075
|
-
if (typeof value === "string" || typeof value === "number" || Array.isArray(value)) {
|
|
14076
|
-
res.setHeader(key, value);
|
|
14077
|
-
}
|
|
14078
|
-
}
|
|
14308
|
+
const respond = (upstream) => {
|
|
14309
|
+
res.statusCode = upstream.statusCode ?? 502;
|
|
14310
|
+
for (const [key, value] of Object.entries(upstream.headers)) {
|
|
14311
|
+
const lowerKey = key.toLowerCase();
|
|
14312
|
+
if (value === void 0 || lowerKey === "connection" || lowerKey === "keep-alive" || lowerKey === "transfer-encoding") {
|
|
14313
|
+
continue;
|
|
14079
14314
|
}
|
|
14080
|
-
res.
|
|
14081
|
-
if (statusCode !== 200) res.removeHeader(ROLLDOWN_INVENTORY_HEADER);
|
|
14082
|
-
return res;
|
|
14315
|
+
res.setHeader(key, value);
|
|
14083
14316
|
}
|
|
14084
|
-
|
|
14085
|
-
|
|
14086
|
-
|
|
14087
|
-
|
|
14088
|
-
const toBuffer = (chunk, encoding) => {
|
|
14089
|
-
if (chunk === void 0 || chunk === null || typeof chunk === "function")
|
|
14090
|
-
return null;
|
|
14091
|
-
if (Buffer.isBuffer(chunk)) return chunk;
|
|
14092
|
-
if (chunk instanceof Uint8Array) return Buffer.from(chunk);
|
|
14093
|
-
if (typeof chunk === "string")
|
|
14094
|
-
return Buffer.from(chunk, isBufferEncoding(encoding) ? encoding : "utf8");
|
|
14095
|
-
return null;
|
|
14317
|
+
const forward = res.statusCode === 200 ? forwardRolldownBundleResponse(upstream, res) : (0, import_promises3.pipeline)(upstream, res);
|
|
14318
|
+
forward.catch(
|
|
14319
|
+
(error) => res.destroy(error instanceof Error ? error : new Error(String(error)))
|
|
14320
|
+
);
|
|
14096
14321
|
};
|
|
14097
|
-
|
|
14098
|
-
|
|
14099
|
-
|
|
14100
|
-
|
|
14101
|
-
return origWrite("");
|
|
14102
|
-
}
|
|
14103
|
-
if (!buffering) {
|
|
14104
|
-
const lower = buf.toString("utf8").toLowerCase();
|
|
14105
|
-
const contentType = String(res.getHeader("content-type") ?? "").toLowerCase();
|
|
14106
|
-
if (!contentType.includes("multipart/mixed") || lower.includes("content-type: text/javascript") || lower.includes("content-type: application/javascript")) {
|
|
14107
|
-
buffering = true;
|
|
14108
|
-
}
|
|
14109
|
-
}
|
|
14110
|
-
if (buffering) {
|
|
14111
|
-
chunks.push(buf);
|
|
14112
|
-
return true;
|
|
14113
|
-
}
|
|
14114
|
-
flushHead();
|
|
14115
|
-
return origWrite(buf);
|
|
14322
|
+
const upstreamReq = server.config.server.https ? import_node_https.default.request(options2, respond) : import_node_http.default.request(options2, respond);
|
|
14323
|
+
upstreamReq.once("error", next);
|
|
14324
|
+
req.once("close", () => {
|
|
14325
|
+
if (!res.writableFinished) upstreamReq.destroy();
|
|
14116
14326
|
});
|
|
14117
|
-
|
|
14118
|
-
res,
|
|
14119
|
-
"end",
|
|
14120
|
-
function(chunk, arg1, arg2) {
|
|
14121
|
-
const callback = typeof chunk === "function" ? chunk : typeof arg1 === "function" ? arg1 : typeof arg2 === "function" ? arg2 : void 0;
|
|
14122
|
-
const finish = () => {
|
|
14123
|
-
flushHead();
|
|
14124
|
-
if (typeof callback === "function") {
|
|
14125
|
-
return origEnd(() => {
|
|
14126
|
-
Reflect.apply(callback, res, []);
|
|
14127
|
-
});
|
|
14128
|
-
}
|
|
14129
|
-
return origEnd();
|
|
14130
|
-
};
|
|
14131
|
-
const buf = toBuffer(chunk, arg1);
|
|
14132
|
-
if (buf) chunks.push(buf);
|
|
14133
|
-
if (chunks.length === 0 || res.statusCode && res.statusCode !== 200) {
|
|
14134
|
-
if (!res.headersSent) res.removeHeader(ROLLDOWN_INVENTORY_HEADER);
|
|
14135
|
-
flushHead();
|
|
14136
|
-
for (const queued of chunks) origWrite(queued);
|
|
14137
|
-
return finish();
|
|
14138
|
-
}
|
|
14139
|
-
const payload = Buffer.concat(chunks).toString("utf8");
|
|
14140
|
-
const contentType = String(res.getHeader("content-type") ?? "");
|
|
14141
|
-
void getCliRuntime().rolldown_bundle_inventory.attachRolldownBundleHttpPayload(
|
|
14142
|
-
payload,
|
|
14143
|
-
contentType
|
|
14144
|
-
).then((annotated) => {
|
|
14145
|
-
if (!res.headersSent) res.removeHeader("content-length");
|
|
14146
|
-
flushHead();
|
|
14147
|
-
origWrite(Buffer.from(annotated, "utf8"));
|
|
14148
|
-
finish();
|
|
14149
|
-
}).catch((error) => {
|
|
14150
|
-
console.error("[peach] failed to attach rolldown bundle inventory", error);
|
|
14151
|
-
if (!res.headersSent) {
|
|
14152
|
-
res.removeHeader("content-length");
|
|
14153
|
-
res.removeHeader(ROLLDOWN_INVENTORY_HEADER);
|
|
14154
|
-
}
|
|
14155
|
-
flushHead();
|
|
14156
|
-
origWrite(Buffer.from(payload, "utf8"));
|
|
14157
|
-
finish();
|
|
14158
|
-
});
|
|
14159
|
-
return res;
|
|
14160
|
-
}
|
|
14161
|
-
);
|
|
14162
|
-
next();
|
|
14327
|
+
upstreamReq.end();
|
|
14163
14328
|
});
|
|
14164
14329
|
const bundleLayer = server.middlewares.stack.pop();
|
|
14165
14330
|
if (bundleLayer) server.middlewares.stack.unshift(bundleLayer);
|
|
@@ -14261,8 +14426,11 @@ function peachPlugin(options = {}) {
|
|
|
14261
14426
|
if (!pathname.startsWith(KOTLIN_ROUTE_PREFIX)) return next();
|
|
14262
14427
|
loadKotlinHost().then(async (host) => {
|
|
14263
14428
|
if (!kotlinModuleRoot) {
|
|
14264
|
-
|
|
14265
|
-
|
|
14429
|
+
const root = host.peachKotlinModuleRoot();
|
|
14430
|
+
kotlinModuleRoot = root;
|
|
14431
|
+
server.watcher.add(
|
|
14432
|
+
["sdk.tar.gz", "toolchain.json"].map((file) => import_path4.default.join(root, file))
|
|
14433
|
+
);
|
|
14266
14434
|
}
|
|
14267
14435
|
const served = await host.serveKotlinRequest(pathname, res, {
|
|
14268
14436
|
root: server.config.root,
|
|
@@ -14742,6 +14910,7 @@ init_bundleGlobalFooter();
|
|
|
14742
14910
|
init_is_record();
|
|
14743
14911
|
|
|
14744
14912
|
// src/nativeAppIconContract.ts
|
|
14913
|
+
init_assetCatalogContract();
|
|
14745
14914
|
init_is_record();
|
|
14746
14915
|
function resolveNativeAppIconArtwork(resources, readText, resourceUri, icons, primaryName, alternateNames, resolveReference) {
|
|
14747
14916
|
const members = new Set(resources);
|
|
@@ -15132,10 +15301,10 @@ function appTargetReleaseSettings(pbxproj, targetName, infoPlistRelativePath) {
|
|
|
15132
15301
|
var APP_DELEGATE_PATH_RE = /(?:^|\/)ios\/([^/]+)\/AppDelegate\.(?:swift|mm|m)$/;
|
|
15133
15302
|
function nativeAppIdentityFromIos(files, parseInfoPlist, iosTarget, resourceUri) {
|
|
15134
15303
|
const pbxprojPath = Object.keys(files).find(
|
|
15135
|
-
(
|
|
15304
|
+
(path21) => /(?:^|\/)ios\/[^/]+\.xcodeproj\/project\.pbxproj$/.test(path21)
|
|
15136
15305
|
) ?? Object.keys(files).find(
|
|
15137
|
-
(
|
|
15138
|
-
) ?? Object.keys(files).find((
|
|
15306
|
+
(path21) => /(?:^|\/)[^/]+\.xcodeproj\/project\.pbxproj$/.test(path21)
|
|
15307
|
+
) ?? Object.keys(files).find((path21) => /(?:^|\/)project\.pbxproj$/.test(path21));
|
|
15139
15308
|
if (!pbxprojPath) return null;
|
|
15140
15309
|
const pbxproj = files[pbxprojPath];
|
|
15141
15310
|
let objects = {};
|
|
@@ -15177,7 +15346,7 @@ function nativeAppIdentityFromIos(files, parseInfoPlist, iosTarget, resourceUri)
|
|
|
15177
15346
|
} else if (applicationTargetNames.size === 1) {
|
|
15178
15347
|
targetName = [...applicationTargetNames][0];
|
|
15179
15348
|
} else if (applicationTargetNames.size > 1) {
|
|
15180
|
-
const delegateTargets = Object.keys(files).filter((
|
|
15349
|
+
const delegateTargets = Object.keys(files).filter((path21) => !path21.includes("/Pods/")).map((path21) => path21.match(APP_DELEGATE_PATH_RE)?.[1]).filter(
|
|
15181
15350
|
(name2) => typeof name2 === "string" && applicationTargetNames.has(name2)
|
|
15182
15351
|
);
|
|
15183
15352
|
if (delegateTargets.length === 1) {
|
|
@@ -15386,7 +15555,7 @@ function nativeAppIdentityFromIos(files, parseInfoPlist, iosTarget, resourceUri)
|
|
|
15386
15555
|
return `${base.startsWith("/") ? "/" : ""}${segments.join("/")}`;
|
|
15387
15556
|
};
|
|
15388
15557
|
const project = Object.values(objects).find(
|
|
15389
|
-
(
|
|
15558
|
+
(object2) => isRecord(object2) && object2.isa === "PBXProject"
|
|
15390
15559
|
);
|
|
15391
15560
|
const projectDir = join6(
|
|
15392
15561
|
pbxprojPath.replace(/(?:^|\/)[^/]+\.xcodeproj\/project\.pbxproj$/, ""),
|
|
@@ -15401,7 +15570,7 @@ function nativeAppIdentityFromIos(files, parseInfoPlist, iosTarget, resourceUri)
|
|
|
15401
15570
|
if (Object.hasOwn(files, file)) return [file];
|
|
15402
15571
|
const prefix2 = file === "" ? "" : `${file.replace(/\/$/, "")}/`;
|
|
15403
15572
|
return paths.filter(
|
|
15404
|
-
(
|
|
15573
|
+
(path21) => path21.startsWith(prefix2) && !/(?:^|\/)\./.test(path21.slice(prefix2.length))
|
|
15405
15574
|
);
|
|
15406
15575
|
},
|
|
15407
15576
|
join6,
|
|
@@ -15412,7 +15581,7 @@ function nativeAppIdentityFromIos(files, parseInfoPlist, iosTarget, resourceUri)
|
|
|
15412
15581
|
}
|
|
15413
15582
|
const rootModuleName = readRootModuleName(
|
|
15414
15583
|
Object.entries(files).filter(
|
|
15415
|
-
([
|
|
15584
|
+
([path21]) => !path21.includes("/Pods/") && (/(?:^|\/)ios\/AppDelegate\.(?:swift|mm|m)$/.test(path21) || path21.match(APP_DELEGATE_PATH_RE)?.[1] === targetName)
|
|
15416
15585
|
).map(([, source]) => source)
|
|
15417
15586
|
);
|
|
15418
15587
|
return {
|
|
@@ -15850,6 +16019,11 @@ function isJsonObject(value) {
|
|
|
15850
16019
|
|
|
15851
16020
|
// src/xcode-project.ts
|
|
15852
16021
|
var APPLICATION = "com.apple.product-type.application";
|
|
16022
|
+
var FRAMEWORK_PRODUCTS = /* @__PURE__ */ new Set([
|
|
16023
|
+
"com.apple.product-type.framework",
|
|
16024
|
+
"com.apple.product-type.framework.static"
|
|
16025
|
+
]);
|
|
16026
|
+
var HEADER_FILE = /\.(h|hh|hpp|hxx|pch)$/;
|
|
15853
16027
|
var MODULE_PRODUCTS = /* @__PURE__ */ new Set([
|
|
15854
16028
|
"com.apple.product-type.framework",
|
|
15855
16029
|
"com.apple.product-type.framework.static",
|
|
@@ -15982,11 +16156,11 @@ function loadProject(xcodeproj) {
|
|
|
15982
16156
|
throw new Error(`${projectFile} has no objects table`);
|
|
15983
16157
|
}
|
|
15984
16158
|
const objects = root.objects;
|
|
15985
|
-
const
|
|
16159
|
+
const object2 = (id) => {
|
|
15986
16160
|
const found = id === void 0 ? void 0 : objects[id];
|
|
15987
16161
|
return isDict(found) ? found : void 0;
|
|
15988
16162
|
};
|
|
15989
|
-
const project =
|
|
16163
|
+
const project = object2(str(root.rootObject));
|
|
15990
16164
|
if (!project || project.isa !== "PBXProject") {
|
|
15991
16165
|
throw new Error(`${projectFile} has no PBXProject root`);
|
|
15992
16166
|
}
|
|
@@ -16000,7 +16174,7 @@ function loadProject(xcodeproj) {
|
|
|
16000
16174
|
objects,
|
|
16001
16175
|
project,
|
|
16002
16176
|
projectDir,
|
|
16003
|
-
object,
|
|
16177
|
+
object: object2,
|
|
16004
16178
|
resolvePath
|
|
16005
16179
|
};
|
|
16006
16180
|
loaded2.set(projectFile, { mtimeMs, project: result });
|
|
@@ -16013,7 +16187,7 @@ function defaultConfiguration(project) {
|
|
|
16013
16187
|
);
|
|
16014
16188
|
return names.includes("Debug") ? "Debug" : str(configList?.defaultConfigurationName) ?? names[0] ?? "Debug";
|
|
16015
16189
|
}
|
|
16016
|
-
function targetSettings(ref, configuration, builtins, options = {}) {
|
|
16190
|
+
function targetSettings(ref, configuration, builtins, options = {}, overrides = {}) {
|
|
16017
16191
|
const { project, target } = ref;
|
|
16018
16192
|
const xcconfigs = [];
|
|
16019
16193
|
const level = (listId) => {
|
|
@@ -16050,7 +16224,8 @@ function targetSettings(ref, configuration, builtins, options = {}) {
|
|
|
16050
16224
|
const levels = [
|
|
16051
16225
|
{ ...builtins, CONFIGURATION: configuration },
|
|
16052
16226
|
...level(str(project.project.buildConfigurationList)),
|
|
16053
|
-
...level(str(target.buildConfigurationList))
|
|
16227
|
+
...level(str(target.buildConfigurationList)),
|
|
16228
|
+
overrides
|
|
16054
16229
|
];
|
|
16055
16230
|
const resolving2 = /* @__PURE__ */ new Set();
|
|
16056
16231
|
const valueAt = (key, top) => {
|
|
@@ -16343,14 +16518,51 @@ function commonAncestor(dirs) {
|
|
|
16343
16518
|
}
|
|
16344
16519
|
return common;
|
|
16345
16520
|
}
|
|
16346
|
-
|
|
16521
|
+
var isPodsProject = (xcodeproj) => import_node_path14.default.basename(xcodeproj) === "Pods.xcodeproj" && import_node_path14.default.basename(import_node_path14.default.dirname(xcodeproj)) === "Pods";
|
|
16522
|
+
function installedPodsSandbox(pods) {
|
|
16523
|
+
const podfileLock = import_node_path14.default.join(import_node_path14.default.dirname(pods), "Podfile.lock");
|
|
16524
|
+
const manifestLock = import_node_path14.default.join(pods, "Manifest.lock");
|
|
16525
|
+
if (!import_node_fs14.default.existsSync(podfileLock))
|
|
16526
|
+
throw new Error(
|
|
16527
|
+
`${pods} has no ${podfileLock}: run \`pod install\` in ${import_node_path14.default.dirname(pods)}`
|
|
16528
|
+
);
|
|
16529
|
+
if (!import_node_fs14.default.existsSync(manifestLock) || !import_node_fs14.default.readFileSync(manifestLock).equals(import_node_fs14.default.readFileSync(podfileLock)))
|
|
16530
|
+
throw new Error(
|
|
16531
|
+
`The sandbox is not in sync with the Podfile.lock: ${manifestLock} differs from ${podfileLock}. Run \`pod install\` in ${import_node_path14.default.dirname(pods)}`
|
|
16532
|
+
);
|
|
16533
|
+
const specChecksums = {};
|
|
16534
|
+
const lines = import_node_fs14.default.readFileSync(manifestLock, "utf8").split("\n");
|
|
16535
|
+
const start = lines.indexOf("SPEC CHECKSUMS:");
|
|
16536
|
+
for (const line of start === -1 ? [] : lines.slice(start + 1)) {
|
|
16537
|
+
const entry = /^ {2}"?([^":]+)"?: ([0-9a-f]+)$/.exec(line);
|
|
16538
|
+
if (!entry) break;
|
|
16539
|
+
specChecksums[entry[1]] = entry[2];
|
|
16540
|
+
}
|
|
16541
|
+
const specs = import_node_path14.default.join(pods, "Local Podspecs");
|
|
16542
|
+
return {
|
|
16543
|
+
podfileLock,
|
|
16544
|
+
manifestLock,
|
|
16545
|
+
specChecksums,
|
|
16546
|
+
localPodspecs: isDirectory(specs) ? import_node_fs14.default.readdirSync(specs).filter((name2) => name2.endsWith(".podspec.json")).sort().map((name2) => import_node_path14.default.join(specs, name2)) : []
|
|
16547
|
+
};
|
|
16548
|
+
}
|
|
16549
|
+
function workspaceProjects(xcodeprojOrWorkspace, installedPods = false) {
|
|
16347
16550
|
const listed = xcodeprojOrWorkspace.endsWith(".xcworkspace") ? workspaceReferences(xcodeprojOrWorkspace) : [xcodeprojOrWorkspace];
|
|
16348
16551
|
const projects = [];
|
|
16349
16552
|
const projectAt = /* @__PURE__ */ new Map();
|
|
16553
|
+
let cocoapods = null;
|
|
16350
16554
|
const addProject = (xcodeproj) => {
|
|
16351
|
-
if (!xcodeProjectFile(xcodeproj))
|
|
16555
|
+
if (!xcodeProjectFile(xcodeproj)) {
|
|
16556
|
+
if (installedPods && isPodsProject(xcodeproj))
|
|
16557
|
+
throw new Error(
|
|
16558
|
+
`${import_node_path14.default.basename(xcodeprojOrWorkspace)} builds ${xcodeproj}, which is not installed: run \`pod install\` in ${import_node_path14.default.dirname(import_node_path14.default.dirname(xcodeproj))}`
|
|
16559
|
+
);
|
|
16560
|
+
return;
|
|
16561
|
+
}
|
|
16352
16562
|
const key = import_node_fs14.default.realpathSync(xcodeproj);
|
|
16353
|
-
if (projectAt.has(key) || key.split(import_node_path14.default.sep).includes("Pods"))
|
|
16563
|
+
if (projectAt.has(key) || !installedPods && key.split(import_node_path14.default.sep).includes("Pods"))
|
|
16564
|
+
return;
|
|
16565
|
+
if (isPodsProject(key)) cocoapods = installedPodsSandbox(import_node_path14.default.dirname(key));
|
|
16354
16566
|
const project = loadProject(key);
|
|
16355
16567
|
projectAt.set(key, project);
|
|
16356
16568
|
projects.push(project);
|
|
@@ -16368,7 +16580,12 @@ function workspaceProjects(xcodeprojOrWorkspace) {
|
|
|
16368
16580
|
if (projects.length === 0) {
|
|
16369
16581
|
throw new Error(`${import_node_path14.default.basename(xcodeprojOrWorkspace)} lists no Xcode project`);
|
|
16370
16582
|
}
|
|
16371
|
-
|
|
16583
|
+
const podfile = import_node_path14.default.join(import_node_path14.default.dirname(xcodeprojOrWorkspace), "Podfile");
|
|
16584
|
+
if (installedPods && !cocoapods && import_node_fs14.default.existsSync(podfile))
|
|
16585
|
+
throw new Error(
|
|
16586
|
+
`${podfile} is not installed into ${import_node_path14.default.basename(xcodeprojOrWorkspace)}: run \`pod install\` in ${import_node_path14.default.dirname(podfile)} and open the workspace it writes`
|
|
16587
|
+
);
|
|
16588
|
+
return { listed, projects, projectAt, cocoapods };
|
|
16372
16589
|
}
|
|
16373
16590
|
var targetRefs = /* @__PURE__ */ new WeakMap();
|
|
16374
16591
|
function nativeTargets(project) {
|
|
@@ -16404,7 +16621,10 @@ function listXcodeAppTargets(xcodeprojOrWorkspace, options = {}) {
|
|
|
16404
16621
|
function readXcodeAppTarget(input, targetName, configurationName, options = {}) {
|
|
16405
16622
|
const xcodeprojOrWorkspace = import_node_fs14.default.realpathSync(input);
|
|
16406
16623
|
const workspace = xcodeprojOrWorkspace.endsWith(".xcworkspace") ? xcodeprojOrWorkspace : null;
|
|
16407
|
-
const { listed, projects, projectAt } = workspaceProjects(
|
|
16624
|
+
const { listed, projects, projectAt, cocoapods } = workspaceProjects(
|
|
16625
|
+
xcodeprojOrWorkspace,
|
|
16626
|
+
options.installedPods
|
|
16627
|
+
);
|
|
16408
16628
|
const allTargets = projects.flatMap(nativeTargets);
|
|
16409
16629
|
const appTargets = allTargets.filter((ref) => isIosAppTarget(ref, options));
|
|
16410
16630
|
const appTargetNames = appTargets.map((ref) => str(ref.target.name) ?? ref.id);
|
|
@@ -16467,7 +16687,61 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
16467
16687
|
order.push(ref);
|
|
16468
16688
|
};
|
|
16469
16689
|
visit3(app);
|
|
16690
|
+
const headerPhase = (ref) => list(ref.target.buildPhases).flatMap((phaseId) => {
|
|
16691
|
+
const phase = ref.project.object(phaseId);
|
|
16692
|
+
if (phase?.isa !== "PBXHeadersBuildPhase") return [];
|
|
16693
|
+
return list(phase.files).flatMap((id) => {
|
|
16694
|
+
const file = ref.project.object(id);
|
|
16695
|
+
const resolved = ref.project.resolvePath(str(file?.fileRef) ?? "");
|
|
16696
|
+
const attributes = isDict(file?.settings) ? list(file.settings.ATTRIBUTES) : [];
|
|
16697
|
+
if (!resolved) return [];
|
|
16698
|
+
return [
|
|
16699
|
+
{
|
|
16700
|
+
file: resolved,
|
|
16701
|
+
visibility: attributes.includes("Public") ? "Public" : attributes.includes("Private") ? "Private" : "Project"
|
|
16702
|
+
}
|
|
16703
|
+
];
|
|
16704
|
+
});
|
|
16705
|
+
});
|
|
16706
|
+
const productName = (ref) => targetSettings(
|
|
16707
|
+
ref,
|
|
16708
|
+
configuration,
|
|
16709
|
+
{ TARGET_NAME: str(ref.target.name) ?? ref.id },
|
|
16710
|
+
options
|
|
16711
|
+
).get("PRODUCT_NAME");
|
|
16712
|
+
const projectHeaderMaps = /* @__PURE__ */ new Map();
|
|
16713
|
+
const projectHeaderMap = (project) => {
|
|
16714
|
+
const cached2 = projectHeaderMaps.get(project);
|
|
16715
|
+
if (cached2) return cached2;
|
|
16716
|
+
const entries = /* @__PURE__ */ new Map();
|
|
16717
|
+
for (const ref of nativeTargets(project)) {
|
|
16718
|
+
const framework = FRAMEWORK_PRODUCTS.has(str(ref.target.productType) ?? "");
|
|
16719
|
+
const product = framework ? productName(ref) : "";
|
|
16720
|
+
for (const { file, visibility } of headerPhase(ref)) {
|
|
16721
|
+
const name2 = import_node_path14.default.basename(file);
|
|
16722
|
+
if (!entries.has(name2))
|
|
16723
|
+
entries.set(
|
|
16724
|
+
name2,
|
|
16725
|
+
framework && visibility !== "Project" ? `${product}/${name2}` : file
|
|
16726
|
+
);
|
|
16727
|
+
}
|
|
16728
|
+
}
|
|
16729
|
+
for (const id of Object.keys(project.objects)) {
|
|
16730
|
+
if (project.object(id)?.isa !== "PBXFileReference") continue;
|
|
16731
|
+
const file = project.resolvePath(id);
|
|
16732
|
+
if (file && HEADER_FILE.test(file) && !entries.has(import_node_path14.default.basename(file)))
|
|
16733
|
+
entries.set(import_node_path14.default.basename(file), file);
|
|
16734
|
+
}
|
|
16735
|
+
const map2 = [...entries];
|
|
16736
|
+
projectHeaderMaps.set(project, map2);
|
|
16737
|
+
return map2;
|
|
16738
|
+
};
|
|
16470
16739
|
const xcconfigs = /* @__PURE__ */ new Set();
|
|
16740
|
+
const buildDir = (project) => import_node_path14.default.join(project.projectDir, ".build/peach-xcode/Build");
|
|
16741
|
+
const podsBuild = {
|
|
16742
|
+
SYMROOT: import_node_path14.default.join(buildDir(app.project), "Products"),
|
|
16743
|
+
OBJROOT: import_node_path14.default.join(buildDir(app.project), "Intermediates.noindex")
|
|
16744
|
+
};
|
|
16471
16745
|
const moduleTarget = (ref) => {
|
|
16472
16746
|
const name2 = str(ref.target.name) ?? ref.id;
|
|
16473
16747
|
const {
|
|
@@ -16483,12 +16757,9 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
16483
16757
|
SRCROOT: ref.project.projectDir,
|
|
16484
16758
|
SOURCE_ROOT: ref.project.projectDir,
|
|
16485
16759
|
PROJECT_DIR: ref.project.projectDir,
|
|
16486
|
-
SYMROOT: import_node_path14.default.join(ref.project
|
|
16760
|
+
SYMROOT: import_node_path14.default.join(buildDir(ref.project), "Products"),
|
|
16487
16761
|
BUILD_DIR: "$(SYMROOT)",
|
|
16488
|
-
OBJROOT: import_node_path14.default.join(
|
|
16489
|
-
ref.project.projectDir,
|
|
16490
|
-
".build/peach-xcode/Build/Intermediates.noindex"
|
|
16491
|
-
),
|
|
16762
|
+
OBJROOT: import_node_path14.default.join(buildDir(ref.project), "Intermediates.noindex"),
|
|
16492
16763
|
CONFIGURATION_BUILD_DIR: "$(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)",
|
|
16493
16764
|
BUILT_PRODUCTS_DIR: "$(CONFIGURATION_BUILD_DIR)",
|
|
16494
16765
|
TARGET_BUILD_DIR: "$(CONFIGURATION_BUILD_DIR)",
|
|
@@ -16504,7 +16775,8 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
16504
16775
|
ACTION: "build",
|
|
16505
16776
|
DEVELOPMENT_LANGUAGE: str(ref.project.project.developmentRegion) ?? "en"
|
|
16506
16777
|
},
|
|
16507
|
-
options
|
|
16778
|
+
options,
|
|
16779
|
+
isPodsProject(ref.project.xcodeproj) ? podsBuild : {}
|
|
16508
16780
|
);
|
|
16509
16781
|
for (const file of read) xcconfigs.add(file);
|
|
16510
16782
|
const swiftVersion = Number.parseFloat(settings2("SWIFT_VERSION") || "5");
|
|
@@ -16514,6 +16786,20 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
16514
16786
|
(file) => /\.(c|cc|cpp|cxx|m|mm)$/.test(file)
|
|
16515
16787
|
);
|
|
16516
16788
|
const absolute = (file) => import_node_path14.default.resolve(ref.project.projectDir, file);
|
|
16789
|
+
const framework = FRAMEWORK_PRODUCTS.has(str(ref.target.productType) ?? "");
|
|
16790
|
+
const product = settings2("PRODUCT_NAME");
|
|
16791
|
+
const headerFiles = headerPhase(ref);
|
|
16792
|
+
const ownHeaders = /* @__PURE__ */ new Map();
|
|
16793
|
+
for (const { file, visibility } of headerFiles) {
|
|
16794
|
+
const name3 = import_node_path14.default.basename(file);
|
|
16795
|
+
const published = framework && visibility !== "Project";
|
|
16796
|
+
if (!ownHeaders.has(name3))
|
|
16797
|
+
ownHeaders.set(name3, published ? `${product}/${name3}` : file);
|
|
16798
|
+
if (framework && !published && !ownHeaders.has(`${product}/${name3}`))
|
|
16799
|
+
ownHeaders.set(`${product}/${name3}`, file);
|
|
16800
|
+
}
|
|
16801
|
+
const wrapper = import_node_path14.default.join(settings2("BUILT_PRODUCTS_DIR"), `${product}.framework`);
|
|
16802
|
+
const moduleMap = settings2("DEFINES_MODULE") === "YES" && settings2("MODULEMAP_FILE") ? absolute(settings2("MODULEMAP_FILE")) : null;
|
|
16517
16803
|
const fileFlags = {};
|
|
16518
16804
|
for (const phaseId of list(ref.target.buildPhases)) {
|
|
16519
16805
|
const phase = ref.project.object(phaseId);
|
|
@@ -16543,22 +16829,15 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
16543
16829
|
iosDeploymentTarget: settings2("IPHONEOS_DEPLOYMENT_TARGET") || null,
|
|
16544
16830
|
...implementations.some((file) => /\.mm?$/.test(file)) ? {
|
|
16545
16831
|
objc: {
|
|
16546
|
-
publicHeaders:
|
|
16547
|
-
|
|
16548
|
-
|
|
16549
|
-
return list(phase.files).flatMap((id) => {
|
|
16550
|
-
const file = ref.project.object(id);
|
|
16551
|
-
const attributes = isDict(file?.settings) ? list(file.settings.ATTRIBUTES) : [];
|
|
16552
|
-
const resolved = ref.project.resolvePath(str(file?.fileRef) ?? "");
|
|
16553
|
-
return attributes.includes("Public") && resolved ? [resolved] : [];
|
|
16554
|
-
});
|
|
16555
|
-
}),
|
|
16832
|
+
publicHeaders: headerFiles.flatMap(
|
|
16833
|
+
({ file, visibility }) => visibility === "Public" ? [file] : []
|
|
16834
|
+
),
|
|
16556
16835
|
headers: [
|
|
16557
16836
|
.../* @__PURE__ */ new Set([
|
|
16558
16837
|
...headers,
|
|
16559
16838
|
...Object.keys(ref.project.objects).flatMap((id) => {
|
|
16560
16839
|
const file = ref.project.resolvePath(id);
|
|
16561
|
-
return file &&
|
|
16840
|
+
return file && HEADER_FILE.test(file) && import_node_fs14.default.existsSync(file) ? [file] : [];
|
|
16562
16841
|
})
|
|
16563
16842
|
])
|
|
16564
16843
|
],
|
|
@@ -16568,9 +16847,13 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
16568
16847
|
...settingList(settings2("HEADER_SEARCH_PATHS")),
|
|
16569
16848
|
...settingList(settings2("USER_HEADER_SEARCH_PATHS"))
|
|
16570
16849
|
].flatMap((raw) => expandSearchPath(absolute(raw), searchRules)),
|
|
16571
|
-
|
|
16572
|
-
|
|
16573
|
-
|
|
16850
|
+
// xcode searches the target's own products directory first
|
|
16851
|
+
frameworkSearchPaths: [
|
|
16852
|
+
settings2("BUILT_PRODUCTS_DIR"),
|
|
16853
|
+
...settingList(settings2("FRAMEWORK_SEARCH_PATHS")).flatMap(
|
|
16854
|
+
(raw) => expandSearchPath(absolute(raw), searchRules)
|
|
16855
|
+
)
|
|
16856
|
+
],
|
|
16574
16857
|
flags: [
|
|
16575
16858
|
settings2("CLANG_ENABLE_OBJC_ARC") === "YES" ? "-fobjc-arc" : "-fno-objc-arc",
|
|
16576
16859
|
...settings2("CLANG_ENABLE_OBJC_WEAK") === "YES" ? ["-fobjc-weak"] : [],
|
|
@@ -16585,14 +16868,40 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
16585
16868
|
...settings2("CLANG_CXX_LANGUAGE_STANDARD") ? [`-std=${settings2("CLANG_CXX_LANGUAGE_STANDARD")}`] : [],
|
|
16586
16869
|
...settingList(settings2("OTHER_CPLUSPLUSFLAGS"))
|
|
16587
16870
|
],
|
|
16588
|
-
fileFlags
|
|
16871
|
+
fileFlags,
|
|
16872
|
+
headerMaps: settings2("USE_HEADERMAP") === "NO" ? [] : [
|
|
16873
|
+
{ flag: "-I", entries: [...ownHeaders] },
|
|
16874
|
+
{
|
|
16875
|
+
flag: "-iquote",
|
|
16876
|
+
entries: projectHeaderMap(ref.project)
|
|
16877
|
+
}
|
|
16878
|
+
],
|
|
16879
|
+
productHeaders: framework ? Object.fromEntries([
|
|
16880
|
+
...headerFiles.flatMap(
|
|
16881
|
+
({ file, visibility }) => visibility === "Project" ? [] : [
|
|
16882
|
+
[
|
|
16883
|
+
import_node_path14.default.join(
|
|
16884
|
+
wrapper,
|
|
16885
|
+
visibility === "Public" ? "Headers" : "PrivateHeaders",
|
|
16886
|
+
import_node_path14.default.basename(file)
|
|
16887
|
+
),
|
|
16888
|
+
file
|
|
16889
|
+
]
|
|
16890
|
+
]
|
|
16891
|
+
),
|
|
16892
|
+
...moduleMap ? [[import_node_path14.default.join(wrapper, "Modules", "module.modulemap"), moduleMap]] : []
|
|
16893
|
+
]) : {}
|
|
16589
16894
|
}
|
|
16590
16895
|
} : {}
|
|
16591
16896
|
}
|
|
16592
16897
|
};
|
|
16593
16898
|
};
|
|
16594
16899
|
const { settings, keys: settingKeys, module: module2 } = moduleTarget(app);
|
|
16595
|
-
const
|
|
16900
|
+
const frameworkTargets = order.slice(0, -1).map((ref) => ({ ref, framework: moduleTarget(ref).module }));
|
|
16901
|
+
const frameworks = frameworkTargets.map(({ framework }) => framework);
|
|
16902
|
+
const podSourceDirs = frameworkTargets.flatMap(
|
|
16903
|
+
({ ref, framework }) => isPodsProject(ref.project.xcodeproj) ? [...framework.allSources, ...framework.objc?.headers ?? []].map((file) => import_node_path14.default.dirname(file)).filter((dir) => import_node_fs14.default.existsSync(dir)) : []
|
|
16904
|
+
);
|
|
16596
16905
|
const expandValue = (value) => {
|
|
16597
16906
|
if (typeof value === "string") return expand(value, settings);
|
|
16598
16907
|
if (Array.isArray(value)) return value.map(expandValue);
|
|
@@ -16718,11 +17027,16 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
16718
17027
|
...localPackageDirs,
|
|
16719
17028
|
...linkedProducts.flatMap(
|
|
16720
17029
|
({ source }) => source.kind === "local" && import_node_fs14.default.existsSync(source.dir) ? [source.dir] : []
|
|
16721
|
-
)
|
|
17030
|
+
),
|
|
17031
|
+
...new Set(podSourceDirs)
|
|
16722
17032
|
].map((dir) => import_node_fs14.default.realpathSync(dir))
|
|
16723
17033
|
),
|
|
16724
17034
|
projectFiles: [
|
|
16725
|
-
.../* @__PURE__ */ new Set([
|
|
17035
|
+
.../* @__PURE__ */ new Set([
|
|
17036
|
+
...used.map((project) => project.projectFile),
|
|
17037
|
+
...xcconfigs,
|
|
17038
|
+
...cocoapods ? [cocoapods.podfileLock, cocoapods.manifestLock, ...cocoapods.localPodspecs] : []
|
|
17039
|
+
])
|
|
16726
17040
|
].sort(),
|
|
16727
17041
|
appIconName: settings("ASSETCATALOG_COMPILER_APPICON_NAME"),
|
|
16728
17042
|
infoPlist: import_plist2.default.build(info),
|
|
@@ -16736,7 +17050,8 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
|
|
|
16736
17050
|
packageResolved,
|
|
16737
17051
|
appTargets: appTargetNames,
|
|
16738
17052
|
configuration,
|
|
16739
|
-
settings
|
|
17053
|
+
settings,
|
|
17054
|
+
cocoapods
|
|
16740
17055
|
};
|
|
16741
17056
|
}
|
|
16742
17057
|
|
|
@@ -17832,13 +18147,13 @@ function resolveMetroPort(server) {
|
|
|
17832
18147
|
var metro_plugin_default = withPeach;
|
|
17833
18148
|
|
|
17834
18149
|
// src/jump-to-source-babel.ts
|
|
17835
|
-
function normalizeSourcePath(
|
|
17836
|
-
const queryStart =
|
|
17837
|
-
const clean = queryStart >= 0 ?
|
|
18150
|
+
function normalizeSourcePath(path21) {
|
|
18151
|
+
const queryStart = path21.indexOf("?");
|
|
18152
|
+
const clean = queryStart >= 0 ? path21.slice(0, queryStart) : path21;
|
|
17838
18153
|
return clean.replace(/\\/g, "/");
|
|
17839
18154
|
}
|
|
17840
|
-
function matchesPath(
|
|
17841
|
-
return typeof matcher === "string" ?
|
|
18155
|
+
function matchesPath(path21, matcher) {
|
|
18156
|
+
return typeof matcher === "string" ? path21.includes(matcher) : matcher.test(path21);
|
|
17842
18157
|
}
|
|
17843
18158
|
function shouldStampFile(filename, options) {
|
|
17844
18159
|
const normalized = normalizeSourcePath(filename);
|
|
@@ -17858,11 +18173,11 @@ function sootsimJumpToSourceBabelPlugin(api, options = {}) {
|
|
|
17858
18173
|
name: "sootsim-jump-to-source",
|
|
17859
18174
|
visitor: {
|
|
17860
18175
|
JSXElement: {
|
|
17861
|
-
exit(
|
|
18176
|
+
exit(path21, state) {
|
|
17862
18177
|
if (options.enabled === false) return;
|
|
17863
18178
|
const filename = state.filename;
|
|
17864
18179
|
if (!filename || !shouldStampFile(filename, options)) return;
|
|
17865
|
-
const node =
|
|
18180
|
+
const node = path21.node;
|
|
17866
18181
|
if (stamped.has(node)) return;
|
|
17867
18182
|
stamped.add(node);
|
|
17868
18183
|
const opening = node.openingElement;
|
|
@@ -17881,12 +18196,12 @@ function sootsimJumpToSourceBabelPlugin(api, options = {}) {
|
|
|
17881
18196
|
);
|
|
17882
18197
|
return;
|
|
17883
18198
|
}
|
|
17884
|
-
const fn =
|
|
18199
|
+
const fn = path21.getFunctionParent();
|
|
17885
18200
|
const parameterDefault = Boolean(
|
|
17886
18201
|
fn && opening.start != null && fn.node.body.start != null && opening.start < fn.node.body.start
|
|
17887
18202
|
);
|
|
17888
|
-
const type =
|
|
17889
|
-
if (!parameterDefault)
|
|
18203
|
+
const type = path21.scope.generateUidIdentifier("PeachSourceType");
|
|
18204
|
+
if (!parameterDefault) path21.scope.push({ id: type });
|
|
17890
18205
|
function expression(tag) {
|
|
17891
18206
|
return t.isJSXIdentifier(tag) ? t.identifier(tag.name) : t.memberExpression(
|
|
17892
18207
|
expression(tag.object),
|
|
@@ -17921,10 +18236,10 @@ function sootsimJumpToSourceBabelPlugin(api, options = {}) {
|
|
|
17921
18236
|
),
|
|
17922
18237
|
node
|
|
17923
18238
|
);
|
|
17924
|
-
if (
|
|
17925
|
-
|
|
18239
|
+
if (path21.parentPath.isJSXElement() || path21.parentPath.isJSXFragment()) {
|
|
18240
|
+
path21.replaceWith(t.jsxExpressionContainer(replacement));
|
|
17926
18241
|
} else {
|
|
17927
|
-
|
|
18242
|
+
path21.replaceWith(replacement);
|
|
17928
18243
|
}
|
|
17929
18244
|
}
|
|
17930
18245
|
}
|