expo-modules-macros 0.27.0 → 0.27.1

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.
Binary file
@@ -334,13 +334,18 @@ internal struct JSFunction {
334
334
  // The parameter list is parenthesized and fully typed, since Swift rejects a type annotation on
335
335
  // a shorthand `{ [capture] name, name in }` parameter.
336
336
  // A sync function binds through the result-slot overload (`JavaScriptRuntime.HostFunctionClosure`):
337
- // it encodes its result into the slot and gets the runtime as a parameter. A function that returns
338
- // nothing writes nothing, so JS gets `undefined` without a value being built.
337
+ // it encodes its result into the slot and gets the runtime as a parameter. A sync function that
338
+ // returns nothing binds through the `Void` overload (`JavaScriptRuntime.VoidFunctionClosure`)
339
+ // instead, which leaves JS's result as `undefined`. A call through it is faster than through a
340
+ // result-slot closure that writes nothing. The closure declares `-> Void` because a body of several
341
+ // statements without a `return` is otherwise ambiguous between the overloads.
339
342
  let captures = receiver.captureClause
340
343
  let parameters =
341
344
  isAsync
342
345
  ? "(this: borrowing JavaScriptUnownedValue, arguments: consuming JavaScriptValuesBuffer)"
343
- : resultSlotClosureParameters
346
+ : returnType == nil
347
+ ? "(this: borrowing JavaScriptUnownedValue, arguments: consuming JavaScriptValuesBuffer) -> Void"
348
+ : resultSlotClosureParameters
344
349
 
345
350
  return """
346
351
  \(object).setProperty("\(jsName)") { \(captures)\(parameters) in
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expo-modules-macros",
3
- "version": "0.27.0",
3
+ "version": "0.27.1",
4
4
  "description": "Swift macro plugin for Expo modules",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",
@@ -26,9 +26,9 @@
26
26
  "typescript": "^5.4.0"
27
27
  },
28
28
  "optionalDependencies": {
29
- "@expo/modules-macros-linux-arm64": "0.27.0",
30
- "@expo/modules-macros-linux-x64": "0.27.0",
31
- "@expo/modules-macros-win32-arm64": "0.27.0",
32
- "@expo/modules-macros-win32-x64": "0.27.0"
29
+ "@expo/modules-macros-linux-arm64": "0.27.1",
30
+ "@expo/modules-macros-linux-x64": "0.27.1",
31
+ "@expo/modules-macros-win32-arm64": "0.27.1",
32
+ "@expo/modules-macros-win32-x64": "0.27.1"
33
33
  }
34
34
  }