@native-sdk/cli 0.10.0 → 0.11.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/README.md +8 -6
- package/bin/native.js +2 -1
- package/build/app.zig +320 -60
- package/build/corewire.zig +53 -0
- package/build/test_shards.zig +49 -0
- package/build/ts_run.mjs +3 -3
- package/build.zig +1818 -87
- package/package.json +19 -14
- package/packages/core/compile-surface/core.ts +134 -72
- package/packages/core/package-lock.json +75 -357
- package/packages/core/package.json +25 -4
- package/packages/core/scripts/compiler_command.mjs +17 -12
- package/packages/core/scripts/compiler_typecheck.mjs +1 -0
- package/packages/core/scripts/gen_declarations.mjs +3 -2
- package/packages/core/scripts/gen_service_surface.mjs +22 -10
- package/packages/core/scripts/install_scriptc.mjs +182 -0
- package/packages/core/scripts/invoke_scriptc.mjs +18 -0
- package/packages/core/scripts/merge_static_archives.mjs +6 -1
- package/packages/core/scripts/npm_static_spike.mjs +2 -2
- package/packages/core/scripts/run_external_core_compiler.mjs +22 -10
- package/packages/core/scripts/run_external_service_compiler.mjs +15 -15
- package/packages/core/scripts/run_library_compiler.mjs +51 -0
- package/packages/core/scripts/run_native_tests.mjs +22 -0
- package/packages/core/scripts/scriptc-toolchain.json +101 -0
- package/packages/core/scripts/scriptc_toolchain.mjs +121 -0
- package/packages/core/scripts/stage_external_core.mjs +57 -1
- package/packages/core/scripts/surface_manifest_diff.mjs +19 -12
- package/packages/core/sdk/bytes.d.ts +2 -0
- package/packages/core/sdk/bytes.ts +86 -0
- package/packages/core/sdk/core.d.ts +308 -4
- package/packages/core/sdk/core.ts +320 -84
- package/packages/core/sdk/events.d.ts +247 -0
- package/packages/core/sdk/events.ts +230 -2
- package/packages/core/sdk/internal/image_identity.d.ts +7 -0
- package/packages/core/sdk/internal/image_identity.ts +71 -0
- package/packages/core/sdk/internal/markdown_policy.d.ts +5 -0
- package/packages/core/sdk/internal/markdown_policy.ts +878 -0
- package/packages/core/sdk/text.d.ts +27 -0
- package/packages/core/sdk/text.ts +206 -15
- package/packages/core/sdk/theme.d.ts +251 -0
- package/packages/core/sdk/theme.ts +267 -0
- package/packages/core/src/authorization.ts +137 -0
- package/packages/core/src/automation_commands.ts +201 -0
- package/packages/core/src/automation_interactions.ts +92 -0
- package/packages/core/src/bridge_descriptors.ts +104 -0
- package/packages/core/src/builtin_coordination.ts +172 -0
- package/packages/core/src/canvas_frame_coordination.ts +81 -0
- package/packages/core/src/canvas_presentation_lifecycle.ts +84 -0
- package/packages/core/src/canvas_scene_observation.ts +145 -0
- package/packages/core/src/chart_content.ts +161 -0
- package/packages/core/src/chart_plans.ts +432 -0
- package/packages/core/src/checker.ts +166 -19
- package/packages/core/src/code_content.ts +580 -0
- package/packages/core/src/command_coordination.ts +140 -0
- package/packages/core/src/component_composition.ts +94 -0
- package/packages/core/src/component_construction.ts +149 -0
- package/packages/core/src/contract.ts +25 -7
- package/packages/core/src/control_appearance.ts +232 -0
- package/packages/core/src/control_commands.ts +115 -0
- package/packages/core/src/control_content.ts +105 -0
- package/packages/core/src/control_geometry.ts +107 -0
- package/packages/core/src/control_payloads.ts +119 -0
- package/packages/core/src/control_primitives.ts +134 -0
- package/packages/core/src/devhost.ts +82 -7
- package/packages/core/src/devhost_journal.mjs +30 -7
- package/packages/core/src/effect_plans.ts +71 -0
- package/packages/core/src/flow_measurement.ts +121 -0
- package/packages/core/src/font_registry.ts +37 -0
- package/packages/core/src/glyph_atlas.ts +86 -0
- package/packages/core/src/gpu_packet_preparation.ts +130 -0
- package/packages/core/src/gpu_planning.ts +123 -0
- package/packages/core/src/gpu_presentation.ts +55 -0
- package/packages/core/src/host_flow.ts +89 -0
- package/packages/core/src/host_input_regions.ts +165 -0
- package/packages/core/src/image_registry.ts +66 -0
- package/packages/core/src/indicator_plans.ts +132 -0
- package/packages/core/src/infer.ts +150 -8
- package/packages/core/src/input_composition.ts +116 -0
- package/packages/core/src/intrinsic_measure.ts +100 -0
- package/packages/core/src/layout_coordination.ts +207 -0
- package/packages/core/src/leaf_plans.ts +134 -0
- package/packages/core/src/markup_development.ts +160 -0
- package/packages/core/src/measurement_coordination.ts +185 -0
- package/packages/core/src/modules.ts +1 -1
- package/packages/core/src/motion_sampling.ts +100 -0
- package/packages/core/src/paragraph_layout.ts +192 -0
- package/packages/core/src/portable_sources.json +74 -0
- package/packages/core/src/portable_sources.ts +17 -0
- package/packages/core/src/registered_font.ts +93 -0
- package/packages/core/src/render_animation_lifecycle.ts +128 -0
- package/packages/core/src/render_coordination.ts +170 -0
- package/packages/core/src/render_resources.ts +234 -0
- package/packages/core/src/runtime_policy.ts +3930 -0
- package/packages/core/src/scalar_text.ts +84 -0
- package/packages/core/src/service_contract.ts +2 -1
- package/packages/core/src/session_codecs.ts +309 -0
- package/packages/core/src/shell_admission.ts +126 -0
- package/packages/core/src/shell_coordination.ts +93 -0
- package/packages/core/src/sqlite_cli.ts +11 -0
- package/packages/core/src/status_validation.ts +232 -0
- package/packages/core/src/stream_policy.ts +63 -0
- package/packages/core/src/surface_recipes.ts +136 -0
- package/packages/core/src/system_admission.ts +60 -0
- package/packages/core/src/terminal_paint.ts +436 -0
- package/packages/core/src/text_document_width.ts +81 -0
- package/packages/core/src/text_measurement_cache.ts +69 -0
- package/packages/core/src/text_query_layout.ts +179 -0
- package/packages/core/src/text_run_layout.ts +410 -0
- package/packages/core/src/text_span_queries.ts +355 -0
- package/packages/core/src/typed_ast.ts +18 -1
- package/packages/core/src/types.ts +7 -5
- package/packages/core/src/vector_effects.ts +98 -0
- package/packages/core/src/vector_raster.ts +243 -0
- package/packages/core/src/view_components.ts +2415 -0
- package/packages/core/src/view_coordination.ts +198 -0
- package/packages/core/src/view_frontend.ts +980 -0
- package/packages/core/src/widget_audits.ts +202 -0
- package/packages/core/src/widget_changes.ts +258 -0
- package/packages/core/src/widget_metrics.ts +139 -0
- package/packages/core/src/widget_motion.ts +171 -0
- package/packages/core/src/widget_paint.ts +272 -0
- package/packages/core/src/widget_paint_walk.ts +203 -0
- package/packages/core/src/widget_presentation.ts +141 -0
- package/packages/core/src/widget_routing.ts +262 -0
- package/packages/core/src/window_lifecycle.ts +92 -0
- package/packages/core/testing/index.ts +430 -0
- package/schemas/app.schema.json +13 -0
- package/skill-data/core/SKILL.md +2 -2
- package/skill-data/core/references/web-engines-packaging-debugging.md +2 -1
- package/skill-data/native-ui/SKILL.md +76 -17
- package/skill-data/ts-core/SKILL.md +113 -9
- package/skill-data/ts-services/SKILL.md +1 -1
- package/skill-data/ts-services/references/service-surface.md +264 -144
- package/src/app_runner/root.zig +25 -12
- package/src/app_runner/ts_compiled_view.zig +1631 -0
- package/src/app_runner/ts_core_main.zig +143 -10
- package/src/app_runner/ts_core_mobile.zig +24 -12
- package/src/automation/server.zig +1 -3
- package/src/automation/snapshot.zig +9 -637
- package/src/automation/snapshot_reference.zig +656 -0
- package/src/automation/snapshot_serialization.zig +566 -0
- package/src/platform/linux/gtk_host.c +36 -24
- package/src/platform/linux/gtk_pixels.h +118 -0
- package/src/platform/linux/gtk_pixels_test.c +241 -0
- package/src/platform/linux/root.zig +2 -0
- package/src/platform/macos/appkit_host.m +188 -30
- package/src/platform/macos/pointer_motion_test.m +96 -0
- package/src/platform/macos/scroll_driver_test.m +105 -0
- package/src/platform/macos/spectrum_bins.h +34 -0
- package/src/platform/macos/spectrum_bins_test.c +56 -0
- package/src/platform/macos/text_keyboard_test.m +80 -0
- package/src/platform/macos/widget_focus_test.m +66 -0
- package/src/platform/null_platform.zig +26 -2
- package/src/platform/null_platform_tests.zig +13 -0
- package/src/platform/root.zig +1 -0
- package/src/platform/types.zig +13 -0
- package/src/platform/windows/root.zig +2 -0
- package/src/platform/windows/webview2_host.cpp +7 -2
- package/src/primitives/app_manifest/comptime_scene.zig +1 -1
- package/src/primitives/app_manifest/root.zig +2 -0
- package/src/primitives/app_manifest/tests.zig +4 -1
- package/src/primitives/app_manifest/validation.zig +2 -0
- package/src/primitives/canvas/a11y_audit.zig +3 -1
- package/src/primitives/canvas/canvas_frame_coordination_policy.zig +134 -0
- package/src/primitives/canvas/chart_content_policy.zig +75 -0
- package/src/primitives/canvas/chart_plan_policy.zig +196 -0
- package/src/primitives/canvas/code_content_policy.zig +162 -0
- package/src/primitives/canvas/commands.zig +29 -1
- package/src/primitives/canvas/component_composition.zig +125 -0
- package/src/primitives/canvas/component_composition_policy.zig +44 -0
- package/src/primitives/canvas/component_construction_policy.zig +187 -0
- package/src/primitives/canvas/container_layout_policy.zig +87 -0
- package/src/primitives/canvas/control_appearance_policy.zig +142 -0
- package/src/primitives/canvas/control_command_policy.zig +75 -0
- package/src/primitives/canvas/control_content_policy.zig +90 -0
- package/src/primitives/canvas/control_geometry_policy.zig +165 -0
- package/src/primitives/canvas/control_payload_policy.zig +48 -0
- package/src/primitives/canvas/control_primitive_policy.zig +129 -0
- package/src/primitives/canvas/effect_plan_policy.zig +96 -0
- package/src/primitives/canvas/events.zig +1027 -1
- package/src/primitives/canvas/flow_measurement_policy.zig +237 -0
- package/src/primitives/canvas/frame.zig +92 -23
- package/src/primitives/canvas/glyph_atlas_policy.zig +40 -0
- package/src/primitives/canvas/gpu.zig +10 -0
- package/src/primitives/canvas/gpu_packet_preparation_policy.zig +325 -0
- package/src/primitives/canvas/gpu_planning_policy.zig +364 -0
- package/src/primitives/canvas/gpu_presentation_policy.zig +74 -0
- package/src/primitives/canvas/grid_layout_policy.zig +51 -0
- package/src/primitives/canvas/indicator_plan_policy.zig +128 -0
- package/src/primitives/canvas/intrinsic_layout_policy.zig +87 -0
- package/src/primitives/canvas/intrinsic_measure_policy.zig +128 -0
- package/src/primitives/canvas/layout_audit.zig +5 -2
- package/src/primitives/canvas/layout_coordination_policy.zig +262 -0
- package/src/primitives/canvas/leaf_plan_policy.zig +117 -0
- package/src/primitives/canvas/markdown.zig +13 -3
- package/src/primitives/canvas/markdown_content_policy.zig +227 -0
- package/src/primitives/canvas/markdown_image_binding.zig +81 -0
- package/src/primitives/canvas/measurement_coordination_policy.zig +288 -0
- package/src/primitives/canvas/numeric_capabilities.zig +14 -0
- package/src/primitives/canvas/reference.zig +12 -6
- package/src/primitives/canvas/registered_font_policy.zig +152 -0
- package/src/primitives/canvas/render.zig +48 -0
- package/src/primitives/canvas/render_cache_policy.zig +184 -0
- package/src/primitives/canvas/render_coordination_policy.zig +163 -0
- package/src/primitives/canvas/render_damage_policy.zig +160 -0
- package/src/primitives/canvas/render_effects.zig +14 -0
- package/src/primitives/canvas/render_generic_resources.zig +14 -0
- package/src/primitives/canvas/render_images.zig +14 -0
- package/src/primitives/canvas/render_layers.zig +14 -0
- package/src/primitives/canvas/render_override_policy.zig +119 -0
- package/src/primitives/canvas/render_paths.zig +14 -0
- package/src/primitives/canvas/render_plan_policy.zig +199 -0
- package/src/primitives/canvas/render_resource_policy.zig +476 -0
- package/src/primitives/canvas/root.zig +100 -0
- package/src/primitives/canvas/semantic_tree_policy.zig +158 -0
- package/src/primitives/canvas/serialization.zig +8 -1
- package/src/primitives/canvas/surface_layout_policy.zig +36 -0
- package/src/primitives/canvas/surface_recipe_policy.zig +231 -0
- package/src/primitives/canvas/terminal_grid.zig +10 -696
- package/src/primitives/canvas/terminal_grid_reference.zig +709 -0
- package/src/primitives/canvas/terminal_paint_policy.zig +191 -0
- package/src/primitives/canvas/text.zig +1 -0
- package/src/primitives/canvas/text_atlas.zig +113 -0
- package/src/primitives/canvas/text_cache_policy.zig +94 -0
- package/src/primitives/canvas/text_document_policy.zig +120 -0
- package/src/primitives/canvas/text_layout.zig +51 -2
- package/src/primitives/canvas/text_layout_cache.zig +29 -0
- package/src/primitives/canvas/text_layout_hash.zig +1 -0
- package/src/primitives/canvas/text_layout_types.zig +3 -0
- package/src/primitives/canvas/text_measure_cache.zig +46 -0
- package/src/primitives/canvas/text_measurement_policy.zig +124 -0
- package/src/primitives/canvas/text_metrics.zig +23 -0
- package/src/primitives/canvas/text_query_policy.zig +156 -0
- package/src/primitives/canvas/text_run_policy.zig +252 -0
- package/src/primitives/canvas/text_scalar_policy.zig +156 -0
- package/src/primitives/canvas/text_span_query_policy.zig +232 -0
- package/src/primitives/canvas/text_spans.zig +280 -8
- package/src/primitives/canvas/text_tests.zig +10 -0
- package/src/primitives/canvas/tokens.zig +38 -0
- package/src/primitives/canvas/ui.zig +250 -83
- package/src/primitives/canvas/ui_markup.zig +139 -33
- package/src/primitives/canvas/ui_markup_compiled.zig +319 -59
- package/src/primitives/canvas/ui_markup_compiled_tests.zig +225 -0
- package/src/primitives/canvas/ui_markup_contract.zig +146 -14
- package/src/primitives/canvas/ui_markup_contract_tests.zig +77 -0
- package/src/primitives/canvas/ui_markup_reflect.zig +56 -0
- package/src/primitives/canvas/ui_markup_tests.zig +116 -0
- package/src/primitives/canvas/ui_markup_view.zig +258 -32
- package/src/primitives/canvas/ui_markup_view_tests.zig +142 -10
- package/src/primitives/canvas/ui_schema.zig +13 -1
- package/src/primitives/canvas/ui_schema_tests.zig +11 -7
- package/src/primitives/canvas/ui_tests.zig +1 -0
- package/src/primitives/canvas/vector.zig +36 -2
- package/src/primitives/canvas/vector_effect_policy.zig +236 -0
- package/src/primitives/canvas/vector_raster_policy.zig +190 -0
- package/src/primitives/canvas/virtual_extent_policy.zig +292 -0
- package/src/primitives/canvas/virtual_extents.zig +99 -3
- package/src/primitives/canvas/virtual_flow_policy.zig +108 -0
- package/src/primitives/canvas/widget_audit_policy.zig +293 -0
- package/src/primitives/canvas/widget_change_policy.zig +298 -0
- package/src/primitives/canvas/widget_invalidation.zig +113 -2
- package/src/primitives/canvas/widget_layout.zig +673 -128
- package/src/primitives/canvas/widget_layout_tests.zig +4 -0
- package/src/primitives/canvas/widget_metric_policy.zig +126 -0
- package/src/primitives/canvas/widget_metrics.zig +45 -6
- package/src/primitives/canvas/widget_paint_policy.zig +166 -0
- package/src/primitives/canvas/widget_paint_walk_policy.zig +252 -0
- package/src/primitives/canvas/widget_presentation_policy.zig +168 -0
- package/src/primitives/canvas/widget_render.zig +744 -74
- package/src/primitives/canvas/widget_render_controls.zig +1217 -133
- package/src/primitives/canvas/widget_render_scroll.zig +11 -3
- package/src/primitives/canvas/widget_render_style.zig +94 -0
- package/src/primitives/canvas/widget_render_surfaces.zig +61 -50
- package/src/primitives/canvas/widget_routing.zig +75 -0
- package/src/primitives/canvas/widget_routing_policy.zig +135 -0
- package/src/primitives/canvas/widget_runtime.zig +20 -1
- package/src/primitives/canvas/widget_semantics.zig +25 -0
- package/src/primitives/canvas/widget_text_input.zig +86 -23
- package/src/primitives/canvas/widget_text_select.zig +1 -0
- package/src/primitives/canvas/widget_tree.zig +8 -1
- package/src/primitives/canvas/widgets.zig +42 -12
- package/src/primitives/canvas/wrapped_layout_policy.zig +104 -0
- package/src/root.zig +21 -0
- package/src/runtime/accessibility_policy.zig +122 -0
- package/src/runtime/api.zig +28 -0
- package/src/runtime/app_dispatch_policy.zig +68 -0
- package/src/runtime/authorization_policy.zig +150 -0
- package/src/runtime/automation_command_policy.zig +241 -0
- package/src/runtime/automation_interaction_policy.zig +107 -0
- package/src/runtime/automation_snapshot.zig +52 -22
- package/src/runtime/automation_snapshot_reference.zig +290 -0
- package/src/runtime/automation_widget_dispatch.zig +267 -355
- package/src/runtime/automation_widget_dispatch_reference.zig +900 -0
- package/src/runtime/blob_policy.zig +58 -0
- package/src/runtime/blob_reference.zig +64 -0
- package/src/runtime/bridge_descriptor_policy.zig +206 -0
- package/src/runtime/builtin_bridge.zig +180 -44
- package/src/runtime/builtin_coordination_policy.zig +121 -0
- package/src/runtime/callback_policy_test_reference.zig +97 -0
- package/src/runtime/canvas_drag_policy.zig +94 -0
- package/src/runtime/canvas_fonts.zig +38 -10
- package/src/runtime/canvas_frame.zig +590 -134
- package/src/runtime/canvas_frame_helpers.zig +1 -0
- package/src/runtime/canvas_hover_policy.zig +131 -0
- package/src/runtime/canvas_images.zig +59 -30
- package/src/runtime/canvas_keyboard_focus_policy.zig +154 -0
- package/src/runtime/canvas_limits.zig +1 -1
- package/src/runtime/canvas_presentation_lifecycle_policy.zig +86 -0
- package/src/runtime/canvas_scene_observation_policy.zig +181 -0
- package/src/runtime/canvas_widget_context_menu.zig +4 -4
- package/src/runtime/canvas_widget_display.zig +110 -9
- package/src/runtime/canvas_widget_events.zig +718 -328
- package/src/runtime/canvas_widget_runtime.zig +437 -81
- package/src/runtime/canvas_widget_scroll_drivers.zig +39 -1
- package/src/runtime/canvas_widget_scroll_tests.zig +31 -0
- package/src/runtime/canvas_widget_state.zig +93 -56
- package/src/runtime/channel_sources.zig +80 -0
- package/src/runtime/command_policy.zig +161 -0
- package/src/runtime/component_policy.zig +83 -0
- package/src/runtime/core.zig +156 -6
- package/src/runtime/desktop_files.zig +189 -0
- package/src/runtime/effects.zig +466 -29
- package/src/runtime/effects_tests.zig +28 -0
- package/src/runtime/file_policy_test_reference.zig +113 -0
- package/src/runtime/flow.zig +418 -341
- package/src/runtime/flow_reference.zig +1426 -0
- package/src/runtime/font_registry_policy.zig +72 -0
- package/src/runtime/frame_profile.zig +24 -33
- package/src/runtime/gpu_surface_events.zig +97 -35
- package/src/runtime/host_event_pump.zig +303 -0
- package/src/runtime/host_event_pump_reference.zig +268 -0
- package/src/runtime/host_flow_policy.zig +155 -0
- package/src/runtime/host_input_regions_policy.zig +156 -0
- package/src/runtime/image_registry_policy.zig +94 -0
- package/src/runtime/input_composition_policy.zig +138 -0
- package/src/runtime/journal_policy.zig +66 -0
- package/src/runtime/journal_reference.zig +53 -0
- package/src/runtime/lifecycle_policy_test_reference.zig +97 -0
- package/src/runtime/markup_development_policy.zig +91 -0
- package/src/runtime/media_surface.zig +40 -1
- package/src/runtime/motion_sampling_policy.zig +159 -0
- package/src/runtime/recording_policy.zig +42 -0
- package/src/runtime/render_animation_policy.zig +206 -0
- package/src/runtime/replay_policy.zig +66 -0
- package/src/runtime/replay_policy_reference.zig +326 -0
- package/src/runtime/replay_progress_policy.zig +64 -0
- package/src/runtime/replay_progress_reference.zig +34 -0
- package/src/runtime/request_policy_test_reference.zig +188 -0
- package/src/runtime/root.zig +13 -0
- package/src/runtime/session_blobs.zig +157 -58
- package/src/runtime/session_blobs_reference.zig +692 -0
- package/src/runtime/session_codec.zig +361 -0
- package/src/runtime/session_codec_reference.zig +1027 -0
- package/src/runtime/session_journal.zig +246 -983
- package/src/runtime/session_record.zig +224 -45
- package/src/runtime/session_replay.zig +157 -415
- package/src/runtime/session_tests.zig +552 -0
- package/src/runtime/shell_admission_policy.zig +225 -0
- package/src/runtime/shell_coordination_policy.zig +138 -0
- package/src/runtime/shell_layout.zig +126 -1
- package/src/runtime/snapshot_policy.zig +60 -0
- package/src/runtime/snapshot_reference.zig +64 -0
- package/src/runtime/state.zig +16 -0
- package/src/runtime/status_validation.zig +190 -0
- package/src/runtime/system_admission_policy.zig +140 -0
- package/src/runtime/system_services.zig +46 -36
- package/src/runtime/tests.zig +1 -0
- package/src/runtime/ts_canvas_hooks.zig +261 -0
- package/src/runtime/ts_canvas_hooks_tests.zig +279 -0
- package/src/runtime/ts_canvas_icons.zig +234 -0
- package/src/runtime/ts_core_host.zig +2325 -411
- package/src/runtime/ts_core_host_tests.zig +1982 -0
- package/src/runtime/ts_test_host.zig +699 -0
- package/src/runtime/ts_ui_app.zig +1087 -45
- package/src/runtime/ui_app.zig +1117 -629
- package/src/runtime/ui_app_provenance.zig +147 -5
- package/src/runtime/ui_app_provenance_reference.zig +370 -0
- package/src/runtime/ui_app_tests.zig +619 -9
- package/src/runtime/ui_app_window_tests.zig +89 -0
- package/src/runtime/view.zig +25 -0
- package/src/runtime/view_canvas.zig +30 -6
- package/src/runtime/view_coordination_policy.zig +147 -0
- package/src/runtime/view_widget_control.zig +51 -14
- package/src/runtime/view_widget_scroll.zig +16 -5
- package/src/runtime/view_widget_text.zig +153 -68
- package/src/runtime/view_widget_tree.zig +460 -56
- package/src/runtime/webview_view_bridge_tests.zig +2 -0
- package/src/runtime/widget_motion_policy.zig +238 -0
- package/src/runtime/window_command_bridge_tests.zig +63 -0
- package/src/runtime/window_lifecycle_policy.zig +127 -0
- package/src/runtime/window_storage.zig +74 -8
- package/src/runtime/window_view_runtime.zig +148 -33
- package/src/runtime/window_views.zig +163 -10
- package/src/tooling/codesign.zig +125 -74
- package/src/tooling/components/identity_tests.zig +62 -36
- package/src/tooling/components/stepper.native +24 -0
- package/src/tooling/components/stepper.zig +0 -19
- package/src/tooling/components/timeline-item.native +22 -0
- package/src/tooling/components/timeline.native +5 -3
- package/src/tooling/components/timeline_item.zig +0 -32
- package/src/tooling/eject_components.zig +76 -8
- package/src/tooling/ios.zig +66 -12
- package/src/tooling/manifest.zig +35 -0
- package/src/tooling/package.zig +85 -1
- package/src/tooling/raw_manifest.zig +6 -0
- package/src/tooling/templates.zig +15 -3
- package/src/tooling/ts_core.zig +13 -3
- package/src/tooling/verbs.zig +22 -0
- package/tools/corewire/build_profile.mjs +54 -0
- package/tools/corewire/contract_intake.ts +303 -0
- package/tools/corewire/contract_intake.zig +82 -0
- package/tools/corewire/core.test.ts +166 -0
- package/tools/corewire/core_abi.zig +51 -0
- package/tools/corewire/core_cases.ts +233 -0
- package/tools/corewire/core_contract.ts +407 -0
- package/tools/corewire/core_emission.ts +136 -0
- package/tools/corewire/core_emission.zig +69 -0
- package/tools/corewire/core_goldens.json +3110 -0
- package/tools/corewire/core_policy.ts +14 -0
- package/tools/corewire/core_policy.zig +48 -0
- package/tools/corewire/core_projection.ts +360 -0
- package/tools/corewire/core_vocabulary.ts +6 -0
- package/tools/corewire/emit.zig +19 -1590
- package/tools/corewire/emit_facade.ts +714 -0
- package/tools/corewire/emit_facade.zig +10 -3752
- package/tools/corewire/emit_mirror.ts +290 -0
- package/tools/corewire/emit_profile.ts +50 -0
- package/tools/corewire/emit_service.ts +331 -0
- package/tools/corewire/emit_service.zig +23 -842
- package/tools/corewire/entry.test.ts +95 -0
- package/tools/corewire/entry_coordination.ts +127 -0
- package/tools/corewire/entry_coordination.zig +190 -0
- package/tools/corewire/facade_templates.ts +85 -0
- package/tools/corewire/filesystem.test.ts +166 -0
- package/tools/corewire/filesystem_coordination.ts +213 -0
- package/tools/corewire/filesystem_coordination.zig +245 -0
- package/tools/corewire/intake.test.ts +35 -0
- package/tools/corewire/intake_cases.ts +55 -0
- package/tools/corewire/intake_goldens.json +12237 -0
- package/tools/corewire/invocation.test.ts +24 -0
- package/tools/corewire/invocation.ts +175 -0
- package/tools/corewire/invocation.zig +136 -0
- package/tools/corewire/invocation_cases.ts +60 -0
- package/tools/corewire/invocation_fixture.ts +33 -0
- package/tools/corewire/invocation_goldens.json +1143 -0
- package/tools/corewire/invocation_tests.zig +111 -0
- package/tools/corewire/invocation_usage.ts +2 -0
- package/tools/corewire/lossless_projection.ts +96 -0
- package/tools/corewire/main.zig +7 -680
- package/tools/corewire/main_reference.zig +415 -0
- package/tools/corewire/mirror_templates.ts +55 -0
- package/tools/corewire/profile.test.ts +248 -0
- package/tools/corewire/profile.zig +56 -0
- package/tools/corewire/profile_emission.ts +202 -0
- package/tools/corewire/profile_library.json +29 -0
- package/tools/corewire/profile_tests.zig +136 -0
- package/tools/corewire/service.test.ts +75 -0
- package/tools/corewire/service_cases.ts +61 -0
- package/tools/corewire/service_contract.zig +40 -146
- package/tools/corewire/service_goldens.json +650 -0
- package/tools/corewire/service_projection.zig +52 -0
- package/tools/corewire/service_templates.ts +14 -0
- package/tools/corewire/shim_rt.zig +9 -0
- package/tools/corewire/sidecar.zig +267 -1438
- package/tools/corewire/emit_profile.zig +0 -521
package/src/tooling/manifest.zig
CHANGED
|
@@ -697,6 +697,13 @@ pub fn parseTextForPath(allocator: std.mem.Allocator, path: []const u8, source:
|
|
|
697
697
|
}
|
|
698
698
|
|
|
699
699
|
fn metadataFromRaw(allocator: std.mem.Allocator, raw: RawManifest) !Metadata {
|
|
700
|
+
if (raw.assets.fonts.len > 8) return error.TooManyFontAssets;
|
|
701
|
+
for (raw.assets.fonts, 0..) |font, index| {
|
|
702
|
+
if (font.id < 64 or font.id > 9_007_199_254_740_991) return error.InvalidFontAssetId;
|
|
703
|
+
try validateRelativePath(font.path);
|
|
704
|
+
if (!std.mem.startsWith(u8, font.path, "assets/")) return error.InvalidFontAssetPath;
|
|
705
|
+
for (raw.assets.fonts[0..index]) |previous| if (previous.id == font.id) return error.DuplicateFontAssetId;
|
|
706
|
+
}
|
|
700
707
|
return .{
|
|
701
708
|
.id = try allocator.dupe(u8, raw.id),
|
|
702
709
|
.name = try allocator.dupe(u8, raw.name),
|
|
@@ -3891,3 +3898,31 @@ test "manifest validation resolves explicit DMG file items beside app.zon" {
|
|
|
3891
3898
|
try std.testing.expect(!missing.ok);
|
|
3892
3899
|
try std.testing.expect(std.mem.indexOf(u8, missing.message, "dmg item source could not be read") != null);
|
|
3893
3900
|
}
|
|
3901
|
+
|
|
3902
|
+
test "font manifests enforce permanent ids, bundled paths and the native slot bound" {
|
|
3903
|
+
const allocator = std.testing.allocator;
|
|
3904
|
+
const good = try parseJsonText(allocator,
|
|
3905
|
+
\\{"id":"dev.test.fonts","name":"fonts","version":"0.1.0","assets":{"fonts":[{"id":64,"path":"assets/mono.ttf"}]}}
|
|
3906
|
+
);
|
|
3907
|
+
good.deinit(allocator);
|
|
3908
|
+
const zon = try parseText(allocator, ".{ .id = \"dev.test.fonts\", .name = \"fonts\", .version = \"0.1.0\", .assets = .{ .fonts = .{ .{ .id = 64, .path = \"assets/mono.ttf\" } } } }");
|
|
3909
|
+
zon.deinit(allocator);
|
|
3910
|
+
const nine = try std.fmt.allocPrint(
|
|
3911
|
+
allocator,
|
|
3912
|
+
"{{\"id\":\"dev.test.fonts\",\"name\":\"fonts\",\"version\":\"0.1.0\",\"assets\":{{\"fonts\":[{s}]}}}}",
|
|
3913
|
+
.{"{\"id\":64,\"path\":\"assets/a.ttf\"}," ** 8 ++ "{\"id\":65,\"path\":\"assets/b.ttf\"}"},
|
|
3914
|
+
);
|
|
3915
|
+
defer allocator.free(nine);
|
|
3916
|
+
try std.testing.expectError(error.TooManyFontAssets, parseJsonText(allocator, nine));
|
|
3917
|
+
for ([_]struct { fonts: []const u8, err: anyerror }{
|
|
3918
|
+
.{ .fonts = "[{\"id\":9007199254740992,\"path\":\"assets/a.ttf\"}]", .err = error.InvalidFontAssetId },
|
|
3919
|
+
.{ .fonts = "[{\"id\":63,\"path\":\"assets/a.ttf\"}]", .err = error.InvalidFontAssetId },
|
|
3920
|
+
.{ .fonts = "[{\"id\":64,\"path\":\"a.ttf\"}]", .err = error.InvalidFontAssetPath },
|
|
3921
|
+
.{ .fonts = "[{\"id\":64,\"path\":\"assets/../a.ttf\"}]", .err = error.InvalidPath },
|
|
3922
|
+
.{ .fonts = "[{\"id\":64,\"path\":\"assets/a.ttf\"},{\"id\":64,\"path\":\"assets/b.ttf\"}]", .err = error.DuplicateFontAssetId },
|
|
3923
|
+
}) |case| {
|
|
3924
|
+
const source = try std.fmt.allocPrint(allocator, "{{\"id\":\"dev.test.fonts\",\"name\":\"fonts\",\"version\":\"0.1.0\",\"assets\":{{\"fonts\":{s}}}}}", .{case.fonts});
|
|
3925
|
+
defer allocator.free(source);
|
|
3926
|
+
try std.testing.expectError(case.err, parseJsonText(allocator, source));
|
|
3927
|
+
}
|
|
3928
|
+
}
|
package/src/tooling/package.zig
CHANGED
|
@@ -54,7 +54,6 @@ pub const SigningConfig = struct {
|
|
|
54
54
|
identity: ?[]const u8 = null,
|
|
55
55
|
entitlements: ?[]const u8 = null,
|
|
56
56
|
profile: ?[]const u8 = null,
|
|
57
|
-
team_id: ?[]const u8 = null,
|
|
58
57
|
};
|
|
59
58
|
|
|
60
59
|
pub const PackageOptions = struct {
|
|
@@ -83,6 +82,10 @@ pub const PackageOptions = struct {
|
|
|
83
82
|
cef_dir: []const u8 = web_engine_tool.default_cef_dir,
|
|
84
83
|
signing: SigningConfig = .{},
|
|
85
84
|
archive: bool = false,
|
|
85
|
+
/// Submit the final macOS distribution artifact to Apple's notary service,
|
|
86
|
+
/// then staple and validate its ticket. Requires identity signing and a
|
|
87
|
+
/// notarytool Keychain profile in `signing.profile`.
|
|
88
|
+
notarize: bool = false,
|
|
86
89
|
/// Emit the ZIP consumed by the native updater. macOS only; unlike the
|
|
87
90
|
/// user-facing DMG, this archive contains exactly the packaged .app.
|
|
88
91
|
update_archive: bool = false,
|
|
@@ -152,6 +155,7 @@ pub const PackageStats = struct {
|
|
|
152
155
|
/// the proof behind the report's "signed, verified" line. A package
|
|
153
156
|
/// whose signing or verification fails never produces stats at all.
|
|
154
157
|
signing_verified: bool = false,
|
|
158
|
+
notarized: bool = false,
|
|
155
159
|
asset_count: usize = 0,
|
|
156
160
|
web_engine: WebEngine = .system,
|
|
157
161
|
web_layer: ?manifest_tool.WebLayer = null,
|
|
@@ -221,6 +225,20 @@ pub fn createPackage(allocator: std.mem.Allocator, io: std.Io, options: PackageO
|
|
|
221
225
|
return err;
|
|
222
226
|
};
|
|
223
227
|
try validateWebEngineTarget(options.target, options.web_engine);
|
|
228
|
+
if (options.notarize) {
|
|
229
|
+
if (options.target != .macos) {
|
|
230
|
+
std.debug.print("error: notarization is supported only for macOS packages\n", .{});
|
|
231
|
+
return error.UnsupportedNotarizationTarget;
|
|
232
|
+
}
|
|
233
|
+
if (options.signing.mode != .identity) {
|
|
234
|
+
std.debug.print("error: --notarize requires --signing identity and a Developer ID Application certificate\n", .{});
|
|
235
|
+
return error.NotarizationRequiresIdentity;
|
|
236
|
+
}
|
|
237
|
+
if (options.signing.profile == null) {
|
|
238
|
+
std.debug.print("error: --notarize requires --notary-profile <name>; create it with `xcrun notarytool store-credentials <name>`\n", .{});
|
|
239
|
+
return error.MissingNotaryProfile;
|
|
240
|
+
}
|
|
241
|
+
}
|
|
224
242
|
if (options.metadata.updates.enabled() and options.target == .macos and options.web_engine == .chromium) {
|
|
225
243
|
std.debug.print("error: native updates currently require the system macOS host; package with --web-engine system or remove the updates block\n", .{});
|
|
226
244
|
return error.UnsupportedUpdateHost;
|
|
@@ -241,12 +259,24 @@ pub fn createPackage(allocator: std.mem.Allocator, io: std.Io, options: PackageO
|
|
|
241
259
|
.ios => try createIosArtifact(allocator, io, options),
|
|
242
260
|
.android => try createAndroidArtifact(allocator, io, options),
|
|
243
261
|
};
|
|
262
|
+
if (options.notarize) {
|
|
263
|
+
try runNotarization(allocator, io, options.output_path, options.signing.profile.?, true);
|
|
264
|
+
}
|
|
244
265
|
if (options.archive) {
|
|
245
266
|
const archive_path = try createArchive(allocator, io, options);
|
|
246
267
|
if (archive_path) |path| {
|
|
247
268
|
stats.archive_path = path;
|
|
269
|
+
if (options.target == .macos and options.signing.mode == .identity) {
|
|
270
|
+
try signDistributionArtifact(allocator, io, path, options.signing.identity.?);
|
|
271
|
+
}
|
|
272
|
+
if (options.notarize) {
|
|
273
|
+
try runNotarization(allocator, io, path, options.signing.profile.?, false);
|
|
274
|
+
}
|
|
248
275
|
}
|
|
249
276
|
}
|
|
277
|
+
if (options.notarize) {
|
|
278
|
+
stats.notarized = true;
|
|
279
|
+
}
|
|
250
280
|
if (options.update_archive) {
|
|
251
281
|
if (options.target != .macos) return error.UnsupportedUpdateTarget;
|
|
252
282
|
if (!options.metadata.updates.enabled()) return error.UpdatesNotConfigured;
|
|
@@ -286,6 +316,9 @@ pub fn printDiagnostic(stats: PackageStats) void {
|
|
|
286
316
|
if (stats.signing_verified) {
|
|
287
317
|
std.debug.print(" signing: {s} (signed, verified)\n", .{@tagName(stats.signing_mode)});
|
|
288
318
|
}
|
|
319
|
+
if (stats.notarized) {
|
|
320
|
+
std.debug.print(" notarization: accepted, stapled, validated\n", .{});
|
|
321
|
+
}
|
|
289
322
|
if (stats.windows_subsystem) |subsystem| {
|
|
290
323
|
switch (subsystem) {
|
|
291
324
|
.console => std.debug.print(" subsystem: console (a terminal window opens behind the app - rebuild with `native build`)\n", .{}),
|
|
@@ -1721,6 +1754,33 @@ fn runSigning(allocator: std.mem.Allocator, io: std.Io, dir: std.Io.Dir, options
|
|
|
1721
1754
|
return true;
|
|
1722
1755
|
}
|
|
1723
1756
|
|
|
1757
|
+
fn signDistributionArtifact(allocator: std.mem.Allocator, io: std.Io, path: []const u8, identity: []const u8) !void {
|
|
1758
|
+
const signed = try codesign.signIdentityArtifact(allocator, io, path, identity);
|
|
1759
|
+
defer allocator.free(signed.message);
|
|
1760
|
+
if (!signed.ok) {
|
|
1761
|
+
std.debug.print("error: code signing distribution artifact {s} with \"{s}\" failed:\n{s}\n", .{ path, identity, trimmedToolOutput(signed.message) });
|
|
1762
|
+
return error.SigningFailed;
|
|
1763
|
+
}
|
|
1764
|
+
const verified = try codesign.verifyArtifact(allocator, io, path);
|
|
1765
|
+
defer allocator.free(verified.message);
|
|
1766
|
+
if (!verified.ok) {
|
|
1767
|
+
std.debug.print("error: signed distribution artifact {s} failed strict codesign verification:\n{s}\n", .{ path, trimmedToolOutput(verified.message) });
|
|
1768
|
+
return error.SignatureVerificationFailed;
|
|
1769
|
+
}
|
|
1770
|
+
}
|
|
1771
|
+
|
|
1772
|
+
fn runNotarization(allocator: std.mem.Allocator, io: std.Io, path: []const u8, profile: []const u8, app_bundle: bool) !void {
|
|
1773
|
+
const result = if (app_bundle)
|
|
1774
|
+
try codesign.notarizeApp(allocator, io, .{ .artifact_path = path, .keychain_profile = profile })
|
|
1775
|
+
else
|
|
1776
|
+
try codesign.notarizeArtifact(allocator, io, .{ .artifact_path = path, .keychain_profile = profile }, null);
|
|
1777
|
+
defer allocator.free(result.message);
|
|
1778
|
+
if (!result.ok) {
|
|
1779
|
+
std.debug.print("error: notarization failed for {s}:\n{s}\n", .{ path, trimmedToolOutput(result.message) });
|
|
1780
|
+
return error.NotarizationFailed;
|
|
1781
|
+
}
|
|
1782
|
+
}
|
|
1783
|
+
|
|
1724
1784
|
/// codesign's output, trimmed of trailing newlines so the teaching
|
|
1725
1785
|
/// message's fix line lands directly under it (the output itself stays
|
|
1726
1786
|
/// verbatim).
|
|
@@ -3630,6 +3690,30 @@ test "identity signing without an identity is a loud failure, not a silent unsig
|
|
|
3630
3690
|
}));
|
|
3631
3691
|
}
|
|
3632
3692
|
|
|
3693
|
+
test "notarization refuses unsigned non-macos and uncredentialed packages before artifact creation" {
|
|
3694
|
+
const metadata: manifest_tool.Metadata = .{ .id = "dev.example.notarize", .name = "notarize-demo", .version = "1.0.0" };
|
|
3695
|
+
try std.testing.expectError(error.NotarizationRequiresIdentity, createPackage(std.testing.allocator, std.testing.io, .{
|
|
3696
|
+
.metadata = metadata,
|
|
3697
|
+
.target = .macos,
|
|
3698
|
+
.output_path = ".zig-cache/test-notarize-unsigned.app",
|
|
3699
|
+
.notarize = true,
|
|
3700
|
+
}));
|
|
3701
|
+
try std.testing.expectError(error.UnsupportedNotarizationTarget, createPackage(std.testing.allocator, std.testing.io, .{
|
|
3702
|
+
.metadata = metadata,
|
|
3703
|
+
.target = .linux,
|
|
3704
|
+
.output_path = ".zig-cache/test-notarize-linux",
|
|
3705
|
+
.signing = .{ .mode = .identity, .identity = "Developer ID Application: Test" },
|
|
3706
|
+
.notarize = true,
|
|
3707
|
+
}));
|
|
3708
|
+
try std.testing.expectError(error.MissingNotaryProfile, createPackage(std.testing.allocator, std.testing.io, .{
|
|
3709
|
+
.metadata = metadata,
|
|
3710
|
+
.target = .macos,
|
|
3711
|
+
.output_path = ".zig-cache/test-notarize-no-profile.app",
|
|
3712
|
+
.signing = .{ .mode = .identity, .identity = "Developer ID Application: Test" },
|
|
3713
|
+
.notarize = true,
|
|
3714
|
+
}));
|
|
3715
|
+
}
|
|
3716
|
+
|
|
3633
3717
|
test "native-only windows package ships no WebView2 loader and reports web layer none" {
|
|
3634
3718
|
var cwd = std.Io.Dir.cwd();
|
|
3635
3719
|
const root = ".zig-cache/test-package-native-only-windows";
|
|
@@ -119,6 +119,12 @@ pub const RawSecurity = struct {
|
|
|
119
119
|
/// reference.
|
|
120
120
|
pub const RawAssets = struct {
|
|
121
121
|
images: []const RawImageAsset = &.{},
|
|
122
|
+
fonts: []const RawFontAsset = &.{},
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
pub const RawFontAsset = struct {
|
|
126
|
+
id: u64,
|
|
127
|
+
path: []const u8,
|
|
122
128
|
};
|
|
123
129
|
|
|
124
130
|
pub const RawImageAsset = struct {
|
|
@@ -2399,6 +2399,8 @@ fn runnerZig() []const u8 {
|
|
|
2399
2399
|
\\ relational_store: ?native_sdk.RelationalStoreBinding = null,
|
|
2400
2400
|
\\ file_access: ?native_sdk.FileAccessBinding = null,
|
|
2401
2401
|
\\ file_access_enforce: bool = true,
|
|
2402
|
+
\\ /// Explicit compatibility capability for an app's former data identity.
|
|
2403
|
+
\\ legacy_data_directory: bool = false,
|
|
2402
2404
|
\\ relational_migrations: []const native_sdk.relational_store.Migration = &built_relational_migrations.migrations,
|
|
2403
2405
|
\\
|
|
2404
2406
|
\\ fn appInfo(self: RunOptions, buffers: *StateBuffers) native_sdk.AppInfo {
|
|
@@ -2893,7 +2895,8 @@ fn runnerZig() []const u8 {
|
|
|
2893
2895
|
\\ var record_store_open = false;
|
|
2894
2896
|
\\ var resolved_options = options;
|
|
2895
2897
|
\\ var file_root_buffers: [6][1024]u8 = undefined;
|
|
2896
|
-
\\ var file_roots: [
|
|
2898
|
+
\\ var file_roots: [7][]const u8 = undefined;
|
|
2899
|
+
\\ var legacy_data_buffer: [1024]u8 = undefined;
|
|
2897
2900
|
\\ const resolved_file_dirs = native_sdk.app_dirs.resolve(
|
|
2898
2901
|
\\ .{ .name = options.bundle_id },
|
|
2899
2902
|
\\ native_sdk.app_dirs.currentPlatform(),
|
|
@@ -2902,8 +2905,17 @@ fn runnerZig() []const u8 {
|
|
|
2902
2905
|
\\ ) catch null;
|
|
2903
2906
|
\\ var file_root_count: usize = 0;
|
|
2904
2907
|
\\ if (resolved_file_dirs) |dirs| {
|
|
2905
|
-
\\ file_roots = .{ dirs.config, dirs.cache, dirs.data, dirs.state, dirs.logs, dirs.temp };
|
|
2906
|
-
\\ file_root_count =
|
|
2908
|
+
\\ file_roots[0..6].* = .{ dirs.config, dirs.cache, dirs.data, dirs.state, dirs.logs, dirs.temp };
|
|
2909
|
+
\\ file_root_count = 6;
|
|
2910
|
+
\\ }
|
|
2911
|
+
\\ if (options.legacy_data_directory) {
|
|
2912
|
+
\\ if (native_sdk.app_dirs.resolveOne(
|
|
2913
|
+
\\ .{ .name = options.app_name }, native_sdk.app_dirs.currentPlatform(),
|
|
2914
|
+
\\ native_sdk.debug.envFromMap(init.environ_map), .data, &legacy_data_buffer,
|
|
2915
|
+
\\ )) |directory| {
|
|
2916
|
+
\\ file_roots[file_root_count] = directory;
|
|
2917
|
+
\\ file_root_count += 1;
|
|
2918
|
+
\\ } else |_| {}
|
|
2907
2919
|
\\ }
|
|
2908
2920
|
\\ resolved_options.file_access = .{
|
|
2909
2921
|
\\ .roots = file_roots[0..file_root_count],
|
package/src/tooling/ts_core.zig
CHANGED
|
@@ -801,7 +801,7 @@ pub fn runDevHost(allocator: std.mem.Allocator, io: std.Io, framework_root: []co
|
|
|
801
801
|
// to npm, the CLI materializes `node_modules/@native-sdk/core` inside the
|
|
802
802
|
// app itself — a plain COPY (never a symlink; cache paths get GC'd) of
|
|
803
803
|
// exactly the files the published artifact will contain (package.json plus
|
|
804
|
-
// the `files: ["sdk"]` allowlist: sdk/core.ts, sdk/text.ts, sdk/events.ts,
|
|
804
|
+
// the `files: ["sdk"]` allowlist: sdk/core.ts, sdk/bytes.ts, sdk/text.ts, sdk/events.ts,
|
|
805
805
|
// and the ambient bytes-text method surface core.ts references).
|
|
806
806
|
// The copy is
|
|
807
807
|
// EDITOR-AND-VERSIONING SURFACE ONLY: builds check and compile against the
|
|
@@ -815,10 +815,10 @@ pub fn runDevHost(allocator: std.mem.Allocator, io: std.Io, framework_root: []co
|
|
|
815
815
|
pub const editor_package_dir = "node_modules/@native-sdk/core";
|
|
816
816
|
|
|
817
817
|
/// The published artifact's files, relative to packages/core (and to the
|
|
818
|
-
/// materialized copy): package.json
|
|
818
|
+
/// materialized copy): package.json, core editor sources, and the test driver.
|
|
819
819
|
/// packages/core/test/package_manifest.test.ts pins the manifest to this
|
|
820
820
|
/// shape, so copy and tarball cannot drift apart.
|
|
821
|
-
const editor_package_files = [_][]const u8{ "package.json", "sdk/core.ts", "sdk/text.ts", "sdk/events.ts", "sdk/bytes_text_methods.d.ts" };
|
|
821
|
+
const editor_package_files = [_][]const u8{ "package.json", "sdk/core.ts", "sdk/bytes.ts", "sdk/text.ts", "sdk/events.ts", "sdk/theme.ts", "sdk/internal/image_identity.ts", "sdk/internal/markdown_policy.ts", "testing/index.ts", "sdk/bytes_text_methods.d.ts" };
|
|
822
822
|
const sqlite_editor_overlay_marker = ".native/cache/sqlite/editor-overlay";
|
|
823
823
|
|
|
824
824
|
/// Extract the top-level "version" of a package.json. A targeted scan, not
|
|
@@ -1071,20 +1071,30 @@ test "editor package: materialize, heal, and the npm-install handoff" {
|
|
|
1071
1071
|
try cwd.createDirPath(io, app ++ "/src");
|
|
1072
1072
|
try cwd.writeFile(io, .{ .sub_path = sdk ++ "/packages/core/package.json", .data = "{ \"name\": \"@native-sdk/core\", \"version\": \"0.0.9\" }" });
|
|
1073
1073
|
try cwd.writeFile(io, .{ .sub_path = sdk ++ "/packages/core/sdk/core.ts", .data = "// core module" });
|
|
1074
|
+
try cwd.writeFile(io, .{ .sub_path = sdk ++ "/packages/core/sdk/bytes.ts", .data = "// byte module" });
|
|
1074
1075
|
try cwd.writeFile(io, .{ .sub_path = sdk ++ "/packages/core/sdk/text.ts", .data = "// text module" });
|
|
1075
1076
|
try cwd.writeFile(io, .{ .sub_path = sdk ++ "/packages/core/sdk/events.ts", .data = "// events module" });
|
|
1077
|
+
try cwd.writeFile(io, .{ .sub_path = sdk ++ "/packages/core/sdk/theme.ts", .data = "// theme module" });
|
|
1078
|
+
try cwd.createDirPath(io, sdk ++ "/packages/core/sdk/internal");
|
|
1079
|
+
try cwd.writeFile(io, .{ .sub_path = sdk ++ "/packages/core/sdk/internal/image_identity.ts", .data = "// image identity module" });
|
|
1080
|
+
try cwd.writeFile(io, .{ .sub_path = sdk ++ "/packages/core/sdk/internal/markdown_policy.ts", .data = "// Markdown policy module" });
|
|
1076
1081
|
try cwd.writeFile(io, .{ .sub_path = sdk ++ "/packages/core/sdk/bytes_text_methods.d.ts", .data = "// ambient text methods" });
|
|
1077
1082
|
|
|
1078
1083
|
const bundled = try bundledSdkVersion(allocator, io, sdk);
|
|
1079
1084
|
defer allocator.free(bundled);
|
|
1080
1085
|
try std.testing.expectEqualStrings("0.0.9", bundled);
|
|
1081
1086
|
|
|
1087
|
+
try cwd.createDirPath(io, sdk ++ "/packages/core/testing");
|
|
1088
|
+
try cwd.writeFile(io, .{ .sub_path = sdk ++ "/packages/core/testing/index.ts", .data = "// native test driver" });
|
|
1089
|
+
|
|
1082
1090
|
// Missing copy: materialized, and the full artifact lands.
|
|
1083
1091
|
try std.testing.expectEqual(EnsureOutcome.materialized, try ensureEditorPackage(allocator, io, sdk, app));
|
|
1084
1092
|
try std.testing.expect(buildgraph.fileExists(io, app ++ "/node_modules/@native-sdk/core/package.json"));
|
|
1085
1093
|
try std.testing.expect(buildgraph.fileExists(io, app ++ "/node_modules/@native-sdk/core/sdk/core.ts"));
|
|
1094
|
+
try std.testing.expect(buildgraph.fileExists(io, app ++ "/node_modules/@native-sdk/core/sdk/bytes.ts"));
|
|
1086
1095
|
try std.testing.expect(buildgraph.fileExists(io, app ++ "/node_modules/@native-sdk/core/sdk/text.ts"));
|
|
1087
1096
|
try std.testing.expect(buildgraph.fileExists(io, app ++ "/node_modules/@native-sdk/core/sdk/events.ts"));
|
|
1097
|
+
try std.testing.expect(buildgraph.fileExists(io, app ++ "/node_modules/@native-sdk/core/testing/index.ts"));
|
|
1088
1098
|
try std.testing.expect(buildgraph.fileExists(io, app ++ "/node_modules/@native-sdk/core/sdk/bytes_text_methods.d.ts"));
|
|
1089
1099
|
|
|
1090
1100
|
// A generated relational surface overlays the editor-resolved core and
|
package/src/tooling/verbs.zig
CHANGED
|
@@ -145,6 +145,12 @@ pub fn run(allocator: std.mem.Allocator, io: std.Io, verb: Verb, options: Option
|
|
|
145
145
|
try argv.append(allocator, "-Doptimize=Debug");
|
|
146
146
|
dev_debug = true;
|
|
147
147
|
}
|
|
148
|
+
if (core_tree == .ts and !hasTypeScriptViewFlag(options.forwarded_args)) {
|
|
149
|
+
// The interactive dev loop keeps its model-preserving markup
|
|
150
|
+
// watcher. Build and test use the compiled view default;
|
|
151
|
+
// callers can explicitly select either backend for dev.
|
|
152
|
+
try argv.append(allocator, "-Dtypescript-view=false");
|
|
153
|
+
}
|
|
148
154
|
},
|
|
149
155
|
.build => {
|
|
150
156
|
try argv.appendSlice(allocator, &.{ "--summary", "all" });
|
|
@@ -236,6 +242,14 @@ fn hasOptimizeFlag(args: []const []const u8) bool {
|
|
|
236
242
|
return false;
|
|
237
243
|
}
|
|
238
244
|
|
|
245
|
+
fn hasTypeScriptViewFlag(args: []const []const u8) bool {
|
|
246
|
+
for (args) |arg| {
|
|
247
|
+
if (std.mem.eql(u8, arg, "-Dtypescript-view") or
|
|
248
|
+
std.mem.startsWith(u8, arg, "-Dtypescript-view=")) return true;
|
|
249
|
+
}
|
|
250
|
+
return false;
|
|
251
|
+
}
|
|
252
|
+
|
|
239
253
|
const rebuild_snapshot_path = ".native/cache/rebuild-inputs.tsv";
|
|
240
254
|
|
|
241
255
|
const RebuildInput = struct {
|
|
@@ -498,6 +512,14 @@ test "optimize flags are detected among forwarded args" {
|
|
|
498
512
|
try std.testing.expect(!hasOptimizeFlag(&.{}));
|
|
499
513
|
}
|
|
500
514
|
|
|
515
|
+
test "explicit view backend choices override the dev hot-reload default" {
|
|
516
|
+
try std.testing.expect(hasTypeScriptViewFlag(&.{"-Dtypescript-view=true"}));
|
|
517
|
+
try std.testing.expect(hasTypeScriptViewFlag(&.{ "-Doptimize=Debug", "-Dtypescript-view=false" }));
|
|
518
|
+
try std.testing.expect(hasTypeScriptViewFlag(&.{"-Dtypescript-view"}));
|
|
519
|
+
try std.testing.expect(!hasTypeScriptViewFlag(&.{"-Dtypescript-view-cache=true"}));
|
|
520
|
+
try std.testing.expect(!hasTypeScriptViewFlag(&.{}));
|
|
521
|
+
}
|
|
522
|
+
|
|
501
523
|
test "rebuild explanations persist manifest and source hashes" {
|
|
502
524
|
const allocator = std.testing.allocator;
|
|
503
525
|
const io = std.testing.io;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
// Compile the corewire projections for the build host with the SDK's exact pin.
|
|
2
|
+
// This library has no contract sidecar, so scriptc's native library command
|
|
3
|
+
// can build it directly, without the app-core sidecar compatibility path.
|
|
4
|
+
import { spawnSync } from "node:child_process";
|
|
5
|
+
import fs from "node:fs";
|
|
6
|
+
import os from "node:os";
|
|
7
|
+
import path from "node:path";
|
|
8
|
+
import { compilerArgv, publishedScriptcArgv } from "../../packages/core/scripts/compiler_command.mjs";
|
|
9
|
+
|
|
10
|
+
const args = {};
|
|
11
|
+
for (let i = 2; i < process.argv.length; i += 2) {
|
|
12
|
+
const key = process.argv[i];
|
|
13
|
+
const value = process.argv[i + 1];
|
|
14
|
+
if (!key?.startsWith("--") || value === undefined) throw new Error("expected --option value pairs");
|
|
15
|
+
args[key.slice(2)] = value;
|
|
16
|
+
}
|
|
17
|
+
for (const key of ["stage", "manifest", "out", "host-platform", "zig-exe"]) {
|
|
18
|
+
if (!args[key]) throw new Error(`missing --${key}`);
|
|
19
|
+
}
|
|
20
|
+
const manifest = path.resolve(args.manifest);
|
|
21
|
+
const sdk = JSON.parse(fs.readFileSync(manifest, "utf8"));
|
|
22
|
+
const pin = sdk.nativeToolchain?.scriptc ?? sdk.dependencies?.scriptc;
|
|
23
|
+
if (typeof pin !== "string" || !/^\d+\.\d+\.\d+$/.test(pin)) throw new Error("the SDK must pin an exact scriptc release");
|
|
24
|
+
const command = args.compiler ? compilerArgv(args.compiler) : publishedScriptcArgv(manifest);
|
|
25
|
+
const version = spawnSync(command[0], [...command.slice(1), "-v"], { encoding: "utf8" });
|
|
26
|
+
if (version.status !== 0 || version.stdout.trim() !== pin) {
|
|
27
|
+
throw new Error(`the corewire projections require scriptc ${pin}; reinstall the SDK dependencies or fix NATIVE_SDK_CORE_COMPILER`);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const work = fs.mkdtempSync(path.join(os.tmpdir(), "native-profile-"));
|
|
31
|
+
try {
|
|
32
|
+
fs.cpSync(path.resolve(args.stage), work, { recursive: true });
|
|
33
|
+
// This tool always executes on the host, even for an iOS/Android/Windows
|
|
34
|
+
// app target. Do not inherit a caller's cross-compilation environment.
|
|
35
|
+
const env = { ...process.env };
|
|
36
|
+
delete env.SCRIPTC_TARGET;
|
|
37
|
+
delete env.SCRIPTC_CC;
|
|
38
|
+
if (args["host-platform"].includes("-windows-gnu")) {
|
|
39
|
+
env.SCRIPTC_TARGET = args["host-platform"];
|
|
40
|
+
env.SCRIPTC_CC = "zigcc";
|
|
41
|
+
env.PATH = `${path.dirname(args["zig-exe"])}${path.delimiter}${env.PATH ?? ""}`;
|
|
42
|
+
}
|
|
43
|
+
const build = spawnSync(command[0], [...command.slice(1), "build", "--lib", "--profile", "profile_library.json", "-o", "profile"], {
|
|
44
|
+
cwd: work, env, stdio: "inherit",
|
|
45
|
+
});
|
|
46
|
+
if (build.status !== 0) process.exitCode = build.status ?? 1;
|
|
47
|
+
else {
|
|
48
|
+
const artifact = ["profile.lib.a", "profile"].find(file => fs.existsSync(path.join(work, file)));
|
|
49
|
+
if (!artifact) throw new Error("scriptc produced no corewire projection archive");
|
|
50
|
+
fs.copyFileSync(path.join(work, artifact), path.resolve(args.out));
|
|
51
|
+
}
|
|
52
|
+
} finally {
|
|
53
|
+
fs.rmSync(work, { recursive: true, force: true });
|
|
54
|
+
}
|