Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: add configuration to allow custom TypeScript transformers to be added. #210

Closed
2 tasks
brandonroberts opened this issue Jan 15, 2023 · 5 comments · Fixed by #213
Closed
2 tasks
Labels
accepting PRs enhancement New feature or request

Comments

@brandonroberts
Copy link
Member

Which scope/s are relevant/related to the feature request?

vite-plugin-angular

Information

Because Angular wraps the TypeScript compiler, being able to transform source code is usually done through transformers. One example is replacing the bootstrapping call in the main.ts. This feature would add a configuration option to allow custom transformers to be included before Angular compilation starts.

Existing transformers are here: https://github.com/analogjs/analog/blob/main/packages/vite-plugin-angular/src/lib/angular-vite-plugin.ts#L446

Proposed:

import { defineConfig } from 'vite';
import analog from '@analogjs/platform';

// https://vitejs.dev/config/
export default defineConfig(() => {
  return {
    plugins: [
      analog({
        advanced: {
          tsTransformers: [customTransformer]
        }
      })
    ]
  };
});

Provided transformers would be added to the before array.

Describe any alternatives/workarounds you're currently using

No response

I would be willing to submit a PR to fix this issue

  • Yes
  • No
@brandonroberts brandonroberts added enhancement New feature or request accepting PRs labels Jan 15, 2023
@marcus-sa
Copy link

marcus-sa commented Jan 16, 2023

+1, would be great to use Deepkit runtime types with Analog

@brandonroberts
Copy link
Member Author

@marcus-sa how would this enable that?

@marcus-sa
Copy link

@marcus-sa how would this enable that?

Deepkit needs a custom transformer for it to work.
https://docs.deepkit.io/deepkit-book-english.html under section 2.1.x

@ch1ffa
Copy link
Contributor

ch1ffa commented Jan 16, 2023

Then, I think, we need to change interface a tad as Deepkit requires afterDeclaration transformer

@marcus-sa
Copy link

marcus-sa commented Jan 16, 2023

Then, I think, we need to change interface a tad as Deepkit requires afterDeclaration transformer

Yeah the API for custom transformers needs to be a bit more flexible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accepting PRs enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants