constants.js 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. 'use strict';
  2. const {sep} = require('path');
  3. const {platform} = process;
  4. const os = require('os');
  5. exports.EV_ALL = 'all';
  6. exports.EV_READY = 'ready';
  7. exports.EV_ADD = 'add';
  8. exports.EV_CHANGE = 'change';
  9. exports.EV_ADD_DIR = 'addDir';
  10. exports.EV_UNLINK = 'unlink';
  11. exports.EV_UNLINK_DIR = 'unlinkDir';
  12. exports.EV_RAW = 'raw';
  13. exports.EV_ERROR = 'error';
  14. exports.STR_DATA = 'data';
  15. exports.STR_END = 'end';
  16. exports.STR_CLOSE = 'close';
  17. exports.FSEVENT_CREATED = 'created';
  18. exports.FSEVENT_MODIFIED = 'modified';
  19. exports.FSEVENT_DELETED = 'deleted';
  20. exports.FSEVENT_MOVED = 'moved';
  21. exports.FSEVENT_CLONED = 'cloned';
  22. exports.FSEVENT_UNKNOWN = 'unknown';
  23. exports.FSEVENT_TYPE_FILE = 'file';
  24. exports.FSEVENT_TYPE_DIRECTORY = 'directory';
  25. exports.FSEVENT_TYPE_SYMLINK = 'symlink';
  26. exports.KEY_LISTENERS = 'listeners';
  27. exports.KEY_ERR = 'errHandlers';
  28. exports.KEY_RAW = 'rawEmitters';
  29. exports.HANDLER_KEYS = [exports.KEY_LISTENERS, exports.KEY_ERR, exports.KEY_RAW];
  30. exports.DOT_SLASH = `.${sep}`;
  31. exports.BACK_SLASH_RE = /\\/g;
  32. exports.DOUBLE_SLASH_RE = /\/\//;
  33. exports.SLASH_OR_BACK_SLASH_RE = /[/\\]/;
  34. exports.DOT_RE = /\..*\.(sw[px])$|~$|\.subl.*\.tmp/;
  35. exports.REPLACER_RE = /^\.[/\\]/;
  36. exports.SLASH = '/';
  37. exports.SLASH_SLASH = '//';
  38. exports.BRACE_START = '{';
  39. exports.BANG = '!';
  40. exports.ONE_DOT = '.';
  41. exports.TWO_DOTS = '..';
  42. exports.STAR = '*';
  43. exports.GLOBSTAR = '**';
  44. exports.ROOT_GLOBSTAR = '/**/*';
  45. exports.SLASH_GLOBSTAR = '/**';
  46. exports.DIR_SUFFIX = 'Dir';
  47. exports.ANYMATCH_OPTS = {dot: true};
  48. exports.STRING_TYPE = 'string';
  49. exports.FUNCTION_TYPE = 'function';
  50. exports.EMPTY_STR = '';
  51. exports.EMPTY_FN = () => {};
  52. exports.IDENTITY_FN = val => val;
  53. exports.isWindows = platform === 'win32';
  54. exports.isMacos = platform === 'darwin';
  55. exports.isLinux = platform === 'linux';
  56. exports.isIBMi = os.type() === 'OS400';