refactor(ivy): ngcc - fix return type on makeEntryPointBundle()
(#32052)
In commit 7b55ba58b
(part of PR #29092), the implementation of
`makeEntryPointBundle()` was changed such that it now always return
`EntryPointBundle` (and not `null`).
However, the return type was not updated and as result we continued to
unnecessarily handle `null` as a potential return value in some places.
This commit fixes the return type to reflect the implementation and
removes the redundant code that was dealing with `null`.
PR Close #32052
This commit is contained in:

committed by
Alex Rickabaugh

parent
961d663fbe
commit
9537b2ff84
@ -134,24 +134,19 @@ export function mainNgcc(
|
||||
fileSystem, entryPoint, formatPath, isCore, property, format, processDts, pathMappings,
|
||||
true);
|
||||
|
||||
if (bundle) {
|
||||
logger.info(`Compiling ${entryPoint.name} : ${property} as ${format}`);
|
||||
const transformedFiles = transformer.transform(bundle);
|
||||
fileWriter.writeBundle(entryPoint, bundle, transformedFiles);
|
||||
compiledFormats.add(formatPath);
|
||||
logger.info(`Compiling ${entryPoint.name} : ${property} as ${format}`);
|
||||
const transformedFiles = transformer.transform(bundle);
|
||||
fileWriter.writeBundle(entryPoint, bundle, transformedFiles);
|
||||
compiledFormats.add(formatPath);
|
||||
|
||||
const propsToMarkAsProcessed = pathToPropsMap.get(formatPath) !;
|
||||
if (processDts) {
|
||||
propsToMarkAsProcessed.push('typings');
|
||||
processDts = false;
|
||||
}
|
||||
|
||||
markAsProcessed(
|
||||
fileSystem, entryPointPackageJson, entryPointPackageJsonPath, propsToMarkAsProcessed);
|
||||
} else {
|
||||
logger.warn(
|
||||
`Skipping ${entryPoint.name} : ${format} (no valid entry point file for this format).`);
|
||||
const propsToMarkAsProcessed = pathToPropsMap.get(formatPath) !;
|
||||
if (processDts) {
|
||||
propsToMarkAsProcessed.push('typings');
|
||||
processDts = false;
|
||||
}
|
||||
|
||||
markAsProcessed(
|
||||
fileSystem, entryPointPackageJson, entryPointPackageJsonPath, propsToMarkAsProcessed);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -44,7 +44,7 @@ export interface EntryPointBundle {
|
||||
export function makeEntryPointBundle(
|
||||
fs: FileSystem, entryPoint: EntryPoint, formatPath: string, isCore: boolean,
|
||||
formatProperty: EntryPointJsonProperty, format: EntryPointFormat, transformDts: boolean,
|
||||
pathMappings?: PathMappings, mirrorDtsFromSrc: boolean = false): EntryPointBundle|null {
|
||||
pathMappings?: PathMappings, mirrorDtsFromSrc: boolean = false): EntryPointBundle {
|
||||
// Create the TS program and necessary helpers.
|
||||
const options: ts.CompilerOptions = {
|
||||
allowJs: true,
|
||||
@ -88,4 +88,4 @@ function computePotentialDtsFilesFromJsFiles(
|
||||
}
|
||||
}
|
||||
return additionalFiles;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user