Skip to content

Commit

Permalink
fix(angular-output-target): multiple targets do not overwrite each ot…
Browse files Browse the repository at this point in the history
…her (#376)
  • Loading branch information
sean-perkins authored Aug 16, 2023
1 parent 2de5d64 commit 3c6a325
Showing 1 changed file with 18 additions and 16 deletions.
34 changes: 18 additions & 16 deletions packages/angular-output-target/src/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,24 @@ import { angularDirectiveProxyOutput } from './output-angular';
import type { OutputTargetAngular } from './types';
import path from 'path';

let validatedOutputTarget: OutputTargetAngular;

export const angularOutputTarget = (outputTarget: OutputTargetAngular): OutputTargetCustom => ({
type: 'custom',
name: 'angular-library',
validate(config) {
validatedOutputTarget = normalizeOutputTarget(config, outputTarget);
},
async generator(config, compilerCtx, buildCtx) {
const timespan = buildCtx.createTimeSpan(`generate angular proxies started`, true);

await angularDirectiveProxyOutput(compilerCtx, validatedOutputTarget, buildCtx.components, config);

timespan.finish(`generate angular proxies finished`);
},
});
export const angularOutputTarget = (outputTarget: OutputTargetAngular): OutputTargetCustom => {
let validatedOutputTarget: OutputTargetAngular;

return {
type: 'custom',
name: 'angular-library',
validate(config) {
validatedOutputTarget = normalizeOutputTarget(config, outputTarget);
},
async generator(config, compilerCtx, buildCtx) {
const timespan = buildCtx.createTimeSpan(`generate angular proxies started`, true);

await angularDirectiveProxyOutput(compilerCtx, validatedOutputTarget, buildCtx.components, config);

timespan.finish(`generate angular proxies finished`);
},
};
};

export function normalizeOutputTarget(config: Config, outputTarget: OutputTargetAngular) {
const results: OutputTargetAngular = {
Expand Down

0 comments on commit 3c6a325

Please sign in to comment.