@native-sdk/cli 0.11.0 → 0.11.1
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 +73 -37
- package/build.zig +239 -5
- package/native-sdk.d.ts +5 -1
- package/package.json +13 -12
- package/packages/core/compile-surface/core.ts +30 -0
- package/packages/core/package-lock.json +6 -6
- package/packages/core/package.json +3 -3
- package/packages/core/scripts/scriptc-toolchain.json +44 -44
- package/packages/core/scripts/stage_external_core.mjs +27 -16
- package/packages/core/sdk/core.d.ts +24 -1
- package/packages/core/sdk/core.ts +51 -1
- package/packages/core/sdk/events.d.ts +5 -0
- package/packages/core/sdk/events.ts +10 -0
- package/packages/core/src/bridge_descriptors.ts +3 -3
- package/packages/core/src/checker.ts +20 -0
- package/packages/core/src/cli.ts +2 -11
- package/packages/core/src/context_menus.ts +76 -0
- package/packages/core/src/diagnostics.ts +7 -0
- package/packages/core/src/extent_program.ts +53 -0
- package/packages/core/src/frontend.ts +12 -10
- package/packages/core/src/markup_canonical.ts +140 -0
- package/packages/core/src/markup_construction.ts +189 -0
- package/packages/core/src/markup_display.ts +43 -0
- package/packages/core/src/markup_document.ts +226 -0
- package/packages/core/src/markup_elements.ts +225 -0
- package/packages/core/src/markup_expressions.ts +79 -0
- package/packages/core/src/markup_imports.ts +146 -0
- package/packages/core/src/markup_parser.ts +228 -0
- package/packages/core/src/markup_runtime.ts +93 -0
- package/packages/core/src/markup_scalars.ts +143 -0
- package/packages/core/src/markup_shapes.ts +243 -0
- package/packages/core/src/markup_specialized.ts +242 -0
- package/packages/core/src/markup_text.ts +86 -0
- package/packages/core/src/markup_values.ts +336 -0
- package/packages/core/src/portable_sources.json +24 -0
- package/packages/core/src/registered_font.ts +2 -3
- package/packages/core/src/runtime_policy.ts +24 -0
- package/packages/core/src/scalar_text.ts +1 -3
- package/packages/core/src/scroll_mutation.ts +86 -0
- package/packages/core/src/scroll_tree.ts +86 -0
- package/packages/core/src/service_contract.ts +53 -2
- package/packages/core/src/sqlite_cli.ts +3 -46
- package/packages/core/src/sqlite_codegen.ts +84 -0
- package/packages/core/src/staged_rebuild.ts +60 -0
- package/packages/core/src/view_bridge.ts +161 -0
- package/packages/core/src/view_check.ts +145 -0
- package/packages/core/src/view_evaluator.ts +823 -0
- package/packages/core/src/view_frontend.ts +340 -218
- package/packages/core/src/view_program.ts +221 -0
- package/packages/core/src/view_reload.ts +166 -0
- package/packages/core/src/view_reload_watch.ts +98 -0
- package/packages/core/src/view_sources.ts +34 -0
- package/packages/core/src/virtual_windows.ts +88 -0
- package/packages/core/src/web_panes.ts +67 -0
- package/packages/core/src/widget_continuity.ts +37 -0
- package/packages/core/src/widget_reconcile.ts +63 -0
- package/packages/core/src/widget_retention.ts +62 -0
- package/skill-data/native-ui/SKILL.md +2 -2
- package/skill-data/ts-core/SKILL.md +5 -3
- package/skill-data/ts-services/references/service-surface.md +29 -5
- package/src/app_runner/root.zig +14 -0
- package/src/app_runner/ts_compiled_view.zig +88 -17
- package/src/app_runner/ts_core_main.zig +43 -5
- package/src/app_runner/ts_core_mobile.zig +1 -1
- package/src/automation/server.zig +56 -3
- package/src/embed/host.zig +2 -0
- package/src/embed/tests.zig +2 -0
- package/src/embed/ui_host.zig +2 -0
- package/src/platform/keyboard_input.zig +32 -0
- package/src/platform/linux/root.zig +2 -0
- package/src/platform/macos/appkit_host.h +7 -2
- package/src/platform/macos/appkit_host.m +31 -9
- package/src/platform/macos/cef_host.mm +15 -1
- package/src/platform/macos/global_shortcuts.zig +138 -0
- package/src/platform/macos/key_codes.zig +102 -0
- package/src/platform/macos/keyboard_input.zig +81 -0
- package/src/platform/macos/root.zig +25 -3
- package/src/platform/macos/webview_inspection_test.m +106 -0
- package/src/platform/null_platform.zig +104 -0
- package/src/platform/root.zig +14 -0
- package/src/platform/types.zig +102 -0
- package/src/platform/windows/global_shortcuts.zig +157 -0
- package/src/platform/windows/key_codes.zig +63 -0
- package/src/platform/windows/keyboard_input.zig +136 -0
- package/src/platform/windows/root.zig +15 -0
- package/src/primitives/canvas/decision_reuse.zig +133 -0
- package/src/primitives/canvas/font_ttf.zig +27 -3
- package/src/primitives/canvas/fonts/Geist-Bold.ttf +0 -0
- package/src/primitives/canvas/fonts/Geist-Medium.ttf +0 -0
- package/src/primitives/canvas/fonts/OFL.txt +93 -0
- package/src/primitives/canvas/fonts/README.md +15 -0
- package/src/primitives/canvas/intrinsic_measure_policy.zig +4 -1
- package/src/primitives/canvas/markdown_tests.zig +3 -3
- package/src/primitives/canvas/reference.zig +3 -5
- package/src/primitives/canvas/reference_tests.zig +58 -0
- package/src/primitives/canvas/registered_font_policy.zig +1 -1
- package/src/primitives/canvas/root.zig +7 -4
- package/src/primitives/canvas/text_metrics.zig +32 -39
- package/src/primitives/canvas/text_metrics_tests.zig +52 -7
- package/src/primitives/canvas/text_query_policy.zig +142 -3
- package/src/primitives/canvas/text_scalar_policy.zig +80 -2
- package/src/primitives/canvas/tokens.zig +9 -0
- package/src/primitives/canvas/ui.zig +1 -0
- package/src/primitives/canvas/ui_markup.zig +69 -14
- package/src/primitives/canvas/ui_markup_canonical.zig +237 -0
- package/src/primitives/canvas/ui_markup_compiled.zig +1407 -23
- package/src/primitives/canvas/ui_markup_compiled_values.zig +76 -0
- package/src/primitives/canvas/ui_markup_construction.zig +146 -0
- package/src/primitives/canvas/ui_markup_display.zig +82 -0
- package/src/primitives/canvas/ui_markup_document.zig +196 -0
- package/src/primitives/canvas/ui_markup_elements.zig +163 -0
- package/src/primitives/canvas/ui_markup_expr.zig +192 -2
- package/src/primitives/canvas/ui_markup_imports.zig +262 -0
- package/src/primitives/canvas/ui_markup_parser.zig +117 -0
- package/src/primitives/canvas/ui_markup_runtime.zig +76 -0
- package/src/primitives/canvas/ui_markup_scalars.zig +115 -0
- package/src/primitives/canvas/ui_markup_shapes.zig +224 -0
- package/src/primitives/canvas/ui_markup_specialized.zig +106 -0
- package/src/primitives/canvas/ui_markup_text.zig +128 -0
- package/src/primitives/canvas/ui_markup_values.zig +368 -0
- package/src/primitives/canvas/ui_markup_view.zig +2817 -74
- package/src/primitives/canvas/virtual_extent_policy.zig +58 -0
- package/src/primitives/canvas/virtual_extents.zig +47 -33
- package/src/primitives/canvas/widget_metric_policy.zig +4 -1
- package/src/primitives/canvas/widget_runtime.zig +2 -1
- package/src/root.zig +5 -0
- package/src/runtime/api.zig +1 -0
- package/src/runtime/bridge_descriptor_policy.zig +1 -1
- package/src/runtime/bridge_payload.zig +2 -0
- package/src/runtime/canvas_widget_context_menu.zig +179 -0
- package/src/runtime/canvas_widget_context_menu_test_cases.zig +1147 -0
- package/src/runtime/canvas_widget_context_menu_tests.zig +23 -1098
- package/src/runtime/canvas_widget_runtime.zig +306 -92
- package/src/runtime/context_menu_policy.zig +112 -0
- package/src/runtime/core.zig +14 -0
- package/src/runtime/effects.zig +172 -4
- package/src/runtime/effects_host_tests.zig +25 -0
- package/src/runtime/flow.zig +1 -0
- package/src/runtime/flow_reference.zig +1 -0
- package/src/runtime/global_shortcuts.zig +75 -0
- package/src/runtime/keyboard_input.zig +86 -0
- package/src/runtime/root.zig +3 -0
- package/src/runtime/scroll_mutation_policy.zig +130 -0
- package/src/runtime/scroll_mutation_runtime.zig +158 -0
- package/src/runtime/scroll_tree_policy.zig +99 -0
- package/src/runtime/session_record.zig +7 -0
- package/src/runtime/staged_rebuild_policy.zig +83 -0
- package/src/runtime/system_services.zig +19 -0
- package/src/runtime/tests.zig +1 -0
- package/src/runtime/ts_core_host.zig +126 -0
- package/src/runtime/ts_ui_app.zig +24 -0
- package/src/runtime/ui_app.zig +274 -31
- package/src/runtime/ui_app_tests.zig +48 -179
- package/src/runtime/ui_app_window_tests.zig +133 -0
- package/src/runtime/view_reload.zig +226 -0
- package/src/runtime/view_widget_scroll.zig +30 -21
- package/src/runtime/view_widget_tree.zig +43 -13
- package/src/runtime/virtual_window_policy.zig +128 -0
- package/src/runtime/web_pane_policy.zig +111 -0
- package/src/runtime/web_pane_test_cases.zig +204 -0
- package/src/runtime/widget_continuity_policy.zig +73 -0
- package/src/runtime/widget_reconcile_policy.zig +81 -0
- package/src/runtime/widget_retention_policy.zig +75 -0
- package/src/runtime/window_views.zig +19 -4
- package/src/security/root.zig +1 -0
- package/src/tooling/templates.zig +8 -0
- package/src/tooling/ts_core.zig +84 -1
- package/src/tooling/verbs.zig +79 -15
- package/tools/corewire/core.test.ts +25 -3
- package/tools/corewire/core_abi.zig +4 -0
- package/tools/corewire/core_contract.ts +1 -1
- package/tools/corewire/core_goldens.json +75 -75
- package/tools/corewire/core_projection.ts +3 -2
- package/tools/corewire/emit_mirror.ts +19 -9
- package/tools/corewire/facade_templates.ts +1 -1
- package/tools/corewire/intake.test.ts +4 -0
- package/tools/corewire/intake_goldens.json +50 -50
- package/tools/corewire/invocation.test.ts +4 -0
- package/tools/corewire/invocation_goldens.json +3 -3
- package/tools/corewire/mirror_templates.ts +4 -0
- package/tools/corewire/profile_emission.ts +2 -0
- package/tools/corewire/sidecar.zig +2 -0
package/src/tooling/verbs.zig
CHANGED
|
@@ -125,6 +125,7 @@ pub fn run(allocator: std.mem.Allocator, io: std.Io, verb: Verb, options: Option
|
|
|
125
125
|
}
|
|
126
126
|
|
|
127
127
|
const wants_frontend_dev = verb == .dev and metadata.frontend != null and metadata.frontend.?.dev != null;
|
|
128
|
+
var view_reload = false;
|
|
128
129
|
var release_fast = false;
|
|
129
130
|
var dev_debug = false;
|
|
130
131
|
switch (verb) {
|
|
@@ -145,11 +146,17 @@ pub fn run(allocator: std.mem.Allocator, io: std.Io, verb: Verb, options: Option
|
|
|
145
146
|
try argv.append(allocator, "-Doptimize=Debug");
|
|
146
147
|
dev_debug = true;
|
|
147
148
|
}
|
|
148
|
-
if (core_tree == .ts and !
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
149
|
+
if (core_tree == .ts and !wants_frontend_dev and !typeScriptViewDisabled(options.forwarded_args) and
|
|
150
|
+
!hasFlag(options.forwarded_args, "-Dview-reload") and !targetsMobile(options.forwarded_args) and
|
|
151
|
+
(dev_debug or hasDebugOptimizeFlag(options.forwarded_args)))
|
|
152
|
+
{
|
|
153
|
+
// TypeScript apps run their compiled views in dev, and a
|
|
154
|
+
// Debug run reloads markup edits in place: the build stages
|
|
155
|
+
// the development evaluator, and a watcher started below
|
|
156
|
+
// hands the app each edit. `-Dtypescript-view=false` selects
|
|
157
|
+
// the native markup backend instead.
|
|
158
|
+
try argv.append(allocator, "-Dview-reload=true");
|
|
159
|
+
view_reload = true;
|
|
153
160
|
}
|
|
154
161
|
},
|
|
155
162
|
.build => {
|
|
@@ -178,7 +185,23 @@ pub fn run(allocator: std.mem.Allocator, io: std.Io, verb: Verb, options: Option
|
|
|
178
185
|
});
|
|
179
186
|
}
|
|
180
187
|
|
|
181
|
-
|
|
188
|
+
if (view_reload) {
|
|
189
|
+
const framework_root = (try buildgraph.resolveFrameworkRoot(allocator, io, options.base_env)) orelse return error.MissingFramework;
|
|
190
|
+
defer allocator.free(framework_root);
|
|
191
|
+
var watcher = try ts_core.startViewReloadWatch(allocator, io, options.base_env, framework_root);
|
|
192
|
+
defer {
|
|
193
|
+
// Closing its stdin ends the watcher; kill covers a stuck one.
|
|
194
|
+
if (watcher.stdin) |stdin| stdin.close(io);
|
|
195
|
+
watcher.stdin = null;
|
|
196
|
+
watcher.kill(io);
|
|
197
|
+
}
|
|
198
|
+
var env = std.process.Environ.Map.init(allocator);
|
|
199
|
+
defer env.deinit();
|
|
200
|
+
for (options.base_env.keys(), options.base_env.values()) |key, value| try env.put(key, value);
|
|
201
|
+
try env.put("NATIVE_SDK_DEV_VIEW", ts_core.view_reload_dir);
|
|
202
|
+
std.debug.print("native dev: markup edits reload in place (compiled views)\n", .{});
|
|
203
|
+
try runZigWithEnv(io, verb, argv.items, &env);
|
|
204
|
+
} else try runZig(io, verb, argv.items);
|
|
182
205
|
if (rebuild_snapshot) |snapshot| try persistRebuildSnapshot(io, snapshot);
|
|
183
206
|
|
|
184
207
|
if (wants_frontend_dev) {
|
|
@@ -242,10 +265,39 @@ fn hasOptimizeFlag(args: []const []const u8) bool {
|
|
|
242
265
|
return false;
|
|
243
266
|
}
|
|
244
267
|
|
|
245
|
-
|
|
268
|
+
/// Whether the forwarded args turn compiled TypeScript views off (they are
|
|
269
|
+
/// the default for TypeScript apps); the last spelling wins.
|
|
270
|
+
fn typeScriptViewDisabled(args: []const []const u8) bool {
|
|
271
|
+
var disabled = false;
|
|
246
272
|
for (args) |arg| {
|
|
247
|
-
if (std.mem.eql(u8, arg, "-Dtypescript-view") or
|
|
248
|
-
|
|
273
|
+
if (std.mem.eql(u8, arg, "-Dtypescript-view") or std.mem.eql(u8, arg, "-Dtypescript-view=true")) disabled = false;
|
|
274
|
+
if (std.mem.eql(u8, arg, "-Dtypescript-view=false")) disabled = true;
|
|
275
|
+
}
|
|
276
|
+
return disabled;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
/// Mobile builds reload by rebuilding; their dev runs never stage the
|
|
280
|
+
/// development evaluator.
|
|
281
|
+
fn targetsMobile(args: []const []const u8) bool {
|
|
282
|
+
for (args) |arg| {
|
|
283
|
+
if (!std.mem.startsWith(u8, arg, "-Dtarget=")) continue;
|
|
284
|
+
if (std.mem.indexOf(u8, arg, "ios") != null or std.mem.indexOf(u8, arg, "android") != null) return true;
|
|
285
|
+
}
|
|
286
|
+
return false;
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
fn hasDebugOptimizeFlag(args: []const []const u8) bool {
|
|
290
|
+
var debug = false;
|
|
291
|
+
for (args) |arg| {
|
|
292
|
+
if (std.mem.startsWith(u8, arg, "-Doptimize")) debug = std.mem.eql(u8, arg, "-Doptimize=Debug");
|
|
293
|
+
if (std.mem.startsWith(u8, arg, "--release")) debug = false;
|
|
294
|
+
}
|
|
295
|
+
return debug;
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
fn hasFlag(args: []const []const u8, comptime name: []const u8) bool {
|
|
299
|
+
for (args) |arg| {
|
|
300
|
+
if (std.mem.eql(u8, arg, name) or std.mem.startsWith(u8, arg, name ++ "=")) return true;
|
|
249
301
|
}
|
|
250
302
|
return false;
|
|
251
303
|
}
|
|
@@ -413,6 +465,10 @@ fn persistRebuildSnapshot(io: std.Io, snapshot: []const u8) !void {
|
|
|
413
465
|
}
|
|
414
466
|
|
|
415
467
|
fn runZig(io: std.Io, verb: Verb, argv: []const []const u8) !void {
|
|
468
|
+
return runZigWithEnv(io, verb, argv, null);
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
fn runZigWithEnv(io: std.Io, verb: Verb, argv: []const []const u8, environ_map: ?*const std.process.Environ.Map) !void {
|
|
416
472
|
// The dev verb owns a whole process TREE: `zig build run` spawns the
|
|
417
473
|
// app as its child, and a `native dev` that dies (Ctrl-C, a driver
|
|
418
474
|
// killing the CLI) must not leave that app running — an orphaned
|
|
@@ -425,6 +481,7 @@ fn runZig(io: std.Io, verb: Verb, argv: []const []const u8) !void {
|
|
|
425
481
|
.stdin = .inherit,
|
|
426
482
|
.stdout = .inherit,
|
|
427
483
|
.stderr = .inherit,
|
|
484
|
+
.environ_map = environ_map,
|
|
428
485
|
.pgid = if (own_tree) process_tree.spawnPgid() else null,
|
|
429
486
|
});
|
|
430
487
|
// Capture the group id at spawn: wait() clears the child's id.
|
|
@@ -512,12 +569,19 @@ test "optimize flags are detected among forwarded args" {
|
|
|
512
569
|
try std.testing.expect(!hasOptimizeFlag(&.{}));
|
|
513
570
|
}
|
|
514
571
|
|
|
515
|
-
test "
|
|
516
|
-
try std.testing.expect(
|
|
517
|
-
try std.testing.expect(
|
|
518
|
-
try std.testing.expect(
|
|
519
|
-
try std.testing.expect(!
|
|
520
|
-
try std.testing.expect(
|
|
572
|
+
test "compiled views reload markup in a Debug dev run unless the native backend is selected" {
|
|
573
|
+
try std.testing.expect(!typeScriptViewDisabled(&.{}));
|
|
574
|
+
try std.testing.expect(!typeScriptViewDisabled(&.{"-Dtypescript-view=true"}));
|
|
575
|
+
try std.testing.expect(typeScriptViewDisabled(&.{"-Dtypescript-view=false"}));
|
|
576
|
+
try std.testing.expect(!typeScriptViewDisabled(&.{ "-Dtypescript-view=false", "-Dtypescript-view" }));
|
|
577
|
+
try std.testing.expect(hasDebugOptimizeFlag(&.{"-Doptimize=Debug"}));
|
|
578
|
+
try std.testing.expect(!hasDebugOptimizeFlag(&.{"-Doptimize=ReleaseFast"}));
|
|
579
|
+
try std.testing.expect(!hasDebugOptimizeFlag(&.{ "-Doptimize=Debug", "--release=safe" }));
|
|
580
|
+
try std.testing.expect(hasFlag(&.{"-Dview-reload=false"}, "-Dview-reload"));
|
|
581
|
+
try std.testing.expect(!hasFlag(&.{"-Dview-reloads=true"}, "-Dview-reload"));
|
|
582
|
+
try std.testing.expect(targetsMobile(&.{"-Dtarget=aarch64-ios-simulator"}));
|
|
583
|
+
try std.testing.expect(targetsMobile(&.{"-Dtarget=aarch64-linux-android"}));
|
|
584
|
+
try std.testing.expect(!targetsMobile(&.{"-Dtarget=x86_64-linux-gnu.2.36"}));
|
|
521
585
|
}
|
|
522
586
|
|
|
523
587
|
test "rebuild explanations persist manifest and source hashes" {
|
|
@@ -48,6 +48,10 @@ test("nested unions in helper arguments retain their decoder type imports", () =
|
|
|
48
48
|
// Exact diagnostics and complete generated-file hashes captured from the
|
|
49
49
|
// independent native implementation before replacing its admission rules.
|
|
50
50
|
// Mirror hashes include the reviewed stateless-runtime API addition.
|
|
51
|
+
// Mirror hashes also include file-scope host facts: `has_windows` and the
|
|
52
|
+
// virtual extent capability, which the model types forward. Removing that
|
|
53
|
+
// block and nesting the capability back in both model types recovers the
|
|
54
|
+
// previous mirror pins exactly.
|
|
51
55
|
// Facade hashes include exact u32 image identities, nonreplacing file
|
|
52
56
|
// results and exact-range timers. Removing the reviewed timer encoder
|
|
53
57
|
// addition recovers every previous complete facade pin. The byte-key
|
|
@@ -110,13 +114,15 @@ test("parameterized arena helpers and retained integer estimators keep the attes
|
|
|
110
114
|
assert.match(mirror, /pub fn snapshotModel/);
|
|
111
115
|
assert.match(mirror, /decoded_model = null/);
|
|
112
116
|
assert.match(mirror, /const args_tuple = \.\{ p0, p1 \}/);
|
|
113
|
-
assert.match(mirror,
|
|
114
|
-
assert.match(mirror,
|
|
117
|
+
assert.match(mirror, /\npub fn virtualExtentHelper\(name: \[\]const u8\) \?u32 \{/);
|
|
118
|
+
assert.match(mirror, /\npub fn virtualExtentEstimate\(context: \?\*const anyopaque, index: u64\) f32 \{/);
|
|
119
|
+
assert.equal(mirror.split(" pub const virtualExtentEstimate = shim_root.virtualExtentEstimate;").length, 3, "both model types forward the capability");
|
|
120
|
+
assert.match(mirror, /\npub const has_windows: bool = false;/);
|
|
115
121
|
assert.match(mirror, /callHelper\(\[\]const Range, 0, args, arena\)/);
|
|
116
122
|
assert.match(mirror, /@bitCast\(@as\(u64, @intCast\(index\)\)\)/);
|
|
117
123
|
assert.match(facade, /rows\(nscfCommitted,/);
|
|
118
124
|
assert.match(facade, /estimate\(nscfCommitted,/);
|
|
119
|
-
for (const name of ["virtualExtentHelper", "virtualExtentEstimate", "RuntimeModel", "RuntimeResult", "decoded_model", "restoreCommittedModel"]) {
|
|
125
|
+
for (const name of ["virtualExtentHelper", "virtualExtentEstimate", "shim_root", "has_windows", "RuntimeModel", "RuntimeResult", "decoded_model", "restoreCommittedModel"]) {
|
|
120
126
|
const conflicting = structuredClone(contract);
|
|
121
127
|
conflicting.model_helpers[1].name = name;
|
|
122
128
|
conflicting.integer_slots.find(slot => slot.slot === "helpers.estimate.params[0]")!.slot = `helpers.${name}.params[0]`;
|
|
@@ -138,6 +144,22 @@ test("parameterized arena helpers and retained integer estimators keep the attes
|
|
|
138
144
|
} finally { fs.rmSync(dir, { recursive: true, force: true }); }
|
|
139
145
|
});
|
|
140
146
|
|
|
147
|
+
test("the windows helper fact is published at file scope", () => {
|
|
148
|
+
const dir = fs.mkdtempSync(path.join(os.tmpdir(), "native-windows-fact-"));
|
|
149
|
+
try {
|
|
150
|
+
for (const declared of [false, true]) {
|
|
151
|
+
const contract = baseContract();
|
|
152
|
+
if (declared) contract.model_helpers.push({ name: "windows", params: [], returns: { kind: "f64" }, arena: false });
|
|
153
|
+
fs.writeFileSync(path.join(dir, "input.json"), JSON.stringify(contract, (key, value) => (key === "origin" || key === "member") && value === null ? undefined : value));
|
|
154
|
+
const result = spawnSync(corewire, ["--sidecar", "input.json", "--out", "mirror"], { cwd: dir, encoding: "utf8" });
|
|
155
|
+
assert.ifError(result.error); assert.equal(result.status, 0, result.stderr);
|
|
156
|
+
const mirror = fs.readFileSync(path.join(dir, "mirror"), "utf8");
|
|
157
|
+
assert.equal(mirror.split("\npub const has_windows: bool = " + declared + ";\n").length, 2);
|
|
158
|
+
assert.doesNotMatch(mirror, /shim_root/, "no virtual extent capability without numeric helpers or virtual views");
|
|
159
|
+
}
|
|
160
|
+
} finally { fs.rmSync(dir, { recursive: true, force: true }); }
|
|
161
|
+
});
|
|
162
|
+
|
|
141
163
|
test("Markdown recipe wrapper names reserve only when window policy glue is emitted", () => {
|
|
142
164
|
const dir = fs.mkdtempSync(path.join(os.tmpdir(), "native-markdown-collision-"));
|
|
143
165
|
try {
|
|
@@ -116,6 +116,10 @@ pub fn Bindings(comptime prefix: []const u8) type {
|
|
|
116
116
|
pub const native_media_window_view = Symbol(fn (label: [*]const u8, label_len: usize, request: [*]const u8, request_len: usize, out: *[*]const u8, len: *usize) callconv(.c) void, "native_media_window_view");
|
|
117
117
|
pub const native_virtual_requests = Symbol(fn (label: [*]const u8, label_len: usize, video: [*]const u8, video_len: usize, out: *[*]const u8, len: *usize) callconv(.c) void, "native_virtual_requests");
|
|
118
118
|
pub const native_virtual_view = Symbol(fn (label: [*]const u8, label_len: usize, context: [*]const u8, context_len: usize, video: [*]const u8, video_len: usize, out: *[*]const u8, len: *usize) callconv(.c) void, "native_virtual_view");
|
|
119
|
+
/// Debug-only development view: prepare a changed markup program, or
|
|
120
|
+
/// return to the compiled view. Results borrow until frame_reset.
|
|
121
|
+
pub const native_dev_view_prepare = Symbol(fn (program: [*]const u8, program_len: usize, out: *[*]const u8, len: *usize) callconv(.c) void, "native_dev_view_prepare");
|
|
122
|
+
pub const native_dev_view_reset = Symbol(fn (out: *[*]const u8, len: *usize) callconv(.c) void, "native_dev_view_reset");
|
|
119
123
|
pub const native_window_view = Symbol(fn (label: [*]const u8, label_len: usize, out: *[*]const u8, len: *usize) callconv(.c) void, "native_window_view");
|
|
120
124
|
|
|
121
125
|
/// Pure retained radio policy over native tree/eligibility bytes.
|
|
@@ -278,7 +278,7 @@ function channels(s: CoreContract, out: Diagnostic[]): void {
|
|
|
278
278
|
}
|
|
279
279
|
}
|
|
280
280
|
export const unconditionalExports = ["abi_version", "build_id", "set_panic_sink", "init", "collect", "frame_reset", "boot_cmd", "dispatch_void", "dispatch_bytes", "dispatch_number", "dispatch_number_bytes", "dispatch_bool", "dispatch_enum", "dispatch_record", "dispatch_text_input", "dispatch_scroll_state", "subscriptions", "model_snapshot", "persist_snapshot", "restore_model", "migrate_model", "helper_call"];
|
|
281
|
-
export const conditionalExports = ["command_msg", "frame_msg", "frame_msg_ns", "key_msg", "pinch_msg", "drop_msg", "native_view", "native_window_view", "native_media_view", "native_media_window_view", "native_radio_policy", "native_tabs_policy", "native_tree_policy", "native_list_policy", "native_menu_policy", "native_toggle_policy", "native_accordion_policy", "native_slider_policy", "native_split_policy", "native_scroll_policy", "native_resizable_policy", "native_text_policy", "native_timer_policy", "native_db_policy", "native_effect_policy", "native_stream_policy", "native_window_policy", "native_theme_policy", "native_status_policy", "native_virtual_requests", "native_virtual_view"];
|
|
281
|
+
export const conditionalExports = ["command_msg", "frame_msg", "frame_msg_ns", "key_msg", "pinch_msg", "drop_msg", "native_view", "native_window_view", "native_media_view", "native_media_window_view", "native_radio_policy", "native_tabs_policy", "native_tree_policy", "native_list_policy", "native_menu_policy", "native_toggle_policy", "native_accordion_policy", "native_slider_policy", "native_split_policy", "native_scroll_policy", "native_resizable_policy", "native_text_policy", "native_timer_policy", "native_db_policy", "native_effect_policy", "native_stream_policy", "native_window_policy", "native_theme_policy", "native_status_policy", "native_virtual_requests", "native_virtual_view", "native_dev_view_prepare", "native_dev_view_reset"];
|
|
282
282
|
function abi(s: CoreContract, out: Diagnostic[]): void {
|
|
283
283
|
let cursor = 0;
|
|
284
284
|
for (const name of unconditionalExports) {
|