Skip to content

Merge NAPI wrapper types into same file as Rust types #570

@AntonyBlakey

Description

@AntonyBlakey

I suggest keeping every type/API in a single place. This makes it much easier to maintain or edit together, instead of editing one version and spending the time to look for others, possibly missing them. This way, all types/APIs can evolve together, and we don't have to maintain separate hierarchies.

So instead of this:

  • src/parse_error.rs shared + rust stuff
  • src/visitor.rs shared + rust stuff
  • src/napi/parse_error.rs napi stuff
  • src/napi/visitor.rs napi stuff

I suggest this:

  • src/parse_error/mod.rs shared stuff
  • src/parse_error/rust.rs rust stuff
  • src/parse_error/napi.rs napi stuff
  • src/visitor/mod.rs shared stuff
  • src/visitor/rust.rs rust stuff
  • src/visitor/napi.rs napi stuff

This way, they can also follow (roughly) the same structure as the public API. For example, if I'm adding a new method to Cursor, it is really easy to miss its NAPI counterpart if it is not within the same module/folder. This is a trivial example, but there are more complicated scenarios.

The more atomic/holistic each type/module can be, the easier it is to update/revision accurately.

Originally posted by @OmarTawfik in #564 (comment)

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions