Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

krodak
Copy link
Contributor

@krodak krodak commented Sep 2, 2025

Introduction

Migrating from "manual" code generation with the use of .indent(count, to using CodeFragmentPrinter within BridgeJSLnk.

Notes

  • split content of link() method as it was becoming a bit large and having lots of moving part as a result of adding new conditional sections for enums, etc
  • separated TS and JS code generation within link() and encapsulated into individual functions for clarity
  • as a side effect removed some empty lines from generated files which were mostly there due to conditional content that was inserted into """ and resulted in empty line if not present
  • abstracted vars from link() into LinkData for clarity
  • added some comments for JS / TS code generation to make it a bit easier to identify given segments of JS / TS generated files
  • cleaned up unused old version of renderGlobalNamespace

Initially was biased to not split let outputJs as large """ seemed convenient, but eventually decided on refactoring this as well, as with more functionality added, it would become even more bloated 🙏🏻

@krodak krodak self-assigned this Sep 2, 2025
Copy link
Member

@kateinoigakukun kateinoigakukun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@kateinoigakukun kateinoigakukun changed the title BridgeJS: Migrate to code fragment printer [NFC] BridgeJS: Migrate to code fragment printer Sep 3, 2025
@kateinoigakukun kateinoigakukun merged commit 250af4d into swiftwasm:main Sep 3, 2025
8 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants