@snap/valdi 1.2.0 → 1.3.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.
Files changed (56) hide show
  1. package/.bootstrap/modules/ui_component/BUILD.bazel.template +1 -1
  2. package/.metadata/.bazelrc.template +5 -5
  3. package/.metadata/.bazelversion.template +1 -1
  4. package/.metadata/AGENTS.md.template +7 -0
  5. package/.metadata/MODULE.bazel.template +75 -6
  6. package/.metadata/README.md.template +2 -2
  7. package/.metadata/android_ide_common_30_1_3_install.json.template +1818 -0
  8. package/.metadata/android_mvn_install.json.template +2877 -0
  9. package/.metadata/maven_install.json.template +444 -0
  10. package/.metadata/rules_android_maven_install.json.template +4879 -0
  11. package/.metadata/skill-tests-README.md.template +1 -1
  12. package/README.md +12 -13
  13. package/bundled-skills/skills/valdi-async/tests/README.md +1 -1
  14. package/bundled-skills/skills/valdi-compiler/skill.md +3 -8
  15. package/bundled-skills/skills/valdi-component-tests/skill.md +1 -1
  16. package/bundled-skills/skills/valdi-component-tests/tests/README.md +1 -1
  17. package/bundled-skills/skills/valdi-custom-view/skill.md +1 -1
  18. package/bundled-skills/skills/valdi-gestures/skill.md +1 -1
  19. package/bundled-skills/skills/valdi-migrate/tests/README.md +2 -2
  20. package/bundled-skills/skills/valdi-mock-breakdown/skill.md +1 -1
  21. package/bundled-skills/skills/valdi-mock-to-module/scripts/find_icon.py +8 -8
  22. package/bundled-skills/skills/valdi-mock-to-module/scripts/test_find_icon.py +2 -2
  23. package/bundled-skills/skills/valdi-perf/skill.md +2 -2
  24. package/bundled-skills/skills/valdi-perf/tests/README.md +1 -1
  25. package/bundled-skills/skills/valdi-polyglot-module/skill.md +5 -1
  26. package/bundled-skills/skills/valdi-tsx/skill.md +6 -6
  27. package/bundled-skills/skills/valdi-tsx/tests/README.md +1 -1
  28. package/dist/commands/agentCheck.js +9 -7
  29. package/dist/commands/bootstrap.js +16 -5
  30. package/dist/commands/build.js +7 -1
  31. package/dist/commands/doctor.js +4 -7
  32. package/dist/commands/export.js +47 -16
  33. package/dist/commands/hotreload.js +247 -27
  34. package/dist/commands/install.js +92 -3
  35. package/dist/commands/newModule.js +8 -1
  36. package/dist/commands/webHotreload.js +3 -3
  37. package/dist/core/constants.js +17 -2
  38. package/dist/setup/DevSetupHelper.js +11 -2
  39. package/dist/setup/libtinfo5.js +19 -0
  40. package/dist/setup/linuxSetup.js +2 -22
  41. package/dist/utils/BazelClient.js +11 -4
  42. package/dist/utils/applicationUtils.js +17 -2
  43. package/dist/utils/buildInfo.js +5 -1
  44. package/dist/utils/cliUtils.js +2 -2
  45. package/dist/utils/directorySync.js +153 -0
  46. package/dist/utils/errorUtils.js +1 -1
  47. package/dist/utils/githubUtils.js +1 -1
  48. package/dist/utils/iosSimulator.js +136 -0
  49. package/dist/utils/nonInteractive.js +13 -0
  50. package/dist/utils/prettierCheck.js +19 -0
  51. package/dist/utils/processUtils.js +14 -0
  52. package/dist/utils/webApplicationSession.js +58 -0
  53. package/dist/utils/webHotReloadSession.js +212 -0
  54. package/dist/utils/webServerUtils.js +195 -0
  55. package/dist/utils/zipUtils.js +20 -2
  56. package/package.json +4 -2
@@ -1,7 +1,7 @@
1
1
  # Usage Instructions for This Module
2
2
  #
3
3
  # Step 1: Add this module to your `BUILD.bazel` file dependencies:
4
- # `//src/valdi/{{MODULE_NAME}}`
4
+ # `//modules/{{MODULE_NAME}}` (adjust to wherever this module lives in your workspace)
5
5
  #
6
6
  # Step 2: Import the module in your `.tsx` file:
7
7
  # `import { NewModuleComponent } from '{{MODULE_NAME}}/src/NewModuleComponent';`
@@ -2,9 +2,12 @@
2
2
  common --registry=https://raw.githubusercontent.com/Snapchat/Valdi/{{VALDI_RELEASE_TAG}}/registry
3
3
  common --registry=https://bcr.bazel.build
4
4
 
5
- common --bes_instance_name=client
6
5
  common --enable_platform_specific_config
7
6
 
7
+ # Bazel 8 flipped this to true by default; the generated module BUILD globs src/**/*.ts
8
+ # and Valdi's own packages glob empty dirs.
9
+ common --noincompatible_disallow_empty_glob
10
+
8
11
  # Disable workers for repo fetching to prevent OOM
9
12
  common --experimental_worker_for_repo_fetching=off
10
13
 
@@ -40,7 +43,7 @@ build --incompatible_use_specific_tool_files=false
40
43
  ## For Objective-C source files
41
44
  build --per_file_copt=.*\.mm\$@-std=c++20
42
45
  build --host_per_file_copt=.*\.mm\$@-std=c++20
43
- build --ios_minimum_os=12.0
46
+ build --ios_minimum_os=15.0
44
47
 
45
48
  ## TODO: (dchapp) this is currently needed otherwise -O0 and -DDEBUG=1 get passed to compilations of .mm/.m for production flavor builds
46
49
  build --experimental_objc_fastbuild_options=""
@@ -74,7 +77,6 @@ build:macos --spawn_strategy=local
74
77
  build:linux --sandbox_writable_path=/var/tmp
75
78
 
76
79
  # Disable disk cache to save disk space
77
- # https://docs.google.com/document/d/1N8W_M83n9jhMi7pgUhXuEuxypb3dmlHBu_CG_eXipXI/edit?usp=sharing
78
80
  build --disk_cache=""
79
81
 
80
82
  # common build configuration
@@ -86,8 +88,6 @@ build --generate_json_trace_profile
86
88
  # CLI passes to its build/test flows so they converge; raw `bazel` keeps the
87
89
  # default. Changing test flags (e.g. --test_output) repopulates it once.
88
90
  build:stable_exec --notrim_test_configuration
89
- # enable grpc log
90
- build --remote_grpc_log=/tmp/snap_client_grpc.log
91
91
  build --experimental_reuse_sandbox_directories
92
92
 
93
93
  # Default JS engine
@@ -1 +1 @@
1
- 7.2.1
1
+ 8.2.1
@@ -13,4 +13,11 @@ valdi skills install # installs skills for Claude Code, Cursor, or Copi
13
13
 
14
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
15
 
16
+ ## Security: Handling Credentials
17
+
18
+ 1. **Never print credential files or secrets.** When diagnosing setup, install, or registry problems, do not `cat`, `head`, `grep`, or otherwise echo `~/.npmrc`, `~/.netrc`, `~/.gitconfig` credential sections, `~/.docker/config.json`, Bazel credential helpers, `.env` files, or environment variables that may hold tokens. Tool output ends up in transcripts and logs.
19
+ 2. **Read only the setting you need, by key.** For example `npm config get registry` (never `npm config list`, which can include auth values) or `git config --get remote.origin.url`.
20
+ 3. **If you must inspect such a file, redact first** and print key names only, e.g. `sed -E 's/(_authToken|_auth|_password|password|token)[[:space:]]*=.*/\1=<redacted>/' ~/.npmrc`.
21
+ 4. **If a secret is exposed anyway, say so plainly** so the user can rotate it.
22
+
16
23
  For documentation and support: https://github.com/Snapchat/Valdi
@@ -53,7 +53,7 @@ register_toolchains("@local_config_apple_cc_toolchains//:all")
53
53
  register_toolchains("@llvm_toolchain//:all")
54
54
 
55
55
  # -- Android dependencies ----------------------------------------------------
56
- bazel_dep(name = "rules_java", version = "7.4.0")
56
+ bazel_dep(name = "rules_java", version = "8.14.0")
57
57
  bazel_dep(name = "rules_android", version = "0.6.5")
58
58
  # Resolve rules_android from the Valdi registry, which carries the hermetic Android SDK
59
59
  # patch (registry/modules/rules_android/0.6.5) so bootstrapped apps build Android targets
@@ -85,9 +85,9 @@ use_repo(hermetic_ndk_extension, "androidndk")
85
85
 
86
86
  register_toolchains("@androidndk//:all")
87
87
 
88
- bazel_dep(name = "rules_kotlin", version = "1.9.0")
89
- single_version_override(module_name = "rules_kotlin", version = "1.9.0")
90
- bazel_dep(name = "rules_jvm_external", version = "6.2")
88
+ bazel_dep(name = "rules_kotlin", version = "2.3.10")
89
+ single_version_override(module_name = "rules_kotlin", version = "2.3.10")
90
+ bazel_dep(name = "rules_jvm_external", version = "6.6")
91
91
 
92
92
  # -- Maven (Android) ---------------------------------------------------------
93
93
  maven = use_extension("@rules_jvm_external//:extensions.bzl", "maven")
@@ -144,19 +144,49 @@ maven.install(
144
144
  aar_import_bzl_label = "@rules_android//rules:rules.bzl",
145
145
  use_starlark_android_rules = True,
146
146
  version_conflict_policy = "pinned",
147
+ lock_file = "//:android_mvn_install.json",
147
148
  )
148
149
 
149
150
  use_repo(maven, "android_mvn")
150
151
 
152
+ # Unpinned maven repos are resolved by coursier straight from Maven Central,
153
+ # which rate-limits (HTTP 429). With a lock file Bazel's downloader fetches
154
+ # each jar by checksum instead. The root module's lock file wins for a namespace,
155
+ # and Valdi's own pins for these namespaces don't reach this app, so the app
156
+ # pins the ones an Android build fetches. A root tag also replaces the
157
+ # namespace's repositories, so each repeats its declaring module's list.
158
+ # After changing artifacts or bumping a declaring module, repin with
159
+ # `REPIN=1 bazel run @unpinned_<name>//:pin` (add the name to use_repo first).
160
+ maven.install(
161
+ name = "android_ide_common_30_1_3",
162
+ lock_file = "//:android_ide_common_30_1_3_install.json",
163
+ repositories = [
164
+ "https://maven.google.com",
165
+ "https://repo1.maven.org/maven2",
166
+ ],
167
+ )
168
+ maven.install(
169
+ name = "maven",
170
+ lock_file = "//:maven_install.json",
171
+ )
172
+ maven.install(
173
+ name = "rules_android_maven",
174
+ lock_file = "//:rules_android_maven_install.json",
175
+ repositories = [
176
+ "https://maven.google.com",
177
+ "https://repo1.maven.org/maven2",
178
+ ],
179
+ )
180
+
151
181
  # -- Version pins (must match Valdi's MODULE.bazel) ---------------------------
152
- single_version_override(module_name = "protobuf", version = "27.0")
182
+ single_version_override(module_name = "protobuf", version = "29.3")
153
183
  single_version_override(module_name = "rules_apple", version = "4.0.0")
154
184
  single_version_override(module_name = "rules_pkg", version = "0.9.1")
155
185
  single_version_override(module_name = "zlib", version = "1.3.2")
156
186
 
157
187
  # rules_python 1.9.0's hermetic Python toolchain bundles setuptools files whose
158
188
  # names contain spaces (e.g. "Lorem ipsum.txt"), which Bazel's build-runfiles
159
- # cannot materialize on macOS. The patch renames them. It is vendored into this
189
+ # cannot materialize on macOS or Linux. The patch renames them. It is vendored into this
160
190
  # app (bzl/patches/...) and referenced with a root-local `//` label on purpose:
161
191
  # bzlmod only applies this override from the ROOT module, and `@valdi` resolves
162
192
  # to the pinned public release, which may not ship the patch. See the CLI
@@ -169,3 +199,42 @@ python.single_version_platform_override(
169
199
  platform = "aarch64-apple-darwin",
170
200
  python_version = "3.11.14",
171
201
  )
202
+ python.single_version_platform_override(
203
+ patch_strip = 1,
204
+ patches = ["//bzl/patches/rules_python/1.9.0:remove_setuptools_spaces.patch"],
205
+ platform = "aarch64-unknown-linux-gnu",
206
+ python_version = "3.11.14",
207
+ )
208
+ python.single_version_platform_override(
209
+ patch_strip = 1,
210
+ patches = ["//bzl/patches/rules_python/1.9.0:remove_setuptools_spaces.patch"],
211
+ platform = "x86_64-unknown-linux-gnu",
212
+ python_version = "3.11.14",
213
+ )
214
+
215
+ # -- Rust toolchain ------------------------------------------------------------
216
+ # rules_rust only honors rust.toolchain() from the root module, so Valdi's own
217
+ # toolchain config does not reach bootstrapped apps. Mirror it here.
218
+ # -Cstrip=none for exec-config (host tool / proc-macro) builds: rustc's
219
+ # debuginfo strip leaves a misaligned LINKEDIT string table that macOS 27 dyld
220
+ # rejects when the dylib was linked against SDK 27 (rust-lang/rust#157750,
221
+ # fixed in Rust 1.98.0).
222
+ bazel_dep(name = "rules_rust", version = "0.64.0")
223
+
224
+ rust = use_extension("@rules_rust//rust:extensions.bzl", "rust")
225
+ rust.toolchain(
226
+ edition = "2024",
227
+ extra_exec_rustc_flags = ["-Cstrip=none"],
228
+ extra_target_triples = [
229
+ "aarch64-apple-ios",
230
+ "aarch64-apple-ios-sim",
231
+ "aarch64-linux-android",
232
+ "armv7-linux-androideabi",
233
+ "x86_64-apple-ios",
234
+ "x86_64-linux-android",
235
+ ],
236
+ versions = ["1.87.0"],
237
+ )
238
+ use_repo(rust, "rust_toolchains")
239
+
240
+ register_toolchains("@rust_toolchains//:all")
@@ -1,5 +1,5 @@
1
- # valdi_demo
2
- Demo of a hello world app using Valdi open source
1
+ # {{PROJECT_NAME}}
2
+ A [Valdi](https://github.com/Snapchat/Valdi) application.
3
3
 
4
4
  ## Usage
5
5