Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/johnfairh/sourcemapper
Create and edit Source Maps in Swift
https://github.com/johnfairh/sourcemapper
json linux macos sourcemap swift
Last synced: about 1 month ago
JSON representation
Create and edit Source Maps in Swift
- Host: GitHub
- URL: https://github.com/johnfairh/sourcemapper
- Owner: johnfairh
- License: mit
- Created: 2021-04-01T16:06:48.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2024-09-19T09:54:42.000Z (5 months ago)
- Last Synced: 2025-01-11T09:12:41.251Z (about 1 month ago)
- Topics: json, linux, macos, sourcemap, swift
- Language: Swift
- Homepage:
- Size: 771 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README

[](https://codecov.io/gh/johnfairh/SourceMapper)
# SourceMapper
Simple Swift implementation of the
[SourceMap](https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k)
specification: create, load, query, modify, and save source maps.## Examples
```swift
let map = try SourceMap(Data(contentsOf: mapURL))
print(map.file)let unpackedMap = try UnpackedSourceMap(map)
let segment = unpackedMap.map(line: 12, column: 0)
``````swift
var map = SourceMap()
map.sources = [.remote("a.scss")]
map.sourceRoot = "./../src/"
try map.set(segments: ..., validate: true)
let mapData = map.encode()
```## Documentation
* [API documentation](https://johnfairh.github.io/SourceMapper/)
* [Dash docset](https://johnfairh.github.io/SourceMapper/docsets/SourceMapper.tgz)No support for:
* Extension fields
* Index map format## Requirements
* Swift 6.0
* macOS 14 (tested on macOS 14.6.1 IA64)
* Linux (tested on Ubuntu 18.04.5)
* Windows 10, Swift 6.0 (tested in CI only)## Installation
Only with Swift Package Manager, via Xcode or directly:
Package dependency:
```swift
.package(name: "SourceMapper",
url: "https://github.com/johnfairh/SourceMapper.git",
from: "3.0.0")
```## Contributions
Welcome: open an issue / [email protected] / @[email protected]
## License
Distributed under the MIT license.