@native-sdk/cli 0.10.1 → 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/README.md +8 -6
- package/bin/native.js +2 -1
- package/build/app.zig +393 -97
- package/build/corewire.zig +53 -0
- package/build/test_shards.zig +49 -0
- package/build/ts_run.mjs +3 -3
- package/build.zig +2030 -83
- package/native-sdk.d.ts +5 -1
- package/package.json +20 -14
- package/packages/core/compile-surface/core.ts +164 -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 +68 -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 +332 -5
- package/packages/core/sdk/core.ts +371 -85
- package/packages/core/sdk/events.d.ts +252 -0
- package/packages/core/sdk/events.ts +240 -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 +186 -19
- package/packages/core/src/cli.ts +2 -11
- 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/context_menus.ts +76 -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/diagnostics.ts +7 -0
- package/packages/core/src/effect_plans.ts +71 -0
- package/packages/core/src/extent_program.ts +53 -0
- package/packages/core/src/flow_measurement.ts +121 -0
- package/packages/core/src/font_registry.ts +37 -0
- package/packages/core/src/frontend.ts +12 -10
- 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_canonical.ts +140 -0
- package/packages/core/src/markup_construction.ts +189 -0
- package/packages/core/src/markup_development.ts +160 -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/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 +98 -0
- package/packages/core/src/portable_sources.ts +17 -0
- package/packages/core/src/registered_font.ts +92 -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 +3954 -0
- package/packages/core/src/scalar_text.ts +82 -0
- 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 +55 -3
- 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 +14 -46
- package/packages/core/src/sqlite_codegen.ts +84 -0
- package/packages/core/src/staged_rebuild.ts +60 -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_bridge.ts +161 -0
- package/packages/core/src/view_check.ts +145 -0
- package/packages/core/src/view_components.ts +2415 -0
- package/packages/core/src/view_coordination.ts +198 -0
- package/packages/core/src/view_evaluator.ts +823 -0
- package/packages/core/src/view_frontend.ts +1102 -0
- 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_audits.ts +202 -0
- package/packages/core/src/widget_changes.ts +258 -0
- package/packages/core/src/widget_continuity.ts +37 -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_reconcile.ts +63 -0
- package/packages/core/src/widget_retention.ts +62 -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/native-ui/SKILL.md +77 -18
- package/skill-data/ts-core/SKILL.md +117 -11
- package/skill-data/ts-services/SKILL.md +1 -1
- package/skill-data/ts-services/references/service-surface.md +288 -144
- package/src/app_runner/root.zig +39 -12
- package/src/app_runner/ts_compiled_view.zig +1702 -0
- package/src/app_runner/ts_core_main.zig +185 -14
- package/src/app_runner/ts_core_mobile.zig +25 -13
- package/src/automation/server.zig +57 -6
- 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/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/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 +4 -0
- package/src/platform/macos/appkit_host.h +7 -2
- package/src/platform/macos/appkit_host.m +219 -39
- 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/pointer_motion_test.m +96 -0
- package/src/platform/macos/root.zig +25 -3
- 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/webview_inspection_test.m +106 -0
- package/src/platform/macos/widget_focus_test.m +66 -0
- package/src/platform/null_platform.zig +130 -2
- package/src/platform/null_platform_tests.zig +13 -0
- package/src/platform/root.zig +15 -0
- package/src/platform/types.zig +115 -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 +17 -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/decision_reuse.zig +133 -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/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/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 +131 -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/markdown_tests.zig +3 -3
- 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 +15 -11
- package/src/primitives/canvas/reference_tests.zig +58 -0
- 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 +107 -4
- 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 +53 -37
- package/src/primitives/canvas/text_metrics_tests.zig +52 -7
- package/src/primitives/canvas/text_query_policy.zig +295 -0
- package/src/primitives/canvas/text_run_policy.zig +252 -0
- package/src/primitives/canvas/text_scalar_policy.zig +234 -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 +47 -0
- package/src/primitives/canvas/ui.zig +251 -83
- package/src/primitives/canvas/ui_markup.zig +207 -46
- package/src/primitives/canvas/ui_markup_canonical.zig +237 -0
- package/src/primitives/canvas/ui_markup_compiled.zig +1724 -80
- package/src/primitives/canvas/ui_markup_compiled_tests.zig +225 -0
- 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_contract.zig +146 -14
- package/src/primitives/canvas/ui_markup_contract_tests.zig +77 -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_reflect.zig +56 -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_tests.zig +116 -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 +3026 -57
- 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 +350 -0
- package/src/primitives/canvas/virtual_extents.zig +113 -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 +129 -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 +21 -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 +26 -0
- package/src/runtime/accessibility_policy.zig +122 -0
- package/src/runtime/api.zig +29 -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/bridge_payload.zig +2 -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 +183 -4
- 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_display.zig +110 -9
- package/src/runtime/canvas_widget_events.zig +718 -328
- package/src/runtime/canvas_widget_runtime.zig +720 -150
- 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/context_menu_policy.zig +112 -0
- package/src/runtime/core.zig +170 -6
- package/src/runtime/desktop_files.zig +189 -0
- package/src/runtime/effects.zig +638 -33
- package/src/runtime/effects_host_tests.zig +25 -0
- package/src/runtime/effects_tests.zig +28 -0
- package/src/runtime/file_policy_test_reference.zig +113 -0
- package/src/runtime/flow.zig +419 -341
- package/src/runtime/flow_reference.zig +1427 -0
- package/src/runtime/font_registry_policy.zig +72 -0
- package/src/runtime/frame_profile.zig +24 -33
- package/src/runtime/global_shortcuts.zig +75 -0
- 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/keyboard_input.zig +86 -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 +16 -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_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 +231 -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/staged_rebuild_policy.zig +83 -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 +65 -36
- package/src/runtime/tests.zig +2 -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 +2451 -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 +1111 -45
- package/src/runtime/ui_app.zig +1381 -650
- 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 +667 -188
- package/src/runtime/ui_app_window_tests.zig +222 -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_reload.zig +226 -0
- package/src/runtime/view_widget_control.zig +51 -14
- package/src/runtime/view_widget_scroll.zig +46 -26
- package/src/runtime/view_widget_text.zig +153 -68
- package/src/runtime/view_widget_tree.zig +503 -69
- 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/webview_view_bridge_tests.zig +2 -0
- package/src/runtime/widget_continuity_policy.zig +73 -0
- package/src/runtime/widget_motion_policy.zig +238 -0
- package/src/runtime/widget_reconcile_policy.zig +81 -0
- package/src/runtime/widget_retention_policy.zig +75 -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 +179 -11
- package/src/security/root.zig +1 -0
- 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/raw_manifest.zig +6 -0
- package/src/tooling/templates.zig +23 -3
- package/src/tooling/ts_core.zig +97 -4
- package/src/tooling/verbs.zig +87 -1
- 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 +188 -0
- package/tools/corewire/core_abi.zig +55 -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 +361 -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 +300 -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 +39 -0
- package/tools/corewire/intake_cases.ts +55 -0
- package/tools/corewire/intake_goldens.json +12237 -0
- package/tools/corewire/invocation.test.ts +28 -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 +59 -0
- package/tools/corewire/profile.test.ts +248 -0
- package/tools/corewire/profile.zig +56 -0
- package/tools/corewire/profile_emission.ts +204 -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 +269 -1438
- package/tools/corewire/emit_profile.zig +0 -521
|
@@ -16,14 +16,7 @@
|
|
|
16
16
|
//! The library form stays available — call sites you have not migrated
|
|
17
17
|
//! keep rendering the stock item, and deleting this file costs nothing
|
|
18
18
|
//! (`native eject component timeline-item` writes it again).
|
|
19
|
-
//!
|
|
20
|
-
//! The composition, in one glance: a leading status indicator (badge or
|
|
21
|
-
//! dot, plus a hairline connector toward the next item), a
|
|
22
|
-
//! title/description/meta content column, and — when pressable — a
|
|
23
|
-
//! trailing chevron with `on_press` bound to the item's root, so presses
|
|
24
|
-
//! on the plain text fall through to the item.
|
|
25
19
|
|
|
26
|
-
const std = @import("std");
|
|
27
20
|
const native_sdk = @import("native_sdk");
|
|
28
21
|
const canvas = native_sdk.canvas;
|
|
29
22
|
|
|
@@ -34,31 +27,13 @@ pub fn TimelineItem(comptime Msg: type) type {
|
|
|
34
27
|
pub const Options = struct {
|
|
35
28
|
key: ?canvas.UiKey = null,
|
|
36
29
|
global_key: ?canvas.UiKey = null,
|
|
37
|
-
/// Indicator badge text ("3"); empty (with no `icon`)
|
|
38
|
-
/// renders a small dot. Prefer `icon` for symbols — text
|
|
39
|
-
/// glyphs outside the bundled font render as tofu boxes on
|
|
40
|
-
/// the reference/screenshot paths.
|
|
41
30
|
indicator: []const u8 = "",
|
|
42
|
-
/// Vector icon indicator (registry name, e.g. "check"):
|
|
43
|
-
/// drawn inside the badge with the variant's tint. Wins the
|
|
44
|
-
/// badge's content slot alongside `indicator` text.
|
|
45
31
|
icon: []const u8 = "",
|
|
46
|
-
/// Indicator color variant — map item outcomes here (primary
|
|
47
|
-
/// for done, destructive for errors, outline for stopped, ...).
|
|
48
32
|
variant: canvas.WidgetVariant = .outline,
|
|
49
33
|
title: []const u8,
|
|
50
|
-
/// Wrapped muted preview under the title.
|
|
51
34
|
description: []const u8 = "",
|
|
52
|
-
/// Muted trailing meta line ("claude · sonnet · 1m 12s").
|
|
53
35
|
meta: []const u8 = "",
|
|
54
|
-
/// Hairline connector from the indicator toward the next
|
|
55
|
-
/// item; clear it on the last item.
|
|
56
36
|
connector: bool = true,
|
|
57
|
-
/// Whole-item press: adds a trailing chevron and binds the
|
|
58
|
-
/// press to the item's root, focusable with role `listitem`.
|
|
59
|
-
/// A click anywhere on the item dispatches — presses on the
|
|
60
|
-
/// title/description/meta text fall through to the root
|
|
61
|
-
/// (dragging still selects the text).
|
|
62
37
|
on_press: ?Msg = null,
|
|
63
38
|
selected: bool = false,
|
|
64
39
|
};
|
|
@@ -95,7 +70,6 @@ pub fn TimelineItem(comptime Msg: type) type {
|
|
|
95
70
|
content_len += 1;
|
|
96
71
|
}
|
|
97
72
|
const content = ui.el(.column, .{ .grow = 1, .gap = 2 }, .{content_nodes[0..content_len]});
|
|
98
|
-
|
|
99
73
|
const item_semantics = canvas.WidgetSemantics{
|
|
100
74
|
.role = .listitem,
|
|
101
75
|
.label = options.title,
|
|
@@ -113,12 +87,6 @@ pub fn TimelineItem(comptime Msg: type) type {
|
|
|
113
87
|
row_len += 1;
|
|
114
88
|
}
|
|
115
89
|
const row_node = ui.el(.row, .{ .gap = 10, .padding = 8 }, .{row_children[0..row_len]});
|
|
116
|
-
|
|
117
|
-
// The press binds to the item's root: a bound handler makes
|
|
118
|
-
// the stack a hit target, and presses on the plain
|
|
119
|
-
// title/description/meta text fall through to it (dragging
|
|
120
|
-
// still selects the text). No overlay, no duplicated
|
|
121
|
-
// handlers.
|
|
122
90
|
return ui.el(.stack, .{
|
|
123
91
|
.key = options.key,
|
|
124
92
|
.global_key = options.global_key,
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
//! The ownership model, stated once: the default is to USE the library
|
|
5
5
|
//! composites and theme them through design tokens; ejecting writes the
|
|
6
6
|
//! composite's canonical source into the app (`src/components/`) for the
|
|
7
|
-
//! moment you need to own its shape. Only
|
|
7
|
+
//! moment you need to own its shape. Only library compositions are on the
|
|
8
8
|
//! menu — views the library itself builds from public primitives (rows,
|
|
9
9
|
//! columns, badges, separators, text). Engine control classes (buttons,
|
|
10
10
|
//! text fields, tabs, ...) are never ejectable: their behavior lives in
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
//! fork.
|
|
13
13
|
//!
|
|
14
14
|
//! Each canonical source lives as a real file next to this one
|
|
15
|
-
//! (`components/`), embedded verbatim at compile time, and held
|
|
15
|
+
//! (`components/`), embedded verbatim at compile time, and held in parity
|
|
16
16
|
//! by identity tests (`src/tooling/components/identity_tests.zig`) that
|
|
17
17
|
//! build the ejected form and the library form against the same inputs
|
|
18
18
|
//! and require identical widget trees. Whether a component ejects as a
|
|
@@ -25,6 +25,9 @@
|
|
|
25
25
|
const std = @import("std");
|
|
26
26
|
const buildgraph = @import("buildgraph.zig");
|
|
27
27
|
|
|
28
|
+
pub const ComponentForm = enum { markup, zig };
|
|
29
|
+
pub const ComponentCore = enum { ts, zig };
|
|
30
|
+
|
|
28
31
|
pub const Component = struct {
|
|
29
32
|
/// The name `native eject component <name>` accepts (the registry
|
|
30
33
|
/// element / builder-sugar name, so users name the thing they see).
|
|
@@ -36,30 +39,75 @@ pub const Component = struct {
|
|
|
36
39
|
/// The canonical source, embedded verbatim — the identity tests keep
|
|
37
40
|
/// it building the exact tree the library builds.
|
|
38
41
|
source: []const u8,
|
|
42
|
+
/// The source form written into an app. This is explicit so the CLI can
|
|
43
|
+
/// refuse a future Zig-form component in a TypeScript tree rather than
|
|
44
|
+
/// violating the app-authoring rule.
|
|
45
|
+
form_kind: ComponentForm = .markup,
|
|
39
46
|
/// One-line form summary for listings and the success message.
|
|
40
47
|
form: []const u8,
|
|
48
|
+
/// Legacy Zig source retained for Zig-core apps. TypeScript apps use the
|
|
49
|
+
/// markup source above; Zig apps keep the builder-shaped component API
|
|
50
|
+
/// that existed before markup templates became the default.
|
|
51
|
+
zig_path: ?[]const u8 = null,
|
|
52
|
+
zig_source: ?[]const u8 = null,
|
|
53
|
+
zig_form: []const u8 = "Zig view function",
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
pub const Ejection = struct {
|
|
57
|
+
name: []const u8,
|
|
58
|
+
path: []const u8,
|
|
59
|
+
source: []const u8,
|
|
60
|
+
form: []const u8,
|
|
61
|
+
form_kind: ComponentForm,
|
|
41
62
|
};
|
|
42
63
|
|
|
64
|
+
pub fn forCore(component: *const Component, core: ComponentCore) ?Ejection {
|
|
65
|
+
return switch (core) {
|
|
66
|
+
.ts => .{
|
|
67
|
+
.name = component.name,
|
|
68
|
+
.path = component.path,
|
|
69
|
+
.source = component.source,
|
|
70
|
+
.form = component.form,
|
|
71
|
+
.form_kind = component.form_kind,
|
|
72
|
+
},
|
|
73
|
+
.zig => if (component.zig_path != null and component.zig_source != null) .{
|
|
74
|
+
.name = component.name,
|
|
75
|
+
.path = component.zig_path.?,
|
|
76
|
+
.source = component.zig_source.?,
|
|
77
|
+
.form = component.zig_form,
|
|
78
|
+
.form_kind = .zig,
|
|
79
|
+
} else null,
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
|
|
43
83
|
/// The ejectable set. Growing it is three steps: add the canonical
|
|
44
84
|
/// source under `components/`, add its identity test, add a row here.
|
|
45
85
|
pub const components = [_]Component{
|
|
46
86
|
.{
|
|
47
87
|
.name = "stepper",
|
|
48
|
-
.path = "src/components/stepper.
|
|
49
|
-
.source = @embedFile("components/stepper.
|
|
50
|
-
.form = "
|
|
88
|
+
.path = "src/components/stepper.native",
|
|
89
|
+
.source = @embedFile("components/stepper.native"),
|
|
90
|
+
.form = "markup template",
|
|
91
|
+
.form_kind = .markup,
|
|
92
|
+
.zig_path = "src/components/stepper.zig",
|
|
93
|
+
.zig_source = @embedFile("components/stepper.zig"),
|
|
51
94
|
},
|
|
52
95
|
.{
|
|
53
96
|
.name = "timeline",
|
|
54
97
|
.path = "src/components/timeline.native",
|
|
55
98
|
.source = @embedFile("components/timeline.native"),
|
|
56
99
|
.form = "markup template",
|
|
100
|
+
.zig_path = null,
|
|
101
|
+
.zig_source = null,
|
|
57
102
|
},
|
|
58
103
|
.{
|
|
59
104
|
.name = "timeline-item",
|
|
60
|
-
.path = "src/components/
|
|
61
|
-
.source = @embedFile("components/
|
|
62
|
-
.form = "
|
|
105
|
+
.path = "src/components/timeline-item.native",
|
|
106
|
+
.source = @embedFile("components/timeline-item.native"),
|
|
107
|
+
.form = "markup template",
|
|
108
|
+
.form_kind = .markup,
|
|
109
|
+
.zig_path = "src/components/timeline_item.zig",
|
|
110
|
+
.zig_source = @embedFile("components/timeline_item.zig"),
|
|
63
111
|
},
|
|
64
112
|
};
|
|
65
113
|
|
|
@@ -119,6 +167,10 @@ fn editDistance(a: []const u8, b: []const u8) ?usize {
|
|
|
119
167
|
/// destination already exists — eject transfers ownership exactly once
|
|
120
168
|
/// and never overwrites a component the user may have edited.
|
|
121
169
|
pub fn eject(io: std.Io, app_dir: []const u8, component: *const Component) error{ AlreadyEjected, WriteFailed }!void {
|
|
170
|
+
return ejectSelection(io, app_dir, forCore(component, .ts).?);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
pub fn ejectSelection(io: std.Io, app_dir: []const u8, component: Ejection) error{ AlreadyEjected, WriteFailed }!void {
|
|
122
174
|
var dir = std.Io.Dir.cwd().openDir(io, app_dir, .{}) catch return error.WriteFailed;
|
|
123
175
|
defer dir.close(io);
|
|
124
176
|
if (buildgraph.fileExistsIn(io, dir, component.path)) return error.AlreadyEjected;
|
|
@@ -168,3 +220,19 @@ test "unknown names suggest their nearest ejectable component" {
|
|
|
168
220
|
test "the component list names every ejectable component" {
|
|
169
221
|
try std.testing.expectEqualStrings("stepper, timeline, timeline-item", component_list);
|
|
170
222
|
}
|
|
223
|
+
|
|
224
|
+
test "current ejectable components all use the markup form" {
|
|
225
|
+
for (components) |component| {
|
|
226
|
+
try std.testing.expectEqual(ComponentForm.markup, component.form_kind);
|
|
227
|
+
try std.testing.expect(std.mem.endsWith(u8, component.path, ".native"));
|
|
228
|
+
try std.testing.expectEqualStrings("markup template", component.form);
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
test "Zig-core selection preserves the legacy builder sources" {
|
|
233
|
+
try std.testing.expectEqualStrings("src/components/stepper.zig", forCore(&components[0], .zig).?.path);
|
|
234
|
+
try std.testing.expectEqual(ComponentForm.zig, forCore(&components[0], .zig).?.form_kind);
|
|
235
|
+
try std.testing.expect(forCore(&components[1], .zig) == null);
|
|
236
|
+
try std.testing.expectEqualStrings("src/components/timeline_item.zig", forCore(&components[2], .zig).?.path);
|
|
237
|
+
try std.testing.expect(std.mem.indexOf(u8, forCore(&components[2], .zig).?.source, "on_press") != null);
|
|
238
|
+
}
|
package/src/tooling/ios.zig
CHANGED
|
@@ -36,6 +36,7 @@ pub const host_image_fit_header = @import("ios_host").apple_image_fit_h;
|
|
|
36
36
|
pub const host_source_name = "uikit_host.m";
|
|
37
37
|
pub const host_header_name = "native_sdk_app.h";
|
|
38
38
|
pub const host_image_fit_header_name = "apple_image_fit.h";
|
|
39
|
+
const ubsan_runtime_name = "libclang_rt.ubsan_iossim_dynamic.dylib";
|
|
39
40
|
|
|
40
41
|
pub const deployment_target = "15.0";
|
|
41
42
|
|
|
@@ -307,18 +308,40 @@ pub fn runDev(allocator: std.mem.Allocator, io: std.Io, options: DevOptions) !vo
|
|
|
307
308
|
// target (ELF from the Android tier) must fail here with the real
|
|
308
309
|
// cause, not as a confusing linker error.
|
|
309
310
|
embedlib.requireArchiveClass(allocator, io, lib_path, .macho, LibSlice.simulator.zigTriple()) catch return error.HostCompileFailed;
|
|
310
|
-
try
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
"
|
|
316
|
-
"
|
|
317
|
-
"-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
311
|
+
const ubsan_runtime = if (try archiveNeedsUbsan(allocator, io, lib_path)) try simulatorUbsanRuntimePathAlloc(allocator, io) else null;
|
|
312
|
+
defer if (ubsan_runtime) |path| allocator.free(path);
|
|
313
|
+
var clang_args: std.ArrayList([]const u8) = .empty;
|
|
314
|
+
defer clang_args.deinit(allocator);
|
|
315
|
+
try clang_args.appendSlice(allocator, &.{
|
|
316
|
+
"xcrun", "--sdk", LibSlice.simulator.clangSdk(),
|
|
317
|
+
"clang", "-target", LibSlice.simulator.clangTriple(),
|
|
318
|
+
"-fobjc-arc", "-O2", ".native/ios/host/" ++ host_source_name,
|
|
319
|
+
lib_path,
|
|
320
|
+
});
|
|
321
|
+
if (ubsan_runtime) |path| {
|
|
322
|
+
// ScriptC's Debug runtime references Clang UBSan handlers. Link
|
|
323
|
+
// the runtime directly so the UIKit host itself stays uninstrumented.
|
|
324
|
+
try clang_args.appendSlice(allocator, &.{ path, "-Wl,-rpath,@executable_path" });
|
|
325
|
+
}
|
|
326
|
+
try clang_args.appendSlice(allocator, &.{
|
|
327
|
+
"-framework", "UIKit",
|
|
328
|
+
"-framework", "Metal",
|
|
329
|
+
"-framework", "QuartzCore",
|
|
330
|
+
"-framework", "Foundation",
|
|
331
|
+
"-framework", "CoreGraphics",
|
|
332
|
+
"-framework", "AVFoundation",
|
|
333
|
+
"-framework", "ImageIO",
|
|
334
|
+
"-framework", "Security",
|
|
335
|
+
"-o", executable_path,
|
|
336
|
+
});
|
|
337
|
+
try runInherit(io, clang_args.items, error.HostCompileFailed);
|
|
338
|
+
if (ubsan_runtime) |path| {
|
|
339
|
+
const bundled_runtime = try std.fs.path.join(allocator, &.{ bundle_path, ubsan_runtime_name });
|
|
340
|
+
defer allocator.free(bundled_runtime);
|
|
341
|
+
const arch = if (builtin.cpu.arch == .x86_64) "x86_64" else "arm64";
|
|
342
|
+
try runInherit(io, &.{ "xcrun", "lipo", "-thin", arch, path, "-output", bundled_runtime }, error.HostCompileFailed);
|
|
343
|
+
try runInherit(io, &.{ "codesign", "--force", "--sign", "-", bundled_runtime }, error.HostCompileFailed);
|
|
344
|
+
}
|
|
322
345
|
try runInherit(io, &.{ "codesign", "--force", "--sign", "-", bundle_path }, error.HostCompileFailed);
|
|
323
346
|
|
|
324
347
|
const device = options.device orelse try pickSimulatorDevice(allocator, io);
|
|
@@ -412,6 +435,37 @@ pub fn hasOptimizeFlag(args: []const []const u8) bool {
|
|
|
412
435
|
return false;
|
|
413
436
|
}
|
|
414
437
|
|
|
438
|
+
fn archiveNeedsUbsan(allocator: std.mem.Allocator, io: std.Io, lib_path: []const u8) !bool {
|
|
439
|
+
const result = std.process.run(allocator, io, .{
|
|
440
|
+
.argv = &.{ "xcrun", "nm", "-u", "-j", lib_path },
|
|
441
|
+
.stdout_limit = .limited(16 * 1024 * 1024),
|
|
442
|
+
.stderr_limit = .limited(64 * 1024),
|
|
443
|
+
}) catch return error.HostCompileFailed;
|
|
444
|
+
defer allocator.free(result.stdout);
|
|
445
|
+
defer allocator.free(result.stderr);
|
|
446
|
+
if (result.term != .exited or result.term.exited != 0) {
|
|
447
|
+
std.debug.print("native dev (ios): could not inspect the embed archive for sanitizer references: {s}\n", .{result.stderr});
|
|
448
|
+
return error.HostCompileFailed;
|
|
449
|
+
}
|
|
450
|
+
return std.mem.indexOf(u8, result.stdout, "___ubsan_handle_") != null;
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
fn simulatorUbsanRuntimePathAlloc(allocator: std.mem.Allocator, io: std.Io) ![]const u8 {
|
|
454
|
+
const result = std.process.run(allocator, io, .{
|
|
455
|
+
.argv = &.{ "xcrun", "--sdk", "iphonesimulator", "clang", "-print-file-name=" ++ ubsan_runtime_name },
|
|
456
|
+
.stdout_limit = .limited(4096),
|
|
457
|
+
.stderr_limit = .limited(64 * 1024),
|
|
458
|
+
}) catch return error.HostCompileFailed;
|
|
459
|
+
defer allocator.free(result.stdout);
|
|
460
|
+
defer allocator.free(result.stderr);
|
|
461
|
+
const path = std.mem.trim(u8, result.stdout, " \t\r\n");
|
|
462
|
+
if (result.term != .exited or result.term.exited != 0 or !buildgraph.fileExists(io, path)) {
|
|
463
|
+
std.debug.print("native dev (ios): Xcode's simulator UBSan runtime ({s}) is unavailable\n", .{ubsan_runtime_name});
|
|
464
|
+
return error.HostCompileFailed;
|
|
465
|
+
}
|
|
466
|
+
return allocator.dupe(u8, path);
|
|
467
|
+
}
|
|
468
|
+
|
|
415
469
|
/// Spawn with inherited stdio and turn a non-zero exit into `fail_error`
|
|
416
470
|
/// after naming the failed step (never fail in silence).
|
|
417
471
|
fn runInherit(io: std.Io, argv: []const []const u8, fail_error: anyerror) !void {
|
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
|
+
}
|
|
@@ -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 {
|
|
@@ -1410,6 +1410,7 @@ fn buildZig(allocator: std.mem.Allocator, names: TemplateNames, framework_path:
|
|
|
1410
1410
|
\\ const trace_option = b.option(TraceOption, "trace", "Trace output: off, events, runtime, all") orelse .events;
|
|
1411
1411
|
\\ const debug_overlay = b.option(bool, "debug-overlay", "Enable debug overlay output") orelse false;
|
|
1412
1412
|
\\ const automation_enabled = b.option(bool, "automation", "Enable Native SDK automation artifacts") orelse false;
|
|
1413
|
+
\\ const webview_inspection = b.option(bool, "webview-inspect", "Enable macOS system WebView inspection (default: Debug builds only)");
|
|
1413
1414
|
\\ const js_bridge_enabled = b.option(bool, "js-bridge", "Enable optional JavaScript bridge stubs") orelse false;
|
|
1414
1415
|
\\ const web_engine_override = b.option(WebEngineOption, "web-engine", "Override app.zon web engine: system, chromium");
|
|
1415
1416
|
\\ const web_layer_override = b.option(WebLayerOption, "web-layer", "Override app.zon webview_layer: auto, include, exclude");
|
|
@@ -1460,6 +1461,9 @@ fn buildZig(allocator: std.mem.Allocator, names: TemplateNames, framework_path:
|
|
|
1460
1461
|
\\ options.addOption([]const u8, "web_engine", @tagName(web_engine));
|
|
1461
1462
|
\\ options.addOption(bool, "debug_overlay", debug_overlay);
|
|
1462
1463
|
\\ options.addOption(bool, "automation", automation_enabled);
|
|
1464
|
+
\\ // Resolve the default inside each runner so the separate packaged
|
|
1465
|
+
\\ // release binary never inherits the development binary's setting.
|
|
1466
|
+
\\ options.addOption(?bool, "webview_inspection", webview_inspection);
|
|
1463
1467
|
\\ options.addOption(bool, "js_bridge", js_bridge_enabled);
|
|
1464
1468
|
\\ options.addOption(bool, "web_layer", web_layer);
|
|
1465
1469
|
\\ const options_mod = options.createModule();
|
|
@@ -2399,6 +2403,8 @@ fn runnerZig() []const u8 {
|
|
|
2399
2403
|
\\ relational_store: ?native_sdk.RelationalStoreBinding = null,
|
|
2400
2404
|
\\ file_access: ?native_sdk.FileAccessBinding = null,
|
|
2401
2405
|
\\ file_access_enforce: bool = true,
|
|
2406
|
+
\\ /// Explicit compatibility capability for an app's former data identity.
|
|
2407
|
+
\\ legacy_data_directory: bool = false,
|
|
2402
2408
|
\\ relational_migrations: []const native_sdk.relational_store.Migration = &built_relational_migrations.migrations,
|
|
2403
2409
|
\\
|
|
2404
2410
|
\\ fn appInfo(self: RunOptions, buffers: *StateBuffers) native_sdk.AppInfo {
|
|
@@ -2408,6 +2414,10 @@ fn runnerZig() []const u8 {
|
|
|
2408
2414
|
\\ .version = manifestStringField("version"),
|
|
2409
2415
|
\\ .description = manifestStringField("description"),
|
|
2410
2416
|
\\ .has_web_content = manifestHasWebContent(),
|
|
2417
|
+
\\ .webview_inspection = if (@hasDecl(build_options, "webview_inspection"))
|
|
2418
|
+
\\ build_options.webview_inspection orelse (@import("builtin").mode == .Debug)
|
|
2419
|
+
\\ else
|
|
2420
|
+
\\ @import("builtin").mode == .Debug,
|
|
2411
2421
|
\\ .declares_tray = manifestDeclaresTrayCapability(),
|
|
2412
2422
|
\\ .dock_visible = manifestDockVisible(),
|
|
2413
2423
|
\\ .window_title = self.window_title,
|
|
@@ -2893,7 +2903,8 @@ fn runnerZig() []const u8 {
|
|
|
2893
2903
|
\\ var record_store_open = false;
|
|
2894
2904
|
\\ var resolved_options = options;
|
|
2895
2905
|
\\ var file_root_buffers: [6][1024]u8 = undefined;
|
|
2896
|
-
\\ var file_roots: [
|
|
2906
|
+
\\ var file_roots: [7][]const u8 = undefined;
|
|
2907
|
+
\\ var legacy_data_buffer: [1024]u8 = undefined;
|
|
2897
2908
|
\\ const resolved_file_dirs = native_sdk.app_dirs.resolve(
|
|
2898
2909
|
\\ .{ .name = options.bundle_id },
|
|
2899
2910
|
\\ native_sdk.app_dirs.currentPlatform(),
|
|
@@ -2902,8 +2913,17 @@ fn runnerZig() []const u8 {
|
|
|
2902
2913
|
\\ ) catch null;
|
|
2903
2914
|
\\ var file_root_count: usize = 0;
|
|
2904
2915
|
\\ if (resolved_file_dirs) |dirs| {
|
|
2905
|
-
\\ file_roots = .{ dirs.config, dirs.cache, dirs.data, dirs.state, dirs.logs, dirs.temp };
|
|
2906
|
-
\\ file_root_count =
|
|
2916
|
+
\\ file_roots[0..6].* = .{ dirs.config, dirs.cache, dirs.data, dirs.state, dirs.logs, dirs.temp };
|
|
2917
|
+
\\ file_root_count = 6;
|
|
2918
|
+
\\ }
|
|
2919
|
+
\\ if (options.legacy_data_directory) {
|
|
2920
|
+
\\ if (native_sdk.app_dirs.resolveOne(
|
|
2921
|
+
\\ .{ .name = options.app_name }, native_sdk.app_dirs.currentPlatform(),
|
|
2922
|
+
\\ native_sdk.debug.envFromMap(init.environ_map), .data, &legacy_data_buffer,
|
|
2923
|
+
\\ )) |directory| {
|
|
2924
|
+
\\ file_roots[file_root_count] = directory;
|
|
2925
|
+
\\ file_root_count += 1;
|
|
2926
|
+
\\ } else |_| {}
|
|
2907
2927
|
\\ }
|
|
2908
2928
|
\\ resolved_options.file_access = .{
|
|
2909
2929
|
\\ .roots = file_roots[0..file_root_count],
|
package/src/tooling/ts_core.zig
CHANGED
|
@@ -519,10 +519,15 @@ pub const ServicePackage = struct {
|
|
|
519
519
|
content_hash: []const u8,
|
|
520
520
|
};
|
|
521
521
|
|
|
522
|
+
/// Where `native check` keeps the core contract it checks markup against.
|
|
523
|
+
pub const check_contract_path = ".native/cache/check/core.contract.json";
|
|
524
|
+
|
|
522
525
|
/// Run the TypeScript frontend in check-only mode on src/core.ts — and,
|
|
523
526
|
/// through it, the core's whole import graph under src/ — and surface its NS
|
|
524
527
|
/// diagnostics verbatim. Manifest-owned routes ride into the same typed Msg
|
|
525
|
-
/// contract the watched dev host invokes on each of its own restarts.
|
|
528
|
+
/// contract the watched dev host invokes on each of its own restarts. The
|
|
529
|
+
/// core contract lands at `check_contract_path`, the same document the
|
|
530
|
+
/// build compiles the views against.
|
|
526
531
|
pub fn checkCore(
|
|
527
532
|
allocator: std.mem.Allocator,
|
|
528
533
|
io: std.Io,
|
|
@@ -547,6 +552,8 @@ pub fn checkCore(
|
|
|
547
552
|
var persist_version_arg: ?[]u8 = null;
|
|
548
553
|
defer if (persist_version_arg) |value| allocator.free(value);
|
|
549
554
|
try argv.appendSlice(allocator, &.{ "node", runner_path, cli_path, "src/core.ts" });
|
|
555
|
+
try std.Io.Dir.cwd().createDirPath(io, std.fs.path.dirname(check_contract_path).?);
|
|
556
|
+
try argv.appendSlice(allocator, &.{ "--contract", check_contract_path, "--contract-entry", "src/core.ts" });
|
|
550
557
|
for (capabilities) |capability| try argv.appendSlice(allocator, &.{ "--capability", capability });
|
|
551
558
|
for (permissions) |permission| try argv.appendSlice(allocator, &.{ "--permission", permission });
|
|
552
559
|
var service_package_args: std.ArrayList([]u8) = .empty;
|
|
@@ -604,6 +611,75 @@ pub fn checkCore(
|
|
|
604
611
|
return error.CoreCheckFailed;
|
|
605
612
|
}
|
|
606
613
|
|
|
614
|
+
/// Where `native dev` and the running app exchange markup reloads: the
|
|
615
|
+
/// app's session announcement and the watcher's view updates. Local to one
|
|
616
|
+
/// dev session; never staged, built from, or packaged.
|
|
617
|
+
pub const view_reload_dir = ".native/dev";
|
|
618
|
+
|
|
619
|
+
/// Start the markup watcher for a `native dev` run of a view-reload build
|
|
620
|
+
/// (packages/core/src/view_reload_watch.ts). It snapshots the markup now,
|
|
621
|
+
/// before the build reads it, and exits when its stdin closes. Clears any
|
|
622
|
+
/// exchange left by an earlier session first.
|
|
623
|
+
pub fn startViewReloadWatch(allocator: std.mem.Allocator, io: std.Io, base_env: *std.process.Environ.Map, framework_root: []const u8) !std.process.Child {
|
|
624
|
+
const watch_path = try transpilerPath(allocator, io, framework_root, "src/view_reload_watch.ts");
|
|
625
|
+
defer allocator.free(watch_path);
|
|
626
|
+
const runner_path = try tsRunnerPath(allocator, io, framework_root);
|
|
627
|
+
defer allocator.free(runner_path);
|
|
628
|
+
std.Io.Dir.cwd().deleteTree(io, view_reload_dir) catch {};
|
|
629
|
+
try std.Io.Dir.cwd().createDirPath(io, view_reload_dir);
|
|
630
|
+
return std.process.spawn(io, .{
|
|
631
|
+
.argv = &.{ "node", runner_path, watch_path, "--src", "src", "--dir", view_reload_dir },
|
|
632
|
+
.stdin = .pipe,
|
|
633
|
+
.stdout = .inherit,
|
|
634
|
+
.stderr = .inherit,
|
|
635
|
+
.environ_map = base_env,
|
|
636
|
+
}) catch return nodeMissing();
|
|
637
|
+
}
|
|
638
|
+
|
|
639
|
+
pub const ViewCheck = struct {
|
|
640
|
+
errors: usize = 0,
|
|
641
|
+
warnings: usize = 0,
|
|
642
|
+
};
|
|
643
|
+
|
|
644
|
+
/// Compile the app's markup against the contract `checkCore` wrote, with
|
|
645
|
+
/// the same TypeScript view compiler and source closure the build uses,
|
|
646
|
+
/// and report model state and Msg kinds no view uses. The checker prints
|
|
647
|
+
/// its own diagnostics; the returned counts feed the summary and
|
|
648
|
+
/// `--strict`.
|
|
649
|
+
pub fn checkViews(allocator: std.mem.Allocator, io: std.Io, base_env: *std.process.Environ.Map, framework_root: []const u8) !ViewCheck {
|
|
650
|
+
const check_path = try transpilerPath(allocator, io, framework_root, "src/view_check.ts");
|
|
651
|
+
defer allocator.free(check_path);
|
|
652
|
+
const runner_path = try tsRunnerPath(allocator, io, framework_root);
|
|
653
|
+
defer allocator.free(runner_path);
|
|
654
|
+
const result = std.process.run(allocator, io, .{
|
|
655
|
+
.argv = &.{ "node", runner_path, check_path, "--contract", check_contract_path, "--src", "src" },
|
|
656
|
+
.stdout_limit = .limited(4096),
|
|
657
|
+
.environ_map = base_env,
|
|
658
|
+
}) catch |err| switch (err) {
|
|
659
|
+
error.FileNotFound => return nodeMissing(),
|
|
660
|
+
else => return err,
|
|
661
|
+
};
|
|
662
|
+
defer allocator.free(result.stdout);
|
|
663
|
+
defer allocator.free(result.stderr);
|
|
664
|
+
std.debug.print("{s}", .{result.stderr});
|
|
665
|
+
const exited_cleanly = switch (result.term) {
|
|
666
|
+
.exited => |code| code == 0,
|
|
667
|
+
else => false,
|
|
668
|
+
};
|
|
669
|
+
if (exited_cleanly) {
|
|
670
|
+
if (parseViewCheck(allocator, result.stdout)) |counts| return counts else |_| {}
|
|
671
|
+
}
|
|
672
|
+
std.debug.print("native check: the TypeScript view checker did not report a verdict (output above)\n", .{});
|
|
673
|
+
return error.ViewCheckFailed;
|
|
674
|
+
}
|
|
675
|
+
|
|
676
|
+
fn parseViewCheck(allocator: std.mem.Allocator, stdout: []const u8) !ViewCheck {
|
|
677
|
+
const line = std.mem.trim(u8, stdout, " \r\n");
|
|
678
|
+
const parsed = try std.json.parseFromSlice(ViewCheck, allocator, line, .{});
|
|
679
|
+
defer parsed.deinit();
|
|
680
|
+
return parsed.value;
|
|
681
|
+
}
|
|
682
|
+
|
|
607
683
|
/// The compiler-truth pass `checkCore` chains after the frontend: the
|
|
608
684
|
/// pinned external core compiler's analyzer over the same entry, with
|
|
609
685
|
/// the shipped SDK declarations mapped — the check verdict and the
|
|
@@ -801,7 +877,7 @@ pub fn runDevHost(allocator: std.mem.Allocator, io: std.Io, framework_root: []co
|
|
|
801
877
|
// to npm, the CLI materializes `node_modules/@native-sdk/core` inside the
|
|
802
878
|
// app itself — a plain COPY (never a symlink; cache paths get GC'd) of
|
|
803
879
|
// 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,
|
|
880
|
+
// the `files: ["sdk"]` allowlist: sdk/core.ts, sdk/bytes.ts, sdk/text.ts, sdk/events.ts,
|
|
805
881
|
// and the ambient bytes-text method surface core.ts references).
|
|
806
882
|
// The copy is
|
|
807
883
|
// EDITOR-AND-VERSIONING SURFACE ONLY: builds check and compile against the
|
|
@@ -815,10 +891,10 @@ pub fn runDevHost(allocator: std.mem.Allocator, io: std.Io, framework_root: []co
|
|
|
815
891
|
pub const editor_package_dir = "node_modules/@native-sdk/core";
|
|
816
892
|
|
|
817
893
|
/// The published artifact's files, relative to packages/core (and to the
|
|
818
|
-
/// materialized copy): package.json
|
|
894
|
+
/// materialized copy): package.json, core editor sources, and the test driver.
|
|
819
895
|
/// packages/core/test/package_manifest.test.ts pins the manifest to this
|
|
820
896
|
/// 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" };
|
|
897
|
+
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
898
|
const sqlite_editor_overlay_marker = ".native/cache/sqlite/editor-overlay";
|
|
823
899
|
|
|
824
900
|
/// Extract the top-level "version" of a package.json. A targeted scan, not
|
|
@@ -964,6 +1040,13 @@ pub fn selfHealEditorPackage(allocator: std.mem.Allocator, io: std.Io, framework
|
|
|
964
1040
|
}
|
|
965
1041
|
}
|
|
966
1042
|
|
|
1043
|
+
test "the view checker verdict parses from its one stdout line" {
|
|
1044
|
+
const counts = try parseViewCheck(std.testing.allocator, "{\"errors\":0,\"warnings\":3}\n");
|
|
1045
|
+
try std.testing.expectEqual(@as(usize, 0), counts.errors);
|
|
1046
|
+
try std.testing.expectEqual(@as(usize, 3), counts.warnings);
|
|
1047
|
+
try std.testing.expectError(error.UnexpectedEndOfInput, parseViewCheck(std.testing.allocator, ""));
|
|
1048
|
+
}
|
|
1049
|
+
|
|
967
1050
|
test "core tree detection reads the tree, not config" {
|
|
968
1051
|
const io = std.testing.io;
|
|
969
1052
|
var cwd = std.Io.Dir.cwd();
|
|
@@ -1071,20 +1154,30 @@ test "editor package: materialize, heal, and the npm-install handoff" {
|
|
|
1071
1154
|
try cwd.createDirPath(io, app ++ "/src");
|
|
1072
1155
|
try cwd.writeFile(io, .{ .sub_path = sdk ++ "/packages/core/package.json", .data = "{ \"name\": \"@native-sdk/core\", \"version\": \"0.0.9\" }" });
|
|
1073
1156
|
try cwd.writeFile(io, .{ .sub_path = sdk ++ "/packages/core/sdk/core.ts", .data = "// core module" });
|
|
1157
|
+
try cwd.writeFile(io, .{ .sub_path = sdk ++ "/packages/core/sdk/bytes.ts", .data = "// byte module" });
|
|
1074
1158
|
try cwd.writeFile(io, .{ .sub_path = sdk ++ "/packages/core/sdk/text.ts", .data = "// text module" });
|
|
1075
1159
|
try cwd.writeFile(io, .{ .sub_path = sdk ++ "/packages/core/sdk/events.ts", .data = "// events module" });
|
|
1160
|
+
try cwd.writeFile(io, .{ .sub_path = sdk ++ "/packages/core/sdk/theme.ts", .data = "// theme module" });
|
|
1161
|
+
try cwd.createDirPath(io, sdk ++ "/packages/core/sdk/internal");
|
|
1162
|
+
try cwd.writeFile(io, .{ .sub_path = sdk ++ "/packages/core/sdk/internal/image_identity.ts", .data = "// image identity module" });
|
|
1163
|
+
try cwd.writeFile(io, .{ .sub_path = sdk ++ "/packages/core/sdk/internal/markdown_policy.ts", .data = "// Markdown policy module" });
|
|
1076
1164
|
try cwd.writeFile(io, .{ .sub_path = sdk ++ "/packages/core/sdk/bytes_text_methods.d.ts", .data = "// ambient text methods" });
|
|
1077
1165
|
|
|
1078
1166
|
const bundled = try bundledSdkVersion(allocator, io, sdk);
|
|
1079
1167
|
defer allocator.free(bundled);
|
|
1080
1168
|
try std.testing.expectEqualStrings("0.0.9", bundled);
|
|
1081
1169
|
|
|
1170
|
+
try cwd.createDirPath(io, sdk ++ "/packages/core/testing");
|
|
1171
|
+
try cwd.writeFile(io, .{ .sub_path = sdk ++ "/packages/core/testing/index.ts", .data = "// native test driver" });
|
|
1172
|
+
|
|
1082
1173
|
// Missing copy: materialized, and the full artifact lands.
|
|
1083
1174
|
try std.testing.expectEqual(EnsureOutcome.materialized, try ensureEditorPackage(allocator, io, sdk, app));
|
|
1084
1175
|
try std.testing.expect(buildgraph.fileExists(io, app ++ "/node_modules/@native-sdk/core/package.json"));
|
|
1085
1176
|
try std.testing.expect(buildgraph.fileExists(io, app ++ "/node_modules/@native-sdk/core/sdk/core.ts"));
|
|
1177
|
+
try std.testing.expect(buildgraph.fileExists(io, app ++ "/node_modules/@native-sdk/core/sdk/bytes.ts"));
|
|
1086
1178
|
try std.testing.expect(buildgraph.fileExists(io, app ++ "/node_modules/@native-sdk/core/sdk/text.ts"));
|
|
1087
1179
|
try std.testing.expect(buildgraph.fileExists(io, app ++ "/node_modules/@native-sdk/core/sdk/events.ts"));
|
|
1180
|
+
try std.testing.expect(buildgraph.fileExists(io, app ++ "/node_modules/@native-sdk/core/testing/index.ts"));
|
|
1088
1181
|
try std.testing.expect(buildgraph.fileExists(io, app ++ "/node_modules/@native-sdk/core/sdk/bytes_text_methods.d.ts"));
|
|
1089
1182
|
|
|
1090
1183
|
// A generated relational surface overlays the editor-resolved core and
|