Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
25 changes: 14 additions & 11 deletions aio/tools/transforms/angular-api-package/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ module.exports = new Package('angular-api', [basePackage, typeScriptPackage])

// API files are typescript
readTypeScriptModules.basePath = API_SOURCE_PATH;
readTypeScriptModules.ignoreExportsMatching = [/^[_]|^VERSION$/];
readTypeScriptModules.ignoreExportsMatching = [/^[_Δ]|^VERSION$/];
readTypeScriptModules.hidePrivateMembers = true;

// NOTE: This list should be in sync with tools/public_api_guard/BUILD.bazel
Expand Down Expand Up @@ -204,7 +204,8 @@ module.exports = new Package('angular-api', [basePackage, typeScriptPackage])

function addMinLengthRules(checkContentRules) {
const createMinLengthRule = require('./content-rules/minLength');
const paramRuleSet = checkContentRules.docTypeRules['parameter'] = checkContentRules.docTypeRules['parameter'] || {};
const paramRuleSet = checkContentRules.docTypeRules['parameter'] =
checkContentRules.docTypeRules['parameter'] || {};
const paramRules = paramRuleSet['name'] = paramRuleSet['name'] || [];
paramRules.push(createMinLengthRule());
}
Expand All @@ -216,7 +217,8 @@ function addHeadingRules(checkContentRules, API_DOC_TYPES) {

API_DOC_TYPES.forEach(docType => {
let rules;
const ruleSet = checkContentRules.docTypeRules[docType] = checkContentRules.docTypeRules[docType] || {};
const ruleSet = checkContentRules.docTypeRules[docType] =
checkContentRules.docTypeRules[docType] || {};

rules = ruleSet['description'] = ruleSet['description'] || [];
rules.push(noMarkdownHeadings);
Expand All @@ -231,16 +233,17 @@ function addHeadingRules(checkContentRules, API_DOC_TYPES) {

function addAllowedPropertiesRules(checkContentRules, API_CONTAINED_DOC_TYPES) {
API_CONTAINED_DOC_TYPES.forEach(docType => {
const ruleSet = checkContentRules.docTypeRules[docType] = checkContentRules.docTypeRules[docType] || {};
const ruleSet = checkContentRules.docTypeRules[docType] =
checkContentRules.docTypeRules[docType] || {};

const rules = ruleSet['usageNotes'] = ruleSet['usageNotes'] || [];
rules.push((doc, prop, value) =>
value &&
// methods are allowed to have usage notes
!isMethod(doc) &&
// options on decorators are allowed to ahve usage notes
!(doc.containerDoc && doc.containerDoc.docType === 'decorator') &&
`Invalid property: "${prop}" is not allowed on "${doc.docType}" docs.`);
rules.push(
(doc, prop, value) => value &&
// methods are allowed to have usage notes
!isMethod(doc) &&
// options on decorators are allowed to ahve usage notes
!(doc.containerDoc && doc.containerDoc.docType === 'decorator') &&
`Invalid property: "${prop}" is not allowed on "${doc.docType}" docs.`);
});
}

Expand Down
2 changes: 1 addition & 1 deletion docs/PUBLIC_API.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ We explicitly don't consider the following to be our public API surface:

- any file/import paths within our package except for the `/`, `/testing` and `/bundles/*` and other documented package entry-points.
- constructors of injectable classes (services and directives) - please use DI to obtain instances of these classes
- any class members or symbols marked as `private`, or prefixed with underscore (`_`) and [barred latin o](https://en.wikipedia.org/wiki/%C6%9F) (`ɵ`)
- any class members or symbols marked as `private`, or prefixed with underscore (`_`), [barred latin o](https://en.wikipedia.org/wiki/%C6%9F) (`ɵ`), and [latin delta](https://en.wikipedia.org/wiki/Delta_(letter)) (`Δ`).
- extending any of our classes unless the support for this is specifically documented in the API docs
- the contents and API surface of the code generated by Angular's compiler (with one notable exception: the existence and name of `NgModuleFactory` instances exported from generated code is guaranteed)

Expand Down
14 changes: 7 additions & 7 deletions integration/ngcc/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,25 +40,25 @@ if [[ $? != 0 ]]; then exit 1; fi
if [[ $? != 0 ]]; then exit 1; fi

# Did it compile @angular/core/ApplicationModule correctly?
grep "ApplicationModule.ngModuleDef = defineNgModule" node_modules/@angular/core/fesm2015/core.js
grep "ApplicationModule.ngModuleDef = ΔdefineNgModule" node_modules/@angular/core/fesm2015/core.js
if [[ $? != 0 ]]; then exit 1; fi
grep "ApplicationModule.ngModuleDef = defineNgModule" node_modules/@angular/core/fesm5/core.js
grep "ApplicationModule.ngModuleDef = ΔdefineNgModule" node_modules/@angular/core/fesm5/core.js
if [[ $? != 0 ]]; then exit 1; fi
grep "ApplicationModule.ngModuleDef = ɵngcc0.defineNgModule" node_modules/@angular/core/esm2015/src/application_module.js
grep "ApplicationModule.ngModuleDef = ɵngcc0.ΔdefineNgModule" node_modules/@angular/core/esm2015/src/application_module.js
if [[ $? != 0 ]]; then exit 1; fi
grep "ApplicationModule.ngModuleDef = ɵngcc0.defineNgModule" node_modules/@angular/core/esm5/src/application_module.js
grep "ApplicationModule.ngModuleDef = ɵngcc0.ΔdefineNgModule" node_modules/@angular/core/esm5/src/application_module.js
if [[ $? != 0 ]]; then exit 1; fi

# Did it transform @angular/core typing files correctly?
grep "import [*] as ɵngcc0 from './src/r3_symbols';" node_modules/@angular/core/core.d.ts
if [[ $? != 0 ]]; then exit 1; fi
grep "static ngInjectorDef: ɵngcc0.InjectorDef<ApplicationModule>;" node_modules/@angular/core/core.d.ts
grep "static ngInjectorDef: ɵngcc0.ΔInjectorDef<ApplicationModule>;" node_modules/@angular/core/core.d.ts
if [[ $? != 0 ]]; then exit 1; fi

# Did it generate a base factory call for synthesized constructors correctly?
grep "const ɵMatTable_BaseFactory = ɵngcc0.ɵgetInheritedFactory(MatTable);" node_modules/@angular/material/esm2015/table.js
grep "const ɵMatTable_BaseFactory = ɵngcc0.ΔgetInheritedFactory(MatTable);" node_modules/@angular/material/esm2015/table.js
if [[ $? != 0 ]]; then exit 1; fi
grep "const ɵMatTable_BaseFactory = ɵngcc0.ɵgetInheritedFactory(MatTable);" node_modules/@angular/material/esm5/table.es5.js
grep "const ɵMatTable_BaseFactory = ɵngcc0.ΔgetInheritedFactory(MatTable);" node_modules/@angular/material/esm5/table.es5.js
if [[ $? != 0 ]]; then exit 1; fi

# Can it be safely run again (as a noop)?
Expand Down
40 changes: 20 additions & 20 deletions modules/benchmarks/src/tree/render3_function/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* found in the LICENSE file at https://angular.io/license
*/

import {ɵRenderFlags, ɵcontainer, ɵcontainerRefreshEnd, ɵcontainerRefreshStart, ɵdefineComponent, ɵelementEnd, ɵelementStart, ɵelementStyleProp, ɵelementStyling, ɵembeddedViewEnd, ɵembeddedViewStart, ɵinterpolation1, ɵrenderComponent as renderComponent, ɵtext, ɵtextBinding} from '@angular/core';
import {ɵRenderFlags, ɵrenderComponent as renderComponent, Δcontainer, ΔcontainerRefreshEnd, ΔcontainerRefreshStart, ΔdefineComponent, ΔelementEnd, ΔelementStart, ΔelementStyleProp, ΔelementStyling, ΔembeddedViewEnd, ΔembeddedViewStart, Δinterpolation1, Δtext, ΔtextBinding} from '@angular/core';

import {bindAction, profile} from '../../util';
import {createDom, destroyDom, detectChanges} from '../render3/tree';
Expand All @@ -18,7 +18,7 @@ export class TreeFunction {
data: TreeNode = emptyTree;

/** @nocollapse */
static ngComponentDef = ɵdefineComponent({
static ngComponentDef = ΔdefineComponent({
type: TreeFunction,
selectors: [['tree']],
consts: 5,
Expand All @@ -35,38 +35,38 @@ export class TreeFunction {
const c1 = ['background-color'];
export function TreeTpl(rf: ɵRenderFlags, ctx: TreeNode) {
if (rf & ɵRenderFlags.Create) {
ɵelementStart(0, 'tree');
ΔelementStart(0, 'tree');
{
ɵelementStart(1, 'span');
ɵelementStyling(null, c1);
{ ɵtext(2); }
ɵelementEnd();
ɵcontainer(3);
ɵcontainer(4);
ΔelementStart(1, 'span');
ΔelementStyling(null, c1);
{ Δtext(2); }
ΔelementEnd();
Δcontainer(3);
Δcontainer(4);
}
ɵelementEnd();
ΔelementEnd();
}
if (rf & ɵRenderFlags.Update) {
ɵelementStyleProp(1, 0, ctx.depth % 2 ? '' : 'grey');
ɵtextBinding(2, ɵinterpolation1(' ', ctx.value, ' '));
ɵcontainerRefreshStart(3);
ΔelementStyleProp(1, 0, ctx.depth % 2 ? '' : 'grey');
ΔtextBinding(2, Δinterpolation1(' ', ctx.value, ' '));
ΔcontainerRefreshStart(3);
{
if (ctx.left != null) {
let rf0 = ɵembeddedViewStart(0, 5, 1);
let rf0 = ΔembeddedViewStart(0, 5, 1);
{ TreeTpl(rf0, ctx.left); }
ɵembeddedViewEnd();
ΔembeddedViewEnd();
}
}
ɵcontainerRefreshEnd();
ɵcontainerRefreshStart(4);
ΔcontainerRefreshEnd();
ΔcontainerRefreshStart(4);
{
if (ctx.right != null) {
let rf0 = ɵembeddedViewStart(0, 5, 1);
let rf0 = ΔembeddedViewStart(0, 5, 1);
{ TreeTpl(rf0, ctx.right); }
ɵembeddedViewEnd();
ΔembeddedViewEnd();
}
}
ɵcontainerRefreshEnd();
ΔcontainerRefreshEnd();
}
}

Expand Down
10 changes: 5 additions & 5 deletions packages/common/src/directives/ng_class.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* 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 {Directive, DoCheck, Input, ɵRenderFlags, ɵdefineDirective, ɵelementHostStyling, ɵelementHostStylingApply, ɵelementHostStylingMap} from '@angular/core';
import {Directive, DoCheck, Input, ɵRenderFlags, ΔdefineDirective, ΔelementHostStyling, ΔelementHostStylingApply, ΔelementHostStylingMap} from '@angular/core';

import {NgClassImpl, NgClassImplProvider} from './ng_class_impl';

Expand All @@ -29,17 +29,17 @@ export const ngClassDirectiveDef__PRE_R3__ = undefined;
// used when the VE is not present (note the directive will
// never be instantiated normally because it is apart of a
// base class)
export const ngClassDirectiveDef__POST_R3__ = ɵdefineDirective({
export const ngClassDirectiveDef__POST_R3__ = ΔdefineDirective({
type: function() {} as any,
selectors: null as any,
factory: () => {},
hostBindings: function(rf: ɵRenderFlags, ctx: any, elIndex: number) {
if (rf & ɵRenderFlags.Create) {
ɵelementHostStyling();
ΔelementHostStyling();
}
if (rf & ɵRenderFlags.Update) {
ɵelementHostStylingMap(ctx.getValue());
ɵelementHostStylingApply();
ΔelementHostStylingMap(ctx.getValue());
ΔelementHostStylingApply();
}
}
});
Expand Down
10 changes: 5 additions & 5 deletions packages/common/src/directives/ng_style.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* 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 {Directive, DoCheck, Input, ɵRenderFlags, ɵdefineDirective, ɵelementHostStyling, ɵelementHostStylingApply, ɵelementHostStylingMap} from '@angular/core';
import {Directive, DoCheck, Input, ɵRenderFlags, ΔdefineDirective, ΔelementHostStyling, ΔelementHostStylingApply, ΔelementHostStylingMap} from '@angular/core';

import {NgStyleImpl, NgStyleImplProvider} from './ng_style_impl';

Expand All @@ -29,17 +29,17 @@ export const ngStyleDirectiveDef__PRE_R3__ = undefined;
// used when the VE is not present (note the directive will
// never be instantiated normally because it is apart of a
// base class)
export const ngStyleDirectiveDef__POST_R3__ = ɵdefineDirective({
export const ngStyleDirectiveDef__POST_R3__ = ΔdefineDirective({
type: function() {} as any,
selectors: null as any,
factory: () => {},
hostBindings: function(rf: ɵRenderFlags, ctx: any, elIndex: number) {
if (rf & ɵRenderFlags.Create) {
ɵelementHostStyling();
ΔelementHostStyling();
}
if (rf & ɵRenderFlags.Update) {
ɵelementHostStylingMap(null, ctx.getValue());
ɵelementHostStylingApply();
ΔelementHostStylingMap(null, ctx.getValue());
ΔelementHostStylingApply();
}
}
});
Expand Down
6 changes: 3 additions & 3 deletions packages/common/src/viewport_scroller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* found in the LICENSE file at https://angular.io/license
*/

import {ErrorHandler, defineInjectable, inject} from '@angular/core';
import {ErrorHandler, ΔdefineInjectable, Δinject} from '@angular/core';

import {DOCUMENT} from './dom_tokens';

Expand All @@ -21,9 +21,9 @@ export abstract class ViewportScroller {
// De-sugared tree-shakable injection
// See #23917
/** @nocollapse */
static ngInjectableDef = defineInjectable({
static ngInjectableDef = ΔdefineInjectable({
providedIn: 'root',
factory: () => new BrowserViewportScroller(inject(DOCUMENT), window, inject(ErrorHandler))
factory: () => new BrowserViewportScroller(Δinject(DOCUMENT), window, Δinject(ErrorHandler))
});

/**
Expand Down
12 changes: 6 additions & 6 deletions packages/compiler-cli/ngcc/test/rendering/renderer_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,11 +152,11 @@ describe('Renderer', () => {
const addDefinitionsSpy = renderer.addDefinitions as jasmine.Spy;
expect(addDefinitionsSpy.calls.first().args[2])
.toEqual(
`A.ngComponentDef = ɵngcc0.ɵdefineComponent({ type: A, selectors: [["a"]], factory: function A_Factory(t) { return new (t || A)(); }, consts: 1, vars: 1, template: function A_Template(rf, ctx) { if (rf & 1) {
ɵngcc0.ɵtext(0);
`A.ngComponentDef = ɵngcc0.ΔdefineComponent({ type: A, selectors: [["a"]], factory: function A_Factory(t) { return new (t || A)(); }, consts: 1, vars: 1, template: function A_Template(rf, ctx) { if (rf & 1) {
ɵngcc0.Δtext(0);
} if (rf & 2) {
ɵngcc0.ɵselect(0);
ɵngcc0.ɵtextBinding(0, ɵngcc0.ɵinterpolation1("", ctx.person.name, ""));
ɵngcc0.Δselect(0);
ɵngcc0.ΔtextBinding(0, ɵngcc0.Δinterpolation1("", ctx.person.name, ""));
} }, encapsulation: 2 });
/*@__PURE__*/ ɵngcc0.ɵsetClassMetadata(A, [{
type: Component,
Expand Down Expand Up @@ -197,7 +197,7 @@ describe('Renderer', () => {
}));
expect(addDefinitionsSpy.calls.first().args[2])
.toEqual(
`A.ngDirectiveDef = ɵngcc0.ɵdefineDirective({ type: A, selectors: [["", "a", ""]], factory: function A_Factory(t) { return new (t || A)(); } });
`A.ngDirectiveDef = ɵngcc0.ΔdefineDirective({ type: A, selectors: [["", "a", ""]], factory: function A_Factory(t) { return new (t || A)(); } });
/*@__PURE__*/ ɵngcc0.ɵsetClassMetadata(A, [{
type: Directive,
args: [{ selector: '[a]' }]
Expand Down Expand Up @@ -331,7 +331,7 @@ describe('Renderer', () => {
const typingsFile = result.find(f => f.path === '/typings/file.d.ts') !;
expect(typingsFile.contents)
.toContain(
'foo(x: number): number;\n static ngDirectiveDef: ɵngcc0.ɵDirectiveDefWithMeta');
'foo(x: number): number;\n static ngDirectiveDef: ɵngcc0.ΔDirectiveDefWithMeta');
});

it('should render imports into typings files', () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/compiler-cli/src/metadata/bundler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ export class MetadataBundler {
result[key] = this.convertFunction(moduleName, value);
} else if (isMetadataSymbolicCallExpression(value)) {
// Class members can also contain static members that call a function with module
// references. e.g. "static ngInjectableDef = defineInjectable(..)". We also need to
// references. e.g. "static ngInjectableDef = ΔdefineInjectable(..)". We also need to
// convert these module references because otherwise these resolve to non-existent files.
result[key] = this.convertValue(moduleName, value);
} else {
Expand Down
16 changes: 8 additions & 8 deletions packages/compiler-cli/src/ngtsc/imports/src/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,15 @@ export class NoopImportRewriter implements ImportRewriter {
* which they're exported from r3_symbols.
*/
const CORE_SUPPORTED_SYMBOLS = new Map<string, string>([
['defineInjectable', 'defineInjectable'],
['defineInjector', 'defineInjector'],
['ɵdefineNgModule', 'defineNgModule'],
['ɵsetNgModuleScope', 'setNgModuleScope'],
['inject', 'inject'],
['ΔdefineInjectable', 'ΔdefineInjectable'],
['ΔdefineInjector', 'ΔdefineInjector'],
['ΔdefineNgModule', 'ΔdefineNgModule'],
['ΔsetNgModuleScope', 'ΔsetNgModuleScope'],
['Δinject', 'Δinject'],
['ɵsetClassMetadata', 'setClassMetadata'],
['ɵInjectableDef', 'InjectableDef'],
['ɵInjectorDef', 'InjectorDef'],
['ɵNgModuleDefWithMeta', 'NgModuleDefWithMeta'],
['ΔInjectableDef', 'ΔInjectableDef'],
['ΔInjectorDef', 'ΔInjectorDef'],
['ΔNgModuleDefWithMeta', 'ΔNgModuleDefWithMeta'],
['ɵNgModuleFactory', 'NgModuleFactory'],
]);

Expand Down
4 changes: 2 additions & 2 deletions packages/compiler-cli/test/compliance/mock_compiler_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ describe('mock_compiler', () => {
expectEmit(
result.source, `
// TODO: this comment should not be taken into account
$r3$.ɵtext(0, "Hello!");
$r3$.Δtext(0, "Hello!");
// TODO: this comment should not be taken into account
`,
'todo comments should be ignored');
Expand Down Expand Up @@ -214,4 +214,4 @@ describe('mock_compiler', () => {
result.source, '$ctx$.$n$ … $ctx$.$n$.length', 'Match names', {'$n$': /(not)_(\1)/});
}).toThrowError(/"\$n\$" is "name" which doesn't match \/\(not\)_\(\\1\)\//);
});
});
});
Loading