peachsim 0.1.1815 → 0.1.1817
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/commands/package.ts +82 -31
- package/cli/outbound-endpoints.ts +1 -1
- package/cli/packaged-app-launcher.ts +6 -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 +4418 -5235
- package/dist-lib/capture-contract.cjs +1 -1
- package/dist-lib/capture-contract.mjs +1 -1
- package/dist-lib/cloud-contract.cjs +1 -1
- package/dist-lib/cloud-contract.mjs +1 -1
- package/dist-lib/cloud-test-args.cjs +1 -1
- package/dist-lib/cloud-test-args.mjs +1 -1
- package/dist-lib/cloud.cjs +1 -1
- package/dist-lib/cloud.mjs +1 -1
- package/dist-lib/config.cjs +1 -1
- package/dist-lib/config.mjs +1 -1
- package/dist-lib/detox/index.cjs +12 -3
- package/dist-lib/dev-bundle-resolution.cjs +1 -1
- package/dist-lib/expo-swift-bundle.cjs +3932 -4526
- 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 +3289 -4175
- package/dist-lib/host/fetch-proxy-handler.cjs +12 -3
- 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 +13 -24
- 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 +1 -1
- 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 +13 -24
- package/dist-lib/native-app-identity-project.cjs +2 -22
- package/dist-lib/native-app-identity-project.mjs +2 -22
- package/dist-lib/native-app-identity.cjs +1 -1
- package/dist-lib/native-app-identity.mjs +1 -1
- package/dist-lib/native-firebase-metadata.cjs +1 -1
- package/dist-lib/native-firebase-metadata.mjs +1 -1
- package/dist-lib/pdfium-raster.cjs +1 -1
- package/dist-lib/pdfium-raster.mjs +1 -1
- package/dist-lib/plist.cjs +1 -1
- package/dist-lib/plist.mjs +1 -1
- package/dist-lib/profiles.cjs +1 -1
- package/dist-lib/public-brand.cjs +1 -1
- package/dist-lib/public-origins-lib-esm.json +24 -24
- package/dist-lib/public-origins-lib.json +74 -66
- package/dist-lib/react-native-host-modules.cjs +1 -1
- package/dist-lib/react-native-host-modules.mjs +1 -1
- package/dist-lib/reap-browser.cjs +1 -1
- package/dist-lib/scripts/dev-server-scanner.cjs +1 -1
- package/dist-lib/sdk.cjs +1 -1
- package/dist-lib/sdk.mjs +1 -1
- package/dist-lib/skills.cjs +3793 -4671
- package/dist-lib/swift-compile.cjs +216 -242
- package/dist-lib/swift-compile.mjs +216 -242
- 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 +251 -236
- package/dist-lib/vite.cjs +12 -3
- package/dist-lib/worklet-executable.cjs +1 -1
- package/dist-lib/worklet-executable.mjs +1 -1
- package/package.json +1 -1
- package/src/answeredNativePackages.ts +41 -0
- package/src/cli-runtime.ts +2 -9
- package/src/expo-discovery-cache.ts +2 -0
- package/src/expo-kotlin-host.ts +11 -9
- package/src/expo-swift-host.ts +10 -6
- package/src/nitro-bundle.ts +8 -6
- package/src/nitro-compiler-digest.ts +2 -4
- package/src/nitro-superset.lock.json +19 -251
- package/src/nitro-superset.ts +59 -63
- package/src/react-native-bridge-modules.ts +2 -4
- package/src/swift-compile.ts +258 -254
- package/src/swift-objc-standin.ts +10 -6
- package/src/swift-standins.ts +36 -12
- package/src/turbo-source.ts +2 -3
package/src/nitro-superset.ts
CHANGED
|
@@ -1,18 +1,23 @@
|
|
|
1
1
|
// the shared Nitro executable (plans/peach/native-prebuild-registry.md). every
|
|
2
2
|
// compiled Nitro provider links one Swift, Foundation and UIKit closure that is
|
|
3
3
|
// most of an executable's bytes, so building each app's own copy ships the same
|
|
4
|
-
// closure per app. one executable of every provider in the
|
|
5
|
-
//
|
|
6
|
-
//
|
|
7
|
-
//
|
|
8
|
-
//
|
|
9
|
-
//
|
|
4
|
+
// closure per app. one executable of every provider in the capsule is published
|
|
5
|
+
// on the prebuilt registry under a key of its committed inputs and the compiler
|
|
6
|
+
// sources, and an app whose providers are byte-identical to the ones it was
|
|
7
|
+
// built from points its metadata at that key: the browser downloads it once for
|
|
8
|
+
// every app, port and deployment. an app with a provider outside the lock, a
|
|
9
|
+
// different provider build, or a HybridObject or view its config answers
|
|
10
|
+
// compiles its own executable.
|
|
10
11
|
import { createHash } from 'node:crypto'
|
|
11
12
|
import { readdirSync, readFileSync } from 'node:fs'
|
|
12
13
|
import { createRequire } from 'node:module'
|
|
13
14
|
import { dirname, join } from 'node:path'
|
|
14
15
|
import { isRecord } from './is-record'
|
|
15
|
-
import {
|
|
16
|
+
import {
|
|
17
|
+
NATIVE_PREBUILT_ORIGIN,
|
|
18
|
+
nativeEntryKey,
|
|
19
|
+
nativeEntryPrefix,
|
|
20
|
+
} from './native-prebuilt'
|
|
16
21
|
import { committedAdapterLocks } from './nitro-adapter'
|
|
17
22
|
import { nitroCompilerSourceDigest } from './nitro-compiler-digest'
|
|
18
23
|
import supersetLockJson from './nitro-superset.lock.json' with { type: 'json' }
|
|
@@ -49,10 +54,10 @@ const packageVersion = (root: string): string =>
|
|
|
49
54
|
|
|
50
55
|
/**
|
|
51
56
|
* what one executable of these providers depends on, apart from the sources
|
|
52
|
-
* that compile it
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
*
|
|
57
|
+
* that compile it, which NITRO_COMPILER_DIGEST adds to the key: the toolchain
|
|
58
|
+
* and runtime identities, the build configuration, the iOS deployment target
|
|
59
|
+
* its project compiles for, and each provider's version and source tree, Nitro
|
|
60
|
+
* Modules' included.
|
|
56
61
|
*/
|
|
57
62
|
export function nitroSupersetInputs(options: {
|
|
58
63
|
appRoot: string
|
|
@@ -77,64 +82,56 @@ export function nitroSupersetInputs(options: {
|
|
|
77
82
|
return inputs
|
|
78
83
|
}
|
|
79
84
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
85
|
+
// build-cli replaces this in every bundle with the digest of the sources it
|
|
86
|
+
// bundles; source runs read the files once at load, like STANDIN_SOURCE_DIGEST.
|
|
87
|
+
declare const __NITRO_COMPILER_DIGEST__: string | undefined
|
|
88
|
+
export const NITRO_COMPILER_DIGEST =
|
|
89
|
+
typeof __NITRO_COMPILER_DIGEST__ === 'string'
|
|
90
|
+
? __NITRO_COMPILER_DIGEST__
|
|
91
|
+
: nitroCompilerSourceDigest(import.meta.dirname, STANDIN_SOURCE_DIGEST)
|
|
83
92
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
inputs: Record<string, string>
|
|
87
|
-
/** every provider the executable registers; urls are absolute. */
|
|
88
|
-
metadata: NitroCompiledModule
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
/** the Release executable at the top level, where the lander reads its
|
|
92
|
-
* compiler digest, and the Debug build of the same providers beside it. */
|
|
93
|
-
export interface NitroSupersetLock extends NitroSupersetEntry {
|
|
94
|
-
debug: NitroSupersetEntry
|
|
95
|
-
}
|
|
93
|
+
/** each configuration's compiler-independent inputs, as `nitro-superset.ts inputs` wrote them. */
|
|
94
|
+
export type NitroSupersetLock = Record<NitroBuildConfiguration, Record<string, string>>
|
|
96
95
|
|
|
97
|
-
function
|
|
98
|
-
if (!isRecord(value)
|
|
99
|
-
const
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
)
|
|
106
|
-
return { key: value.key, inputs, metadata }
|
|
96
|
+
function readInputs(value: unknown): Record<string, string> | null {
|
|
97
|
+
if (!isRecord(value)) return null
|
|
98
|
+
const inputs: Record<string, string> = {}
|
|
99
|
+
for (const [name, entry] of Object.entries(value)) {
|
|
100
|
+
if (typeof entry !== 'string') return null
|
|
101
|
+
inputs[name] = entry
|
|
102
|
+
}
|
|
103
|
+
return inputs
|
|
107
104
|
}
|
|
108
105
|
|
|
109
106
|
function parseLock(value: unknown): NitroSupersetLock | null {
|
|
110
|
-
|
|
111
|
-
const
|
|
112
|
-
|
|
107
|
+
if (!isRecord(value)) return null
|
|
108
|
+
const release = readInputs(value.Release)
|
|
109
|
+
const debug = readInputs(value.Debug)
|
|
110
|
+
return release && debug ? { Release: release, Debug: debug } : null
|
|
113
111
|
}
|
|
114
112
|
|
|
115
113
|
export const nitroSupersetLock = parseLock(supersetLockJson)
|
|
116
114
|
|
|
117
|
-
/** the
|
|
118
|
-
export const
|
|
119
|
-
|
|
120
|
-
configuration: NitroBuildConfiguration,
|
|
121
|
-
): NitroSupersetEntry => (configuration === 'Debug' ? lock.debug : lock)
|
|
115
|
+
/** the registry key of an executable: its inputs and the compiler that builds it. */
|
|
116
|
+
export const nitroSupersetKey = (inputs: Record<string, string>): string =>
|
|
117
|
+
nativeEntryKey({ ...inputs, compiler: NITRO_COMPILER_DIGEST })
|
|
122
118
|
|
|
123
119
|
/** the registry prefix and file urls of an executable built for a key. */
|
|
124
120
|
export function nitroSupersetUrl(key: string, file: string): string {
|
|
125
121
|
return `${NATIVE_PREBUILT_ORIGIN}/${nativeEntryPrefix('nitro', NITRO_SUPERSET_ENTRY_NAME, key)}/${file}`
|
|
126
122
|
}
|
|
127
123
|
|
|
128
|
-
//
|
|
129
|
-
//
|
|
130
|
-
const published = new Map<string, Promise<
|
|
131
|
-
const
|
|
124
|
+
// the publish workflow fills a key after main moves its compiler, so each key's
|
|
125
|
+
// metadata is asked for once per process and a miss compiles the app's own.
|
|
126
|
+
const published = new Map<string, Promise<NitroCompiledModule | null>>()
|
|
127
|
+
const publishedMetadata = (url: string) => {
|
|
132
128
|
let pending = published.get(url)
|
|
133
129
|
if (!pending) {
|
|
134
|
-
pending = fetch(url
|
|
135
|
-
(response) =>
|
|
136
|
-
|
|
137
|
-
|
|
130
|
+
pending = fetch(url)
|
|
131
|
+
.then(async (response) =>
|
|
132
|
+
response.ok ? readNitroMetadata(await response.json()) : null,
|
|
133
|
+
)
|
|
134
|
+
.catch(() => null)
|
|
138
135
|
published.set(url, pending)
|
|
139
136
|
}
|
|
140
137
|
return pending
|
|
@@ -143,8 +140,8 @@ const isPublished = (url: string) => {
|
|
|
143
140
|
/**
|
|
144
141
|
* the shared executable's metadata for an app's providers, or null when the app
|
|
145
142
|
* needs its own: its inputs differ from the lock's anywhere, it holds a
|
|
146
|
-
* provider the lock lacks,
|
|
147
|
-
* would register.
|
|
143
|
+
* provider the lock lacks, its config answers a name or view the executable
|
|
144
|
+
* would register, or this compiler's executable is not published yet.
|
|
148
145
|
*/
|
|
149
146
|
export async function sharedNitroModule(options: {
|
|
150
147
|
appRoot: string
|
|
@@ -153,17 +150,16 @@ export async function sharedNitroModule(options: {
|
|
|
153
150
|
providers: readonly { name: string; root: string }[]
|
|
154
151
|
answers: { hybridObjects: ReadonlySet<string>; views: ReadonlySet<string> }
|
|
155
152
|
}): Promise<NitroCompiledModule | null> {
|
|
156
|
-
const
|
|
157
|
-
|
|
158
|
-
if (!lock || options.answers.hybridObjects.size > 0 || options.answers.views.size > 0)
|
|
153
|
+
const locked = nitroSupersetLock?.[options.configuration]
|
|
154
|
+
if (!locked || options.answers.hybridObjects.size > 0 || options.answers.views.size > 0)
|
|
159
155
|
return null
|
|
160
156
|
const inputs = nitroSupersetInputs(options)
|
|
161
157
|
for (const [name, value] of Object.entries(inputs))
|
|
162
|
-
if (
|
|
158
|
+
if (locked[name] !== value) return null
|
|
159
|
+
const metadata = await publishedMetadata(
|
|
160
|
+
nitroSupersetUrl(nitroSupersetKey(locked), 'metadata.json'),
|
|
161
|
+
)
|
|
162
|
+
if (!metadata) return null
|
|
163
163
|
const own = new Set(options.providers.map(({ name }) => name))
|
|
164
|
-
|
|
165
|
-
return {
|
|
166
|
-
...lock.metadata,
|
|
167
|
-
packages: lock.metadata.packages.filter(({ name }) => own.has(name)),
|
|
168
|
-
}
|
|
164
|
+
return { ...metadata, packages: metadata.packages.filter(({ name }) => own.has(name)) }
|
|
169
165
|
}
|
|
@@ -6,9 +6,7 @@
|
|
|
6
6
|
import fs from 'node:fs'
|
|
7
7
|
import { createRequire } from 'node:module'
|
|
8
8
|
import path from 'node:path'
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
const answeredPackages: ReadonlySet<string> = new Set(PEACH_ANSWERED_NATIVE_PACKAGE_NAMES)
|
|
9
|
+
import { peachAnsweredNativePackages } from './answeredNativePackages'
|
|
12
10
|
import { swiftCodeMask, swiftSourceClosure } from './swift-compile'
|
|
13
11
|
import { xcodeNativeFlags, xcodeObjCInputs } from './swift-objc-compile'
|
|
14
12
|
import { SWIFT_NATIVE_INPUT_ROOT, SWIFT_NATIVE_SDK_INCLUDE } from './swiftContract'
|
|
@@ -617,7 +615,7 @@ function collectInstalledSwiftBridgeUnits(
|
|
|
617
615
|
const namespacesSeen = new Set(units.map((unit) => unit.namespace))
|
|
618
616
|
for (const packageName of Object.keys(dependencies).sort()) {
|
|
619
617
|
signal?.throwIfAborted()
|
|
620
|
-
if (
|
|
618
|
+
if (peachAnsweredNativePackages().has(packageName)) continue
|
|
621
619
|
let pkgRoot: string | null = null
|
|
622
620
|
try {
|
|
623
621
|
pkgRoot = fs.realpathSync(
|