py_unpack_sourcemap
Unpack JavaScript source maps into source files
Description
This Python tool allows you to extract JavaScript source files from source maps. It can be particularly useful for debugging and analyzing minified JavaScript code in production environments.
Modern browsers like Chrome and Firefox provide this functionality in DevTools. However, they only let you view the source code in the browser itself, which can be limiting. This tool allows you to extract the whole source tree for viewing it in your favourite IDE.
This projects aims to follow the
Source Map Revision 3 Proposal.
Only the sourcesContent field is currently supported.
See Roadmap for what is lacking.
Installation
Ensure you have Python 3.10 or later installed. The package is not tested on older versions, but they will probably work.
You can install the tool from PyPI using pip:
pip install py_unpack_sourcemap
Or Poetry:
poetry add py_unpack_sourcemap
Usage
As a command-line tool
python -m py_unpack_sourcemap [-h] -o OUTPUT_DIR [--overwrite] sourcemap
positional arguments:
sourcemap path to the source map (a .js.map file)
options:
-h, --help show this help message and exit
-o OUTPUT_DIR, --output-dir OUTPUT_DIR
a directory to extract source files into
--overwrite overwrite existing output directory
As a Python module
No information here yet :( Use autocompletion or view the source code.
Roadmap
This project is developed on demand. If you need a feature, submit an issue to express your interest.
- Support for fetching remote source maps via HTTP
- Support for
nullelements insourcesContentfield - More tests
- Support for
sourceRootfield - Support for
namesfield - Support for
mappingsfield - "Index map" format (
sectionsfield) - GitHub workflows for tests and publishing
Contributing
Any contributions are appreciated. Regular stuff. Don't be afraid to submit issues or PRs.
Contributors
- lonelyteapot - original author
License
This project is licensed under the MIT License.
Metadata
Release files for py_unpack_sourcemap 1.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| py_unpack_sourcemap-1.0.1.tar.gz | 4.9 kB | Without provenance | Details for py_unpack_sourcemap-1.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| py_unpack_sourcemap-1.0.1-py3-none-any.whl | Python 3 | none | any | Details for py_unpack_sourcemap-1.0.1-py3-none-any.whl |
Total release size: 11.2 kB
Release files / py_unpack_sourcemap-1.0.1.tar.gz
| Download URL | py_unpack_sourcemap-1.0.1.tar.gz |
|---|---|
| Size | 4.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a99f8a4a160dd7235360eb8fdb4dcf490fe08daa9671415610a48fe89142ace4
|
|
BLAKE2b-256 checksum How to use checksums |
38558a63aea6c9858c24e31255ec5c4ea1fc0bcb12090a399855ffe7eedc1125
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.6.1 CPython/3.11.5 Linux/6.1.60-1-lts
|
Release files / py_unpack_sourcemap-1.0.1-py3-none-any.whl
| Download URL | py_unpack_sourcemap-1.0.1-py3-none-any.whl |
|---|---|
| Size | 6.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
29b3f33a8f81a7669ee3741066414a369b08b887eaa2781780471e91b5f52090
|
|
BLAKE2b-256 checksum How to use checksums |
f55b0c370e8577e26793f09f3e461ee68b3c5dfa171687cfda318a23ebbad34c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.6.1 CPython/3.11.5 Linux/6.1.60-1-lts
|
Security for py_unpack_sourcemap 1.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.