-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
meson: add script to fix up sourcemap by adding sourceRoot
- Loading branch information
1 parent
7ab31fd
commit ba9b0be
Showing
3 changed files
with
29 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#!/usr/bin/env python3 | ||
|
||
import json | ||
from argparse import ArgumentParser, FileType | ||
|
||
|
||
def main(): | ||
parser = ArgumentParser() | ||
parser.add_argument( | ||
"sourcemap", | ||
type=FileType("r+", encoding="utf-8"), | ||
help="The sourcemap to modify", | ||
) | ||
parser.add_argument("base_url", help="The sourceRoot URL") | ||
args = parser.parse_args() | ||
|
||
content = json.load(args.sourcemap) | ||
if content["version"] < 3: | ||
raise ValueError("Sourcemap version 2 and lower is not supported") | ||
content["sourceRoot"] = args.base_url | ||
args.sourcemap.seek(0) | ||
json.dump(content, args.sourcemap) | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters