Socket
Book a DemoInstallSign in
Socket

astii

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

astii

AST aware diff and patch

0.1.1
latest
Source
npmnpm
Version published
Maintainers
1
Created
Source

astii

NPM

Build Status Coverage Status Dependency Status

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.

installation:

npm install . -g

Tests

npm install

npm test

usage

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

Package last updated on 06 Aug 2015

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.