0.0.28 • Published 10 months ago

rewrite-exports v0.0.28

Weekly downloads
309
License
MIT
Repository
github
Last release
10 months ago

rewrite-exports Build status

Transforms various export statements into module.exports definitions, using regular expressions.

Heavily inspired by rewrite-imports and meant to be complementary!

Install

$ npm install --save rewrite-exports

Usage

const  rExports  =  require('rewrite-exports');

rExports('export default 42');
//=> module.exports = 42

rExports('export default function () {  }');
//=> module.exports = function () {  }

rExports('export { default } from "./src";', 'foo', 'bar');
//=> foo = bar("./src");

Examine the test.js file to see all supported variations.

API

rExports(input[, ctx[, fn, x]])

input

Type: String

The export statement(s) or the code containing export statement(s).

See MDN for valid export statement syntax.

ctx

Type: String

Variable name for exporting symbols, default is module.exports.

fn

Type: String Function name when re-exporting symbols, default is require.

x

Type: String Function name for extending from symbols, default is Object.assign.

0.0.27

11 months ago

0.0.28

10 months ago

0.0.25

3 years ago

0.0.26

3 years ago

0.0.24

3 years ago

0.0.23

3 years ago

0.0.20

3 years ago

0.0.21

3 years ago

0.0.22

3 years ago

0.0.19

3 years ago

0.0.18

3 years ago

0.0.17

3 years ago

0.0.16

3 years ago

0.0.15

3 years ago

0.0.14

3 years ago

0.0.12

3 years ago

0.0.13

3 years ago

0.0.11

3 years ago

0.0.10

3 years ago

0.0.9

3 years ago

0.0.8

3 years ago

0.0.7

3 years ago

0.0.6

3 years ago

0.0.5

3 years ago

0.0.4

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago

0.0.1

5 years ago