@native-sdk/cli 0.9.4 → 0.9.5
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 +3 -3
- package/build/app.zig +68 -57
- package/build.zig +12 -1
- package/package.json +10 -9
- package/packages/core/package-lock.json +2 -2
- package/packages/core/package.json +1 -1
- package/packages/core/scripts/run_external_core_compiler.mjs +19 -9
- package/packages/core/scripts/run_external_service_compiler.mjs +17 -8
- package/packages/core/scripts/vendor_service_packages.mjs +121 -8
- package/packages/core/sdk/events.d.ts +33 -4
- package/packages/core/sdk/events.ts +45 -6
- package/packages/core/src/checker.ts +103 -8
- package/packages/core/src/modules.ts +6 -2
- package/packages/core/src/sqlite_cli.ts +22 -2
- package/packages/core/src/typed_ast.ts +4 -2
- package/packages/core/src/types.ts +8 -8
- package/schemas/app.schema.json +435 -0
- package/skill-data/core/SKILL.md +53 -15
- package/skill-data/core/references/project-anatomy.md +6 -6
- package/skill-data/native-ui/SKILL.md +26 -5
- package/skill-data/ts-core/SKILL.md +6 -6
- package/skills/native-sdk/SKILL.md +2 -2
- package/src/automation/snapshot.zig +91 -3
- package/src/platform/macos/appkit_host.h +41 -2
- package/src/platform/macos/appkit_host.m +198 -9
- package/src/platform/macos/cef_host.mm +191 -9
- package/src/platform/macos/root.zig +110 -3
- package/src/platform/null_platform.zig +50 -1
- package/src/platform/null_platform_tests.zig +53 -0
- package/src/platform/root.zig +9 -0
- package/src/platform/types.zig +58 -0
- package/src/platform/windows/root.zig +88 -15
- package/src/primitives/canvas/reference.zig +37 -15
- package/src/primitives/canvas/reference_tests.zig +63 -0
- package/src/primitives/canvas/ui.zig +9 -0
- package/src/primitives/canvas/ui_markup.zig +29 -0
- package/src/primitives/canvas/ui_markup_compiled.zig +32 -0
- package/src/primitives/canvas/ui_markup_compiled_tests.zig +4 -2
- package/src/primitives/canvas/ui_markup_contract.zig +7 -0
- package/src/primitives/canvas/ui_markup_contract_tests.zig +21 -0
- package/src/primitives/canvas/ui_markup_tests.zig +6 -0
- package/src/primitives/canvas/ui_markup_view.zig +28 -0
- package/src/primitives/canvas/ui_markup_view_tests.zig +32 -3
- package/src/primitives/canvas/ui_schema.zig +9 -0
- package/src/primitives/canvas/ui_schema_tests.zig +5 -3
- package/src/primitives/canvas/ui_tests.zig +4 -2
- package/src/primitives/canvas/widget_render.zig +7 -2
- package/src/primitives/canvas/widget_semantics_tests.zig +3 -1
- package/src/root.zig +4 -0
- package/src/runtime/automation_snapshot.zig +3 -0
- package/src/runtime/flow.zig +1 -1
- package/src/runtime/state.zig +14 -0
- package/src/runtime/system_services.zig +62 -0
- package/src/runtime/ts_ui_app.zig +161 -33
- package/src/runtime/ui_app.zig +33 -1
- package/src/runtime/ui_app_tests.zig +63 -0
- package/src/runtime/validation.zig +87 -1
- package/src/tooling/android.zig +5 -4
- package/src/tooling/buildgraph.zig +24 -8
- package/src/tooling/db.zig +1 -1
- package/src/tooling/doctor.zig +1 -1
- package/src/tooling/ios.zig +5 -4
- package/src/tooling/json_to_zon.zig +136 -0
- package/src/tooling/manifest.zig +120 -33
- package/src/tooling/raw_manifest.zig +4 -0
- package/src/tooling/root.zig +1 -0
- package/src/tooling/templates.zig +165 -116
- package/src/tooling/ts_core.zig +11 -7
- package/src/tooling/verbs.zig +7 -6
- package/src/tooling/web_engine.zig +17 -1
package/src/tooling/verbs.zig
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
//! The canonical app verbs: `native dev|build|test` work in any app
|
|
2
2
|
//! directory. If the app owns a build.zig (ejected, and every example),
|
|
3
3
|
//! the verbs drive it through plain `zig build` — zero behavior change.
|
|
4
|
-
//! Otherwise (app.zon + src/ only) the CLI synthesizes the build graph
|
|
4
|
+
//! Otherwise (app.json/app.zon + src/ only) the CLI synthesizes the build graph
|
|
5
5
|
//! into `<app>/.native/build/` (see buildgraph.zig) and drives that.
|
|
6
6
|
//!
|
|
7
7
|
//! Callers are expected to have chdir'd into the app directory: every
|
|
@@ -43,15 +43,15 @@ pub const Options = struct {
|
|
|
43
43
|
};
|
|
44
44
|
|
|
45
45
|
pub fn run(allocator: std.mem.Allocator, io: std.Io, verb: Verb, options: Options) !void {
|
|
46
|
-
|
|
46
|
+
const manifest_path = manifest_tool.defaultPath(io) orelse {
|
|
47
47
|
std.debug.print(
|
|
48
|
-
\\no app.zon here — `native {s}` runs inside an app directory
|
|
48
|
+
\\no app.json or app.zon here — `native {s}` runs inside an app directory
|
|
49
49
|
\\(or pass one: `native {s} path/to/app`). Start one with `native init`.
|
|
50
50
|
\\
|
|
51
51
|
, .{ @tagName(verb), @tagName(verb) });
|
|
52
52
|
return error.MissingManifest;
|
|
53
|
-
}
|
|
54
|
-
const metadata = try manifest_tool.readMetadata(allocator, io,
|
|
53
|
+
};
|
|
54
|
+
const metadata = try manifest_tool.readMetadata(allocator, io, manifest_path);
|
|
55
55
|
const rebuild_snapshot = if (options.explain_rebuild)
|
|
56
56
|
try explainRebuild(allocator, io)
|
|
57
57
|
else
|
|
@@ -112,6 +112,7 @@ pub fn run(allocator: std.mem.Allocator, io: std.Io, verb: Verb, options: Option
|
|
|
112
112
|
build_file = try buildgraph.ensureGeneratedBuild(allocator, io, ".", .{
|
|
113
113
|
.app_name = metadata.name,
|
|
114
114
|
.framework_root = framework_root,
|
|
115
|
+
.manifest_name = manifest_path,
|
|
115
116
|
});
|
|
116
117
|
// Keep artifacts where users expect them: the generated build root
|
|
117
118
|
// is .native/build/, so without a prefix the binary would hide in
|
|
@@ -335,7 +336,7 @@ fn explainRebuild(allocator: std.mem.Allocator, io: std.Io) ![]u8 {
|
|
|
335
336
|
if (old_hash != null and std.mem.eql(u8, old_hash.?, &input.hash)) continue;
|
|
336
337
|
changed += 1;
|
|
337
338
|
std.debug.print("native rebuild: {s} {s} -> {s}\n", .{ input.path, old_hash orelse "<new>", &input.hash });
|
|
338
|
-
if (std.mem.eql(u8, input.path, "app.zon")) {
|
|
339
|
+
if (std.mem.eql(u8, input.path, "app.json") or std.mem.eql(u8, input.path, "app.zon")) {
|
|
339
340
|
std.debug.print(" invalidates manifest-derived configuration -> affected contracts, app-code/platform link, and final artifact\n", .{});
|
|
340
341
|
} else if (std.mem.eql(u8, input.path, "build.zig") or std.mem.eql(u8, input.path, "build.zig.zon")) {
|
|
341
342
|
std.debug.print(" invalidates the owned build graph -> graph-selected compilation and final artifact\n", .{});
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
const std = @import("std");
|
|
2
|
+
const json_to_zon = @import("json_to_zon.zig");
|
|
2
3
|
const raw_manifest = @import("raw_manifest.zig");
|
|
3
4
|
|
|
4
5
|
pub const default_engine: Engine = .system;
|
|
@@ -72,7 +73,10 @@ pub fn resolve(manifest: ManifestConfig, overrides: Overrides) Error!Resolved {
|
|
|
72
73
|
pub fn readManifestConfig(allocator: std.mem.Allocator, io: std.Io, path: []const u8) !ManifestConfig {
|
|
73
74
|
const source = try std.Io.Dir.cwd().readFileAlloc(io, path, allocator, .limited(1024 * 1024));
|
|
74
75
|
defer allocator.free(source);
|
|
75
|
-
return
|
|
76
|
+
return if (json_to_zon.isJsonPath(path))
|
|
77
|
+
parseJsonManifestConfig(allocator, source)
|
|
78
|
+
else
|
|
79
|
+
parseManifestConfig(allocator, source);
|
|
76
80
|
}
|
|
77
81
|
|
|
78
82
|
pub fn parseManifestConfig(allocator: std.mem.Allocator, source: []const u8) !ManifestConfig {
|
|
@@ -82,6 +86,18 @@ pub fn parseManifestConfig(allocator: std.mem.Allocator, source: []const u8) !Ma
|
|
|
82
86
|
const source_z = try scratch.dupeZ(u8, source);
|
|
83
87
|
@setEvalBranchQuota(4000);
|
|
84
88
|
const raw = try std.zon.parse.fromSliceAlloc(raw_manifest.RawManifest, scratch, source_z, null, .{});
|
|
89
|
+
return duplicateManifestConfig(allocator, raw);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
pub fn parseJsonManifestConfig(allocator: std.mem.Allocator, source: []const u8) !ManifestConfig {
|
|
93
|
+
try json_to_zon.validateSource(allocator, source);
|
|
94
|
+
var arena = std.heap.ArenaAllocator.init(allocator);
|
|
95
|
+
defer arena.deinit();
|
|
96
|
+
const raw = try std.json.parseFromSliceLeaky(raw_manifest.RawManifest, arena.allocator(), source, .{ .ignore_unknown_fields = false });
|
|
97
|
+
return duplicateManifestConfig(allocator, raw);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
fn duplicateManifestConfig(allocator: std.mem.Allocator, raw: raw_manifest.RawManifest) !ManifestConfig {
|
|
85
101
|
return .{
|
|
86
102
|
.web_engine = try allocator.dupe(u8, raw.web_engine),
|
|
87
103
|
.cef = .{
|