0.0.28 • Published 2 years ago

rewrite-exports v0.0.28

Weekly downloads
309
License
MIT
Repository
github
Last release
2 years 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

2 years ago

0.0.28

2 years ago

0.0.25

4 years ago

0.0.26

4 years ago

0.0.24

4 years ago

0.0.23

4 years ago

0.0.20

4 years ago

0.0.21

4 years ago

0.0.22

4 years ago

0.0.19

4 years ago

0.0.18

4 years ago

0.0.17

4 years ago

0.0.16

4 years ago

0.0.15

4 years ago

0.0.14

5 years ago

0.0.12

5 years ago

0.0.13

5 years ago

0.0.11

5 years ago

0.0.10

5 years ago

0.0.9

5 years ago

0.0.8

5 years ago

0.0.7

5 years ago

0.0.6

5 years ago

0.0.5

5 years ago

0.0.4

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago

0.0.1

6 years ago