
Product
Introducing Pull Request Stories to Help Security Teams Track Supply Chain Risks
Socket’s new Pull Request Stories give security teams clear visibility into dependency risks and outcomes across scanned pull requests.
A JavaScript AST-aware diff and patch toolset
When comparing two JavaScript files, standard diff tools compare the two files line-by-line and output the lines on which the files differ. This tool does not compare the characters of the source files directly but their abstract representation - their abstract syntax trees.
JavaScript source file1 JavaScript source file2
+ +
| |
| |
| |
v v
abstract syntax tree abstract syntax tree
+ +
| |
| |
| |
v v
generated JS source file generated JS source file2
+ +
| |
| ++++ |
+---> diff <---+
----
This enables you to have more meaningfull diffs between files which may be very simmilar but have different source code formatting.
When patching, astii patch will regenerate (original --> AST --> generate) the source file and patch it with the provided diff.
npm install . -g
npm install
npm test
Usage: astii [options] [command]
Commands:
patchSafe <file1> <patchfile> apply an astii-generated diff file to an original in an AST-aware way, losing original formatting, safer
patch <file1> <patchfile> apply an astii-generated diff file to an original in an AST-aware way, preserving original formatting
diff <file1> <file2> compare AST-neutral representations of two JavaScript files line by line
git-diff <file1> <SHA> compare AST-neutral representations of a JavaScript files against its specified git revision
git-diff-version <file1> <SHA1> <SHA2> compare AST-neutral representations of a JavaScript file between two git revisions
Options:
-h, --help output usage information
-V, --version output the version number
FAQs
AST aware diff and patch
We found that astii demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket’s new Pull Request Stories give security teams clear visibility into dependency risks and outcomes across scanned pull requests.
Research
/Security News
npm author Qix’s account was compromised, with malicious versions of popular packages like chalk-template, color-convert, and strip-ansi published.
Research
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.