Skip to content

Commit

Permalink
More checker features (#126)
Browse files Browse the repository at this point in the history
* Class hoisting and use as internal. Package imports and more
* Generic chain and others generic fixes
* Few fixes to calling, template literal type annotations and some extra stuff
* Hopeful fix to performance-and-size.yml
  • Loading branch information
kaleidawave authored Apr 8, 2024
1 parent 78e3839 commit 0fa4fa8
Show file tree
Hide file tree
Showing 62 changed files with 5,056 additions and 2,859 deletions.
40 changes: 31 additions & 9 deletions .github/workflows/performance-and-size.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ jobs:
with:
packages: hyperfine

# For displaying line count in file
- name: Download scc
run: |
mkdir scc
Expand All @@ -52,38 +53,59 @@ jobs:
- name: Run checker performance
shell: bash
run: |
echo "::info::Found specification"
# Generate a file which contains everything that Ezno currently implements
cargo run -p ezno-parser --example code_blocks_to_script ./checker/specification/specification.md demo.ts
cargo run -p ezno-parser --example code_blocks_to_script ./checker/specification/specification.md ./demo.ts
echo "::group::Generated demo.ts"
cat ./demo.ts
cargo run -p ezno-parser --example parse demo.ts --timings
echo "::endgroup::"
echo "::info::Finished file generation"
echo "<details>
<summary>Input</summary>
\`\`\`ts
" >> $GITHUB_STEP_SUMMARY
lines=$(scc -c --no-cocomo -f json .\private\tocheck\all.ts | jq ".[0].Code")
echo "// $lines of TypeScript" >> $GITHUB_STEP_SUMMARY
cat demo.ts >> $GITHUB_STEP_SUMMARY
lines=$(scc -c --no-cocomo -f json demo.ts | jq ".[0].Code")
echo "// $lines lines of TypeScript" >> $GITHUB_STEP_SUMMARY
cat ./demo.ts >> $GITHUB_STEP_SUMMARY
echo "\`\`\`
</details>
" >> $GITHUB_STEP_SUMMARY
# Printing diagnostics, so turn colors off for GH Summary
NO_COLOR=1
echo "::info::Wrote code to summary"
echo "<details>
<summary>Diagnostics</summary>
\`\`\`" >> $GITHUB_STEP_SUMMARY
# Printing diagnostics, so turn colors off for GH Summary (also affects printing perf I think)
NO_COLOR=1
./target/release/ezno check demo.ts --timings &>> $GITHUB_STEP_SUMMARY
echo "\`\`\`
</details>
" >> $GITHUB_STEP_SUMMARY
echo "### Checking
\`\`\`shell" >> $GITHUB_STEP_SUMMARY
hyperfine './target/release/ezno check demo.ts' >> $GITHUB_STEP_SUMMARY
hyperfine -i './target/release/ezno check demo.ts' >> $GITHUB_STEP_SUMMARY
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
echo "::group::Comparing printing of diagnostics"
hyperfine -i './target/release/ezno check demo.ts' './target/release/ezno check demo.ts --count-diagnostics'
echo "::endgroup::"
- name: Run parser, minfier/stringer performance
shell: bash
run: |
Expand Down
9 changes: 7 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ If you don't want to run the whole Ezno CLI. You can run just the checker with
cargo run -p ezno-checker --example run path/to/file.ts
```

Note you can skip the cache with the additional `--no-cache` option (re-reads base `.d.ts` file)

If you want to check all the checker tests

```shell
Expand All @@ -38,10 +40,13 @@ cargo test -p ezno-checker-specification -F staging
cargo test -p ezno-checker-specification -F all
```

> [!IMPORTANT]
> `cache` might need to be regenerated between specification runs if working on internal methods (e.g. `Array.map` etc). See below
If you want to regenerate the binary definition file

```shell
cargo run -p ezno-checker -F ezno-parser --example cache ./checker/definitions/full.d.ts ./checker/definitions/internal.ts.d.bin
cargo run -p ezno-checker -F ezno-parser --example cache ./checker/definitions/overrides.d.ts ./checker/definitions/internal.ts.d.bin
```

If you want to test the lexing and parsing in Ezno's parser
Expand All @@ -60,7 +65,7 @@ cargo run -p ezno-parser --example lex path/to/file.ts
- Run all tests `cargo test --workspace --verbose`
- Use `cargo clippy -- -A warnings` to find blocking lints

### The notify! macro
### The `notify!` macro

The checker crate has the `crate::utils::notify!` macro, which can be used to trace information when the `EZNO_DEBUG` environment variable is set.

Expand Down
7 changes: 7 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions checker/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ ordered-float = "4.2.0"
map_vec = "0.3.0"

serde = { version = "1.0", features = ["derive"], optional = true }
simple-json-parser = "0.0.2"

[target.'cfg(target_family = "wasm")'.dependencies]
tsify = "0.4.5"
Expand Down
239 changes: 0 additions & 239 deletions checker/definitions/full.d.ts

This file was deleted.

Binary file modified checker/definitions/internal.ts.d.bin
Binary file not shown.
Binary file removed checker/definitions/internal.ts.d2.bin
Binary file not shown.
Loading

0 comments on commit 0fa4fa8

Please sign in to comment.