d3dc / classier-react

Use stylesheets for styles, not Javascript
ISC License
1 stars 0 forks source link

Simple blocks - complicated refactor #9

Open d3dc opened 6 years ago

d3dc commented 6 years ago

This exposes functions for creating elements and wrapping CSS modules by iterating through them as an alternative to #5. closes #2.

Under the hood, it made sense to enforce an AST, since different systems might provide different semantic meaning by default.

This makes it very modular and clean - the internal syntax machinery resolves and then the configured transformFn is run for each node.

because its doing more traversal and collecting over string building, this might be a lot slower...

d3dc commented 6 years ago

Looks to be about 65% slower

Shallow React Component Test Run Average over 10 runs:

StringsNodes
1.0409s1.714s

Update: it really looks like only half the time went to object creation... Where the rest go?

d3dc commented 6 years ago

Dist is broken by the flatmap polyfill:

Module not found: Can't resolve 'array.prototype.flatmap/auto' in '/../node_modules/classier-react/dist'

d3dc commented 6 years ago

flatMap is an unnecessary dependency.

I inlined a lot of functional stuff and invoked the dark art of imperative programming.

d3dc commented 6 years ago

going up as 1.0.0-next.5