nl_tokens: A module for loading a style processor @module loadProcessor Loads a module in 3 Steps . 1 . Check if module is compatible 1 . Check if module is installed 2 . Check if module version is compatible 3 . Load the module
pl_tokens: function _loadModule ( moduleName ) { let modulePath // Check if module exists try { modulePath = require . resolve ( moduleName ) } catch ( err ) { switch ( err . code ) { case 'MODULE_NOT_FOUND' : const error = new Error ( ` ${ moduleName } ${ moduleName } ` ) error . code = 'MODULE_NOT_INSTALLED' throw error default : throw err } } //Check if module version is supported const f = finder ( modulePath ) const moduleVersion = f . <mask> ( ) . value . version const compatibleVersion = compatibleProcessors [ moduleName ] if ( ! semver . satisfies ( moduleVersion , compatibleVersion ) ) { const error = new Error ( ` ${ moduleName } ${ moduleVersion } ${ compatibleVersion } ` ) error . code = 'MODULE_NOT_COMPATIBLE' throw error } return require ( moduleName ) }