fix(bazel): ng_package creates invalid typings reexport on windows (#27829)
Currently when building a package on Windows, the typings re-export for secondary entry-points is not valid TypeScript. Similarly the metadata and the "package.json" files use non-posix paths and cause inconsistency within the NPM package. For example: _package.json_ ``` "esm5": "./esm5\\core.js", "esm2015": "./esm2015\\core.js", ``` _testing.d.t.s_ (of the `core` package) ``` export * from './testing\testing'; ``` PR Close #27829
This commit is contained in:
parent
a75c734471
commit
4caf6540d1
|
@ -235,8 +235,8 @@ function main(args: string[]): number {
|
|||
* @param file path to a file under the binDir, like bazel-bin/core/testing/generated.js
|
||||
*/
|
||||
function srcDirRelative(from: string, file: string) {
|
||||
const result =
|
||||
path.relative(path.dirname(from), path.join(srcDir, path.relative(binDir, file)));
|
||||
const result = normalizeSeparators(
|
||||
path.relative(path.dirname(from), path.join(srcDir, path.relative(binDir, file))));
|
||||
if (result.startsWith('..')) return result;
|
||||
return `./${result}`;
|
||||
}
|
||||
|
@ -362,6 +362,12 @@ function main(args: string[]): number {
|
|||
const content = amendPackageJson(pkgJson, {name: entryPointPackageName});
|
||||
writeFileFromInputPath(pkgJson, content);
|
||||
}
|
||||
|
||||
/**
|
||||
* Normalizes the specified path by replacing backslash separators with Posix
|
||||
* forward slash separators.
|
||||
*/
|
||||
function normalizeSeparators(path: string): string { return path.replace(/\\/g, '/'); }
|
||||
}
|
||||
|
||||
if (require.main === module) {
|
||||
|
|
Loading…
Reference in New Issue