How to use the ember-ast-hot-load/utils/normalizers.componentNameFromClassName function in ember-ast-hot-load

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
_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('/'));