Skip to main content

Recovers uncompiled TypeScript sources from Webpack sourcemaps. A fork of rarecoil's work.

Project description

unwebpack-sourcemap

Recover uncompiled TypeScript sources, JSX, and more from Webpack sourcemaps.

This is a Python command line application that parses Webpack sourcemaps and returns uncompiled TypeScript sources.

unwebpack-sourcemap can process source maps on the local filesystem, or it can discover source maps on a remote website.

Introduction

If you're unfamiliar with source maps, you can read:

Installation

1. Create a new Python virtualenv in a directory named venv.

python3 -m venv venv

2. Activate the virtualenv.

source venv/bin/activate

3. Install unwebpack-sourcemap from PyPI.

python3 -m pip install unwebpack-sourcemap

Note: unwebpack-sourcemap comes with Python dependencies that may conflict with the dependencies in your system installation of Python. That is why it is important to always install unwebpack-sourcemap inside of a virtualenv, which won't make any changes to your surrounding system.

4. Try running unwebpack-sourcemap.

unwebpack-sourcemap --help

The below examples assume that you are inside of an activated virtualenv.

If you have installed unwebpack-sourcemap in a virtualenv, but want to avoid activating it, you can find the unwebpack-sourcemap command in the location venv/bin/unwebpack-sourcemap.

Usage

These examples use the --make-directory flag to create a subdirectory named output_dir. You can omit the --make-directory if you want to use an existing empty directory.

Example #1: Unpacking a sourcemap on the local filesystem

unwebpack-sourcemap --make-directory --local /path/to/source.map output_dir

Example #2: Unpacking a sourcemap on a remote website

unwebpack-sourcemap --make-directory https://pathto.example.com/source.map output_dir

Example #3: Unpacking a sourcemap on a remote website (with autodetection)

To attempt to read all <script src> on an HTML page, fetch JS assets, look for sourceMappingURI, and pull sourcemaps from remote sources:

This will:

  1. read all of the <script src=> tags on an HTML page
  2. fetch JavaScript assets
  3. look for sourceMappingURI and pull the sourcemaps that are found.

To do this, the command is:

unwebpack-sourcemap --make-directory --detect https://pathto.example.com/spa_root/ output_dir

License and credit

unwebpack-sourcemap was originally published by rarecoil under the MIT license. rarecoil has also published a blog post explaining the design and functionality of the original version of unwebpack-sourcemap.

This repository is a fork of unwebpack-sourcemap maintained by James Mishra and packaged for PyPI.

This repository is also licensed under the MIT license.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

unwebpack_sourcemap-0.0.3.tar.gz (7.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

unwebpack_sourcemap-0.0.3-py3-none-any.whl (8.1 kB view details)

Uploaded Python 3

File details

Details for the file unwebpack_sourcemap-0.0.3.tar.gz.

File metadata

  • Download URL: unwebpack_sourcemap-0.0.3.tar.gz
  • Upload date:
  • Size: 7.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.3.2 CPython/3.8.16 Linux/5.15.0-1031-azure

File hashes

Hashes for unwebpack_sourcemap-0.0.3.tar.gz
Algorithm Hash digest
SHA256 14d19d0a6cb74693b97f1f3a0c9a885c6391103a5facc32b78ccbe6e062437a6
MD5 de1d182739c361dfdeffbb96815b1fb0
BLAKE2b-256 d116351e7e47286dde13583f5b748dfc357125ea0a27f7fa03c3ea1f0a8abd59

See more details on using hashes here.

File details

Details for the file unwebpack_sourcemap-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: unwebpack_sourcemap-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 8.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.3.2 CPython/3.8.16 Linux/5.15.0-1031-azure

File hashes

Hashes for unwebpack_sourcemap-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 f51b6bd390cd4a5706e320a0829974501f0cfbdc71ce828be17b8d5b3620f765
MD5 347d5f264003f9779e7df24754c3f5cf
BLAKE2b-256 5a1a1f832c8805ca13e1f222ee0796c0f1597426712093319e75cce682ec7ee8

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page