polyfills.js 3.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. "use strict";
  2. // Taken from https://github.com/ionic-team/rollup-plugin-node-polyfills/blob/master/src/modules.ts
  3. Object.defineProperty(exports, "__esModule", { value: true });
  4. exports.builtinsPolyfills = void 0;
  5. const EMPTY_PATH = require.resolve('rollup-plugin-node-polyfills/polyfills/empty.js');
  6. function builtinsPolyfills() {
  7. const libs = new Map();
  8. libs.set('process', require.resolve('rollup-plugin-node-polyfills/polyfills/process-es6'));
  9. libs.set('buffer', require.resolve('rollup-plugin-node-polyfills/polyfills/buffer-es6'));
  10. libs.set('util', require.resolve('rollup-plugin-node-polyfills/polyfills/util'));
  11. libs.set('sys', libs.get('util'));
  12. libs.set('events', require.resolve('rollup-plugin-node-polyfills/polyfills/events'));
  13. libs.set('stream', require.resolve('rollup-plugin-node-polyfills/polyfills/stream'));
  14. libs.set('path', require.resolve('rollup-plugin-node-polyfills/polyfills/path'));
  15. libs.set('querystring', require.resolve('rollup-plugin-node-polyfills/polyfills/qs'));
  16. libs.set('punycode', require.resolve('rollup-plugin-node-polyfills/polyfills/punycode'));
  17. libs.set('url', require.resolve('rollup-plugin-node-polyfills/polyfills/url'));
  18. libs.set('string_decoder', require.resolve('rollup-plugin-node-polyfills/polyfills/string-decoder'));
  19. libs.set('http', require.resolve('rollup-plugin-node-polyfills/polyfills/http'));
  20. libs.set('https', require.resolve('rollup-plugin-node-polyfills/polyfills/http'));
  21. libs.set('os', require.resolve('rollup-plugin-node-polyfills/polyfills/os'));
  22. libs.set('assert', require.resolve('rollup-plugin-node-polyfills/polyfills/assert'));
  23. libs.set('constants', require.resolve('rollup-plugin-node-polyfills/polyfills/constants'));
  24. libs.set('_stream_duplex', require.resolve('rollup-plugin-node-polyfills/polyfills/readable-stream/duplex'));
  25. libs.set('_stream_passthrough', require.resolve('rollup-plugin-node-polyfills/polyfills/readable-stream/passthrough'));
  26. libs.set('_stream_readable', require.resolve('rollup-plugin-node-polyfills/polyfills/readable-stream/readable'));
  27. libs.set('_stream_writable', require.resolve('rollup-plugin-node-polyfills/polyfills/readable-stream/writable'));
  28. libs.set('_stream_transform', require.resolve('rollup-plugin-node-polyfills/polyfills/readable-stream/transform'));
  29. libs.set('timers', require.resolve('rollup-plugin-node-polyfills/polyfills/timers'));
  30. libs.set('console', require.resolve('rollup-plugin-node-polyfills/polyfills/console'));
  31. libs.set('vm', require.resolve('rollup-plugin-node-polyfills/polyfills/vm'));
  32. libs.set('zlib', require.resolve('rollup-plugin-node-polyfills/polyfills/zlib'));
  33. libs.set('tty', require.resolve('rollup-plugin-node-polyfills/polyfills/tty'));
  34. libs.set('domain', require.resolve('rollup-plugin-node-polyfills/polyfills/domain'));
  35. // not shimmed
  36. libs.set('dns', EMPTY_PATH);
  37. libs.set('dgram', EMPTY_PATH);
  38. libs.set('child_process', EMPTY_PATH);
  39. libs.set('cluster', EMPTY_PATH);
  40. libs.set('module', EMPTY_PATH);
  41. libs.set('net', EMPTY_PATH);
  42. libs.set('readline', EMPTY_PATH);
  43. libs.set('repl', EMPTY_PATH);
  44. libs.set('tls', EMPTY_PATH);
  45. libs.set('fs', EMPTY_PATH);
  46. libs.set('crypto', EMPTY_PATH);
  47. // libs.set(
  48. // 'fs',
  49. // require.resolve('rollup-plugin-node-polyfills/polyfills/browserify-fs'),
  50. // )
  51. // TODO enable crypto and fs https://github.com/ionic-team/rollup-plugin-node-polyfills/issues/20
  52. // libs.set(
  53. // 'crypto',
  54. // require.resolve(
  55. // 'rollup-plugin-node-polyfills/polyfills/crypto-browserify',
  56. // ),
  57. // )
  58. return libs;
  59. }
  60. exports.builtinsPolyfills = builtinsPolyfills;
  61. //# sourceMappingURL=polyfills.js.map