@native-sdk/cli 0.9.5 → 0.10.0
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/build/app.zig +7 -0
- package/build/ts_run.mjs +1 -1
- package/build.zig +8 -1
- package/package.json +10 -10
- package/packages/core/package-lock.json +12 -11
- package/packages/core/package.json +2 -2
- package/packages/core/scripts/compiler_command.mjs +1 -1
- package/schemas/app.schema.json +12 -1
- package/skill-data/ts-services/references/service-surface.md +1 -1
- package/src/app_runner/root.zig +25 -0
- package/src/platform/macos/appkit_host.h +25 -0
- package/src/platform/macos/appkit_host.m +537 -15
- package/src/platform/macos/cef_host.mm +17 -0
- package/src/platform/macos/root.zig +95 -0
- package/src/platform/root.zig +3 -0
- package/src/platform/types.zig +15 -0
- package/src/primitives/app_manifest/tests.zig +19 -0
- package/src/primitives/app_manifest/validation.zig +14 -2
- package/src/primitives/canvas/font_ttf.zig +24 -0
- package/src/primitives/canvas/gpu.zig +5 -0
- package/src/primitives/canvas/reference.zig +4 -1
- package/src/primitives/canvas/render_tests.zig +1 -1
- package/src/primitives/canvas/root.zig +1 -0
- package/src/primitives/canvas/serialization.zig +1 -0
- package/src/primitives/canvas/test_support.zig +1 -0
- package/src/primitives/canvas/text.zig +1 -0
- package/src/primitives/canvas/text_layout.zig +84 -15
- package/src/primitives/canvas/text_layout_hash.zig +3 -1
- package/src/primitives/canvas/text_layout_types.zig +3 -0
- package/src/primitives/canvas/text_metrics.zig +28 -1
- package/src/primitives/canvas/text_tests.zig +61 -6
- package/src/primitives/canvas/widget_render.zig +6 -0
- package/src/primitives/canvas/widget_render_controls.zig +1 -0
- package/src/root.zig +2 -0
- package/src/runtime/canvas_fonts.zig +87 -0
- package/src/runtime/core.zig +1 -0
- package/src/runtime/flow.zig +7 -0
- package/src/runtime/native_command_event_tests.zig +58 -0
- package/src/tooling/manifest.zig +79 -2
- package/src/tooling/package.zig +33 -0
- package/src/tooling/raw_manifest.zig +7 -0
- package/src/tooling/root.zig +1 -0
- package/src/tooling/templates.zig +45 -0
- package/src/tooling/update.zig +576 -0
- package/src/updater/c_api.zig +123 -0
- package/src/updater/feed.zig +215 -0
- package/src/updater/root.zig +10 -0
|
@@ -1433,6 +1433,9 @@ fn buildZig(allocator: std.mem.Allocator, names: TemplateNames, framework_path:
|
|
|
1433
1433
|
\\ }
|
|
1434
1434
|
\\ const app_config = appManifestBuildConfig(b);
|
|
1435
1435
|
\\ const web_engine = web_engine_override orelse app_config.web_engine;
|
|
1436
|
+
\\ if (app_config.updates_enabled and selected_platform == .macos and web_engine == .chromium) {
|
|
1437
|
+
\\ @panic("\nnative updates currently require the system macOS host; use web_engine = \"system\" or remove the updates block\n");
|
|
1438
|
+
\\ }
|
|
1436
1439
|
\\ const cef_dir = cef_dir_override orelse defaultCefDir(selected_platform, app_config.cef_dir);
|
|
1437
1440
|
\\ const cef_auto_install = cef_auto_install_override orelse app_config.cef_auto_install;
|
|
1438
1441
|
\\ if (web_engine == .chromium and selected_platform != .macos) {
|
|
@@ -1589,6 +1592,7 @@ fn buildZig(allocator: std.mem.Allocator, names: TemplateNames, framework_path:
|
|
|
1589
1592
|
\\ // exe/package agreement structural.
|
|
1590
1593
|
\\ package.addArgs(&.{ "--web-layer", if (web_layer) "include" else "exclude" });
|
|
1591
1594
|
\\ if (cef_auto_install) package.addArg("--cef-auto-install");
|
|
1595
|
+
\\ if (app_config.updates_enabled and package_target == .macos and b.graph.host.result.os.tag == .macos) package.addArg("--update-archive");
|
|
1592
1596
|
\\ package.step.dependOn(&package_exe.step);
|
|
1593
1597
|
\\ package.step.dependOn(&frontend_build.step);
|
|
1594
1598
|
\\ const package_step = b.step("package", "Create a local package artifact");
|
|
@@ -2047,6 +2051,7 @@ fn buildZig(allocator: std.mem.Allocator, names: TemplateNames, framework_path:
|
|
|
2047
2051
|
\\ system_audio_permission: bool = false,
|
|
2048
2052
|
\\ sqlite_capability: bool = false,
|
|
2049
2053
|
\\ relational_capability: bool = false,
|
|
2054
|
+
\\ updates_enabled: bool = false,
|
|
2050
2055
|
\\ /// The first web declaration found (for teaching messages), or
|
|
2051
2056
|
\\ /// null when app.zon declares no web use. `web_engine = "system"`
|
|
2052
2057
|
\\ /// alone is NOT web intent — it is the default in many canvas
|
|
@@ -2068,6 +2073,7 @@ fn buildZig(allocator: std.mem.Allocator, names: TemplateNames, framework_path:
|
|
|
2068
2073
|
\\ auto_install: bool = false,
|
|
2069
2074
|
\\ } = .{},
|
|
2070
2075
|
\\ frontend: ?struct {} = null,
|
|
2076
|
+
\\ updates: ?struct {} = null,
|
|
2071
2077
|
\\ shell: struct {
|
|
2072
2078
|
\\ windows: []const struct {
|
|
2073
2079
|
\\ views: []const struct {
|
|
@@ -2104,6 +2110,7 @@ fn buildZig(allocator: std.mem.Allocator, names: TemplateNames, framework_path:
|
|
|
2104
2110
|
\\ .system_audio_permission = hasManifestPermission(raw.permissions, "system_audio"),
|
|
2105
2111
|
\\ .sqlite_capability = hasManifestCapability(raw.capabilities, "store") or hasManifestCapability(raw.capabilities, "sqlite"),
|
|
2106
2112
|
\\ .relational_capability = hasManifestCapability(raw.capabilities, "sqlite"),
|
|
2113
|
+
\\ .updates_enabled = raw.updates != null,
|
|
2107
2114
|
\\ };
|
|
2108
2115
|
\\ config.web_declaration = blk: {
|
|
2109
2116
|
\\ if (raw.frontend != null) break :blk "a .frontend block";
|
|
@@ -2397,12 +2404,18 @@ fn runnerZig() []const u8 {
|
|
|
2397
2404
|
\\ fn appInfo(self: RunOptions, buffers: *StateBuffers) native_sdk.AppInfo {
|
|
2398
2405
|
\\ var info: native_sdk.AppInfo = .{
|
|
2399
2406
|
\\ .app_name = self.app_name,
|
|
2407
|
+
\\ .display_name = manifestStringField("display_name"),
|
|
2408
|
+
\\ .version = manifestStringField("version"),
|
|
2409
|
+
\\ .description = manifestStringField("description"),
|
|
2400
2410
|
\\ .has_web_content = manifestHasWebContent(),
|
|
2401
2411
|
\\ .declares_tray = manifestDeclaresTrayCapability(),
|
|
2402
2412
|
\\ .dock_visible = manifestDockVisible(),
|
|
2403
2413
|
\\ .window_title = self.window_title,
|
|
2404
2414
|
\\ .bundle_id = self.bundle_id,
|
|
2405
2415
|
\\ .icon_path = self.icon_path,
|
|
2416
|
+
\\ .update_feed_url = manifestUpdateString("feed_url"),
|
|
2417
|
+
\\ .update_public_key = manifestUpdateString("public_key"),
|
|
2418
|
+
\\ .update_check_on_start = manifestUpdateCheckOnStart(),
|
|
2406
2419
|
\\ };
|
|
2407
2420
|
\\ const windows = manifestWindowOptions(buffers);
|
|
2408
2421
|
\\ if (windows.len > 0) {
|
|
@@ -2454,6 +2467,30 @@ fn runnerZig() []const u8 {
|
|
|
2454
2467
|
\\ }
|
|
2455
2468
|
\\};
|
|
2456
2469
|
\\
|
|
2470
|
+
\\fn manifestStringField(comptime field: []const u8) []const u8 {
|
|
2471
|
+
\\ if (comptime !@hasField(@TypeOf(app_manifest), field)) return "";
|
|
2472
|
+
\\ const value = @field(app_manifest, field);
|
|
2473
|
+
\\ if (comptime @TypeOf(value) == @TypeOf(null)) return "";
|
|
2474
|
+
\\ return value;
|
|
2475
|
+
\\}
|
|
2476
|
+
\\
|
|
2477
|
+
\\fn manifestUpdateString(comptime field: []const u8) []const u8 {
|
|
2478
|
+
\\ if (comptime !@hasField(@TypeOf(app_manifest), "updates")) return "";
|
|
2479
|
+
\\ const updates = app_manifest.updates;
|
|
2480
|
+
\\ if (comptime !@hasField(@TypeOf(updates), field)) return "";
|
|
2481
|
+
\\ const value = @field(updates, field);
|
|
2482
|
+
\\ return switch (@typeInfo(@TypeOf(value))) {
|
|
2483
|
+
\\ .optional => value orelse "",
|
|
2484
|
+
\\ else => value,
|
|
2485
|
+
\\ };
|
|
2486
|
+
\\}
|
|
2487
|
+
\\
|
|
2488
|
+
\\fn manifestUpdateCheckOnStart() bool {
|
|
2489
|
+
\\ if (comptime !@hasField(@TypeOf(app_manifest), "updates")) return false;
|
|
2490
|
+
\\ if (comptime !@hasField(@TypeOf(app_manifest.updates), "check_on_start")) return false;
|
|
2491
|
+
\\ return app_manifest.updates.check_on_start;
|
|
2492
|
+
\\}
|
|
2493
|
+
\\
|
|
2457
2494
|
\\const CommandStorage = struct {
|
|
2458
2495
|
\\ commands: [native_sdk.app_manifest.max_commands]native_sdk.Command = undefined,
|
|
2459
2496
|
\\
|
|
@@ -4190,9 +4227,13 @@ test "writeDefaultApp emits Vite project files" {
|
|
|
4190
4227
|
// loader when native-only).
|
|
4191
4228
|
try std.testing.expect(std.mem.indexOf(u8, build_zig_text, "b.option(WebLayerOption, \"web-layer\", \"Override app.zon webview_layer: auto, include, exclude\")") != null);
|
|
4192
4229
|
try std.testing.expect(std.mem.indexOf(u8, build_zig_text, "const web_layer = resolveWebLayer(app_config, web_engine, web_layer_override)") != null);
|
|
4230
|
+
try std.testing.expect(std.mem.indexOf(u8, build_zig_text, "app_config.updates_enabled and selected_platform == .macos and web_engine == .chromium") != null);
|
|
4231
|
+
try std.testing.expect(std.mem.indexOf(u8, build_zig_text, "updates: ?struct {} = null") != null);
|
|
4232
|
+
try std.testing.expect(std.mem.indexOf(u8, build_zig_text, ".updates_enabled = raw.updates != null") != null);
|
|
4193
4233
|
// The emitted package step forwards the graph's resolved decision so
|
|
4194
4234
|
// the packaged artifact structurally agrees with the compiled exe.
|
|
4195
4235
|
try std.testing.expect(std.mem.indexOf(u8, build_zig_text, "package.addArgs(&.{ \"--web-layer\", if (web_layer) \"include\" else \"exclude\" })") != null);
|
|
4236
|
+
try std.testing.expect(std.mem.indexOf(u8, build_zig_text, "package.addArg(\"--update-archive\")") != null);
|
|
4196
4237
|
try std.testing.expect(std.mem.indexOf(u8, build_zig_text, "options.addOption(bool, \"web_layer\", web_layer)") != null);
|
|
4197
4238
|
try std.testing.expect(std.mem.indexOf(u8, build_zig_text, "std.json.parseFromSliceLeaky(InferenceManifest") != null);
|
|
4198
4239
|
try std.testing.expect(std.mem.indexOf(u8, build_zig_text, "fn appManifestModule") != null);
|
|
@@ -4251,6 +4292,10 @@ test "writeDefaultApp emits Vite project files" {
|
|
|
4251
4292
|
try std.testing.expect(std.mem.indexOf(u8, runner_zig_text, "resolvedShortcuts") != null);
|
|
4252
4293
|
try std.testing.expect(std.mem.indexOf(u8, runner_zig_text, "const manifest_windows") != null);
|
|
4253
4294
|
try std.testing.expect(std.mem.indexOf(u8, runner_zig_text, "fn appInfo(self: RunOptions, buffers: *StateBuffers)") != null);
|
|
4295
|
+
try std.testing.expect(std.mem.indexOf(u8, runner_zig_text, ".version = manifestStringField(\"version\")") != null);
|
|
4296
|
+
try std.testing.expect(std.mem.indexOf(u8, runner_zig_text, ".update_feed_url = manifestUpdateString(\"feed_url\")") != null);
|
|
4297
|
+
try std.testing.expect(std.mem.indexOf(u8, runner_zig_text, ".update_public_key = manifestUpdateString(\"public_key\")") != null);
|
|
4298
|
+
try std.testing.expect(std.mem.indexOf(u8, runner_zig_text, ".update_check_on_start = manifestUpdateCheckOnStart()") != null);
|
|
4254
4299
|
try std.testing.expect(std.mem.indexOf(u8, runner_zig_text, "fn manifestWindowOptions") != null);
|
|
4255
4300
|
try std.testing.expect(std.mem.indexOf(u8, runner_zig_text, "info.windows = windows") != null);
|
|
4256
4301
|
try std.testing.expect(std.mem.indexOf(u8, runner_zig_text, "for (restored_windows, 0..)") != null);
|