-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathenvironment.ts
49 lines (39 loc) · 1.18 KB
/
environment.ts
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
/*!
* @author electricessence / https://github.com/electricessence/
* Licensing: MIT https://github.com/electricessence/TypeScript.NET-Core/blob/master/LICENSE.md
*/
/* eslint-disable no-empty */
declare const process: any;
// Need to spoof this so WebPack doesn't panic (warnings).
let r: any;
try
{ r = eval('require'); }
catch(ex)
{}
export const
isCommonJS: boolean
= !!(r && r.resolve);
export const
isRequireJS: boolean
= !!(r && r.toUrl && r.defined);
/*
* Ensure is in a real Node environment, with a `process.nextTick`.
* To see through fake Node environments:
* Mocha test runner - exposes a `process` global without a `nextTick`
* Browserify - exposes a `process.nexTick` function that uses
* `setTimeout`. In this case `setImmediate` is preferred because
* it is faster. Browserify's `process.toString()` yields
* "[object Object]", while in a real Node environment
* `process.nextTick()` yields "[object process]".
*/
export const
isNodeJS: boolean
= typeof process=='object'
&& process.toString()==='[object process]'
&& process.nextTick!= void 0;
declare const exports: any;
//noinspection JSUnusedAssignment
try
{ Object.freeze(exports); }
catch(ex)
{ }