@snap/valdi 1.0.8 → 1.0.11

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.
Files changed (64) hide show
  1. package/.bootstrap/apps/cli_application/BUILD.bazel.template +7 -0
  2. package/.bootstrap/apps/cli_application/modules/{{MODULE_NAME}}/BUILD.bazel.template +11 -0
  3. package/.bootstrap/apps/cli_application/modules/{{MODULE_NAME}}/src/index.ts +1 -0
  4. package/.bootstrap/apps/ui_application/.eslint.rc +27 -0
  5. package/.bootstrap/apps/ui_application/BUILD.bazel.template +19 -0
  6. package/.bootstrap/apps/ui_application/modules/{{MODULE_NAME}}/BUILD.bazel.template +21 -0
  7. package/.bootstrap/apps/ui_application/modules/{{MODULE_NAME}}/res/valdi@3x.png +0 -0
  8. package/.bootstrap/apps/ui_application/modules/{{MODULE_NAME}}/src/App.tsx +133 -0
  9. package/.bootstrap/apps/ui_application/package.json +24 -0
  10. package/.bootstrap/modules/polyglot_bridge_module/BUILD.bazel.template +54 -0
  11. package/.bootstrap/modules/polyglot_bridge_module/android/CalculatorModuleFactory.kt.template +18 -0
  12. package/.bootstrap/modules/polyglot_bridge_module/ios/SCCCalculatorModuleFactory.m.template +31 -0
  13. package/.bootstrap/modules/polyglot_bridge_module/src/Calculator.d.ts +4 -0
  14. package/.bootstrap/modules/polyglot_bridge_module/web/Calculator.ts +11 -0
  15. package/.bootstrap/modules/polyglot_bridge_module/web/tsconfig.json +16 -0
  16. package/.bootstrap/modules/polyglot_view_module/BUILD.bazel.template +75 -0
  17. package/.bootstrap/modules/polyglot_view_module/android/PolyglotNativeView.kt.template +41 -0
  18. package/.bootstrap/modules/polyglot_view_module/android/PolyglotNativeViewAttributesBinder.kt.template +17 -0
  19. package/.bootstrap/modules/polyglot_view_module/ios/SCPolyglotView.h +8 -0
  20. package/.bootstrap/modules/polyglot_view_module/ios/SCPolyglotView.m +23 -0
  21. package/.bootstrap/modules/polyglot_view_module/macos/SCPolyglotView.h +8 -0
  22. package/.bootstrap/modules/polyglot_view_module/macos/SCPolyglotView.m +23 -0
  23. package/.bootstrap/modules/polyglot_view_module/src/PolyglotCustomView.tsx.template +23 -0
  24. package/.bootstrap/modules/polyglot_view_module/web/PolyglotWeb.ts.template +30 -0
  25. package/.bootstrap/modules/polyglot_view_module/web/tsconfig.json +16 -0
  26. package/.bootstrap/modules/ui_component/BUILD.bazel.template +34 -0
  27. package/.bootstrap/modules/ui_component/src/NewModuleComponent.tsx +45 -0
  28. package/.metadata/.bazelrc.template +91 -0
  29. package/.metadata/.bazelversion.template +1 -0
  30. package/.metadata/.editorconfig.template +37 -0
  31. package/.metadata/.eslintrc.js.template +27 -0
  32. package/.metadata/.gitignore.template +4 -0
  33. package/.metadata/.prettierrc.json.template +7 -0
  34. package/.metadata/.watchmanconfig.template +8 -0
  35. package/.metadata/AGENTS.md.template +16 -0
  36. package/.metadata/README.md.template +31 -0
  37. package/.metadata/WORKSPACE.template +57 -0
  38. package/.metadata/config.yaml.template +1 -0
  39. package/.metadata/package.json.template +23 -0
  40. package/.metadata/skill-reference.tsx.template +8 -0
  41. package/.metadata/skill-tests-BUILD.bazel.template +21 -0
  42. package/.metadata/skill-tests-README.md.template +17 -0
  43. package/.metadata/skill.md.template +27 -0
  44. package/bundled-skills/registry.json +2 -1
  45. package/bundled-skills/skills/valdi-bazel/skill.md +21 -2
  46. package/bundled-skills/skills/valdi-custom-view/skill.md +6 -4
  47. package/bundled-skills/skills/valdi-inspect/skill.md +199 -0
  48. package/bundled-skills/skills/valdi-polyglot-module/skill.md +51 -12
  49. package/bundled-skills/skills/valdi-profile/skill.md +126 -0
  50. package/dist/commands/inspect.js +16 -0
  51. package/dist/commands/inspect_commands/contexts.js +55 -0
  52. package/dist/commands/inspect_commands/devices.js +53 -0
  53. package/dist/commands/inspect_commands/heap.js +59 -0
  54. package/dist/commands/inspect_commands/select.js +43 -0
  55. package/dist/commands/inspect_commands/snapshot.js +64 -0
  56. package/dist/commands/inspect_commands/status.js +68 -0
  57. package/dist/commands/inspect_commands/tree.js +86 -0
  58. package/dist/commands/profile.js +16 -0
  59. package/dist/commands/profile_commands/capture.js +106 -0
  60. package/dist/core/packageFiles.spec.js +29 -0
  61. package/dist/utils/daemonClient.js +342 -0
  62. package/dist/utils/hermesClient.js +252 -0
  63. package/dist/utils/stringUtils.spec.js +1 -1
  64. package/package.json +16 -6
@@ -0,0 +1,34 @@
1
+ # Usage Instructions for This Module
2
+ #
3
+ # Step 1: Add this module to your `BUILD.bazel` file dependencies:
4
+ # `//src/valdi/{{MODULE_NAME}}`
5
+ #
6
+ # Step 2: Import the module in your `.tsx` file:
7
+ # `import { NewModuleComponent } from '{{MODULE_NAME}}/src/NewModuleComponent';`
8
+ #
9
+ # Step 3: Render the component in your `onRender()` function:
10
+ # `<NewModuleComponent title={'Valdi'}/>`
11
+
12
+ load("@valdi//bzl/valdi:valdi_module.bzl", "valdi_module")
13
+
14
+ valdi_module(
15
+ name = "{{MODULE_NAME}}",
16
+ srcs = glob(
17
+ [
18
+ "src/**/*.ts",
19
+ "src/**/*.tsx",
20
+ ],
21
+ ),
22
+ res = glob([
23
+ "res/**/*.jpeg",
24
+ "res/**/*.jpg",
25
+ "res/**/*.png",
26
+ "res/**/*.svg",
27
+ "res/**/*.webp",
28
+ ]),
29
+ visibility = ["//visibility:public"],
30
+ deps = [
31
+ "@valdi//src/valdi_modules/src/valdi/valdi_core",
32
+ "@valdi//src/valdi_modules/src/valdi/valdi_tsx",
33
+ ],
34
+ )
@@ -0,0 +1,45 @@
1
+ import { Component } from 'valdi_core/src/Component';
2
+ import { Label, View } from 'valdi_tsx/src/NativeTemplateElements';
3
+ import { systemFont } from 'valdi_core/src/SystemFont';
4
+ import { Style } from 'valdi_core/src/Style';
5
+
6
+ export interface NewModuleViewModel {
7
+ title: string;
8
+ }
9
+
10
+ export class NewModuleComponent extends Component<NewModuleViewModel> {
11
+ onCreate() {
12
+ // Called when the component is created in the render-tree
13
+ // Used to prepare some resources, precomputed values or subscribe to observables
14
+ }
15
+ onDestroy() {
16
+ // Called the component is not longer in the render-tree
17
+ // Used to dispose of resources and observables
18
+ }
19
+ onViewModelUpdate(previous?: NewModuleViewModel) {
20
+ // Called every time the view model changes
21
+ // Used to trigger some computations, typically used for asynchronous operations,
22
+ // that would then impact the internal component state
23
+ }
24
+
25
+ onRender(): void {
26
+ // Called every time the component needs to be rendered
27
+ // Used to define child components and child render-tree
28
+ // Can access "this.viewModel" that contains the current component parameters values
29
+ <view style={styles.root}>
30
+ <label style={styles.label} value={this.viewModel.title} />
31
+ </view>;
32
+ }
33
+ }
34
+
35
+ const styles = {
36
+ root: new Style<View>({
37
+ backgroundColor: 'red',
38
+ width: '100%',
39
+ height: '100%',
40
+ }),
41
+ label: new Style<Label>({
42
+ font: systemFont(20),
43
+ color: 'white',
44
+ }),
45
+ };
@@ -0,0 +1,91 @@
1
+ # No bzlmod yet
2
+ common --noenable_bzlmod
3
+
4
+ common --bes_instance_name=client
5
+ common --enable_platform_specific_config
6
+
7
+ # Disable workers for repo fetching to prevent OOM
8
+ common --experimental_worker_for_repo_fetching=off
9
+
10
+ # android configuration
11
+ # Expose AndroidResourceInfo provider to Kotlin rules
12
+ common --experimental_google_legacy_api=true
13
+ common --experimental_enable_android_migration_apis=true
14
+ common --incompatible_java_common_parameters=false
15
+
16
+ # Flags for compilation
17
+ common --define enable_web=true
18
+
19
+ build --tool_java_language_version=11
20
+ build --java_language_version=11
21
+
22
+ ## Disable sandboxing for macs, both laptops and in CI; the performance hit is much too high.
23
+ build:macos --spawn_strategy=local
24
+ build:linux --sandbox_writable_path=/var/tmp
25
+
26
+ # common cc configuration
27
+ build --cxxopt=-std=c++20
28
+ build --cxxopt=-Wno-ambiguous-reversed-operator
29
+ build --cxxopt=-D_LIBCPP_ENABLE_CXX20_REMOVED_TYPE_TRAITS
30
+ build --host_cxxopt=-std=c++20
31
+
32
+ ## we need to disable this due to a bug in bazel
33
+ ## see https://github.com/bazelbuild/bazel/issues/12381
34
+ build --incompatible_use_specific_tool_files=false
35
+ build --incompatible_enable_cc_toolchain_resolution
36
+
37
+ # iOS and Apple cc changes and hacks
38
+ ## For Objective-C source files
39
+ build --per_file_copt=.*\.mm\$@-std=c++20
40
+ build --host_per_file_copt=.*\.mm\$@-std=c++20
41
+ build --ios_minimum_os=12.0
42
+
43
+ ## TODO: (dchapp) this is currently needed otherwise -O0 and -DDEBUG=1 get passed to compilations of .mm/.m for production flavor builds
44
+ build --experimental_objc_fastbuild_options=""
45
+ ## HACK inject this in the default toolchain which is only used on macos until we switch to bazel_toolchains
46
+ build:macos --copt=-fvisibility=hidden
47
+
48
+ # java configuration
49
+ ## Disable some java checks for now, djinni generates code that errors out
50
+ build --javacopt=-XepDisableAllChecks
51
+ build --java_runtime_version=11
52
+ build --tool_java_runtime_version=17
53
+
54
+ build --flag_alias=snap_flavor=@snap_platforms//flavors:snap_flavor
55
+ build --snap_flavor=platform_development
56
+
57
+ build --android_crosstool_top=@androidndk//:toolchain
58
+ build --define=android_dexmerger_tool=d8_dexmerger
59
+ build --define=android_incremental_dexing_tool=d8_dexbuilder
60
+ build --define=android_standalone_dexing_tool=d8_compat_dx
61
+ build --incremental_dexing
62
+
63
+ # Disable 3rd party libs warnings
64
+ build --per_file_copt=external/com_github_grpc_grpc/.*\$@-Wno-everything
65
+ build --per_file_copt=external/snap_protobuf/.*\$@-Wno-everything
66
+ build --per_file_copt=external/boringssl/.*\$@-Wno-everything
67
+ build --per_file_copt=external/com_github_google_flatbuffers/.*\$@-Wno-everything
68
+
69
+ # Enable persistent worker for Valdi compilation
70
+ build --strategy=ValdiCompile=worker
71
+
72
+ ## Disable sandboxing for macs, both laptops and in CI; the performance hit is much too high.
73
+ build:macos --spawn_strategy=local
74
+ build:linux --sandbox_writable_path=/var/tmp
75
+
76
+ # Disable disk cache to save disk space
77
+ # https://docs.google.com/document/d/1N8W_M83n9jhMi7pgUhXuEuxypb3dmlHBu_CG_eXipXI/edit?usp=sharing
78
+ build --disk_cache=""
79
+
80
+ # common build configuration
81
+ build --experimental_generate_json_trace_profile
82
+ # enable grpc log
83
+ build --remote_grpc_log=/tmp/snap_client_grpc.log
84
+ build --experimental_reuse_sandbox_directories
85
+
86
+ # Default JS engine
87
+ build --flag_alias=valdi_js_engine=@valdi//bzl/valdi:js_engine
88
+ build --valdi_js_engine=hermes
89
+
90
+ # Valdi Open Source Flags
91
+ build --define=open_source_build=true
@@ -0,0 +1 @@
1
+ 7.2.1
@@ -0,0 +1,37 @@
1
+ root = true
2
+
3
+ [*]
4
+ charset = utf-8
5
+ end_of_line = lf
6
+ insert_final_newline = true
7
+ trim_trailing_whitespace = true
8
+
9
+ [*.{ts,tsx,js,jsx}]
10
+ indent_style = space
11
+ indent_size = 2
12
+
13
+ [*.{cpp,hpp,h,cc}]
14
+ indent_style = space
15
+ indent_size = 4
16
+
17
+ [*.{swift,kt,java}]
18
+ indent_style = space
19
+ indent_size = 4
20
+
21
+ [*.{yml,yaml,json}]
22
+ indent_style = space
23
+ indent_size = 2
24
+
25
+ [*.{bzl,bazel,BUILD}]
26
+ indent_style = space
27
+ indent_size = 4
28
+
29
+ [*.md]
30
+ trim_trailing_whitespace = false
31
+
32
+ [*.{mm,m}]
33
+ indent_style = space
34
+ indent_size = 4
35
+
36
+ [Makefile]
37
+ indent_style = tab
@@ -0,0 +1,27 @@
1
+
2
+ module.exports = {
3
+ root: true,
4
+ parser: '@typescript-eslint/parser',
5
+ parserOptions: {
6
+ tsconfigRootDir: __dirname,
7
+ project: ['./src/valdi/_configs/eslint.tsconfig.json'],
8
+ },
9
+ plugins: ['@typescript-eslint', 'unused-imports', 'rxjs', 'prettier', '@snapchat/eslint-plugin-valdi'],
10
+ extends: [
11
+ 'eslint:recommended',
12
+ 'plugin:@typescript-eslint/recommended',
13
+ 'plugin:import/recommended',
14
+ 'plugin:import/typescript',
15
+ 'prettier',
16
+ ],
17
+ rules: {
18
+ '@snapchat/valdi/attributed-text-no-array-assignment': 'error',
19
+ '@snapchat/valdi/jsx-no-lambda': 'error',
20
+ '@snapchat/valdi/assign-timer-id': 'error',
21
+ '@snapchat/valdi/only-const-enum': 'off',
22
+ '@snapchat/valdi/no-implicit-index-import': 'error',
23
+ '@snapchat/valdi/mutate-state-without-set-state': 'error',
24
+ '@snapchat/valdi/no-import-from-test-outside-test-dir': 'error',
25
+ '@snapchat/valdi/no-declare-test-without-describe': 'error',
26
+ },
27
+ };
@@ -0,0 +1,4 @@
1
+ *.DS_Store
2
+
3
+ bazel-*
4
+ node_modules
@@ -0,0 +1,7 @@
1
+ {
2
+ "printWidth": 120,
3
+ "singleQuote": true,
4
+ "jsxSingleQuote": true,
5
+ "arrowParens": "avoid",
6
+ "trailingComma": "all"
7
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "root_files": [".watchmanconfig"],
3
+ "ignore_dirs": [
4
+ "bazel-out",
5
+ "bazel-bin",
6
+ "bazel-testlogs"
7
+ ]
8
+ }
@@ -0,0 +1,16 @@
1
+ # AI Assistant Context
2
+
3
+ This is a Valdi application. Valdi compiles TypeScript/TSX to native iOS, Android, and macOS views — it is **not React**.
4
+
5
+ ## Get AI Skills
6
+
7
+ Install context files so your AI tool generates correct Valdi code instead of React patterns:
8
+
9
+ ```bash
10
+ npm install -g @snap/valdi
11
+ valdi skills install # installs skills for Claude Code, Cursor, or Copilot
12
+ ```
13
+
14
+ Skills are bundled in the npm package and work offline. They cover component patterns, lifecycle, async handling, build rules, testing, and platform bridging.
15
+
16
+ For documentation and support: https://github.com/Snapchat/Valdi
@@ -0,0 +1,31 @@
1
+ # valdi_demo
2
+ Demo of a hello world app using Valdi open source
3
+
4
+ ## Usage
5
+
6
+ All commands requires `valdi` to be available on PATH.
7
+
8
+ Get auto completion in VSCode
9
+ ```sh
10
+ valdi projectsync
11
+ ```
12
+
13
+ Build and install iOS:
14
+ ```sh
15
+ valdi install ios
16
+ ```
17
+
18
+ Build and install Android:
19
+ ```sh
20
+ valdi install android
21
+ ```
22
+
23
+ Build and install MacOS:
24
+ ```sh
25
+ valdi install macos
26
+ ```
27
+
28
+ Start hot reloader:
29
+ ```sh
30
+ valdi hotreload
31
+ ```
@@ -0,0 +1,57 @@
1
+ workspace(name = "{{WORKSPACE_NAME}}")
2
+
3
+ load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")
4
+ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
5
+
6
+ {{VALDI_IMPORT}}
7
+
8
+ {{VALDI_WIDGETS_IMPORT}}
9
+
10
+ load("@valdi//bzl:workspace_prepare.bzl", "valdi_prepare_workspace")
11
+
12
+ valdi_prepare_workspace()
13
+
14
+ load("@valdi//bzl:workspace_preinit.bzl", "valdi_preinitialize_workspace")
15
+
16
+ valdi_preinitialize_workspace()
17
+
18
+ load("@aspect_bazel_lib//lib:repositories.bzl", "aspect_bazel_lib_dependencies", "aspect_bazel_lib_register_toolchains", "register_yq_toolchains")
19
+
20
+ register_yq_toolchains()
21
+
22
+ # Required bazel-lib dependencies
23
+
24
+ aspect_bazel_lib_dependencies()
25
+
26
+ # Required rules_shell dependencies
27
+ load("@rules_shell//shell:repositories.bzl", "rules_shell_dependencies", "rules_shell_toolchains")
28
+
29
+ rules_shell_dependencies()
30
+
31
+ rules_shell_toolchains()
32
+
33
+ # Register bazel-lib toolchains
34
+
35
+ aspect_bazel_lib_register_toolchains()
36
+
37
+ # Create the host platform repository transitively required by bazel-lib
38
+
39
+ load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe")
40
+ load("@platforms//host:extension.bzl", "host_platform_repo")
41
+
42
+ maybe(
43
+ host_platform_repo,
44
+ name = "host_platform",
45
+ )
46
+
47
+ load("@valdi//bzl:workspace_init.bzl", "valdi_initialize_workspace")
48
+
49
+ valdi_initialize_workspace()
50
+
51
+ load("@valdi_npm//:repositories.bzl", "npm_repositories")
52
+
53
+ npm_repositories()
54
+
55
+ load("@valdi//bzl:workspace_postinit.bzl", "valdi_post_initialize_workspace")
56
+
57
+ valdi_post_initialize_workspace()
@@ -0,0 +1 @@
1
+ logs_output_dir: ~/.valdi/logs
@@ -0,0 +1,23 @@
1
+ {
2
+ "name": "hello_world",
3
+ "version": "1.0.0",
4
+ "description": "Valdi Helloworld app",
5
+ "license": "ISC",
6
+ "devDependencies": {
7
+ "@snap/eslint-plugin-valdi": "1.0.2",
8
+ "@types/eslint": "^9.6.1",
9
+ "@types/jasmine": "^5.1.7",
10
+ "@typescript-eslint/eslint-plugin": "^6.21.0",
11
+ "@typescript-eslint/parser": "^6.21.0",
12
+ "@typescript-eslint/utils": "^6.21.0",
13
+ "eslint": "^8.27.0",
14
+ "eslint-config-prettier": "^8.5.0",
15
+ "eslint-plugin-import": "^2.26.0",
16
+ "eslint-plugin-prettier": "^4.2.1",
17
+ "eslint-plugin-rxjs": "^5.0.2",
18
+ "eslint-plugin-unused-imports": "^3.2.0",
19
+ "jasmine": "^5.6.0",
20
+ "ts-node": "^10.9.2",
21
+ "typescript": "5.3.3"
22
+ }
23
+ }
@@ -0,0 +1,8 @@
1
+ // SKILL_NAME skill reference — compile check for patterns in ../skill.md.
2
+ // Add code that exercises every import path and API shown in the skill.
3
+ // Run: bazel build //ai-skills/skills/SKILL_NAME/tests:tests
4
+
5
+ import { Component } from 'valdi_core/src/Component';
6
+
7
+ // TODO: add reference examples here
8
+ void Component;
@@ -0,0 +1,21 @@
1
+ load("//bzl/valdi:valdi_module.bzl", "valdi_module")
2
+
3
+ valdi_module(
4
+ name = "tests",
5
+ srcs = glob([
6
+ "src/**/*.ts",
7
+ "src/**/*.tsx",
8
+ ]) + [
9
+ "tsconfig.json",
10
+ ],
11
+ android_output_target = "release",
12
+ ios_module_name = "SKILL_IOS_MODULE_NAME",
13
+ ios_output_target = "release",
14
+ visibility = ["//visibility:public"],
15
+ deps = [
16
+ # Add deps for the imports used in src/reference.tsx
17
+ # Common options: valdi_core, valdi_tsx, valdi_http, foundation, valdi_test, jasmine
18
+ "//src/valdi_modules/src/valdi/valdi_core",
19
+ "//src/valdi_modules/src/valdi/valdi_tsx",
20
+ ],
21
+ )
@@ -0,0 +1,17 @@
1
+ # SKILL_NAME skill tests
2
+
3
+ Compile check for the patterns taught in `../skill.md`.
4
+
5
+ ## Compile check
6
+
7
+ ```bash
8
+ cd client/src/open_source
9
+ bazel build //ai-skills/skills/SKILL_NAME/tests:tests
10
+ ```
11
+
12
+ Expected: `Build completed successfully`
13
+
14
+ ## Updating
15
+
16
+ When Valdi APIs change (import paths, type signatures), update `src/reference.tsx` to match.
17
+ Also update `../skill.md` with any corrected patterns.
@@ -0,0 +1,27 @@
1
+ # SKILL_NAME
2
+
3
+ SKILL_DESCRIPTION
4
+
5
+ ## When to use
6
+
7
+ Describe the scenarios or file types where this skill applies.
8
+
9
+ ## Key concepts
10
+
11
+ Explain the important concepts for this area of Valdi.
12
+
13
+ ## Correct patterns
14
+
15
+ ```typescript
16
+ // ✅ Correct example
17
+ ```
18
+
19
+ ## Common mistakes
20
+
21
+ ```typescript
22
+ // ❌ Wrong example — explain why
23
+ ```
24
+
25
+ ## More information
26
+
27
+ - Valdi docs: https://github.com/Snapchat/Valdi
@@ -15,6 +15,7 @@
15
15
  { "name": "valdi-perf", "description": "Valdi performance: viewModel identity stability, createReusableCallback, layout vs view, Style interning", "tags": ["performance", "rendering"], "path": "skills/valdi-perf/skill.md", "category": ["client"] },
16
16
  { "name": "valdi-component-tests", "description": "Valdi component test patterns: elementKeyFind, componentTypeFind, tapNodeWithKey, discriminated unions, arrays", "tags": ["testing", "components", "jasmine"], "path": "skills/valdi-component-tests/skill.md", "category": ["client"] },
17
17
  { "name": "valdi-setup", "description": "Valdi module setup: BUILD.bazel, valdi_module(), tsconfig, deps, ios_module_name, hot reload", "tags": ["setup", "bazel", "build"], "path": "skills/valdi-setup/skill.md", "category": ["client"] },
18
- { "name": "valdi-migrate", "description": "Migrate Flutter, React, or Jetpack Compose code to Valdi — component model, lifecycle, element mapping tables", "tags": ["migration", "flutter", "react", "compose"], "path": "skills/valdi-migrate/skill.md", "category": ["client"] }
18
+ { "name": "valdi-migrate", "description": "Migrate Flutter, React, or Jetpack Compose code to Valdi — component model, lifecycle, element mapping tables", "tags": ["migration", "flutter", "react", "compose"], "path": "skills/valdi-migrate/skill.md", "category": ["client"] },
19
+ { "name": "valdi-inspect", "description": "Inspect a live Valdi app: contexts, component trees, screenshots, heap dumps via valdi inspect CLI", "tags": ["inspect", "debug", "runtime", "cli"], "path": "skills/valdi-inspect/skill.md", "category": ["client"] }
19
20
  ]
20
21
  }
@@ -39,6 +39,8 @@ bazel clean
39
39
  ### Common Targets
40
40
 
41
41
  ```python
42
+ load("@aspect_rules_ts//ts:defs.bzl", "ts_project")
43
+
42
44
  # Valdi application
43
45
  valdi_application(
44
46
  name = "my_app",
@@ -48,10 +50,27 @@ valdi_application(
48
50
  deps = ["//apps/my_app/src/valdi/my_app"],
49
51
  )
50
52
 
51
- # Valdi module
53
+ # Web polyglot views — MUST be ts_project, never filegroup
54
+ ts_project(
55
+ name = "my_module_web",
56
+ srcs = glob(
57
+ ["web/**/*.ts", "src/**/*.d.ts"],
58
+ exclude = ["web/**/*.d.ts"],
59
+ ),
60
+ allow_js = True,
61
+ composite = True,
62
+ transpiler = "tsc",
63
+ tsconfig = "web/tsconfig.json",
64
+ )
65
+
66
+ # Valdi module with platform deps
52
67
  valdi_module(
53
68
  name = "my_module",
54
- srcs = glob(["src/**/*.ts", "src/**/*.tsx"]),
69
+ srcs = glob(["src/**/*.ts", "src/**/*.tsx"]) + ["tsconfig.json"],
70
+ ios_deps = [":my_ios_views"], # objc_library
71
+ macos_deps = [":my_macos_views"], # objc_library (or omit to share ios_deps)
72
+ android_deps = [":my_android_views"], # valdi_android_library
73
+ web_deps = [":my_module_web"], # ts_project (never filegroup)
55
74
  deps = [
56
75
  "//src/valdi_modules/src/valdi/valdi_core",
57
76
  ],
@@ -26,12 +26,12 @@
26
26
  | `macosClass` | macOS | `NSClassFromString()`; must be linked via `macos_deps` |
27
27
  | `webClass` | Web | Looked up in `WebViewClassRegistry`; registered via `webPolyglotViews` export |
28
28
 
29
- ## Platform Discovery
29
+ ## Platform Resolution
30
30
 
31
31
  - **Android**: The view class needs a single-arg `(Context)` constructor. An `@RegisterAttributesBinder`-annotated binder is discovered from assets at runtime.
32
- - **iOS**: The ObjC class must be an `NSView`/`UIView` subclass linked into the binary.
33
- - **macOS**: Same as iOS but with `NSView` subclass.
34
- - **Web**: The `webClass` name is matched against the `WebViewClassRegistry`. Register by exporting `webPolyglotViews` from a web polyglot entry file (see `web-polyglot.md` rule).
32
+ - **iOS**: The ObjC class must be a `UIView` subclass linked into the binary via `ios_deps`.
33
+ - **macOS**: Falls through to `iosClass` when `macosClass` is not specified — both in TypeScript (`JSXBootstrap.ts`) and C++ (`ViewNode.cpp`). Only specify `macosClass` when the macOS view is different from iOS.
34
+ - **Web**: The `webClass` name is matched against the `WebViewClassRegistry`. Register by exporting `webPolyglotViews` from a typed TypeScript web polyglot entry file compiled via `ts_project` (see `valdi-polyglot-module` skill). Factories return an `AttributeHandler` with `changeAttribute(name, value)` to receive attribute updates.
35
35
 
36
36
  ## viewFactory Pattern
37
37
 
@@ -60,3 +60,5 @@ class MyComponent extends Component<MyViewModel> {
60
60
  - Using `<custom-view>` without checking the platform — wrap in `Device.isAndroid()` / `Device.isIOS()` etc. if not all platforms are supported
61
61
  - Forgetting to link native implementations — the class name string alone isn't enough; the native code must be compiled and linked via platform `_deps` in BUILD.bazel
62
62
  - Wrong package name in `androidClass` — must match the Kotlin/Java package exactly
63
+ - Specifying `macosClass` when it's the same as `iosClass` — omit it and let the fallthrough handle it
64
+ - Using a `filegroup` for `web_deps` — always use `ts_project` with `transpiler = "tsc"`