@mehmetb/rollup-plugin-node-builtins 3.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +101 -0
- package/dist/constants.js +474 -0
- package/dist/rollup-plugin-node-builtins.cjs.js +77 -0
- package/dist/rollup-plugin-node-builtins.es6.js +75 -0
- package/package.json +42 -0
- package/src/es6/assert.js +488 -0
- package/src/es6/console.js +13 -0
- package/src/es6/domain.js +100 -0
- package/src/es6/empty.js +1 -0
- package/src/es6/events.js +475 -0
- package/src/es6/http-lib/capability.js +52 -0
- package/src/es6/http-lib/request.js +278 -0
- package/src/es6/http-lib/response.js +185 -0
- package/src/es6/http-lib/to-arraybuffer.js +30 -0
- package/src/es6/http.js +167 -0
- package/src/es6/inherits.js +25 -0
- package/src/es6/os.js +113 -0
- package/src/es6/path.js +234 -0
- package/src/es6/punycode.js +475 -0
- package/src/es6/qs.js +147 -0
- package/src/es6/readable-stream/buffer-list.js +59 -0
- package/src/es6/readable-stream/duplex.js +45 -0
- package/src/es6/readable-stream/passthrough.js +15 -0
- package/src/es6/readable-stream/readable.js +896 -0
- package/src/es6/readable-stream/transform.js +174 -0
- package/src/es6/readable-stream/writable.js +483 -0
- package/src/es6/setimmediate.js +185 -0
- package/src/es6/stream.js +110 -0
- package/src/es6/string-decoder.js +220 -0
- package/src/es6/timers.js +76 -0
- package/src/es6/tty.js +20 -0
- package/src/es6/url.js +745 -0
- package/src/es6/util.js +598 -0
- package/src/es6/vm.js +202 -0
- package/src/es6/zlib-lib/LICENSE +21 -0
- package/src/es6/zlib-lib/adler32.js +31 -0
- package/src/es6/zlib-lib/binding.js +269 -0
- package/src/es6/zlib-lib/crc32.js +40 -0
- package/src/es6/zlib-lib/deflate.js +1862 -0
- package/src/es6/zlib-lib/inffast.js +325 -0
- package/src/es6/zlib-lib/inflate.js +1650 -0
- package/src/es6/zlib-lib/inftrees.js +329 -0
- package/src/es6/zlib-lib/messages.js +11 -0
- package/src/es6/zlib-lib/trees.js +1220 -0
- package/src/es6/zlib-lib/utils.js +73 -0
- package/src/es6/zlib-lib/zstream.js +28 -0
- package/src/es6/zlib.js +635 -0
- package/src/index.js +73 -0
@@ -0,0 +1,73 @@
|
|
1
|
+
'use strict';
|
2
|
+
|
3
|
+
|
4
|
+
var TYPED_OK = (typeof Uint8Array !== 'undefined') &&
|
5
|
+
(typeof Uint16Array !== 'undefined') &&
|
6
|
+
(typeof Int32Array !== 'undefined');
|
7
|
+
|
8
|
+
|
9
|
+
export function assign(obj /*from1, from2, from3, ...*/) {
|
10
|
+
var sources = Array.prototype.slice.call(arguments, 1);
|
11
|
+
while (sources.length) {
|
12
|
+
var source = sources.shift();
|
13
|
+
if (!source) { continue; }
|
14
|
+
|
15
|
+
if (typeof source !== 'object') {
|
16
|
+
throw new TypeError(source + 'must be non-object');
|
17
|
+
}
|
18
|
+
|
19
|
+
for (var p in source) {
|
20
|
+
if (source.hasOwnProperty(p)) {
|
21
|
+
obj[p] = source[p];
|
22
|
+
}
|
23
|
+
}
|
24
|
+
}
|
25
|
+
|
26
|
+
return obj;
|
27
|
+
}
|
28
|
+
|
29
|
+
|
30
|
+
// reduce buffer size, avoiding mem copy
|
31
|
+
export function shrinkBuf(buf, size) {
|
32
|
+
if (buf.length === size) { return buf; }
|
33
|
+
if (buf.subarray) { return buf.subarray(0, size); }
|
34
|
+
buf.length = size;
|
35
|
+
return buf;
|
36
|
+
}
|
37
|
+
export function arraySet(dest, src, src_offs, len, dest_offs) {
|
38
|
+
if (src.subarray && dest.subarray) {
|
39
|
+
dest.set(src.subarray(src_offs, src_offs + len), dest_offs);
|
40
|
+
return;
|
41
|
+
}
|
42
|
+
// Fallback to ordinary array
|
43
|
+
for (var i = 0; i < len; i++) {
|
44
|
+
dest[dest_offs + i] = src[src_offs + i];
|
45
|
+
}
|
46
|
+
}
|
47
|
+
export function flattenChunks(chunks) {
|
48
|
+
var i, l, len, pos, chunk, result;
|
49
|
+
|
50
|
+
// calculate data length
|
51
|
+
len = 0;
|
52
|
+
for (i = 0, l = chunks.length; i < l; i++) {
|
53
|
+
len += chunks[i].length;
|
54
|
+
}
|
55
|
+
|
56
|
+
// join chunks
|
57
|
+
result = new Uint8Array(len);
|
58
|
+
pos = 0;
|
59
|
+
for (i = 0, l = chunks.length; i < l; i++) {
|
60
|
+
chunk = chunks[i];
|
61
|
+
result.set(chunk, pos);
|
62
|
+
pos += chunk.length;
|
63
|
+
}
|
64
|
+
|
65
|
+
return result;
|
66
|
+
}
|
67
|
+
|
68
|
+
|
69
|
+
export var Buf8 = Uint8Array;
|
70
|
+
export var Buf16 = Uint16Array;
|
71
|
+
export var Buf32 = Int32Array;
|
72
|
+
// Enable/Disable typed arrays use, for testing
|
73
|
+
//
|
@@ -0,0 +1,28 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
function ZStream() {
|
4
|
+
/* next input byte */
|
5
|
+
this.input = null; // JS specific, because we have no pointers
|
6
|
+
this.next_in = 0;
|
7
|
+
/* number of bytes available at input */
|
8
|
+
this.avail_in = 0;
|
9
|
+
/* total number of input bytes read so far */
|
10
|
+
this.total_in = 0;
|
11
|
+
/* next output byte should be put there */
|
12
|
+
this.output = null; // JS specific, because we have no pointers
|
13
|
+
this.next_out = 0;
|
14
|
+
/* remaining free space at output */
|
15
|
+
this.avail_out = 0;
|
16
|
+
/* total number of bytes output so far */
|
17
|
+
this.total_out = 0;
|
18
|
+
/* last error message, NULL if no error */
|
19
|
+
this.msg = ''/*Z_NULL*/;
|
20
|
+
/* not visible by applications */
|
21
|
+
this.state = null;
|
22
|
+
/* best guess about the data type: binary or text */
|
23
|
+
this.data_type = 2/*Z_UNKNOWN*/;
|
24
|
+
/* adler32 value of the uncompressed data */
|
25
|
+
this.adler = 0;
|
26
|
+
}
|
27
|
+
|
28
|
+
export default ZStream;
|