Description:
As an alternative to the main thread addon, we will evaluate using parse5 directly within the App worker for dev mode. This approach avoids the complexities and potential race conditions of an asynchronous worker roundtrip for parsing. While it introduces a ~176KB dependency to the dev build, this cost may be acceptable for the significant gain in architectural simplicity and rendering predictability.
Implementation Details:
- Tool:
parse5
- Method:
- Create a new
HtmlTemplateProcessor utility inside the app worker (src/util/HtmlTemplateProcessor.mjs or similar).
- This processor will be lazy-loaded when a component first uses an HTML template.
- The processor will use
parse5 to synchronously convert the template string into a Neo.mjs VDOM JSON structure.
- The component's lifecycle (
continueUpdateWithVdom for functional, a new hook for class-based) will then proceed synchronously with the parsed VDOM.
- The existing main thread addon (
Neo.main.addon.HtmlStringToVdom) and its tests will be kept for comparison and potential future use cases.
Description: As an alternative to the main thread addon, we will evaluate using
parse5directly within the App worker for dev mode. This approach avoids the complexities and potential race conditions of an asynchronous worker roundtrip for parsing. While it introduces a ~176KB dependency to the dev build, this cost may be acceptable for the significant gain in architectural simplicity and rendering predictability.Implementation Details:
parse5HtmlTemplateProcessorutility inside the app worker (src/util/HtmlTemplateProcessor.mjsor similar).parse5to synchronously convert the template string into a Neo.mjs VDOM JSON structure.continueUpdateWithVdomfor functional, a new hook for class-based) will then proceed synchronously with the parsed VDOM.Neo.main.addon.HtmlStringToVdom) and its tests will be kept for comparison and potential future use cases.