Skip to content
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

refactor(ivy): migrate ɵɵ prefix back to Δ #30362

Closed
wants to merge 3 commits into from
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
94 changes: 47 additions & 47 deletions aio/content/guide/deprecations.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion aio/tools/transforms/angular-api-package/index.js
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
2 changes: 1 addition & 1 deletion docs/PUBLIC_API.md
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 (`_`), [barred latin o](https://en.wikipedia.org/wiki/%C6%9F) (`ɵ`), and [double 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 [greek 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
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
46 changes: 23 additions & 23 deletions modules/benchmarks/src/tree/render3_function/index.ts
Expand Up @@ -6,7 +6,7 @@
* found in the LICENSE file at https://angular.io/license
*/

import {ɵRenderFlags, ɵrenderComponent as renderComponent, ɵɵcontainer, ɵɵcontainerRefreshEnd, ɵɵcontainerRefreshStart, ɵɵdefineComponent, ɵɵelementEnd, ɵɵelementStart, ɵɵembeddedViewEnd, ɵɵembeddedViewStart, ɵɵinterpolation1, ɵɵselect, ɵɵstyleProp, ɵɵstyling, ɵɵtext, ɵɵtextBinding} from '@angular/core';
import {ɵRenderFlags, ɵrenderComponent as renderComponent, Δcontainer, ΔcontainerRefreshEnd, ΔcontainerRefreshStart, ΔdefineComponent, ΔelementEnd, ΔelementStart, ΔembeddedViewEnd, ΔembeddedViewStart, Δinterpolation1, Δselect, ΔstyleProp, Δstyling, Δ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,41 +35,41 @@ 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');
ɵɵstyling(null, c1);
{ ɵɵtext(2); }
ɵɵelementEnd();
ɵɵcontainer(3);
ɵɵcontainer(4);
ΔelementStart(1, 'span');
Δstyling(null, c1);
{ Δtext(2); }
ΔelementEnd();
Δcontainer(3);
Δcontainer(4);
}
ɵɵelementEnd();
ΔelementEnd();
}
if (rf & ɵRenderFlags.Update) {
ɵɵselect(1);
ɵɵstyleProp(0, ctx.depth % 2 ? '' : 'grey');
ɵɵstyling();
ɵɵselect(2);
ɵɵtextBinding(2, ɵɵinterpolation1(' ', ctx.value, ' '));
ɵɵcontainerRefreshStart(3);
Δselect(1);
ΔstyleProp(0, ctx.depth % 2 ? '' : 'grey');
Δstyling();
Δselect(2);
Δ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
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, ɵɵclassMap, ɵɵdefineDirective, ɵɵstyling, ɵɵstylingApply} from '@angular/core';
import {Directive, DoCheck, Input, ɵRenderFlags, ΔclassMap, ΔdefineDirective, Δstyling, ΔstylingApply} 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) {
ɵɵstyling();
Δstyling();
}
if (rf & ɵRenderFlags.Update) {
ɵɵclassMap(ctx.getValue());
ɵɵstylingApply();
ΔclassMap(ctx.getValue());
ΔstylingApply();
}
}
});
Expand Down
10 changes: 5 additions & 5 deletions packages/common/src/directives/ng_style.ts
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, ɵɵstyleMap, ɵɵstyling, ɵɵstylingApply} from '@angular/core';
import {Directive, DoCheck, Input, ɵRenderFlags, ΔdefineDirective, ΔstyleMap, Δstyling, ΔstylingApply} 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) {
ɵɵstyling();
Δstyling();
}
if (rf & ɵRenderFlags.Update) {
ɵɵstyleMap(ctx.getValue());
ɵɵstylingApply();
ΔstyleMap(ctx.getValue());
ΔstylingApply();
}
}
});
Expand Down
6 changes: 3 additions & 3 deletions packages/common/src/viewport_scroller.ts
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
Expand Up @@ -160,11 +160,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 @@ -205,7 +205,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 @@ -339,7 +339,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
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
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
2 changes: 1 addition & 1 deletion packages/compiler-cli/test/compliance/mock_compile.ts
Expand Up @@ -14,7 +14,7 @@ import * as ts from 'typescript';
import {NgtscProgram} from '../../src/ngtsc/program';


const IDENTIFIER = /[A-Za-z_$ɵ][A-Za-z0-9_$]*/;
const IDENTIFIER = /[A-Za-z_$ɵΔ][A-Za-z0-9_$]*/;
const OPERATOR =
/!|\?|%|\*|\/|\^|&&?|\|\|?|\(|\)|\{|\}|\[|\]|:|;|<=?|>=?|={1,3}|!==?|=>|\+\+?|--?|@|,|\.|\.\.\./;
const STRING = /'[^']*'|"[^"]*"|`[\s\S]*?`/;
Expand Down
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