Skip to content

Commit 724ca37

Browse files
chuckjazIgorMinar
authored andcommitted
build: produce metadata bundles for @angular modules (angular#14509)
Closes angular#14509
1 parent 3b89670 commit 724ca37

35 files changed

+349
-166
lines changed

integration/hello_world__closure/bundle.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ CLOSURE_ARGS=(
3535
node_modules/zone.js/dist/zone.js
3636
$(find -L vendor/rxjs -name *.js)
3737
node_modules/@angular/{core,common,compiler,platform-browser}/index.js
38+
node_modules/@angular/{core,common}/public_api.js
3839
$(find node_modules/@angular/{core,common,compiler,platform-browser}/src -name *.js)
3940
"built/src/*.js"
4041
"--entry_point=./built/src/main"

modules/@angular/animation/index.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
* found in the LICENSE file at https://angular.io/license
77
*/
88

9-
/**
10-
* @module
11-
* @description
12-
* Entry point for all public APIs of the animation package.
13-
*/
14-
export * from './src/animation';
9+
// This file is not used to build this module. It is only used during editing
10+
// by the TypeScript language serivce and during build for verifcation. `ngc`
11+
// replaces this file with production index.ts when it rewrites private symbol
12+
// names.
13+
14+
export * from './public_api';
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/**
2+
* @license
3+
* Copyright Google Inc. All Rights Reserved.
4+
*
5+
* Use of this source code is governed by an MIT-style license that can be
6+
* found in the LICENSE file at https://angular.io/license
7+
*/
8+
9+
/**
10+
* @module
11+
* @description
12+
* Entry point for all public APIs of the animation package.
13+
*/
14+
export * from './src/animation';

modules/@angular/animation/tsconfig-build.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,14 @@
2020
"types": []
2121
},
2222
"files": [
23-
"index.ts",
23+
"public_api.ts",
2424
"../../../node_modules/zone.js/dist/zone.js.d.ts",
2525
"../../system.d.ts"
2626
],
2727
"angularCompilerOptions": {
2828
"annotateForClosureCompiler": true,
29-
"strictMetadataEmit": true
29+
"strictMetadataEmit": true,
30+
"bundleIndex": "index",
31+
"importAs": "@angular/animation"
3032
}
3133
}

modules/@angular/common/index.ts

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,9 @@
66
* found in the LICENSE file at https://angular.io/license
77
*/
88

9-
/**
10-
* @module
11-
* @description
12-
* Entry point for all public APIs of the common package.
13-
*/
14-
export * from './src/common';
9+
// This file is not used to build this module. It is only used during editing
10+
// by the TypeScript language serivce and during build for verifcation. `ngc`
11+
// replaces this file with production index.ts when it rewrites private symbol
12+
// names.
1513

16-
// This file only reexports content of the `src` folder. Keep it that way.
14+
export * from './public_api';
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/**
2+
* @license
3+
* Copyright Google Inc. All Rights Reserved.
4+
*
5+
* Use of this source code is governed by an MIT-style license that can be
6+
* found in the LICENSE file at https://angular.io/license
7+
*/
8+
9+
/**
10+
* @module
11+
* @description
12+
* Entry point for all public APIs of the common package.
13+
*/
14+
export * from './src/common';
15+
16+
// This file only reexports content of the `src` folder. Keep it that way.

modules/@angular/common/src/common.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
*/
1414
export * from './location/index';
1515
export {NgLocaleLocalization, NgLocalization} from './localization';
16-
export {CommonModule} from './common_module';
16+
export {CommonModule, DeprecatedCommonModule} from './common_module';
1717
export {NgClass, NgFor, NgForOf, NgIf, NgPlural, NgPluralCase, NgStyle, NgSwitch, NgSwitchCase, NgSwitchDefault, NgTemplateOutlet, NgComponentOutlet} from './directives/index';
1818
export {AsyncPipe, DatePipe, I18nPluralPipe, I18nSelectPipe, JsonPipe, LowerCasePipe, CurrencyPipe, DecimalPipe, PercentPipe, SlicePipe, UpperCasePipe, TitleCasePipe} from './pipes/index';
1919
export {VERSION} from './version';

modules/@angular/common/src/common_module.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,9 @@ export class CommonModule {
3232

3333
/**
3434
* A module to contain deprecated directives.
35+
*
36+
* @deprecated
3537
*/
3638
@NgModule({declarations: [COMMON_DEPRECATED_DIRECTIVES], exports: [COMMON_DEPRECATED_DIRECTIVES]})
37-
export class CommonDeprecatedModule {
39+
export class DeprecatedCommonModule {
3840
}

modules/@angular/common/tsconfig-build.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,13 @@
2020
"types": []
2121
},
2222
"files": [
23-
"index.ts",
23+
"public_api.ts",
2424
"../../../node_modules/zone.js/dist/zone.js.d.ts"
2525
],
2626
"angularCompilerOptions": {
2727
"annotateForClosureCompiler": true,
28-
"strictMetadataEmit": true
28+
"strictMetadataEmit": true,
29+
"bundleIndex": "index",
30+
"importAs": "@angular/common"
2931
}
3032
}

modules/@angular/compiler-cli/integrationtest/test/test_summaries.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,9 @@ function main() {
3131

3232
class AssertingHostContext extends NodeCompilerHostContext {
3333
readFile(fileName: string): string {
34-
if (/.*\/node_modules\/.*/.test(fileName) && !/.*ngsummary\.json$/.test(fileName)) {
35-
// Only allow to read summaries from node_modules
34+
if (/.*\/node_modules\/.*/.test(fileName) && !/.*ngsummary\.json$/.test(fileName) &&
35+
!/package\.json$/.test(fileName)) {
36+
// Only allow to read summaries and package.json files from node_modules
3637
return null;
3738
}
3839
readFiles.push(path.relative(basePath, fileName));

0 commit comments

Comments
 (0)