Skip to content

Commit 138ca5a

Browse files
benleshIgorMinar
authored andcommitted
refactor(ivy): prefix all generated instructions (angular#29692)
- Updates all instructions to be prefixed with the Greek delta symbol PR Close angular#29692
1 parent db62ccf commit 138ca5a

File tree

149 files changed

+8263
-7617
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

149 files changed

+8263
-7617
lines changed

aio/tools/transforms/angular-api-package/index.js

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ module.exports = new Package('angular-api', [basePackage, typeScriptPackage])
7474

7575
// API files are typescript
7676
readTypeScriptModules.basePath = API_SOURCE_PATH;
77-
readTypeScriptModules.ignoreExportsMatching = [/^[_]|^VERSION$/];
77+
readTypeScriptModules.ignoreExportsMatching = [/^[_Δ]|^VERSION$/];
7878
readTypeScriptModules.hidePrivateMembers = true;
7979

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

205205
function addMinLengthRules(checkContentRules) {
206206
const createMinLengthRule = require('./content-rules/minLength');
207-
const paramRuleSet = checkContentRules.docTypeRules['parameter'] = checkContentRules.docTypeRules['parameter'] || {};
207+
const paramRuleSet = checkContentRules.docTypeRules['parameter'] =
208+
checkContentRules.docTypeRules['parameter'] || {};
208209
const paramRules = paramRuleSet['name'] = paramRuleSet['name'] || [];
209210
paramRules.push(createMinLengthRule());
210211
}
@@ -216,7 +217,8 @@ function addHeadingRules(checkContentRules, API_DOC_TYPES) {
216217

217218
API_DOC_TYPES.forEach(docType => {
218219
let rules;
219-
const ruleSet = checkContentRules.docTypeRules[docType] = checkContentRules.docTypeRules[docType] || {};
220+
const ruleSet = checkContentRules.docTypeRules[docType] =
221+
checkContentRules.docTypeRules[docType] || {};
220222

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

232234
function addAllowedPropertiesRules(checkContentRules, API_CONTAINED_DOC_TYPES) {
233235
API_CONTAINED_DOC_TYPES.forEach(docType => {
234-
const ruleSet = checkContentRules.docTypeRules[docType] = checkContentRules.docTypeRules[docType] || {};
236+
const ruleSet = checkContentRules.docTypeRules[docType] =
237+
checkContentRules.docTypeRules[docType] || {};
235238

236239
const rules = ruleSet['usageNotes'] = ruleSet['usageNotes'] || [];
237-
rules.push((doc, prop, value) =>
238-
value &&
239-
// methods are allowed to have usage notes
240-
!isMethod(doc) &&
241-
// options on decorators are allowed to ahve usage notes
242-
!(doc.containerDoc && doc.containerDoc.docType === 'decorator') &&
243-
`Invalid property: "${prop}" is not allowed on "${doc.docType}" docs.`);
240+
rules.push(
241+
(doc, prop, value) => value &&
242+
// methods are allowed to have usage notes
243+
!isMethod(doc) &&
244+
// options on decorators are allowed to ahve usage notes
245+
!(doc.containerDoc && doc.containerDoc.docType === 'decorator') &&
246+
`Invalid property: "${prop}" is not allowed on "${doc.docType}" docs.`);
244247
});
245248
}
246249

docs/PUBLIC_API.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ We explicitly don't consider the following to be our public API surface:
3737

3838
- any file/import paths within our package except for the `/`, `/testing` and `/bundles/*` and other documented package entry-points.
3939
- constructors of injectable classes (services and directives) - please use DI to obtain instances of these classes
40-
- any class members or symbols marked as `private`, or prefixed with underscore (`_`) and [barred latin o](https://en.wikipedia.org/wiki/%C6%9F) (`ɵ`)
40+
- 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)) (`Δ`).
4141
- extending any of our classes unless the support for this is specifically documented in the API docs
4242
- 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)
4343

integration/ngcc/test.sh

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,25 +40,25 @@ if [[ $? != 0 ]]; then exit 1; fi
4040
if [[ $? != 0 ]]; then exit 1; fi
4141

4242
# Did it compile @angular/core/ApplicationModule correctly?
43-
grep "ApplicationModule.ngModuleDef = defineNgModule" node_modules/@angular/core/fesm2015/core.js
43+
grep "ApplicationModule.ngModuleDef = ΔdefineNgModule" node_modules/@angular/core/fesm2015/core.js
4444
if [[ $? != 0 ]]; then exit 1; fi
45-
grep "ApplicationModule.ngModuleDef = defineNgModule" node_modules/@angular/core/fesm5/core.js
45+
grep "ApplicationModule.ngModuleDef = ΔdefineNgModule" node_modules/@angular/core/fesm5/core.js
4646
if [[ $? != 0 ]]; then exit 1; fi
47-
grep "ApplicationModule.ngModuleDef = ɵngcc0.defineNgModule" node_modules/@angular/core/esm2015/src/application_module.js
47+
grep "ApplicationModule.ngModuleDef = ɵngcc0.ΔdefineNgModule" node_modules/@angular/core/esm2015/src/application_module.js
4848
if [[ $? != 0 ]]; then exit 1; fi
49-
grep "ApplicationModule.ngModuleDef = ɵngcc0.defineNgModule" node_modules/@angular/core/esm5/src/application_module.js
49+
grep "ApplicationModule.ngModuleDef = ɵngcc0.ΔdefineNgModule" node_modules/@angular/core/esm5/src/application_module.js
5050
if [[ $? != 0 ]]; then exit 1; fi
5151

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

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

6464
# Can it be safely run again (as a noop)?

modules/benchmarks/src/tree/render3_function/index.ts

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* found in the LICENSE file at https://angular.io/license
77
*/
88

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

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

2020
/** @nocollapse */
21-
static ngComponentDef = ɵdefineComponent({
21+
static ngComponentDef = ΔdefineComponent({
2222
type: TreeFunction,
2323
selectors: [['tree']],
2424
consts: 5,
@@ -35,38 +35,38 @@ export class TreeFunction {
3535
const c1 = ['background-color'];
3636
export function TreeTpl(rf: ɵRenderFlags, ctx: TreeNode) {
3737
if (rf & ɵRenderFlags.Create) {
38-
ɵelementStart(0, 'tree');
38+
ΔelementStart(0, 'tree');
3939
{
40-
ɵelementStart(1, 'span');
41-
ɵelementStyling(null, c1);
42-
{ ɵtext(2); }
43-
ɵelementEnd();
44-
ɵcontainer(3);
45-
ɵcontainer(4);
40+
ΔelementStart(1, 'span');
41+
ΔelementStyling(null, c1);
42+
{ Δtext(2); }
43+
ΔelementEnd();
44+
Δcontainer(3);
45+
Δcontainer(4);
4646
}
47-
ɵelementEnd();
47+
ΔelementEnd();
4848
}
4949
if (rf & ɵRenderFlags.Update) {
50-
ɵelementStyleProp(1, 0, ctx.depth % 2 ? '' : 'grey');
51-
ɵtextBinding(2, ɵinterpolation1(' ', ctx.value, ' '));
52-
ɵcontainerRefreshStart(3);
50+
ΔelementStyleProp(1, 0, ctx.depth % 2 ? '' : 'grey');
51+
ΔtextBinding(2, Δinterpolation1(' ', ctx.value, ' '));
52+
ΔcontainerRefreshStart(3);
5353
{
5454
if (ctx.left != null) {
55-
let rf0 = ɵembeddedViewStart(0, 5, 1);
55+
let rf0 = ΔembeddedViewStart(0, 5, 1);
5656
{ TreeTpl(rf0, ctx.left); }
57-
ɵembeddedViewEnd();
57+
ΔembeddedViewEnd();
5858
}
5959
}
60-
ɵcontainerRefreshEnd();
61-
ɵcontainerRefreshStart(4);
60+
ΔcontainerRefreshEnd();
61+
ΔcontainerRefreshStart(4);
6262
{
6363
if (ctx.right != null) {
64-
let rf0 = ɵembeddedViewStart(0, 5, 1);
64+
let rf0 = ΔembeddedViewStart(0, 5, 1);
6565
{ TreeTpl(rf0, ctx.right); }
66-
ɵembeddedViewEnd();
66+
ΔembeddedViewEnd();
6767
}
6868
}
69-
ɵcontainerRefreshEnd();
69+
ΔcontainerRefreshEnd();
7070
}
7171
}
7272

packages/common/src/directives/ng_class.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* Use of this source code is governed by an MIT-style license that can be
66
* found in the LICENSE file at https://angular.io/license
77
*/
8-
import {Directive, DoCheck, Input, ɵRenderFlags, ɵdefineDirective, ɵelementHostStyling, ɵelementHostStylingApply, ɵelementHostStylingMap} from '@angular/core';
8+
import {Directive, DoCheck, Input, ɵRenderFlags, ΔdefineDirective, ΔelementHostStyling, ΔelementHostStylingApply, ΔelementHostStylingMap} from '@angular/core';
99

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

@@ -29,17 +29,17 @@ export const ngClassDirectiveDef__PRE_R3__ = undefined;
2929
// used when the VE is not present (note the directive will
3030
// never be instantiated normally because it is apart of a
3131
// base class)
32-
export const ngClassDirectiveDef__POST_R3__ = ɵdefineDirective({
32+
export const ngClassDirectiveDef__POST_R3__ = ΔdefineDirective({
3333
type: function() {} as any,
3434
selectors: null as any,
3535
factory: () => {},
3636
hostBindings: function(rf: ɵRenderFlags, ctx: any, elIndex: number) {
3737
if (rf & ɵRenderFlags.Create) {
38-
ɵelementHostStyling();
38+
ΔelementHostStyling();
3939
}
4040
if (rf & ɵRenderFlags.Update) {
41-
ɵelementHostStylingMap(ctx.getValue());
42-
ɵelementHostStylingApply();
41+
ΔelementHostStylingMap(ctx.getValue());
42+
ΔelementHostStylingApply();
4343
}
4444
}
4545
});

packages/common/src/directives/ng_style.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* Use of this source code is governed by an MIT-style license that can be
66
* found in the LICENSE file at https://angular.io/license
77
*/
8-
import {Directive, DoCheck, Input, ɵRenderFlags, ɵdefineDirective, ɵelementHostStyling, ɵelementHostStylingApply, ɵelementHostStylingMap} from '@angular/core';
8+
import {Directive, DoCheck, Input, ɵRenderFlags, ΔdefineDirective, ΔelementHostStyling, ΔelementHostStylingApply, ΔelementHostStylingMap} from '@angular/core';
99

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

@@ -29,17 +29,17 @@ export const ngStyleDirectiveDef__PRE_R3__ = undefined;
2929
// used when the VE is not present (note the directive will
3030
// never be instantiated normally because it is apart of a
3131
// base class)
32-
export const ngStyleDirectiveDef__POST_R3__ = ɵdefineDirective({
32+
export const ngStyleDirectiveDef__POST_R3__ = ΔdefineDirective({
3333
type: function() {} as any,
3434
selectors: null as any,
3535
factory: () => {},
3636
hostBindings: function(rf: ɵRenderFlags, ctx: any, elIndex: number) {
3737
if (rf & ɵRenderFlags.Create) {
38-
ɵelementHostStyling();
38+
ΔelementHostStyling();
3939
}
4040
if (rf & ɵRenderFlags.Update) {
41-
ɵelementHostStylingMap(null, ctx.getValue());
42-
ɵelementHostStylingApply();
41+
ΔelementHostStylingMap(null, ctx.getValue());
42+
ΔelementHostStylingApply();
4343
}
4444
}
4545
});

packages/common/src/viewport_scroller.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* found in the LICENSE file at https://angular.io/license
77
*/
88

9-
import {ErrorHandler, defineInjectable, inject} from '@angular/core';
9+
import {ErrorHandler, ΔdefineInjectable, Δinject} from '@angular/core';
1010

1111
import {DOCUMENT} from './dom_tokens';
1212

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

2929
/**

packages/compiler-cli/ngcc/test/rendering/renderer_spec.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -152,11 +152,11 @@ describe('Renderer', () => {
152152
const addDefinitionsSpy = renderer.addDefinitions as jasmine.Spy;
153153
expect(addDefinitionsSpy.calls.first().args[2])
154154
.toEqual(
155-
`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) {
156-
ɵngcc0.ɵtext(0);
155+
`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) {
156+
ɵngcc0.Δtext(0);
157157
} if (rf & 2) {
158-
ɵngcc0.ɵselect(0);
159-
ɵngcc0.ɵtextBinding(0, ɵngcc0.ɵinterpolation1("", ctx.person.name, ""));
158+
ɵngcc0.Δselect(0);
159+
ɵngcc0.ΔtextBinding(0, ɵngcc0.Δinterpolation1("", ctx.person.name, ""));
160160
} }, encapsulation: 2 });
161161
/*@__PURE__*/ ɵngcc0.ɵsetClassMetadata(A, [{
162162
type: Component,
@@ -197,7 +197,7 @@ describe('Renderer', () => {
197197
}));
198198
expect(addDefinitionsSpy.calls.first().args[2])
199199
.toEqual(
200-
`A.ngDirectiveDef = ɵngcc0.ɵdefineDirective({ type: A, selectors: [["", "a", ""]], factory: function A_Factory(t) { return new (t || A)(); } });
200+
`A.ngDirectiveDef = ɵngcc0.ΔdefineDirective({ type: A, selectors: [["", "a", ""]], factory: function A_Factory(t) { return new (t || A)(); } });
201201
/*@__PURE__*/ ɵngcc0.ɵsetClassMetadata(A, [{
202202
type: Directive,
203203
args: [{ selector: '[a]' }]
@@ -331,7 +331,7 @@ describe('Renderer', () => {
331331
const typingsFile = result.find(f => f.path === '/typings/file.d.ts') !;
332332
expect(typingsFile.contents)
333333
.toContain(
334-
'foo(x: number): number;\n static ngDirectiveDef: ɵngcc0.ɵDirectiveDefWithMeta');
334+
'foo(x: number): number;\n static ngDirectiveDef: ɵngcc0.ΔDirectiveDefWithMeta');
335335
});
336336

337337
it('should render imports into typings files', () => {

packages/compiler-cli/src/metadata/bundler.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,7 @@ export class MetadataBundler {
423423
result[key] = this.convertFunction(moduleName, value);
424424
} else if (isMetadataSymbolicCallExpression(value)) {
425425
// Class members can also contain static members that call a function with module
426-
// references. e.g. "static ngInjectableDef = defineInjectable(..)". We also need to
426+
// references. e.g. "static ngInjectableDef = ΔdefineInjectable(..)". We also need to
427427
// convert these module references because otherwise these resolve to non-existent files.
428428
result[key] = this.convertValue(moduleName, value);
429429
} else {

packages/compiler-cli/src/ngtsc/imports/src/core.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,15 +48,15 @@ export class NoopImportRewriter implements ImportRewriter {
4848
* which they're exported from r3_symbols.
4949
*/
5050
const CORE_SUPPORTED_SYMBOLS = new Map<string, string>([
51-
['defineInjectable', 'defineInjectable'],
52-
['defineInjector', 'defineInjector'],
53-
['ɵdefineNgModule', 'defineNgModule'],
54-
['ɵsetNgModuleScope', 'setNgModuleScope'],
55-
['inject', 'inject'],
51+
['ΔdefineInjectable', 'ΔdefineInjectable'],
52+
['ΔdefineInjector', 'ΔdefineInjector'],
53+
['ΔdefineNgModule', 'ΔdefineNgModule'],
54+
['ΔsetNgModuleScope', 'ΔsetNgModuleScope'],
55+
['Δinject', 'Δinject'],
5656
['ɵsetClassMetadata', 'setClassMetadata'],
57-
['ɵInjectableDef', 'InjectableDef'],
58-
['ɵInjectorDef', 'InjectorDef'],
59-
['ɵNgModuleDefWithMeta', 'NgModuleDefWithMeta'],
57+
['ΔInjectableDef', 'ΔInjectableDef'],
58+
['ΔInjectorDef', 'ΔInjectorDef'],
59+
['ΔNgModuleDefWithMeta', 'ΔNgModuleDefWithMeta'],
6060
['ɵNgModuleFactory', 'NgModuleFactory'],
6161
]);
6262

packages/compiler-cli/test/compliance/mock_compiler_spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ describe('mock_compiler', () => {
140140
expectEmit(
141141
result.source, `
142142
// TODO: this comment should not be taken into account
143-
$r3$.ɵtext(0, "Hello!");
143+
$r3$.Δtext(0, "Hello!");
144144
// TODO: this comment should not be taken into account
145145
`,
146146
'todo comments should be ignored');
@@ -214,4 +214,4 @@ describe('mock_compiler', () => {
214214
result.source, '$ctx$.$n$ … $ctx$.$n$.length', 'Match names', {'$n$': /(not)_(\1)/});
215215
}).toThrowError(/"\$n\$" is "name" which doesn't match \/\(not\)_\(\\1\)\//);
216216
});
217-
});
217+
});

0 commit comments

Comments
 (0)