craft-native 0.0.446 → 0.0.451

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/dist/cli.js CHANGED
@@ -3228,7 +3228,7 @@ function pinCraftNativeDependency(packagePath, craftVersion) {
3228
3228
  `);
3229
3229
  }
3230
3230
  // package.json
3231
- var version = "0.0.446";
3231
+ var version = "0.0.451";
3232
3232
 
3233
3233
  // bin/cli.ts
3234
3234
  var spawnedFrom = process6.env[CRAFT_CLI_SPAWN_MARKER];
package/dist/index.cjs CHANGED
@@ -376,7 +376,7 @@ function craftBinaryNotFoundMessage(triedPath) {
376
376
  `);
377
377
  }
378
378
  // package.json
379
- var version = "0.0.446";
379
+ var version = "0.0.451";
380
380
 
381
381
  // src/sdk-version.ts
382
382
  var SDK_VERSION = version;
package/dist/index.js CHANGED
@@ -117,7 +117,7 @@ function craftBinaryNotFoundMessage(triedPath) {
117
117
  `);
118
118
  }
119
119
  // package.json
120
- var version = "0.0.446";
120
+ var version = "0.0.451";
121
121
 
122
122
  // src/sdk-version.ts
123
123
  var SDK_VERSION = version;
@@ -245,6 +245,9 @@ final class DriverTests: XCTestCase {
245
245
  /// nor any descendant has keyboard focus". A later tap lands once the app
246
246
  /// is idle again.
247
247
  func focus(_ target: XCUIElement, seconds: Double = 15) -> Bool {
248
+ // Retapping an already focused field can collapse its selection. A
249
+ // caller that just selected text must type into that same selection.
250
+ if hasKeyboardFocus(target) { return true }
248
251
  let end = Date().addingTimeInterval(seconds)
249
252
  repeat {
250
253
  target.tap()
@@ -295,7 +298,14 @@ final class DriverTests: XCTestCase {
295
298
  /// The switch answers `/exec` with 200 whatever the hook did, its first
296
299
  /// word the hook's exit code: only `exit 0` is a hook that worked.
297
300
  func hookSucceeded(_ answer: String) -> Bool {
298
- answer.trimmingCharacters(in: .whitespacesAndNewlines).hasPrefix("exit 0")
301
+ // get() already requires HTTP success. Custom control servers may
302
+ // return a message or no body. Preserve the legacy shell protocol's
303
+ // explicit failures, without accepting "exit 01" as a zero status.
304
+ let body = answer.trimmingCharacters(in: .whitespacesAndNewlines)
305
+ if body == "no such hook" { return false }
306
+ let fields = body.split(whereSeparator: { $0.isWhitespace })
307
+ guard fields.first == "exit" else { return true }
308
+ return fields.count >= 2 && fields[1] == "0"
299
309
  }
300
310
 
301
311
  func switchFlipped(from before: String?, to after: String?) -> Bool {
@@ -482,6 +492,12 @@ final class DriverTests: XCTestCase {
482
492
  check(false, "longpressid \(arg) is hittable")
483
493
  return
484
494
  }
495
+ if [.textField, .secureTextField, .textView].contains(target.elementType) {
496
+ guard focus(target) else {
497
+ check(false, "longpressid \(arg) takes keyboard focus")
498
+ return
499
+ }
500
+ }
485
501
  target.press(forDuration: 1.2)
486
502
  note("longpressid \(arg): ok")
487
503
  case "holdtab":
@@ -43,9 +43,9 @@ import process from "process";
43
43
  var macosToolchain = {
44
44
  zig: "0.18.0-dev.252+86dc5ce25",
45
45
  sources: {
46
- "zig-js": { repository: "zig-utils/zig-js", revision: "95d835edcbad55a7456cff76a9bb7ef6cdf265fc", paths: ["src", "include", "tests", "tools", "docs", "bench", "conformance"] },
46
+ "zig-js": { repository: "zig-utils/zig-js", revision: "58885b7dad974d15b4eb410dc617da64d8c29550", paths: ["src", "include", "tests", "tools", "docs", "bench", "conformance"] },
47
47
  "zig-regex": { repository: "zig-utils/zig-regex", revision: "fdd9c2e333ea6ac2fd06d080d939ef7f11d61b1b", paths: ["src"] },
48
- "zig-gc": { repository: "zig-utils/zig-gc", revision: "73c802e05768a729614e9c4296abb118aa06faf9", paths: ["src"] }
48
+ "zig-gc": { repository: "zig-utils/zig-gc", revision: "9bdb139cb4c6cdaa37b6fa2abebcf549cfe43762", paths: ["src"] }
49
49
  }
50
50
  };
51
51
  var defaultRun = async (args, cwd) => {
@@ -9,7 +9,7 @@ export declare const macosToolchain: {
9
9
  readonly sources: {
10
10
  readonly 'zig-js': {
11
11
  readonly repository: 'zig-utils/zig-js';
12
- readonly revision: '95d835edcbad55a7456cff76a9bb7ef6cdf265fc';
12
+ readonly revision: '58885b7dad974d15b4eb410dc617da64d8c29550';
13
13
  readonly paths: readonly ['src', 'include', 'tests', 'tools', 'docs', 'bench', 'conformance'];
14
14
  };
15
15
  readonly 'zig-regex': {
@@ -19,7 +19,7 @@ export declare const macosToolchain: {
19
19
  };
20
20
  readonly 'zig-gc': {
21
21
  readonly repository: 'zig-utils/zig-gc';
22
- readonly revision: '73c802e05768a729614e9c4296abb118aa06faf9';
22
+ readonly revision: '9bdb139cb4c6cdaa37b6fa2abebcf549cfe43762';
23
23
  readonly paths: readonly ['src'];
24
24
  };
25
25
  };
@@ -173,6 +173,12 @@ final class CraftMacRuntime {
173
173
  defer { JSGlobalContextRelease(created) }
174
174
  let context = ZigJSContext(jsGlobalContextRef: created)!
175
175
  self.context = context
176
+ // The bundle's parsed tree is kept between launches, in the app's own caches (entries are trusted,
177
+ // so never a shared folder): a screen's next start skips parsing its bundle.
178
+ if let caches = FileManager.default.urls(for: .cachesDirectory, in: .userDomainMask).first {
179
+ let directory = caches.appendingPathComponent(Bundle.main.bundleIdentifier ?? "dev.craft.native", isDirectory: true).appendingPathComponent("zig-js-scripts", isDirectory: true)
180
+ _ = ZJSContextSetScriptCacheDirectory(created, directory.path)
181
+ }
176
182
  context.exceptionHandler = { [weak self] _, value in
177
183
  let message = value?.objectForKeyedSubscript("message")?.toString() ?? "Native script failed"
178
184
  let stack = value?.objectForKeyedSubscript("stack")?.toString() ?? ""
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "craft-native",
3
- "version": "0.0.446",
3
+ "version": "0.0.451",
4
4
  "type": "module",
5
5
  "description": "Build desktop apps with web languages - TypeScript SDK for Craft",
6
6
  "author": "Chris Breuer <chris@stacksjs.org>",