How to use the @adonisjs/fold.Registrar function in @adonisjs/fold

To help you get started, we’ve selected a few @adonisjs/fold 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 adonisjs / view / test / view.spec.ts View on Github external
assert.equal(domain, 'root')
          return '/'
        },
        BriskRoute: {
          macro () {},
        },
        makeSignedUrl (identifier, options, domain) {
          assert.equal(identifier, '/signed')
          assert.deepEqual(options, {})
          assert.equal(domain, 'root')
          return '/'
        },
      }
    })

    const registrar = new Registrar(ioc)
    await registrar.useProviders([join(__dirname, '..', 'providers', 'ViewProvider')]).registerAndBoot()

    const view = ioc.use('Adonis/Core/View')
    view.registerTemplate('dummy', { template: `{{ route('/', {}, 'root') }}` })
    view.registerTemplate('signedDummy', { template: `{{ signedRoute('/signed', {}, 'root') }}` })

    view.render('dummy')
    view.render('signedDummy')
  })
github adonisjs / adonis-framework / src / Ignitor / Bootstrapper / index.ts View on Github external
try {
      rcContents = esmRequire(join(this.appRoot, '.adonisrc.json'))
    } catch (error) {
      if (isMissingModuleError(error)) {
        throw new Error('Make sure the project root has ".adonisrc.json"')
      }
      throw error
    }

    /**
     * Setting up the application and binding it to the container as well. This makes
     * it's way to the container even before the providers starts registering
     * themselves.
     */
    this.application = new Application(this.appRoot, ioc, rcContents, pkgFile)
    this.registrar = new Registrar(ioc, this.appRoot)

    ioc.singleton('Adonis/Core/Application', () => this.application)
    return this.application
  }
github adonisjs / adonis-framework / packages / core / src / Ignitor / index.ts View on Github external
private async _bootProviders () {
    const registrar = new Registrar(this.ioc)

    /**
     * Loads `start/app` file and use providers and aliases from it. In
     * case of `intent === ace`, also use `aceProviders`.
     */
    const { providers, aceProviders, aliases } = this._loadAppFile()
    const list = this._intent === 'ace' ? providers.concat(aceProviders) : providers

    /**
     * Register all providers
     */
    this._providersList = registrar.useProviders(list).register()
    this._providersWithExitHook = this._providersList.filter((provider) => typeof (provider.onExit) === 'function')

    /**
     * Register aliases after registering providers. This will override