Skip to content

Commit 2320532

Browse files
devversiontinayuangao
authored andcommitted
build: no longer add pure annotations to es5 bundles (#6107)
* The pure annotations are no longer added to ES5 bundles of Angular Material or the CDK. The pure annotations should be added by the new build optimizer which is part of the CLI.
1 parent e79f7f9 commit 2320532

File tree

5 files changed

+11
-45
lines changed

5 files changed

+11
-45
lines changed

tools/package-tools/build-release.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import {join} from 'path';
22
import {mkdirpSync} from 'fs-extra';
33
import {copyFiles} from './copy-files';
4-
import {addPureAnnotationsToFile} from './pure-annotations';
54
import {replaceVersionPlaceholders} from './version-placeholders';
65
import {inlinePackageMetadataFiles} from './metadata-inlining';
76
import {createTypingsReexportFile} from './typings-reexport';
@@ -43,8 +42,6 @@ export function composeRelease(packageName: string, options: ComposeReleaseOptio
4342
if (options.useSecondaryEntryPoints) {
4443
createFilesForSecondaryEntryPoint(packageName, packagePath, releasePath);
4544
}
46-
47-
addPureAnnotationsToFile(join(releasePath, '@angular', `${packageName}.es5.js`));
4845
}
4946

5047
/** Creates files necessary for a secondary entry-point. */

tools/package-tools/copy-files.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {join, dirname} from 'path';
55
/** Function to copy files that match a glob to another directory. */
66
export function copyFiles(fromPath: string, fileGlob: string, outDir: string) {
77
glob(fileGlob, {cwd: fromPath}).forEach(filePath => {
8-
let fileDestPath = join(outDir, filePath);
8+
const fileDestPath = join(outDir, filePath);
99
mkdirpSync(dirname(fileDestPath));
1010
copySync(join(fromPath, filePath), fileDestPath);
1111
});

tools/package-tools/entry-point-package-json.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@ export function createEntryPointPackageJson(destDir: string, packageName: string
1212
es2015: `../@angular/${packageName}/${entryPointName}.js`,
1313
};
1414

15-
writeFileSync(join(destDir, 'package.json'), JSON.stringify(content), 'utf-8');
15+
writeFileSync(join(destDir, 'package.json'), JSON.stringify(content, null, 2), 'utf-8');
1616
}

tools/package-tools/metadata-reexport.ts

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,13 @@ import {join} from 'path';
33

44
/** Creates a metadata file that re-exports the metadata bundle inside of the typings. */
55
export function createMetadataReexportFile(destDir: string, from: string, name: string) {
6-
const metadataReExport = `{
7-
"__symbolic":"module",
8-
"version":3,"metadata":{},
9-
"exports":[{"from":"${from}"}],
10-
"flatModuleIndexRedirect": true
11-
}`;
12-
writeFileSync(join(destDir, `${name}.metadata.json`), metadataReExport, 'utf-8');
6+
const metadataJsonContent = JSON.stringify({
7+
__symbolic: 'module',
8+
version: 3,
9+
metadata: {},
10+
exports: [{from}],
11+
flatModuleIndexRedirect: true
12+
}, null, 2);
13+
14+
writeFileSync(join(destDir, `${name}.metadata.json`), metadataJsonContent, 'utf-8');
1315
}

tools/package-tools/pure-annotations.ts

Lines changed: 0 additions & 33 deletions
This file was deleted.

0 commit comments

Comments
 (0)