peachsim 0.1.2590 → 0.1.2592
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/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 +2 -2
- package/dist-lib/bridge-constants.cjs +1 -1
- package/dist-lib/bridge-contract-input.cjs +1 -1
- package/dist-lib/bridge-contract-input.mjs +5 -5
- package/dist-lib/bridge-contract.cjs +1 -1
- package/dist-lib/bridge-contract.mjs +3 -3
- package/dist-lib/bundle-channel.cjs +4184 -3613
- package/dist-lib/capture-contract.cjs +1 -1
- package/dist-lib/capture-contract.mjs +3 -3
- package/dist-lib/cloud-contract.cjs +1 -1
- package/dist-lib/cloud-contract.mjs +3 -3
- package/dist-lib/cloud-test-args.cjs +1 -1
- package/dist-lib/cloud-test-args.mjs +2 -2
- package/dist-lib/cloud.cjs +1 -1
- package/dist-lib/cloud.mjs +7 -7
- package/dist-lib/config.cjs +1 -1
- package/dist-lib/config.mjs +5 -5
- package/dist-lib/detox/index.cjs +2 -2
- package/dist-lib/dev-bundle-resolution.cjs +1 -1
- package/dist-lib/esm-chunks/{acorn-65FNEARV.mjs → acorn-67PU73QE.mjs} +3 -3
- package/dist-lib/esm-chunks/{chunk-X2EKFONU.mjs → chunk-5FTHILIE.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-ADKUIQXX.mjs → chunk-6DB5FR7S.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-WPDY5IAD.mjs → chunk-CF3MTPMY.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-RGC2JNCL.mjs → chunk-D4LYKRRB.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-EFKDUMB5.mjs → chunk-DFF5XZ5M.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-2GUB5OLB.mjs → chunk-EHRSWFTD.mjs} +3 -3
- package/dist-lib/esm-chunks/{chunk-NZY4GOG5.mjs → chunk-EITX573K.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-SLPXTLBK.mjs → chunk-EWHA6X3Z.mjs} +5 -5
- package/dist-lib/esm-chunks/{chunk-BZS5SIYK.mjs → chunk-FYXXFYML.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-JG4AANWA.mjs → chunk-GQ3EO2UV.mjs} +107 -6
- package/dist-lib/esm-chunks/{chunk-N2II5SRJ.mjs → chunk-GY6TE4B4.mjs} +4 -4
- package/dist-lib/esm-chunks/{chunk-HZTK7TP5.mjs → chunk-KDI5YYQ6.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-4VCRUQ36.mjs → chunk-L5T3HBPO.mjs} +973 -549
- package/dist-lib/esm-chunks/{chunk-SRFKOU76.mjs → chunk-M4QLI2SY.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-OZJ66CXY.mjs → chunk-PITO2NI2.mjs} +2 -2
- package/dist-lib/esm-chunks/{chunk-5GNGHM5B.mjs → chunk-QSFWBVUO.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-YPPH6F77.mjs → chunk-R3WTQB5J.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-XE3VHAU2.mjs → chunk-RV4ACE6R.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-GBD26EBV.mjs → chunk-SW4PSSTF.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-V5TTEXYO.mjs → chunk-TJZPNFVF.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-WYDRQRJL.mjs → chunk-XSQH4R5E.mjs} +48 -15
- package/dist-lib/esm-chunks/{chunk-462CWTWI.mjs → chunk-XZ3FX3HW.mjs} +1 -1
- package/dist-lib/esm-chunks/{metro-layout-parser-CRI3GMCM.mjs → metro-layout-parser-EX65MARK.mjs} +3 -3
- package/dist-lib/esm-chunks/{swift-package-prebuilt-5XDZ2HZZ.mjs → swift-package-prebuilt-3BPDQVA7.mjs} +10 -10
- package/dist-lib/esm-chunks/{swift-sdk-app-module-6H3G6AXD.mjs → swift-sdk-app-module-CRX6E3TR.mjs} +151 -67
- package/dist-lib/esm-chunks/{swift-sdk-image-WAC7GG2R.mjs → swift-sdk-image-EJD5TPQH.mjs} +14 -14
- package/dist-lib/esm-chunks/{swift-sdk-image-producer-B3L27QTG.mjs → swift-sdk-image-producer-QAZOSLTZ.mjs} +4 -4
- package/dist-lib/expo-swift-bundle.cjs +3555 -2987
- package/dist-lib/expo-swift-metadata.cjs +1 -1
- package/dist-lib/expo-swift-metadata.mjs +7 -7
- package/dist-lib/home-paths.cjs +1 -1
- package/dist-lib/host/bridge-host.cjs +5981 -4986
- package/dist-lib/host/fetch-proxy-handler.cjs +310 -298
- package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
- package/dist-lib/host/fetch-proxy-overrides.mjs +2 -2
- package/dist-lib/host/replacement-module-handler.cjs +1 -1
- package/dist-lib/host/websocket-proxy.cjs +1 -1
- package/dist-lib/index.cjs +1 -1
- package/dist-lib/kotlin-host.cjs +1 -1
- package/dist-lib/menu.cjs +1 -1
- package/dist-lib/menu.mjs +3 -3
- package/dist-lib/metro-fingerprint-registry.cjs +1 -1
- package/dist-lib/metro-fingerprint-registry.mjs +3 -3
- package/dist-lib/metro-production-bundle.cjs +1 -1
- package/dist-lib/metro-production-bundle.mjs +4 -4
- package/dist-lib/native-app-identity-project.cjs +238 -223
- package/dist-lib/native-app-identity-project.mjs +17 -17
- package/dist-lib/native-app-identity.cjs +1 -1
- package/dist-lib/native-app-identity.mjs +6 -6
- package/dist-lib/native-firebase-metadata.cjs +1 -1
- package/dist-lib/native-firebase-metadata.mjs +3 -3
- package/dist-lib/pdfium-raster.cjs +1 -1
- package/dist-lib/pdfium-raster.mjs +2 -2
- package/dist-lib/plist.cjs +1 -1
- package/dist-lib/plist.mjs +3 -3
- package/dist-lib/profiles.cjs +1 -1
- package/dist-lib/public-brand.cjs +1 -1
- package/dist-lib/public-origins-lib-esm.json +81 -81
- package/dist-lib/public-origins-lib.json +73 -71
- package/dist-lib/react-native-host-modules.cjs +1 -1
- package/dist-lib/react-native-host-modules.mjs +2 -2
- package/dist-lib/reap-browser.cjs +1 -1
- package/dist-lib/scripts/dev-server-scanner.cjs +1 -1
- package/dist-lib/sdk.cjs +1 -1
- package/dist-lib/sdk.mjs +8 -8
- package/dist-lib/skills.cjs +6603 -5608
- package/dist-lib/swift-compile.cjs +1363 -778
- package/dist-lib/swift-compile.mjs +10 -10
- package/dist-lib/swift-package.cjs +1 -1
- package/dist-lib/swift-package.mjs +3 -3
- package/dist-lib/swift-submit.cjs +1 -1
- package/dist-lib/swift-submit.mjs +6 -6
- package/dist-lib/swift-svg-raster.cjs +1 -1
- package/dist-lib/swift-svg-raster.mjs +2 -2
- package/dist-lib/swift-toolchain.cjs +12 -6
- package/dist-lib/swift.cjs +1 -1
- package/dist-lib/vendor/@peculiar/x509.cjs +1 -1
- package/dist-lib/vendor/@ruby/prism/src/nodes.js.cjs +1 -1
- package/dist-lib/vendor/@ruby/prism/src/parsePrism.js.cjs +1 -1
- package/dist-lib/vendor/@xmldom/xmldom.cjs +1 -1
- package/dist-lib/vendor/acorn.cjs +1 -1
- package/dist-lib/vendor/bplist-parser.cjs +1 -1
- package/dist-lib/vendor/ignore.cjs +1 -1
- package/dist-lib/vendor/magic-string.cjs +1 -1
- package/dist-lib/vendor/plist.cjs +1 -1
- package/dist-lib/vendor/smol-toml.cjs +1 -1
- package/dist-lib/vendor/stream-json.cjs +1 -1
- package/dist-lib/vendor/sucrase/dist/index.js.cjs +1 -1
- package/dist-lib/vendor/sucrase/dist/parser/index.js.cjs +1 -1
- package/dist-lib/vendor/sucrase/dist/parser/tokenizer/index.js.cjs +1 -1
- package/dist-lib/vendor/sucrase/dist/parser/tokenizer/types.js.cjs +1 -1
- package/dist-lib/vendor/sucrase.cjs +1 -1
- package/dist-lib/vendor/terser.cjs +1 -1
- package/dist-lib/vendor/valibot.cjs +1 -1
- package/dist-lib/vendor/ws.cjs +1 -1
- package/dist-lib/vendor/zod.cjs +1 -1
- package/dist-lib/worklet-executable.cjs +1 -1
- package/dist-lib/worklet-executable.mjs +3 -3
- package/dist-types/packages/peach-engine/src/engine/native-node-queries.d.ts +1 -0
- package/kotlin/sdk.tar.gz +0 -0
- package/package.json +1 -1
- package/runtime-companion.json +1 -1
- package/src/native-bundles.ts +2 -0
- package/src/one-native-controls-package.ts +141 -31
- package/src/one-sdk/source.ts +2 -1
- package/src/oneSdkContract.ts +13 -2
- package/src/swift-compile.ts +301 -48
- package/src/swift-guest-compile.ts +41 -8
- package/src/swift-guest-link.ts +3 -0
- package/src/swift-guest-source-inputs.ts +158 -30
- package/src/swift-host.ts +88 -16
- package/src/swift-reproducible.ts +16 -2
- package/src/swift-root-lock.ts +77 -5
- package/src/swift-sdk-app-module.ts +146 -59
- package/src/swift-sdk-image.ts +53 -10
- package/src/swift-startup-split.ts +65 -27
- package/src/swift-toolchain.ts +16 -5
- package/src/wasm-lazy-split.ts +46 -40
|
@@ -6,6 +6,7 @@ import { createRequire } from 'node:module'
|
|
|
6
6
|
import path from 'node:path'
|
|
7
7
|
import { fileURLToPath } from 'node:url'
|
|
8
8
|
import { swiftGuestControls } from '../../peach-globals/build/one-swift-control-source'
|
|
9
|
+
import { oneSDKHost, oneSDKModule, oneSDKTransport } from './one-sdk/source'
|
|
9
10
|
import {
|
|
10
11
|
ONE_NATIVE_CONTROLS_CONTRACT,
|
|
11
12
|
ONE_NATIVE_CONTROLS_NAVIGATION_SPLIT_VIEW,
|
|
@@ -13,7 +14,7 @@ import {
|
|
|
13
14
|
ONE_NATIVE_CONTROLS_PACKAGE,
|
|
14
15
|
} from './oneNativeControlsContract'
|
|
15
16
|
import { swiftCodeMask, syncSwiftTree } from './swift-compile'
|
|
16
|
-
import { swiftPackageAssets, swiftPackageMetadata } from './swift-host'
|
|
17
|
+
import { projectFor, swiftPackageAssets, swiftPackageMetadata } from './swift-host'
|
|
17
18
|
import { collectSwiftSourceClosure } from './swift-source-closure'
|
|
18
19
|
import { SWIFT_HMR_PATH, SWIFT_PACKAGE_PATH } from './swift-submit'
|
|
19
20
|
import { privateSwiftDistributionRoot, swiftCacheDir } from './swift-toolchain'
|
|
@@ -556,7 +557,7 @@ private struct NavigationSplitViewBridge: UIViewRepresentable {
|
|
|
556
557
|
let root = spec["root"] as! Spec
|
|
557
558
|
precondition((root["spec"] as? Spec)?["control"] as? String == view)
|
|
558
559
|
return AnyView(ControlBridge(root: root, emit: emit)
|
|
559
|
-
.frame(maxWidth: .infinity, maxHeight: .infinity))
|
|
560
|
+
.frame(minWidth: 0, maxWidth: .infinity, maxHeight: .infinity))
|
|
560
561
|
}
|
|
561
562
|
}
|
|
562
563
|
}
|
|
@@ -642,7 +643,19 @@ private let startupProfileSpec: [String: Any] = [
|
|
|
642
643
|
|
|
643
644
|
@main
|
|
644
645
|
struct OneNativeControlsGuest: PeachPackage {
|
|
645
|
-
func view(props: JSON) -> some View {
|
|
646
|
+
@ViewBuilder func view(props: JSON) -> some View {
|
|
647
|
+
#if PEACH_ONE_SDK
|
|
648
|
+
if props["oneSDKHost"] != nil {
|
|
649
|
+
OneSDKUIKitHost(props: props)
|
|
650
|
+
} else {
|
|
651
|
+
startupProfile
|
|
652
|
+
}
|
|
653
|
+
#else
|
|
654
|
+
startupProfile
|
|
655
|
+
#endif
|
|
656
|
+
}
|
|
657
|
+
|
|
658
|
+
private var startupProfile: some View {
|
|
646
659
|
NavigationStackBridge(spec: startupProfileSpec, emit: { _, _ in })
|
|
647
660
|
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
|
648
661
|
}
|
|
@@ -695,9 +708,25 @@ function defaultSwiftModuleRoot(): string | undefined {
|
|
|
695
708
|
return fs.existsSync(path.join(root, 'toolchain.json')) ? root : undefined
|
|
696
709
|
}
|
|
697
710
|
|
|
711
|
+
const ONE_SDK_RUNTIME_SOURCES = [
|
|
712
|
+
'SDK/OneSDKRuntime.swift',
|
|
713
|
+
'OneNativeUIKitHostView.swift',
|
|
714
|
+
'OneNativeContent.swift',
|
|
715
|
+
'OneNativeAccessibility.swift',
|
|
716
|
+
'SDKViews/OneNativeViewsTable.swift',
|
|
717
|
+
] as const
|
|
718
|
+
|
|
719
|
+
export interface OneNativeControlsSDKInput {
|
|
720
|
+
files: ReadonlyMap<string, string>
|
|
721
|
+
modules: readonly string[]
|
|
722
|
+
defines?: readonly string[]
|
|
723
|
+
reemitForWasi?: (diagnostic: string) => Promise<ReadonlyMap<string, string> | undefined>
|
|
724
|
+
}
|
|
725
|
+
|
|
698
726
|
export interface OneNativeControlsPackage {
|
|
699
727
|
packagePath: string
|
|
700
728
|
watched: string[]
|
|
729
|
+
oneSDKModules?: string[]
|
|
701
730
|
}
|
|
702
731
|
|
|
703
732
|
function excludedGroupSource(source: string, defines: ReadonlySet<string>): boolean {
|
|
@@ -718,6 +747,7 @@ function excludedGroupSource(source: string, defines: ReadonlySet<string>): bool
|
|
|
718
747
|
export async function oneNativeControlsPackage(
|
|
719
748
|
appRoot?: string,
|
|
720
749
|
linkedGroups?: readonly string[],
|
|
750
|
+
sdk?: OneNativeControlsSDKInput | null,
|
|
721
751
|
): Promise<OneNativeControlsPackage> {
|
|
722
752
|
const iosDir = resolveOneNativeAppleIosDir(appRoot)
|
|
723
753
|
const generated = swiftGuestControls(
|
|
@@ -728,10 +758,13 @@ export async function oneNativeControlsPackage(
|
|
|
728
758
|
const sources: Record<string, string> = {}
|
|
729
759
|
const paths = new Map<string, string>()
|
|
730
760
|
const defines = new Set([...ONE_SDK_DEFINES, ...generated.defines])
|
|
761
|
+
const bindings = sdk && sdk.files.size && sdk.modules.length ? sdk : undefined
|
|
762
|
+
const sdkSources = new Set(ONE_SDK_RUNTIME_SOURCES.map((file) => path.basename(file)))
|
|
731
763
|
for (const folder of ['', 'Generated', 'SDK']) {
|
|
732
764
|
for (const name of fs.readdirSync(path.join(iosDir, folder)).sort()) {
|
|
733
765
|
// the guest SDK supplies PeachPackage and its JSON type.
|
|
734
766
|
if (!name.endsWith('.swift') || name === 'OneSwiftPackage.swift') continue
|
|
767
|
+
if (bindings && sdkSources.has(name)) continue
|
|
735
768
|
if (paths.has(name))
|
|
736
769
|
throw new Error(`duplicate Swift filename ${name} in OneNativeControls`)
|
|
737
770
|
const full = path.join(iosDir, folder, name)
|
|
@@ -743,7 +776,7 @@ export async function oneNativeControlsPackage(
|
|
|
743
776
|
}
|
|
744
777
|
sources['OneNativeGuestControls.swift'] = generated.source
|
|
745
778
|
sources['OneNativeControlsBridge.swift'] = BRIDGE_SWIFT
|
|
746
|
-
const
|
|
779
|
+
const controls = new Map(
|
|
747
780
|
Object.entries(
|
|
748
781
|
collectSwiftSourceClosure(
|
|
749
782
|
sources,
|
|
@@ -754,28 +787,76 @@ export async function oneNativeControlsPackage(
|
|
|
754
787
|
),
|
|
755
788
|
)
|
|
756
789
|
const watched = new Set(generated.watched)
|
|
757
|
-
const
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
790
|
+
const files = new Map<string, string>()
|
|
791
|
+
const prefix = bindings ? 'Sources/Controls/' : ''
|
|
792
|
+
for (const [name, source] of controls) {
|
|
793
|
+
files.set(prefix + name, source)
|
|
761
794
|
const full = paths.get(name)
|
|
762
795
|
if (full) watched.add(full)
|
|
763
|
-
digest.update(name).update('\0').update(source).update('\0')
|
|
764
796
|
}
|
|
765
797
|
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
798
|
+
if (bindings) {
|
|
799
|
+
files.set('Sources/One/One.swift', oneSDKModule)
|
|
800
|
+
for (const relative of ONE_SDK_RUNTIME_SOURCES) {
|
|
801
|
+
const full = path.join(iosDir, relative)
|
|
802
|
+
files.set('Sources/One/' + path.basename(relative), fs.readFileSync(full, 'utf8'))
|
|
803
|
+
watched.add(full)
|
|
804
|
+
}
|
|
805
|
+
for (const [name, content] of [...bindings.files].sort(([a], [b]) =>
|
|
806
|
+
a.localeCompare(b),
|
|
807
|
+
)) {
|
|
808
|
+
const relative = 'Sources/OneSDKBindings/' + path.basename(name)
|
|
809
|
+
if (files.has(relative))
|
|
810
|
+
throw new Error('duplicate Swift filename in OneSDKBindings: ' + relative)
|
|
811
|
+
files.set(relative, content)
|
|
812
|
+
}
|
|
813
|
+
files.set('Sources/Controls/OneSDKHost.swift', oneSDKHost)
|
|
814
|
+
files.set('Sources/Controls/OneSDKTransport.swift', oneSDKTransport)
|
|
815
|
+
defines.add('PEACH_ONE_SDK')
|
|
816
|
+
}
|
|
817
|
+
|
|
818
|
+
const swiftDefines = (flags: Iterable<string>) =>
|
|
819
|
+
Array.from(flags, (flag) => '.define(' + JSON.stringify(flag) + ')')
|
|
820
|
+
const bindingSettings = [
|
|
821
|
+
...swiftDefines(bindings?.defines ?? []),
|
|
822
|
+
'.unsafeFlags(["-suppress-warnings"])',
|
|
823
|
+
]
|
|
824
|
+
const controlSettings = [
|
|
825
|
+
'.swiftLanguageMode(.v5)',
|
|
826
|
+
...swiftDefines(defines),
|
|
827
|
+
...(bindings
|
|
828
|
+
? ['.unsafeFlags(["-Xfrontend", "-import-module", "-Xfrontend", "One"])']
|
|
829
|
+
: []),
|
|
830
|
+
]
|
|
831
|
+
|
|
832
|
+
let manifest: string
|
|
833
|
+
if (bindings) {
|
|
834
|
+
manifest = [
|
|
770
835
|
'// swift-tools-version: 6.2',
|
|
771
|
-
`// OneNativeControls ${key}`,
|
|
772
836
|
'import PackageDescription',
|
|
773
837
|
`let package = Package(name: "${ONE_NATIVE_CONTROLS_PACKAGE}", platforms: [.iOS(.v17)], targets: [`,
|
|
774
|
-
|
|
838
|
+
' .target(name: "One", path: "Sources/One"),',
|
|
839
|
+
` .target(name: "OneSDKBindings", dependencies: ["One"], path: "Sources/OneSDKBindings", swiftSettings: [${bindingSettings.join(', ')}]),`,
|
|
840
|
+
` .executableTarget(name: "Controls", dependencies: ["One", "OneSDKBindings"], path: "Sources/Controls", swiftSettings: [${controlSettings.join(', ')}]),`,
|
|
775
841
|
'])',
|
|
776
842
|
'',
|
|
777
|
-
].join('\n')
|
|
778
|
-
|
|
843
|
+
].join('\n')
|
|
844
|
+
} else {
|
|
845
|
+
manifest = [
|
|
846
|
+
'// swift-tools-version: 6.2',
|
|
847
|
+
'import PackageDescription',
|
|
848
|
+
`let package = Package(name: "${ONE_NATIVE_CONTROLS_PACKAGE}", platforms: [.iOS(.v17)], targets: [`,
|
|
849
|
+
` .executableTarget(name: "${ONE_NATIVE_CONTROLS_PACKAGE}", path: ".", swiftSettings: [${controlSettings.join(', ')}]),`,
|
|
850
|
+
'])',
|
|
851
|
+
'',
|
|
852
|
+
].join('\n')
|
|
853
|
+
}
|
|
854
|
+
|
|
855
|
+
const digest = createHash('sha256').update(manifest)
|
|
856
|
+
for (const [name, source] of files)
|
|
857
|
+
digest.update(name).update('\0').update(source).update('\0')
|
|
858
|
+
const key = digest.digest('hex').slice(0, 16)
|
|
859
|
+
files.set('Package.swift', manifest)
|
|
779
860
|
|
|
780
861
|
const packagePath = path.join(
|
|
781
862
|
swiftCacheDir(),
|
|
@@ -788,30 +869,59 @@ export async function oneNativeControlsPackage(
|
|
|
788
869
|
packagePath,
|
|
789
870
|
new Map([...files].map(([file, text]) => [path.join(packagePath, file), text])),
|
|
790
871
|
)
|
|
791
|
-
return {
|
|
872
|
+
return {
|
|
873
|
+
packagePath,
|
|
874
|
+
watched: [...watched],
|
|
875
|
+
oneSDKModules: bindings && [...bindings.modules],
|
|
876
|
+
}
|
|
792
877
|
}
|
|
793
878
|
|
|
794
879
|
export async function stageOneNativeControlsRelease(
|
|
795
880
|
appRoot?: string,
|
|
796
|
-
options?: {
|
|
881
|
+
options?: {
|
|
882
|
+
moduleRoot?: string
|
|
883
|
+
startupRuntimeUrl?: URL
|
|
884
|
+
sdk?: OneNativeControlsSDKInput | null
|
|
885
|
+
},
|
|
797
886
|
linkedGroups?: readonly string[],
|
|
798
887
|
): Promise<{
|
|
799
888
|
metadataPath: string
|
|
800
889
|
metadata: SwiftEntryModuleArgs
|
|
801
890
|
files: Map<string, Blob>
|
|
891
|
+
oneSDKModules?: string[]
|
|
802
892
|
}> {
|
|
803
|
-
const { packagePath } = await oneNativeControlsPackage(appRoot, linkedGroups)
|
|
804
893
|
const moduleRoot = options?.moduleRoot ?? defaultSwiftModuleRoot()
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
894
|
+
let sdk = options?.sdk
|
|
895
|
+
const compile = async () => {
|
|
896
|
+
for (;;) {
|
|
897
|
+
const { packagePath, oneSDKModules } = await oneNativeControlsPackage(
|
|
898
|
+
appRoot,
|
|
899
|
+
linkedGroups,
|
|
900
|
+
sdk,
|
|
901
|
+
)
|
|
902
|
+
if (oneSDKModules?.length)
|
|
903
|
+
projectFor(fs.realpathSync(packagePath)).oneModule = false
|
|
904
|
+
try {
|
|
905
|
+
const metadata = await swiftPackageMetadata(
|
|
906
|
+
packagePath,
|
|
907
|
+
ONE_NATIVE_CONTROLS_PACKAGE,
|
|
908
|
+
moduleRoot,
|
|
909
|
+
'',
|
|
910
|
+
undefined,
|
|
911
|
+
undefined,
|
|
912
|
+
[],
|
|
913
|
+
options?.startupRuntimeUrl,
|
|
914
|
+
)
|
|
915
|
+
return { packagePath, oneSDKModules, metadata }
|
|
916
|
+
} catch (error) {
|
|
917
|
+
if (!sdk?.reemitForWasi || !(error instanceof Error)) throw error
|
|
918
|
+
const files = await sdk.reemitForWasi(error.message)
|
|
919
|
+
if (!files) throw error
|
|
920
|
+
sdk = { ...sdk, files }
|
|
921
|
+
}
|
|
922
|
+
}
|
|
923
|
+
}
|
|
924
|
+
const { packagePath, oneSDKModules, metadata } = await compile()
|
|
815
925
|
const assets = await swiftPackageAssets(packagePath, metadata)
|
|
816
926
|
const files = new Map<string, Blob>()
|
|
817
927
|
const metadataPath = `${SWIFT_PACKAGE_PATH}${ONE_NATIVE_CONTROLS_PACKAGE}`
|
|
@@ -824,5 +934,5 @@ export async function stageOneNativeControlsRelease(
|
|
|
824
934
|
for (const [assetPath, { bytes, contentType }] of assets) {
|
|
825
935
|
files.set(assetPath, new Blob([new Uint8Array(bytes)], { type: contentType }))
|
|
826
936
|
}
|
|
827
|
-
return { metadataPath, metadata, files }
|
|
937
|
+
return { metadataPath, metadata, files, oneSDKModules }
|
|
828
938
|
}
|
package/src/one-sdk/source.ts
CHANGED
|
@@ -155,7 +155,8 @@ private enum SDKTransport {
|
|
|
155
155
|
|
|
156
156
|
static func failure(_ error: Error, _ context: String? = nil) -> [String: Any] {
|
|
157
157
|
let native = error as NSError
|
|
158
|
-
let
|
|
158
|
+
let detail = (error as? OneSDKError)?.description ?? native.localizedDescription
|
|
159
|
+
let message = context.map { "E_SDK: \($0): \(detail)" } ?? detail
|
|
159
160
|
return envelope(["$error": ["message": message, "code": "E_SDK", "domain": native.domain, "nativeCode": Double(native.code)]])
|
|
160
161
|
}
|
|
161
162
|
|
package/src/oneSdkContract.ts
CHANGED
|
@@ -19,12 +19,14 @@ export interface OneSDKCompilation extends SwiftEntryOptions {
|
|
|
19
19
|
export function readOneSDKMetadata(value: unknown): OneSDKCompilation | null {
|
|
20
20
|
if (value == null) return null
|
|
21
21
|
if (!isRecord(value)) throw new Error('invalid One SDK compilation metadata')
|
|
22
|
-
const { url, hash, rootId, icuUrl, modules, bundleFiles } = value
|
|
22
|
+
const { url, hash, rootId, icuUrl, sdkUrl, sdkBindingUrl, modules, bundleFiles } = value
|
|
23
23
|
if (
|
|
24
24
|
typeof url !== 'string' ||
|
|
25
25
|
typeof hash !== 'string' ||
|
|
26
26
|
typeof rootId !== 'string' ||
|
|
27
27
|
typeof icuUrl !== 'string' ||
|
|
28
|
+
(sdkUrl !== undefined && typeof sdkUrl !== 'string') ||
|
|
29
|
+
(sdkBindingUrl !== undefined && typeof sdkBindingUrl !== 'string') ||
|
|
28
30
|
!Array.isArray(modules) ||
|
|
29
31
|
!modules.every((name) => typeof name === 'string') ||
|
|
30
32
|
!isRecord(bundleFiles)
|
|
@@ -41,7 +43,16 @@ export function readOneSDKMetadata(value: unknown): OneSDKCompilation | null {
|
|
|
41
43
|
return [name, bytes] satisfies [string, string]
|
|
42
44
|
}),
|
|
43
45
|
)
|
|
44
|
-
return {
|
|
46
|
+
return {
|
|
47
|
+
url,
|
|
48
|
+
hash,
|
|
49
|
+
rootId,
|
|
50
|
+
icuUrl,
|
|
51
|
+
...(sdkUrl !== undefined ? { sdkUrl } : {}),
|
|
52
|
+
...(sdkBindingUrl !== undefined ? { sdkBindingUrl } : {}),
|
|
53
|
+
modules,
|
|
54
|
+
bundleFiles: files,
|
|
55
|
+
}
|
|
45
56
|
}
|
|
46
57
|
|
|
47
58
|
export const readOneSDKFooter = (source: string) =>
|