fix(bazel): ng_package includes transitive .d.ts and flatModuleMetadata (#22499)

Fixes #22419

PR Close #22499
This commit is contained in:
Alex Eagle
2018-02-28 09:12:39 -08:00
parent b6c941053e
commit aabe16c08c
9 changed files with 73 additions and 26 deletions

View File

@ -17,9 +17,5 @@ ng_package(
],
entry_point = "packages/bazel/test/ng_package/example/index.js",
secondary_entry_points = ["secondary"],
deps = [
":example",
# FIXME(#22419)
"//packages/bazel/test/ng_package/example/secondary",
],
deps = [":example"],
)

View File

@ -1 +1,9 @@
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
export * from './mymodule';

View File

@ -1,4 +1,13 @@
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
import {NgModule} from '@angular/core';
import {a} from './secondary/secondarymodule';
@NgModule({})
export class MyModule {

View File

@ -1 +1,9 @@
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
export * from './secondarymodule';

View File

@ -1,5 +1,15 @@
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
import {NgModule} from '@angular/core';
@NgModule({})
export class SecondaryModule {
}
export const a = 1;

View File

@ -41,6 +41,16 @@ describe('ng_package', () => {
expect(shx.ls('-R', 'esm5').stdout.split('\n').filter(n => !!n).sort()).toEqual(expected);
expect(shx.ls('-R', 'esm2015').stdout.split('\n').filter(n => !!n).sort()).toEqual(expected);
});
it('should have right secondary sources', () => {
const expected = [
'index.d.ts',
'package.json',
'secondary.d.ts',
'secondary.metadata.json',
'secondarymodule.d.ts',
];
expect(shx.ls('-R', 'secondary').stdout.split('\n').filter(n => !!n).sort()).toEqual(expected);
});
it('should have main entry point package.json properties set', () => {
const packageJson = JSON.parse(fs.readFileSync('package.json', UTF8));
expect(packageJson['main']).toBe('./bundles/example.umd.js');