peachsim 0.1.2566 → 0.1.2568
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/login.ts +25 -3
- 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 +6 -6
- 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 +1 -1
- package/dist-lib/dev-bundle-resolution.cjs +1 -1
- package/dist-lib/esm-chunks/{acorn-DYEYOMUU.mjs → acorn-NBSUHIIK.mjs} +3 -3
- package/dist-lib/esm-chunks/{chunk-MRBXBNE3.mjs → chunk-3WYC2MFA.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-VWJJME3B.mjs → chunk-46H2UWDM.mjs} +2 -2
- package/dist-lib/esm-chunks/{chunk-L6NCBYXV.mjs → chunk-6PQHZAWR.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-7P5YYTKQ.mjs → chunk-AGZH4PRD.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-TFVL2N7M.mjs → chunk-CJZPW57C.mjs} +5 -5
- package/dist-lib/esm-chunks/{chunk-HUMH7T2B.mjs → chunk-D4IOJBAQ.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-42GFG6ZP.mjs → chunk-DDE6A6ID.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-EXU7ACFD.mjs → chunk-E2GCX6VF.mjs} +13 -13
- package/dist-lib/esm-chunks/{chunk-HCU5LRRB.mjs → chunk-FSGWSAEC.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-5WMNT2YX.mjs → chunk-GOI7ZDIK.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-TOANLDK6.mjs → chunk-KDHU7QSN.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-2HUTHRHJ.mjs → chunk-KF2EXOW6.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-ZZ2EEXQN.mjs → chunk-LMZUXCDJ.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-3CEFGP34.mjs → chunk-OTSQ5IK6.mjs} +4 -4
- package/dist-lib/esm-chunks/{chunk-A6PD7PFR.mjs → chunk-QMXXFOOH.mjs} +5 -5
- package/dist-lib/esm-chunks/{chunk-VVYYOMUN.mjs → chunk-R7N6XMYT.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-LXUGBB46.mjs → chunk-RJL2J4FZ.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-7HXVR5BK.mjs → chunk-SFKTIJY6.mjs} +3 -3
- package/dist-lib/esm-chunks/{chunk-KZGMDJLS.mjs → chunk-VADUFN2P.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-FFK7YQNG.mjs → chunk-WVVN6VKY.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-W3OR5LAQ.mjs → chunk-XJTY4I2K.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-JWFNIIH4.mjs → chunk-YAO74TBM.mjs} +1 -1
- package/dist-lib/esm-chunks/{metro-layout-parser-V3734W5Z.mjs → metro-layout-parser-PMITIC6E.mjs} +3 -3
- package/dist-lib/esm-chunks/{swift-package-prebuilt-4Z3TXN7U.mjs → swift-package-prebuilt-3XQZC6HL.mjs} +10 -10
- package/dist-lib/esm-chunks/{swift-sdk-app-module-4OI3ZMEC.mjs → swift-sdk-app-module-XWVIQQE6.mjs} +14 -14
- package/dist-lib/esm-chunks/{swift-sdk-image-5GTB5MLE.mjs → swift-sdk-image-TYPSLB2K.mjs} +14 -14
- package/dist-lib/esm-chunks/{swift-sdk-image-producer-JACXDWJI.mjs → swift-sdk-image-producer-TXBWSQQU.mjs} +4 -4
- package/dist-lib/expo-swift-bundle.cjs +5 -5
- 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 +52 -49
- package/dist-lib/host/fetch-proxy-handler.cjs +5 -5
- 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 +3 -3
- 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 +69 -69
- 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 +71 -53
- package/dist-lib/swift-compile.cjs +2 -2
- 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 +8 -1
- 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/package.json +1 -1
- package/src/one-native-controls-package.ts +29 -5
- package/src/one-native-source.ts +22 -46
- package/src/swift-toolchain.ts +6 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! peach v0.1.
|
|
1
|
+
/*! peach v0.1.2568 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
|
|
2
2
|
let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = '', __sootsim_import_meta_filename = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; __sootsim_import_meta_filename = __filename; } catch {}
|
|
3
3
|
"use strict";
|
|
4
4
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! peach v0.1.
|
|
1
|
+
/*! peach v0.1.2568 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
|
|
2
2
|
let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = '', __sootsim_import_meta_filename = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; __sootsim_import_meta_filename = __filename; } catch {}
|
|
3
3
|
"use strict";
|
|
4
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! peach v0.1.
|
|
1
|
+
/*! peach v0.1.2568 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
|
|
2
2
|
let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = '', __sootsim_import_meta_filename = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; __sootsim_import_meta_filename = __filename; } catch {}
|
|
3
3
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
4
|
var __commonJS = (cb, mod) => function __require() {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! peach v0.1.
|
|
1
|
+
/*! peach v0.1.2568 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
|
|
2
2
|
let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = '', __sootsim_import_meta_filename = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; __sootsim_import_meta_filename = __filename; } catch {}
|
|
3
3
|
|
|
4
4
|
// ../../node_modules/valibot/dist/index.cjs
|
package/dist-lib/vendor/ws.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! peach v0.1.
|
|
1
|
+
/*! peach v0.1.2568 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
|
|
2
2
|
let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = '', __sootsim_import_meta_filename = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; __sootsim_import_meta_filename = __filename; } catch {}
|
|
3
3
|
"use strict";
|
|
4
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
package/dist-lib/vendor/zod.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! peach v0.1.
|
|
1
|
+
/*! peach v0.1.2568 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
|
|
2
2
|
let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = '', __sootsim_import_meta_filename = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; __sootsim_import_meta_filename = __filename; } catch {}
|
|
3
3
|
"use strict";
|
|
4
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! peach v0.1.
|
|
1
|
+
/*! peach v0.1.2568 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
|
|
2
2
|
let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = '', __sootsim_import_meta_filename = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; __sootsim_import_meta_filename = __filename; } catch {}
|
|
3
3
|
"use strict";
|
|
4
4
|
var __defProp = Object.defineProperty;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
/*! peach v0.1.
|
|
1
|
+
/*! peach v0.1.2568 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
|
|
2
2
|
import {
|
|
3
3
|
parse
|
|
4
|
-
} from "./esm-chunks/chunk-
|
|
4
|
+
} from "./esm-chunks/chunk-KF2EXOW6.mjs";
|
|
5
5
|
import {
|
|
6
6
|
__privateAdd,
|
|
7
7
|
__privateGet,
|
|
8
8
|
__publicField
|
|
9
|
-
} from "./esm-chunks/chunk-
|
|
9
|
+
} from "./esm-chunks/chunk-KDHU7QSN.mjs";
|
|
10
10
|
|
|
11
11
|
// src/worklet-kernel.ts
|
|
12
12
|
var Unsupported = class extends Error {
|
package/package.json
CHANGED
|
@@ -27,6 +27,7 @@ const ONE_CONTROL_SOURCES = [
|
|
|
27
27
|
'Generated/OneNativeButtonView.swift',
|
|
28
28
|
'Generated/OneNativeLabelView.swift',
|
|
29
29
|
'Generated/OneNativeTextView.swift',
|
|
30
|
+
'Generated/OneNativeImageView.swift',
|
|
30
31
|
'Generated/OneNativeSwiftUI.swift',
|
|
31
32
|
'Generated/OneNativeAnimationValues.swift',
|
|
32
33
|
'Generated/OneNativeEnvironment.swift',
|
|
@@ -42,8 +43,13 @@ const ONE_CONTROL_SOURCES = [
|
|
|
42
43
|
'OneNativeHostingController.swift',
|
|
43
44
|
'OneNativeSlot.swift',
|
|
44
45
|
'OneNativeStyle.swift',
|
|
46
|
+
'OneNativeRemoteImage.swift',
|
|
45
47
|
] as const
|
|
46
48
|
|
|
49
|
+
// One.podspec defines a flag for each SDK version up to the installed one, and the
|
|
50
|
+
// native graph reports NATIVE_GRAPH_SDK_VERSION (27.1) to podspecs
|
|
51
|
+
const ONE_SDK_DEFINES = ['ONE_IOS_27_SDK', 'ONE_IOS_27_1_SDK']
|
|
52
|
+
|
|
47
53
|
const BRIDGE_SWIFT = `import SwiftUI
|
|
48
54
|
@_spi(Peach) import UIKit
|
|
49
55
|
import PeachJSON
|
|
@@ -250,6 +256,20 @@ private struct NavigationStackBridge: UIViewRepresentable {
|
|
|
250
256
|
text.configureStyle(style)
|
|
251
257
|
text.onSDKEvent = visit
|
|
252
258
|
view = text
|
|
259
|
+
case "OneNativeImage":
|
|
260
|
+
let image = views[id] as? OneNativeImageView ?? OneNativeImageView(frame: .zero)
|
|
261
|
+
image.configureAccessibility(label, hint: hint, value: value, identifier: identifier)
|
|
262
|
+
image.configureStyle(style)
|
|
263
|
+
image.configure(
|
|
264
|
+
spec["systemName"] as? String ?? "",
|
|
265
|
+
uri: spec["uri"] as? String ?? "",
|
|
266
|
+
renderingMode: spec["renderingMode"] as? String ?? "original",
|
|
267
|
+
variableValue: spec["variableValue"] as? Double ?? 0,
|
|
268
|
+
hasVariableValue: spec["hasVariableValue"] as? Bool ?? false,
|
|
269
|
+
resizable: spec["resizable"] as? Bool ?? false
|
|
270
|
+
)
|
|
271
|
+
image.onSDKEvent = visit
|
|
272
|
+
view = image
|
|
253
273
|
case "OneNativeContainerSlot":
|
|
254
274
|
let slot = views[id] as? OneNativeContainerSlotView ?? OneNativeContainerSlotView(frame: .zero)
|
|
255
275
|
let host = slots[id] ?? UIView(frame: .zero)
|
|
@@ -376,11 +396,11 @@ private let startupProfileSpec: [String: Any] = [
|
|
|
376
396
|
"children": [
|
|
377
397
|
[
|
|
378
398
|
"id": "profile-cancel-btn",
|
|
379
|
-
"spec": ["control": "OneNativeButton", "
|
|
399
|
+
"spec": ["control": "OneNativeButton", "buttonRole": "cancel"],
|
|
380
400
|
"children": [
|
|
381
401
|
[
|
|
382
402
|
"id": "profile-cancel-label",
|
|
383
|
-
"spec": ["control": "OneNativeLabel", "
|
|
403
|
+
"spec": ["control": "OneNativeLabel", "label": "Cancel", "systemImage": "xmark"],
|
|
384
404
|
"children": [] as [Any],
|
|
385
405
|
],
|
|
386
406
|
],
|
|
@@ -398,11 +418,15 @@ private let startupProfileSpec: [String: Any] = [
|
|
|
398
418
|
"children": [
|
|
399
419
|
[
|
|
400
420
|
"id": "profile-confirm-btn",
|
|
401
|
-
"spec": [
|
|
421
|
+
"spec": [
|
|
422
|
+
"control": "OneNativeButton",
|
|
423
|
+
"buttonRole": "confirm",
|
|
424
|
+
"swiftStyle": ["sdkModifiers": #"[["disabled",true]]"#],
|
|
425
|
+
],
|
|
402
426
|
"children": [
|
|
403
427
|
[
|
|
404
428
|
"id": "profile-confirm-label",
|
|
405
|
-
"spec": ["control": "OneNativeLabel", "
|
|
429
|
+
"spec": ["control": "OneNativeLabel", "label": "Add", "systemImage": "checkmark"],
|
|
406
430
|
"children": [] as [Any],
|
|
407
431
|
],
|
|
408
432
|
],
|
|
@@ -524,7 +548,7 @@ export async function oneNativeControlsPackage(
|
|
|
524
548
|
`// OneNativeControls ${key}`,
|
|
525
549
|
'import PackageDescription',
|
|
526
550
|
`let package = Package(name: "${ONE_NATIVE_CONTROLS_PACKAGE}", platforms: [.iOS(.v17)], targets: [`,
|
|
527
|
-
` .executableTarget(name: "${ONE_NATIVE_CONTROLS_PACKAGE}", path: ".", swiftSettings: [.swiftLanguageMode(.v5)]),`,
|
|
551
|
+
` .executableTarget(name: "${ONE_NATIVE_CONTROLS_PACKAGE}", path: ".", swiftSettings: [.swiftLanguageMode(.v5), ${ONE_SDK_DEFINES.map((flag) => `.define("${flag}")`).join(', ')}]),`,
|
|
528
552
|
'])',
|
|
529
553
|
'',
|
|
530
554
|
].join('\n'),
|
package/src/one-native-source.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import fs from 'node:fs'
|
|
6
6
|
import { createRequire } from 'node:module'
|
|
7
7
|
import path from 'node:path'
|
|
8
|
-
import {
|
|
8
|
+
import { pathToFileURL } from 'node:url'
|
|
9
9
|
import { promisify } from 'node:util'
|
|
10
10
|
import { brotliCompress, constants } from 'node:zlib'
|
|
11
11
|
import { KOTLIN_PACKAGE_PATH } from '@peach/globals/kotlin-discovery'
|
|
@@ -18,7 +18,7 @@ import { ONE_NATIVE_CONTROLS_PACKAGE } from './oneNativeControlsContract'
|
|
|
18
18
|
import { ONE_WIDGET_PATH } from './oneWidgetContract'
|
|
19
19
|
import { swiftPackageMetadata, swiftPackageWatchFiles } from './swift-host'
|
|
20
20
|
import { SWIFT_HMR_PATH, SWIFT_PACKAGE_PATH } from './swift-submit'
|
|
21
|
-
import {
|
|
21
|
+
import { localSwiftModuleRoot } from './swift-toolchain'
|
|
22
22
|
import type { IncomingMessage, ServerResponse } from 'node:http'
|
|
23
23
|
import type { Duplex } from 'node:stream'
|
|
24
24
|
|
|
@@ -36,21 +36,15 @@ interface App {
|
|
|
36
36
|
const apps = new Map<string, App>()
|
|
37
37
|
const compressMetadata = promisify(brotliCompress)
|
|
38
38
|
|
|
39
|
-
|
|
40
|
-
// and its packages compile on Contrast
|
|
41
|
-
function swiftModuleRoot(): string | undefined {
|
|
42
|
-
if (privateSwiftDistributionRoot()) return undefined
|
|
43
|
-
const root = path.resolve(
|
|
44
|
-
path.dirname(fileURLToPath(import.meta.url)),
|
|
45
|
-
'../../sootsim-swift',
|
|
46
|
-
)
|
|
47
|
-
return fs.existsSync(path.join(root, 'toolchain.json')) ? root : undefined
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
function appFor(url: URL, origin: string): App | null {
|
|
39
|
+
function appFor(url: URL, origin: string, allowRootless: boolean): App | null {
|
|
51
40
|
const requested = url.searchParams.get('root')
|
|
52
|
-
if (
|
|
53
|
-
|
|
41
|
+
if (
|
|
42
|
+
requested === null
|
|
43
|
+
? !allowRootless
|
|
44
|
+
: !path.isAbsolute(requested) || !fs.existsSync(requested)
|
|
45
|
+
)
|
|
46
|
+
return null
|
|
47
|
+
const root = requested === null ? '' : fs.realpathSync(requested)
|
|
54
48
|
let app = apps.get(root)
|
|
55
49
|
if (!app) {
|
|
56
50
|
app = {
|
|
@@ -61,6 +55,8 @@ function appFor(url: URL, origin: string): App | null {
|
|
|
61
55
|
active: new Map(),
|
|
62
56
|
}
|
|
63
57
|
apps.set(root, app)
|
|
58
|
+
} else if (!root) {
|
|
59
|
+
app.origin = origin
|
|
64
60
|
}
|
|
65
61
|
return app
|
|
66
62
|
}
|
|
@@ -101,7 +97,7 @@ async function packageMetadata(app: App, packageName: string) {
|
|
|
101
97
|
!builtinControls && packageName === ONE_WIDGET_PACKAGE
|
|
102
98
|
? await oneWidgetPackage(app.root)
|
|
103
99
|
: null
|
|
104
|
-
if (!builtinControls
|
|
100
|
+
if (!builtinControls) app.packages ??= await swiftPackages(app.root)
|
|
105
101
|
if (widget && app.packages?.has(packageName))
|
|
106
102
|
throw new Error(
|
|
107
103
|
`swift package ${packageName} conflicts with One's generated widget extension`,
|
|
@@ -109,7 +105,7 @@ async function packageMetadata(app: App, packageName: string) {
|
|
|
109
105
|
const packagePath =
|
|
110
106
|
builtinControls?.packagePath ?? widget?.packagePath ?? app.packages?.get(packageName)
|
|
111
107
|
if (!packagePath) throw new Error(`swift package ${packageName} was not found`)
|
|
112
|
-
const moduleRoot =
|
|
108
|
+
const moduleRoot = localSwiftModuleRoot()
|
|
113
109
|
const built = await swiftPackageMetadata(
|
|
114
110
|
packagePath,
|
|
115
111
|
packageName,
|
|
@@ -195,31 +191,11 @@ export async function handleOneNativeSourceRequest(
|
|
|
195
191
|
}
|
|
196
192
|
res.setHeader('access-control-allow-origin', req.headers.origin ?? '*')
|
|
197
193
|
res.setHeader('vary', 'origin')
|
|
198
|
-
const
|
|
194
|
+
const packageName = isSwift
|
|
199
195
|
? decodeURIComponent(url.pathname.slice(SWIFT_PACKAGE_PATH.length))
|
|
200
196
|
: null
|
|
201
197
|
const origin = req.headers.host ? `http://${req.headers.host}` : null
|
|
202
|
-
const app =
|
|
203
|
-
origin &&
|
|
204
|
-
(appFor(url, origin) ??
|
|
205
|
-
(builtinControlsName === ONE_NATIVE_CONTROLS_PACKAGE
|
|
206
|
-
? (() => {
|
|
207
|
-
let shared = apps.get('')
|
|
208
|
-
if (!shared) {
|
|
209
|
-
shared = {
|
|
210
|
-
root: '',
|
|
211
|
-
origin,
|
|
212
|
-
sockets: new WebSocketServer({ noServer: true }),
|
|
213
|
-
watched: new Set(),
|
|
214
|
-
active: new Map(),
|
|
215
|
-
}
|
|
216
|
-
apps.set('', shared)
|
|
217
|
-
} else {
|
|
218
|
-
shared.origin = origin
|
|
219
|
-
}
|
|
220
|
-
return shared
|
|
221
|
-
})()
|
|
222
|
-
: null))
|
|
198
|
+
const app = origin && appFor(url, origin, packageName === ONE_NATIVE_CONTROLS_PACKAGE)
|
|
223
199
|
if (!app) {
|
|
224
200
|
res.writeHead(400)
|
|
225
201
|
res.end('missing absolute app root')
|
|
@@ -240,10 +216,7 @@ export async function handleOneNativeSourceRequest(
|
|
|
240
216
|
res.end(JSON.stringify(widget))
|
|
241
217
|
return true
|
|
242
218
|
}
|
|
243
|
-
if (
|
|
244
|
-
const packageName = decodeURIComponent(
|
|
245
|
-
url.pathname.slice(SWIFT_PACKAGE_PATH.length),
|
|
246
|
-
)
|
|
219
|
+
if (packageName !== null) {
|
|
247
220
|
const metadata = await packageMetadata(app, packageName)
|
|
248
221
|
const body = JSON.stringify(metadata)
|
|
249
222
|
const acceptsBrotli = req.headers['accept-encoding']?.split(',').some((value) => {
|
|
@@ -290,8 +263,11 @@ export function handleOneNativeSourceUpgrade(
|
|
|
290
263
|
): boolean {
|
|
291
264
|
const url = new URL(req.url ?? '/', 'http://localhost')
|
|
292
265
|
if (url.pathname !== SWIFT_HMR_PATH) return false
|
|
293
|
-
const app =
|
|
294
|
-
|
|
266
|
+
const app =
|
|
267
|
+
req.headers.host && loopbackClient(req)
|
|
268
|
+
? appFor(url, `http://${req.headers.host}`, true)
|
|
269
|
+
: null
|
|
270
|
+
if (!app) {
|
|
295
271
|
socket.destroy()
|
|
296
272
|
return true
|
|
297
273
|
}
|
package/src/swift-toolchain.ts
CHANGED
|
@@ -292,6 +292,12 @@ export function privateSwiftDistributionRoot(): string | null {
|
|
|
292
292
|
return root ? path.resolve(root) : null
|
|
293
293
|
}
|
|
294
294
|
|
|
295
|
+
export function localSwiftModuleRoot(): string | undefined {
|
|
296
|
+
if (privateSwiftDistributionRoot()) return undefined
|
|
297
|
+
const root = path.resolve(peachsimPackageRoot(), '../sootsim-swift')
|
|
298
|
+
return fs.existsSync(path.join(root, 'toolchain.json')) ? root : undefined
|
|
299
|
+
}
|
|
300
|
+
|
|
295
301
|
// the private distribution's own compiler release: the only one accepted without
|
|
296
302
|
// a qualified archive entry.
|
|
297
303
|
export function privateSwiftCompilerRelease(): string | null {
|