@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.
Files changed (48) hide show
  1. package/README.md +101 -0
  2. package/dist/constants.js +474 -0
  3. package/dist/rollup-plugin-node-builtins.cjs.js +77 -0
  4. package/dist/rollup-plugin-node-builtins.es6.js +75 -0
  5. package/package.json +42 -0
  6. package/src/es6/assert.js +488 -0
  7. package/src/es6/console.js +13 -0
  8. package/src/es6/domain.js +100 -0
  9. package/src/es6/empty.js +1 -0
  10. package/src/es6/events.js +475 -0
  11. package/src/es6/http-lib/capability.js +52 -0
  12. package/src/es6/http-lib/request.js +278 -0
  13. package/src/es6/http-lib/response.js +185 -0
  14. package/src/es6/http-lib/to-arraybuffer.js +30 -0
  15. package/src/es6/http.js +167 -0
  16. package/src/es6/inherits.js +25 -0
  17. package/src/es6/os.js +113 -0
  18. package/src/es6/path.js +234 -0
  19. package/src/es6/punycode.js +475 -0
  20. package/src/es6/qs.js +147 -0
  21. package/src/es6/readable-stream/buffer-list.js +59 -0
  22. package/src/es6/readable-stream/duplex.js +45 -0
  23. package/src/es6/readable-stream/passthrough.js +15 -0
  24. package/src/es6/readable-stream/readable.js +896 -0
  25. package/src/es6/readable-stream/transform.js +174 -0
  26. package/src/es6/readable-stream/writable.js +483 -0
  27. package/src/es6/setimmediate.js +185 -0
  28. package/src/es6/stream.js +110 -0
  29. package/src/es6/string-decoder.js +220 -0
  30. package/src/es6/timers.js +76 -0
  31. package/src/es6/tty.js +20 -0
  32. package/src/es6/url.js +745 -0
  33. package/src/es6/util.js +598 -0
  34. package/src/es6/vm.js +202 -0
  35. package/src/es6/zlib-lib/LICENSE +21 -0
  36. package/src/es6/zlib-lib/adler32.js +31 -0
  37. package/src/es6/zlib-lib/binding.js +269 -0
  38. package/src/es6/zlib-lib/crc32.js +40 -0
  39. package/src/es6/zlib-lib/deflate.js +1862 -0
  40. package/src/es6/zlib-lib/inffast.js +325 -0
  41. package/src/es6/zlib-lib/inflate.js +1650 -0
  42. package/src/es6/zlib-lib/inftrees.js +329 -0
  43. package/src/es6/zlib-lib/messages.js +11 -0
  44. package/src/es6/zlib-lib/trees.js +1220 -0
  45. package/src/es6/zlib-lib/utils.js +73 -0
  46. package/src/es6/zlib-lib/zstream.js +28 -0
  47. package/src/es6/zlib.js +635 -0
  48. package/src/index.js +73 -0
@@ -0,0 +1,45 @@
1
+
2
+ import {inherits} from 'util';
3
+ import {nextTick} from 'process';
4
+ import {Readable} from './readable';
5
+ import {Writable} from './writable';
6
+
7
+
8
+ inherits(Duplex, Readable);
9
+
10
+ var keys = Object.keys(Writable.prototype);
11
+ for (var v = 0; v < keys.length; v++) {
12
+ var method = keys[v];
13
+ if (!Duplex.prototype[method]) Duplex.prototype[method] = Writable.prototype[method];
14
+ }
15
+ export default Duplex;
16
+ export function Duplex(options) {
17
+ if (!(this instanceof Duplex)) return new Duplex(options);
18
+
19
+ Readable.call(this, options);
20
+ Writable.call(this, options);
21
+
22
+ if (options && options.readable === false) this.readable = false;
23
+
24
+ if (options && options.writable === false) this.writable = false;
25
+
26
+ this.allowHalfOpen = true;
27
+ if (options && options.allowHalfOpen === false) this.allowHalfOpen = false;
28
+
29
+ this.once('end', onend);
30
+ }
31
+
32
+ // the no-half-open enforcer
33
+ function onend() {
34
+ // if we allow half-open state, or if the writable side ended,
35
+ // then we're ok.
36
+ if (this.allowHalfOpen || this._writableState.ended) return;
37
+
38
+ // no more data can be written.
39
+ // But allow more writes to happen in this tick.
40
+ nextTick(onEndNT, this);
41
+ }
42
+
43
+ function onEndNT(self) {
44
+ self.end();
45
+ }
@@ -0,0 +1,15 @@
1
+
2
+ import {Transform} from './transform';
3
+
4
+ import {inherits} from 'util';
5
+ inherits(PassThrough, Transform);
6
+ export default PassThrough;
7
+ export function PassThrough(options) {
8
+ if (!(this instanceof PassThrough)) return new PassThrough(options);
9
+
10
+ Transform.call(this, options);
11
+ }
12
+
13
+ PassThrough.prototype._transform = function (chunk, encoding, cb) {
14
+ cb(null, chunk);
15
+ };