Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Conversation

@elringus
Copy link
Owner

@elringus elringus commented Jan 20, 2024

This moves as much logic as possible out of source generator into the build step, which removes lots of duplicated code between the generator and the builder, as well as allows implementing common build preferences affecting bindings in all the assemblies.

Example on using new preferences attribute to make all bindings declared under "Foo.Bar" C# namespace have "Baz" namespace in JavaScript:

[assembly: JSPreferences(
    Space = ["^Foo\.Bar\.(\S+)", "Baz.$1"]
)]

Resolves #50, resolves #72.

Breaking changes:

  • Removed [JSNamespace] attribute. Generated JS namespace is now customized via Space property of [JSPreferences] attribute.
  • C# class name is now included in generated JS namespaces for both binding objects and types.
  • Global is no longer prepended to the generated JS namespace when binding's type doesn't have namespace.
  • Removed properties from [JSExport] and [JSImport] attributes, that allowed customizing some of the generated content. Associated behaviour (and more) is now customized via [JSPreferences] attribute.
  • Main (entry) file name in generated JavaScript module changed to index.mjs.

@codecov
Copy link

codecov bot commented Jan 20, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (33e9742) 100.00% compared to head (0e15293) 100.00%.

Additional details and impacted files
@@            Coverage Diff            @@
##              main      #140   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           47        42    -5     
  Lines         1457      1425   -32     
  Branches       235       246   +11     
=========================================
- Hits          1457      1425   -32     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@elringus elringus changed the title consolidate source generation, add preferences consolidate source generation Jan 21, 2024
@elringus elringus merged commit 1e6b7e7 into main Jan 23, 2024
@elringus elringus deleted the feat/intercept branch January 23, 2024 19:27
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.

Detect when to emit nullable defines in auto-generated C# files Consolidate namespace override mechanism

2 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.