peachsim 0.1.1881 → 0.1.1887

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 (160) hide show
  1. package/cli/commands/control.ts +11 -10
  2. package/cli/commands/reset.ts +1 -1
  3. package/cli/native-input.ts +1 -1
  4. package/cli/outbound-endpoints.ts +1 -1
  5. package/detox/index.ts +62 -1
  6. package/dist-lib/agent-daemon-client.cjs +1 -1
  7. package/dist-lib/agent-events.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/bundle-channel.cjs +9079 -4305
  19. package/dist-lib/capture-contract.cjs +1 -1
  20. package/dist-lib/capture-contract.mjs +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/config.mjs +1 -1
  29. package/dist-lib/detox/index.cjs +35 -2
  30. package/dist-lib/dev-bundle-resolution.cjs +1 -1
  31. package/dist-lib/expo-swift-bundle.cjs +8609 -3976
  32. package/dist-lib/expo-swift-metadata.cjs +5 -1
  33. package/dist-lib/expo-swift-metadata.mjs +5 -1
  34. package/dist-lib/home-paths.cjs +1 -1
  35. package/dist-lib/host/bridge-host.cjs +9894 -5149
  36. package/dist-lib/host/fetch-proxy-handler.cjs +93 -13
  37. package/dist-lib/host/fetch-proxy-overrides.cjs +10 -2
  38. package/dist-lib/host/fetch-proxy-overrides.mjs +8 -2
  39. package/dist-lib/host/replacement-module-handler.cjs +1 -1
  40. package/dist-lib/host/websocket-proxy.cjs +1 -1
  41. package/dist-lib/index.cjs +538 -120
  42. package/dist-lib/jump-to-source-babel.cjs +1 -1
  43. package/dist-lib/jump-to-source-native.cjs +1 -1
  44. package/dist-lib/kotlin-host.cjs +1 -1
  45. package/dist-lib/menu.cjs +1 -1
  46. package/dist-lib/menu.mjs +1 -1
  47. package/dist-lib/metro-fingerprint-registry.cjs +1 -1
  48. package/dist-lib/metro-fingerprint-registry.mjs +1 -1
  49. package/dist-lib/metro-production-bundle.cjs +1 -1
  50. package/dist-lib/metro-production-bundle.mjs +1 -1
  51. package/dist-lib/metro.cjs +536 -118
  52. package/dist-lib/native-app-identity-project.cjs +408 -72
  53. package/dist-lib/native-app-identity-project.mjs +739 -375
  54. package/dist-lib/native-app-identity.cjs +37 -1
  55. package/dist-lib/native-app-identity.mjs +36 -1
  56. package/dist-lib/native-firebase-metadata.cjs +1 -1
  57. package/dist-lib/native-firebase-metadata.mjs +1 -1
  58. package/dist-lib/pdfium-raster.cjs +1 -1
  59. package/dist-lib/pdfium-raster.mjs +1 -1
  60. package/dist-lib/plist.cjs +1 -1
  61. package/dist-lib/plist.mjs +1 -1
  62. package/dist-lib/profiles.cjs +1 -1
  63. package/dist-lib/public-brand.cjs +1 -1
  64. package/dist-lib/public-origins-lib-esm.json +61 -28
  65. package/dist-lib/public-origins-lib.json +250 -92
  66. package/dist-lib/react-native-host-modules.cjs +1 -1
  67. package/dist-lib/react-native-host-modules.mjs +1 -1
  68. package/dist-lib/reap-browser.cjs +1 -1
  69. package/dist-lib/scripts/dev-server-scanner.cjs +1 -1
  70. package/dist-lib/sdk.cjs +1 -1
  71. package/dist-lib/sdk.mjs +1 -1
  72. package/dist-lib/skills.cjs +16568 -11674
  73. package/dist-lib/swift-compile.cjs +6874 -2537
  74. package/dist-lib/swift-compile.mjs +6207 -1866
  75. package/dist-lib/swift-package.cjs +20 -3
  76. package/dist-lib/swift-package.mjs +20 -3
  77. package/dist-lib/swift-submit.cjs +2 -2
  78. package/dist-lib/swift-submit.mjs +2 -2
  79. package/dist-lib/swift-toolchain.cjs +19 -1
  80. package/dist-lib/swift.cjs +1 -1
  81. package/dist-lib/vite-swift.cjs +8753 -4124
  82. package/dist-lib/vite.cjs +93 -13
  83. package/dist-lib/worklet-executable.cjs +1 -1
  84. package/dist-lib/worklet-executable.mjs +1 -1
  85. package/dist-types/packages/peach-engine/src/engine/canvaskit-api.d.ts +1 -1
  86. package/dist-types/packages/peach-engine/src/engine/fontDataContract.d.ts +2 -0
  87. package/dist-types/packages/peach-engine/src/render-worker/host-service-protocol.d.ts +3 -0
  88. package/dist-types/packages/peach-engine/src/render-worker/native-ui-protocol.d.ts +1 -0
  89. package/dist-types/packages/peach-engine/src/render-worker/protocol.d.ts +11 -1
  90. package/dist-types/packages/peach-engine/src/render-worker/shell-tree-wire.d.ts +2 -1
  91. package/dist-types/packages/peach-globals/src/nodeContract.d.ts +1 -0
  92. package/dist-types/packages/peach-globals/src/testBridgeContract.d.ts +10 -1
  93. package/dist-types/packages/peach-kit/src/capabilities.d.ts +1 -0
  94. package/dist-types/packages/peach-kit/src/ui/popover-placement.d.ts +1 -1
  95. package/dist-types/packages/sootsim-swift/src/securityHostContract.d.ts +10 -0
  96. package/package.json +1 -1
  97. package/runtime-companion.json +1 -1
  98. package/sdk/ios/System/Library/Frameworks/CFNetwork.framework/Headers/CFHost.h +555 -0
  99. package/sdk/ios/System/Library/Frameworks/CFNetwork.framework/Headers/CFNetwork.h +1 -0
  100. package/sdk/ios/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes +6 -0
  101. package/sdk/ios/System/Library/Frameworks/Foundation.framework/Headers/NSURLProtocol.h +0 -1
  102. package/sdk/ios/System/Library/Frameworks/QuartzCore.framework/Modules/module.modulemap +6 -0
  103. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIBarButtonItemBadge.h +1 -1
  104. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIBarMinimization.h +1 -1
  105. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIScrollView.h +1 -1
  106. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UISearchTab.h +1 -1
  107. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UITab.h +1 -1
  108. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UITabAccessory.h +2 -2
  109. package/sdk/ios/usr/include/os/activity.h +534 -0
  110. package/sdk/ios/usr/include/os.modulemap +15 -0
  111. package/sdk/ios/wasm/include/fcntl.h +16 -0
  112. package/sdk/ios/wasm/include/string.h +5 -0
  113. package/sdk/native-hashes.json +1 -1
  114. package/src/dns-over-https.ts +61 -9
  115. package/src/expo-swift-bundle.ts +2 -7
  116. package/src/expo-swift-host.ts +11 -3
  117. package/src/host/fetch-proxy-handler.ts +51 -2
  118. package/src/host/fetch-proxy-overrides.ts +4 -0
  119. package/src/host/hostname-resolver.ts +9 -5
  120. package/src/native-app-identity-project.ts +13 -2
  121. package/src/native-app-identity.ts +47 -0
  122. package/src/nitro-adapter.lock.json +260 -260
  123. package/src/nitro-bundle.ts +7 -10
  124. package/src/nitro-superset.lock.json +4 -4
  125. package/src/podspec-sources.ts +20 -0
  126. package/src/storageSnapshotContract.ts +20 -1
  127. package/src/swift-compile.ts +409 -77
  128. package/src/swift-compiler-digest.ts +15 -0
  129. package/src/swift-coverage/xcode-packages.ts +3 -2
  130. package/src/swift-distribution.lock.json +12 -12
  131. package/src/swift-guest-archive.ts +153 -0
  132. package/src/swift-guest-compile.ts +449 -0
  133. package/src/swift-guest-image-ledger.ts +656 -0
  134. package/src/swift-guest-link-plan.ts +52 -0
  135. package/src/swift-guest-link.ts +1414 -0
  136. package/src/swift-guest-linked-spans.ts +338 -0
  137. package/src/swift-guest-manifest.ts +141 -0
  138. package/src/swift-guest-projection-storage.ts +310 -0
  139. package/src/swift-guest-projection.ts +252 -0
  140. package/src/swift-guest-runtime-plan.ts +834 -0
  141. package/src/swift-guest-source-inputs.ts +427 -0
  142. package/src/swift-guest-source-plan.ts +279 -0
  143. package/src/swift-host.ts +157 -36
  144. package/src/swift-icu.ts +60 -18
  145. package/src/swift-link-roots.ts +27 -50
  146. package/src/swift-package-manifest.ts +34 -18
  147. package/src/swift-package.ts +32 -2
  148. package/src/swift-packages.ts +138 -17
  149. package/src/swift-runtime-products.ts +73 -0
  150. package/src/swift-shared-sdk.ts +1 -1
  151. package/src/swift-submit.ts +15 -3
  152. package/src/swift-toolchain.ts +18 -0
  153. package/src/swift-wasm-prune.ts +313 -14
  154. package/src/swiftContract.ts +83 -0
  155. package/src/swiftRuntimeProductContract.ts +85 -45
  156. package/src/turbo-bundle.ts +1 -1
  157. package/src/turbo-codegen-intake.ts +10 -3
  158. package/src/turbo-runtime.lock.json +23 -23
  159. package/src/wasm-optimize.ts +16 -4
  160. package/src/xcode-project.ts +142 -14
@@ -0,0 +1,534 @@
1
+ /*
2
+ * Copyright (c) 2013-2016 Apple Inc. All rights reserved.
3
+ */
4
+
5
+ #ifndef __OS_ACTIVITY_H__
6
+ #define __OS_ACTIVITY_H__
7
+
8
+ #include <os/trace_base.h>
9
+
10
+ __BEGIN_DECLS
11
+
12
+ OS_ASSUME_NONNULL_BEGIN
13
+
14
+ #pragma mark - types and globals
15
+
16
+ #if OS_LOG_TARGET_HAS_10_12_FEATURES
17
+ #ifndef OS_ACTIVITY_OBJECT_API
18
+ #define OS_ACTIVITY_OBJECT_API 1
19
+ #endif // OS_ACTIVITY_OBJECT_API
20
+ #else
21
+ #if OS_ACTIVITY_OBJECT_API
22
+ #error Please change your minimum OS requirements because OS_ACTIVITY_OBJECT_API is not available
23
+ #endif // OS_ACTIVITY_OBJECT_API
24
+ #define OS_ACTIVITY_OBJECT_API 0
25
+ #endif // OS_LOG_TARGET_HAS_10_12_FEATURES
26
+
27
+ /*!
28
+ * @enum os_activity_flag_t
29
+ *
30
+ * @discussion
31
+ * Support flags for os_activity_create or os_activity_start.
32
+ *
33
+ * @constant OS_ACTIVITY_FLAG_DEFAULT
34
+ * Use the default flags.
35
+ *
36
+ * @constant OS_ACTIVITY_FLAG_DETACHED
37
+ * Detach the newly created activity from the provided activity (if any). If
38
+ * passed in conjunction with an exiting activity, the activity will only note
39
+ * what activity "created" the new one, but will make the new activity a top
40
+ * level activity. This allows users to see what activity triggered work
41
+ * without actually relating the activities.
42
+ *
43
+ * @constant OS_ACTIVITY_FLAG_IF_NONE_PRESENT
44
+ * Will only create a new activity if none present. If an activity ID is
45
+ * already present, a new object will be returned with the same activity ID
46
+ * underneath.
47
+ *
48
+ * Passing both OS_ACTIVITY_FLAG_DETACHED and OS_ACTIVITY_FLAG_IF_NONE_PRESENT
49
+ * is undefined.
50
+ */
51
+ OS_ENUM(os_activity_flag, uint32_t,
52
+ OS_ACTIVITY_FLAG_DEFAULT = 0,
53
+ OS_ACTIVITY_FLAG_DETACHED = 0x1,
54
+ OS_ACTIVITY_FLAG_IF_NONE_PRESENT = 0x2
55
+ );
56
+
57
+ #if OS_ACTIVITY_OBJECT_API
58
+
59
+ #define OS_ACTIVITY_NULL NULL
60
+
61
+ /*!
62
+ * @typedef os_activity_t
63
+ * An opaque activity object.
64
+ */
65
+ API_AVAILABLE(macos(10.12), ios(10.0), watchos(3.0), tvos(10.0))
66
+ #if OS_OBJECT_USE_OBJC
67
+ OS_OBJECT_DECL(os_activity);
68
+ #else
69
+ typedef struct os_activity_s *os_activity_t;
70
+ #endif /* OS_OBJECT_USE_OBJC */
71
+
72
+ /*!
73
+ * @const OS_ACTIVITY_NONE
74
+ *
75
+ * @discussion
76
+ * Create activity with no current traits, this is the equivalent of a
77
+ * detached activity.
78
+ */
79
+ #define OS_ACTIVITY_NONE OS_OBJECT_GLOBAL_OBJECT(os_activity_t, _os_activity_none)
80
+ API_AVAILABLE(macos(10.12), ios(10.0), watchos(3.0), tvos(10.0))
81
+ OS_EXPORT
82
+ struct os_activity_s _os_activity_none;
83
+
84
+ /*!
85
+ * @const OS_ACTIVITY_CURRENT
86
+ *
87
+ * @discussion
88
+ * Create activity and links to the current activity if one is present.
89
+ * If no activity is present it is treated as if it is detached.
90
+ */
91
+ #define OS_ACTIVITY_CURRENT OS_OBJECT_GLOBAL_OBJECT(os_activity_t, _os_activity_current)
92
+ API_AVAILABLE(macos(10.12), ios(10.0), watchos(3.0), tvos(10.0))
93
+ OS_EXPORT
94
+ struct os_activity_s _os_activity_current;
95
+
96
+ #else // !OS_ACTIVITY_OBJECT_API
97
+
98
+ #define OS_ACTIVITY_NULL 0
99
+
100
+ /*!
101
+ * @typedef os_activity_t
102
+ * An opaque activity identifier.
103
+ */
104
+ API_AVAILABLE(macos(10.10), ios(8.0), watchos(2.0), tvos(9.0))
105
+ typedef uint64_t os_activity_t;
106
+
107
+ #endif // OS_ACTIVITY_OBJECT_API
108
+
109
+ /*!
110
+ * @typedef os_activity_id_t
111
+ * An value representing the activity ID assigned to an newly created activity.
112
+ */
113
+ API_AVAILABLE(macos(10.10), ios(8.0), watchos(2.0), tvos(9.0))
114
+ typedef uint64_t os_activity_id_t;
115
+
116
+ /*!
117
+ * @typedef os_activity_scope_state_t
118
+ * Structure that is populated by os_activity_scope_enter and restored using
119
+ * os_activity_scope_leave.
120
+ */
121
+ API_AVAILABLE(macos(10.12), ios(10.0), watchos(3.0), tvos(10.0))
122
+ typedef struct os_activity_scope_state_s {
123
+ uint64_t opaque[2];
124
+ } *os_activity_scope_state_t;
125
+
126
+ #pragma mark - Internal support functions
127
+
128
+ #if OS_ACTIVITY_OBJECT_API
129
+ API_AVAILABLE(macos(10.12), ios(10.0), watchos(3.0), tvos(10.0))
130
+ OS_EXPORT OS_NOTHROW OS_WARN_RESULT_NEEDS_RELEASE OS_NOT_TAIL_CALLED
131
+ OS_OBJECT_RETURNS_RETAINED
132
+ os_activity_t
133
+ _os_activity_create(void *dso, const char *description, os_activity_t activity,
134
+ os_activity_flag_t flags);
135
+ #endif
136
+
137
+ /*!
138
+ * @function _os_activity_label_useraction
139
+ *
140
+ * @abstract
141
+ * Internal function for use by os_activity_label_useraction.
142
+ *
143
+ * @warning
144
+ * Do not use directly.
145
+ */
146
+ API_AVAILABLE(macos(10.12), ios(10.0), watchos(3.0), tvos(10.0))
147
+ OS_EXPORT OS_NOTHROW OS_NOT_TAIL_CALLED
148
+ void
149
+ _os_activity_label_useraction(void *dso, const char *name);
150
+
151
+ /*!
152
+ * @function _os_activity_initiate
153
+ *
154
+ * @abstract
155
+ * Do not use directly because your description will not be preserved.
156
+ */
157
+ API_AVAILABLE(macos(10.10), ios(8.0), watchos(2.0), tvos(9.0))
158
+ OS_EXPORT OS_NOTHROW OS_NOT_TAIL_CALLED
159
+ void
160
+ _os_activity_initiate(void *dso, const char *description,
161
+ os_activity_flag_t flags, os_block_t activity_block OS_NOESCAPE);
162
+
163
+ /*!
164
+ * @function _os_activity_initiate_f
165
+ *
166
+ * @abstract
167
+ * Do not use directly because your description will not be preserved.
168
+ */
169
+ API_AVAILABLE(macos(10.10), ios(8.0), watchos(2.0), tvos(9.0))
170
+ OS_EXPORT OS_NOTHROW OS_NOT_TAIL_CALLED
171
+ void
172
+ _os_activity_initiate_f(void *dso, const char *description,
173
+ os_activity_flag_t flags, void *context, os_function_t function);
174
+
175
+ #pragma mark - activity related
176
+
177
+ /*!
178
+ * @function os_activity_initiate
179
+ *
180
+ * @abstract
181
+ * Synchronously initiates an activity using provided block.
182
+ *
183
+ * @discussion
184
+ * Synchronously initiates an activity using the provided block and creates
185
+ * a tracing buffer as appropriate. All new activities are created as a
186
+ * subactivity of an existing activity on the current thread.
187
+ *
188
+ * <code>
189
+ * os_activity_initiate("indexing database", OS_ACTIVITY_FLAG_DEFAULT, ^(void) {
190
+ * // either do work directly or issue work asynchronously
191
+ * });
192
+ * </code>
193
+ *
194
+ * @param description
195
+ * A constant string describing the activity, e.g., "performClick" or
196
+ * "menuSelection".
197
+ *
198
+ * @param flags
199
+ * Flags to be used when initiating the activity, typically
200
+ * OS_ACTIVITY_FLAG_DEFAULT.
201
+ *
202
+ * @param activity_block
203
+ * The block to execute a given activity
204
+ */
205
+ #define os_activity_initiate(description, flags, activity_block) __extension__({ \
206
+ OS_LOG_STRING(ACT, __description, description); \
207
+ _os_activity_initiate(&__dso_handle, __description, flags, activity_block); \
208
+ })
209
+
210
+ /*!
211
+ * @function os_activity_initiate_f
212
+ *
213
+ * @abstract
214
+ * Synchronously initiates an activity using the provided function.
215
+ *
216
+ * @discussion
217
+ * Synchronously initiates an activity using the provided function and creates
218
+ * a tracing buffer as appropriate. All new activities are created as a
219
+ * subactivity of an existing activity on the current thread.
220
+ *
221
+ * <code>
222
+ * os_activity_initiate_f("indexing database", OS_ACTIVITY_FLAG_DEFAULT, context, function);
223
+ * </code>
224
+ *
225
+ * @param description
226
+ * A constant string describing the activity, e.g., "performClick" or
227
+ * "menuSelection".
228
+ *
229
+ * @param flags
230
+ * Flags to be used when initiating the activity, typically
231
+ * OS_ACTIVITY_FLAG_DEFAULT.
232
+ *
233
+ * @param context
234
+ * An optional context that will be supplied to the activity function.
235
+ *
236
+ * @param activity_func
237
+ * The function to execute for the new activity.
238
+ */
239
+ #define os_activity_initiate_f(description, flags, context, function) __extension__({ \
240
+ OS_LOG_STRING(ACT, __description, description); \
241
+ _os_activity_initiate_f(&__dso_handle, __description, flags, context, function); \
242
+ })
243
+
244
+ #if OS_ACTIVITY_OBJECT_API
245
+ /*!
246
+ * @function os_activity_create
247
+ *
248
+ * @abstract
249
+ * Creates an os_activity_t object which can be passed to os_activity_apply
250
+ * function.
251
+ *
252
+ * @param description
253
+ * Pass a description for the activity. The description must be a constant
254
+ * string within the calling executable or library.
255
+ *
256
+ * @param parent_activity
257
+ * Depending on flags will link the newly created activity to the value passed
258
+ * or note where the activity was created. Possible activities include:
259
+ * OS_ACTIVITY_NONE, OS_ACTIVITY_CURRENT or any existing os_activity_t object
260
+ * created using os_activity_create.
261
+ *
262
+ * @param flags
263
+ * A valid os_activity_flag_t which will determine behavior of the newly created
264
+ * activity.
265
+ *
266
+ * If the OS_ACTIVITY_FLAG_DETACHED flag is passed, the value passed to the
267
+ * parent_activity argument is ignored, and OS_ACTIVITY_NONE is used instead.
268
+ *
269
+ * If the OS_ACTIVITY_FLAG_IF_NONE_PRESENT flag is passed, then passing another
270
+ * value than OS_ACTIVITY_CURRENT to the parent_activity argument is undefined.
271
+ *
272
+ * @result
273
+ * Returns an os_activity_t object which can be used with os_activity_apply.
274
+ */
275
+ #define os_activity_create(description, parent_activity, flags) __extension__({ \
276
+ OS_LOG_STRING(ACT, __description, description); \
277
+ _os_activity_create(&__dso_handle, __description, parent_activity, flags); \
278
+ })
279
+
280
+ /*!
281
+ * @function os_activity_apply
282
+ *
283
+ * @abstract
284
+ * Execute a block using a given activity object.
285
+ *
286
+ * @param activity
287
+ * The given activity object created with os_activity_create() or
288
+ * OS_ACTIVITY_NONE.
289
+ *
290
+ * @param block
291
+ * Pass the block to be executed within the context of the given activity.
292
+ */
293
+ API_AVAILABLE(macos(10.12), ios(10.0), watchos(3.0), tvos(10.0))
294
+ OS_EXPORT OS_NOTHROW
295
+ void
296
+ os_activity_apply(os_activity_t activity, os_block_t block OS_NOESCAPE);
297
+
298
+ /*!
299
+ * @function os_activity_apply_f
300
+ *
301
+ * @abstract
302
+ * Execute a given function with a provided activity.
303
+ *
304
+ * @param activity
305
+ * The given activity object created with os_activity_create() or
306
+ * OS_ACTIVITY_NONE.
307
+ *
308
+ * @param context
309
+ * Context to pass to the function which may be NULL.
310
+ *
311
+ * @param function
312
+ * Pass the function to be executed within the context of the given activity.
313
+ */
314
+ API_AVAILABLE(macos(10.12), ios(10.0), watchos(3.0), tvos(10.0))
315
+ OS_EXPORT OS_NOTHROW
316
+ void
317
+ os_activity_apply_f(os_activity_t activity, void *context,
318
+ os_function_t function);
319
+
320
+ /*!
321
+ * @function os_activity_scope_enter
322
+ *
323
+ * @abstract
324
+ * Will change the current execution context to use the provided activity.
325
+ *
326
+ * @discussion
327
+ * Will change the current execution context to use the provided activity.
328
+ * An activity can be created and then applied to the current scope by doing:
329
+ *
330
+ * <code>
331
+ * struct os_activity_scope_state_s state;
332
+ * os_activity_t activity = os_activity_create("my new activity", 0);
333
+ * os_activity_scope_enter(activity, &state);
334
+ * ... do some work ...
335
+ * os_activity_scope_leave(&state);
336
+ * </code>
337
+ *
338
+ * To auto-cleanup state call:
339
+ *
340
+ * os_activity_scope(activity);
341
+ *
342
+ * @param activity
343
+ * Pass a valid activity created with os_activity_create or any global object.
344
+ *
345
+ * @param state
346
+ * A stack-based struct os_activity_scope_state_s to store the state.
347
+ */
348
+ API_AVAILABLE(macos(10.12), ios(10.0), watchos(3.0), tvos(10.0))
349
+ OS_EXPORT OS_NOTHROW
350
+ void
351
+ os_activity_scope_enter(os_activity_t activity, os_activity_scope_state_t state);
352
+
353
+ /*!
354
+ * @function os_activity_scope_leave
355
+ *
356
+ * @abstract
357
+ * Will pop state up to the state provided.
358
+ *
359
+ * @discussion
360
+ * Will leave scope using the state provided. If state is not present an error
361
+ * will be generated.
362
+ *
363
+ * @param state
364
+ * Must be a valid value filled by os_activity_scope_enter call.
365
+ */
366
+ API_AVAILABLE(macos(10.12), ios(10.0), watchos(3.0), tvos(10.0))
367
+ OS_EXPORT OS_NOTHROW
368
+ void
369
+ os_activity_scope_leave(os_activity_scope_state_t state);
370
+
371
+ #if defined(__GNUC__)
372
+ #define _os_activity_scope(var, activity) \
373
+ struct os_activity_scope_state_s var __attribute__((__cleanup__(os_activity_scope_leave))); \
374
+ os_activity_scope_enter(activity, &var)
375
+ #define os_activity_scope(activity) _os_activity_scope(OS_CONCAT(scope, __COUNTER__), activity)
376
+ #endif
377
+
378
+ #endif // OS_ACTIVITY_OBJECT_API
379
+
380
+ /*!
381
+ * @function os_activity_get_active
382
+ *
383
+ * @abstract
384
+ * Returns the stack of nested activities associated with the current thread.
385
+ *
386
+ * @discussion
387
+ * Activities have a sense of nesting and therefore there could be more than
388
+ * one activity involved on the current thread. This should be used by
389
+ * diagnostic tools only for making additional decisions about a situation.
390
+ *
391
+ * @param entries
392
+ * Pass a buffer of sufficient size to hold the the number of os_activity_id_t
393
+ * being requested.
394
+ *
395
+ * @param count
396
+ * Pointer to the requested number of activity identifiers.
397
+ * On output will be filled with the number of activities that are available.
398
+ *
399
+ * @result
400
+ * Number of activity identifiers written to 'entries'
401
+ */
402
+ API_DEPRECATED("No longer supported", macos(10.10, 10.12), ios(8.0, 10.0),
403
+ watchos(2.0, 3.0), tvos(9.0, 10.0))
404
+ OS_EXPORT OS_NOTHROW
405
+ unsigned int
406
+ os_activity_get_active(os_activity_id_t *entries, unsigned int *count);
407
+
408
+ /*!
409
+ * @function os_activity_get_identifier
410
+ *
411
+ * @abstract
412
+ * Returns the current activity ID and will fill the parent_id if present.
413
+ *
414
+ * @discussion
415
+ * Returns the current activity ID and will fill the parent_id if present.
416
+ *
417
+ * @param parent_id
418
+ * If non-null will set the parent activity ID.
419
+ *
420
+ * @result
421
+ * The identifier for the provided activity.
422
+ */
423
+ API_AVAILABLE(macos(10.12), ios(10.0), watchos(3.0), tvos(10.0))
424
+ OS_EXPORT OS_NOTHROW OS_WARN_RESULT
425
+ os_activity_id_t
426
+ os_activity_get_identifier(os_activity_t activity,
427
+ os_activity_id_t *_Nullable parent_id);
428
+
429
+ /*!
430
+ * @function os_activity_label_useraction
431
+ *
432
+ * @abstract
433
+ * Label an activity that is auto-generated by AppKit/UIKit with a name that is
434
+ * useful for debugging macro-level user actions.
435
+ *
436
+ * @discussion
437
+ * Label an activity that is auto-generated by AppKit/UIKit with a name that is
438
+ * useful for debugging macro-level user actions. The API should be called
439
+ * early within the scope of the IBAction and before any sub-activities are
440
+ * created. The name provided will be shown in tools in additon to the
441
+ * underlying AppKit/UIKit provided name. This API can only be called once and
442
+ * only on the activity created by AppKit/UIKit. These actions help determine
443
+ * workflow of the user in order to reproduce problems that occur. For example,
444
+ * a control press and/or menu item selection can be labeled:
445
+ *
446
+ * <code>
447
+ * os_activity_label_useraction("New mail message");
448
+ * os_activity_label_useraction("Empty trash");
449
+ * </code>
450
+ *
451
+ * Where the underlying AppKit/UIKit name will be "gesture:" or "menuSelect:".
452
+ *
453
+ * @param name
454
+ * A constant string that describes the the action.
455
+ */
456
+ #define os_activity_label_useraction(label) __extension__({ \
457
+ OS_LOG_STRING(ACT, __label, label); \
458
+ _os_activity_label_useraction(&__dso_handle, __label); \
459
+ })
460
+
461
+ #pragma mark - deprecated function support
462
+
463
+ /*!
464
+ * @function _os_activity_start
465
+ *
466
+ * @abstract
467
+ * Internal function for activity start, do not use directly will not preserve
468
+ * description.
469
+ */
470
+ API_DEPRECATED("use combination of os_activity_create and os_activity_apply/os_activity_scope",
471
+ macos(10.10, 10.12), ios(8.0, 10.0), watchos(2.0, 3.0), tvos(9.0, 10.0))
472
+ OS_EXPORT OS_NOTHROW OS_WARN_RESULT OS_NOT_TAIL_CALLED
473
+ os_activity_t
474
+ _os_activity_start(void *dso, const char *description, os_activity_flag_t flags);
475
+
476
+ /*!
477
+ * @function os_activity_start
478
+ *
479
+ * @warning
480
+ * Deprecated please use new os_activity_create and os_activity_apply.
481
+ */
482
+ #define os_activity_start(description, flags) __extension__({ \
483
+ OS_LOG_STRING(ACT, __description, description); \
484
+ _os_activity_start(&__dso_handle, __description, flags); \
485
+ })
486
+
487
+ /*!
488
+ * @function os_activity_end
489
+ *
490
+ * @warning
491
+ * Deprecated please use new os_activity_create and os_activity_apply.
492
+ */
493
+ API_DEPRECATED("use combination of os_activity_create and os_activity_apply/os_activity_scope",
494
+ macos(10.10, 10.12), ios(8.0, 10.0), watchos(2.0, 3.0), tvos(9.0, 10.0))
495
+ OS_EXPORT OS_NOTHROW
496
+ void
497
+ os_activity_end(os_activity_t activity);
498
+
499
+ /*!
500
+ * @typedef os_breadcrumb_t
501
+ * An opaque value for the breadcrumb ID.
502
+ */
503
+ API_DEPRECATED("No longer supported", macos(10.10, 10.12), ios(8.0, 10.0),
504
+ watchos(2.0, 3.0), tvos(9.0, 10.0))
505
+ typedef uint32_t os_breadcrumb_t;
506
+
507
+ /*!
508
+ * @function _os_activity_set_breadcrumb
509
+ *
510
+ * @warning
511
+ * Deprecated, please use os_activity_label_useraction.
512
+ */
513
+ API_DEPRECATED_WITH_REPLACEMENT("os_activity_label_useraction",
514
+ macos(10.10, 10.12), ios(8.0, 10.0), watchos(2.0, 3.0), tvos(9.0, 10.0))
515
+ OS_EXPORT OS_NOTHROW OS_NOT_TAIL_CALLED
516
+ void
517
+ _os_activity_set_breadcrumb(void *dso, const char *name);
518
+
519
+ /*!
520
+ * @function os_activity_set_breadcrumb
521
+ *
522
+ * @warning
523
+ * Deprecated, please use os_activity_label_useraction.
524
+ */
525
+ #define os_activity_set_breadcrumb(name) __extension__({ \
526
+ OS_LOG_STRING(ACT, __name, name); \
527
+ _os_activity_set_breadcrumb(&__dso_handle, __name); \
528
+ })
529
+
530
+ OS_ASSUME_NONNULL_END
531
+
532
+ __END_DECLS
533
+
534
+ #endif // __OS_ACTIVITY_H__
@@ -1,4 +1,14 @@
1
1
  module os [system] {
2
+ module trace_base {
3
+ header "os/trace_base.h"
4
+ export *
5
+ }
6
+
7
+ explicit module activity {
8
+ header "os/activity.h"
9
+ export *
10
+ }
11
+
2
12
  explicit module log {
3
13
  header "os/log.h"
4
14
  export *
@@ -9,6 +19,11 @@ module os [system] {
9
19
  export *
10
20
  }
11
21
 
22
+ explicit module trace {
23
+ header "os/trace.h"
24
+ export *
25
+ }
26
+
12
27
  module lock {
13
28
  header "os/lock.h"
14
29
  export *
@@ -2,8 +2,24 @@
2
2
  // darwin's cancellation points bind to the darwin provider, which acts on a
3
3
  // pending cancel first.
4
4
  #include <sys/_types/_mode_t.h>
5
+ // wasi's flock has a different field order from the iOS ABI.
6
+ #define flock __peach_wasi_flock
5
7
  #include_next <fcntl.h>
8
+ #undef flock
6
9
  #include <sys/cdefs.h>
10
+ struct flock {
11
+ off_t l_start;
12
+ off_t l_len;
13
+ pid_t l_pid;
14
+ short l_type;
15
+ short l_whence;
16
+ };
17
+ #define F_GETLK 7
18
+ #define F_SETLK 8
19
+ #define F_SETLKW 9
20
+ #define F_RDLCK 1
21
+ #define F_UNLCK 2
22
+ #define F_WRLCK 3
7
23
  // darwin's path and cache commands and file security records. no installed
8
24
  // libc command shares F_GETPATH's or F_NOCACHE's number: the darwin provider
9
25
  // answers F_GETPATH from the path it recorded when the guest opened the
@@ -17,4 +17,9 @@ char *strcasestr(const char *__big, const char *__little);
17
17
  #include <sys/_types/_rsize_t.h>
18
18
  errno_t memset_s(void *__s, rsize_t __smax, int __c, rsize_t __n);
19
19
  #endif
20
+ #if defined(__STDC_WANT_LIB_EXT1__) && __STDC_WANT_LIB_EXT1__ >= 1
21
+ #include <sys/_types/_errno_t.h>
22
+ #include <sys/_types/_rsize_t.h>
23
+ errno_t memset_s(void *__s, rsize_t __smax, int __c, rsize_t __n);
24
+ #endif
20
25
  __END_DECLS
@@ -77,7 +77,7 @@
77
77
  {
78
78
  "path": "System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes",
79
79
  "nativeSha256": "025956c54d34391f2c422b736710641a860694436f5b8a34d719ade2d9ed3220",
80
- "sha256": "93c2ba06e63400fb206ef3931099e3b5a59add909b5263ab8b3c8e5fb995fd88",
80
+ "sha256": "8dc2bc8008ae1d31401458ec776a9c2f356ff6ffdb890bb409bc79b07318b651",
81
81
  "change": "hide NSArray arrayWithObjects:count: from Swift, nest FileManager sync control and URLSession delayed request and multipath enums, import networking singleton and selector names, and hide native members whose Swift implementation supplies the existing typed declaration",
82
82
  "reason": "the Objective-C header owns the networking classes and categories; their Swift implementation must use the native imported names without the obsolete moved-type aliases or duplicate Swift-owned session classes"
83
83
  },
@@ -45,11 +45,59 @@ export async function resolveHostIps(
45
45
  return addresses.length ? addresses : null
46
46
  }
47
47
 
48
- export async function resolveHostnameAtEdge(
48
+ const loopbackV4 = [127, 0, 0, 1]
49
+ const loopbackV6 = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]
50
+
51
+ // the bytes of a textual ipv4 or ipv6 address, or null for any other text.
52
+ export function parseIpLiteral(text: string): number[] | null {
53
+ if (text.includes(':')) return parseIpv6(text)
54
+ const parts = text.split('.')
55
+ if (parts.length !== 4 || !parts.every((part) => /^\d{1,3}$/.test(part))) return null
56
+ const bytes = parts.map(Number)
57
+ return bytes.every((byte) => byte <= 255) ? bytes : null
58
+ }
59
+
60
+ function parseIpv6(text: string): number[] | null {
61
+ const halves = text.split('::')
62
+ if (halves.length > 2) return null
63
+ const words = (side: string): number[] | null => {
64
+ if (side === '') return []
65
+ const groups = side.split(':')
66
+ const result: number[] = []
67
+ for (const [index, group] of groups.entries()) {
68
+ if (group.includes('.')) {
69
+ const isLast =
70
+ index === groups.length - 1 && (side !== halves[0] || halves.length === 1)
71
+ const v4 = isLast ? parseIpLiteral(group) : null
72
+ if (!v4) return null
73
+ result.push(v4[0] * 256 + v4[1], v4[2] * 256 + v4[3])
74
+ } else if (/^[0-9a-f]{1,4}$/i.test(group)) result.push(parseInt(group, 16))
75
+ else return null
76
+ }
77
+ return result
78
+ }
79
+ const head = words(halves[0])
80
+ const tail = halves.length === 2 ? words(halves[1]) : []
81
+ if (!head || !tail) return null
82
+ const missing = 8 - head.length - tail.length
83
+ if (halves.length === 2 ? missing < 1 : missing !== 0) return null
84
+ return [...head, ...Array<number>(missing).fill(0), ...tail].flatMap((word) => [
85
+ word >> 8,
86
+ word & 255,
87
+ ])
88
+ }
89
+
90
+ // the addresses a name resolves to, as 4 or 16 byte arrays; empty when the
91
+ // name does not exist. a numeric host is its own address, and localhost is
92
+ // ::1 then 127.0.0.1 as the ios resolver answers it.
93
+ export async function resolveHostAddressesAtEdge(
49
94
  host: string,
50
95
  fetcher: typeof fetch = fetch,
51
- ): Promise<boolean> {
52
- if (host.toLowerCase().replace(/\.$/, '') === 'localhost') return true
96
+ ): Promise<number[][]> {
97
+ if (host.toLowerCase().replace(/\.$/, '') === 'localhost')
98
+ return [loopbackV6, loopbackV4]
99
+ const literal = parseIpLiteral(host)
100
+ if (literal) return [literal]
53
101
  try {
54
102
  const url = new URL(`http://${host}`)
55
103
  if (
@@ -58,13 +106,17 @@ export async function resolveHostnameAtEdge(
58
106
  url.port ||
59
107
  url.pathname !== '/' ||
60
108
  url.search ||
61
- url.hash
109
+ url.hash ||
110
+ url.hostname.startsWith('[')
62
111
  )
63
- return false
64
- if (/^\d+\.\d+\.\d+\.\d+$/.test(url.hostname) || url.hostname.startsWith('['))
65
- return true
112
+ return []
66
113
  } catch {
67
- return false
114
+ return []
68
115
  }
69
- return (await resolveHostIps(host, fetcher)) !== null
116
+ const addresses = (await resolveHostIps(host, fetcher)) ?? []
117
+ return addresses.map((address) => {
118
+ const bytes = parseIpLiteral(address)
119
+ if (!bytes) throw new Error('dns resolver returned an invalid address')
120
+ return bytes
121
+ })
70
122
  }