Repository

sourcemap

Generate source maps.

Installation

v install aheissenberger.sourcemap

Usage

Generator

    mut sg := generate_empty_map() or { panic('broken') }
    mut sm := sg.add_map('hello.js', '/', 0, 0)
    sm.add_mapping('hello.v', SourcePosition{
        source_line: 0
        source_column: 0
    }, 1, 1, '')
    sm.add_mapping('hello_lib1.v', SourcePosition{
        source_line: 0
        source_column: 0
    }, 2, 1, '')
    sm.add_mapping('hello_lib2.v', SourcePosition{
        source_line: 0
        source_column: 0
    }, 3, 1, '')
    json_data := sm.to_json()

    expected := '{"version":3,"file":"hello.js","sourceRoot":"\\/","sources":["hello.v","hello_lib1.v","hello_lib2.v"],"sourcesContent":[null,null,null],"names":[],"mappings":"CA+\\/\\/\\/\\/\\/HA;CCAA;CCAA"}'
    assert json_data.str() == expected

Consumer

not implemented

API Documentation

auto generated documentation (created v doc -f md -m . -o . )

Roadmap

  • implement consumer
  • performance benchmark
  • rewrite with streaming to IO

Contribution

Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

License

Distributed under the "bsd-2-clause" License. See LICENSE.txt for more information.

About

0
68
1 year ago

Author

aheissenberger