Skip to content

Rename parsers to importers#332

Merged
waynemwashuma merged 3 commits into
wimaengine:devfrom
waynemwashuma:rename-parser
Jun 3, 2026
Merged

Rename parsers to importers#332
waynemwashuma merged 3 commits into
wimaengine:devfrom
waynemwashuma:rename-parser

Conversation

@waynemwashuma

Copy link
Copy Markdown
Collaborator

Objective

Rename the asset import pipeline from Parser to Importer to better reflect its responsibility and align terminology with the existing Exporter abstraction. The primary goal is to make asset serialization and deserialization concepts symmetrical:

  • Importer.deserialize()
  • Exporter.serialize()

Secondary changes include renaming plugins, registration systems, resources, and examples to use the new importer terminology consistently.

Solution

The former Parser abstraction has been renamed to Importer.

Showcase

Before

class ImageParser extends Parser {
  async parse(response, typeRegistry) {
    return image
  }
}

server.registerParser(Image, new ImageParser())
app.registerPlugin(new AssetParserPlugin({
  asset: Image,
  parser: new ImageParser()
}))

After

class ImageImporter extends Importer {
  async deserialize(response, typeRegistry) {
    return image
  }
}

server.registerImporter(Image, new ImageImporter())
app.registerPlugin(new AssetImporterPlugin({
  asset: Image,
  importer: new ImageImporter()
}))

Migration guide

Rename Parser to Importer

Replace:

class MyParser extends Parser {}

with:

class MyImporter extends Importer {}

Rename parse()

Replace:

async parse(response, typeRegistry)

with:

async deserialize(response, typeRegistry)

Rename AssetServer registration APIs

Replace:

server.registerParser(Type, parser)

with:

server.registerImporter(Type, importer)

Replace:

server.getParser(typeId, path)

with:

server.getImporter(typeId, path)

Rename plugin usage

Replace:

new AssetParserPlugin({
  asset: Type,
  parser: new MyParser()
})

with:

new AssetImporterPlugin({
  asset: Type,
  importer: new MyImporter()
})

Rename built-in engine importers

Replace:

AudioParser
ImageParser

with:

AudioImporter
ImageImporter

Checklist

  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.

@waynemwashuma waynemwashuma self-assigned this Jun 3, 2026
@waynemwashuma waynemwashuma merged commit a52045f into wimaengine:dev Jun 3, 2026
7 checks passed
@waynemwashuma waynemwashuma deleted the rename-parser branch June 3, 2026 00:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant