Skip to content

Tooling package: intended for use in VS Code, CLI... - #256

Draft
freekh wants to merge 1780 commits into
mainfrom
feat/tooling-package
Draft

Tooling package: intended for use in VS Code, CLI...#256
freekh wants to merge 1780 commits into
mainfrom
feat/tooling-package

Conversation

@freekh

@freekh freekh commented Sep 9, 2024

Copy link
Copy Markdown
Contributor

The VS Code extension, CLI and possibly @valbuild/server (through the UI), needs to be able to generate and apply fixes to validation errors. It feels like there might be other things as well which all different tools requires, so we create a package and move all common functionality from VS Code extension and CLI to this package.

Our first goal is to generate fixes in VS Code, CLI and beyond with the same code.

freekh and others added 30 commits April 26, 2024 11:02
Users must now add modules that are editable to this file. This is the disadvantage.

The advantage is that Val no longer needs to evaluate files using QuickJS. So no need for QuickJS, no need for heavy caching in the content server, nor will the proxy need to load files from github (before patching). Now the proxy simply reads the val.modules files instead of loading this from github.
Overall there's less magic.
Everything will load much faster both in dev and prod. We also believe this is a concept that should be relatively familiar to many people, in particular those used to sanity. The val.modules files can be extended also be used to hide or give permissions on modules or how files are shown in the UI...

The plan is to test this out first before changing too much making it harder to revert (yes: we could git revert but that might not be easy once we start piling on things). That means we will keep QuickJS and the Service class that can evaluate files for now.

There's a lot of questions around whether this is a good idea.
Will it even work in proxy / prod mode? Can we get hot module replacement working when Val is enabled? Did it work before? What do we do now with the VS code extension - will it use quickjs or will it use something else? Finally, although we believe this makes Val less magical, it is another thing to remember - to add a editable module you must declare it val.modules - it will be something easy to forget. Some tooling is expected to be necessary to make up for it that, but are will this tooling hurt devex, will they be expensive to make?
Still needs to be updated... Hoping that will happen at some point :)
Need a simpler way to do most server operations. Believe ValOps might be the right abstraction
Module Ids looked like this: /test/foo
Module file path looks like this: /test/foo.val.ts

Why? We need to know the complete path of the source file to be able to create changes to it.

Since the module file path includes "." we had to have another separator: ?p=.
So source paths goes from looking like this:  /test."foo" to /test.val.ts?p="foo"
We changed the format of patches and we believe we won't have the same view anymore so hopefully we will remember to remove the whoel thing
Currently it seems to be working but no validation is done. Also no errors are handled.
The plan is to continue on this path and once ValOpsHttp is working and we can add changes in production,
we'll circle back and take care of this. The reason: it is urgent to get changes in prod up and running (blank needs this)
... Other major changes: files are loaded using patch id, which is shimmed in when files are coming from patches, sha256 can now be removed but because of richtext we're waiting with that.
isakgb and others added 16 commits September 2, 2024 10:24
Async prettier doesn't work in jest v29. It will supposedly be fixed in
v30, which is currently in alpha.
Bump prettier version in root to latest
…ing-patches-in-studio

Feat/add error handling to failing patches in studio
... We plan on using this do runtime type verification.

NOTE: we should use assert always in the validation methods. Right now we are not doing that.

NOTE: we did think about whether it made sense for it to recurse or not. In the end it does not (expect where it makes sense :})
Both the VS Code extension, CLI and possibly the server (through the UI), needs to to generate and apply fixes to validation errors. It feels like there might be other things as well which all tooling requires. This package unifies that.
@changeset-bot

changeset-bot Bot commented Sep 9, 2024

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 7fa9bbe

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@freekh
freekh marked this pull request as draft September 9, 2024 15:02
@freekh
freekh force-pushed the main branch 2 times, most recently from db2e3c3 to 75cdcf9 Compare March 1, 2025 18:19
@freekh
freekh force-pushed the main branch 3 times, most recently from df12780 to 3004c84 Compare September 30, 2025 14:34
@freekh
freekh force-pushed the main branch 2 times, most recently from 272f3ac to 8d6daf7 Compare January 21, 2026 05:09
@freekh
freekh force-pushed the main branch 2 times, most recently from a72dec0 to 9a45969 Compare May 19, 2026 19:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants