How to use the use.modules function in use

To help you get started, we’ve selected a few use examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github werty1001 / bemgo / core / readBlocks.js View on Github external
} catch (e) {
						throw new Error( `\n\n\x1b[41mFAIL\x1b[0m: A JSON "\x1b[36m${path.join( level, block, 'data.json' )}\x1b[0m" have SyntaxError:\n${e.message}\n\n` )
					}

				}

				// Read deps

				if ( isFile( use ) ) {

					delete require.cache[ require.resolve( use ) ]

					const data = require( use )

					if ( data && Array.isArray( data.modules ) ) {

						data.modules.forEach( obj => {

							if ( !obj || obj.constructor !== Object ) return

							if ( !obj.from || typeof obj.from !== 'string' )
								return ( obj.from = path.join( blocks, level, block, 'assets' ) )

							if ( isExternal( obj.from ) ) return

							return ( obj.from = path.join( root, obj.from ) )
						})

					}

					if ( !deps[block] ) {
github werty1001 / bemgo / core / readBlocks.js View on Github external
throw new Error( `\n\n\x1b[41mFAIL\x1b[0m: A JSON "\x1b[36m${path.join( level, block, 'data.json' )}\x1b[0m" have SyntaxError:\n${e.message}\n\n` )
					}

				}

				// Read deps

				if ( isFile( use ) ) {

					delete require.cache[ require.resolve( use ) ]

					const data = require( use )

					if ( data && Array.isArray( data.modules ) ) {

						data.modules.forEach( obj => {

							if ( !obj || obj.constructor !== Object ) return

							if ( !obj.from || typeof obj.from !== 'string' )
								return ( obj.from = path.join( blocks, level, block, 'assets' ) )

							if ( isExternal( obj.from ) ) return

							return ( obj.from = path.join( root, obj.from ) )
						})

					}

					if ( !deps[block] ) {

						if ( data ) deps[block] = {
github werty1001 / bemgo / core / readBlocks.js View on Github external
if ( !obj.from || typeof obj.from !== 'string' )
								return ( obj.from = path.join( blocks, level, block, 'assets' ) )

							if ( isExternal( obj.from ) ) return

							return ( obj.from = path.join( root, obj.from ) )
						})

					}

					if ( !deps[block] ) {

						if ( data ) deps[block] = {
							nodes: Array.isArray( data.nodes ) ? data.nodes : [],
							modules: Array.isArray( data.modules ) ? data.modules : []
						}

					} else {

						if ( data ) deps[block] = {
							nodes: Array.isArray( data.nodes ) ? deps[block].nodes.concat( data.nodes ) : deps[block].nodes,
							modules: Array.isArray( data.modules ) ? deps[block].modules.concat( data.modules ) : deps[block].modules
						}

					}

				}

			})
github werty1001 / bemgo / core / readBlocks.js View on Github external
})

					}

					if ( !deps[block] ) {

						if ( data ) deps[block] = {
							nodes: Array.isArray( data.nodes ) ? data.nodes : [],
							modules: Array.isArray( data.modules ) ? data.modules : []
						}

					} else {

						if ( data ) deps[block] = {
							nodes: Array.isArray( data.nodes ) ? deps[block].nodes.concat( data.nodes ) : deps[block].nodes,
							modules: Array.isArray( data.modules ) ? deps[block].modules.concat( data.modules ) : deps[block].modules
						}

					}

				}

			})

use

Easily add plugin support to your node.js application.

MIT
Latest version published 6 years ago

Package Health Score

68 / 100
Full package analysis