Swiftpack.co - johnfairh/SourceMapper as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by johnfairh.
johnfairh/SourceMapper 2.0.0
Create and edit Source Maps in Swift
⭐️ 2
🕓 51 weeks ago
.package(url: "https://github.com/johnfairh/SourceMapper.git", from: "2.0.0")

Platforms codecov Tests

SourceMapper

Simple Swift implementation of the SourceMap specification: create, load, query, modify, and save source maps.

Examples

let map = try SourceMap(Data(contentsOf: mapURL))
print(map.file)

let unpackedMap = try UnpackedSourceMap(map)
let segment = unpackedMap.map(line: 12, column: 0)
var map = SourceMap()
map.sources = [.remote("a.scss")]
map.sourceRoot = "./../src/"
try map.set(segments: ..., validate: true)
let mapData = map.encode()

Documentation

No support for:

  • Extension fields
  • Index map format

Requirements

  • Swift 5.7
  • macOS 10.10 (tested on macOS 12.0 IA64)
  • Linux (tested on Ubuntu 18.04.5)
  • Windows 10, Swift 5.7 (tested in CI only)

Installation

Only with Swift Package Manager, via Xcode or directly:

Package dependency:

.package(name: "SourceMapper",
         url: "https://github.com/johnfairh/SourceMapper.git",
         from: "2.0.0")

Contributions

Welcome: open an issue / [email protected] / @[email protected]

License

Distributed under the MIT license.

GitHub

link
Stars: 2
Last commit: 1 week ago
Advertisement: IndiePitcher.com - Cold Email Software for Startups

Release Notes

2.0.0
52 weeks ago

Restructure to work properly with Swift concurrency.

Split the SourceMap class into two Sendable structures SourceMap and the immutable UnpackedSourceMap.

The UnpackedSourceMap type is the new home for the map(...) method on a segment cache.

Move index validation and cross-checks to the point of assigning the segments rather than serialising the source map.

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics