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.
Fixes #34
Built on top of #35 -- I couldn't get project to compile without this
You can run the test with
npm run unittest -- -g 'does not run out of memory'
Note that there is also a lot of memory being consumed by fsExtra in
CodeBlockExtractor
when reading an entire file into memory. We could speed things up and use much less memory if we used some sort ofreadline
approach to reading the markdown code blocks, and emitted them with an async iterator as they pop up.I went ahead with the
CodeBlockExtractor
change.. it speeds things up a bit and should allow for much larger files to be read a little more safely, but can remove from this PR if desired. check the stats fromhyperfine
run below.NOTE that in the below hyperfine tests, the memory test removed so test speeds are a little more accurate.
How I changed the solution to #30 (previously fixed by #33):
Wrap all functions that should be able to be wrapped in an IIFE without error in a named IIFE, and to ensure line number accuracy for errors, recognize that if the code block is wrapped.
It's possible that someone may want to completely prevent this behavior for some reason, so I would propose a
<!-- ts-docs-verifier:no-wrap -->
or// ts-docs-verifier:no-wrap
pragma in order to allow for escaping this new behavior if desired.