peachsim 0.1.2438 → 0.1.2440
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +30 -98
- package/cli/app-catalog.ts +4 -73
- package/cli/catalog/content.ts +1 -1
- package/cli/cloud-box-artifact.ts +26 -39
- package/cli/cloud-client.ts +69 -117
- package/cli/cloud-session.ts +2 -9
- package/cli/commands/box.ts +6 -6
- package/cli/commands/control.ts +4 -11
- package/cli/commands/flow.ts +5 -9
- package/cli/commands/kotlin.ts +2 -1
- package/cli/commands/platform.ts +21 -39
- package/cli/commands/record-three.ts +1 -1
- package/cli/commands/shell-url.ts +29 -23
- package/cli/dev-build-freshness.ts +4 -3
- package/cli/native-input.ts +2 -2
- package/cli/outbound-endpoints.ts +20 -45
- package/cli/remote-project-bundle.ts +8 -14
- package/cli/remote-simulators.ts +1 -1
- package/cli/send-to-box.ts +2 -1
- package/detox/jest-preset.cjs +1 -1
- package/detox/jest-transform.cjs +40 -2
- package/dist-lib/agent-daemon-client.cjs +34 -24
- package/dist-lib/agent-events.cjs +1 -1
- package/dist-lib/attached-projects.cjs +19 -17
- package/dist-lib/auth/shared-session.cjs +18 -16
- package/dist-lib/backend-origin.cjs +1 -1
- package/dist-lib/beta.cjs +1 -1
- package/dist-lib/beta.mjs +2 -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 +20 -583
- package/dist-lib/bridge-contract.cjs +1 -1
- package/dist-lib/bridge-contract.mjs +17 -99
- package/dist-lib/bundle-channel.cjs +8743 -5562
- package/dist-lib/capture-contract.cjs +1 -1
- package/dist-lib/capture-contract.mjs +13 -363
- package/dist-lib/cloud-contract.cjs +1 -1
- package/dist-lib/cloud-contract.mjs +34 -155
- package/dist-lib/cloud-test-args.cjs +1 -1
- package/dist-lib/cloud-test-args.mjs +2 -1
- package/dist-lib/cloud.cjs +1 -1
- package/dist-lib/cloud.mjs +26 -155
- package/dist-lib/config.cjs +1 -4
- package/dist-lib/config.mjs +11 -30
- package/dist-lib/detox/index.cjs +2554 -230
- package/dist-lib/detox/jest-preset.cjs +1 -1
- package/dist-lib/detox/jest-transform.cjs +40 -2
- package/dist-lib/dev-bundle-resolution.cjs +1 -1
- package/dist-lib/esm-chunks/acorn-B27MTHKJ.mjs +50 -0
- package/dist-lib/esm-chunks/chunk-4U7IGWPB.mjs +42 -0
- package/dist-lib/esm-chunks/chunk-5CZQZKYU.mjs +10 -0
- package/dist-lib/esm-chunks/chunk-6HFWZJ6C.mjs +115 -0
- package/dist-lib/esm-chunks/chunk-6JGALQD5.mjs +12 -0
- package/dist-lib/esm-chunks/chunk-ADE23YGG.mjs +30 -0
- package/dist-lib/esm-chunks/chunk-D4Z36DQQ.mjs +186 -0
- package/dist-lib/esm-chunks/chunk-EATI62W3.mjs +188 -0
- package/dist-lib/esm-chunks/chunk-H6QIEJRC.mjs +10992 -0
- package/dist-lib/esm-chunks/chunk-HIK3VREC.mjs +1353 -0
- package/dist-lib/esm-chunks/chunk-HP7DHONL.mjs +598 -0
- package/dist-lib/esm-chunks/chunk-PRZI3CFF.mjs +5719 -0
- package/dist-lib/esm-chunks/chunk-QECVPSP3.mjs +10 -0
- package/dist-lib/esm-chunks/chunk-R5FNLCBO.mjs +17 -0
- package/dist-lib/esm-chunks/chunk-RVMUQQWC.mjs +664 -0
- package/dist-lib/esm-chunks/chunk-SJFNKW3W.mjs +57 -0
- package/dist-lib/esm-chunks/chunk-WQISIGIX.mjs +10 -0
- package/dist-lib/esm-chunks/chunk-X6UKJ5AX.mjs +375 -0
- package/dist-lib/esm-chunks/chunk-ZXNBC3PZ.mjs +18959 -0
- package/dist-lib/esm-chunks/metro-layout-parser-ZOI5PO4E.mjs +58 -0
- package/dist-lib/expo-swift-bundle.cjs +7881 -4717
- package/dist-lib/expo-swift-metadata.cjs +1 -1
- package/dist-lib/expo-swift-metadata.mjs +16 -165
- package/dist-lib/home-paths.cjs +1 -1
- package/dist-lib/host/bridge-host.cjs +15685 -11414
- package/dist-lib/host/fetch-proxy-handler.cjs +3928 -343
- package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
- package/dist-lib/host/fetch-proxy-overrides.mjs +2 -1
- package/dist-lib/host/replacement-module-handler.cjs +4 -4
- package/dist-lib/host/websocket-proxy.cjs +1 -1
- package/dist-lib/index.cjs +9145 -32150
- package/dist-lib/jump-to-source-babel.cjs +1 -1
- package/dist-lib/jump-to-source-native.cjs +2 -2
- package/dist-lib/kotlin-host.cjs +260 -253
- package/dist-lib/menu.cjs +1 -1
- package/dist-lib/menu.mjs +5 -13
- package/dist-lib/metro-fingerprint-registry.cjs +1 -1
- package/dist-lib/metro-fingerprint-registry.mjs +5 -6
- package/dist-lib/metro-production-bundle.cjs +22 -3
- package/dist-lib/metro-production-bundle.mjs +26 -92
- package/dist-lib/native-app-identity-project.cjs +664 -452
- package/dist-lib/native-app-identity-project.mjs +509 -2318
- package/dist-lib/native-app-identity.cjs +1 -1
- package/dist-lib/native-app-identity.mjs +27 -1340
- package/dist-lib/native-firebase-metadata.cjs +1 -1
- package/dist-lib/native-firebase-metadata.mjs +5 -18
- package/dist-lib/pdfium-raster.cjs +1 -1
- package/dist-lib/pdfium-raster.mjs +2 -1
- package/dist-lib/plist.cjs +2 -2
- package/dist-lib/plist.mjs +5 -7
- package/dist-lib/profiles.cjs +2 -1
- package/dist-lib/public-brand.cjs +1 -1
- package/dist-lib/public-origins-lib-esm.json +246 -187
- package/dist-lib/public-origins-lib-static.json +1 -1
- package/dist-lib/public-origins-lib.json +1059 -1238
- package/dist-lib/react-native-host-modules.cjs +1 -1
- package/dist-lib/react-native-host-modules.mjs +2 -1
- package/dist-lib/reap-browser.cjs +18 -7
- package/dist-lib/scripts/dev-server-scanner.cjs +6 -230
- package/dist-lib/sdk.cjs +1 -1
- package/dist-lib/sdk.mjs +22 -78
- package/dist-lib/skills.cjs +21694 -17393
- package/dist-lib/swift-compile.cjs +1355 -1322
- package/dist-lib/swift-compile.mjs +68 -19013
- package/dist-lib/swift-package.cjs +1 -1
- package/dist-lib/swift-package.mjs +35 -630
- package/dist-lib/swift-submit.cjs +1 -1
- package/dist-lib/swift-submit.mjs +9 -24
- package/dist-lib/swift-toolchain.cjs +1 -1
- package/dist-lib/swift.cjs +1 -1
- package/dist-lib/vendor/@peculiar/x509.cjs +18061 -0
- package/dist-lib/vendor/acorn.cjs +5699 -0
- package/dist-lib/vendor/bplist-parser.cjs +1589 -0
- package/dist-lib/vendor/ignore.cjs +455 -0
- package/dist-lib/vendor/magic-string.cjs +1693 -0
- package/dist-lib/vendor/plist.cjs +10978 -0
- package/dist-lib/vendor/smol-toml.cjs +768 -0
- package/dist-lib/vendor/stream-json.cjs +1997 -0
- package/dist-lib/vendor/sucrase/dist/index.js.cjs +23593 -0
- package/dist-lib/vendor/sucrase/dist/parser/index.js.cjs +15750 -0
- package/dist-lib/vendor/sucrase/dist/parser/tokenizer/index.js.cjs +11316 -0
- package/dist-lib/vendor/sucrase/dist/parser/tokenizer/types.js.cjs +482 -0
- package/dist-lib/vendor/sucrase.cjs +23593 -0
- package/dist-lib/vendor/terser.cjs +36874 -0
- package/dist-lib/vendor/valibot.cjs +6253 -0
- package/dist-lib/vendor/zod.cjs +23262 -0
- package/dist-lib/worklet-executable.cjs +3 -3
- package/dist-lib/worklet-executable.mjs +11 -16
- package/dist-types/packages/peach-compat/src/stubs/native-seams/react-native-cookies.d.ts +4 -0
- package/dist-types/packages/peach-engine/src/config.d.ts +1 -1
- package/dist-types/packages/peach-engine/src/remote-stream/cloud-display.d.ts +2 -2
- package/dist-types/packages/peach-engine/src/render-worker/protocol.d.ts +9 -0
- package/kotlin/fork/NOTICE +3 -0
- package/kotlin/sdk.tar.gz +0 -0
- package/kotlin/toolchain.json +6 -6
- package/package.json +17 -121
- package/runtime-companion.json +1 -1
- package/scripts/dev-server-scanner.ts +13 -223
- package/sdk/ios/System/Library/Frameworks/Foundation.framework/Headers/NSDateComponentsFormatter.h +1 -1
- package/src/android-autolinking.ts +2 -2
- package/src/bundle-channel.mjs +3 -15
- package/src/cloud-contract.ts +3 -4
- package/src/config.ts +0 -5
- package/src/host/bridge-host.ts +21 -1
- package/src/host/server-scan-handler.ts +1 -9
- package/src/index.ts +0 -2
- package/src/kotlin-host.ts +1 -2
- package/src/kotlinDiscoveryContract.ts +1 -0
- package/src/metro-production-bundle.ts +28 -6
- package/src/native-seam-manifest.ts +0 -13
- package/src/native-slices.ts +1 -1
- package/src/one-native-app-catalog.ts +8 -27
- package/src/one-native-app-config.ts +95 -0
- package/src/one-native-source.ts +250 -0
- package/src/one-widget-metadata.ts +45 -126
- package/src/oneWidgetContract.ts +80 -117
- package/src/serverDiscoveryContract.ts +0 -1
- package/src/simulator-route.ts +8 -0
- package/src/swift-compile.ts +13 -7
- package/src/swift-host.ts +2 -0
- package/src/swift-package-manifest.ts +13 -8
- package/src/vite-plugin.ts +2 -2
- package/src/xcode-project.ts +1 -1
- package/dist-lib/metro.cjs +0 -27984
- package/dist-lib/vite-swift.cjs +0 -43376
- package/dist-lib/vite.cjs +0 -21456
- package/src/androidAutolinkingContract.ts +0 -48
- package/src/androidRootModuleContract.ts +0 -39
- package/src/dev-server-open.ts +0 -92
- package/src/metro-plugin.ts +0 -578
- package/src/one-widget-discovery.ts +0 -23
- package/src/swift-vite-lifetime.ts +0 -42
- package/src/vite-plugin-one.ts +0 -746
- package/src/vite-plugin-swift.ts +0 -225
- package/src/vite.d.ts +0 -10
|
@@ -1,146 +1,63 @@
|
|
|
1
|
-
import { execFile } from 'node:child_process'
|
|
2
1
|
import { createHash } from 'node:crypto'
|
|
3
2
|
import fs from 'node:fs'
|
|
4
|
-
import { createRequire } from 'node:module'
|
|
5
3
|
import path from 'node:path'
|
|
6
|
-
import { promisify } from 'node:util'
|
|
7
|
-
import { PEACH_FORKED_SCRIPT_ENV } from './forked-script-contract'
|
|
8
4
|
import { isRecord } from './is-record'
|
|
5
|
+
import { oneConfigPath, readOneNativeApp } from './one-native-app-config'
|
|
9
6
|
import { isHomeWidgetFamily } from './oneWidgetContract'
|
|
10
7
|
import { readPackageFile } from './swift-source-file'
|
|
11
|
-
import { MAX_SWIFT_COMPILE_SOURCE_BYTES
|
|
8
|
+
import { MAX_SWIFT_COMPILE_SOURCE_BYTES } from './swift-submit'
|
|
12
9
|
import type {
|
|
13
10
|
ConfiguredOneWidget,
|
|
14
11
|
HomeWidgetFamily,
|
|
15
12
|
OneWidgetMetadata,
|
|
16
13
|
} from './oneWidgetContract'
|
|
17
14
|
|
|
18
|
-
const run = promisify(execFile)
|
|
19
15
|
export const ONE_WIDGET_PACKAGE = 'OneWidgets'
|
|
20
16
|
|
|
21
17
|
type WidgetConfig = Omit<OneWidgetMetadata, 'sources' | 'families'>
|
|
22
18
|
|
|
23
|
-
|
|
24
|
-
urlSchemes: string[]
|
|
25
|
-
widget: WidgetConfig | null
|
|
26
|
-
watched: string[]
|
|
27
|
-
stamp: string
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
const configs = new Map<string, ConfigRead>()
|
|
31
|
-
const reads = new Map<string, Promise<ConfigRead>>()
|
|
32
|
-
const CONFIG_CHILD = `
|
|
33
|
-
import fs from 'node:fs';
|
|
34
|
-
import { loadUserOneOptions } from 'one/vite';
|
|
35
|
-
const { config, oneOptions } = await loadUserOneOptions('serve', true);
|
|
36
|
-
const app = oneOptions.native?.app;
|
|
37
|
-
const widgets = app?.ios?.widgets;
|
|
38
|
-
fs.writeFileSync(process.argv[2], JSON.stringify({
|
|
39
|
-
widget: widgets ? { appName: app.name, bundleId: app.ios.bundleId,
|
|
40
|
-
suite: widgets.appGroup, kind: widgets.kind, displayName: widgets.displayName,
|
|
41
|
-
description: widgets.description } : null,
|
|
42
|
-
urlSchemes: app?.scheme === undefined ? [] : Array.isArray(app.scheme) ? app.scheme : [app.scheme],
|
|
43
|
-
watched: [config.path, ...config.dependencies]
|
|
44
|
-
}));
|
|
45
|
-
`
|
|
19
|
+
const nonEmpty = (value: unknown): value is string => typeof value === 'string' && !!value
|
|
46
20
|
|
|
47
|
-
function
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
21
|
+
function readConfig(root: string) {
|
|
22
|
+
const configPath = oneConfigPath(root)
|
|
23
|
+
const app = readOneNativeApp(root)
|
|
24
|
+
const scheme = app?.scheme
|
|
25
|
+
const urlSchemes = scheme === undefined ? [] : Array.isArray(scheme) ? scheme : [scheme]
|
|
26
|
+
if (
|
|
27
|
+
!urlSchemes.every(
|
|
28
|
+
(entry): entry is string =>
|
|
29
|
+
typeof entry === 'string' && /^[A-Za-z][A-Za-z0-9+.-]*$/.test(entry),
|
|
30
|
+
)
|
|
54
31
|
)
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
if (
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
const value: unknown = JSON.parse(fs.readFileSync(result, 'utf8'))
|
|
79
|
-
if (
|
|
80
|
-
!isRecord(value) ||
|
|
81
|
-
!Array.isArray(value.watched) ||
|
|
82
|
-
!value.watched.every((file): file is string => typeof file === 'string')
|
|
83
|
-
)
|
|
84
|
-
throw new Error('One config loader returned invalid dependencies')
|
|
85
|
-
if (
|
|
86
|
-
!Array.isArray(value.urlSchemes) ||
|
|
87
|
-
!value.urlSchemes.every(
|
|
88
|
-
(scheme): scheme is string =>
|
|
89
|
-
typeof scheme === 'string' && /^[A-Za-z][A-Za-z0-9+.-]*$/.test(scheme),
|
|
90
|
-
)
|
|
91
|
-
)
|
|
92
|
-
throw new Error('One config loader returned invalid native.app.scheme')
|
|
93
|
-
let widget: WidgetConfig | null = null
|
|
94
|
-
if (value.widget !== null) {
|
|
95
|
-
const entry = value.widget
|
|
96
|
-
if (
|
|
97
|
-
!isRecord(entry) ||
|
|
98
|
-
typeof entry.appName !== 'string' ||
|
|
99
|
-
!/^[A-Za-z][A-Za-z0-9_]*$/.test(entry.appName) ||
|
|
100
|
-
typeof entry.bundleId !== 'string' ||
|
|
101
|
-
!entry.bundleId ||
|
|
102
|
-
typeof entry.suite !== 'string' ||
|
|
103
|
-
!entry.suite ||
|
|
104
|
-
typeof entry.kind !== 'string' ||
|
|
105
|
-
!entry.kind ||
|
|
106
|
-
typeof entry.displayName !== 'string' ||
|
|
107
|
-
!entry.displayName ||
|
|
108
|
-
typeof entry.description !== 'string' ||
|
|
109
|
-
!entry.description
|
|
110
|
-
)
|
|
111
|
-
throw new Error('One config loader returned invalid native.app.ios.widgets')
|
|
112
|
-
widget = {
|
|
113
|
-
appName: entry.appName,
|
|
114
|
-
bundleId: entry.bundleId,
|
|
115
|
-
suite: entry.suite,
|
|
116
|
-
kind: entry.kind,
|
|
117
|
-
displayName: entry.displayName,
|
|
118
|
-
description: entry.description,
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
const watched = [
|
|
122
|
-
...new Set([
|
|
123
|
-
path.join(root, 'package.json'),
|
|
124
|
-
...value.watched.map((file) => path.resolve(root, file)),
|
|
125
|
-
]),
|
|
126
|
-
]
|
|
127
|
-
const loaded = {
|
|
128
|
-
widget,
|
|
129
|
-
urlSchemes: value.urlSchemes,
|
|
130
|
-
watched,
|
|
131
|
-
stamp: configStamp(watched),
|
|
132
|
-
}
|
|
133
|
-
configs.set(root, loaded)
|
|
134
|
-
return loaded
|
|
135
|
-
} finally {
|
|
136
|
-
fs.rmSync(directory, { recursive: true, force: true })
|
|
32
|
+
throw new Error('One config has an invalid native.app.scheme')
|
|
33
|
+
const ios = isRecord(app?.ios) ? app.ios : null
|
|
34
|
+
const widgets = ios?.widgets
|
|
35
|
+
let widget: WidgetConfig | null = null
|
|
36
|
+
if (widgets !== undefined) {
|
|
37
|
+
if (
|
|
38
|
+
!isRecord(widgets) ||
|
|
39
|
+
typeof app?.name !== 'string' ||
|
|
40
|
+
!/^[A-Za-z][A-Za-z0-9_]*$/.test(app.name) ||
|
|
41
|
+
!nonEmpty(ios?.bundleId) ||
|
|
42
|
+
!nonEmpty(widgets.appGroup) ||
|
|
43
|
+
!nonEmpty(widgets.kind) ||
|
|
44
|
+
!nonEmpty(widgets.displayName) ||
|
|
45
|
+
!nonEmpty(widgets.description)
|
|
46
|
+
)
|
|
47
|
+
throw new Error('One config has an invalid native.app.ios.widgets')
|
|
48
|
+
widget = {
|
|
49
|
+
appName: app.name,
|
|
50
|
+
bundleId: ios.bundleId,
|
|
51
|
+
suite: widgets.appGroup,
|
|
52
|
+
kind: widgets.kind,
|
|
53
|
+
displayName: widgets.displayName,
|
|
54
|
+
description: widgets.description,
|
|
137
55
|
}
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
reads.delete(root)
|
|
56
|
+
}
|
|
57
|
+
return {
|
|
58
|
+
widget,
|
|
59
|
+
urlSchemes,
|
|
60
|
+
watched: [path.join(root, 'package.json'), ...(configPath ? [configPath] : [])],
|
|
144
61
|
}
|
|
145
62
|
}
|
|
146
63
|
|
|
@@ -161,7 +78,7 @@ function declaredFamilies(source: string): HomeWidgetFamily[] {
|
|
|
161
78
|
|
|
162
79
|
export async function readOneWidgetSources(appRoot: string) {
|
|
163
80
|
const root = fs.realpathSync(appRoot)
|
|
164
|
-
const config =
|
|
81
|
+
const config = readConfig(root)
|
|
165
82
|
if (!config.widget) return null
|
|
166
83
|
const widget = config.widget
|
|
167
84
|
const sourceFiles = {
|
|
@@ -209,9 +126,11 @@ export async function readOneWidgetSources(appRoot: string) {
|
|
|
209
126
|
}
|
|
210
127
|
}
|
|
211
128
|
|
|
129
|
+
// `packageUrl` is where the Peach host compiles the generated widget package
|
|
212
130
|
export async function configuredOneWidget(
|
|
213
131
|
appRoot: string,
|
|
214
132
|
bundleUrl: string,
|
|
133
|
+
packageUrl: string,
|
|
215
134
|
): Promise<ConfiguredOneWidget | null> {
|
|
216
135
|
const source = await readOneWidgetSources(appRoot)
|
|
217
136
|
if (!source) return null
|
|
@@ -222,7 +141,7 @@ export async function configuredOneWidget(
|
|
|
222
141
|
.update(JSON.stringify([source.root, source.widget.bundleId]))
|
|
223
142
|
.digest('hex'),
|
|
224
143
|
bundleUrl,
|
|
225
|
-
packageUrl
|
|
144
|
+
packageUrl,
|
|
226
145
|
urlSchemes: source.urlSchemes,
|
|
227
146
|
}
|
|
228
147
|
}
|
package/src/oneWidgetContract.ts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { alignLoopbackBundleUrlWithProbe } from './native-dev-bundle-url'
|
|
2
|
-
|
|
3
1
|
// the Home Screen families a widget configuration can declare in
|
|
4
2
|
// `.supportedFamilies`, in the order SpringBoard's size strip lists them.
|
|
5
3
|
export const HOME_WIDGET_FAMILIES = [
|
|
@@ -34,6 +32,8 @@ export interface OneWidgetPackage {
|
|
|
34
32
|
widget: OneWidgetMetadata
|
|
35
33
|
}
|
|
36
34
|
|
|
35
|
+
export const ONE_WIDGET_PATH = '/__peach/one-widget'
|
|
36
|
+
|
|
37
37
|
// lightweight discovery identity; packageUrl compiles only when placement requests it.
|
|
38
38
|
export interface ConfiguredOneWidget {
|
|
39
39
|
metadata: OneWidgetMetadata
|
|
@@ -52,120 +52,83 @@ function parseUrl(value: string): URL | null {
|
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
const
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
)
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
!Array.isArray(families) ||
|
|
134
|
-
families.length === 0 ||
|
|
135
|
-
!families.every(isHomeWidgetFamily) ||
|
|
136
|
-
!sources ||
|
|
137
|
-
typeof sources !== 'object' ||
|
|
138
|
-
Array.isArray(sources)
|
|
139
|
-
)
|
|
140
|
-
continue
|
|
141
|
-
const sourceHashes: Record<string, string> = {}
|
|
142
|
-
for (const [file, hash] of Object.entries(sources)) {
|
|
143
|
-
if (typeof hash !== 'string' || !/^[a-f0-9]{64}$/.test(hash)) return null
|
|
144
|
-
sourceHashes[file] = hash
|
|
145
|
-
}
|
|
146
|
-
if (
|
|
147
|
-
Object.keys(sourceHashes).length !== 2 ||
|
|
148
|
-
!sourceHashes['ios/OneWidgets/OneWidget.swift'] ||
|
|
149
|
-
!sourceHashes[`ios/${appName}/OneWidgetContract.swift`]
|
|
150
|
-
)
|
|
151
|
-
continue
|
|
152
|
-
return {
|
|
153
|
-
metadata: {
|
|
154
|
-
appName,
|
|
155
|
-
bundleId,
|
|
156
|
-
kind,
|
|
157
|
-
suite,
|
|
158
|
-
displayName,
|
|
159
|
-
description,
|
|
160
|
-
families,
|
|
161
|
-
sources: sourceHashes,
|
|
162
|
-
},
|
|
163
|
-
bundleUrl,
|
|
164
|
-
packageUrl: new URL('/__peach/swift-package/OneWidgets', requested).href,
|
|
165
|
-
projectRoot,
|
|
166
|
-
appIdentity,
|
|
167
|
-
urlSchemes,
|
|
168
|
-
}
|
|
55
|
+
const nonEmpty = (value: unknown): value is string => typeof value === 'string' && !!value
|
|
56
|
+
|
|
57
|
+
export function parseConfiguredOneWidget(value: unknown): ConfiguredOneWidget | null {
|
|
58
|
+
if (!value || typeof value !== 'object') return null
|
|
59
|
+
const metadata: unknown = Reflect.get(value, 'metadata')
|
|
60
|
+
const bundleUrl: unknown = Reflect.get(value, 'bundleUrl')
|
|
61
|
+
const packageUrl: unknown = Reflect.get(value, 'packageUrl')
|
|
62
|
+
const projectRoot: unknown = Reflect.get(value, 'projectRoot')
|
|
63
|
+
const appIdentity: unknown = Reflect.get(value, 'appIdentity')
|
|
64
|
+
const urlSchemes: unknown = Reflect.get(value, 'urlSchemes')
|
|
65
|
+
if (
|
|
66
|
+
typeof bundleUrl !== 'string' ||
|
|
67
|
+
!parseUrl(bundleUrl) ||
|
|
68
|
+
typeof packageUrl !== 'string' ||
|
|
69
|
+
parseUrl(packageUrl)?.pathname !== '/__peach/swift-package/OneWidgets' ||
|
|
70
|
+
!nonEmpty(projectRoot) ||
|
|
71
|
+
typeof appIdentity !== 'string' ||
|
|
72
|
+
!/^[a-f0-9]{64}$/.test(appIdentity) ||
|
|
73
|
+
!Array.isArray(urlSchemes) ||
|
|
74
|
+
!urlSchemes.every(
|
|
75
|
+
(scheme): scheme is string =>
|
|
76
|
+
typeof scheme === 'string' && /^[A-Za-z][A-Za-z0-9+.-]*$/.test(scheme),
|
|
77
|
+
) ||
|
|
78
|
+
!metadata ||
|
|
79
|
+
typeof metadata !== 'object'
|
|
80
|
+
)
|
|
81
|
+
return null
|
|
82
|
+
const appName: unknown = Reflect.get(metadata, 'appName')
|
|
83
|
+
const bundleId: unknown = Reflect.get(metadata, 'bundleId')
|
|
84
|
+
const kind: unknown = Reflect.get(metadata, 'kind')
|
|
85
|
+
const suite: unknown = Reflect.get(metadata, 'suite')
|
|
86
|
+
const displayName: unknown = Reflect.get(metadata, 'displayName')
|
|
87
|
+
const description: unknown = Reflect.get(metadata, 'description')
|
|
88
|
+
const families: unknown = Reflect.get(metadata, 'families')
|
|
89
|
+
const sources: unknown = Reflect.get(metadata, 'sources')
|
|
90
|
+
if (
|
|
91
|
+
typeof appName !== 'string' ||
|
|
92
|
+
!/^[A-Za-z][A-Za-z0-9_]*$/.test(appName) ||
|
|
93
|
+
!nonEmpty(bundleId) ||
|
|
94
|
+
!nonEmpty(kind) ||
|
|
95
|
+
!nonEmpty(suite) ||
|
|
96
|
+
!nonEmpty(displayName) ||
|
|
97
|
+
!nonEmpty(description) ||
|
|
98
|
+
!Array.isArray(families) ||
|
|
99
|
+
families.length === 0 ||
|
|
100
|
+
!families.every(isHomeWidgetFamily) ||
|
|
101
|
+
!sources ||
|
|
102
|
+
typeof sources !== 'object' ||
|
|
103
|
+
Array.isArray(sources)
|
|
104
|
+
)
|
|
105
|
+
return null
|
|
106
|
+
const sourceHashes: Record<string, string> = {}
|
|
107
|
+
for (const [file, hash] of Object.entries(sources)) {
|
|
108
|
+
if (typeof hash !== 'string' || !/^[a-f0-9]{64}$/.test(hash)) return null
|
|
109
|
+
sourceHashes[file] = hash
|
|
110
|
+
}
|
|
111
|
+
if (
|
|
112
|
+
Object.keys(sourceHashes).length !== 2 ||
|
|
113
|
+
!sourceHashes['ios/OneWidgets/OneWidget.swift'] ||
|
|
114
|
+
!sourceHashes[`ios/${appName}/OneWidgetContract.swift`]
|
|
115
|
+
)
|
|
116
|
+
return null
|
|
117
|
+
return {
|
|
118
|
+
metadata: {
|
|
119
|
+
appName,
|
|
120
|
+
bundleId,
|
|
121
|
+
kind,
|
|
122
|
+
suite,
|
|
123
|
+
displayName,
|
|
124
|
+
description,
|
|
125
|
+
families,
|
|
126
|
+
sources: sourceHashes,
|
|
127
|
+
},
|
|
128
|
+
bundleUrl,
|
|
129
|
+
packageUrl,
|
|
130
|
+
projectRoot,
|
|
131
|
+
appIdentity,
|
|
132
|
+
urlSchemes,
|
|
169
133
|
}
|
|
170
|
-
return null
|
|
171
134
|
}
|
|
@@ -28,7 +28,6 @@ export interface DiscoveredServer {
|
|
|
28
28
|
widget?: ConfiguredOneWidget | null
|
|
29
29
|
settingsBundle?: readonly AppSettingsSpecifier[]
|
|
30
30
|
settingsStorageScopeUrl?: string
|
|
31
|
-
patched?: boolean
|
|
32
31
|
/** true when `bundleUrl` was not derived from the server's own manifest —
|
|
33
32
|
* the manifest probe got no answer, so this is the generic `/index.bundle`
|
|
34
33
|
* guess. good enough to list the server; never good enough to open it. see
|
package/src/simulator-route.ts
CHANGED
|
@@ -18,3 +18,11 @@ const SIMULATOR_DOCUMENT_PATH = new RegExp(
|
|
|
18
18
|
export function isPeachSimulatorDocumentPath(pathname: string): boolean {
|
|
19
19
|
return SIMULATOR_DOCUMENT_PATH.test(pathname)
|
|
20
20
|
}
|
|
21
|
+
|
|
22
|
+
export function cloudSimulatorPath(simId: string): string {
|
|
23
|
+
return `/sim/${encodeURIComponent(simId)}`
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export function cloudBoxSimulatorId(boxId: string): string {
|
|
27
|
+
return `${boxId}:sim`
|
|
28
|
+
}
|
package/src/swift-compile.ts
CHANGED
|
@@ -50,9 +50,7 @@ import {
|
|
|
50
50
|
} from './swift-distribution-contract'
|
|
51
51
|
import { foundationCategoryObjects } from './swift-foundation'
|
|
52
52
|
import { compileGuestLink } from './swift-guest-compile'
|
|
53
|
-
import {
|
|
54
|
-
CLANG_TARGET_MODULE_WRAPPER,
|
|
55
|
-
} from './swift-guest-source-inputs'
|
|
53
|
+
import { CLANG_TARGET_MODULE_WRAPPER } from './swift-guest-source-inputs'
|
|
56
54
|
import {
|
|
57
55
|
SWIFT_HEADER_COMPILER_WRAPPER,
|
|
58
56
|
withSwiftHeaderCompiler,
|
|
@@ -6214,6 +6212,7 @@ export function writeSwiftProject(
|
|
|
6214
6212
|
'explicit=',
|
|
6215
6213
|
'prev=',
|
|
6216
6214
|
'cxx=',
|
|
6215
|
+
'plainCxx=',
|
|
6217
6216
|
'cxxModules=',
|
|
6218
6217
|
'for arg in "$@"; do',
|
|
6219
6218
|
' case $arg in -fmodule-name=*) explicit=1 ;; esac',
|
|
@@ -6232,17 +6231,24 @@ export function writeSwiftProject(
|
|
|
6232
6231
|
' fi',
|
|
6233
6232
|
' prev=$arg',
|
|
6234
6233
|
' case $arg in',
|
|
6235
|
-
' *.mm
|
|
6234
|
+
' *.mm) cxx=1 ;;',
|
|
6235
|
+
' *.cpp|*.cc|*.cxx) cxx=1; plainCxx=1 ;;',
|
|
6236
6236
|
' -fno-cxx-modules) cxxModules=off ;;',
|
|
6237
6237
|
' -fcxx-modules) cxxModules=on ;;',
|
|
6238
6238
|
' esac',
|
|
6239
6239
|
'done',
|
|
6240
6240
|
// apple clang claims the toolset's cache path in a c++ unit whose modules
|
|
6241
|
-
// are off; this clang reports it unused
|
|
6241
|
+
// are off; this clang reports it unused and can still import explicit
|
|
6242
|
+
// swiftpm umbrella maps from inside a namespace in plain c++.
|
|
6242
6243
|
'if [ -n "$cxx" ] && [ "$cxxModules" = off ]; then',
|
|
6243
6244
|
' for arg in "$@"; do',
|
|
6244
6245
|
' shift',
|
|
6245
|
-
' case $arg in
|
|
6246
|
+
' case $arg in',
|
|
6247
|
+
' -fmodules-cache-path=*) ;;',
|
|
6248
|
+
' -fmodule-map-file=*/.build/*/*.build/module.modulemap)',
|
|
6249
|
+
' [ -n "$plainCxx" ] || set -- "$@" "$arg" ;;',
|
|
6250
|
+
' *) set -- "$@" "$arg" ;;',
|
|
6251
|
+
' esac',
|
|
6246
6252
|
' done',
|
|
6247
6253
|
'fi',
|
|
6248
6254
|
'if [ -n "$name" ] && [ -z "$explicit" ]; then',
|
|
@@ -8225,7 +8231,7 @@ function compileSwiftProjectOnce(
|
|
|
8225
8231
|
toolchainBin: options.toolchainBin,
|
|
8226
8232
|
swiftCompiler: preparation.headerCompiler
|
|
8227
8233
|
? path.join(root, SWIFT_HEADER_COMPILER_WRAPPER)
|
|
8228
|
-
: compiler.SWIFT_EXEC ?? path.join(options.toolchainBin, 'swiftc'),
|
|
8234
|
+
: (compiler.SWIFT_EXEC ?? path.join(options.toolchainBin, 'swiftc')),
|
|
8229
8235
|
sysroot: swiftSdkPaths(frameworkRoot, options.toolchainBin).sysroot,
|
|
8230
8236
|
sdk: swiftModuleSdk(frameworkRoot),
|
|
8231
8237
|
staticClangTargets: input.staticClangTargets ?? [],
|
package/src/swift-host.ts
CHANGED
|
@@ -2065,6 +2065,8 @@ const RESOURCE_CONTENT_TYPES: Record<string, string> = {
|
|
|
2065
2065
|
'.avif': 'image/avif',
|
|
2066
2066
|
'.bmp': 'image/bmp',
|
|
2067
2067
|
'.gif': 'image/gif',
|
|
2068
|
+
'.heic': 'image/heic',
|
|
2069
|
+
'.heif': 'image/heif',
|
|
2068
2070
|
'.ico': 'image/x-icon',
|
|
2069
2071
|
'.jpeg': 'image/jpeg',
|
|
2070
2072
|
'.jpg': 'image/jpeg',
|
|
@@ -236,6 +236,8 @@ export class SwiftManifestPreparationRequired extends Error {
|
|
|
236
236
|
}
|
|
237
237
|
|
|
238
238
|
function dumpInputs(dir: string) {
|
|
239
|
+
const inheritedEnvironment = { ...process.env }
|
|
240
|
+
const env = swiftEnvironment(inheritedEnvironment)
|
|
239
241
|
const manifests = fs
|
|
240
242
|
.readdirSync(dir)
|
|
241
243
|
.filter((name) => /^Package(@swift-[\d.]+)?\.swift$/.test(name))
|
|
@@ -251,13 +253,16 @@ function dumpInputs(dir: string) {
|
|
|
251
253
|
sha256: createHash('sha256').update(fs.readFileSync(command)).digest('hex'),
|
|
252
254
|
version: execFileSync(command, ['--version'], {
|
|
253
255
|
encoding: 'utf8',
|
|
254
|
-
env
|
|
256
|
+
env,
|
|
255
257
|
stdio: ['ignore', 'pipe', 'pipe'],
|
|
256
258
|
}).trim(),
|
|
257
259
|
}
|
|
258
260
|
cachedToolchain = { fingerprint, value: toolchain }
|
|
261
|
+
const environment = Object.keys(inheritedEnvironment)
|
|
262
|
+
.sort()
|
|
263
|
+
.map((name) => [name, inheritedEnvironment[name]])
|
|
259
264
|
const key = createHash('sha256')
|
|
260
|
-
.update(JSON.stringify([toolchain, path.resolve(dir)]))
|
|
265
|
+
.update(JSON.stringify([toolchain, path.resolve(dir), environment]))
|
|
261
266
|
.update(
|
|
262
267
|
manifests
|
|
263
268
|
.map((name) => `${name}\0${fs.readFileSync(path.join(dir, name), 'utf8')}`)
|
|
@@ -265,14 +270,14 @@ function dumpInputs(dir: string) {
|
|
|
265
270
|
)
|
|
266
271
|
.digest('hex')
|
|
267
272
|
.slice(0, 32)
|
|
268
|
-
return { command, key, toolchain, cached: path.join(cacheDir, `${key}.json`) }
|
|
273
|
+
return { command, env, key, toolchain, cached: path.join(cacheDir, `${key}.json`) }
|
|
269
274
|
}
|
|
270
275
|
|
|
271
276
|
const manifestPreparations = new Map<string, Promise<void>>()
|
|
272
277
|
|
|
273
278
|
export async function prepareSwiftPackageManifest(dir: string): Promise<void> {
|
|
274
279
|
await prepareSwiftManifestToolchain()
|
|
275
|
-
const { command, key, cached } = dumpInputs(dir)
|
|
280
|
+
const { command, env, key, cached } = dumpInputs(dir)
|
|
276
281
|
if (fs.existsSync(cached)) return
|
|
277
282
|
const pending = manifestPreparations.get(key)
|
|
278
283
|
if (pending) return pending
|
|
@@ -291,7 +296,7 @@ export async function prepareSwiftPackageManifest(dir: string): Promise<void> {
|
|
|
291
296
|
scratch,
|
|
292
297
|
'dump-package',
|
|
293
298
|
],
|
|
294
|
-
{ encoding: 'utf8', env
|
|
299
|
+
{ encoding: 'utf8', env, maxBuffer: 64 * 1024 * 1024 },
|
|
295
300
|
)
|
|
296
301
|
const output = path.join(scratch, 'manifest.json')
|
|
297
302
|
await fs.promises.writeFile(output, stdout)
|
|
@@ -326,7 +331,7 @@ function dump(
|
|
|
326
331
|
cachedToolchain?.fingerprint !== toolchainFingerprint(swiftCommand())
|
|
327
332
|
)
|
|
328
333
|
throw new SwiftManifestPreparationRequired(dir)
|
|
329
|
-
const { command, key, toolchain, cached } = dumpInputs(dir)
|
|
334
|
+
const { command, env, key, toolchain, cached } = dumpInputs(dir)
|
|
330
335
|
if (fs.existsSync(cached))
|
|
331
336
|
return { key, toolchain, raw: record(JSON.parse(fs.readFileSync(cached, 'utf8'))) }
|
|
332
337
|
if (requirePrepared) throw new SwiftManifestPreparationRequired(dir)
|
|
@@ -346,7 +351,7 @@ function dump(
|
|
|
346
351
|
],
|
|
347
352
|
{
|
|
348
353
|
encoding: 'utf8',
|
|
349
|
-
env
|
|
354
|
+
env,
|
|
350
355
|
stdio: ['ignore', 'pipe', 'pipe'],
|
|
351
356
|
maxBuffer: 64 * 1024 * 1024,
|
|
352
357
|
},
|
|
@@ -406,7 +411,7 @@ function linksOnPlatform(
|
|
|
406
411
|
// exactly as the source branches it gates do.
|
|
407
412
|
const GUEST_PLATFORMS = ['ios', 'wasi'] as const
|
|
408
413
|
|
|
409
|
-
/** the manifest of the package at `dir`, evaluated
|
|
414
|
+
/** the manifest of the package at `dir`, evaluated per content and caller environment.
|
|
410
415
|
* conditions hold for the guest platforms unless told otherwise; host macro
|
|
411
416
|
* evaluation passes its own. */
|
|
412
417
|
export function swiftPackageManifest(
|
package/src/vite-plugin.ts
CHANGED
|
@@ -508,13 +508,13 @@ function isPathInside(child: string, parent: string): boolean {
|
|
|
508
508
|
export function recordingPluginWorkerRedirect(): Plugin {
|
|
509
509
|
const workerTarget = path.resolve(
|
|
510
510
|
workspaceRoot,
|
|
511
|
-
'packages/peach-
|
|
511
|
+
'packages/peach-engine/plugins/recording/worker.ts',
|
|
512
512
|
)
|
|
513
513
|
return {
|
|
514
514
|
name: 'sootsim-recording-plugin-worker-redirect',
|
|
515
515
|
enforce: 'pre',
|
|
516
516
|
resolveId(source) {
|
|
517
|
-
if (source === '
|
|
517
|
+
if (source === 'peach-engine/recording') {
|
|
518
518
|
return workerTarget
|
|
519
519
|
}
|
|
520
520
|
return null
|
package/src/xcode-project.ts
CHANGED
|
@@ -1869,7 +1869,7 @@ export function selectIosAppTarget(
|
|
|
1869
1869
|
if (projects.length === 0) return null
|
|
1870
1870
|
if (projects.length > 1 && !iosTarget) {
|
|
1871
1871
|
throw new NativeAppTargetSelectionError(
|
|
1872
|
-
`native app identity requires a selected Xcode project;
|
|
1872
|
+
`native app identity requires a selected Xcode project; pass --ios-target with an app target in one of: ${projects.map((entry) => entry.name).join(', ')}`,
|
|
1873
1873
|
)
|
|
1874
1874
|
}
|
|
1875
1875
|
let project = projects[0]!
|