peachsim 0.1.2702 → 0.1.2703
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/perf-native.ts +100 -58
- 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 +17 -7
- 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-I3ZAV2HM.mjs → acorn-43Q5KRLL.mjs} +3 -3
- package/dist-lib/esm-chunks/{chunk-4W62JNLV.mjs → chunk-3XOKPZGS.mjs} +4 -4
- package/dist-lib/esm-chunks/{chunk-55UUHJIF.mjs → chunk-42K537BB.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-3TVOPWQ4.mjs → chunk-4BMF44KC.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-CTMG6TJS.mjs → chunk-4N7DHUC6.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-OS4FVQQU.mjs → chunk-B3AGCWOJ.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-SR5CKA77.mjs → chunk-DMHSTMXP.mjs} +6 -6
- package/dist-lib/esm-chunks/{chunk-C4ANQZOL.mjs → chunk-F3RRYYLF.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-74IQS3IW.mjs → chunk-GUR2WE4P.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-PYE2SXBC.mjs → chunk-H5ELVRKG.mjs} +5 -5
- package/dist-lib/esm-chunks/{chunk-P5TRIEZT.mjs → chunk-HFPHOP7B.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-RRRO6O3P.mjs → chunk-HXDBQN66.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-OOGBJF7A.mjs → chunk-JZ5XJAXQ.mjs} +2 -2
- package/dist-lib/esm-chunks/{chunk-7ZXSFDJI.mjs → chunk-K2OOA65C.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-ZSMI2FCL.mjs → chunk-KP2NMWWX.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-6Z2YJFQH.mjs → chunk-NFKOUEBN.mjs} +6 -6
- package/dist-lib/esm-chunks/{chunk-B2AJ3NG3.mjs → chunk-NNWFER2D.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-K6PYAFA7.mjs → chunk-ODCTJTKL.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-GY7TSHXT.mjs → chunk-SG3PGG3S.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-ZYLZ676Y.mjs → chunk-SMBH32NF.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-PNFDFXED.mjs → chunk-SOAH7CMP.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-W336OLQN.mjs → chunk-TT3PYTWA.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-AASQZJJD.mjs → chunk-UJSEYJ2F.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-DUBZMBNO.mjs → chunk-VSD7SG36.mjs} +3 -3
- package/dist-lib/esm-chunks/{chunk-7CNNZXLN.mjs → chunk-YF5O3ABY.mjs} +27 -17
- package/dist-lib/esm-chunks/{metro-layout-parser-FRE6D3WN.mjs → metro-layout-parser-UY33H5NJ.mjs} +3 -3
- package/dist-lib/esm-chunks/{swift-package-prebuilt-ZO6ZIEND.mjs → swift-package-prebuilt-H3JZE3QC.mjs} +12 -12
- package/dist-lib/esm-chunks/{swift-sdk-app-module-2CJZ7QH4.mjs → swift-sdk-app-module-FZWIOWZN.mjs} +16 -16
- package/dist-lib/esm-chunks/{swift-sdk-image-RDVAVED4.mjs → swift-sdk-image-7WNTYEJX.mjs} +16 -16
- package/dist-lib/esm-chunks/{swift-sdk-image-producer-HDUM3MGT.mjs → swift-sdk-image-producer-MJD3U6GW.mjs} +5 -5
- package/dist-lib/expo-swift-bundle.cjs +17 -7
- 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 +292 -11
- package/dist-lib/host/fetch-proxy-handler.cjs +3 -3
- 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 +1 -1
- package/dist-lib/native-app-identity-project.mjs +15 -15
- 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 +85 -85
- package/dist-lib/public-origins-lib.json +64 -64
- 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 +292 -11
- package/dist-lib/swift-compile.cjs +14 -4
- package/dist-lib/swift-compile.mjs +12 -12
- 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 +1 -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/acorn.cjs +1 -1
- package/dist-lib/vendor/magic-string.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/{core-abi → shared}/value/kernel-client.d.ts +2 -2
- package/dist-types/packages/peach-engine/src/kernel/kernel.d.ts +1 -1
- package/package.json +1 -1
- package/src/one-native-controls-package.ts +306 -5
- package/src/swift-compile.ts +18 -4
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! peach v0.1.
|
|
1
|
+
/*! peach v0.1.2703 | (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.2703 | (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.2703 | (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.2703 | (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.2703 | (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.2703 | (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.2703 | (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.2703 | (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.2703 | (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.2703 | (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.2703 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
|
|
2
2
|
import {
|
|
3
3
|
parse
|
|
4
|
-
} from "./esm-chunks/chunk-
|
|
4
|
+
} from "./esm-chunks/chunk-SOAH7CMP.mjs";
|
|
5
5
|
import {
|
|
6
6
|
__privateAdd,
|
|
7
7
|
__privateGet,
|
|
8
8
|
__publicField
|
|
9
|
-
} from "./esm-chunks/chunk-
|
|
9
|
+
} from "./esm-chunks/chunk-HFPHOP7B.mjs";
|
|
10
10
|
|
|
11
11
|
// src/worklet-kernel.ts
|
|
12
12
|
var Unsupported = class extends Error {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Kernel, KernelInstruction } from '
|
|
2
|
-
export * from '
|
|
1
|
+
import type { Kernel, KernelInstruction } from './kernelContract.d.ts';
|
|
2
|
+
export * from './kernelContract.d.ts';
|
|
3
3
|
export declare class KernelBuilder implements Kernel {
|
|
4
4
|
#private;
|
|
5
5
|
readonly code: KernelInstruction[];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { type Kernel } from '../../shared/value/kernelContract.d.ts';
|
|
2
|
-
export * from '../../
|
|
2
|
+
export * from '../../shared/value/kernel-client.d.ts';
|
|
3
3
|
export declare function isKernel(value: unknown, inputs?: number): value is Kernel;
|
|
4
4
|
export declare function validKernel(kernel: Kernel, inputs?: number): boolean;
|
package/package.json
CHANGED
|
@@ -1402,6 +1402,298 @@ function shardOneNativeStyleSource(
|
|
|
1402
1402
|
mainDepth += braceDelta(maskedLine)
|
|
1403
1403
|
}
|
|
1404
1404
|
|
|
1405
|
+
const headerText = headerLines.join('\n')
|
|
1406
|
+
const stem = name.slice(0, -'.swift'.length)
|
|
1407
|
+
const dispatchShards = shardOneNativeSDKStyleDispatch(mainLines, headerText, stem)
|
|
1408
|
+
const out: Array<{ name: string; source: string }> = [
|
|
1409
|
+
{ name, source: dispatchShards.mainLines.join('\n') },
|
|
1410
|
+
...dispatchShards.shards,
|
|
1411
|
+
]
|
|
1412
|
+
for (let i = 0; i < buckets.length; i++) {
|
|
1413
|
+
const bucket = buckets[i]!
|
|
1414
|
+
if (bucket.chunks.length === 0) continue
|
|
1415
|
+
const shardBody = bucket.chunks.map((chunk) => chunk.join('\n')).join('\n\n')
|
|
1416
|
+
out.push({
|
|
1417
|
+
name: `${stem}.shard-${String(i).padStart(2, '0')}.swift`,
|
|
1418
|
+
source: `${headerText}\n\nextension View {\n${shardBody}\n}\n`,
|
|
1419
|
+
})
|
|
1420
|
+
}
|
|
1421
|
+
return out
|
|
1422
|
+
}
|
|
1423
|
+
|
|
1424
|
+
// `extension AnyView { func oneNativeSDKStyle(...) }` contains a ~1,000-line
|
|
1425
|
+
// switch over every SDK modifier, leaving OneNativeStyle.swift at ~127 KB on
|
|
1426
|
+
// one swift-frontend worker. Split its switch cases across parallel dispatch
|
|
1427
|
+
// shards while keeping every case body verbatim.
|
|
1428
|
+
function shardOneNativeSDKStyleDispatch(
|
|
1429
|
+
mainLines: string[],
|
|
1430
|
+
headerText: string,
|
|
1431
|
+
stem: string,
|
|
1432
|
+
shardCount = 6,
|
|
1433
|
+
): { mainLines: string[]; shards: Array<{ name: string; source: string }> } {
|
|
1434
|
+
let switchStart = -1
|
|
1435
|
+
let switchEnd = -1
|
|
1436
|
+
let defaultLine = -1
|
|
1437
|
+
for (let i = 0; i < mainLines.length; i++) {
|
|
1438
|
+
if (mainLines[i]!.trim() === 'switch name {') {
|
|
1439
|
+
switchStart = i
|
|
1440
|
+
break
|
|
1441
|
+
}
|
|
1442
|
+
}
|
|
1443
|
+
if (switchStart < 0) return { mainLines, shards: [] }
|
|
1444
|
+
|
|
1445
|
+
const masked = swiftCodeMask(mainLines.join('\n')).split('\n')
|
|
1446
|
+
if (masked.length !== mainLines.length) return { mainLines, shards: [] }
|
|
1447
|
+
const braceDelta = (line: string) => {
|
|
1448
|
+
let delta = 0
|
|
1449
|
+
for (let i = 0; i < line.length; i++) {
|
|
1450
|
+
if (line[i] === '{') delta++
|
|
1451
|
+
else if (line[i] === '}') delta--
|
|
1452
|
+
}
|
|
1453
|
+
return delta
|
|
1454
|
+
}
|
|
1455
|
+
|
|
1456
|
+
let depth = 1
|
|
1457
|
+
for (let i = switchStart + 1; i < mainLines.length; i++) {
|
|
1458
|
+
const trimmed = masked[i]!.trim()
|
|
1459
|
+
if (depth === 1 && trimmed.startsWith('default:')) {
|
|
1460
|
+
defaultLine = i
|
|
1461
|
+
}
|
|
1462
|
+
if (!trimmed.startsWith('#')) {
|
|
1463
|
+
depth += braceDelta(masked[i]!)
|
|
1464
|
+
if (depth === 0) {
|
|
1465
|
+
switchEnd = i
|
|
1466
|
+
break
|
|
1467
|
+
}
|
|
1468
|
+
if (depth < 0) return { mainLines, shards: [] }
|
|
1469
|
+
}
|
|
1470
|
+
}
|
|
1471
|
+
if (switchEnd < 0 || defaultLine < 0) return { mainLines, shards: [] }
|
|
1472
|
+
|
|
1473
|
+
const caseChunks: string[][] = []
|
|
1474
|
+
let current: string[] = []
|
|
1475
|
+
let ifDepth = 0
|
|
1476
|
+
const flush = () => {
|
|
1477
|
+
if (current.length > 0) {
|
|
1478
|
+
caseChunks.push(current)
|
|
1479
|
+
current = []
|
|
1480
|
+
}
|
|
1481
|
+
}
|
|
1482
|
+
for (let i = switchStart + 1; i < defaultLine; i++) {
|
|
1483
|
+
const line = mainLines[i]!
|
|
1484
|
+
const trimmed = masked[i]!.trim()
|
|
1485
|
+
if (ifDepth === 0) {
|
|
1486
|
+
if (trimmed.startsWith('#if ')) {
|
|
1487
|
+
flush()
|
|
1488
|
+
ifDepth++
|
|
1489
|
+
current.push(line)
|
|
1490
|
+
continue
|
|
1491
|
+
}
|
|
1492
|
+
if (trimmed.startsWith('case ')) {
|
|
1493
|
+
flush()
|
|
1494
|
+
current.push(line)
|
|
1495
|
+
continue
|
|
1496
|
+
}
|
|
1497
|
+
if (trimmed === '' && current.length === 0) continue
|
|
1498
|
+
current.push(line)
|
|
1499
|
+
continue
|
|
1500
|
+
}
|
|
1501
|
+
current.push(line)
|
|
1502
|
+
if (trimmed.startsWith('#if ')) ifDepth++
|
|
1503
|
+
else if (trimmed === '#endif') {
|
|
1504
|
+
ifDepth--
|
|
1505
|
+
if (ifDepth < 0) return { mainLines, shards: [] }
|
|
1506
|
+
if (ifDepth === 0) flush()
|
|
1507
|
+
}
|
|
1508
|
+
}
|
|
1509
|
+
if (ifDepth !== 0) return { mainLines, shards: [] }
|
|
1510
|
+
flush()
|
|
1511
|
+
if (caseChunks.length < shardCount * 2) return { mainLines, shards: [] }
|
|
1512
|
+
|
|
1513
|
+
const buckets: Array<{ lines: number; chunks: string[][] }> = Array.from(
|
|
1514
|
+
{ length: shardCount },
|
|
1515
|
+
() => ({ lines: 0, chunks: [] }),
|
|
1516
|
+
)
|
|
1517
|
+
for (const chunk of caseChunks) {
|
|
1518
|
+
let target = buckets[0]!
|
|
1519
|
+
for (const candidate of buckets) {
|
|
1520
|
+
if (candidate.lines < target.lines) target = candidate
|
|
1521
|
+
}
|
|
1522
|
+
target.chunks.push(chunk)
|
|
1523
|
+
target.lines += chunk.length
|
|
1524
|
+
}
|
|
1525
|
+
|
|
1526
|
+
const shards: Array<{ name: string; source: string }> = []
|
|
1527
|
+
const callLines: string[] = []
|
|
1528
|
+
for (let i = 0; i < buckets.length; i++) {
|
|
1529
|
+
const bucket = buckets[i]!
|
|
1530
|
+
if (bucket.chunks.length === 0) continue
|
|
1531
|
+
const fnName = `oneNativeSDKStyleDispatch${i}`
|
|
1532
|
+
const casesBody = bucket.chunks.map((chunk) => chunk.join('\n')).join('\n')
|
|
1533
|
+
shards.push({
|
|
1534
|
+
name: `${stem}.dispatch-${String(i).padStart(2, '0')}.swift`,
|
|
1535
|
+
source: [
|
|
1536
|
+
headerText,
|
|
1537
|
+
'',
|
|
1538
|
+
'extension AnyView {',
|
|
1539
|
+
` func ${fnName}(_ name: String, _ value: String, emit: @escaping (String, String) -> Void) -> AnyView? {`,
|
|
1540
|
+
' var view = self',
|
|
1541
|
+
' switch name {',
|
|
1542
|
+
casesBody,
|
|
1543
|
+
' default: return nil',
|
|
1544
|
+
' }',
|
|
1545
|
+
' return view',
|
|
1546
|
+
' }',
|
|
1547
|
+
'}',
|
|
1548
|
+
'',
|
|
1549
|
+
].join('\n'),
|
|
1550
|
+
})
|
|
1551
|
+
const prefix = callLines.length === 0 ? ' if let next = ' : ' ?? '
|
|
1552
|
+
callLines.push(`${prefix}view.${fnName}(name, value, emit: emit)`)
|
|
1553
|
+
}
|
|
1554
|
+
const defaultBody = mainLines
|
|
1555
|
+
.slice(defaultLine, switchEnd)
|
|
1556
|
+
.map((line, index) =>
|
|
1557
|
+
index === 0 ? line.replace(/^\s*default:\s*/, ' ') : line,
|
|
1558
|
+
)
|
|
1559
|
+
const replacement = [
|
|
1560
|
+
...callLines,
|
|
1561
|
+
' {',
|
|
1562
|
+
' view = next',
|
|
1563
|
+
' } else {',
|
|
1564
|
+
...defaultBody,
|
|
1565
|
+
' }',
|
|
1566
|
+
]
|
|
1567
|
+
const nextMainLines = [
|
|
1568
|
+
...mainLines.slice(0, switchStart),
|
|
1569
|
+
...replacement,
|
|
1570
|
+
...mainLines.slice(switchEnd + 1),
|
|
1571
|
+
]
|
|
1572
|
+
return { mainLines: nextMainLines, shards }
|
|
1573
|
+
}
|
|
1574
|
+
|
|
1575
|
+
// OneNativeAnimationValues.swift is ~117 KB of independent top-level SDK value
|
|
1576
|
+
// decoders (`func oneNativeSDKValue*`). Shard those decoders across balanced
|
|
1577
|
+
// files so SwiftPM compiles them in parallel alongside the OneNativeStyle shards.
|
|
1578
|
+
function shardOneNativeAnimationValuesSource(
|
|
1579
|
+
name: string,
|
|
1580
|
+
source: string,
|
|
1581
|
+
shardCount = 6,
|
|
1582
|
+
): Array<{ name: string; source: string }> {
|
|
1583
|
+
if (name !== 'OneNativeAnimationValues.swift' || source.length < 40_000) {
|
|
1584
|
+
return [{ name, source }]
|
|
1585
|
+
}
|
|
1586
|
+
const masked = swiftCodeMask(source)
|
|
1587
|
+
const lines = source.split('\n')
|
|
1588
|
+
const maskedLines = masked.split('\n')
|
|
1589
|
+
if (lines.length !== maskedLines.length) return [{ name, source }]
|
|
1590
|
+
|
|
1591
|
+
const braceDelta = (line: string) => {
|
|
1592
|
+
let delta = 0
|
|
1593
|
+
for (let i = 0; i < line.length; i++) {
|
|
1594
|
+
if (line[i] === '{') delta++
|
|
1595
|
+
else if (line[i] === '}') delta--
|
|
1596
|
+
}
|
|
1597
|
+
return delta
|
|
1598
|
+
}
|
|
1599
|
+
|
|
1600
|
+
const headerLines: string[] = []
|
|
1601
|
+
let bodyStart = 0
|
|
1602
|
+
let headerIfDepth = 0
|
|
1603
|
+
for (let i = 0; i < lines.length; i++) {
|
|
1604
|
+
const trimmed = maskedLines[i]!.trim()
|
|
1605
|
+
if (trimmed === '') {
|
|
1606
|
+
headerLines.push(lines[i]!)
|
|
1607
|
+
bodyStart = i + 1
|
|
1608
|
+
continue
|
|
1609
|
+
}
|
|
1610
|
+
if (trimmed.startsWith('import ')) {
|
|
1611
|
+
headerLines.push(lines[i]!)
|
|
1612
|
+
bodyStart = i + 1
|
|
1613
|
+
continue
|
|
1614
|
+
}
|
|
1615
|
+
if (trimmed.startsWith('#if ')) {
|
|
1616
|
+
headerIfDepth++
|
|
1617
|
+
headerLines.push(lines[i]!)
|
|
1618
|
+
bodyStart = i + 1
|
|
1619
|
+
continue
|
|
1620
|
+
}
|
|
1621
|
+
if (trimmed === '#endif' && headerIfDepth > 0) {
|
|
1622
|
+
headerIfDepth--
|
|
1623
|
+
headerLines.push(lines[i]!)
|
|
1624
|
+
bodyStart = i + 1
|
|
1625
|
+
continue
|
|
1626
|
+
}
|
|
1627
|
+
if (headerIfDepth > 0 && trimmed.startsWith('#')) {
|
|
1628
|
+
headerLines.push(lines[i]!)
|
|
1629
|
+
bodyStart = i + 1
|
|
1630
|
+
continue
|
|
1631
|
+
}
|
|
1632
|
+
break
|
|
1633
|
+
}
|
|
1634
|
+
if (headerIfDepth !== 0) return [{ name, source }]
|
|
1635
|
+
|
|
1636
|
+
const mainLines: string[] = lines.slice(0, bodyStart)
|
|
1637
|
+
const chunks: string[][] = []
|
|
1638
|
+
let current: string[] = []
|
|
1639
|
+
let depth = 0
|
|
1640
|
+
let ifDepth = 0
|
|
1641
|
+
let chunkSawBrace = false
|
|
1642
|
+
let chunkIsSdkValue = false
|
|
1643
|
+
const flush = () => {
|
|
1644
|
+
if (current.length === 0) return
|
|
1645
|
+
if (chunkIsSdkValue) chunks.push(current)
|
|
1646
|
+
else mainLines.push(...current)
|
|
1647
|
+
current = []
|
|
1648
|
+
chunkSawBrace = false
|
|
1649
|
+
chunkIsSdkValue = false
|
|
1650
|
+
}
|
|
1651
|
+
for (let i = bodyStart; i < lines.length; i++) {
|
|
1652
|
+
const text = lines[i]!
|
|
1653
|
+
const maskedLine = maskedLines[i]!
|
|
1654
|
+
const trimmed = maskedLine.trim()
|
|
1655
|
+
if (current.length === 0 && text.trim() === '') {
|
|
1656
|
+
mainLines.push(text)
|
|
1657
|
+
continue
|
|
1658
|
+
}
|
|
1659
|
+
if (depth === 0 && /^func\s+oneNativeSDKValue\w*\b/.test(trimmed)) {
|
|
1660
|
+
chunkIsSdkValue = true
|
|
1661
|
+
}
|
|
1662
|
+
current.push(text)
|
|
1663
|
+
if (trimmed.startsWith('#if ')) {
|
|
1664
|
+
ifDepth++
|
|
1665
|
+
continue
|
|
1666
|
+
}
|
|
1667
|
+
if (trimmed === '#endif') {
|
|
1668
|
+
ifDepth--
|
|
1669
|
+
if (ifDepth < 0) return [{ name, source }]
|
|
1670
|
+
if (ifDepth === 0 && depth === 0) flush()
|
|
1671
|
+
continue
|
|
1672
|
+
}
|
|
1673
|
+
if (trimmed.startsWith('#')) continue
|
|
1674
|
+
const delta = braceDelta(maskedLine)
|
|
1675
|
+
if (delta !== 0) chunkSawBrace = true
|
|
1676
|
+
depth += delta
|
|
1677
|
+
if (depth < 0) return [{ name, source }]
|
|
1678
|
+
if (ifDepth === 0 && depth === 0 && chunkSawBrace) flush()
|
|
1679
|
+
}
|
|
1680
|
+
if (depth !== 0 || ifDepth !== 0) return [{ name, source }]
|
|
1681
|
+
flush()
|
|
1682
|
+
if (chunks.length < 2) return [{ name, source }]
|
|
1683
|
+
|
|
1684
|
+
const buckets: Array<{ lines: number; chunks: string[][] }> = Array.from(
|
|
1685
|
+
{ length: Math.min(shardCount, chunks.length) },
|
|
1686
|
+
() => ({ lines: 0, chunks: [] }),
|
|
1687
|
+
)
|
|
1688
|
+
for (const chunk of chunks) {
|
|
1689
|
+
let target = buckets[0]!
|
|
1690
|
+
for (const candidate of buckets) {
|
|
1691
|
+
if (candidate.lines < target.lines) target = candidate
|
|
1692
|
+
}
|
|
1693
|
+
target.chunks.push(chunk)
|
|
1694
|
+
target.lines += chunk.length
|
|
1695
|
+
}
|
|
1696
|
+
|
|
1405
1697
|
const headerText = headerLines.join('\n')
|
|
1406
1698
|
const out: Array<{ name: string; source: string }> = [
|
|
1407
1699
|
{ name, source: mainLines.join('\n') },
|
|
@@ -1413,7 +1705,7 @@ function shardOneNativeStyleSource(
|
|
|
1413
1705
|
const shardBody = bucket.chunks.map((chunk) => chunk.join('\n')).join('\n\n')
|
|
1414
1706
|
out.push({
|
|
1415
1707
|
name: `${stem}.shard-${String(i).padStart(2, '0')}.swift`,
|
|
1416
|
-
source: `${headerText}\n\
|
|
1708
|
+
source: `${headerText}\n\n${shardBody}\n`,
|
|
1417
1709
|
})
|
|
1418
1710
|
}
|
|
1419
1711
|
return out
|
|
@@ -1575,7 +1867,13 @@ export async function oneNativeControlsPackage(
|
|
|
1575
1867
|
watched.add(leafMeasurePath)
|
|
1576
1868
|
const files = new Map<string, string>()
|
|
1577
1869
|
for (const [name, source] of controls) {
|
|
1578
|
-
|
|
1870
|
+
const sharded =
|
|
1871
|
+
name === 'OneNativeStyle.swift'
|
|
1872
|
+
? shardOneNativeStyleSource(name, source)
|
|
1873
|
+
: name === 'OneNativeAnimationValues.swift'
|
|
1874
|
+
? shardOneNativeAnimationValuesSource(name, source)
|
|
1875
|
+
: [{ name, source }]
|
|
1876
|
+
for (const shard of sharded) {
|
|
1579
1877
|
files.set('Sources/ControlsCore/' + shard.name, shard.source)
|
|
1580
1878
|
}
|
|
1581
1879
|
const full = paths.get(name)
|
|
@@ -1657,9 +1955,12 @@ export async function oneNativeControlsPackage(
|
|
|
1657
1955
|
const controlSettings = [
|
|
1658
1956
|
'.swiftLanguageMode(.v5)',
|
|
1659
1957
|
...swiftDefines(defines),
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1958
|
+
// OneNativeControlsCore compiles generated SwiftUI wrappers that emit
|
|
1959
|
+
// thousands of actor-isolation warnings per build, stalling stderr I/O.
|
|
1960
|
+
`.unsafeFlags(${JSON.stringify([
|
|
1961
|
+
'-suppress-warnings',
|
|
1962
|
+
...(bindings ? ['-Xfrontend', '-import-module', '-Xfrontend', 'One'] : []),
|
|
1963
|
+
])})`,
|
|
1663
1964
|
]
|
|
1664
1965
|
const hostSettings = hostClangDefines.length
|
|
1665
1966
|
? `, cSettings: [${hostClangDefines.join(', ')}], cxxSettings: [${hostClangDefines.join(', ')}]`
|
package/src/swift-compile.ts
CHANGED
|
@@ -6792,6 +6792,22 @@ const SWIFT_FRAMEWORK_SLOT_RELEASE = '.peach-framework-release'
|
|
|
6792
6792
|
const SWIFT_BUILD_ROOT_SLOTS = 4
|
|
6793
6793
|
const SWIFT_BUILD_ROOT_SHAPE = '.peach-build-shape'
|
|
6794
6794
|
|
|
6795
|
+
// scale framework and build-root pools on large Linux builders (16 on 128-core beast2,
|
|
6796
|
+
// 12 on 96-core beast) so concurrent workers neither serialize on 8 slots nor evict warm commits.
|
|
6797
|
+
function swiftFrameworkSlotCount(unoptimized: boolean): number {
|
|
6798
|
+
const base = unoptimized ? SWIFT_FRAMEWORK_UNOPTIMIZED_SLOTS : SWIFT_FRAMEWORK_SLOTS
|
|
6799
|
+
if (process.platform !== 'linux') return base
|
|
6800
|
+
const cores = os.availableParallelism()
|
|
6801
|
+
return unoptimized
|
|
6802
|
+
? Math.min(8, Math.max(base, Math.floor(cores / 16)))
|
|
6803
|
+
: Math.min(16, Math.max(base, Math.floor(cores / 8)))
|
|
6804
|
+
}
|
|
6805
|
+
|
|
6806
|
+
function swiftBuildRootSlotCount(): number {
|
|
6807
|
+
if (process.platform !== 'linux') return SWIFT_BUILD_ROOT_SLOTS
|
|
6808
|
+
return os.availableParallelism() >= 64 ? 8 : SWIFT_BUILD_ROOT_SLOTS
|
|
6809
|
+
}
|
|
6810
|
+
|
|
6795
6811
|
function swiftFrameworksDir(unoptimized = false): string {
|
|
6796
6812
|
return path.join(
|
|
6797
6813
|
swiftCacheDir(),
|
|
@@ -6828,9 +6844,7 @@ async function withSwiftFrameworkSlot<T>(
|
|
|
6828
6844
|
) => Promise<T | undefined>,
|
|
6829
6845
|
unoptimized = false,
|
|
6830
6846
|
): Promise<T> {
|
|
6831
|
-
const slotCount = unoptimized
|
|
6832
|
-
? SWIFT_FRAMEWORK_UNOPTIMIZED_SLOTS
|
|
6833
|
-
: SWIFT_FRAMEWORK_SLOTS
|
|
6847
|
+
const slotCount = swiftFrameworkSlotCount(unoptimized)
|
|
6834
6848
|
const slotsDir = swiftFrameworksDir(unoptimized)
|
|
6835
6849
|
const slots = Array.from({ length: slotCount }, (_, index) => {
|
|
6836
6850
|
const slot = path.join(slotsDir, `slot-${index}`)
|
|
@@ -6955,7 +6969,7 @@ async function withSwiftBuildRootSlot<T>(
|
|
|
6955
6969
|
signal: AbortSignal | undefined,
|
|
6956
6970
|
work: (slotRoot: string, lease: SwiftRootLease, waitedMs: number) => Promise<T>,
|
|
6957
6971
|
): Promise<T> {
|
|
6958
|
-
const slots = Array.from({ length:
|
|
6972
|
+
const slots = Array.from({ length: swiftBuildRootSlotCount() }, (_, index) => {
|
|
6959
6973
|
const slot = index === 0 ? baseRoot : `${baseRoot}-s${index}`
|
|
6960
6974
|
mkdirSync(slot, { recursive: true })
|
|
6961
6975
|
return slot
|