Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
708e1e3
build: pin @microsoft/api-extractor to 7.7.11
alan-agius4 May 12, 2020
96c5574
fix(language-service): use empty statement as parent of type node
May 12, 2020
6a66575
test(language-service): external template update should not invalidat…
May 12, 2020
67a4e51
build: prepare for TypeScript 3.9
alan-agius4 May 12, 2020
e5ca0be
refactor(ngcc): simplify the `detectKnownDeclaration()` signature
petebacondarwin May 12, 2020
605f6ae
refactor(compiler-cli): simplify and clarify `TypeScriptReflectionHos…
petebacondarwin May 12, 2020
dfd69b6
refactor(compiler-cli): delegate `hasBaseClass()` to `getBaseClassExp…
petebacondarwin May 12, 2020
1a6a71f
refactor(ngcc): remove unused import
petebacondarwin May 12, 2020
5949f3a
refactor(ngcc): ensure unlocker process works in mock file-systems
petebacondarwin May 12, 2020
e97dfd7
fix(ngcc): ensure reflection hosts can handle TS 3.9 IIFE wrapped cla…
petebacondarwin May 12, 2020
8657a24
fix(ngcc): ensure rendering formatters work with IIFE wrapped classes
petebacondarwin May 12, 2020
233ef52
test(ngcc): move specs to correct describe block
petebacondarwin May 12, 2020
50c1659
test(compiler-cli): hande TS 3.9 format in emisson tests
petebacondarwin May 12, 2020
f729a2c
test(ngcc): reformat some subject code for tests
petebacondarwin May 12, 2020
c7f7882
refactor(ngcc): rename `ReexportStatement` to `WildcardReexportStatem…
petebacondarwin May 12, 2020
57edd6b
docs(ngcc): tidy up typos etc in comments
petebacondarwin May 12, 2020
d202276
fix(ngcc): `viaModule` should be `null` for local imports
petebacondarwin May 12, 2020
b086ca9
fix(ngcc): support `defineProperty()` re-exports in CommonJS and UMD
petebacondarwin May 12, 2020
f6c0559
test(docs-infra): update payload sizes after TS 3.9 update
petebacondarwin May 12, 2020
7b455b1
fix(compiler-cli): compute the correct target output for `$localize` …
petebacondarwin May 12, 2020
8391ab8
test: update payload sizes after TS 3.9 update
alan-agius4 May 12, 2020
ade3796
test: enable importHelpers for UMD builds
alan-agius4 May 12, 2020
d0bf4b3
test: disable `cli-hello-world-lazy-rollup` from ivy tests
alan-agius4 May 12, 2020
5125158
refactor: `EventEmitter` to retain behaviour of pre TypeScript 3.9
alan-agius4 May 13, 2020
cabdb74
test: update language service module resolution cache
alan-agius4 May 13, 2020
d53f40e
build(docs-infra): correctly handle "pseudo" classes
petebacondarwin May 13, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions aio/tools/transforms/angular-api-package/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ module.exports =
new Package('angular-api', [basePackage, typeScriptPackage])

// Register the processors
.processor(require('./processors/mergeParameterInfo'))
.processor(require('./processors/processPseudoClasses'))
.processor(require('./processors/splitDescription'))
.processor(require('./processors/convertPrivateClassesToInterfaces'))
.processor(require('./processors/generateApiListDoc'))
Expand Down Expand Up @@ -76,7 +78,6 @@ module.exports =
.config(function(
readTypeScriptModules, readFilesProcessor, collectExamples, tsParser,
packageContentFileReader) {

// Tell TypeScript how to load modules that start with with `@angular`
tsParser.options.paths = {'@angular/*': [API_SOURCE_PATH + '/*']};
tsParser.options.baseUrl = '.';
Expand Down Expand Up @@ -181,14 +182,11 @@ module.exports =
})

.config(function(filterMembers) {
filterMembers.notAllowedPatterns.push(
/^ɵ/
);
filterMembers.notAllowedPatterns.push(/^ɵ/);
})


.config(function(computePathsProcessor, EXPORT_DOC_TYPES, generateApiListDoc) {

const API_SEGMENT = 'api';

generateApiListDoc.outputFolder = API_SEGMENT;
Expand Down
20 changes: 20 additions & 0 deletions aio/tools/transforms/angular-api-package/mocks/methodParameters.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
export class TestClass {
method1(
/** description of param1 */ param1: number,
/** description of param2 */ param2?: string,
/** description of param3 */ param3: object = {},
/** description of param4 */ param4 = 'default string',
) {
///
}

/**
* Some description of method 2
* @param param5 description of param5
* @param param6 description of param6
* @param param7 description of param7
*/
method2(param5: string, param6: number, param7 = 42) {
//
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/**
* @dgProcessor
*
* @description
* Merge the description from `@param` tags into the parameter docs
* extracted from the TypeScript
*
* This is actually an override of the processor provided by the `typescript` dgeni package.
* The original does not set the `defaultValue`.
*/
module.exports = function mergeParameterInfo() {
return {
$runAfter: ['readTypeScriptModules', 'tags-extracted'],
$runBefore: ['extra-docs-added'],
$process(docs) {
docs.forEach((doc) => {
if (doc.docType === 'parameter') {
// The `params` property comes from parsing the `@param` jsdoc tags on the container doc
const paramTag =
doc.container.params && doc.container.params.find(param => param.name === doc.name);
if (paramTag && paramTag.description) {
doc.description = paramTag.description;
if (doc.defaultValue === undefined) {
doc.defaultValue = paramTag.defaultValue;
}
}
}
});
},
};
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
const Dgeni = require('dgeni');
const path = require('canonical-path');
const testPackage = require('../../helpers/test-package');

describe('mergeParameterInfo', () => {
let injector;
let tsProcessor;
let mergeParameterInfoProcessor;
let parseTagsProcessor;
let extractTagsProcessor;

beforeEach(() => {
const dgeni = new Dgeni([testPackage('angular-api-package')]);
injector = dgeni.configureInjector();

tsProcessor = injector.get('readTypeScriptModules');
parseTagsProcessor = injector.get('parseTagsProcessor');
extractTagsProcessor = injector.get('extractTagsProcessor');
mergeParameterInfoProcessor = injector.get('mergeParameterInfo');
tsProcessor.basePath = path.resolve(__dirname, '../mocks');
tsProcessor.sourceFiles = ['methodParameters.ts'];
});

it('should merge the param tags into the parameter docs', () => {
const docsArray = [];

tsProcessor.$process(docsArray);
parseTagsProcessor.$process(docsArray);
extractTagsProcessor.$process(docsArray);
mergeParameterInfoProcessor.$process(docsArray);

const param5 = docsArray.find(doc => doc.name === 'param5' && doc.container.name === 'method2');
expect(param5.id).toEqual('methodParameters/TestClass.method2()~param5');
expect(param5.description).toEqual('description of param5');
expect(param5.type).toEqual('string');

const param6 = docsArray.find(doc => doc.name === 'param6' && doc.container.name === 'method2');
expect(param6.id).toEqual('methodParameters/TestClass.method2()~param6');
expect(param6.description).toEqual('description of param6');
expect(param6.type).toEqual('number');

const param7 = docsArray.find(doc => doc.name === 'param7' && doc.container.name === 'method2');
expect(param7.id).toEqual('methodParameters/TestClass.method2()~param7');
expect(param7.description).toEqual('description of param7');
expect(param7.type).toEqual('number');
expect(param7.defaultValue).toEqual('42');
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
module.exports = function processPseudoClasses(tsHost) {
return {
$runAfter: ['readTypeScriptModules'],
$runBefore: ['parsing-tags'],
$process(docs) {
docs.forEach(doc => {
if (doc.docType === 'interface' && doc.additionalDeclarations &&
doc.additionalDeclarations.length > 0) {
doc.docType = 'class';
const additionalContent = tsHost.getContent(doc.additionalDeclarations[0]);
if (!doc.content || doc.content === '@publicApi' && additionalContent) {
doc.content = additionalContent;
}
doc.members = doc.members && doc.members.filter(m => {
if (m.isNewMember) {
doc.constructorDoc = m;
doc.constructorDoc.name = 'constructor';
return false;
} else {
return true;
}
});
}
});
}
};
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
const testPackage = require('../../helpers/test-package');
const processorFactory = require('./processPseudoClasses');
const Dgeni = require('dgeni');

describe('processPseudoClasses processor', () => {
it('should be available on the injector', () => {
const dgeni = new Dgeni([testPackage('angular-api-package')]);
const injector = dgeni.configureInjector();
const processor = injector.get('processPseudoClasses');
expect(processor.$process).toBeDefined();
expect(processor.$runAfter).toEqual(['readTypeScriptModules']);
expect(processor.$runBefore).toEqual(['parsing-tags']);
});

it('should convert "interface+const" docs to "class" docs', () => {
const processor = processorFactory(jasmine.createSpyObj(['getContent']));
const docs = [
{docType: 'module', id: 'a'},
{docType: 'class', id: 'b'},
{docType: 'interface', id: 'c'},
{docType: 'interface', id: 'd', additionalDeclarations: []},
{docType: 'interface', id: 'e', additionalDeclarations: [{}]},
{docType: 'const', id: 'f'},
{docType: 'const', id: 'g', additionalDeclarations: []},
{docType: 'const', id: 'h', additionalDeclarations: [{}]},
];
processor.$process(docs);
expect(docs).toEqual([
jasmine.objectContaining({docType: 'module', id: 'a'}),
jasmine.objectContaining({docType: 'class', id: 'b'}),
jasmine.objectContaining({docType: 'interface', id: 'c'}),
jasmine.objectContaining({docType: 'interface', id: 'd'}),

// This is the only one that changes
jasmine.objectContaining({docType: 'class', id: 'e'}),

jasmine.objectContaining({docType: 'const', id: 'f'}),
jasmine.objectContaining({docType: 'const', id: 'g'}),
jasmine.objectContaining({docType: 'const', id: 'h'}),
]);
});

it('should grab the content from the first additional declaration if there is no "real" content already',
() => {
const getContent = jasmine.createSpy('getContent').and.returnValue('additional content');
const additionalDeclaration1 = {};
const additionalDeclaration2 = {};
const additionalDeclaration3 = {};
const processor = processorFactory({getContent});
const docs = [
{
docType: 'interface',
id: 'a',
content: 'original content',
additionalDeclarations: [additionalDeclaration1]
},
{
docType: 'interface',
id: 'b',
content: '@publicApi', // this does not count as "real" content
additionalDeclarations: [additionalDeclaration2]
},
{docType: 'interface', id: 'c', additionalDeclarations: [additionalDeclaration3]},
];
processor.$process(docs);
expect(docs[0].content).toEqual('original content');
expect(docs[1].content).toEqual('additional content');
expect(docs[2].content).toEqual('additional content');
expect(getContent).toHaveBeenCalledWith(additionalDeclaration1);
expect(getContent).toHaveBeenCalledWith(additionalDeclaration2);
expect(getContent).toHaveBeenCalledWith(additionalDeclaration3);
});

it('should extract any __new member from the interface members', () => {
const getContent = jasmine.createSpy('getContent').and.returnValue('additional content');
const processor = processorFactory({getContent});
const docs = [
{docType: 'interface', id: 'a', additionalDeclarations: [{}]},
{docType: 'interface', id: 'b', additionalDeclarations: [{}], members: []},
{docType: 'interface', id: 'c', additionalDeclarations: [{}], members: [{name: 'member1'}]},
{
docType: 'interface',
id: 'd',
additionalDeclarations: [{}],
members: [{name: 'member1', isNewMember: true}]
},
];
processor.$process(docs);

expect(docs[0].members).toEqual(undefined);
expect(docs[1].members).toEqual([]);
expect(docs[2].members).toEqual([{name: 'member1'}]);

expect(docs[3].members).toEqual([]);
expect(docs[3].constructorDoc).toEqual({name: 'constructor', isNewMember: true});
});
});
14 changes: 10 additions & 4 deletions goldens/public-api/core/core.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ export declare interface DoCheck {
ngDoCheck(): void;
}

export declare class ElementRef<T extends any = any> {
export declare class ElementRef<T = any> {
nativeElement: T;
constructor(nativeElement: T);
}
Expand All @@ -313,12 +313,18 @@ export declare class ErrorHandler {
handleError(error: any): void;
}

export declare class EventEmitter<T extends any> extends Subject<T> {
constructor(isAsync?: boolean);
export declare interface EventEmitter<T> extends Subject<T> {
new (isAsync?: boolean): EventEmitter<T>;
emit(value?: T): void;
subscribe(generatorOrNext?: any, error?: any, complete?: any): Subscription;
}

export declare const EventEmitter: {
new (isAsync?: boolean): EventEmitter<any>;
new <T>(isAsync?: boolean): EventEmitter<T>;
readonly prototype: EventEmitter<any>;
};

export declare interface ExistingProvider extends ExistingSansProvider {
multi?: boolean;
provide: any;
Expand Down Expand Up @@ -974,7 +980,7 @@ export declare function ɵɵresolveWindow(element: RElement & {
ownerDocument: Document;
}): {
name: string;
target: Window | null;
target: (Window & typeof globalThis) | null;
};

export declare function ɵɵrestoreView(viewToRestore: OpaqueViewState): void;
Expand Down
6 changes: 3 additions & 3 deletions goldens/size-tracking/aio-payloads.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@
"master": {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the diffs documented in the commit message don't look right. I think we should land this PR as is and file JIRAs for the individual diffs and investigate them one by one before the 10.0.0 is released.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

JIRA created: FW-2166

"uncompressed": {
"runtime-es2015": 2987,
"main-es2015": 452717,
"polyfills-es2015": 52628
"main-es2015": 453386,
"polyfills-es2015": 52655
}
}
},
"aio-local-viewengine": {
"master": {
"uncompressed": {
"runtime-es2015": 3097,
"main-es2015": 429742,
"main-es2015": 430367,
"polyfills-es2015": 52195
}
}
Expand Down
13 changes: 7 additions & 6 deletions goldens/size-tracking/integration-payloads.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"master": {
"uncompressed": {
"runtime-es2015": 1485,
"main-es2015": 142794,
"main-es2015": 143350,
"polyfills-es2015": 36657
}
}
Expand All @@ -21,7 +21,7 @@
"master": {
"uncompressed": {
"runtime-es2015": 1485,
"main-es2015": 148932,
"main-es2015": 149471,
"polyfills-es2015": 36657
}
}
Expand All @@ -30,7 +30,7 @@
"master": {
"uncompressed": {
"runtime-es2015": 1485,
"main-es2015": 138343,
"main-es2015": 138866,
"polyfills-es2015": 37334
}
}
Expand All @@ -39,7 +39,7 @@
"master": {
"uncompressed": {
"runtime-es2015": 2289,
"main-es2015": 247761,
"main-es2015": 248455,
"polyfills-es2015": 36657,
"5-es2015": 751
}
Expand All @@ -49,7 +49,7 @@
"master": {
"uncompressed": {
"runtime-es2015": 2289,
"main-es2015": 222907,
"main-es2015": 223603,
"polyfills-es2015": 36657,
"5-es2015": 779
}
Expand All @@ -60,7 +60,8 @@
"uncompressed": {
"bundle": "TODO(i): temporarily increase the payload size limit from 105779 - this is due to a closure issue related to ESM reexports that still needs to be investigated",
"bundle": "TODO(i): we should define ngDevMode to false in Closure, but --define only works in the global scope.",
"bundle": 169991
"bundle": "TODO(i): (FW-2164) TS 3.9 new class shape seems to have broken Closure in big ways. The size went from 169991 to 252338",
"bundle": 252338
}
}
}
Expand Down
Loading