const units = require('./Units.flitter') delete units.App const FlitterApp = require('libflitter/app/FlitterApp') const app = new FlitterApp(units) app.output.level = -Infinity const services = app.di().container.proxy() let ready = false let ready_ps = [] app.up().then(() => { ready = true ready_ps.forEach(x => x(exports)) }) module.exports = exports = { app, services, UniversalPath: require('./app/classes/logical/UniversalPath'), ready: () => ready, ready$: async () => { if ( !ready ) return new Promise(res => ready_ps.push(res)) }, host(name_or_config) { if ( typeof name_or_config === 'object' ) { if ( !name_or_config.name ) throw new TypeError('Missing required host property: name') if ( services.configs.canonical_items.hosts[name_or_config.name] ) throw new TypeError(`A host with the name ${name_or_config.name} is already registered.`) services.configs.canonical_items.hosts[name_or_config.name] = name_or_config return services.hosts.get(name_or_config.name) } return services.hosts.get(name_or_config) }, } exports.ready$().then(() => { app.di().inject(exports.UniversalPath) })