constants.js 1.7 KB

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