or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

docs

core-resolution.mdindex.mdmodule-registry.mdstring-utilities.md
tile.json

index.mddocs/

Ember Resolver

Ember Resolver is the default module-based resolver for Ember CLI applications that handles module lookup and dependency resolution. It converts Ember's naming conventions into actual classes, functions, and templates, enabling the framework to resolve dependencies like routes, models, components, and templates across different module systems.

Package Information

  • Package Name: ember-resolver
  • Package Type: npm
  • Language: JavaScript (with TypeScript definitions)
  • Installation: npm install ember-resolver

Core Imports

import Resolver from "ember-resolver";

For modular imports:

import Resolver, { ModuleRegistry } from "ember-resolver";

For string utilities and configuration:

import { dasherize, classify, underscore, decamelize, setStrings, getStrings, getString } from "ember-resolver/string";

CommonJS:

const Resolver = require("ember-resolver");

Basic Usage

import Resolver from "ember-resolver";

// Create a resolver instance
const resolver = Resolver.create({
  namespace: {
    modulePrefix: "my-app"
  }
});

// Resolve a module by fullName
const componentClass = resolver.resolve("component:my-component");

// Parse Ember naming conventions
const parsedName = resolver.parseName("route:posts/index");
// Returns: { type: "route", name: "posts/index", fullNameWithoutType: "posts/index", ... }

// Static resolver with explicit modules
const StaticResolver = Resolver.withModules({
  "my-app/components/hello": HelloComponent,
  "my-app/routes/application": ApplicationRoute
});

Architecture

Ember Resolver is built around several key components:

  • Resolver Class: Main resolution engine that converts Ember naming conventions to modules
  • ModuleRegistry: Registry interface for managing and accessing available modules
  • Module Name Patterns: Configurable lookup patterns for different file organization strategies (pods, nested, etc.)
  • String Utilities: Cached transformation functions for converting between naming conventions
  • Type System: Full TypeScript integration with proper interface definitions

Capabilities

Core Resolution

Main module resolution functionality that converts Ember naming conventions into actual module references. Essential for Ember application bootstrapping and dependency injection.

class Resolver {
  static create(props: object): Resolver;
  static withModules(explicitModules: object): typeof Resolver;
  
  resolve(fullName: string): any;
  parseName(fullName: string): ParsedName;
  normalize(fullName: string): string;
}

interface ParsedName {
  parsedName: true;
  fullName: string;
  prefix: string;
  type: string;
  fullNameWithoutType: string;
  name: string;
  root: object;
  resolveMethodName: string;
}

Core Resolution

Module Registry

Module registry system for managing available modules and providing lookup capabilities. Supports both dynamic RequireJS-based registries and static module collections.

class ModuleRegistry {
  constructor(entries?: object): ModuleRegistry;
  
  moduleNames(): string[];
  has(moduleName: string): boolean;
  get(...args: any[]): any;
}

Module Registry

String Utilities

High-performance cached string transformation utilities for converting between different naming conventions used throughout Ember applications.

function dasherize(str: string): string;
function classify(str: string): string;
function underscore(str: string): string;
function decamelize(str: string): string;
function setStrings(strings: object): void;
function getStrings(): object;
function getString(name: string): any;

String Utilities

Types

interface Resolver {
  moduleBasedResolver: boolean;
  pluralizedTypes: Record<string, string>;
  moduleNameLookupPatterns: Function[];
  
  addModules(modules: Record<string, unknown>): void;
  makeToString(factory: any, fullName: string): string;
  shouldWrapInClassFactory(module: any, parsedName: ParsedName): boolean;
  pluralize(type: string): string;
  prefix(parsedName: ParsedName): string;
  findModuleName(parsedName: ParsedName): string;
  chooseModuleName(moduleName: string): string;
  knownForType(type: string): object;
  translateToContainerFullname(type: string, moduleName: string): string;
}