peachsim 0.1.727 → 0.1.729

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.
Files changed (74) hide show
  1. package/cli/commands/preview.ts +236 -8
  2. package/cli/commands/skills.ts +41 -3
  3. package/cli/outbound-endpoints.ts +6 -4
  4. package/dist-lib/agent-daemon-client.cjs +1 -1
  5. package/dist-lib/agent-events.cjs +1 -1
  6. package/dist-lib/agent-identity.cjs +1 -1
  7. package/dist-lib/agent-sessions.cjs +1 -1
  8. package/dist-lib/attached-projects.cjs +1 -1
  9. package/dist-lib/auth/shared-session.cjs +1 -1
  10. package/dist-lib/backend-origin.cjs +1 -1
  11. package/dist-lib/beta.cjs +1 -1
  12. package/dist-lib/beta.mjs +1 -1
  13. package/dist-lib/bridge-constants.cjs +1 -1
  14. package/dist-lib/bridge-contract-input.cjs +1 -1
  15. package/dist-lib/bridge-contract-input.mjs +1 -1
  16. package/dist-lib/bridge-contract.cjs +1 -1
  17. package/dist-lib/bridge-contract.mjs +1 -1
  18. package/dist-lib/capture-contract.cjs +1 -1
  19. package/dist-lib/capture-contract.mjs +1 -1
  20. package/dist-lib/cli-constants.cjs +1 -1
  21. package/dist-lib/cloud-contract.cjs +1 -1
  22. package/dist-lib/cloud-contract.mjs +1 -1
  23. package/dist-lib/cloud-test-args.cjs +1 -1
  24. package/dist-lib/cloud-test-args.mjs +1 -1
  25. package/dist-lib/cloud.cjs +1 -1
  26. package/dist-lib/cloud.mjs +1 -1
  27. package/dist-lib/config.cjs +1 -1
  28. package/dist-lib/detox/index.cjs +1 -1
  29. package/dist-lib/dev-bundle-resolution.cjs +1 -1
  30. package/dist-lib/home-paths.cjs +1 -1
  31. package/dist-lib/host/bridge-host.cjs +178 -3
  32. package/dist-lib/host/fetch-proxy-handler.cjs +1 -1
  33. package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
  34. package/dist-lib/host/fetch-proxy-overrides.mjs +1 -1
  35. package/dist-lib/host/replacement-module-handler.cjs +1 -1
  36. package/dist-lib/host/websocket-proxy.cjs +1 -1
  37. package/dist-lib/index.cjs +1 -1
  38. package/dist-lib/jump-to-source-babel.cjs +1 -1
  39. package/dist-lib/jump-to-source-native.cjs +1 -1
  40. package/dist-lib/kotlin-host.cjs +1 -1
  41. package/dist-lib/menu.cjs +1 -1
  42. package/dist-lib/menu.mjs +1 -1
  43. package/dist-lib/metro-fingerprint-registry.cjs +1 -1
  44. package/dist-lib/metro-fingerprint-registry.mjs +1 -1
  45. package/dist-lib/metro-production-bundle.cjs +1 -1
  46. package/dist-lib/metro-production-bundle.mjs +1 -1
  47. package/dist-lib/metro.cjs +1 -1
  48. package/dist-lib/native-app-identity.cjs +1 -1
  49. package/dist-lib/native-app-identity.mjs +1 -1
  50. package/dist-lib/native-firebase-metadata.cjs +1 -1
  51. package/dist-lib/native-firebase-metadata.mjs +1 -1
  52. package/dist-lib/plist.cjs +1 -1
  53. package/dist-lib/plist.mjs +1 -1
  54. package/dist-lib/profiles.cjs +1 -1
  55. package/dist-lib/public-brand.cjs +1 -1
  56. package/dist-lib/react-native-host-modules.cjs +1 -1
  57. package/dist-lib/react-native-host-modules.mjs +1 -1
  58. package/dist-lib/render-mode.cjs +1 -1
  59. package/dist-lib/scripts/dev-server-scanner.cjs +1 -1
  60. package/dist-lib/sdk.cjs +1 -1
  61. package/dist-lib/sdk.mjs +1 -1
  62. package/dist-lib/skills.cjs +264 -64
  63. package/dist-lib/swift-compile.cjs +180 -3
  64. package/dist-lib/swift-compile.mjs +179 -3
  65. package/dist-lib/swift-package.cjs +1 -1
  66. package/dist-lib/swift-package.mjs +1 -1
  67. package/dist-lib/swift-submit.cjs +1 -1
  68. package/dist-lib/swift-submit.mjs +1 -1
  69. package/dist-lib/swift-toolchain.cjs +1 -1
  70. package/dist-lib/swift.cjs +1 -1
  71. package/dist-lib/vite-swift.cjs +178 -3
  72. package/dist-lib/vite.cjs +1 -1
  73. package/package.json +1 -1
  74. package/src/swift-compile.ts +215 -2
@@ -1,4 +1,4 @@
1
- /*! rnx v0.1.727 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
1
+ /*! rnx v0.1.729 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
2
  let __sootsim_import_meta_url = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; } catch {}
3
3
  "use strict";
4
4
  var __create = Object.create;
@@ -440,6 +440,7 @@ var OPTIONAL_FRAMEWORK_DEPENDENCIES = {
440
440
  Accelerate: [],
441
441
  CryptoKit: [],
442
442
  CommonCrypto: [],
443
+ CoreText: [],
443
444
  Security: [],
444
445
  TikTokBusinessSDK: [],
445
446
  nSure: [],
@@ -484,7 +485,7 @@ var ONE_IMPLICIT_FLAGS = ', "-Xfrontend", "-import-module", "-Xfrontend", "One"'
484
485
  var MULTI_MANIFEST_VERSION = 10;
485
486
  function swiftArtifactHash(input, release, moduleRoot) {
486
487
  const hash = (0, import_node_crypto2.createHash)("sha256");
487
- hash.update(`swift-compile/v13
488
+ hash.update(`swift-compile/v14
488
489
  ${release}
489
490
  `);
490
491
  if (input.oneModule) hash.update("one-module\n");
@@ -789,6 +790,180 @@ function liftExtensionOverrides(source) {
789
790
  out = out.slice(0, at) + insert + out.slice(at + remove);
790
791
  return out;
791
792
  }
793
+ function lowerAnyObjectDoubleValue(source) {
794
+ const masked = swiftCodeMask(source);
795
+ const names = /* @__PURE__ */ new Set();
796
+ const binding = /(?:\blet\b|\bvar\b)\s+([A-Za-z_]\w*)\s*=[^\n;{}]*?\bas[?!]?\s*AnyObject\??(?=\s*(?:[,;{]|\belse\b|$))/gm;
797
+ const declared = /(?:\blet\b|\bvar\b)\s+([A-Za-z_]\w*)\s*:\s*AnyObject\b/g;
798
+ const parameter = /[(,]\s*(?:[A-Za-z_]\w*\s+)?([A-Za-z_]\w*)\s*:\s*AnyObject\??(?=\s*[,)=])/g;
799
+ for (const pattern of [binding, declared, parameter]) {
800
+ pattern.lastIndex = 0;
801
+ for (let found = pattern.exec(masked); found; found = pattern.exec(masked))
802
+ names.add(found[1]);
803
+ }
804
+ const edits = [];
805
+ const member = /\.\s*doubleValue\b/g;
806
+ let hit;
807
+ while ((hit = member.exec(masked)) !== null) {
808
+ const memberEnd = hit.index + hit[0].length;
809
+ let j = hit.index - 1;
810
+ while (j >= 0 && /\s/.test(masked[j])) j--;
811
+ if (masked[j] === "?" || masked[j] === "!") {
812
+ j--;
813
+ while (j >= 0 && /\s/.test(masked[j])) j--;
814
+ }
815
+ if (masked[j] === ")") {
816
+ const close = j;
817
+ let depth = 0;
818
+ let open = -1;
819
+ for (let k = close; k >= 0; k--) {
820
+ if (masked[k] === ")") depth++;
821
+ else if (masked[k] === "(" && --depth === 0) {
822
+ open = k;
823
+ break;
824
+ }
825
+ }
826
+ if (open === -1) continue;
827
+ const inner = masked.slice(open + 1, close);
828
+ const cast = /^(?:\s*(?:try\b|await\b))*\s*([\s\S]*?)\bas[?!]?\s*AnyObject\??\s*$/.exec(inner);
829
+ if (!cast) continue;
830
+ const expression = source.slice(open + 1, open + 1 + cast[1].length).replace(/\s+$/, "");
831
+ const hoisted = /^\s*((?:try\b\s*|await\s*)+)([\s\S]*)$/.exec(expression);
832
+ edits.push([
833
+ open,
834
+ memberEnd - open,
835
+ `${hoisted ? hoisted[1] : ""}_objcNumber(${hoisted ? hoisted[2] : expression})`
836
+ ]);
837
+ continue;
838
+ }
839
+ const head = masked.slice(0, j + 1);
840
+ const selfed = /(?:^|[^\w$])self\s*\.\s*([A-Za-z_]\w*)$/.exec(head);
841
+ if (selfed) {
842
+ if (!names.has(selfed[1])) continue;
843
+ const receiver = selfed[0].replace(/^[^\w$]+/, "");
844
+ edits.push([
845
+ j + 1 - receiver.length,
846
+ memberEnd - (j + 1 - receiver.length),
847
+ `_objcNumber(${receiver})`
848
+ ]);
849
+ continue;
850
+ }
851
+ const named = /([A-Za-z_]\w*)$/.exec(head);
852
+ if (!named || !names.has(named[1])) continue;
853
+ const nameStart = j + 1 - named[1].length;
854
+ let before = nameStart - 1;
855
+ while (before >= 0 && /\s/.test(masked[before])) before--;
856
+ if (masked[before] === ".") continue;
857
+ edits.push([nameStart, memberEnd - nameStart, `_objcNumber(${named[1]})`]);
858
+ }
859
+ let out = source;
860
+ for (const [at, remove, insert] of edits.sort((a, b) => b[0] - a[0]))
861
+ out = out.slice(0, at) + insert + out.slice(at + remove);
862
+ return out;
863
+ }
864
+ function swiftCodeMask(source) {
865
+ const chars = source.split("");
866
+ const blank = (from, to) => {
867
+ for (let i = Math.max(0, from); i < Math.min(to, chars.length); i++)
868
+ if (chars[i] !== "\n") chars[i] = " ";
869
+ };
870
+ const hashesAt = (at) => {
871
+ let end = at;
872
+ while (source[end] === "#") end++;
873
+ return end - at;
874
+ };
875
+ const scanString = (quote, hashes) => {
876
+ const multiline = source.startsWith('"""', quote);
877
+ let i = quote + (multiline ? 3 : 1);
878
+ const keep = [];
879
+ const quoteEnd = (at) => {
880
+ const mark = multiline ? '"""' : '"';
881
+ return source.startsWith(mark, at) && source.startsWith("#".repeat(hashes), at + mark.length);
882
+ };
883
+ while (i < chars.length) {
884
+ if (source[i] === "\\" && source.startsWith("#".repeat(hashes), i + 1) && source[i + 1 + hashes] === "(") {
885
+ const codeStart = i + 2 + hashes;
886
+ const codeEnd = scanCode(codeStart, true);
887
+ keep.push([codeStart, codeEnd]);
888
+ i = codeEnd + 1;
889
+ continue;
890
+ }
891
+ if (quoteEnd(i)) {
892
+ const close = i + (multiline ? 3 : 1) + hashes;
893
+ let cursor = quote - hashes;
894
+ for (const [from, to] of [...keep, [close, close]])
895
+ if (from > cursor) {
896
+ blank(cursor, from);
897
+ cursor = to;
898
+ } else cursor = Math.max(cursor, to);
899
+ return close;
900
+ }
901
+ i++;
902
+ }
903
+ blank(quote - hashes, chars.length);
904
+ return chars.length;
905
+ };
906
+ const scanCode = (i, nested) => {
907
+ let parens = 0;
908
+ while (i < chars.length) {
909
+ const char = source[i];
910
+ if (char === "/" && source[i + 1] === "/") {
911
+ const end = source.indexOf("\n", i);
912
+ blank(i, end === -1 ? chars.length : end);
913
+ i = end === -1 ? chars.length : end;
914
+ continue;
915
+ }
916
+ if (char === "/" && source[i + 1] === "*") {
917
+ let j = i + 2;
918
+ let depth = 1;
919
+ while (j < chars.length && depth > 0) {
920
+ if (source.startsWith("/*", j)) {
921
+ depth++;
922
+ j += 2;
923
+ } else if (source.startsWith("*/", j)) {
924
+ depth--;
925
+ j += 2;
926
+ } else j++;
927
+ }
928
+ blank(i, j);
929
+ i = j;
930
+ continue;
931
+ }
932
+ if (char === "#") {
933
+ const hashes = hashesAt(i);
934
+ const at = i + hashes;
935
+ if (source[at] === '"') {
936
+ i = scanString(at, hashes);
937
+ continue;
938
+ }
939
+ if (hashes > 0 && source[at] === "/") {
940
+ const mark = "#".repeat(hashes);
941
+ let j = at + 1;
942
+ while (j < chars.length && !(source[j] === "/" && source.startsWith(mark, j + 1)))
943
+ j++;
944
+ blank(i, Math.min(chars.length, j + 1 + hashes));
945
+ i = Math.min(chars.length, j + 1 + hashes);
946
+ continue;
947
+ }
948
+ i++;
949
+ continue;
950
+ }
951
+ if (char === '"') {
952
+ i = scanString(i, 0);
953
+ continue;
954
+ }
955
+ if (char === "(") parens++;
956
+ else if (char === ")") {
957
+ if (nested && parens === 0) return i;
958
+ parens--;
959
+ }
960
+ i++;
961
+ }
962
+ return i;
963
+ };
964
+ scanCode(0, false);
965
+ return chars.join("");
966
+ }
792
967
  function swiftSourceAsIOS(original) {
793
968
  const source = liftExtensionOverrides(original);
794
969
  const { lineStarts, tokens } = swiftCodeScan(source);
@@ -863,7 +1038,7 @@ function swiftSourceAsIOS(original) {
863
1038
  out += conditioned.slice(copied, at) + replacement;
864
1039
  copied = at + match[0].length;
865
1040
  }
866
- return out + conditioned.slice(copied);
1041
+ return lowerAnyObjectDoubleValue(out + conditioned.slice(copied));
867
1042
  }
868
1043
  function swiftCodeScan(source) {
869
1044
  const starts = /* @__PURE__ */ new Set();
package/dist-lib/vite.cjs CHANGED
@@ -1,4 +1,4 @@
1
- /*! rnx v0.1.727 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
1
+ /*! rnx v0.1.729 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
2
  let __sootsim_import_meta_url = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; } catch {}
3
3
  "use strict";
4
4
  var __create = Object.create;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "peachsim",
3
- "version": "0.1.727",
3
+ "version": "0.1.729",
4
4
  "description": "Vite and Metro plugins, testing drivers, and SDK exports for peach.",
5
5
  "author": "Tamagui LLC",
6
6
  "license": "SEE LICENSE IN LICENSE",
@@ -246,6 +246,7 @@ const OPTIONAL_FRAMEWORK_DEPENDENCIES: Record<string, string[]> = {
246
246
  Accelerate: [],
247
247
  CryptoKit: [],
248
248
  CommonCrypto: [],
249
+ CoreText: [],
249
250
  Security: [],
250
251
  TikTokBusinessSDK: [],
251
252
  nSure: [],
@@ -323,6 +324,7 @@ export function swiftArtifactHash(
323
324
  moduleRoot: string,
324
325
  ): string {
325
326
  const hash = createHash('sha256')
327
+ // v14: AnyObject doubleValue lowers to the typed _objcNumber getter
326
328
  // v13: implicit target resources synthesize Bundle.module
327
329
  // v12: overrides in an extension of a same-file class lift into the class
328
330
  // v10: Foundation-only sources see Dispatch queues
@@ -332,7 +334,7 @@ export function swiftArtifactHash(
332
334
  // v6: app and scene delegate classes compile final
333
335
  // (v5: a target declaring resources gets SwiftPM's Bundle.module accessor;
334
336
  // v4: sources compile through swiftSourceAsIOS)
335
- hash.update(`swift-compile/v13\n${release}\n`)
337
+ hash.update(`swift-compile/v14\n${release}\n`)
336
338
  if (input.oneModule) hash.update('one-module\n')
337
339
  hash.update(swiftModuleDigest(moduleRoot))
338
340
  for (const file of Object.keys(input.files).sort()) {
@@ -761,6 +763,217 @@ function liftExtensionOverrides(source: string): string {
761
763
  return out
762
764
  }
763
765
 
766
+ // wasm Swift has no ObjC runtime, so a member read on AnyObject never
767
+ // resolves: `value of type 'AnyObject' has no member 'doubleValue'`. native
768
+ // code that bridges dictionary values through AnyObject to reach NSNumber's
769
+ // getter lowers here to the typed getter PeachObjC already dispatches
770
+ // (_objcNumber): `name.doubleValue` where name binds `as?`/`as!`/`as`
771
+ // AnyObject or declares `: AnyObject` (a `self.` prefix is the same
772
+ // variable), and `(expression as? AnyObject)?.doubleValue`, become
773
+ // `_objcNumber(name)` and `_objcNumber(expression)`. both read Double?, as
774
+ // natively, so `guard let` and `??` around them keep their meaning. a `try`
775
+ // or `await` on a cast expression hoists in front of the call. a concrete
776
+ // receiver (NSNumber, JSON, a dotted member), a multi-line `let`
777
+ // initializer, and anything in a string, comment or regex stay as written.
778
+ export function lowerAnyObjectDoubleValue(source: string): string {
779
+ const masked = swiftCodeMask(source)
780
+ const names = new Set<string>()
781
+ const binding =
782
+ /(?:\blet\b|\bvar\b)\s+([A-Za-z_]\w*)\s*=[^\n;{}]*?\bas[?!]?\s*AnyObject\??(?=\s*(?:[,;{]|\belse\b|$))/gm
783
+ const declared = /(?:\blet\b|\bvar\b)\s+([A-Za-z_]\w*)\s*:\s*AnyObject\b/g
784
+ const parameter =
785
+ /[(,]\s*(?:[A-Za-z_]\w*\s+)?([A-Za-z_]\w*)\s*:\s*AnyObject\??(?=\s*[,)=])/g
786
+ for (const pattern of [binding, declared, parameter]) {
787
+ pattern.lastIndex = 0
788
+ for (let found = pattern.exec(masked); found; found = pattern.exec(masked))
789
+ names.add(found[1]!)
790
+ }
791
+ const edits: [number, number, string][] = []
792
+ const member = /\.\s*doubleValue\b/g
793
+ let hit: RegExpExecArray | null
794
+ while ((hit = member.exec(masked)) !== null) {
795
+ const memberEnd = hit.index + hit[0].length
796
+ let j = hit.index - 1
797
+ while (j >= 0 && /\s/.test(masked[j]!)) j--
798
+ // `?.` and `!` unwrap an optional AnyObject to the same getter input
799
+ if (masked[j] === '?' || masked[j] === '!') {
800
+ j--
801
+ while (j >= 0 && /\s/.test(masked[j]!)) j--
802
+ }
803
+ if (masked[j] === ')') {
804
+ const close = j
805
+ let depth = 0
806
+ let open = -1
807
+ for (let k = close; k >= 0; k--) {
808
+ if (masked[k] === ')') depth++
809
+ else if (masked[k] === '(' && --depth === 0) {
810
+ open = k
811
+ break
812
+ }
813
+ }
814
+ if (open === -1) continue
815
+ const inner = masked.slice(open + 1, close)
816
+ const cast =
817
+ /^(?:\s*(?:try\b|await\b))*\s*([\s\S]*?)\bas[?!]?\s*AnyObject\??\s*$/.exec(inner)
818
+ if (!cast) continue
819
+ const expression = source
820
+ .slice(open + 1, open + 1 + cast[1]!.length)
821
+ .replace(/\s+$/, '')
822
+ const hoisted = /^\s*((?:try\b\s*|await\s*)+)([\s\S]*)$/.exec(expression)
823
+ edits.push([
824
+ open,
825
+ memberEnd - open,
826
+ `${hoisted ? hoisted[1] : ''}_objcNumber(${hoisted ? hoisted[2] : expression})`,
827
+ ])
828
+ continue
829
+ }
830
+ const head = masked.slice(0, j + 1)
831
+ // `self.name` names the same variable a tracked `name` declares
832
+ const selfed = /(?:^|[^\w$])self\s*\.\s*([A-Za-z_]\w*)$/.exec(head)
833
+ if (selfed) {
834
+ if (!names.has(selfed[1]!)) continue
835
+ const receiver = selfed[0].replace(/^[^\w$]+/, '')
836
+ edits.push([
837
+ j + 1 - receiver.length,
838
+ memberEnd - (j + 1 - receiver.length),
839
+ `_objcNumber(${receiver})`,
840
+ ])
841
+ continue
842
+ }
843
+ const named = /([A-Za-z_]\w*)$/.exec(head)
844
+ if (!named || !names.has(named[1]!)) continue
845
+ const nameStart = j + 1 - named[1]!.length
846
+ let before = nameStart - 1
847
+ while (before >= 0 && /\s/.test(masked[before]!)) before--
848
+ // a dotted member receiver (`a.b.doubleValue`) has an unknown type
849
+ if (masked[before] === '.') continue
850
+ edits.push([nameStart, memberEnd - nameStart, `_objcNumber(${named[1]})`])
851
+ }
852
+ let out = source
853
+ for (const [at, remove, insert] of edits.sort((a, b) => b[0] - a[0]))
854
+ out = out.slice(0, at) + insert + out.slice(at + remove)
855
+ return out
856
+ }
857
+
858
+ // the index-preserving view lowerAnyObjectDoubleValue matches on: every
859
+ // char outside code (comments, strings, regex literals) reads as a space,
860
+ // so an identifier that survives is code. newlines stay, keeping every
861
+ // offset valid in both views.
862
+ function swiftCodeMask(source: string): string {
863
+ const chars = source.split('')
864
+ const blank = (from: number, to: number): void => {
865
+ for (let i = Math.max(0, from); i < Math.min(to, chars.length); i++)
866
+ if (chars[i] !== '\n') chars[i] = ' '
867
+ }
868
+ const hashesAt = (at: number): number => {
869
+ let end = at
870
+ while (source[end] === '#') end++
871
+ return end - at
872
+ }
873
+ const scanString = (quote: number, hashes: number): number => {
874
+ const multiline = source.startsWith('"""', quote)
875
+ let i = quote + (multiline ? 3 : 1)
876
+ const keep: [number, number][] = []
877
+ const quoteEnd = (at: number): boolean => {
878
+ const mark = multiline ? '"""' : '"'
879
+ return (
880
+ source.startsWith(mark, at) &&
881
+ source.startsWith('#'.repeat(hashes), at + mark.length)
882
+ )
883
+ }
884
+ while (i < chars.length) {
885
+ if (
886
+ source[i] === '\\' &&
887
+ source.startsWith('#'.repeat(hashes), i + 1) &&
888
+ source[i + 1 + hashes] === '('
889
+ ) {
890
+ const codeStart = i + 2 + hashes
891
+ const codeEnd = scanCode(codeStart, true)
892
+ keep.push([codeStart, codeEnd])
893
+ i = codeEnd + 1
894
+ continue
895
+ }
896
+ if (quoteEnd(i)) {
897
+ const close = i + (multiline ? 3 : 1) + hashes
898
+ let cursor = quote - hashes
899
+ for (const [from, to] of [...keep, [close, close] as [number, number]])
900
+ if (from > cursor) {
901
+ blank(cursor, from)
902
+ cursor = to
903
+ } else cursor = Math.max(cursor, to)
904
+ return close
905
+ }
906
+ i++
907
+ }
908
+ blank(quote - hashes, chars.length)
909
+ return chars.length
910
+ }
911
+ // an interpolation's `)` ends the scan only when no paren is open inside
912
+ const scanCode = (i: number, nested: boolean): number => {
913
+ let parens = 0
914
+ while (i < chars.length) {
915
+ const char = source[i]!
916
+ if (char === '/' && source[i + 1] === '/') {
917
+ const end = source.indexOf('\n', i)
918
+ blank(i, end === -1 ? chars.length : end)
919
+ i = end === -1 ? chars.length : end
920
+ continue
921
+ }
922
+ if (char === '/' && source[i + 1] === '*') {
923
+ let j = i + 2
924
+ let depth = 1
925
+ while (j < chars.length && depth > 0) {
926
+ if (source.startsWith('/*', j)) {
927
+ depth++
928
+ j += 2
929
+ } else if (source.startsWith('*/', j)) {
930
+ depth--
931
+ j += 2
932
+ } else j++
933
+ }
934
+ blank(i, j)
935
+ i = j
936
+ continue
937
+ }
938
+ if (char === '#') {
939
+ const hashes = hashesAt(i)
940
+ const at = i + hashes
941
+ if (source[at] === '"') {
942
+ i = scanString(at, hashes)
943
+ continue
944
+ }
945
+ if (hashes > 0 && source[at] === '/') {
946
+ const mark = '#'.repeat(hashes)
947
+ let j = at + 1
948
+ while (
949
+ j < chars.length &&
950
+ !(source[j] === '/' && source.startsWith(mark, j + 1))
951
+ )
952
+ j++
953
+ blank(i, Math.min(chars.length, j + 1 + hashes))
954
+ i = Math.min(chars.length, j + 1 + hashes)
955
+ continue
956
+ }
957
+ i++
958
+ continue
959
+ }
960
+ if (char === '"') {
961
+ i = scanString(i, 0)
962
+ continue
963
+ }
964
+ if (char === '(') parens++
965
+ else if (char === ')') {
966
+ if (nested && parens === 0) return i
967
+ parens--
968
+ }
969
+ i++
970
+ }
971
+ return i
972
+ }
973
+ scanCode(0, false)
974
+ return chars.join('')
975
+ }
976
+
764
977
  export function swiftSourceAsIOS(original: string): string {
765
978
  const source = liftExtensionOverrides(original)
766
979
  const { lineStarts, tokens } = swiftCodeScan(source)
@@ -843,7 +1056,7 @@ export function swiftSourceAsIOS(original: string): string {
843
1056
  out += conditioned.slice(copied, at) + replacement
844
1057
  copied = at + match[0].length
845
1058
  }
846
- return out + conditioned.slice(copied)
1059
+ return lowerAnyObjectDoubleValue(out + conditioned.slice(copied))
847
1060
  }
848
1061
 
849
1062
  // the offsets of the lines that begin in code, and of every `@`, `#`,