fix(bazel): enable dts bundling for Ivy packages (#42728)

It is now possible to bundle DTS files of Ivy libraries since the blocker https://github.com/microsoft/rushstack/issues/1029 has been addressed upstream.

PR Close #42728
This commit is contained in:
Alan Agius 2021-07-01 08:48:16 +02:00 committed by atscott
parent d0414555f9
commit 7e04116d15
2 changed files with 16 additions and 33 deletions

View File

@ -140,11 +140,7 @@ def _should_produce_dts_bundle(ctx):
Returns:
true when we should produce bundled dts.
"""
# At the moment we cannot use this with ngtsc compiler since it emits
# import * as ___ from local modules which is not supported
# see: https://github.com/Microsoft/web-build-tools/issues/1029
return _is_view_engine_enabled(ctx) and getattr(ctx.attr, "bundle_dts", False)
return getattr(ctx.attr, "bundle_dts", False)
def _should_produce_r3_symbols_bundle(ctx):
"""Should we produce r3_symbols bundle.

View File

@ -6,7 +6,7 @@
* found in the LICENSE file at https://angular.io/license
*/
import {ivyEnabled, obsoleteInIvy} from '@angular/private/testing';
import {obsoleteInIvy} from '@angular/private/testing';
import {runfiles} from '@bazel/runfiles';
import * as path from 'path';
import * as shx from 'shelljs';
@ -69,22 +69,16 @@ describe('@angular/core ng_package', () => {
});
describe('typescript support', () => {
if (ivyEnabled) {
it('should have an index d.ts file', () => {
expect(shx.cat('core.d.ts')).toContain(`export *`);
});
it('should not have amd module names', () => {
expect(shx.cat('public_api.d.ts')).not.toContain('<amd-module name');
expect(shx.cat('core.d.ts')).not.toContain('<amd-module name');
});
} else {
it('should have an index d.ts file', () => {
expect(shx.cat('core.d.ts')).toContain('export declare');
});
it('should have an r3_symbols d.ts file', () => {
obsoleteInIvy('we no longer need to export r3_symbols')
.it('should have an r3_symbols d.ts file', () => {
expect(shx.cat('src/r3_symbols.d.ts')).toContain('export declare');
});
}
});
obsoleteInIvy('metadata files are no longer needed or produced in Ivy')
@ -174,17 +168,10 @@ describe('@angular/core ng_package', () => {
});
describe('typings', () => {
if (ivyEnabled) {
const typingsFile = p`testing/index.d.ts`;
it('should have a typings file', () => {
expect(shx.cat(typingsFile)).toContain(`export * from './public_api';`);
});
} else {
const typingsFile = p`testing/testing.d.ts`;
it('should have a typings file', () => {
expect(shx.cat(typingsFile)).toContain('export declare');
});
}
obsoleteInIvy(
'now that we don\'t need metadata files, we don\'t need these redirects to help resolve paths to them')