@tokamakdev/platform-macos-arm64 0.1.1-beta.143 → 0.1.1-beta.144
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/macos-arm64/build/entrypoint +1 -10
- package/macos-arm64/frameworks/TokamakRuntime.framework/TokamakRuntime +0 -0
- package/macos-arm64/native-shell/TokamakApp.swift +9 -17
- package/macos-arm64/native-shell/TokamakControls.swift +3 -5
- package/macos-arm64/native-shell/TokamakPlugins.swift +11 -6
- package/macos-arm64/tools/tokamak-apple-signing +0 -0
- package/macos-arm64/tools/tokamak-swift-describe +1 -1
- package/package.json +1 -1
|
@@ -220,16 +220,7 @@ if [[ -n "$icon" ]]; then
|
|
|
220
220
|
fi
|
|
221
221
|
|
|
222
222
|
shopt -s nullglob
|
|
223
|
-
swift_sources=()
|
|
224
|
-
for source in "$pack/native-shell"/*.swift; do
|
|
225
|
-
[[ -f "$source" ]] || continue
|
|
226
|
-
swift_sources+=("$source")
|
|
227
|
-
done
|
|
228
|
-
|
|
229
|
-
if [[ ! -f "$pack/native-shell/TokamakShell.swift" ]]; then
|
|
230
|
-
echo "Apple native shell source is missing: $pack/native-shell/TokamakShell.swift" >&2
|
|
231
|
-
exit 1
|
|
232
|
-
fi
|
|
223
|
+
swift_sources=("$pack/native-shell"/*.swift)
|
|
233
224
|
|
|
234
225
|
# A plugin's class is a Swift type name, which the registry creates, and its
|
|
235
226
|
# sources are the Swift files in its native directory.
|
|
Binary file
|
|
@@ -311,16 +311,8 @@ enum TokamakBackgroundResult {
|
|
|
311
311
|
}
|
|
312
312
|
}
|
|
313
313
|
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
case runtime(String)
|
|
317
|
-
|
|
318
|
-
var description: String {
|
|
319
|
-
switch self {
|
|
320
|
-
case .configuration(let message), .runtime(let message):
|
|
321
|
-
return message
|
|
322
|
-
}
|
|
323
|
-
}
|
|
314
|
+
struct RuntimeError: Error, CustomStringConvertible {
|
|
315
|
+
let description: String
|
|
324
316
|
}
|
|
325
317
|
|
|
326
318
|
enum AuthenticationMaterial<Value> {
|
|
@@ -338,7 +330,7 @@ final class RuntimeHandle {
|
|
|
338
330
|
/// Worker calls `plugins`.
|
|
339
331
|
init(foreground: Bool, plugins: TokamakPluginHandler) throws {
|
|
340
332
|
guard let appHost = Bundle.main.tokamakHost, !appHost.isEmpty else {
|
|
341
|
-
throw RuntimeError
|
|
333
|
+
throw RuntimeError(description: "TokamakHost is required")
|
|
342
334
|
}
|
|
343
335
|
self.appHost = appHost
|
|
344
336
|
|
|
@@ -371,7 +363,7 @@ final class RuntimeHandle {
|
|
|
371
363
|
} else {
|
|
372
364
|
let bundle = Bundle.main.resourceURL?.appendingPathComponent("app")
|
|
373
365
|
guard let bundle else {
|
|
374
|
-
throw RuntimeError
|
|
366
|
+
throw RuntimeError(description: "app bundle resources are unavailable")
|
|
375
367
|
}
|
|
376
368
|
let storage = try Self.storageDirectory()
|
|
377
369
|
handle = bundle.path.withCString { bundlePath in
|
|
@@ -396,7 +388,7 @@ final class RuntimeHandle {
|
|
|
396
388
|
}
|
|
397
389
|
}
|
|
398
390
|
guard handle != nil else {
|
|
399
|
-
throw RuntimeError
|
|
391
|
+
throw RuntimeError(description: String(cString: error))
|
|
400
392
|
}
|
|
401
393
|
try? FileManager.default.removeItem(at: state.appendingPathComponent(startupErrorFile))
|
|
402
394
|
}
|
|
@@ -424,7 +416,7 @@ final class RuntimeHandle {
|
|
|
424
416
|
tokamak_runtime_restore_gateway(handle, error.baseAddress, error.count)
|
|
425
417
|
}
|
|
426
418
|
guard port != 0 else {
|
|
427
|
-
throw RuntimeError
|
|
419
|
+
throw RuntimeError(description: String(cString: error))
|
|
428
420
|
}
|
|
429
421
|
return port
|
|
430
422
|
}
|
|
@@ -453,7 +445,7 @@ final class RuntimeHandle {
|
|
|
453
445
|
}
|
|
454
446
|
defer { tokamak_bytes_free(reply) }
|
|
455
447
|
guard succeeded else {
|
|
456
|
-
throw RuntimeError
|
|
448
|
+
throw RuntimeError(description: String(cString: error))
|
|
457
449
|
}
|
|
458
450
|
return reply.contents ?? Data()
|
|
459
451
|
}
|
|
@@ -477,7 +469,7 @@ final class RuntimeHandle {
|
|
|
477
469
|
}
|
|
478
470
|
defer { tokamak_bytes_free(body) }
|
|
479
471
|
guard succeeded else {
|
|
480
|
-
throw RuntimeError
|
|
472
|
+
throw RuntimeError(description: String(cString: error))
|
|
481
473
|
}
|
|
482
474
|
return body.contents ?? Data()
|
|
483
475
|
}
|
|
@@ -574,7 +566,7 @@ final class RuntimeHandle {
|
|
|
574
566
|
/// This app's folder in the user's `directory`.
|
|
575
567
|
private static func appDirectory(_ directory: FileManager.SearchPathDirectory) throws -> URL {
|
|
576
568
|
guard let identifier = Bundle.main.bundleIdentifier else {
|
|
577
|
-
throw RuntimeError
|
|
569
|
+
throw RuntimeError(description: "CFBundleIdentifier is required")
|
|
578
570
|
}
|
|
579
571
|
return try FileManager.default.url(
|
|
580
572
|
for: directory,
|
|
@@ -36,7 +36,9 @@ final class TokamakCorePlugin: TokamakPlugin {
|
|
|
36
36
|
/// Starts navigation to the app URL `path`, relative to the current page or
|
|
37
37
|
/// the app origin.
|
|
38
38
|
private func navigate(to path: Any) -> Result<Void, TokamakPluginError> {
|
|
39
|
-
guard let view = host.webView else {
|
|
39
|
+
guard let view = host.webView else {
|
|
40
|
+
return .failure(.init(name: "InvalidStateError", message: "The app has no WebView"))
|
|
41
|
+
}
|
|
40
42
|
let appHost = Bundle.main.tokamakHost ?? ""
|
|
41
43
|
guard let path = path as? String,
|
|
42
44
|
let base = view.url ?? URL(string: "https://\(appHost)/"),
|
|
@@ -60,8 +62,4 @@ final class TokamakCorePlugin: TokamakPlugin {
|
|
|
60
62
|
reply(result.map { _ in nil }.mapError { TokamakPluginError($0) })
|
|
61
63
|
}
|
|
62
64
|
}
|
|
63
|
-
|
|
64
|
-
private var noView: TokamakPluginError {
|
|
65
|
-
.init(name: "InvalidStateError", message: "The app has no WebView")
|
|
66
|
-
}
|
|
67
65
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import Foundation
|
|
2
|
+
import Security
|
|
2
3
|
import WebKit
|
|
3
4
|
|
|
4
5
|
#if os(iOS)
|
|
@@ -56,13 +57,9 @@ struct TokamakPluginResult {
|
|
|
56
57
|
let payload: Data
|
|
57
58
|
let failed: Bool
|
|
58
59
|
let done: Bool
|
|
60
|
+
}
|
|
59
61
|
|
|
60
|
-
|
|
61
|
-
self.payload = payload
|
|
62
|
-
self.failed = failed
|
|
63
|
-
self.done = done
|
|
64
|
-
}
|
|
65
|
-
|
|
62
|
+
extension TokamakPluginResult {
|
|
66
63
|
init(_ result: Result<Data, TokamakPluginError>, done: Bool) {
|
|
67
64
|
self.done = done
|
|
68
65
|
switch result {
|
|
@@ -95,6 +92,14 @@ func decodePluginValue(_ payload: Data) throws(TokamakPluginError) -> Any {
|
|
|
95
92
|
}
|
|
96
93
|
}
|
|
97
94
|
|
|
95
|
+
#if os(macOS)
|
|
96
|
+
/// The value of the app's entitlement `key`, or nil when its signature lacks it.
|
|
97
|
+
func tokamakEntitlement(_ key: String) -> Any? {
|
|
98
|
+
guard let task = SecTaskCreateFromSelf(nil) else { return nil }
|
|
99
|
+
return SecTaskCopyValueForEntitlement(task, key as CFString, nil)
|
|
100
|
+
}
|
|
101
|
+
#endif
|
|
102
|
+
|
|
98
103
|
/// The app as one plugin sees it.
|
|
99
104
|
final class TokamakHost {
|
|
100
105
|
private unowned let app: TokamakApp
|
|
Binary file
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
[diffend] Oversized file quarantined before diffing.
|
|
2
2
|
name: package/macos-arm64/tools/tokamak-swift-describe
|
|
3
3
|
size: 34569672 bytes
|
|
4
|
-
sha256:
|
|
4
|
+
sha256: f1660801317e44cfbfd7f6d2c135fbf9d305fbe1c6d5465a2f5ac34525564cb4
|