Injector defs are not considered public API, so the property
that contains them should be prefixed with Angular's marker
for "private" ('ɵ') to discourage apps from relying on def
APIs directly.
This commit adds the prefix and shortens the name from
ngInjectorDef to inj. This is because property names
cannot be minified by Uglify without turning on property
mangling (which most apps have turned off) and are thus
size-sensitive.
PR Close #33151
		
	
			
		
			
				
	
	
		
			27 lines
		
	
	
		
			776 B
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
			
		
		
	
	
			27 lines
		
	
	
		
			776 B
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
| /**
 | |
|  * @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
 | |
|  */
 | |
| 
 | |
| import {nocollapseHack} from '../../src/transformers/nocollapse_hack';
 | |
| 
 | |
| describe('@nocollapse hack', () => {
 | |
|   it('should add @nocollapse to a basic class', () => {
 | |
|     const decl = `Foo.ɵinj = define(...);`;
 | |
|     expect(nocollapseHack(decl)).toEqual('/** @nocollapse */ ' + decl);
 | |
|   });
 | |
| 
 | |
|   it('should add nocollapse to an if (false) declaration of the kind generated by tsickle', () => {
 | |
|     const decl = `
 | |
|       if (false) {
 | |
|         /** @type {?} */
 | |
|         Foo.ɵinj;
 | |
|       }
 | |
|     `;
 | |
|     expect(nocollapseHack(decl)).toContain('/** @nocollapse @type {?} */');
 | |
|   });
 | |
| });
 |