-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathutils.js
50 lines (39 loc) · 1.16 KB
/
utils.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
'use strict'
/**
* Module dependencies
*/
var utils = require('lazy-cache')(require)
/**
* Temporarily re-assign `require` to trick browserify and
* webpack into reconizing lazy dependencies.
*
* This tiny bit of ugliness has the huge dual advantage of
* only loading modules that are actually called at some
* point in the lifecycle of the application, whilst also
* allowing browserify and webpack to find modules that
* are depended on but never actually called.
*/
var fn = require
require = utils // eslint-disable-line no-undef, no-native-reassign, no-global-assign
/**
* Lazily required module dependencies
*/
require('co')
require('is-es6-generator-function', 'isGenFn')
require('native-or-another')
require('relike')
require('sliced')
/**
* Restore `require`
*/
require = fn // eslint-disable-line no-undef, no-native-reassign, no-global-assign
utils.normalizePromise = function normalizePromise (promise, Promize) {
promise.Promise = Promize
promise.___customPromise = promise.Promise.___customPromise
promise.___bluebirdPromise = promise.Promise.___bluebirdPromise
return promise
}
/**
* Expose `utils` modules
*/
module.exports = utils