forked from AssemblyScript/assemblyscript
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnode.js
34 lines (30 loc) · 724 Bytes
/
node.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
/**
* @fileoverview Node.js polyfills.
* @license Apache-2.0
*/
export const isNode = Object.prototype.toString.call(typeof globalThis.process !== 'undefined' ? globalThis.process : 0) === '[object process]';
var fs;
var module;
var path;
var process;
var url;
if (isNode) {
fs = await import("fs");
module = await import("module");
path = await import("path");
process = globalThis.process;
url = await import("url");
} else {
fs = await import("./browser/fs.js");
module = await import("./browser/module.js");
path = await import("./browser/path.js");
process = await import("./browser/process.js");
url = await import("./browser/url.js");
}
export {
fs,
module,
path,
process,
url
};