constants.js 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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_FLAG_MUST_SCAN_SUBDIRS = 1;
  24. exports.FSEVENT_TYPE_FILE = 'file';
  25. exports.FSEVENT_TYPE_DIRECTORY = 'directory';
  26. exports.FSEVENT_TYPE_SYMLINK = 'symlink';
  27. exports.KEY_LISTENERS = 'listeners';
  28. exports.KEY_ERR = 'errHandlers';
  29. exports.KEY_RAW = 'rawEmitters';
  30. exports.HANDLER_KEYS = [exports.KEY_LISTENERS, exports.KEY_ERR, exports.KEY_RAW];
  31. exports.DOT_SLASH = `.${sep}`;
  32. exports.BACK_SLASH_RE = /\\/g;
  33. exports.DOUBLE_SLASH_RE = /\/\//;
  34. exports.SLASH_OR_BACK_SLASH_RE = /[/\\]/;
  35. exports.DOT_RE = /\..*\.(sw[px])$|~$|\.subl.*\.tmp/;
  36. exports.REPLACER_RE = /^\.[/\\]/;
  37. exports.SLASH = '/';
  38. exports.SLASH_SLASH = '//';
  39. exports.BRACE_START = '{';
  40. exports.BANG = '!';
  41. exports.ONE_DOT = '.';
  42. exports.TWO_DOTS = '..';
  43. exports.STAR = '*';
  44. exports.GLOBSTAR = '**';
  45. exports.ROOT_GLOBSTAR = '/**/*';
  46. exports.SLASH_GLOBSTAR = '/**';
  47. exports.DIR_SUFFIX = 'Dir';
  48. exports.ANYMATCH_OPTS = {dot: true};
  49. exports.STRING_TYPE = 'string';
  50. exports.FUNCTION_TYPE = 'function';
  51. exports.EMPTY_STR = '';
  52. exports.EMPTY_FN = () => {};
  53. exports.IDENTITY_FN = val => val;
  54. exports.isWindows = platform === 'win32';
  55. exports.isMacos = platform === 'darwin';
  56. exports.isLinux = platform === 'linux';
  57. exports.isIBMi = os.type() === 'OS400';