Skip to content

Commit

Permalink
fix(@angular-devkit/build-angular): add missing declaration types in …
Browse files Browse the repository at this point in the history
…build_angular schemas.

Fixes issue #13388
  • Loading branch information
gatthias authored and kyliau committed Jan 14, 2019
1 parent 4de0ba9 commit fbbef68
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 16 deletions.
Expand Up @@ -15,8 +15,9 @@ import {
Budget,
CurrentFileReplacement,
ExtraEntryPoint,
NormalizedOptimization,
NormalizedSourceMaps,
} from '../../browser/schema';
import { NormalizedOptimization, NormalizedSourceMaps } from '../../utils/index';

export interface BuildOptions {
optimization: NormalizedOptimization;
Expand Down
13 changes: 13 additions & 0 deletions packages/angular_devkit/build_angular/src/browser/schema.d.ts
Expand Up @@ -5,6 +5,7 @@
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/

export interface BrowserBuilderSchema {
/**
* List of static application assets.
Expand Down Expand Up @@ -409,6 +410,18 @@ export enum BudgetType {
// Right now this normalization has to be done in all other builders that make use of the
// BrowserBuildSchema and BrowserBuilder.buildWebpackConfig.
// It would really help if it happens during architect.validateBuilderOptions, or similar.
export interface NormalizedOptimization {
scripts: boolean;
styles: boolean;
}

export interface NormalizedSourceMaps {
scripts: boolean;
styles: boolean;
hidden: boolean;
vendor: boolean;
}

export interface NormalizedBrowserBuilderSchema extends
Pick<
BrowserBuilderSchema,
Expand Down
7 changes: 6 additions & 1 deletion packages/angular_devkit/build_angular/src/karma/schema.d.ts
Expand Up @@ -5,7 +5,12 @@
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
import { BrowserBuilderSchema } from '../browser/schema';
import {
AssetPatternObject,
BrowserBuilderSchema,
CurrentFileReplacement,
NormalizedSourceMaps,
} from '../browser/schema';

export interface KarmaBuilderSchema extends Pick<BrowserBuilderSchema,
'assets' | 'main' | 'polyfills' | 'tsConfig' | 'scripts' | 'styles' | 'stylePreprocessorOptions'
Expand Down
3 changes: 3 additions & 0 deletions packages/angular_devkit/build_angular/src/server/schema.d.ts
Expand Up @@ -8,7 +8,10 @@

import {
BrowserBuilderSchema,
CurrentFileReplacement,
FileReplacement,
NormalizedOptimization,
NormalizedSourceMaps,
OptimizationObject,
SourceMapOptions,
} from '../browser/schema';
Expand Down
Expand Up @@ -6,12 +6,11 @@
* found in the LICENSE file at https://angular.io/license
*/

import { OptimizationOptions, SourceMapOptions } from '../browser/schema';

export interface NormalizedOptimization {
scripts: boolean;
styles: boolean;
}
import {
NormalizedOptimization,
OptimizationOptions,
SourceMapOptions,
} from '../browser/schema';

export function normalizeOptimization(optimization: OptimizationOptions): NormalizedOptimization {
const scripts = !!(typeof optimization === 'object' ? optimization.scripts : optimization);
Expand Down
Expand Up @@ -6,14 +6,7 @@
* found in the LICENSE file at https://angular.io/license
*/

import { SourceMapOptions } from '../browser/schema';

export interface NormalizedSourceMaps {
scripts: boolean;
styles: boolean;
hidden: boolean;
vendor: boolean;
}
import { NormalizedSourceMaps, SourceMapOptions } from '../browser/schema';

export function normalizeSourceMaps(sourceMap: SourceMapOptions): NormalizedSourceMaps {
const scripts = !!(typeof sourceMap === 'object' ? sourceMap.scripts : sourceMap);
Expand Down

0 comments on commit fbbef68

Please sign in to comment.