New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

amdex

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

amdex

A tool to extract and restore AMD-style JavaScript modules

  • 1.0.8
  • npm
  • Socket score

Version published
Weekly downloads
10
decreased by-47.37%
Maintainers
1
Weekly downloads
 
Created
Source

amdex

A command-line tool to extract and restore AMD-style JavaScript modules from bundled files.

Installation

npm install -g amdex
# or
pnpm add -g amdex
# or
yarn global add amdex

Usage

Restore AMD Modules

Extract and restore individual AMD modules from a bundled file:

amdex restore -i bundle.js -o ./output

Options:

  • -i, --input <path>: Input bundle file path (required)
  • -o, --output <path>: Output directory for extracted modules (default: "./restored")
  • --include <pattern>: Include only modules matching this pattern (regex)
  • --exclude <pattern>: Exclude modules matching this pattern (regex)

List Modules

List all AMD modules found in a bundle:

amdex list -i bundle.js

Options:

  • -i, --input <path>: Input bundle file path (required)

Example

Given a bundled file with AMD modules:

define('module/a', ['jquery', 'underscore'], function($, _) {
    // module code
});

define('module/b', ['module/a'], function(moduleA) {
    // module code
});

Running:

amdex restore -i bundle.js -o ./src --include "module/.*"

Will create:

src/
  module/
    a.js
    b.js

Each file will contain its original AMD module definition with dependencies and implementation code.

Features

  • Extracts AMD modules while preserving:
    • Module IDs
    • Dependencies
    • Implementation code
    • Original formatting (mostly)
  • Supports filtering modules by include/exclude patterns
  • Maintains directory structure based on module IDs
  • Handles reserved keywords in code
  • TypeScript support

Development

# Clone the repository
git clone https://github.com/yourusername/amdex.git

# Install dependencies
cd amdex
npm install

# Build
npm run build

# Run locally
./dist/cli.js

License

MIT

Keywords

FAQs

Package last updated on 13 Jan 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc