<commit_before>TaskRegistry = require('../task-registry').default
StoreRegistry = require('../store-registry').default
DatabaseObjectRegistry = require('../database-object-registry').default

class NylasExports

  @default = (requireValue) -> requireValue.default ? requireValue

  # Will lazy load when requested
  @lazyLoad = (prop, path) ->
    Object.defineProperty @, prop,
      get: ->
        NylasExports.default(require("../#{path}"))
      enumerable: true

  @lazyLoadCustomGetter = (prop, get) ->
    Object.defineProperty @, prop, {get, enumerable: true}

  @lazyLoadAndRegisterStore = (klassName, path) ->
    constructorFactory = -><commit_msg>fix(nylas-exports): Avoid repeatedly calling require inside lazyLoad<commit_after>TaskRegistry = require('../task-registry').default
StoreRegistry = require('../store-registry').default
DatabaseObjectRegistry = require('../database-object-registry').default

# Calling require() repeatedly isn't free! Even though it has it's own cache,
# it still needs to resolve the path to a file based on the current __dirname,
# match it against it's cache, etc. We can shortcut all this work.
RequireCache = {}

class NylasExports

  @default = (requireValue) -> requireValue.default ? requireValue

  # Will lazy load when requested
  @lazyLoad = (prop, path) ->
    Object.defineProperty @, prop,
      get: ->
        key = "#{prop}#{path}"
        RequireCache[key] = RequireCache[key] || NylasExports.default(require("../#{path}"))
        return RequireCache[key]
      enumerable: true

  @lazyLoadCustomGetter = (prop, get) ->
    Object.defineProperty @, prop, {get, enumerable: true}

  @lazyLoadAndRegisterStore = (klassName, path) ->
    constructorFactory = ->
{'fraction_non_alphanumeric': 0.13406848520023215, 'fraction_numerical': 0.0, 'mean_word_length': 4.026239067055394, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5606348', 'n_tokens_mistral': 495, 'n_tokens_neox': 487, 'n_words': 128}