message: cleanup inheritance support
diff: @@ -74,9 +74,36 @@ export class Compiler<Identity extends Saved | Unsaved = Saved> {
  let { cardSource } = this;
  let originalModules = this.analyzeFiles();
  let parentCard = await this.getParentCard(originalModules);
  + originalModules = await this.inheritComponents(parentCard, originalModules);
  let fields = await this.lookupFieldsForCard(originalModules, parentCard);
  this.assertData(fields);
  + let outputModules = await this.transformFiles(originalModules, fields, parentCard);
  + let { componentInfos } = this;
  + assertAllComponentInfos(componentInfos);
  + return {
  + realm: cardSource.realm,
  + url: (cardSource.id ? `${cardSource.realm}${cardSource.id}` : undefined) as Identity,
  + schemaModule: this.getSchemaModuleRef(parentCard, cardSource.schema),
  + serializerModule: this.getSerializerModuleRef(parentCard, cardSource.serializer),
  + fields,
  + adoptsFrom: parentCard,
  + componentInfos: componentInfos,
  + modules: outputModules,
  + deps: [...this.dependencies],
  + };
  + }
  +
  + private assertData(fields: CompiledCard['fields']) {
  + if (this.cardSource.data) {
  + let unexpectedFields = difference(Object.keys(this.cardSource.data), Object.keys(fields));
  + if (unexpectedFields.length) {
  + throw new BadRequest(`Field(s) "${unexpectedFields.join(',')}" does not exist on this card`);
  + }
  + }
  + }
  + private async inheritComponents(parentCard: CompiledCard | undefined, modules: OriginalModules) {
  + let { cardSource } = this;
  // handle component inheritance
  for (let format of FORMATS) {
  if (!cardSource[format]) {
  @@ -89,8 +116,8 @@ export class Compiler<Identity extends Saved | Unsaved = Saved> {
  // stick it into input modules so it will be recompiled
  let mod = await this.inheritParentComponent(parentCard, format);
  let name = uniqueName(cardSource.files, mod.localPath);
  - originalModules = {
  - ...originalModules,
  + modules = {
  + ...modules,
  [name]: mod,
  };
  cardSource = this.cardSource = { ...cardSource, [format]: name };
  @@ -108,30 +135,7 @@ export class Compiler<Identity extends Saved | Unsaved = Saved> {
  }
  }
  }
  -
  - let outputModules = await this.transformFiles(originalModules, fields, parentCard);
  - let { componentInfos } = this;
  - assertAllComponentInfos(componentInfos);
  - return {
  - realm: cardSource.realm,
  - url: (cardSource.id ? `${cardSource.realm}${cardSource.id}` : undefined) as Identity,
  - schemaModule: this.getSchemaModuleRef(parentCard, cardSource.schema),
  - serializerModule: this.getSerializerModuleRef(parentCard, cardSource.serializer),
  - fields,
  - adoptsFrom: parentCard,
  - componentInfos: componentInfos,
  - modules: outputModules,
  - deps: [...this.dependencies],
  - };
  - }
  -
  - private assertData(fields: CompiledCard['fields']) {
  - if (this.cardSource.data) {
  - let unexpectedFields = difference(Object.keys(this.cardSource.data), Object.keys(fields));
  - if (unexpectedFields.length) {
  - throw new BadRequest(`Field(s) "${unexpectedFields.join(',')}" does not exist on this card`);
  - }
  - }
  + return modules;
  }
  private async transformFiles(
  