How to use ember-resolver - 10 common examples

To help you get started, we’ve selected a few ember-resolver 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 gabrielgrant / ember-cli-test-model-waiter / addon / instance-initializers / test-model-waiter.js View on Github external
Ember.Test.registerWaiter(function(){

      iterations++;

      // Get all models from the store
      // The following should work to get model names:
      //   var debugAdapter = appInstance.lookup('container-debug-adapter:main');
      //   debugAdapter.catalogEntriesByType('model');
      // but unfortunately it is buggy. Use that once the issue is fixed:
      // https://github.com/ember-cli/ember-resolver/issues/120
      // Until then:
      var modelRegexp = /^[a-zA-Z0-9-_]+\/models\/(.*)$/;
      var modelNames = new ModuleRegistry()
        .moduleNames()
        .filter((name) => modelRegexp.test(name))
        .map((name) => modelRegexp.exec(name)[1]);
      // Check for models in any pending state. Inspired by:
      // https://gist.github.com/rsutphin/73fdad14a24884eee336
      var store = appInstance.lookup('service:store');
      var pendingStates = ['isSaving','isEmpty', 'isLoading', 'isReloading'];
      var allPendingRecords = [];
      modelNames.forEach((name) => {
        var records = store.peekAll(name);
        var pendingRecords = records.filter((r) =>
          pendingStates.map((s) => r.get(s)).some((i) => i)
        );
        allPendingRecords =  allPendingRecords.concat(pendingRecords);
      });
github ember-engines / ember-engines / addon / resolver.js View on Github external
/* globals require, requirejs */
import Ember from 'ember';
import Resolver from 'ember-resolver';
import { ROUTES } from './routes';

export default Resolver.extend({
  resolveEngine(parsedName) {
    // TODO: clean this up to use latest ember-resolver from npm
    let engineName = parsedName.fullNameWithoutType;
    let engineModule = engineName + '/engine';

    if (requirejs.entries[engineModule]) {
      let module = require(engineModule);

      return module.default;
    }
  },

  resolveRouteMap(parsedName) {
    let engineName = parsedName.fullNameWithoutType;
    let engineRoutesModule = engineName + '/routes';
github MiguelMadero / ember-cli-bundle-loader / addon / resolver.js View on Github external
// Extensions the ember-resolver lookuppatterns that take a 'packageName'
    function defaultModuleName(packageName, parsedName) {
      return packageName + '/' + this.pluralize(parsedName.type) + '/' + parsedName.fullNameWithoutType;
    }
  ];

// The order is again important
genericModuleNameLookupPatterns.forEach(function(genericLookupPattern) {
  packageNames.concat(config.modulePrefix).forEach(function(packageName) {
    lookupFunctions.push(function(parsedName) {
      return genericLookupPattern.call(this, packageName, parsedName);
    });
  });
});

export default EmberResolver.extend({
  moduleNameLookupPatterns: Ember.computed(function() {
    // Not sure if we need to delegate, this might be enough.
    // return lookupFunctions.concat(this._super());
    return lookupFunctions;
  })
});
github izelnakri / mber / ember-app-boilerplate / src / resolver.js View on Github external
import Resolver from 'ember-resolver/resolvers/fallback';
import buildResolverConfig from 'ember-resolver/ember-config';
import config from '../config/environment';

let moduleConfig = buildResolverConfig(config.modulePrefix);

/*
 * If your application has custom types and collections, modify moduleConfig here
 * to add support for them.
 */

 moduleConfig.types = Object.assign({}, moduleConfig.types, { // NOTE: needed fast fastboot!
   ajax: { definitiveCollection: 'main' },
   mixin: { definitiveCollection: 'main' }
 });

export default Resolver.extend({
  config: moduleConfig
});
github NullVoxPopuli / react-vs-ember / state-management / ember / src / resolver.js View on Github external
import Resolver from 'ember-resolver/resolvers/fallback';
// import Resolver from 'ember-resolver/resolvers/glimmer-wrapper';

import { merge } from '@ember/polyfills';

import buildResolverConfig from 'ember-resolver/ember-config';
import config from '../config/environment';

let moduleConfig = buildResolverConfig(config.modulePrefix);
/*
 * If your application has custom types and collections, modify moduleConfig here
 * to add support for them.
 */

merge(moduleConfig.types, {
  config: { definitiveCollection: 'main' },
  mixin: { definitiveCollection: 'main' },
  util: { definitiveCollection: 'utils' },
});

moduleConfig.collections.main.types.push('config');

export default Resolver.extend({
  config: moduleConfig,
});
github izelnakri / mber / ember-app-boilerplate / src / resolver.js View on Github external
import buildResolverConfig from 'ember-resolver/ember-config';
import config from '../config/environment';

let moduleConfig = buildResolverConfig(config.modulePrefix);

/*
 * If your application has custom types and collections, modify moduleConfig here
 * to add support for them.
 */

 moduleConfig.types = Object.assign({}, moduleConfig.types, { // NOTE: needed fast fastboot!
   ajax: { definitiveCollection: 'main' },
   mixin: { definitiveCollection: 'main' }
 });

export default Resolver.extend({
  config: moduleConfig
});
github ember-cli / ember-cli / lib / broccoli / ember-app.js View on Github external
},
            },
          ],
        },
        this.options.vendorFiles
      ),
      isNull
    );

    this._addJqueryInLegacyEmber();

    if (this._addonInstalled('ember-resolver') || !bowerDeps['ember-resolver']) {
      // if the project is using `ember-resolver` as an addon
      // remove it from `vendorFiles` (the npm version properly works
      // without `app.import`s)
      delete this.vendorFiles['ember-resolver.js'];
    }

    // Warn if ember-cli-shims is not included.
    // certain versions of `ember-source` bundle them by default,
    // so we must check if that is the load mechanism of ember
    // before checking `bower`.
    let emberCliShimsRequired = this._checkEmberCliBabel(this.project.addons);
    if (!emberShims && !addonEmberCliShims && !bowerEmberCliShims && emberCliShimsRequired) {
      this.project.ui.writeWarnLine(
        "You have not included `ember-cli-shims` in your project's `bower.json` or `package.json`. This only works if you provide an alternative yourself and unset `app.vendorFiles['app-shims.js']`."
      );
    }

    // If ember-testing.js is coming from Bower (not ember-source) and it does not
    // exist, then we remove it from vendor files. This is needed to support versions
    // of Ember older than 1.8.0 (when ember-testing.js was incldued in ember.js itself)
github runspired / building-cross-platform / tests / helpers / resolver.js View on Github external
import Resolver from 'ember-resolver';
import config from '../../config/environment';

const resolver = Resolver.create();

resolver.namespace = {
  modulePrefix: config.modulePrefix,
  podModulePrefix: config.podModulePrefix
};

export default resolver;
github Emerson / ember-form-master-2000 / tests / helpers / resolver.js View on Github external
import Resolver from 'ember-resolver';
import config from '../../config/environment';

var resolver = Resolver.create();

resolver.namespace = {
  modulePrefix: config.modulePrefix,
  podModulePrefix: config.podModulePrefix
};

export default resolver;
github sglanzer / ember-cli-blanket / tests / helpers / resolver.js View on Github external
import Resolver from 'ember-resolver';
import config from '../../config/environment';

var resolver = Resolver.create();

resolver.namespace = {
  modulePrefix: config.modulePrefix,
  podModulePrefix: config.podModulePrefix
};

export default resolver;

ember-resolver

The default modules based resolver for Ember CLI.

MIT
Latest version published 2 days ago

Package Health Score

83 / 100
Full package analysis

Similar packages