ilhamgusti / moduleRaid

:gift: Taking apart webpackJsonp

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

moduleRaid

moduleRaid is a utility to get modules and module constructors from webpackJsonp functions (or similar endpoints) embedded on websites by Webpack. It also provides functions to search through returned modules.

Installation

You can get moduleRaid over npm

$ npm install moduleraid

Or if you directly want to use it in the browser

<script src="https://unpkg.com/moduleraid/dist/moduleraid.iife.js"></script>

Or alternatively, just copy the contents from above unpkg link into the devtools console on a website!

Usage

Preparation

Using moduleRaid as a module, simply require and execute it somewhere where it will end up as a public facing script on a page that also includes a Webpack build!

import ModuleRaid from 'moduleRaid'

const mR = new ModuleRaid()

Examples

Now, with the mR instance available and modules being fetched, you can use the two available find*() methods to search for modules!

let results = mR.findModule('coolFeature')
// => Array of fitting modules for the search query

let constRes = mR.findConstructor('_internal')
// => Array of fitting constructor/module tuples for the search query

For more in-depth documentation around what you can use of moduleRaid, you can visit the API Documentation!

Special Thanks

License

moduleRaid is licensed under the MIT License

About

:gift: Taking apart webpackJsonp

License:MIT License


Languages

Language:TypeScript 97.0%Language:JavaScript 3.0%