snapback4-expo 0.4.29 → 0.4.30

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/README.md CHANGED
@@ -31,9 +31,16 @@ SQLite and the native-query Wasm host. The earlier module measured 1.7 MB
31
31
  linked and about a millisecond per call; those measurements predate the
32
32
  native-query host.
33
33
 
34
- The pinned Expo 57.0.22 apps list `snapback4-expo/plugin` in app.json's
34
+ The pinned Expo 57.0.30 apps list `snapback4-expo/plugin` in app.json's
35
35
  `plugins`. Keep that entry when generating iOS: it supplies the scene lifecycle
36
36
  required by Xcode 27, shared by the reference chat app and both starters.
37
+ It also adds the selected Xcode build to ExpoModulesJSI's slice-cache key:
38
+ 27.0 and 27.1 can share a Swift compiler version but require different SDK
39
+ modules ([upstream issue](https://github.com/expo/expo/issues/50365)).
40
+ The patch is idempotent, applies during iOS prebuild, and refuses an unknown
41
+ upstream script instead of silently leaving an incompatible cache. Regenerate
42
+ iOS after installing/upgrading dependencies or changing Xcode; direct native
43
+ builds then invalidate the patched cache when the selected Xcode changes.
37
44
  After adding it, run `npx expo prebuild --platform ios`, rebuild Release and
38
45
  reinstall. Preserve custom native changes when regenerating; the plugin handles
39
46
  the standard Swift starter and refuses custom delegates/manifests.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "snapback4-expo",
3
- "version": "0.4.29",
3
+ "version": "0.4.30",
4
4
  "type": "module",
5
5
  "description": "Snapback 4's native module for Expo: the device in Rust (the partition in its own SQLite, the stream applied, the outbox kept, queries and predictions answered) behind one JSON call, and the opener `snapback4/native` takes.",
6
6
  "main": "src/index.ts",
@@ -26,11 +26,11 @@
26
26
  "export-ios.mjs"
27
27
  ],
28
28
  "peerDependencies": {
29
- "expo": "*",
29
+ "expo": ">=57.0.30 <58",
30
30
  "snapback4": "*"
31
31
  },
32
32
  "devDependencies": {
33
- "expo-modules-core": "*",
33
+ "expo-modules-core": "57.0.23",
34
34
  "typescript": "5.9.3"
35
35
  },
36
36
  "bin": {
package/plugin.cjs CHANGED
@@ -1,5 +1,5 @@
1
- // @ref LLP 3000.030#13 — one published lifecycle for reference and generated Expo 57.0.22 apps; preserve existing plugin configs.
2
- const { withAppDelegate, withInfoPlist } = require('expo/config-plugins');
1
+ // @ref LLP 3000.030#13 — one published lifecycle for reference and generated Expo 57.0.30 apps; preserve existing plugin configs.
2
+ const { withAppDelegate, withInfoPlist, withDangerousMod } = require('expo/config-plugins');
3
3
  const marker = '// Snapback4 starter scene lifecycle';
4
4
  const legacy = `#if os(iOS) || os(tvOS)
5
5
  window = UIWindow(frame: UIScreen.main.bounds)
@@ -37,7 +37,36 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
37
37
  }
38
38
  }
39
39
  `;
40
+ // @ref LLP 3000.030#13 — Swift's version alone does not identify the SDK's C++ modules (expo/expo#50365).
41
+ const fs = require('node:fs');
42
+ const path = require('node:path');
43
+ const { createRequire } = require('node:module');
44
+ const { randomUUID } = require('node:crypto');
45
+ const cacheMarker = '# Snapback4: bind ExpoModulesJSI slices to the selected Xcode SDK';
46
+ function withJsiSdkCache(config) {
47
+ return withDangerousMod(config, ['ios', config => {
48
+ const app = createRequire(path.join(config.modRequest.projectRoot, 'package.json'));
49
+ const core = createRequire(app.resolve('expo-modules-core/package.json'));
50
+ const script = path.join(path.dirname(core.resolve('expo-modules-jsi/package.json')), 'apple/scripts/build-xcframework.sh');
51
+ const source = fs.readFileSync(script, 'utf8');
52
+ if (source.includes(cacheMarker)) return config;
53
+ const anchor = ' echo "TOOLCHAIN_VERSION=$(xcrun swiftc --version 2>/dev/null || true)"';
54
+ if (source.split(anchor).length !== 2) {
55
+ throw new Error('snapback4-expo/plugin cannot patch this ExpoModulesJSI cache script; use the qualified Expo 57.0.30 toolchain');
56
+ }
57
+ // Bun can hardlink installed files to its shared cache. Replace only this
58
+ // project's directory entry; never truncate the shared dependency inode.
59
+ const temporary = script + '.snapback4-' + randomUUID();
60
+ try {
61
+ fs.writeFileSync(temporary, source.replace(anchor, anchor + '\n ' + cacheMarker + '\n echo "XCODE_VERSION=$(xcodebuild -version)"'), { flag: 'wx' });
62
+ fs.chmodSync(temporary, fs.statSync(script).mode & 0o777);
63
+ fs.renameSync(temporary, script);
64
+ } finally { fs.rmSync(temporary, { force: true }); }
65
+ return config;
66
+ }]);
67
+ }
40
68
  module.exports = function withStarterScene(config) {
69
+ config = withJsiSdkCache(config);
41
70
  config = withAppDelegate(config, config => {
42
71
  const mod = config.modResults;
43
72
  if (mod.contents.includes(marker)) return config;