Skip to content

Commit

Permalink
fix: add transform filter to vite plugin (#516)
Browse files Browse the repository at this point in the history
  • Loading branch information
Drunkenpilot authored Jul 6, 2023
1 parent 56766d9 commit 9b0b211
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,6 @@ stats.html
.env.local

# E2E test
tmpanalogapp*
tmpanalogapp*
~/.nvm/nvm-exec
~/.nvm/nvm.sh
10 changes: 10 additions & 0 deletions packages/vite-plugin-angular/src/lib/angular-vite-plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export interface PluginOptions {
tsTransformers?: ts.CustomTransformers;
};
supportedBrowsers?: string[];
transformFilter?: (code: string, id: string) => boolean;
}

interface EmitFileResult {
Expand Down Expand Up @@ -207,6 +208,15 @@ export function angular(options?: PluginOptions): Plugin[] {
return;
}

/**
* Check for options.transformFilter
*/
if (options?.transformFilter) {
if (!(options?.transformFilter(code, id) ?? true)) {
return;
}
}

/**
* Check for .ts extenstions for inline script files being
* transformed (Astro).
Expand Down

0 comments on commit 9b0b211

Please sign in to comment.