peachsim 0.1.2248 → 0.1.2249
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/bridge-flow-runner.ts +28 -2
- package/cli/commands/inspect/settling.ts +35 -4
- package/cli/drivers/playwright.ts +2 -0
- 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 +150 -40
- 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 +32 -8
- package/dist-lib/dev-bundle-resolution.cjs +1 -1
- package/dist-lib/expo-swift-bundle.cjs +148 -38
- 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 +150 -40
- package/dist-lib/host/fetch-proxy-handler.cjs +4 -4
- 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 +34 -10
- 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 +4 -4
- package/dist-lib/native-app-identity-project.cjs +2 -2
- package/dist-lib/native-app-identity-project.mjs +2 -2
- 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 +53 -53
- 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 +31 -7
- package/dist-lib/sdk.mjs +31 -7
- package/dist-lib/skills.cjs +194 -49
- package/dist-lib/swift-compile.cjs +137 -28
- package/dist-lib/swift-compile.mjs +137 -28
- 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 +146 -36
- package/dist-lib/vite.cjs +4 -4
- package/dist-lib/worklet-executable.cjs +1 -1
- package/dist-lib/worklet-executable.mjs +1 -1
- package/dist-types/packages/peach-engine/src/render-worker/compositor-protocol.d.ts +4 -0
- package/dist-types/packages/peach-engine/src/render-worker/native-ui-protocol.d.ts +1 -0
- package/dist-types/packages/peach-engine/src/render-worker/shell-tree-wire.d.ts +8 -0
- package/dist-types/packages/peach-engine/src/render-worker/webview-capture-protocol.d.ts +1 -0
- package/dist-types/packages/peach-globals/src/globalsContract.d.ts +5 -0
- package/kotlin/sdk.tar.gz +0 -0
- package/package.json +1 -1
- package/runtime-companion.json +1 -1
- package/sdk/ios/wasm/include/math.h +1 -1
- package/sdk/ios/wasm/include/pthread.h +1 -1
- package/src/assetCatalogContract.ts +6 -0
- package/src/sfSymbolMetricsContract.ts +73 -37
- package/src/swift-compile.ts +99 -7
- package/src/swift-guest-image-ledger.ts +10 -5
- package/src/swift-guest-link.ts +20 -14
- package/src/swift-standins.ts +11 -8
- package/src/swift-wasm-prune.ts +30 -0
package/dist-lib/vite-swift.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! peach v0.1.
|
|
1
|
+
/*! peach v0.1.2249 | (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 __create = Object.create;
|
|
@@ -10517,7 +10517,11 @@ function parseWasmObjectBytes(file, buf, isDist, symbolFlagOffsets) {
|
|
|
10517
10517
|
objcClassSymToTypePrefix,
|
|
10518
10518
|
typePrefixesInObj,
|
|
10519
10519
|
rootFuncs,
|
|
10520
|
-
rootSegs
|
|
10520
|
+
rootSegs,
|
|
10521
|
+
segPayloadRanges: sEnds.map((end, i) => [
|
|
10522
|
+
dataStart + sPayloadStarts[i],
|
|
10523
|
+
dataStart + end
|
|
10524
|
+
])
|
|
10521
10525
|
};
|
|
10522
10526
|
}
|
|
10523
10527
|
function parseWasmObjectCached(file, isDist, useCache) {
|
|
@@ -11194,9 +11198,29 @@ function pruneSwiftWasmLink(directory, toolchainBin, moduleRoot, staticClangTarg
|
|
|
11194
11198
|
"$s10Foundation16NSSortDescriptorC7keyPath9ascendingACs03KeyE0Cyxq_G_SbtcSLR_r0_lufC",
|
|
11195
11199
|
"$s10Foundation16NSSortDescriptorC7keyPath9ascendingACs03KeyE0Cyxq_G_SbtcSLR_r0_lufc"
|
|
11196
11200
|
]);
|
|
11201
|
+
const objectBytes = /* @__PURE__ */ new Map();
|
|
11202
|
+
const keepObjCClassesNamedInSegment = (obj, segIdx) => {
|
|
11203
|
+
const range2 = obj.segPayloadRanges[segIdx];
|
|
11204
|
+
if (!range2) return;
|
|
11205
|
+
let bytes = objectBytes.get(obj);
|
|
11206
|
+
if (!bytes) objectBytes.set(obj, bytes = import_node_fs10.default.readFileSync(obj.file));
|
|
11207
|
+
const text5 = bytes.toString("latin1", range2[0], range2[1]);
|
|
11208
|
+
for (const match of text5.matchAll(/So(\d+)/g)) {
|
|
11209
|
+
const start = match.index + 2 + match[1].length;
|
|
11210
|
+
const length = Number(match[1]);
|
|
11211
|
+
if (text5[start + length] !== "C") continue;
|
|
11212
|
+
const symbol2 = `._OBJC_CLASS_${text5.slice(start, start + length)}`;
|
|
11213
|
+
for (const provider of lazyProviders.get(symbol2) ?? []) {
|
|
11214
|
+
eagerDynamicObjects.add(provider);
|
|
11215
|
+
extractObject(provider);
|
|
11216
|
+
activateSymbolInObj(provider, provider.symNames.indexOf(symbol2));
|
|
11217
|
+
}
|
|
11218
|
+
}
|
|
11219
|
+
};
|
|
11197
11220
|
while (workQueue.length > 0) {
|
|
11198
11221
|
const item = workQueue.pop();
|
|
11199
11222
|
const obj = item.obj;
|
|
11223
|
+
if (item.kind === "seg") keepObjCClassesNamedInSegment(obj, item.idx);
|
|
11200
11224
|
let relocs;
|
|
11201
11225
|
if (item.kind === "func") {
|
|
11202
11226
|
relocs = obj.funcRelocs[item.idx];
|
|
@@ -12046,8 +12070,12 @@ function createGuestImageLedger(input) {
|
|
|
12046
12070
|
}
|
|
12047
12071
|
}
|
|
12048
12072
|
}
|
|
12073
|
+
const nameBytes = /* @__PURE__ */ new Map();
|
|
12074
|
+
for (const definition2 of definitions)
|
|
12075
|
+
if (!nameBytes.has(definition2.name))
|
|
12076
|
+
nameBytes.set(definition2.name, Buffer.from(definition2.name));
|
|
12049
12077
|
definitions.sort(
|
|
12050
|
-
(a, b) => Buffer.compare(
|
|
12078
|
+
(a, b) => Buffer.compare(nameBytes.get(a.name), nameBytes.get(b.name)) || a.image - b.image
|
|
12051
12079
|
);
|
|
12052
12080
|
const preserveCanonical = /* @__PURE__ */ new Set();
|
|
12053
12081
|
const definitionsByName = Map.groupBy(definitions, (definition2) => definition2.name);
|
|
@@ -12077,12 +12105,12 @@ function createGuestImageLedger(input) {
|
|
|
12077
12105
|
preserveCanonical.add(name3);
|
|
12078
12106
|
for (const name3 of input.commandLineSymbols ?? []) preserveCanonical.add(name3);
|
|
12079
12107
|
const bindingsByImage = /* @__PURE__ */ new Map();
|
|
12108
|
+
const definitionsByImage = Map.groupBy(definitions, (definition2) => definition2.image);
|
|
12080
12109
|
for (const caller of input.callers) {
|
|
12081
12110
|
const bindings = /* @__PURE__ */ new Map();
|
|
12082
12111
|
const seen = /* @__PURE__ */ new Map();
|
|
12083
12112
|
for (const image of [caller.image, ...caller.next])
|
|
12084
|
-
for (const definition2 of
|
|
12085
|
-
if (definition2.image !== image) continue;
|
|
12113
|
+
for (const definition2 of definitionsByImage.get(image) ?? []) {
|
|
12086
12114
|
const previous = seen.get(definition2.name);
|
|
12087
12115
|
if (previous?.image === definition2.image) {
|
|
12088
12116
|
if (previous.weak && !definition2.weak) {
|
|
@@ -12122,8 +12150,9 @@ function createGuestImageLedger(input) {
|
|
|
12122
12150
|
definitionsByAlias.set(definition2.alias, definition2);
|
|
12123
12151
|
}
|
|
12124
12152
|
const objects = units.map(({ image, object: object4, aliases, functionImports }) => {
|
|
12125
|
-
const
|
|
12126
|
-
|
|
12153
|
+
const shared = bindingsByImage.get(image);
|
|
12154
|
+
const own = startup.get(object4.path);
|
|
12155
|
+
const bindings = own ? new Map([...shared, ...own]) : shared;
|
|
12127
12156
|
for (const [name3, type] of functionImports) {
|
|
12128
12157
|
const alias = bindings.get(name3);
|
|
12129
12158
|
const provider = alias === void 0 ? void 0 : definitionsByAlias.get(alias);
|
|
@@ -13971,6 +14000,7 @@ function linkGuestImages(options) {
|
|
|
13971
14000
|
);
|
|
13972
14001
|
}
|
|
13973
14002
|
const archives = /* @__PURE__ */ new Map();
|
|
14003
|
+
const memberBytes = /* @__PURE__ */ new Map();
|
|
13974
14004
|
const prepare = (provider2) => {
|
|
13975
14005
|
const trace = runLink("discovery", [
|
|
13976
14006
|
...withOutput(args, discovery, true),
|
|
@@ -14014,20 +14044,23 @@ function linkGuestImages(options) {
|
|
|
14014
14044
|
}
|
|
14015
14045
|
const objectsByImage = /* @__PURE__ */ new Map();
|
|
14016
14046
|
for (const image of plan.images) objectsByImage.set(image.id, []);
|
|
14047
|
+
const artifacts = new Map(plan.artifacts.map((artifact) => [artifact.path, artifact]));
|
|
14017
14048
|
for (const item of selected2) {
|
|
14018
|
-
const artifact =
|
|
14019
|
-
(candidate) => candidate.path === item.artifact
|
|
14020
|
-
);
|
|
14049
|
+
const artifact = artifacts.get(item.artifact);
|
|
14021
14050
|
const image = selectedGuestInputImage(artifact, item.member);
|
|
14022
14051
|
let bytes;
|
|
14023
14052
|
if (item.member === null) bytes = import_node_fs14.default.readFileSync(item.artifact);
|
|
14024
14053
|
else {
|
|
14025
|
-
let
|
|
14026
|
-
if (!
|
|
14027
|
-
members2 = readArMembers(import_node_fs14.default.readFileSync(item.artifact));
|
|
14054
|
+
let byName = memberBytes.get(item.artifact);
|
|
14055
|
+
if (!byName) {
|
|
14056
|
+
const members2 = readArMembers(import_node_fs14.default.readFileSync(item.artifact));
|
|
14028
14057
|
archives.set(item.artifact, members2);
|
|
14058
|
+
byName = /* @__PURE__ */ new Map();
|
|
14059
|
+
for (const member of members2)
|
|
14060
|
+
if (!byName.has(member.name)) byName.set(member.name, member.bytes);
|
|
14061
|
+
memberBytes.set(item.artifact, byName);
|
|
14029
14062
|
}
|
|
14030
|
-
bytes =
|
|
14063
|
+
bytes = byName.get(item.member);
|
|
14031
14064
|
}
|
|
14032
14065
|
const objects = objectsByImage.get(image);
|
|
14033
14066
|
if (!objects) throw new Error(`unknown image ${image}`);
|
|
@@ -14060,10 +14093,11 @@ function linkGuestImages(options) {
|
|
|
14060
14093
|
const { selected, ledger } = prepared;
|
|
14061
14094
|
const replacements = /* @__PURE__ */ new Map();
|
|
14062
14095
|
const linkedOwners = /* @__PURE__ */ new Map();
|
|
14096
|
+
const ledgerObjects = new Map(ledger.objects.map((item) => [item.path, item]));
|
|
14063
14097
|
for (const [index, artifact] of plan.artifacts.entries()) {
|
|
14064
14098
|
const prefix = `${artifact.path}(`;
|
|
14065
14099
|
if (artifact.kind === "object") {
|
|
14066
|
-
const object4 =
|
|
14100
|
+
const object4 = ledgerObjects.get(artifact.path);
|
|
14067
14101
|
if (!object4) continue;
|
|
14068
14102
|
const output3 = import_node_path14.default.join(directory, `object-${index}.o`);
|
|
14069
14103
|
import_node_fs14.default.writeFileSync(output3, object4.bytes);
|
|
@@ -14083,9 +14117,7 @@ function linkGuestImages(options) {
|
|
|
14083
14117
|
const output2 = import_node_path14.default.join(directory, `archive-${index}.a`);
|
|
14084
14118
|
const inputs = members2.map((member) => {
|
|
14085
14119
|
const memberOutput = import_node_path14.default.join(memberDir, member.name);
|
|
14086
|
-
const rewritten =
|
|
14087
|
-
(item) => item.path === `${prefix}${member.name})`
|
|
14088
|
-
);
|
|
14120
|
+
const rewritten = ledgerObjects.get(`${prefix}${member.name})`);
|
|
14089
14121
|
import_node_fs14.default.writeFileSync(memberOutput, rewritten?.bytes ?? member.bytes);
|
|
14090
14122
|
if (rewritten) {
|
|
14091
14123
|
linkedOwners.set(
|
|
@@ -14424,10 +14456,13 @@ function selectedGuestSymbolInputs(plan, selected) {
|
|
|
14424
14456
|
else {
|
|
14425
14457
|
let members2 = archives.get(item.artifact);
|
|
14426
14458
|
if (!members2) {
|
|
14427
|
-
members2 =
|
|
14459
|
+
members2 = Map.groupBy(
|
|
14460
|
+
readArMembers(import_node_fs14.default.readFileSync(item.artifact)),
|
|
14461
|
+
(member) => member.name
|
|
14462
|
+
);
|
|
14428
14463
|
archives.set(item.artifact, members2);
|
|
14429
14464
|
}
|
|
14430
|
-
const matching = members2.
|
|
14465
|
+
const matching = members2.get(item.member) ?? [];
|
|
14431
14466
|
if (matching.length !== 1)
|
|
14432
14467
|
throw new Error(
|
|
14433
14468
|
`ambiguous selected symbol input ${item.artifact}(${item.member})`
|
|
@@ -16974,6 +17009,52 @@ var clangInterfaceHeader = (header) => header.replace(/^@import (?:UIKitCore|UIK
|
|
|
16974
17009
|
/^@import (?:CoreFoundation|FoundationNetworking);$/gm,
|
|
16975
17010
|
"@import Foundation;"
|
|
16976
17011
|
).replace(/\b_TtC10Foundation\d+(NS\w+)\b/g, "$1").replace(/\b__attribute__\(\(objc_subclassing_restricted\)\)\s*/g, "");
|
|
17012
|
+
var objcEnumerations = (header) => [
|
|
17013
|
+
...header.matchAll(
|
|
17014
|
+
/^\s*typedef\s+(?:NS|CF|SWIFT)_\w*(?:ENUM|OPTIONS)\w*\s*\(\s*\w+\s*,\s*(\w+)\b/gm
|
|
17015
|
+
)
|
|
17016
|
+
].map((match) => match[1]);
|
|
17017
|
+
function nativelyDeclaredFunctions(generated, headers) {
|
|
17018
|
+
const candidates = [
|
|
17019
|
+
...new Set(
|
|
17020
|
+
[...generated.matchAll(/^\s*SWIFT_EXTERN\b[^(\n]*?\b(\w+)\s*\(/gm)].map(
|
|
17021
|
+
(match) => match[1]
|
|
17022
|
+
)
|
|
17023
|
+
)
|
|
17024
|
+
];
|
|
17025
|
+
if (candidates.length === 0) return [];
|
|
17026
|
+
const declaration = new RegExp(`^[^\\n#/*]*?\\b(${candidates.join("|")})\\s*\\(`, "gm");
|
|
17027
|
+
const found = /* @__PURE__ */ new Set();
|
|
17028
|
+
for (const header of headers)
|
|
17029
|
+
for (const match of header.matchAll(declaration)) found.add(match[1]);
|
|
17030
|
+
return [...found];
|
|
17031
|
+
}
|
|
17032
|
+
var sdkDeclarationOwners = /* @__PURE__ */ new Map();
|
|
17033
|
+
function sdkObjCDeclarationOwners(frameworks) {
|
|
17034
|
+
const known = sdkDeclarationOwners.get(frameworks);
|
|
17035
|
+
if (known) return known;
|
|
17036
|
+
const owners = /* @__PURE__ */ new Map();
|
|
17037
|
+
for (const framework of (0, import_node_fs27.readdirSync)(frameworks))
|
|
17038
|
+
if (framework.endsWith(".framework")) {
|
|
17039
|
+
const headers = import_node_path27.default.join(frameworks, framework, "Headers");
|
|
17040
|
+
if ((0, import_node_fs27.existsSync)(headers)) {
|
|
17041
|
+
for (const file of (0, import_node_fs27.readdirSync)(headers, { recursive: true, encoding: "utf8" }))
|
|
17042
|
+
if (file.endsWith(".h")) {
|
|
17043
|
+
const header = (0, import_node_fs27.readFileSync)(import_node_path27.default.join(headers, file), "utf8");
|
|
17044
|
+
for (const name3 of [
|
|
17045
|
+
...swiftInterfaceDeclarations(header),
|
|
17046
|
+
...objcEnumerations(header),
|
|
17047
|
+
...[
|
|
17048
|
+
...header.matchAll(/^[A-Z_]*_(?:EXTERN|EXPORT)\b[^;(\n]*?\b(\w+)\s*\(/gm)
|
|
17049
|
+
].map((match) => match[1])
|
|
17050
|
+
])
|
|
17051
|
+
owners.set(name3, framework.slice(0, -".framework".length));
|
|
17052
|
+
}
|
|
17053
|
+
}
|
|
17054
|
+
}
|
|
17055
|
+
sdkDeclarationOwners.set(frameworks, owners);
|
|
17056
|
+
return owners;
|
|
17057
|
+
}
|
|
16977
17058
|
function swiftHeaderWithSuperclassImports(header, interfaceFor) {
|
|
16978
17059
|
const superclasses = new Set(
|
|
16979
17060
|
[...header.matchAll(/@interface\s+\w+\s*:\s*(\w+)/g)].map((match) => match[1])
|
|
@@ -17018,6 +17099,10 @@ function withoutSwiftDeclarations(text5, declared, interfaceImport) {
|
|
|
17018
17099
|
const name3 = /^\s*(?:[A-Z_]\w*(?:\([^()\n]*\))?\s+)*@(?:protocol|interface)\s+(\w+)\s*(?=[:<{]|$)/.exec(
|
|
17019
17100
|
line
|
|
17020
17101
|
)?.[1];
|
|
17102
|
+
const external = /^\s*SWIFT_EXTERN\b[^(\n]*?\b(\w+)\s*\(.*\)[^;\n]*;\s*$/.exec(
|
|
17103
|
+
line
|
|
17104
|
+
)?.[1];
|
|
17105
|
+
if (external && declared.has(external)) continue;
|
|
17021
17106
|
const enumeration = /^\s*typedef\s+(?:NS_ENUM|NS_OPTIONS|SWIFT_ENUM(?:_NAMED)?)\s*\(\s*\w+\s*,\s*(\w+)\b/.exec(
|
|
17022
17107
|
line
|
|
17023
17108
|
)?.[1];
|
|
@@ -17844,7 +17929,7 @@ var darwinRecordsRegion = (quoted2) => quoted2.length ? ["-Wl,--start-lib", ...q
|
|
|
17844
17929
|
var REACTOR_FLAG = '"-Xclang-linker", "-mexec-model=reactor",\n';
|
|
17845
17930
|
var MULTI_MANIFEST_VERSION = 68;
|
|
17846
17931
|
var SWIFT_HEADER_PRODUCTS_TARGET = "PeachHeaderProducts";
|
|
17847
|
-
var compilerSourceDigest = true ? "
|
|
17932
|
+
var compilerSourceDigest = true ? "660487c29d9a45fcb5a83e23f25f239be6cc1cc7338a3a2c2f756a4c985ae043" : swiftCompilerSourceDigest(__sootsim_import_meta_dirname);
|
|
17848
17933
|
function swiftArtifactHash(input, release, moduleRoot) {
|
|
17849
17934
|
const hash = (0, import_node_crypto13.createHash)("sha256");
|
|
17850
17935
|
hash.update(`swift-compile
|
|
@@ -22085,11 +22170,28 @@ function compileSwiftProjectOnce(input, options) {
|
|
|
22085
22170
|
))
|
|
22086
22171
|
declared.add(name4);
|
|
22087
22172
|
}
|
|
22088
|
-
const
|
|
22173
|
+
const own = withoutSwiftDeclarations(
|
|
22089
22174
|
clangInterfaceHeader((0, import_node_fs27.readFileSync)(source, "utf8")),
|
|
22090
22175
|
declared,
|
|
22091
22176
|
`#import <${name3}/${name3}.h>`
|
|
22092
22177
|
);
|
|
22178
|
+
const owners = sdkObjCDeclarationOwners(import_node_path27.default.dirname(import_node_path27.default.dirname(headers)));
|
|
22179
|
+
const foreign = /* @__PURE__ */ new Map();
|
|
22180
|
+
for (const declaration of [
|
|
22181
|
+
...swiftInterfaceDeclarations(own),
|
|
22182
|
+
...objcEnumerations(own),
|
|
22183
|
+
...[...own.matchAll(/^\s*SWIFT_EXTERN\b[^(\n]*?\b(\w+)\s*\(/gm)].map(
|
|
22184
|
+
(match) => match[1]
|
|
22185
|
+
)
|
|
22186
|
+
]) {
|
|
22187
|
+
const owner = owners.get(declaration);
|
|
22188
|
+
if (owner && owner !== name3) foreign.set(declaration, owner);
|
|
22189
|
+
}
|
|
22190
|
+
const header = foreign.size ? withoutSwiftDeclarations(
|
|
22191
|
+
own,
|
|
22192
|
+
new Set(foreign.keys()),
|
|
22193
|
+
[...new Set(foreign.values())].map((owner) => `#import <${owner}/${owner}.h>`).join("\n")
|
|
22194
|
+
) : own;
|
|
22093
22195
|
const value = {
|
|
22094
22196
|
file: import_node_path27.default.join(root, ".build/peach-framework-objc", `${name3}-Swift.h`),
|
|
22095
22197
|
header,
|
|
@@ -22126,18 +22228,25 @@ function compileSwiftProjectOnce(input, options) {
|
|
|
22126
22228
|
`${producer}-Swift.h`
|
|
22127
22229
|
);
|
|
22128
22230
|
const original = preparation.nativeHeaderDeclarations[producer] ? emitted.replace(/-Swift\.h$/, "-Swift.original.h") : emitted;
|
|
22129
|
-
if ((0, import_node_fs27.existsSync)(original))
|
|
22231
|
+
if ((0, import_node_fs27.existsSync)(original)) {
|
|
22232
|
+
const generated = clangInterfaceHeader((0, import_node_fs27.readFileSync)(original, "utf8"));
|
|
22130
22233
|
writeBuildFile(
|
|
22131
22234
|
emitted,
|
|
22132
22235
|
withoutSwiftDeclarations(
|
|
22133
|
-
swiftHeaderWithSuperclassImports(
|
|
22134
|
-
|
|
22135
|
-
|
|
22136
|
-
|
|
22137
|
-
|
|
22236
|
+
swiftHeaderWithSuperclassImports(generated, frameworkInterface),
|
|
22237
|
+
/* @__PURE__ */ new Set([
|
|
22238
|
+
...preparation.nativeHeaderDeclarations[producer] ?? [],
|
|
22239
|
+
...nativelyDeclaredFunctions(
|
|
22240
|
+
generated,
|
|
22241
|
+
Object.entries(input.files).filter(
|
|
22242
|
+
([name3]) => name3.endsWith(".h") && !name3.endsWith("-Swift.h")
|
|
22243
|
+
).map(([, source]) => source)
|
|
22244
|
+
)
|
|
22245
|
+
]),
|
|
22138
22246
|
`#import <${producer}/${producer}.h>`
|
|
22139
22247
|
)
|
|
22140
22248
|
);
|
|
22249
|
+
}
|
|
22141
22250
|
}
|
|
22142
22251
|
}
|
|
22143
22252
|
const checkpoints = import_node_path27.default.join(
|
|
@@ -31361,7 +31470,7 @@ function sourceClosureDigest(srcDir, entrypoints) {
|
|
|
31361
31470
|
return hash.digest("hex");
|
|
31362
31471
|
}
|
|
31363
31472
|
var standinSourceDigest = (srcDir = __sootsim_import_meta_dirname) => sourceClosureDigest(srcDir, STANDIN_DIGEST_ENTRYPOINTS);
|
|
31364
|
-
var STANDIN_SOURCE_DIGEST = true ? "
|
|
31473
|
+
var STANDIN_SOURCE_DIGEST = true ? "089050e56f3e4935fed286174446973ff56c0fb4ee8c326f19a71b9fecbe9d05" : standinSourceDigest();
|
|
31365
31474
|
|
|
31366
31475
|
// src/swift-standins.ts
|
|
31367
31476
|
var import_node_child_process31 = require("node:child_process");
|
|
@@ -32503,9 +32612,9 @@ function exec(file, args, cwd) {
|
|
|
32503
32612
|
}
|
|
32504
32613
|
function failure(error) {
|
|
32505
32614
|
const output2 = error && typeof error === "object" && "stderr" in error ? `${String(error.stderr)}
|
|
32506
|
-
${"stdout" in error ? String(error.stdout) : ""}` : String(error);
|
|
32507
|
-
const errors = output2.split("\n").filter((line) =>
|
|
32508
|
-
return [...new Set(errors)].slice(0, 3).join("; ") || output2.trim().slice(
|
|
32615
|
+
${"stdout" in error ? String(error.stdout) : ""}` : error instanceof Error ? error.message : String(error);
|
|
32616
|
+
const errors = output2.split("\n").filter((line) => /^(\S.*?:\d+:\d+: )?error:/.test(line)).map((line) => line.replace(/^(.*?:\d+:\d+: )?error:\s*/, "").trim());
|
|
32617
|
+
return [...new Set(errors)].slice(0, 3).join("; ") || output2.trim().slice(-600);
|
|
32509
32618
|
}
|
|
32510
32619
|
var key = (...parts) => (0, import_node_crypto25.createHash)("sha256").update(parts.join("\0")).digest("hex").slice(0, 32);
|
|
32511
32620
|
var digests = /* @__PURE__ */ new Map();
|
|
@@ -33023,6 +33132,8 @@ function peachModuleDirs(toolchain, imports2, sdkIncludes) {
|
|
|
33023
33132
|
target,
|
|
33024
33133
|
"-Xswiftc",
|
|
33025
33134
|
"-Osize",
|
|
33135
|
+
"-Xswiftc",
|
|
33136
|
+
"-gnone",
|
|
33026
33137
|
...plugins.libraries.flatMap((library) => [
|
|
33027
33138
|
"-Xswiftc",
|
|
33028
33139
|
"-load-plugin-library",
|
|
@@ -34676,10 +34787,9 @@ ${roots.map((file) => ` header "${file}"`).join("\n")}
|
|
|
34676
34787
|
) : binary.cxxHeaders ? await cxxStandin(surface, binary, toolchain, dir) : cStandin(surface, binary, toolchain, dir)
|
|
34677
34788
|
);
|
|
34678
34789
|
} catch (error) {
|
|
34679
|
-
throw new Error(
|
|
34680
|
-
|
|
34681
|
-
|
|
34682
|
-
);
|
|
34790
|
+
throw new Error(`no stand-in for ${surface.module}: ${failure(error)}`, {
|
|
34791
|
+
cause: error
|
|
34792
|
+
});
|
|
34683
34793
|
}
|
|
34684
34794
|
}
|
|
34685
34795
|
publish(result);
|
package/dist-lib/vite.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! peach v0.1.
|
|
1
|
+
/*! peach v0.1.2249 | (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 __create = Object.create;
|
|
@@ -1058,7 +1058,7 @@ var init_src = __esm({
|
|
|
1058
1058
|
var runtime_companion_default;
|
|
1059
1059
|
var init_runtime_companion = __esm({
|
|
1060
1060
|
"runtime-companion.json"() {
|
|
1061
|
-
runtime_companion_default = { abi: 1, sha256: "
|
|
1061
|
+
runtime_companion_default = { abi: 1, sha256: "0576baa8f64749f044d1fee413b30d3459d6a2a5caf1435ecc04500a7031bf93", file: "node/cli-0576baa8f64749f044d1fee413b30d3459d6a2a5caf1435ecc04500a7031bf93.cjs" };
|
|
1062
1062
|
}
|
|
1063
1063
|
});
|
|
1064
1064
|
|
|
@@ -3160,7 +3160,7 @@ var import_plist5 = __toESM(require("plist"), 1);
|
|
|
3160
3160
|
init_answeredNativePackages();
|
|
3161
3161
|
|
|
3162
3162
|
// src/swift-standin-digest.ts
|
|
3163
|
-
var STANDIN_SOURCE_DIGEST = true ? "
|
|
3163
|
+
var STANDIN_SOURCE_DIGEST = true ? "089050e56f3e4935fed286174446973ff56c0fb4ee8c326f19a71b9fecbe9d05" : standinSourceDigest();
|
|
3164
3164
|
|
|
3165
3165
|
// cli/commands/detect.ts
|
|
3166
3166
|
var import_json5 = __toESM(require_lib(), 1);
|
|
@@ -6292,7 +6292,7 @@ var FOUNDATION_IMPLICIT_MODULES = [
|
|
|
6292
6292
|
var FOUNDATION_IMPLICIT_FLAGS = FOUNDATION_IMPLICIT_MODULES.map(
|
|
6293
6293
|
(module2) => `, "-Xfrontend", "-import-module", "-Xfrontend", "${module2}"`
|
|
6294
6294
|
).join("");
|
|
6295
|
-
var compilerSourceDigest = true ? "
|
|
6295
|
+
var compilerSourceDigest = true ? "660487c29d9a45fcb5a83e23f25f239be6cc1cc7338a3a2c2f756a4c985ae043" : swiftCompilerSourceDigest2(__sootsim_import_meta_dirname);
|
|
6296
6296
|
var CORE_FOUNDATION_HANDLE_IMPORTS = [
|
|
6297
6297
|
"CFAllocator",
|
|
6298
6298
|
"CFArray",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! peach v0.1.
|
|
1
|
+
/*! peach v0.1.2249 | (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;
|
|
@@ -1243,6 +1243,10 @@ export type CompositorHostToWorker = {
|
|
|
1243
1243
|
} | {
|
|
1244
1244
|
type: 'webViewCaptureStream';
|
|
1245
1245
|
port: MessagePort;
|
|
1246
|
+
} | {
|
|
1247
|
+
type: 'webViewSnapshot';
|
|
1248
|
+
view: import('./webview-capture-protocol.d.ts').WebViewSnapshotTarget;
|
|
1249
|
+
bitmap: ImageBitmap | null;
|
|
1246
1250
|
} | {
|
|
1247
1251
|
type: 'animationClock';
|
|
1248
1252
|
snapshot: AnimationClockSnapshot;
|
|
@@ -6,6 +6,13 @@ import type { SootSimNodeType } from '../engine/types.d.ts';
|
|
|
6
6
|
import type { LayoutAnimationConfig } from '../react-native/layout-animation.d.ts';
|
|
7
7
|
import type { GraphPresentation } from './graph-linked-value.d.ts';
|
|
8
8
|
import type { WireInlineSources } from './shell-tree-inline-sources.d.ts';
|
|
9
|
+
export interface WireCenteredPlacement {
|
|
10
|
+
leading: number;
|
|
11
|
+
trailing: number;
|
|
12
|
+
margin: number;
|
|
13
|
+
width: number;
|
|
14
|
+
gap: number;
|
|
15
|
+
}
|
|
9
16
|
export interface WireElementNode {
|
|
10
17
|
k: 0;
|
|
11
18
|
id: number;
|
|
@@ -13,6 +20,7 @@ export interface WireElementNode {
|
|
|
13
20
|
props: Record<string, unknown>;
|
|
14
21
|
styleRecord: Uint8Array;
|
|
15
22
|
layoutPlacement?: LayoutHookPlacement;
|
|
23
|
+
centeredPlacement?: WireCenteredPlacement;
|
|
16
24
|
animDriven?: readonly AnimatedDrivenStyleLease[];
|
|
17
25
|
animDrivenRetired?: readonly AnimatedDrivenStyleRetirement[];
|
|
18
26
|
text?: string;
|
|
@@ -28,3 +28,4 @@ export declare function isWebViewCaptureRegistration(value: unknown): value is W
|
|
|
28
28
|
export interface WebViewCaptureTarget extends WebViewCaptureRegistration {
|
|
29
29
|
captureGeneration: number;
|
|
30
30
|
}
|
|
31
|
+
export type WebViewSnapshotTarget = Omit<WebViewCaptureRegistration, 'sourceKey'>;
|
|
@@ -426,6 +426,11 @@ export type SootSimMetroDefine = (factory: (globalObj: typeof globalThis, requir
|
|
|
426
426
|
export interface SootSimDirectGlobals {
|
|
427
427
|
__peachPageServingAuthority: PeachPageServingAuthority | null;
|
|
428
428
|
__peachWebViewHost: (request: SootSimWebViewHostRequest) => Promise<void>;
|
|
429
|
+
__peachWebViewFrame: (instanceId: string) => Promise<{
|
|
430
|
+
width: number;
|
|
431
|
+
height: number;
|
|
432
|
+
rgbaBase64: string;
|
|
433
|
+
} | null>;
|
|
429
434
|
__sootsimAuxCompositorStats: () => SootSimAuxCompositorStats;
|
|
430
435
|
__sootsimDeviceSpec: SootSimDeviceSpec;
|
|
431
436
|
__sootsimDeviceSpecListeners: Set<() => void>;
|
package/kotlin/sdk.tar.gz
CHANGED
|
Binary file
|
package/package.json
CHANGED
package/runtime-companion.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"abi":1,"sha256":"
|
|
1
|
+
{"abi":1,"sha256":"0576baa8f64749f044d1fee413b30d3459d6a2a5caf1435ecc04500a7031bf93","file":"node/cli-0576baa8f64749f044d1fee413b30d3459d6a2a5caf1435ecc04500a7031bf93.cjs"}
|
|
@@ -53,7 +53,7 @@ _Float16 __fmaf16(_Float16, _Float16, _Float16);
|
|
|
53
53
|
#endif
|
|
54
54
|
|
|
55
55
|
#define PEACH_MATH_PREDICATE(name, builtin, suffix, type) \
|
|
56
|
-
static
|
|
56
|
+
static __inline__ int __inline_##name##suffix(type x) { return __builtin_##builtin(x); }
|
|
57
57
|
#define PEACH_MATH_PREDICATES(name, builtin) \
|
|
58
58
|
PEACH_MATH_PREDICATE(name, builtin, f, float) \
|
|
59
59
|
PEACH_MATH_PREDICATE(name, builtin, d, double) \
|
|
@@ -62,7 +62,7 @@ int pthread_key_delete(pthread_key_t) __asm__("__peach_darwin_pthread_key_delete
|
|
|
62
62
|
void * _Nullable pthread_getspecific(pthread_key_t) __asm__("__peach_darwin_pthread_getspecific");
|
|
63
63
|
int pthread_setspecific(pthread_key_t, const void * _Nullable) __asm__("__peach_darwin_pthread_setspecific");
|
|
64
64
|
int sched_yield(void);
|
|
65
|
-
static
|
|
65
|
+
static __inline__ void pthread_yield_np(void) { sched_yield(); }
|
|
66
66
|
__END_DECLS
|
|
67
67
|
|
|
68
68
|
#define pthread_cleanup_push(func, val) \
|
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
// the asset data exchanged by project hosts and the private renderer.
|
|
2
|
+
export const SF_SYMBOL_METRICS_CATALOG_FILE = 'metrics-dict.bin.gz'
|
|
3
|
+
|
|
4
|
+
export function sfSymbolMetricsFilename(catalogVersion: string): string {
|
|
5
|
+
return `metrics-${catalogVersion}-dict.bin`
|
|
6
|
+
}
|
|
7
|
+
|
|
2
8
|
export interface SwiftImageSource {
|
|
3
9
|
uri: string
|
|
4
10
|
scale: number
|
|
@@ -106,9 +106,9 @@ function bracket(scale: SfSymbolScale, weight: SfSymbolWeight) {
|
|
|
106
106
|
}
|
|
107
107
|
}
|
|
108
108
|
|
|
109
|
-
//
|
|
110
|
-
//
|
|
111
|
-
//
|
|
109
|
+
// little endian: name count, name bytes, unique row count (u32), padded utf-8
|
|
110
|
+
// names, variant constants (f32), name-to-row indices (u32), then unique rows
|
|
111
|
+
// in column order (f32). aliases retain their names and share identical rows.
|
|
112
112
|
export function encodeSfSymbolMetrics(
|
|
113
113
|
rows: ReadonlyMap<string, ReadonlyMap<string, SfSymbolMetricRow>>,
|
|
114
114
|
): Uint8Array {
|
|
@@ -116,22 +116,7 @@ export function encodeSfSymbolMetrics(
|
|
|
116
116
|
names.sort()
|
|
117
117
|
const nameBytes = new TextEncoder().encode(names.join('\n'))
|
|
118
118
|
const namesLength = Math.ceil(nameBytes.length / 4) * 4
|
|
119
|
-
const
|
|
120
|
-
const out = new Uint8Array(
|
|
121
|
-
header +
|
|
122
|
-
4 *
|
|
123
|
-
(VARIANT_COUNT * CONSTANTS.length +
|
|
124
|
-
KNOT_VARIANT_COUNT * COLUMNS.length * names.length),
|
|
125
|
-
)
|
|
126
|
-
const view = new DataView(out.buffer)
|
|
127
|
-
view.setUint32(0, names.length, true)
|
|
128
|
-
view.setUint32(4, nameBytes.length, true)
|
|
129
|
-
out.set(nameBytes, 8)
|
|
130
|
-
let offset = header
|
|
131
|
-
const put = (value: number) => {
|
|
132
|
-
view.setFloat32(offset, value, true)
|
|
133
|
-
offset += 4
|
|
134
|
-
}
|
|
119
|
+
const constants: number[] = []
|
|
135
120
|
for (const scale of SF_SYMBOL_SCALES)
|
|
136
121
|
for (const weight of SF_SYMBOL_WEIGHTS) {
|
|
137
122
|
const variant = rows.get(variantKey(scale, weight))
|
|
@@ -147,13 +132,51 @@ export function encodeSfSymbolMetrics(
|
|
|
147
132
|
`SF Symbol metrics: ${key} varies by name at ${scale}-${weight}`,
|
|
148
133
|
)
|
|
149
134
|
}
|
|
150
|
-
for (const key of CONSTANTS)
|
|
135
|
+
for (const key of CONSTANTS) constants.push(first[key])
|
|
151
136
|
}
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
137
|
+
const uniqueRows: Float32Array[] = []
|
|
138
|
+
const rowIds = new Map<string, number>()
|
|
139
|
+
const indices = new Uint32Array(names.length)
|
|
140
|
+
const columnCount = KNOT_VARIANT_COUNT * COLUMNS.length
|
|
141
|
+
for (const [index, name] of names.entries()) {
|
|
142
|
+
const values = new Float32Array(columnCount)
|
|
143
|
+
let column = 0
|
|
144
|
+
for (const scale of SF_SYMBOL_SCALES)
|
|
145
|
+
for (const knot of sfSymbolMetricKnots(scale)) {
|
|
146
|
+
const row = rows.get(variantKey(scale, knot))!.get(name)!
|
|
147
|
+
for (const key of COLUMNS) values[column++] = row[key]
|
|
148
|
+
}
|
|
149
|
+
const key = new Uint32Array(values.buffer).join(',')
|
|
150
|
+
let id = rowIds.get(key)
|
|
151
|
+
if (id === undefined) {
|
|
152
|
+
id = uniqueRows.length
|
|
153
|
+
rowIds.set(key, id)
|
|
154
|
+
uniqueRows.push(values)
|
|
155
|
+
}
|
|
156
|
+
indices[index] = id
|
|
157
|
+
}
|
|
158
|
+
const header = 12 + namesLength
|
|
159
|
+
const out = new Uint8Array(
|
|
160
|
+
header + 4 * (constants.length + indices.length + columnCount * uniqueRows.length),
|
|
161
|
+
)
|
|
162
|
+
const view = new DataView(out.buffer)
|
|
163
|
+
view.setUint32(0, names.length, true)
|
|
164
|
+
view.setUint32(4, nameBytes.length, true)
|
|
165
|
+
view.setUint32(8, uniqueRows.length, true)
|
|
166
|
+
out.set(nameBytes, 12)
|
|
167
|
+
let offset = header
|
|
168
|
+
for (const value of constants) {
|
|
169
|
+
view.setFloat32(offset, value, true)
|
|
170
|
+
offset += 4
|
|
171
|
+
}
|
|
172
|
+
for (const index of indices) {
|
|
173
|
+
view.setUint32(offset, index, true)
|
|
174
|
+
offset += 4
|
|
175
|
+
}
|
|
176
|
+
for (let column = 0; column < columnCount; column++)
|
|
177
|
+
for (const row of uniqueRows) {
|
|
178
|
+
view.setFloat32(offset, row[column]!, true)
|
|
179
|
+
offset += 4
|
|
157
180
|
}
|
|
158
181
|
return out
|
|
159
182
|
}
|
|
@@ -167,24 +190,37 @@ export class SfSymbolMetrics {
|
|
|
167
190
|
private readonly index = new Map<string, number>()
|
|
168
191
|
private readonly constants: Float32Array
|
|
169
192
|
private readonly columns: Float32Array
|
|
193
|
+
private readonly rowCount: number
|
|
170
194
|
|
|
171
195
|
constructor(bytes: Uint8Array) {
|
|
196
|
+
if (bytes.byteLength < 12) throw new Error('SF Symbol metrics: malformed header')
|
|
172
197
|
const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength)
|
|
173
198
|
const count = view.getUint32(0, true)
|
|
174
199
|
const nameLength = view.getUint32(4, true)
|
|
175
|
-
this.
|
|
176
|
-
|
|
177
|
-
throw new Error('SF Symbol metrics: name count mismatch')
|
|
178
|
-
this.names.forEach((name, i) => this.index.set(name, i))
|
|
179
|
-
const header = 8 + Math.ceil(nameLength / 4) * 4
|
|
180
|
-
const floats = bytes.byteLength - header
|
|
181
|
-
if (floats % 4 !== 0) throw new Error('SF Symbol metrics: malformed')
|
|
182
|
-
const all = new Float32Array(bytes.slice(header).buffer)
|
|
200
|
+
this.rowCount = view.getUint32(8, true)
|
|
201
|
+
const header = 12 + Math.ceil(nameLength / 4) * 4
|
|
183
202
|
const constantCount = VARIANT_COUNT * CONSTANTS.length
|
|
184
|
-
|
|
203
|
+
const expected =
|
|
204
|
+
header +
|
|
205
|
+
4 * (constantCount + count + KNOT_VARIANT_COUNT * COLUMNS.length * this.rowCount)
|
|
206
|
+
if (
|
|
207
|
+
!count ||
|
|
208
|
+
!this.rowCount ||
|
|
209
|
+
this.rowCount > count ||
|
|
210
|
+
bytes.byteLength !== expected
|
|
211
|
+
)
|
|
185
212
|
throw new Error('SF Symbol metrics: size mismatch')
|
|
186
|
-
this.
|
|
187
|
-
this.
|
|
213
|
+
this.names = new TextDecoder().decode(bytes.subarray(12, 12 + nameLength)).split('\n')
|
|
214
|
+
if (this.names.length !== count)
|
|
215
|
+
throw new Error('SF Symbol metrics: name count mismatch')
|
|
216
|
+
const indicesOffset = header + constantCount * 4
|
|
217
|
+
this.names.forEach((name, index) => {
|
|
218
|
+
const row = view.getUint32(indicesOffset + index * 4, true)
|
|
219
|
+
if (row >= this.rowCount) throw new Error('SF Symbol metrics: invalid row index')
|
|
220
|
+
this.index.set(name, row)
|
|
221
|
+
})
|
|
222
|
+
this.constants = new Float32Array(bytes.slice(header, indicesOffset).buffer)
|
|
223
|
+
this.columns = new Float32Array(bytes.slice(indicesOffset + count * 4).buffer)
|
|
188
224
|
}
|
|
189
225
|
|
|
190
226
|
has(name: string): boolean {
|
|
@@ -196,7 +232,7 @@ export class SfSymbolMetrics {
|
|
|
196
232
|
const at = this.index.get(name)
|
|
197
233
|
if (at === undefined) return undefined
|
|
198
234
|
const { lowKnot, highKnot, t } = bracket(scale, weight)
|
|
199
|
-
const count = this.
|
|
235
|
+
const count = this.rowCount
|
|
200
236
|
const read = (knot: SfSymbolWeight, column: number) =>
|
|
201
237
|
this.columns[(knotIndex(scale, knot) * COLUMNS.length + column) * count + at]!
|
|
202
238
|
const value = (column: number) => {
|