fix(angular): generate correct output for buildable libraries on windows (#31437)
## Current Behavior The `@nx/angular:ng-packagr-lite` executor is generating a wrong output on Windows. ## Expected Behavior The `@nx/angular:ng-packagr-lite` executor should generate the correct output on Windows. ## Related Issue(s) Fixes #31436
This commit is contained in:
parent
34cf5a243f
commit
77b34bd788
@ -93,7 +93,6 @@ export function createNgEntryPoint(
|
|||||||
),
|
),
|
||||||
// changed to use esm2022
|
// changed to use esm2022
|
||||||
declarationsBundled: pathJoinWithDest(
|
declarationsBundled: pathJoinWithDest(
|
||||||
'esm2022',
|
|
||||||
secondaryDir,
|
secondaryDir,
|
||||||
`${flatModuleFile}.d.ts`
|
`${flatModuleFile}.d.ts`
|
||||||
),
|
),
|
||||||
|
|||||||
@ -10,7 +10,7 @@
|
|||||||
import type { NgEntryPoint } from 'ng-packagr/src/lib/ng-package/entry-point/entry-point';
|
import type { NgEntryPoint } from 'ng-packagr/src/lib/ng-package/entry-point/entry-point';
|
||||||
import type { NgPackagrOptions } from 'ng-packagr/src/lib/ng-package/options.di';
|
import type { NgPackagrOptions } from 'ng-packagr/src/lib/ng-package/options.di';
|
||||||
import { mkdir, writeFile } from 'node:fs/promises';
|
import { mkdir, writeFile } from 'node:fs/promises';
|
||||||
import { dirname, join } from 'node:path';
|
import { dirname, join, normalize } from 'node:path';
|
||||||
import { getNgPackagrVersionInfo } from '../../../../utilities/ng-packagr/ng-packagr-version';
|
import { getNgPackagrVersionInfo } from '../../../../utilities/ng-packagr/ng-packagr-version';
|
||||||
import { importNgPackagrPath } from '../../../../utilities/ng-packagr/package-imports';
|
import { importNgPackagrPath } from '../../../../utilities/ng-packagr/package-imports';
|
||||||
import { createNgEntryPoint, type NgEntryPointType } from './entry-point';
|
import { createNgEntryPoint, type NgEntryPointType } from './entry-point';
|
||||||
@ -69,19 +69,28 @@ function normalizeEsm2022Path(
|
|||||||
path: string,
|
path: string,
|
||||||
entryPoint: NgEntryPointType
|
entryPoint: NgEntryPointType
|
||||||
): string {
|
): string {
|
||||||
|
const normalizedPath = normalize(path);
|
||||||
if (!entryPoint.primaryDestinationPath) {
|
if (!entryPoint.primaryDestinationPath) {
|
||||||
return path;
|
return normalizedPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (path.startsWith(join(entryPoint.primaryDestinationPath, 'tmp-esm2022'))) {
|
if (
|
||||||
return path.replace('tmp-esm2022', 'esm2022');
|
normalizedPath.startsWith(
|
||||||
|
join(entryPoint.primaryDestinationPath, 'tmp-esm2022')
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
return normalizedPath.replace('tmp-esm2022', 'esm2022');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (path.startsWith(join(entryPoint.primaryDestinationPath, 'tmp-typings'))) {
|
if (
|
||||||
return path.replace('tmp-typings', 'esm2022');
|
normalizedPath.startsWith(
|
||||||
|
join(entryPoint.primaryDestinationPath, 'tmp-typings')
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
return normalizedPath.replace('tmp-typings', '');
|
||||||
}
|
}
|
||||||
|
|
||||||
return path;
|
return normalizedPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
function toCustomNgEntryPoint(entryPoint: NgEntryPoint): NgEntryPointType {
|
function toCustomNgEntryPoint(entryPoint: NgEntryPoint): NgEntryPointType {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user