<commit_before>## re-define
Let's `re-define` something ... without any configuration ... just do the magic for me.

Easy way to convert AMD and CommonJS projects to one plain javascript bundle wrapped in `UMD`.

### Why
* to get decent encapsulation, registering a bundle not a part
* to make project compatibile across node and web without effort

### Features
* highly customizable: templates, transforms (like with browserify), discoverable folders
* now also resolving modules dependencies
* looking for dependencies in `node_modules` and `bower_components`
* resolving whole dependencies trees as well as single file
* handlebars for templating with custom helpers
* resolving AMD !text plugin within `cjs` and `amd` code
* using `vinyl`, integration with `gulp` should be easy
* (WiP) detailed report, to get whole picture, display modules, dependencies and externals

### Limitation
* does not resolve circular dependencies, and won't be

### Getting Started
Install the module: `npm install -g re-define`

###Usage
```
Usage: re-define [options]

Options:
  '-t, --transform [libs]'      , 'Custom transforms stream invoked for each module'
  '-m, --main [filepath]'       , 'Main file'
  '-b, --base [dir]'            , 'CWD'
  '-e, --external [json]'       , 'Exact dep locations, when discoverable is not enough'
  '-g, --globals [module#as]'   , 'Global reference to external libs'
  '-w, --wrapper [type]'        , 'Wrapper type report, default: umd'
  '-n, --name [module]'         , 'Module name'
  '-r, --returns [module]'      , 'What module returns'
  '-e, --exclude-deps [deps]'   , 'Exclude deps'
```

#### Example usage
check [example folder](re-define/example) and appropriate build files

#### Debbuging
To run `re-define` in debug mode is fairly easy, just run `re-define` with appropriate category like below

```
//all
DEBUG=re-define:* 

//specific:
re-define:transform:* 
re-define:converter
re-define:bin
```

###Config
```js
  { cwd          : '.'
  , name         : 'module_name'
  , wrapper      : 'umd'
  , returns      : ''
  , excludeDeps  : ['\.css$', 'require', 'modules', 'exports']
  , globals      : [] //external module_name#global_ref
  , external     : {} //{"jquery": "location"} or {"..": "{path: "...", cwd: "..."}
  , discoverable : ['node_modules', 'bower_component']
  , descriptors  : ['package.json', 'bower.json']
  , plugins      : [{extension: '.html', pattern : '^(text\/?)*!'}]
  , escape       : function (val) { return val.replace(/\.\/|\!|\.|\/|\\|-/g, '_') }
  , scopeVar     : '_scope_'<commit_msg>fixing path<commit_after>## re-define
Let's `re-define` something ... without any configuration ... just do the magic for me.

Easy way to convert AMD and CommonJS projects to one plain javascript bundle wrapped in `UMD`.

### Why
* to get decent encapsulation, registering a bundle not a part
* to make project compatibile across node and web without effort

### Features
* highly customizable: templates, transforms (like with browserify), discoverable folders
* now also resolving modules dependencies
* looking for dependencies in `node_modules` and `bower_components`
* resolving whole dependencies trees as well as single file
* handlebars for templating with custom helpers
* resolving AMD !text plugin within `cjs` and `amd` code
* using `vinyl`, integration with `gulp` should be easy
* (WiP) detailed report, to get whole picture, display modules, dependencies and externals

### Limitation
* does not resolve circular dependencies, and won't be

### Getting Started
Install the module: `npm install -g re-define`

###Usage
```
Usage: re-define [options]

Options:
  '-t, --transform [libs]'      , 'Custom transforms stream invoked for each module'
  '-m, --main [filepath]'       , 'Main file'
  '-b, --base [dir]'            , 'CWD'
  '-e, --external [json]'       , 'Exact dep locations, when discoverable is not enough'
  '-g, --globals [module#as]'   , 'Global reference to external libs'
  '-w, --wrapper [type]'        , 'Wrapper type report, default: umd'
  '-n, --name [module]'         , 'Module name'
  '-r, --returns [module]'      , 'What module returns'
  '-e, --exclude-deps [deps]'   , 'Exclude deps'
```

#### Example usage
check [example folder](example) and appropriate build files

#### Debbuging
To run `re-define` in debug mode is fairly easy, just run `re-define` with appropriate category like below

```
//all
DEBUG=re-define:* 

//specific:
re-define:transform:* 
re-define:converter
re-define:bin
```

###Config
```js
  { cwd          : '.'
  , name         : 'module_name'
  , wrapper      : 'umd'
  , returns      : ''
  , excludeDeps  : ['\.css$', 'require', 'modules', 'exports']
  , globals      : [] //external module_name#global_ref
  , external     : {} //{"jquery": "location"} or {"..": "{path: "...", cwd: "..."}
  , discoverable : ['node_modules', 'bower_component']
  , descriptors  : ['package.json', 'bower.json']
  , plugins      : [{extension: '.html', pattern : '^(text\/?)*!'}]
  , escape       : function (val) { return val.replace(/\.\/|\!|\.|\/|\\|-/g, '_') }
  , scopeVar     : '_scope_'
{'fraction_non_alphanumeric': 0.15544244322631168, 'fraction_numerical': 0.0, 'mean_word_length': 3.3296610169491525, 'pattern_counts': {'":': 4, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4165927', 'n_tokens_mistral': 1581, 'n_tokens_neox': 1516, 'n_words': 550}