
committed by
Jason Aden

parent
f6aa60c03c
commit
f4655ea98a
@ -170,12 +170,13 @@ function getEntryPointPath(entryPoint: EntryPoint): AbsoluteFsPath {
|
||||
const property = properties[i] as EntryPointJsonProperty;
|
||||
const format = getEntryPointFormat(property);
|
||||
|
||||
if (format === 'esm2015' || format === 'esm5') {
|
||||
if (format === 'esm2015' || format === 'esm5' || format === 'umd') {
|
||||
const formatPath = entryPoint.packageJson[property] !;
|
||||
return AbsoluteFsPath.resolve(entryPoint.path, formatPath);
|
||||
}
|
||||
}
|
||||
throw new Error(`There is no format with import statements in '${entryPoint.path}' entry-point.`);
|
||||
throw new Error(
|
||||
`There is no appropriate source code format in '${entryPoint.path}' entry-point.`);
|
||||
}
|
||||
|
||||
interface DependencyGraph extends DependencyDiagnostics {
|
||||
|
@ -63,7 +63,7 @@ export interface NgccOptions {
|
||||
pathMappings?: PathMappings;
|
||||
}
|
||||
|
||||
const SUPPORTED_FORMATS: EntryPointFormat[] = ['esm5', 'esm2015'];
|
||||
const SUPPORTED_FORMATS: EntryPointFormat[] = ['esm5', 'esm2015', 'umd'];
|
||||
|
||||
/**
|
||||
* This is the main entry-point into ngcc (aNGular Compatibility Compiler).
|
||||
|
@ -16,10 +16,12 @@ import {FileSystem} from '../file_system/file_system';
|
||||
import {Esm2015ReflectionHost} from '../host/esm2015_host';
|
||||
import {Esm5ReflectionHost} from '../host/esm5_host';
|
||||
import {NgccReflectionHost} from '../host/ngcc_host';
|
||||
import {UmdReflectionHost} from '../host/umd_host';
|
||||
import {Logger} from '../logging/logger';
|
||||
import {Esm5Renderer} from '../rendering/esm5_renderer';
|
||||
import {EsmRenderer} from '../rendering/esm_renderer';
|
||||
import {FileInfo, Renderer} from '../rendering/renderer';
|
||||
import {UmdRenderer} from '../rendering/umd_renderer';
|
||||
|
||||
import {EntryPointBundle} from './entry_point_bundle';
|
||||
|
||||
@ -78,6 +80,9 @@ export class Transformer {
|
||||
return new Esm2015ReflectionHost(this.logger, isCore, typeChecker, bundle.dts);
|
||||
case 'esm5':
|
||||
return new Esm5ReflectionHost(this.logger, isCore, typeChecker, bundle.dts);
|
||||
case 'umd':
|
||||
return new UmdReflectionHost(
|
||||
this.logger, isCore, bundle.src.program, bundle.src.host, bundle.dts);
|
||||
default:
|
||||
throw new Error(`Reflection host for "${bundle.format}" not yet implemented.`);
|
||||
}
|
||||
@ -89,6 +94,11 @@ export class Transformer {
|
||||
return new EsmRenderer(this.fs, this.logger, host, isCore, bundle);
|
||||
case 'esm5':
|
||||
return new Esm5Renderer(this.fs, this.logger, host, isCore, bundle);
|
||||
case 'umd':
|
||||
if (!(host instanceof UmdReflectionHost)) {
|
||||
throw new Error('UmdRenderer requires a UmdReflectionHost');
|
||||
}
|
||||
return new UmdRenderer(this.fs, this.logger, host, isCore, bundle);
|
||||
default:
|
||||
throw new Error(`Renderer for "${bundle.format}" not yet implemented.`);
|
||||
}
|
||||
|
Reference in New Issue
Block a user