New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
build: produce bundle indexes for @angular
modules
#14509
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/** | ||
* @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 | ||
*/ | ||
|
||
/** | ||
* @module | ||
* @description | ||
* Entry point for all public APIs of the animation package. | ||
*/ | ||
export * from './src/animation'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/** | ||
* @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 | ||
*/ | ||
|
||
/** | ||
* @module | ||
* @description | ||
* Entry point for all public APIs of the common package. | ||
*/ | ||
export * from './src/common'; | ||
|
||
// This file only reexports content of the `src` folder. Keep it that way. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,15 +9,18 @@ | |
import {AotCompiler, AotCompilerHost, createAotCompiler} from '@angular/compiler'; | ||
import {RenderComponentType} from '@angular/core'; | ||
import {async} from '@angular/core/testing'; | ||
import {MetadataBundler, MetadataCollector, ModuleMetadata, privateEntriesToIndex} from '@angular/tsc-wrapped'; | ||
import * as path from 'path'; | ||
import * as ts from 'typescript'; | ||
|
||
import {ReflectionCapabilities, reflector} from './private_import_core'; | ||
import {EmittingCompilerHost, MockAotCompilerHost, MockCompilerHost, MockData, settings} from './test_util'; | ||
import {EmittingCompilerHost, MockAotCompilerHost, MockCompilerHost, MockData, MockMetadataBundlerHost, settings} from './test_util'; | ||
|
||
const DTS = /\.d\.ts$/; | ||
|
||
const minCoreIndex = ` | ||
export * from './src/application_module'; | ||
export * from './src/change_detection'; | ||
export * from './src/metadata'; | ||
export * from './src/di/metadata'; | ||
export * from './src/di/injector'; | ||
|
@@ -28,7 +31,7 @@ const minCoreIndex = ` | |
export * from './src/codegen_private_exports'; | ||
`; | ||
|
||
describe('compiler', () => { | ||
describe('compiler (unbundled Angular)', () => { | ||
let angularFiles: Map<string, string>; | ||
|
||
beforeAll(() => { | ||
|
@@ -55,17 +58,64 @@ describe('compiler', () => { | |
it('should compile', | ||
async(() => compile(host, aotHost, expectNoDiagnostics).then(generatedFiles => { | ||
expect(generatedFiles.find(f => /app\.component\.ngfactory\.ts/.test(f.genFileUrl))) | ||
.not.toBeUndefined(); | ||
.toBeDefined(); | ||
expect(generatedFiles.find(f => /app\.module\.ngfactory\.ts/.test(f.genFileUrl))) | ||
.not.toBeUndefined(); | ||
.toBeDefined(); | ||
}))); | ||
|
||
it('should compile using summaries', | ||
async(() => summaryCompile(host, aotHost).then(generatedFiles => { | ||
expect(generatedFiles.find(f => /app\.component\.ngfactory\.ts/.test(f.genFileUrl))) | ||
.not.toBeUndefined(); | ||
.toBeDefined(); | ||
expect(generatedFiles.find(f => /app\.module\.ngfactory\.ts/.test(f.genFileUrl))) | ||
.not.toBeUndefined(); | ||
.toBeDefined(); | ||
}))); | ||
}); | ||
}); | ||
|
||
describe('compiler (bundled Angular)', () => { | ||
let angularFiles: Map<string, string>; | ||
|
||
beforeAll(() => { | ||
const emittingHost = new EmittingCompilerHost(['@angular/core/index'], {emitMetadata: false}); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes. This is unrelated to the changes we needed to make for tsickle |
||
|
||
// Create the metadata bundled | ||
const indexModule = emittingHost.effectiveName('@angular/core/index'); | ||
const bundler = new MetadataBundler( | ||
indexModule, '@angular/core', new MockMetadataBundlerHost(emittingHost)); | ||
const bundle = bundler.getMetadataBundle(); | ||
const metadata = JSON.stringify(bundle.metadata, null, ' '); | ||
const bundleIndexSource = privateEntriesToIndex('./index', bundle.privates); | ||
emittingHost.override('@angular/core/bundle_index.ts', bundleIndexSource); | ||
emittingHost.addWrittenFile( | ||
'@angular/core/package.json', JSON.stringify({typings: 'bundle_index.d.ts'})); | ||
emittingHost.addWrittenFile('@angular/core/bundle_index.metadata.json', metadata); | ||
|
||
// Emit the sources | ||
const bundleIndexName = emittingHost.effectiveName('@angular/core/bundle_index.ts'); | ||
const emittingProgram = ts.createProgram([bundleIndexName], settings, emittingHost); | ||
emittingProgram.emit(); | ||
angularFiles = emittingHost.written; | ||
}); | ||
|
||
describe('Quickstart', () => { | ||
let host: MockCompilerHost; | ||
let aotHost: MockAotCompilerHost; | ||
|
||
beforeEach(() => { | ||
host = new MockCompilerHost(QUICKSTART, FILES, angularFiles); | ||
aotHost = new MockAotCompilerHost(host); | ||
}); | ||
|
||
// Restore reflector since AoT compiler will update it with a new static reflector | ||
afterEach(() => { reflector.updateCapabilities(new ReflectionCapabilities()); }); | ||
|
||
it('should compile', | ||
async(() => compile(host, aotHost, expectNoDiagnostics).then(generatedFiles => { | ||
expect(generatedFiles.find(f => /app\.component\.ngfactory\.ts/.test(f.genFileUrl))) | ||
.toBeDefined(); | ||
expect(generatedFiles.find(f => /app\.module\.ngfactory\.ts/.test(f.genFileUrl))) | ||
.toBeDefined(); | ||
}))); | ||
}); | ||
}); | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we still need this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, as discussed offline. This is the module name the user declared in the tsconfig.json file that the compiler should generate for references to symbols in a bundle.