I would like to propose a change to how we handle inject_html.

Currently, it works like this: We define an <inject_html> tag in an asdoc
comment. That tag gets copied to a jsdoc comment when we emit JS code. When
we build an app, we search through the JS files line by line to find
<inject_html>.

I think that, when we emit JS files, it would be beneficial to emit a
separate file that contains the inject_html content.

So, you'd get a JS file, like we have now:

com/example/MyClass.js

Then, if the class contains inject_html, you'd also get:

com/example/MyClass.js.html

This is similar, in a way, to how there's a MyClass.js.map file when source
maps are enabled.

With this change, instead of loading MyClass.js and parsing it line by line
looking for inject_html, we could simply check to see if MyClass.js.html
exists in the same folder (or in the same SWC). This should help us detect
inject_html much faster and without needing to try to parse JS files.

Thoughts?

--
Josh Tynjala
Bowler Hat LLC <https://bowlerhat.dev>

Reply via email to