Skip to content

Compiler refactoring #52

Description

@janis-me

The compiler needs to undergo changes, in order to support more features and fix some bugs. The main issues I see right now:

  • We compile files one-by-one
  • Files that are loaded twice, are run twice. That's an issue, for example for custom properties defined in the root. See Custom properties are defined once for every import #37
  • We can't have multiple entrypoints
  • The watch mode does not currently re-use the rolldown instance
  • CLI Arg parsing is bad

And more importantly, we need to define how surimi code is shared across modules, how surimi code can be imported by ts modules (and end up in the final build) and also how the compiler picks up styles and compiles them.

One of the biggest issues is that builders like the SelectorBuilder cannot and should not be imported into non-surimi files. there is no value and it would require runtime. On the other hand, generated class names and CSS custom property names might very well be used and imported as strings.

How can we

  1. Make it clear to users what they can and can not import into .ts files?
  2. Ensure the compiler compiles away all surimi code so no runtime is needed
  3. Not have any magic that changes variable types (from class to string)

Metadata

Metadata

Assignees

Labels

MVPImportant task to complete the MVP statecompilerRelated to the @surimi/compiler packageenhancementNew feature or request

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions