lib/Genesis.js
async function symbolPhase3(val) {
						if (typeof val === 'object') {
							if (Array.isArray(val)) {
								val = await Promise.all(val.map(v => symbolPhase3(v)));
							} else {
								for (let key in val) {
									val[key] = await symbolPhase3(val[key]);
								}
							}
							return val;
						}
						if (typeof val !== 'string' || (!val.startsWith('@')))
							return val;
						if (val.charAt(0) === '@') {
							let directive = val.substr(0);
							val = val.split(':');
							let key = val[0].toLocaleLowerCase().trim();
							let encoding = undefined;
							if (key.split(',').length == 2) {
								key = key.split(',')[0].trim();
								let _encoding = key.split(',')[1].trim();
							}
							val = val.slice(1).join(':').trim();
							let directiveTimer = log.time(directive);
							switch (key) {
								case '@filename':
								case '@file': {
									log.v(`Compiling ${directive}`);
									let path;
									try {
										let systemPath = Params.config ? Path.dirname(Params.config) : CWD;
										if (Path.isAbsolute(val))
											path = val;
										else {
											path = Path.join(Path.resolve(systemPath), val);
										}
										log.timeEnd(directiveTimer);
										return fs.readFileSync(path).toString(encoding);
									} catch (err) {
										log.e('@file: (compileInstance) Error reading file ', path);
										log.w(`Module ${inst.Module} may not operate as expected.`);
									}
									break;
								}
								case '@folder':
								case '@directory': {
									log.v(`Compiling ${directive}`);
									let dir;
									try {
										let systemPath = Params.config ? Path.dirname(Params.config) : CWD;
										if (Path.isAbsolute(val))
											dir = val;
										else
											dir = Path.join(Path.resolve(systemPath), val);
											let _return = await buildDir(dir);
											log.timeEnd(directiveTimer);
										return _return;
									} catch (err) {
										og.e('Error reading directory ', dir);
										og.w(`Module ${inst.Module} may not operate as expected.`);
									}
									break;
								}
								default: {
									log.w(`Key ${key} not defined.`
										+ `Module ${inst.Module} may not operate as expected.`);
								}
							}
							log.timeEnd(directiveTimer);
						}
						return val;
					}
async function symbolPhase3(val) {
						if (typeof val === 'object') {
							if (Array.isArray(val)) {
								val = await Promise.all(val.map(v => symbolPhase3(v)));
							} else {
								for (let key in val) {
									val[key] = await symbolPhase3(val[key]);
								}
							}
							return val;
						}
						if (typeof val !== 'string' || (!val.startsWith('@')))
							return val;
						if (val.charAt(0) === '@') {
							let directive = val.substr(0);
							val = val.split(':');
							let key = val[0].toLocaleLowerCase().trim();
							let encoding = undefined;
							if (key.split(',').length == 2) {
								key = key.split(',')[0].trim();
								let _encoding = key.split(',')[1].trim();
							}
							val = val.slice(1).join(':').trim();
							let directiveTimer = log.time(directive);
							switch (key) {
								case '@filename':
								case '@file': {
									log.v(`Compiling ${directive}`);
									let path;
									try {
										let systemPath = Params.config ? Path.dirname(Params.config) : CWD;
										if (Path.isAbsolute(val))
											path = val;
										else {
											path = Path.join(Path.resolve(systemPath), val);
										}
										log.timeEnd(directiveTimer);
										return fs.readFileSync(path).toString(encoding);
									} catch (err) {
										log.e('@file: (compileInstance) Error reading file ', path);
										log.w(`Module ${inst.Module} may not operate as expected.`);
									}
									break;
								}
								case '@folder':
								case '@directory': {
									log.v(`Compiling ${directive}`);
									let dir;
									try {
										let systemPath = Params.config ? Path.dirname(Params.config) : CWD;
										if (Path.isAbsolute(val))
											dir = val;
										else
											dir = Path.join(Path.resolve(systemPath), val);
											let _return = await buildDir(dir);
											log.timeEnd(directiveTimer);
										return _return;
									} catch (err) {
										og.e('Error reading directory ', dir);
										og.w(`Module ${inst.Module} may not operate as expected.`);
									}
									break;
								}
								default: {
									log.w(`Key ${key} not defined.`
										+ `Module ${inst.Module} may not operate as expected.`);
								}
							}
							log.timeEnd(directiveTimer);
						}
						return val;
					}
async function symbolPhase3 ( val ) { if ( typeof val === 'object' ) { if ( Array . isArray ( val ) ) { val = await Promise . all ( val . map ( v => symbolPhase3 ( v ) ) ) ; } else { for ( let key in val ) { val [ key ] = await symbolPhase3 ( val [ key ] ) ; } } return val ; } if ( typeof val !== 'string' || ( ! val . startsWith ( '@' ) ) ) return val ; if ( val . charAt ( 0 ) === '@' ) { let directive = val . substr ( 0 ) ; val = val . split ( ':' ) ; let key = val [ 0 ] . toLocaleLowerCase ( ) . trim ( ) ; let encoding = undefined ; if ( key . split ( ',' ) . length == 2 ) { key = key . split ( ',' ) [ 0 ] . trim ( ) ; let _encoding = key . split ( ',' ) [ 1 ] . trim ( ) ; } val = val . slice ( 1 ) . join ( ':' ) . trim ( ) ; let directiveTimer = log . time ( directive ) ; switch ( key ) { case '@filename' : case '@file' : { log . v ( ` ${ directive } ` ) ; let path ; try { let systemPath = Params . config ? Path . dirname ( Params . config ) : CWD ; if ( Path . isAbsolute ( val ) ) path = val ; else { path = Path . join ( Path . resolve ( systemPath ) , val ) ; } log . timeEnd ( directiveTimer ) ; return fs . readFileSync ( path ) . toString ( encoding ) ; } catch ( err ) { log . e ( '@file: (compileInstance) Error reading file ' , path ) ; log . w ( ` ${ inst . Module } ` ) ; } break ; } case '@folder' : case '@directory' : { log . v ( ` ${ directive } ` ) ; let dir ; try { let systemPath = Params . config ? Path . dirname ( Params . config ) : CWD ; if ( Path . isAbsolute ( val ) ) dir = val ; else dir = Path . join ( Path . resolve ( systemPath ) , val ) ; let _return = await buildDir ( dir ) ; log . timeEnd ( directiveTimer ) ; return _return ; } catch ( err ) { og . e ( 'Error reading directory ' , dir ) ; og . w ( ` ${ inst . Module } ` ) ; } break ; } default : { log . w ( ` ${ key } ` + ` ${ inst . Module } ` ) ; } } log . timeEnd ( directiveTimer ) ; } return val ; }
process @ files and directories
process