# @llllvvuu/dl-webapp-sources

> Create source code directory from a list of .js and .js.map URLs

Latest version **0.1.8** (published 2023-09-06) · ISC license · 0 weekly downloads

## Install

```sh
npm install @llllvvuu/dl-webapp-sources
pnpm add @llllvvuu/dl-webapp-sources
yarn add @llllvvuu/dl-webapp-sources
bun add @llllvvuu/dl-webapp-sources
```

Provides the command `dl-webapp-sources`.

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.8 |
| Published | 2023-09-06 |
| First published | 2023-09-04 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 3 |
| Unpacked size | 90.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 6 |
| Author | @llllvvuu |
| Maintainers | llllvvuu |
| Keywords | reverse, engineering, reverse engineering, sourcemaps |

## Links

- npm: https://www.npmjs.com/package/@llllvvuu/dl-webapp-sources
- Repository: https://github.com/llllvvuu/dl-webapp-sources
- Homepage: https://github.com/llllvvuu/dl-webapp-sources#readme
- Issues: https://github.com/llllvvuu/dl-webapp-sources/issues
- npm.io page: https://npm.io/package/@llllvvuu/dl-webapp-sources

## Dependencies (3)

- [axios](https://npm.io/package/axios.md) ^1.5.0
- [commander](https://npm.io/package/commander.md) ^11.0.0
- [source-map](https://npm.io/package/source-map.md) ^0.7.4

## Alternatives

- [jsforce](https://npm.io/package/jsforce.md) — 851.2K weekly downloads
- [react-native-qrcode-svg](https://npm.io/package/react-native-qrcode-svg.md) — 693.5K weekly downloads
- [@salesforce/plugin-data](https://npm.io/package/@salesforce/plugin-data.md) — 394.9K weekly downloads
- [@backstage/plugin-search-common](https://npm.io/package/@backstage/plugin-search-common.md) — 308.5K weekly downloads
- [@chain-registry/types](https://npm.io/package/@chain-registry/types.md) — 38.4K weekly downloads

## Recent versions

- 0.1.8 (latest) — 2023-09-06
- 0.1.7 — 2023-09-04
- 0.1.6 — 2023-09-04
- 0.1.5 — 2023-09-04
- 0.1.4 — 2023-09-04
- 0.1.3 — 2023-09-04
- 0.1.2 — 2023-09-04
- 0.1.1 — 2023-09-04
- 0.1.0 — 2023-09-04

## README

# Download original source code from public sourcemaps

Get original JavaScript/TypeScript files/project layout:
```sh
dl-webapp-sources -o my-react-app \
  https://app.com/chunk1.js https://app.com/chunk2.js.map localChunk.js localMap.js.map ...
```

- [x] sanitize output paths / pad relative parents
- [x] .js arguments
- [x] .js.map arguments
- [x] URL arguments
- [x] filename arguments
- [x] `sourceMappingURL=data:...`
- [x] `sourceMappingURL=file:...`
- [x] `sourceMappingURL=http...`
- [x] `sourceMappingURL=<relativepath>`
- [x] guess `sourceMappingURL` by adding `.map` (find sources that Chrome misses)
- [x] lookup from `sourcesContent`
- [x] lookup from `sources` paths

## Installation

```sh
npm install -g @llllvvuu/dl-webapp-sources
```

## CLI Usage

Automated crawler may not pass auth, and it may also miss asynchronously loaded JS. But, you can get a list of loaded JS files by manually logging in.

After logging in, paste into the console:

```javascript
performance
  .getEntriesByType("resource")
  .map(resource => resource.name)
  .filter(name => name.endsWith(".js"))
  .map(name => `"${name}"`)
  .join(" ")
```

This gives you the CLI args for:

```sh
dl-webapp-sources ${JS_URLS} -o ${OUTPUT_DIRECTORY}
```

If you got anything interesting, go back and click around the app to load all of the chunks (if it's a SPA), and repeat.

Now you can try to add some `create-react-app` or `create-next-app` boilerplate to try to get the app to build.

> ⚠️  Sometimes `axios` gets 403; I will try to fix this if I have time, but in the meantime you can get around this by manually downloading .js.map from the browser and passing the local filepath into the CLI.

> ⚠️  Some sites clear the performance timeline, so the performance API won't list all of the JS files. If this happens you can try another method to get the list of JS files.

## Library Usage

See the API reference at [markdown/dl-webapp-sources.md](./markdown/dl-webapp-sources.md).

## Motivation

I created this solution since neither [denands/sourcemapper](https://github.com/denandz/sourcemapper), [tehryanx/sourcemapper](https://github.com/tehryanx/sourcemapper), nor [paazmaya/shuji](https://github.com/paazmaya/shuji) accept a list of multiple JS files, which is quite common with chunked webapps.

[jonluca/source-map-cloner](https://github.com/jonluca/source-map-cloner) is a solution for crawling an HTML page.

`dl-webapp-sources` leaves auth/crawling to the user. It accepts a list of .js or .js.map.

Sometimes it can find sources that Google Chrome misses.

## Credits

- [denands/sourcemapper](https://github.com/denandz/sourcemapper)
- [tehryanx/sourcemapper](https://github.com/tehryanx/sourcemapper)
- [jonluca/source-map-cloner](https://github.com/jonluca/source-map-cloner)
- [paazmaya/shuji](https://github.com/paazmaya/shuji)
- [webpack-contrib/source-map-loader](https://github.com/webpack-contrib/source-map-loader)
- [User Pingolin on StackOverflow](https://stackoverflow.com/a/62640158/5938726)

---
_Source: https://npm.io/package/@llllvvuu/dl-webapp-sources · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
