Repository navigation
feat: say why a zodResolver call was left as written, and a scan command - #16
Closed
mertcanaltin wants to merge 2 commits into
Closed
mertcanaltin wants to merge 2 commits into
mertcanaltin wants to merge 2 commits into
Conversation
…rt, and a scan command prints the report without a build
# Conflicts: # src/index.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #15; the diff here is the one commit on top of it.
When the build leaves a
zodResolvercall as written it said nothing, so a developer who added the plugin and saw no change had no way to learn why, or what to move. Two things:Every call left as written has a reason, in the build's report beside the validators kept on the runtime. A reason names the schema, the field and the cause, in words about the developer's code:
planZodnow names the field of a refusal,schemaSourcesays what it could not read (a function, a name from outside, TypeScript syntax, an exported constant), and the import path says which module it could not read and why. The count of compiled validators no longer includeszodResolvercalls.npx @ata-project/unplugin scan [directory] [--json]prints that report for a project without building it and without the plugin in its config: it runs the plugin's own transform over the source files and throws the output away (src/scan.js, also exported as@ata-project/unplugin/scan). Nothing is written; a test compares the directory before and after. It is the way to see what the plugin would do before deciding to install it.Tests:
test/scan.test.js(3): a project of seven calls where one compiles and six do not, each with the reason expected for it (a schema inside a function, a refine, an array under a nested object named by its path,url(), a call with options, and an imported schema kept because another call uses it as a value); that nothing is written; the command with--jsonand--help.npm test: 262 tests, 260 pass, 2 skipped.Not covered: the scan gives no sizes, since it does not build. It reads files under the directory with the same skip list as the build's own scan (no
node_modules, no dot directories). The reasons are English only.