How to use ember-ast-hot-load - 10 common examples

To help you get started, we’ve selected a few ember-ast-hot-load 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 lifeart / ember-ast-hot-load / addon / services / hot-loader.js View on Github external
isHelper(name) {
    if (!hasValidHelperName(name)) {
      return false;
    }
    return this.owner.application.hasRegistration('helper:' + name);
  },
  // for mu support components like src/components/tabs/tab
github lifeart / ember-ast-hot-load / addon / services / hot-loader.js View on Github external
_scopedComponentNames(name, scope) {
    const closestRelativeName = [].concat(this.muScopedComponents, this.currentRouteComponents())
      .filter((resolvedName)=>resolvedName.endsWith(name)).pop();
    // closestRelativeName can be undefined
    if (!scope) {
      return [closestRelativeName, name];
    }
    const normalizedContext = componentNameFromClassName(scope.constructor.name);
    const candidate = normalizedContext + '/' + name;
    const result = [];
    if (typeof closestRelativeName === 'string') {
      result.push(closestRelativeName);
    }
    if (candidate !== 'class/' + name) {
      if (!result.includes(candidate)) {
        result.push(candidate);
      }
    }
    // todo add hotReloadCUSTOMhlContext... to resolve deep nesting
    const namesFromContext = this.extractNamesFromContext(scope).reverse();
    for (let i = 1; i <= namesFromContext.length; i++) {
      const possibleNamePaths = namesFromContext.slice(0, i);
      possibleNamePaths.push(name);
      result.push(possibleNamePaths.join('/'));
github lifeart / ember-ast-hot-load / addon / services / hot-loader.js View on Github external
init() {
    this._super(...arguments);
    this.routeScopedComponents = getRouteScopedComponents();
    this.muScopedComponents = getMUScopedComponents();
    this.owner = getOwner(this);
    this.componentLookup = this.owner.lookup('component-lookup:main');
    this.routerService = this.owner.lookup('service:router') || this.owner.lookup('service:-router');
    this.appConfig = this.owner.resolveRegistration('config:environment') || {};
    this.modulePrefix = get(this.appConfig, 'modulePrefix') || 'dummy';
    this.podModulePrefix = get(this.appConfig, 'podModulePrefix') || this.modulePrefix;
  },
  normalizeComponentName(name) {
github lifeart / ember-ast-hot-load / addon / services / hot-loader.js View on Github external
init() {
    this._super(...arguments);
    this.routeScopedComponents = getRouteScopedComponents();
    this.muScopedComponents = getMUScopedComponents();
    this.owner = getOwner(this);
    this.componentLookup = this.owner.lookup('component-lookup:main');
    this.routerService = this.owner.lookup('service:router') || this.owner.lookup('service:-router');
    this.appConfig = this.owner.resolveRegistration('config:environment') || {};
    this.modulePrefix = get(this.appConfig, 'modulePrefix') || 'dummy';
    this.podModulePrefix = get(this.appConfig, 'podModulePrefix') || this.modulePrefix;
  },
  normalizeComponentName(name) {
github lifeart / ember-ast-hot-load / addon / services / hot-loader.js View on Github external
forgetComponent(name, isMU = true) {
    const cacheKey = this.get('iterationId') + '/' + name + '/' + isMU;
    if (FORGET_CACHE.includes(cacheKey)) {
      return;
    }
    if (isMU) {
      const muNames = this.getPossibleMUComponentNames(name);
      muNames.forEach((possibleMuName)=>{
        clearContainerCache(this, possibleMuName);
      });
    }
    clearContainerCache(this, name);
    FORGET_CACHE.push(cacheKey);
  },
  clearRequirejs(name) {
github lifeart / ember-ast-hot-load / addon / services / hot-loader.js View on Github external
muNames.forEach((possibleMuName)=>{
        clearContainerCache(this, possibleMuName);
      });
    }
github lifeart / ember-ast-hot-load / addon / services / hot-loader.js View on Github external
muNames.forEach((possibleMuName)=>{
      clearRequirejsCache(this, possibleMuName);
    });
    clearRequirejsCache(this, name);
github lifeart / ember-ast-hot-load / addon / services / hot-loader.js View on Github external
clearRequirejs(name) {
    const cacheKey = this.get('iterationId') + '/' + name;
    if (REQUIRE_CLEAR_CACHE.includes(cacheKey)) {
      return;
    }
    const muNames = this.getPossibleMUComponentNames(name);
    muNames.forEach((possibleMuName)=>{
      clearRequirejsCache(this, possibleMuName);
    });
    clearRequirejsCache(this, name);
    REQUIRE_CLEAR_CACHE.push(cacheKey);
  },
  addDynamicHelperWrapperComponent(name) {
github lifeart / ember-ast-hot-load / addon / services / hot-loader.js View on Github external
willLiveReloadRouteTemplate(attrs) {
    const meta = getPossibleRouteTemplateMeta(attrs.modulePath);
    if (meta.looksLikeRouteTemplate) {
      attrs.cancel  = true;
      this.clearRequirejs(meta.possibleTemplateName);
    }
  },
  __isAlive() {
github lifeart / ember-ast-hot-load / addon / services / hot-loader.js View on Github external
willHotReloadRouteTemplate(attrs) {
    const meta = getPossibleRouteTemplateMeta(attrs);
    if (!meta.looksLikeRouteTemplate) {
      return;
    }
    const currentRouteName = this.hasActiveRoute() ? this.currentRouteName() : '';
    if (meta.maybeClassicPath) {
      this.forgetComponent(meta.possibleTemplateName, false);
      const route = this.routeByPath(meta.possibleRouteName);
      if (!route) {
        return this.reloadWindow();
      }
      if (shouldRenderTemplate(currentRouteName, meta.possibleRouteName)) {
        route.renderTemplate();
      }
    } else if (meta.isMU) {
      let routeName = stripRouteTemplatePrefix(meta.possibleRouteName);
      routeName  = stripRouteTemplatePostfix(routeName);