LearnNewsExamplesServices
Frontmatter
id7136
titleAlternative Dev Mode: In-Worker Parsing with `parse5`
stateClosed
labels
enhancement
assigneestobiu
createdAtJul 31, 2025, 9:02 AM
updatedAtJul 31, 2025, 12:24 PM
githubUrlhttps://github.com/neomjs/neo/issues/7136
authortobiu
commentsCount0
parentIssue7130
subIssues[]
subIssuesCompleted0
subIssuesTotal0
blockedBy[]
blocking[]
closedAtJul 31, 2025, 12:24 PM

Alternative Dev Mode: In-Worker Parsing with parse5

Closed v10.3.0 enhancement
tobiu
tobiu commented on Jul 31, 2025, 9:02 AM

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:
    1. Create a new HtmlTemplateProcessor utility inside the app worker (src/util/HtmlTemplateProcessor.mjs or similar).
    2. This processor will be lazy-loaded when a component first uses an HTML template.
    3. The processor will use parse5 to synchronously convert the template string into a Neo.mjs VDOM JSON structure.
    4. The component's lifecycle (continueUpdateWithVdom for functional, a new hook for class-based) will then proceed synchronously with the parsed VDOM.
    5. The existing main thread addon (Neo.main.addon.HtmlStringToVdom) and its tests will be kept for comparison and potential future use cases.
tobiu assigned to @tobiu on Jul 31, 2025, 9:02 AM
tobiu added the enhancement label on Jul 31, 2025, 9:02 AM
tobiu added parent issue #7130 on Jul 31, 2025, 9:02 AM
tobiu referenced in commit be9e38e - "Alternative Dev Mode: In-Worker Parsing with parse5 on Jul 31, 2025, 12:24 PM
tobiu closed this issue on Jul 31, 2025, 12:24 PM