# tapc-amd-wrap

> Wraps CommonJS files in `define(function (require, exports, module) { ... })`.

Latest version **0.1.0** (published 2016-08-01) · WTFPL license · 0 weekly downloads

## Install

```sh
npm install tapc-amd-wrap
pnpm add tapc-amd-wrap
yarn add tapc-amd-wrap
bun add tapc-amd-wrap
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.0 |
| Published | 2016-08-01 |
| First published | 2016-08-01 |
| Weekly downloads | 0 |
| License | WTFPL |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 12 |
| Author | maisui99@gmail.com |
| Maintainers | maisui99 |
| Keywords | amd, commonjs, modules, build |

## Links

- npm: https://www.npmjs.com/package/tapc-amd-wrap
- Repository: https://github.com/domenic/amd-wrap
- Homepage: https://github.com/domenic/amd-wrap#readme
- Issues: https://github.com/domenic/amd-wrap/issues
- npm.io page: https://npm.io/package/tapc-amd-wrap

## Alternatives

- [raw-loader](https://npm.io/package/raw-loader.md) — 4.3M weekly downloads
- [plop](https://npm.io/package/plop.md) — 1.4M weekly downloads
- [webpack-deadcode-plugin](https://npm.io/package/webpack-deadcode-plugin.md) — 80.3K weekly downloads
- [@storybook/preact-vite](https://npm.io/package/@storybook/preact-vite.md) — 54.2K weekly downloads
- [vite-plugin-transform](https://npm.io/package/vite-plugin-transform.md) — 2.4K weekly downloads

## Recent versions

- 0.1.0 (latest) — 2016-08-01

## README

# Simple Wrapping of CommonJS to AMD

All this module does is wrap your CommonJS modules into the [simplified CommonJS wrapper](https://github.com/amdjs/amdjs-api/wiki/AMD#simplified-commonjs-wrapping-) format, i.e.:

```js
define(function (require, exports, module) {
    // your CommonJS code here
});
```

It takes in a string and gives back a string:

```js
var amdWrap = require("amd-wrap");

// wrap define around string
var wrapped = amdWrap("module.exports = 5;");

// wrap define around the string from file
var wrapThis = amdWrap(fs.readFileSync(__filename));

// wrap define and moduleName
var wrapped = amdWrap("moduleName","module.exports = 5;");

// wrap define with moduleName and requires
var wrapped = amdWrap("moduleName","module.exports = 5;", ["moduleName1"]);
```

Line numbers will line up, although the first column will be shifted by
`"define (function (require, exports, module) {".length` characters.

See also: [amd-wrap-legacy](https://www.npmjs.com/package/amd-wrap-legacy), which has a few more affordances for use when transitioning a larger codebase from CommonJS to AMD.

---
_Source: https://npm.io/package/tapc-amd-wrap · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
