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
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { readFileSync } from 'node:fs'
|
|
2
|
+
import { join } from 'node:path'
|
|
3
|
+
import {
|
|
4
|
+
resolveActiveRuntimeRoot,
|
|
5
|
+
resolveDevCheckoutRuntimeAssetRoot,
|
|
6
|
+
} from './runtime-assets'
|
|
7
|
+
|
|
8
|
+
// the runtime states which installed native packages it answers itself, so a
|
|
9
|
+
// CLI built from newer source never skips compiling one its runtime lacks.
|
|
10
|
+
export const ANSWERED_NATIVE_PACKAGES_PATH = 'node/answered-native-packages.json'
|
|
11
|
+
|
|
12
|
+
// the companion and the answered packages come from the runtime the host
|
|
13
|
+
// serves: inside the dev checkout that is the dev build `build:peachsim:cli`
|
|
14
|
+
// copied them beside, unless PEACH_HOME stages a runtime, as a release replay
|
|
15
|
+
// does inside a builder's checkout
|
|
16
|
+
export function peachRuntimeRoot(): string {
|
|
17
|
+
const root = resolveDevCheckoutRuntimeAssetRoot() ?? resolveActiveRuntimeRoot()
|
|
18
|
+
if (!root) throw new Error('No Peach runtime installed; run `peach runtime install`')
|
|
19
|
+
return root
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
let answered: ReadonlySet<string> | undefined
|
|
23
|
+
|
|
24
|
+
export function peachAnsweredNativePackages(): ReadonlySet<string> {
|
|
25
|
+
if (answered) return answered
|
|
26
|
+
const file = join(peachRuntimeRoot(), ANSWERED_NATIVE_PACKAGES_PATH)
|
|
27
|
+
let names: unknown
|
|
28
|
+
try {
|
|
29
|
+
names = JSON.parse(readFileSync(file, 'utf8'))
|
|
30
|
+
} catch (error) {
|
|
31
|
+
if (error instanceof Error && 'code' in error && error.code === 'ENOENT')
|
|
32
|
+
throw new Error(
|
|
33
|
+
`The active Peach runtime predates ${ANSWERED_NATIVE_PACKAGES_PATH}; run \`peach runtime install\``,
|
|
34
|
+
)
|
|
35
|
+
throw error
|
|
36
|
+
}
|
|
37
|
+
if (!Array.isArray(names) || !names.every((name) => typeof name === 'string'))
|
|
38
|
+
throw new Error(`${file} must list package names`)
|
|
39
|
+
answered = new Set(names)
|
|
40
|
+
return answered
|
|
41
|
+
}
|
package/src/cli-runtime.ts
CHANGED
|
@@ -4,10 +4,7 @@ import { createRequire } from 'node:module'
|
|
|
4
4
|
import { join } from 'node:path'
|
|
5
5
|
import { downloadToFile } from '@contrast/runtime-delivery'
|
|
6
6
|
import companionIdentity from '../runtime-companion.json' with { type: 'json' }
|
|
7
|
-
import {
|
|
8
|
-
resolveActiveRuntimeRoot,
|
|
9
|
-
resolveDevCheckoutRuntimeAssetRoot,
|
|
10
|
-
} from './runtime-assets'
|
|
7
|
+
import { peachRuntimeRoot } from './answeredNativePackages'
|
|
11
8
|
import type * as CliRuntime from '#peach-cli-contract/cli-companion'
|
|
12
9
|
|
|
13
10
|
export const CLI_COMPANION_ABI = 1
|
|
@@ -73,11 +70,7 @@ let loaded: { root: string; runtime: typeof CliRuntime } | undefined
|
|
|
73
70
|
// so host serializers receive their implementation rather than a forwarding closure.
|
|
74
71
|
export function getCliRuntime(): typeof CliRuntime {
|
|
75
72
|
if (loaded) return loaded.runtime
|
|
76
|
-
|
|
77
|
-
// that is the dev build `build:peachsim:cli` copied it beside, unless PEACH_HOME
|
|
78
|
-
// stages a runtime, as a release replay does inside a builder's checkout
|
|
79
|
-
const root = resolveDevCheckoutRuntimeAssetRoot() ?? resolveActiveRuntimeRoot()
|
|
80
|
-
if (!root) throw new Error('No Peach runtime installed; run `peach runtime install`')
|
|
73
|
+
const root = peachRuntimeRoot()
|
|
81
74
|
verifyCliCompanion(root)
|
|
82
75
|
const require = createRequire(import.meta.url)
|
|
83
76
|
const runtime: typeof CliRuntime = require(join(root, cliCompanionPath()))
|
|
@@ -13,6 +13,7 @@ import { homedir } from 'node:os'
|
|
|
13
13
|
import path from 'node:path'
|
|
14
14
|
import { fileURLToPath } from 'node:url'
|
|
15
15
|
import { EXPO_EAGER_NATIVE_VIEWS } from '../../peach-compat/src/stubs/native-seams/expo-eager-seam-contract'
|
|
16
|
+
import { peachAnsweredNativePackages } from './answeredNativePackages'
|
|
16
17
|
import { getCliVersion } from './cli-version'
|
|
17
18
|
import { hashExpoWorkspace } from './expo-native-workspace'
|
|
18
19
|
import { isRecord } from './is-record'
|
|
@@ -53,6 +54,7 @@ function peachPin(): string {
|
|
|
53
54
|
const hash = createHash('sha256')
|
|
54
55
|
hash.update(`${FORMAT}\0${getCliVersion()}\0`)
|
|
55
56
|
hash.update(JSON.stringify([...EXPO_EAGER_NATIVE_VIEWS]))
|
|
57
|
+
hash.update(JSON.stringify([...peachAnsweredNativePackages()].sort()))
|
|
56
58
|
for (const name of PIPELINE_FILES) {
|
|
57
59
|
let bytes: string | null = null
|
|
58
60
|
for (const ext of ['.ts', '.js']) {
|
package/src/expo-kotlin-host.ts
CHANGED
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
// package with a native seam keeps it; one without compiles here.
|
|
5
5
|
import fs from 'node:fs'
|
|
6
6
|
import path from 'node:path'
|
|
7
|
-
import { PEACH_ANSWERED_NATIVE_PACKAGE_NAMES } from '../../peach-compat/src/generated/supported-native-packages'
|
|
8
7
|
import { resolveExpoAndroidAutolinking } from './android-autolinking'
|
|
9
8
|
import {
|
|
10
9
|
androidAppSources,
|
|
@@ -12,6 +11,7 @@ import {
|
|
|
12
11
|
type BridgePackage,
|
|
13
12
|
type BridgeSelection,
|
|
14
13
|
} from './android-bridge-packages'
|
|
14
|
+
import { peachAnsweredNativePackages } from './answeredNativePackages'
|
|
15
15
|
import { isLoopbackHost } from './backend-origin'
|
|
16
16
|
import { isRecord } from './is-record'
|
|
17
17
|
import { peachKotlinModuleRoot } from './kotlin-module'
|
|
@@ -20,8 +20,6 @@ import type { IncomingMessage, ServerResponse } from 'node:http'
|
|
|
20
20
|
|
|
21
21
|
export const EXPO_KOTLIN_ROUTE = '/__peach/expo-kotlin'
|
|
22
22
|
|
|
23
|
-
const answeredPackages: ReadonlySet<string> = new Set(PEACH_ANSWERED_NATIVE_PACKAGE_NAMES)
|
|
24
|
-
|
|
25
23
|
export interface ExpoKotlinModules {
|
|
26
24
|
// the registration names Android's ExpoModulesPackageList passes, in order
|
|
27
25
|
modules: { classifier: string; name: string | null }[]
|
|
@@ -44,6 +42,7 @@ export async function collectExpoKotlinModules(
|
|
|
44
42
|
): Promise<ExpoKotlinProject[] | null> {
|
|
45
43
|
const modules = await resolveExpoAndroidAutolinking(appRoot)
|
|
46
44
|
const result: ExpoKotlinProject[] = []
|
|
45
|
+
let answeredInstalled = false
|
|
47
46
|
for (const entry of modules) {
|
|
48
47
|
// plugin-only dependencies have no local Kotlin module project.
|
|
49
48
|
if (entry.projects === undefined) continue
|
|
@@ -58,11 +57,13 @@ export async function collectExpoKotlinModules(
|
|
|
58
57
|
throw new Error('invalid Expo Android project')
|
|
59
58
|
const sourceDir = fs.realpathSync(project.sourceDir)
|
|
60
59
|
const installed = sourceDir.split(path.sep).includes('node_modules')
|
|
61
|
-
if (
|
|
62
|
-
|
|
63
|
-
(
|
|
64
|
-
|
|
65
|
-
|
|
60
|
+
if (installed) {
|
|
61
|
+
if (typeof entry.packageName !== 'string') continue
|
|
62
|
+
if (peachAnsweredNativePackages().has(entry.packageName)) {
|
|
63
|
+
answeredInstalled = true
|
|
64
|
+
continue
|
|
65
|
+
}
|
|
66
|
+
}
|
|
66
67
|
if (project.modules.length === 0) continue
|
|
67
68
|
const group: ExpoKotlinProject = {
|
|
68
69
|
modules: [],
|
|
@@ -105,7 +106,8 @@ export async function collectExpoKotlinModules(
|
|
|
105
106
|
result.push(group)
|
|
106
107
|
}
|
|
107
108
|
}
|
|
108
|
-
|
|
109
|
+
// an app whose installed modules a seam answers still links native modules.
|
|
110
|
+
return result.length === 0 && !answeredInstalled ? null : result
|
|
109
111
|
}
|
|
110
112
|
|
|
111
113
|
// the app module's ReactPackage classes the application registers
|
package/src/expo-swift-host.ts
CHANGED
|
@@ -9,10 +9,10 @@ import os from 'node:os'
|
|
|
9
9
|
import path from 'node:path'
|
|
10
10
|
import { fileURLToPath } from 'node:url'
|
|
11
11
|
import { promisify } from 'node:util'
|
|
12
|
-
import { PEACH_ANSWERED_NATIVE_PACKAGE_NAMES } from '../../peach-compat/src/generated/supported-native-packages'
|
|
13
12
|
import { EXPO_EAGER_NATIVE_VIEWS } from '../../peach-compat/src/stubs/native-seams/expo-eager-seam-contract'
|
|
14
13
|
import { loadRNXAppConfig } from '../cli/app-config'
|
|
15
14
|
import { resolveAppProject } from '../cli/app-project'
|
|
15
|
+
import { peachAnsweredNativePackages } from './answeredNativePackages'
|
|
16
16
|
import { isLoopbackHost } from './backend-origin'
|
|
17
17
|
import { autolinkerAppleFlags } from './expo-autolinking'
|
|
18
18
|
import {
|
|
@@ -108,7 +108,6 @@ const WITNESS_BATCH = 200
|
|
|
108
108
|
const traceStore = new AsyncLocalStorage<Witness>()
|
|
109
109
|
const discoveryCache = new Map<string, DiscoveryEntry>()
|
|
110
110
|
const preparedCache = new Map<string, PreparedEntry>()
|
|
111
|
-
const answeredPackages: ReadonlySet<string> = new Set(PEACH_ANSWERED_NATIVE_PACKAGE_NAMES)
|
|
112
111
|
|
|
113
112
|
type MissingMark = { missing: true }
|
|
114
113
|
type PresentMark = {
|
|
@@ -1049,6 +1048,7 @@ async function collectExpoSwiftSourcesUncached(
|
|
|
1049
1048
|
const units: ExpoSwiftSourceUnit[] = []
|
|
1050
1049
|
const namespacesSeen = new Set<string>()
|
|
1051
1050
|
const namespaceGroups = new Map<string, string[]>()
|
|
1051
|
+
let answeredInstalled = false
|
|
1052
1052
|
let needsNativeWorkspace = false
|
|
1053
1053
|
let bytes = 0
|
|
1054
1054
|
let fileCount = 0
|
|
@@ -1067,9 +1067,11 @@ async function collectExpoSwiftSourcesUncached(
|
|
|
1067
1067
|
// through the same autolinker-selected route as app-local modules.
|
|
1068
1068
|
if (
|
|
1069
1069
|
canonical.split(path.sep).includes('node_modules') &&
|
|
1070
|
-
|
|
1071
|
-
)
|
|
1070
|
+
peachAnsweredNativePackages().has(packageName)
|
|
1071
|
+
) {
|
|
1072
|
+
answeredInstalled = true
|
|
1072
1073
|
continue
|
|
1074
|
+
}
|
|
1073
1075
|
// the autolinker read these in a child, so the parent can only stamp them
|
|
1074
1076
|
// afterwards. one modified since the child started may be newer than what
|
|
1075
1077
|
// the child consumed, and so may a module directory that gained or lost one.
|
|
@@ -1530,7 +1532,8 @@ async function collectExpoSwiftSourcesUncached(
|
|
|
1530
1532
|
units.push(inlineUnit)
|
|
1531
1533
|
}
|
|
1532
1534
|
}
|
|
1533
|
-
|
|
1535
|
+
// an app whose installed modules a seam answers still links native modules.
|
|
1536
|
+
if (units.length === 0) return answeredInstalled ? [] : null
|
|
1534
1537
|
if (installed)
|
|
1535
1538
|
enrichInstalledUnits(
|
|
1536
1539
|
units,
|
|
@@ -1892,7 +1895,8 @@ async function compileExpoSwiftModulesTraced(
|
|
|
1892
1895
|
}
|
|
1893
1896
|
const units = [...(expoUnits ?? []), ...(bridge?.units ?? [])]
|
|
1894
1897
|
const bridgeFailures = bridge?.failures ?? []
|
|
1895
|
-
if (units.length === 0 && bridgeFailures.length === 0
|
|
1898
|
+
if (units.length === 0 && bridgeFailures.length === 0 && expoUnits === null)
|
|
1899
|
+
return null
|
|
1896
1900
|
report(
|
|
1897
1901
|
`preparing ${units.length} modules: ${units.map((unit) => unit.moduleId).join(', ')}`,
|
|
1898
1902
|
)
|
package/src/nitro-bundle.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import fs from 'node:fs'
|
|
2
2
|
import path from 'node:path'
|
|
3
|
-
import { PEACH_ANSWERED_NATIVE_PACKAGE_NAMES } from '../../peach-compat/src/generated/supported-native-packages'
|
|
4
3
|
import { loadRNXAppConfig } from '../cli/app-config'
|
|
5
4
|
import { resolveAppProject } from '../cli/app-project'
|
|
5
|
+
import { peachAnsweredNativePackages } from './answeredNativePackages'
|
|
6
6
|
import { isLoopbackHost } from './backend-origin'
|
|
7
7
|
import { prepareNativeAppRoot } from './expo-native-workspace'
|
|
8
8
|
import { readIosAppTarget } from './native-app-identity-project'
|
|
@@ -28,18 +28,19 @@ export interface NitroBundle {
|
|
|
28
28
|
assets: CompiledModuleAsset[]
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
const answeredPackages: ReadonlySet<string> = new Set(PEACH_ANSWERED_NATIVE_PACKAGE_NAMES)
|
|
32
|
-
|
|
33
31
|
// the installed iOS Nitro providers an app compiles and the HybridObject names
|
|
34
32
|
// its config answers, or null when none has an original constructor left. a
|
|
35
33
|
// provider Peach answers itself (a seam resolves before the original
|
|
36
34
|
// registration) is not compiled. a HybridObject the app's config answers, a
|
|
37
35
|
// view or an unsupported or file-answered name, registers no original
|
|
38
36
|
// constructor; a provider left with none is not compiled.
|
|
39
|
-
export async function selectCompiledNitroProviders(
|
|
37
|
+
export async function selectCompiledNitroProviders(
|
|
38
|
+
appRoot: string,
|
|
39
|
+
answered = peachAnsweredNativePackages(),
|
|
40
|
+
) {
|
|
40
41
|
const config = await loadRNXAppConfig(resolveAppProject(appRoot))
|
|
41
42
|
const providers = selectNitroProviders(await discoverNitroProviders(appRoot)).filter(
|
|
42
|
-
({ provider }) => !
|
|
43
|
+
({ provider }) => !answered.has(provider.name),
|
|
43
44
|
)
|
|
44
45
|
const registered = new Set(
|
|
45
46
|
providers.flatMap(({ config }) => config.classes.map(({ name }) => name)),
|
|
@@ -73,9 +74,10 @@ export async function compileNitroApp(
|
|
|
73
74
|
moduleRoot?: string,
|
|
74
75
|
shared = true,
|
|
75
76
|
iosTarget?: string,
|
|
77
|
+
answered?: ReadonlySet<string>,
|
|
76
78
|
): Promise<{ metadata: NitroCompiledModule; artifact: SwiftArtifact | null } | null> {
|
|
77
79
|
appRoot = fs.realpathSync(appRoot)
|
|
78
|
-
const selection = await selectCompiledNitroProviders(appRoot)
|
|
80
|
+
const selection = await selectCompiledNitroProviders(appRoot, answered)
|
|
79
81
|
if (!selection) return null
|
|
80
82
|
const { packageRoots, answers } = selection
|
|
81
83
|
let projectRoot = readIosAppTarget(appRoot, iosTarget)
|
|
@@ -4,10 +4,8 @@ import path from 'node:path'
|
|
|
4
4
|
import { swiftCompilerSourceDigest } from './swift-compiler-digest'
|
|
5
5
|
|
|
6
6
|
// the sources that turn providers into the executable. a change to any of them
|
|
7
|
-
// moves the
|
|
8
|
-
//
|
|
9
|
-
// this module imports only digest code, so the lander can run a candidate
|
|
10
|
-
// tree's own copy to address that tree's lock (scripts/lib/land-nitro-lock.ts).
|
|
7
|
+
// moves the shared executable's key (nitro-superset.ts), which main's
|
|
8
|
+
// nitro-superset workflow then publishes.
|
|
11
9
|
export const COMPILER_SOURCES = [
|
|
12
10
|
'nitro-source.ts',
|
|
13
11
|
'nitro-compile.ts',
|