test: improve symbol-extractor test by ignoring $1 suffix (#28098)
PR Close #28098
This commit is contained in:
parent
da2880d7c4
commit
6a9a48b0ac
@ -6,7 +6,7 @@
|
|||||||
* found in the LICENSE file at https://angular.io/license
|
* found in the LICENSE file at https://angular.io/license
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {ChangeDetectorRef, Directive, DoCheck, EmbeddedViewRef, Input, IterableChangeRecord, IterableChanges, IterableDiffer, IterableDiffers, NgIterable, TemplateRef, TrackByFunction, ViewContainerRef, forwardRef, isDevMode} from '@angular/core';
|
import {Directive, DoCheck, EmbeddedViewRef, Input, IterableChangeRecord, IterableChanges, IterableDiffer, IterableDiffers, NgIterable, TemplateRef, TrackByFunction, ViewContainerRef, forwardRef, isDevMode} from '@angular/core';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @publicApi
|
* @publicApi
|
||||||
@ -151,7 +151,7 @@ export class NgForOf<T> implements DoCheck {
|
|||||||
this._differ = this._differs.find(value).create(this.ngForTrackBy);
|
this._differ = this._differs.find(value).create(this.ngForTrackBy);
|
||||||
} catch {
|
} catch {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
`Cannot find a differ supporting object '${value}' of type '${getTypeNameForDebugging(value)}'. NgFor only supports binding to Iterables such as Arrays.`);
|
`Cannot find a differ supporting object '${value}' of type '${getTypeName(value)}'. NgFor only supports binding to Iterables such as Arrays.`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -218,6 +218,6 @@ class RecordViewTuple<T> {
|
|||||||
constructor(public record: any, public view: EmbeddedViewRef<NgForOfContext<T>>) {}
|
constructor(public record: any, public view: EmbeddedViewRef<NgForOfContext<T>>) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getTypeNameForDebugging(type: any): string {
|
function getTypeName(type: any): string {
|
||||||
return type['name'] || typeof type;
|
return type['name'] || typeof type;
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,7 @@ import {PlayerHandler} from './interfaces/player';
|
|||||||
import {RElement, Renderer3, RendererFactory3, domRendererFactory3} from './interfaces/renderer';
|
import {RElement, Renderer3, RendererFactory3, domRendererFactory3} from './interfaces/renderer';
|
||||||
import {CONTEXT, FLAGS, HEADER_OFFSET, HOST, HOST_NODE, LView, LViewFlags, RootContext, RootContextFlags, TVIEW} from './interfaces/view';
|
import {CONTEXT, FLAGS, HEADER_OFFSET, HOST, HOST_NODE, LView, LViewFlags, RootContext, RootContextFlags, TVIEW} from './interfaces/view';
|
||||||
import {enterView, getPreviousOrParentTNode, leaveView, resetComponentState, setCurrentDirectiveDef} from './state';
|
import {enterView, getPreviousOrParentTNode, leaveView, resetComponentState, setCurrentDirectiveDef} from './state';
|
||||||
import {defaultScheduler, getRootView, readPatchedLView, stringify} from './util';
|
import {defaultScheduler, getRootView, readPatchedLView, renderStringify} from './util';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -84,7 +84,7 @@ type HostFeature = (<T>(component: T, componentDef: ComponentDef<T>) => void);
|
|||||||
// TODO: A hack to not pull in the NullInjector from @angular/core.
|
// TODO: A hack to not pull in the NullInjector from @angular/core.
|
||||||
export const NULL_INJECTOR: Injector = {
|
export const NULL_INJECTOR: Injector = {
|
||||||
get: (token: any, notFoundValue?: any) => {
|
get: (token: any, notFoundValue?: any) => {
|
||||||
throw new Error('NullInjector: Not found: ' + stringify(token));
|
throw new Error('NullInjector: Not found: ' + renderStringify(token));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ import {DECLARATION_VIEW, HOST_NODE, INJECTOR, LView, TData, TVIEW, TView} from
|
|||||||
import {assertNodeOfPossibleTypes} from './node_assert';
|
import {assertNodeOfPossibleTypes} from './node_assert';
|
||||||
import {unwrapOnChangesDirectiveWrapper} from './onchanges_util';
|
import {unwrapOnChangesDirectiveWrapper} from './onchanges_util';
|
||||||
import {getLView, getPreviousOrParentTNode, setTNodeAndViewData} from './state';
|
import {getLView, getPreviousOrParentTNode, setTNodeAndViewData} from './state';
|
||||||
import {findComponentView, getParentInjectorIndex, getParentInjectorView, hasParentInjector, isComponent, isComponentDef, stringify} from './util';
|
import {findComponentView, getParentInjectorIndex, getParentInjectorView, hasParentInjector, isComponent, isComponentDef, renderStringify} from './util';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -312,7 +312,7 @@ export function getOrCreateInjectable<T>(
|
|||||||
try {
|
try {
|
||||||
const value = bloomHash();
|
const value = bloomHash();
|
||||||
if (value == null && !(flags & InjectFlags.Optional)) {
|
if (value == null && !(flags & InjectFlags.Optional)) {
|
||||||
throw new Error(`No provider for ${stringify(token)}!`);
|
throw new Error(`No provider for ${renderStringify(token)}!`);
|
||||||
} else {
|
} else {
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
@ -402,7 +402,7 @@ export function getOrCreateInjectable<T>(
|
|||||||
if (flags & InjectFlags.Optional) {
|
if (flags & InjectFlags.Optional) {
|
||||||
return notFoundValue;
|
return notFoundValue;
|
||||||
} else {
|
} else {
|
||||||
throw new Error(`NodeInjector: NOT_FOUND [${stringify(token)}]`);
|
throw new Error(`NodeInjector: NOT_FOUND [${renderStringify(token)}]`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -500,7 +500,7 @@ export function getNodeInjectable(
|
|||||||
if (isFactory(value)) {
|
if (isFactory(value)) {
|
||||||
const factory: NodeInjectorFactory = value;
|
const factory: NodeInjectorFactory = value;
|
||||||
if (factory.resolving) {
|
if (factory.resolving) {
|
||||||
throw new Error(`Circular dep for ${stringify(tData[index])}`);
|
throw new Error(`Circular dep for ${renderStringify(tData[index])}`);
|
||||||
}
|
}
|
||||||
const previousIncludeViewProviders = setIncludeViewProviders(factory.canSeeViewProviders);
|
const previousIncludeViewProviders = setIncludeViewProviders(factory.canSeeViewProviders);
|
||||||
factory.resolving = true;
|
factory.resolving = true;
|
||||||
|
@ -15,7 +15,7 @@ import {LContext} from './interfaces/context';
|
|||||||
import {DirectiveDef} from './interfaces/definition';
|
import {DirectiveDef} from './interfaces/definition';
|
||||||
import {TElementNode, TNode, TNodeProviderIndexes} from './interfaces/node';
|
import {TElementNode, TNode, TNodeProviderIndexes} from './interfaces/node';
|
||||||
import {CLEANUP, CONTEXT, FLAGS, HOST, LView, LViewFlags, PARENT, RootContext, TVIEW} from './interfaces/view';
|
import {CLEANUP, CONTEXT, FLAGS, HOST, LView, LViewFlags, PARENT, RootContext, TVIEW} from './interfaces/view';
|
||||||
import {readElementValue, readPatchedLView, stringify} from './util';
|
import {readElementValue, readPatchedLView, renderStringify} from './util';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -201,7 +201,7 @@ export function loadLContext(target: {}, throwOnNotFound: boolean = true): LCont
|
|||||||
const context = getLContext(target);
|
const context = getLContext(target);
|
||||||
if (!context && throwOnNotFound) {
|
if (!context && throwOnNotFound) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
ngDevMode ? `Unable to find context associated with ${stringify(target)}` :
|
ngDevMode ? `Unable to find context associated with ${renderStringify(target)}` :
|
||||||
'Invalid ng target');
|
'Invalid ng target');
|
||||||
}
|
}
|
||||||
return context;
|
return context;
|
||||||
|
@ -22,7 +22,7 @@ import {BINDING_INDEX, HEADER_OFFSET, HOST_NODE, LView, RENDERER, TVIEW, TView}
|
|||||||
import {appendChild, createTextNode, removeChild} from './node_manipulation';
|
import {appendChild, createTextNode, removeChild} from './node_manipulation';
|
||||||
import {getIsParent, getLView, getPreviousOrParentTNode, setIsParent, setPreviousOrParentTNode} from './state';
|
import {getIsParent, getLView, getPreviousOrParentTNode, setIsParent, setPreviousOrParentTNode} from './state';
|
||||||
import {NO_CHANGE} from './tokens';
|
import {NO_CHANGE} from './tokens';
|
||||||
import {addAllToArray, getNativeByIndex, getNativeByTNode, getTNode, isLContainer, stringify} from './util';
|
import {addAllToArray, getNativeByIndex, getNativeByTNode, getTNode, isLContainer, renderStringify} from './util';
|
||||||
|
|
||||||
const MARKER = `<EFBFBD>`;
|
const MARKER = `<EFBFBD>`;
|
||||||
const ICU_BLOCK_REGEX = /^\s*(<28>\d+:?\d*<2A>)\s*,\s*(select|plural)\s*,/;
|
const ICU_BLOCK_REGEX = /^\s*(<28>\d+:?\d*<2A>)\s*,\s*(select|plural)\s*,/;
|
||||||
@ -712,7 +712,7 @@ function readUpdateOpCodes(
|
|||||||
} else if (typeof opCode == 'number') {
|
} else if (typeof opCode == 'number') {
|
||||||
if (opCode < 0) {
|
if (opCode < 0) {
|
||||||
// It's a binding index whose value is negative
|
// It's a binding index whose value is negative
|
||||||
value += stringify(viewData[bindingsStartIndex - opCode]);
|
value += renderStringify(viewData[bindingsStartIndex - opCode]);
|
||||||
} else {
|
} else {
|
||||||
const nodeIndex = opCode >>> I18nUpdateOpCode.SHIFT_REF;
|
const nodeIndex = opCode >>> I18nUpdateOpCode.SHIFT_REF;
|
||||||
switch (opCode & I18nUpdateOpCode.MASK_OPCODE) {
|
switch (opCode & I18nUpdateOpCode.MASK_OPCODE) {
|
||||||
|
@ -40,7 +40,7 @@ import {getInitialClassNameValue, initializeStaticContext as initializeStaticSty
|
|||||||
import {BoundPlayerFactory} from './styling/player_factory';
|
import {BoundPlayerFactory} from './styling/player_factory';
|
||||||
import {createEmptyStylingContext, getStylingContext, hasClassInput, hasStyling, isAnimationProp} from './styling/util';
|
import {createEmptyStylingContext, getStylingContext, hasClassInput, hasStyling, isAnimationProp} from './styling/util';
|
||||||
import {NO_CHANGE} from './tokens';
|
import {NO_CHANGE} from './tokens';
|
||||||
import {findComponentView, getComponentViewByIndex, getNativeByIndex, getNativeByTNode, getRootContext, getRootView, getTNode, isComponent, isComponentDef, loadInternal, readElementValue, readPatchedLView, stringify} from './util';
|
import {findComponentView, getComponentViewByIndex, getNativeByIndex, getNativeByTNode, getRootContext, getRootView, getTNode, isComponent, isComponentDef, loadInternal, readElementValue, readPatchedLView, renderStringify} from './util';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -788,7 +788,7 @@ function setUpAttributes(native: RElement, attrs: TAttributes): void {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function createError(text: string, token: any) {
|
export function createError(text: string, token: any) {
|
||||||
return new Error(`Renderer: ${text} [${stringify(token)}]`);
|
return new Error(`Renderer: ${text} [${renderStringify(token)}]`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -984,7 +984,7 @@ export function elementAttribute(
|
|||||||
ngDevMode && ngDevMode.rendererSetAttribute++;
|
ngDevMode && ngDevMode.rendererSetAttribute++;
|
||||||
const tNode = getTNode(index, lView);
|
const tNode = getTNode(index, lView);
|
||||||
const strValue =
|
const strValue =
|
||||||
sanitizer == null ? stringify(value) : sanitizer(value, tNode.tagName || '', name);
|
sanitizer == null ? renderStringify(value) : sanitizer(value, tNode.tagName || '', name);
|
||||||
isProceduralRenderer(renderer) ? renderer.setAttribute(element, name, strValue) :
|
isProceduralRenderer(renderer) ? renderer.setAttribute(element, name, strValue) :
|
||||||
element.setAttribute(name, strValue);
|
element.setAttribute(name, strValue);
|
||||||
}
|
}
|
||||||
@ -1329,7 +1329,7 @@ export function elementStyleProp(
|
|||||||
if (suffix) {
|
if (suffix) {
|
||||||
// when a suffix is applied then it will bypass
|
// when a suffix is applied then it will bypass
|
||||||
// sanitization entirely (b/c a new string is created)
|
// sanitization entirely (b/c a new string is created)
|
||||||
valueToAdd = stringify(value) + suffix;
|
valueToAdd = renderStringify(value) + suffix;
|
||||||
} else {
|
} else {
|
||||||
// sanitization happens by dealing with a String value
|
// sanitization happens by dealing with a String value
|
||||||
// this means that the string value will be passed through
|
// this means that the string value will be passed through
|
||||||
@ -1458,8 +1458,8 @@ export function textBinding<T>(index: number, value: T | NO_CHANGE): void {
|
|||||||
ngDevMode && assertDefined(element, 'native element should exist');
|
ngDevMode && assertDefined(element, 'native element should exist');
|
||||||
ngDevMode && ngDevMode.rendererSetText++;
|
ngDevMode && ngDevMode.rendererSetText++;
|
||||||
const renderer = lView[RENDERER];
|
const renderer = lView[RENDERER];
|
||||||
isProceduralRenderer(renderer) ? renderer.setValue(element, stringify(value)) :
|
isProceduralRenderer(renderer) ? renderer.setValue(element, renderStringify(value)) :
|
||||||
element.textContent = stringify(value);
|
element.textContent = renderStringify(value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2718,7 +2718,7 @@ export function interpolationV(values: any[]): string|NO_CHANGE {
|
|||||||
// Build the updated content
|
// Build the updated content
|
||||||
let content = values[0];
|
let content = values[0];
|
||||||
for (let i = 1; i < values.length; i += 2) {
|
for (let i = 1; i < values.length; i += 2) {
|
||||||
content += stringify(values[i]) + values[i + 1];
|
content += renderStringify(values[i]) + values[i + 1];
|
||||||
}
|
}
|
||||||
|
|
||||||
return content;
|
return content;
|
||||||
@ -2735,7 +2735,7 @@ export function interpolation1(prefix: string, v0: any, suffix: string): string|
|
|||||||
const lView = getLView();
|
const lView = getLView();
|
||||||
const different = bindingUpdated(lView, lView[BINDING_INDEX], v0);
|
const different = bindingUpdated(lView, lView[BINDING_INDEX], v0);
|
||||||
lView[BINDING_INDEX] += 1;
|
lView[BINDING_INDEX] += 1;
|
||||||
return different ? prefix + stringify(v0) + suffix : NO_CHANGE;
|
return different ? prefix + renderStringify(v0) + suffix : NO_CHANGE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Creates an interpolation binding with 2 expressions. */
|
/** Creates an interpolation binding with 2 expressions. */
|
||||||
@ -2745,7 +2745,7 @@ export function interpolation2(
|
|||||||
const different = bindingUpdated2(lView, lView[BINDING_INDEX], v0, v1);
|
const different = bindingUpdated2(lView, lView[BINDING_INDEX], v0, v1);
|
||||||
lView[BINDING_INDEX] += 2;
|
lView[BINDING_INDEX] += 2;
|
||||||
|
|
||||||
return different ? prefix + stringify(v0) + i0 + stringify(v1) + suffix : NO_CHANGE;
|
return different ? prefix + renderStringify(v0) + i0 + renderStringify(v1) + suffix : NO_CHANGE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Creates an interpolation binding with 3 expressions. */
|
/** Creates an interpolation binding with 3 expressions. */
|
||||||
@ -2756,8 +2756,9 @@ export function interpolation3(
|
|||||||
const different = bindingUpdated3(lView, lView[BINDING_INDEX], v0, v1, v2);
|
const different = bindingUpdated3(lView, lView[BINDING_INDEX], v0, v1, v2);
|
||||||
lView[BINDING_INDEX] += 3;
|
lView[BINDING_INDEX] += 3;
|
||||||
|
|
||||||
return different ? prefix + stringify(v0) + i0 + stringify(v1) + i1 + stringify(v2) + suffix :
|
return different ?
|
||||||
NO_CHANGE;
|
prefix + renderStringify(v0) + i0 + renderStringify(v1) + i1 + renderStringify(v2) + suffix :
|
||||||
|
NO_CHANGE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Create an interpolation binding with 4 expressions. */
|
/** Create an interpolation binding with 4 expressions. */
|
||||||
@ -2769,8 +2770,8 @@ export function interpolation4(
|
|||||||
lView[BINDING_INDEX] += 4;
|
lView[BINDING_INDEX] += 4;
|
||||||
|
|
||||||
return different ?
|
return different ?
|
||||||
prefix + stringify(v0) + i0 + stringify(v1) + i1 + stringify(v2) + i2 + stringify(v3) +
|
prefix + renderStringify(v0) + i0 + renderStringify(v1) + i1 + renderStringify(v2) + i2 +
|
||||||
suffix :
|
renderStringify(v3) + suffix :
|
||||||
NO_CHANGE;
|
NO_CHANGE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2785,8 +2786,8 @@ export function interpolation5(
|
|||||||
lView[BINDING_INDEX] += 5;
|
lView[BINDING_INDEX] += 5;
|
||||||
|
|
||||||
return different ?
|
return different ?
|
||||||
prefix + stringify(v0) + i0 + stringify(v1) + i1 + stringify(v2) + i2 + stringify(v3) + i3 +
|
prefix + renderStringify(v0) + i0 + renderStringify(v1) + i1 + renderStringify(v2) + i2 +
|
||||||
stringify(v4) + suffix :
|
renderStringify(v3) + i3 + renderStringify(v4) + suffix :
|
||||||
NO_CHANGE;
|
NO_CHANGE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2801,8 +2802,8 @@ export function interpolation6(
|
|||||||
lView[BINDING_INDEX] += 6;
|
lView[BINDING_INDEX] += 6;
|
||||||
|
|
||||||
return different ?
|
return different ?
|
||||||
prefix + stringify(v0) + i0 + stringify(v1) + i1 + stringify(v2) + i2 + stringify(v3) + i3 +
|
prefix + renderStringify(v0) + i0 + renderStringify(v1) + i1 + renderStringify(v2) + i2 +
|
||||||
stringify(v4) + i4 + stringify(v5) + suffix :
|
renderStringify(v3) + i3 + renderStringify(v4) + i4 + renderStringify(v5) + suffix :
|
||||||
NO_CHANGE;
|
NO_CHANGE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2818,8 +2819,9 @@ export function interpolation7(
|
|||||||
lView[BINDING_INDEX] += 7;
|
lView[BINDING_INDEX] += 7;
|
||||||
|
|
||||||
return different ?
|
return different ?
|
||||||
prefix + stringify(v0) + i0 + stringify(v1) + i1 + stringify(v2) + i2 + stringify(v3) + i3 +
|
prefix + renderStringify(v0) + i0 + renderStringify(v1) + i1 + renderStringify(v2) + i2 +
|
||||||
stringify(v4) + i4 + stringify(v5) + i5 + stringify(v6) + suffix :
|
renderStringify(v3) + i3 + renderStringify(v4) + i4 + renderStringify(v5) + i5 +
|
||||||
|
renderStringify(v6) + suffix :
|
||||||
NO_CHANGE;
|
NO_CHANGE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2835,8 +2837,9 @@ export function interpolation8(
|
|||||||
lView[BINDING_INDEX] += 8;
|
lView[BINDING_INDEX] += 8;
|
||||||
|
|
||||||
return different ?
|
return different ?
|
||||||
prefix + stringify(v0) + i0 + stringify(v1) + i1 + stringify(v2) + i2 + stringify(v3) + i3 +
|
prefix + renderStringify(v0) + i0 + renderStringify(v1) + i1 + renderStringify(v2) + i2 +
|
||||||
stringify(v4) + i4 + stringify(v5) + i5 + stringify(v6) + i6 + stringify(v7) + suffix :
|
renderStringify(v3) + i3 + renderStringify(v4) + i4 + renderStringify(v5) + i5 +
|
||||||
|
renderStringify(v6) + i6 + renderStringify(v7) + suffix :
|
||||||
NO_CHANGE;
|
NO_CHANGE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@ import {componentNeedsResolution, maybeQueueResolutionOfComponentResources} from
|
|||||||
import {ViewEncapsulation} from '../../metadata/view';
|
import {ViewEncapsulation} from '../../metadata/view';
|
||||||
import {EMPTY_ARRAY, EMPTY_OBJ} from '../empty';
|
import {EMPTY_ARRAY, EMPTY_OBJ} from '../empty';
|
||||||
import {NG_COMPONENT_DEF, NG_DIRECTIVE_DEF} from '../fields';
|
import {NG_COMPONENT_DEF, NG_DIRECTIVE_DEF} from '../fields';
|
||||||
import {stringify} from '../util';
|
import {renderStringify} from '../util';
|
||||||
|
|
||||||
import {R3DirectiveMetadataFacade, getCompilerFacade} from './compiler_facade';
|
import {R3DirectiveMetadataFacade, getCompilerFacade} from './compiler_facade';
|
||||||
import {R3ComponentMetadataFacade, R3QueryMetadataFacade} from './compiler_facade_interface';
|
import {R3ComponentMetadataFacade, R3QueryMetadataFacade} from './compiler_facade_interface';
|
||||||
@ -43,9 +43,9 @@ export function compileComponent(type: Type<any>, metadata: Component): void {
|
|||||||
const compiler = getCompilerFacade();
|
const compiler = getCompilerFacade();
|
||||||
if (ngComponentDef === null) {
|
if (ngComponentDef === null) {
|
||||||
if (componentNeedsResolution(metadata)) {
|
if (componentNeedsResolution(metadata)) {
|
||||||
const error = [`Component '${stringify(type)}' is not resolved:`];
|
const error = [`Component '${renderStringify(type)}' is not resolved:`];
|
||||||
if (metadata.templateUrl) {
|
if (metadata.templateUrl) {
|
||||||
error.push(` - templateUrl: ${stringify(metadata.templateUrl)}`);
|
error.push(` - templateUrl: ${renderStringify(metadata.templateUrl)}`);
|
||||||
}
|
}
|
||||||
if (metadata.styleUrls && metadata.styleUrls.length) {
|
if (metadata.styleUrls && metadata.styleUrls.length) {
|
||||||
error.push(` - styleUrls: ${JSON.stringify(metadata.styleUrls)}`);
|
error.push(` - styleUrls: ${JSON.stringify(metadata.styleUrls)}`);
|
||||||
@ -69,7 +69,7 @@ export function compileComponent(type: Type<any>, metadata: Component): void {
|
|||||||
viewProviders: metadata.viewProviders || null,
|
viewProviders: metadata.viewProviders || null,
|
||||||
};
|
};
|
||||||
ngComponentDef = compiler.compileComponent(
|
ngComponentDef = compiler.compileComponent(
|
||||||
angularCoreEnv, `ng://${stringify(type)}/template.html`, meta);
|
angularCoreEnv, `ng://${renderStringify(type)}/template.html`, meta);
|
||||||
|
|
||||||
// When NgModule decorator executed, we enqueued the module definition such that
|
// When NgModule decorator executed, we enqueued the module definition such that
|
||||||
// it would only dequeue and add itself as module scope to all of its declarations,
|
// it would only dequeue and add itself as module scope to all of its declarations,
|
||||||
@ -176,7 +176,7 @@ function extractQueriesMetadata(
|
|||||||
if (!ann.selector) {
|
if (!ann.selector) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
`Can't construct a query for the property "${field}" of ` +
|
`Can't construct a query for the property "${field}" of ` +
|
||||||
`"${stringify(type)}" since the query selector wasn't defined.`);
|
`"${renderStringify(type)}" since the query selector wasn't defined.`);
|
||||||
}
|
}
|
||||||
queriesMeta.push(convertToR3QueryMetadata(field, ann));
|
queriesMeta.push(convertToR3QueryMetadata(field, ann));
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,7 @@ import {getComponentDef, getDirectiveDef, getNgModuleDef, getPipeDef} from '../d
|
|||||||
import {NG_COMPONENT_DEF, NG_DIRECTIVE_DEF, NG_MODULE_DEF, NG_PIPE_DEF} from '../fields';
|
import {NG_COMPONENT_DEF, NG_DIRECTIVE_DEF, NG_MODULE_DEF, NG_PIPE_DEF} from '../fields';
|
||||||
import {ComponentDef} from '../interfaces/definition';
|
import {ComponentDef} from '../interfaces/definition';
|
||||||
import {NgModuleType} from '../ng_module_ref';
|
import {NgModuleType} from '../ng_module_ref';
|
||||||
import {stringify} from '../util';
|
import {renderStringify} from '../util';
|
||||||
|
|
||||||
import {R3InjectorMetadataFacade, getCompilerFacade} from './compiler_facade';
|
import {R3InjectorMetadataFacade, getCompilerFacade} from './compiler_facade';
|
||||||
import {angularCoreEnv} from './environment';
|
import {angularCoreEnv} from './environment';
|
||||||
@ -183,7 +183,7 @@ function verifySemanticsOfNgModuleDef(moduleType: NgModuleType): void {
|
|||||||
const def = getComponentDef(type) || getDirectiveDef(type) || getPipeDef(type);
|
const def = getComponentDef(type) || getDirectiveDef(type) || getPipeDef(type);
|
||||||
if (!def) {
|
if (!def) {
|
||||||
errors.push(
|
errors.push(
|
||||||
`Unexpected value '${stringify(type)}' declared by the module '${stringify(moduleType)}'. Please add a @Pipe/@Directive/@Component annotation.`);
|
`Unexpected value '${renderStringify(type)}' declared by the module '${renderStringify(moduleType)}'. Please add a @Pipe/@Directive/@Component annotation.`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -197,7 +197,7 @@ function verifySemanticsOfNgModuleDef(moduleType: NgModuleType): void {
|
|||||||
if (combinedDeclarations.lastIndexOf(type) === -1) {
|
if (combinedDeclarations.lastIndexOf(type) === -1) {
|
||||||
// We are exporting something which we don't explicitly declare or import.
|
// We are exporting something which we don't explicitly declare or import.
|
||||||
errors.push(
|
errors.push(
|
||||||
`Can't export ${kind} ${stringify(type)} from ${stringify(moduleType)} as it was neither declared nor imported!`);
|
`Can't export ${kind} ${renderStringify(type)} from ${renderStringify(moduleType)} as it was neither declared nor imported!`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -206,11 +206,11 @@ function verifySemanticsOfNgModuleDef(moduleType: NgModuleType): void {
|
|||||||
type = resolveForwardRef(type);
|
type = resolveForwardRef(type);
|
||||||
const existingModule = ownerNgModule.get(type);
|
const existingModule = ownerNgModule.get(type);
|
||||||
if (existingModule && existingModule !== moduleType) {
|
if (existingModule && existingModule !== moduleType) {
|
||||||
const modules = [existingModule, moduleType].map(stringify).sort();
|
const modules = [existingModule, moduleType].map(renderStringify).sort();
|
||||||
errors.push(
|
errors.push(
|
||||||
`Type ${stringify(type)} is part of the declarations of 2 modules: ${modules[0]} and ${modules[1]}! ` +
|
`Type ${renderStringify(type)} is part of the declarations of 2 modules: ${modules[0]} and ${modules[1]}! ` +
|
||||||
`Please consider moving ${stringify(type)} to a higher module that imports ${modules[0]} and ${modules[1]}. ` +
|
`Please consider moving ${renderStringify(type)} to a higher module that imports ${modules[0]} and ${modules[1]}. ` +
|
||||||
`You can also create a new NgModule that exports and includes ${stringify(type)} then import that NgModule in ${modules[0]} and ${modules[1]}.`);
|
`You can also create a new NgModule that exports and includes ${renderStringify(type)} then import that NgModule in ${modules[0]} and ${modules[1]}.`);
|
||||||
} else {
|
} else {
|
||||||
// Mark type as having owner.
|
// Mark type as having owner.
|
||||||
ownerNgModule.set(type, moduleType);
|
ownerNgModule.set(type, moduleType);
|
||||||
@ -222,7 +222,7 @@ function verifySemanticsOfNgModuleDef(moduleType: NgModuleType): void {
|
|||||||
const existingModule = ownerNgModule.get(type);
|
const existingModule = ownerNgModule.get(type);
|
||||||
if (!existingModule) {
|
if (!existingModule) {
|
||||||
errors.push(
|
errors.push(
|
||||||
`Component ${stringify(type)} is not part of any NgModule or the module has not been imported into your module.`);
|
`Component ${renderStringify(type)} is not part of any NgModule or the module has not been imported into your module.`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
import {Type} from '../../interface/type';
|
import {Type} from '../../interface/type';
|
||||||
import {Pipe} from '../../metadata/directives';
|
import {Pipe} from '../../metadata/directives';
|
||||||
import {NG_PIPE_DEF} from '../fields';
|
import {NG_PIPE_DEF} from '../fields';
|
||||||
import {stringify} from '../util';
|
import {renderStringify} from '../util';
|
||||||
|
|
||||||
import {getCompilerFacade} from './compiler_facade';
|
import {getCompilerFacade} from './compiler_facade';
|
||||||
import {angularCoreEnv} from './environment';
|
import {angularCoreEnv} from './environment';
|
||||||
@ -21,7 +21,7 @@ export function compilePipe(type: Type<any>, meta: Pipe): void {
|
|||||||
get: () => {
|
get: () => {
|
||||||
if (ngPipeDef === null) {
|
if (ngPipeDef === null) {
|
||||||
ngPipeDef = getCompilerFacade().compilePipe(
|
ngPipeDef = getCompilerFacade().compilePipe(
|
||||||
angularCoreEnv, `ng://${stringify(type)}/ngPipeDef.js`, {
|
angularCoreEnv, `ng://${renderStringify(type)}/ngPipeDef.js`, {
|
||||||
type: type,
|
type: type,
|
||||||
name: type.name,
|
name: type.name,
|
||||||
deps: reflectDependencies(type),
|
deps: reflectDependencies(type),
|
||||||
|
@ -14,7 +14,7 @@ import {unusedValueExportToPlacateAjd as unused3} from './interfaces/projection'
|
|||||||
import {ProceduralRenderer3, RComment, RElement, RNode, RText, Renderer3, isProceduralRenderer, unusedValueExportToPlacateAjd as unused4} from './interfaces/renderer';
|
import {ProceduralRenderer3, RComment, RElement, RNode, RText, Renderer3, isProceduralRenderer, unusedValueExportToPlacateAjd as unused4} from './interfaces/renderer';
|
||||||
import {CLEANUP, CONTAINER_INDEX, FLAGS, HEADER_OFFSET, HOST_NODE, HookData, LView, LViewFlags, NEXT, PARENT, QUERIES, RENDERER, TVIEW, unusedValueExportToPlacateAjd as unused5} from './interfaces/view';
|
import {CLEANUP, CONTAINER_INDEX, FLAGS, HEADER_OFFSET, HOST_NODE, HookData, LView, LViewFlags, NEXT, PARENT, QUERIES, RENDERER, TVIEW, unusedValueExportToPlacateAjd as unused5} from './interfaces/view';
|
||||||
import {assertNodeType} from './node_assert';
|
import {assertNodeType} from './node_assert';
|
||||||
import {findComponentView, getNativeByTNode, isLContainer, isRootView, readElementValue, stringify} from './util';
|
import {findComponentView, getNativeByTNode, isLContainer, isRootView, readElementValue, renderStringify} from './util';
|
||||||
|
|
||||||
const unusedValueToPlacateAjd = unused1 + unused2 + unused3 + unused4 + unused5;
|
const unusedValueToPlacateAjd = unused1 + unused2 + unused3 + unused4 + unused5;
|
||||||
|
|
||||||
@ -178,8 +178,8 @@ function executeNodeAction(
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function createTextNode(value: any, renderer: Renderer3): RText {
|
export function createTextNode(value: any, renderer: Renderer3): RText {
|
||||||
return isProceduralRenderer(renderer) ? renderer.createText(stringify(value)) :
|
return isProceduralRenderer(renderer) ? renderer.createText(renderStringify(value)) :
|
||||||
renderer.createTextNode(stringify(value));
|
renderer.createTextNode(renderStringify(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -31,7 +31,10 @@ export function isDifferent(a: any, b: any): boolean {
|
|||||||
return !(a !== a && b !== b) && a !== b;
|
return !(a !== a && b !== b) && a !== b;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function stringify(value: any): string {
|
/**
|
||||||
|
* Used for stringify render output in Ivy.
|
||||||
|
*/
|
||||||
|
export function renderStringify(value: any): string {
|
||||||
if (typeof value == 'function') return value.name || value;
|
if (typeof value == 'function') return value.name || value;
|
||||||
if (typeof value == 'string') return value;
|
if (typeof value == 'string') return value;
|
||||||
if (value == null) return '';
|
if (value == null) return '';
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
import {SANITIZER} from '../render3/interfaces/view';
|
import {SANITIZER} from '../render3/interfaces/view';
|
||||||
import {getLView} from '../render3/state';
|
import {getLView} from '../render3/state';
|
||||||
import {stringify} from '../render3/util';
|
import {renderStringify} from '../render3/util';
|
||||||
|
|
||||||
import {BypassType, allowSanitizationBypass} from './bypass';
|
import {BypassType, allowSanitizationBypass} from './bypass';
|
||||||
import {_sanitizeHtml as _sanitizeHtml} from './html_sanitizer';
|
import {_sanitizeHtml as _sanitizeHtml} from './html_sanitizer';
|
||||||
@ -39,7 +39,7 @@ export function sanitizeHtml(unsafeHtml: any): string {
|
|||||||
if (allowSanitizationBypass(unsafeHtml, BypassType.Html)) {
|
if (allowSanitizationBypass(unsafeHtml, BypassType.Html)) {
|
||||||
return unsafeHtml.toString();
|
return unsafeHtml.toString();
|
||||||
}
|
}
|
||||||
return _sanitizeHtml(document, stringify(unsafeHtml));
|
return _sanitizeHtml(document, renderStringify(unsafeHtml));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -63,7 +63,7 @@ export function sanitizeStyle(unsafeStyle: any): string {
|
|||||||
if (allowSanitizationBypass(unsafeStyle, BypassType.Style)) {
|
if (allowSanitizationBypass(unsafeStyle, BypassType.Style)) {
|
||||||
return unsafeStyle.toString();
|
return unsafeStyle.toString();
|
||||||
}
|
}
|
||||||
return _sanitizeStyle(stringify(unsafeStyle));
|
return _sanitizeStyle(renderStringify(unsafeStyle));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -88,7 +88,7 @@ export function sanitizeUrl(unsafeUrl: any): string {
|
|||||||
if (allowSanitizationBypass(unsafeUrl, BypassType.Url)) {
|
if (allowSanitizationBypass(unsafeUrl, BypassType.Url)) {
|
||||||
return unsafeUrl.toString();
|
return unsafeUrl.toString();
|
||||||
}
|
}
|
||||||
return _sanitizeUrl(stringify(unsafeUrl));
|
return _sanitizeUrl(renderStringify(unsafeUrl));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -401,6 +401,9 @@
|
|||||||
{
|
{
|
||||||
"name": "renderEmbeddedTemplate"
|
"name": "renderEmbeddedTemplate"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "renderStringify"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "resetComponentState"
|
"name": "resetComponentState"
|
||||||
},
|
},
|
||||||
@ -434,9 +437,6 @@
|
|||||||
{
|
{
|
||||||
"name": "setUpAttributes"
|
"name": "setUpAttributes"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"name": "stringify$1"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"name": "syncViewWithBlueprint"
|
"name": "syncViewWithBlueprint"
|
||||||
},
|
},
|
||||||
|
@ -3,16 +3,16 @@
|
|||||||
"name": "APP_ROOT"
|
"name": "APP_ROOT"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "CIRCULAR$1"
|
"name": "CIRCULAR"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "EMPTY_ARRAY$2"
|
"name": "EMPTY_ARRAY"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "EmptyErrorImpl"
|
"name": "EmptyErrorImpl"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "INJECTOR$1"
|
"name": "INJECTOR"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Inject"
|
"name": "Inject"
|
||||||
@ -33,7 +33,7 @@
|
|||||||
"name": "NOT_YET"
|
"name": "NOT_YET"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "NULL_INJECTOR$1"
|
"name": "NULL_INJECTOR"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "NullInjector"
|
"name": "NullInjector"
|
||||||
@ -63,7 +63,7 @@
|
|||||||
"name": "THROW_IF_NOT_FOUND"
|
"name": "THROW_IF_NOT_FOUND"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "USE_VALUE$2"
|
"name": "USE_VALUE"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "UnsubscriptionErrorImpl"
|
"name": "UnsubscriptionErrorImpl"
|
||||||
|
@ -795,10 +795,10 @@
|
|||||||
"name": "getTViewCleanup"
|
"name": "getTViewCleanup"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "getTypeNameForDebugging"
|
"name": "getTypeName"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "getTypeNameForDebugging$1"
|
"name": "getTypeNameForDebugging"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "getValue"
|
"name": "getValue"
|
||||||
@ -906,13 +906,13 @@
|
|||||||
"name": "isFactory"
|
"name": "isFactory"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "isJsObject$1"
|
"name": "isJsObject"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "isLContainer"
|
"name": "isLContainer"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "isListLikeIterable$1"
|
"name": "isListLikeIterable"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "isNodeMatchingSelector"
|
"name": "isNodeMatchingSelector"
|
||||||
@ -936,7 +936,7 @@
|
|||||||
"name": "isStylingContext"
|
"name": "isStylingContext"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "iterateListLike$1"
|
"name": "iterateListLike"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "leaveView"
|
"name": "leaveView"
|
||||||
@ -1076,6 +1076,9 @@
|
|||||||
{
|
{
|
||||||
"name": "renderInitialStylingValues"
|
"name": "renderInitialStylingValues"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "renderStringify"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "renderStyling"
|
"name": "renderStyling"
|
||||||
},
|
},
|
||||||
@ -1187,9 +1190,6 @@
|
|||||||
{
|
{
|
||||||
"name": "stringify"
|
"name": "stringify"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"name": "stringify$1"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"name": "syncViewWithBlueprint"
|
"name": "syncViewWithBlueprint"
|
||||||
},
|
},
|
||||||
|
@ -47,7 +47,7 @@ export class SymbolExtractor {
|
|||||||
case ts.SyntaxKind.VariableDeclaration:
|
case ts.SyntaxKind.VariableDeclaration:
|
||||||
const varDecl = child as ts.VariableDeclaration;
|
const varDecl = child as ts.VariableDeclaration;
|
||||||
if (varDecl.initializer && fnRecurseDepth !== 0) {
|
if (varDecl.initializer && fnRecurseDepth !== 0) {
|
||||||
symbols.push({name: varDecl.name.getText()});
|
symbols.push({name: stripSuffix(varDecl.name.getText())});
|
||||||
}
|
}
|
||||||
if (fnRecurseDepth == 0 && isRollupExportSymbol(varDecl)) {
|
if (fnRecurseDepth == 0 && isRollupExportSymbol(varDecl)) {
|
||||||
ts.forEachChild(child, visitor);
|
ts.forEachChild(child, visitor);
|
||||||
@ -55,7 +55,7 @@ export class SymbolExtractor {
|
|||||||
break;
|
break;
|
||||||
case ts.SyntaxKind.FunctionDeclaration:
|
case ts.SyntaxKind.FunctionDeclaration:
|
||||||
const funcDecl = child as ts.FunctionDeclaration;
|
const funcDecl = child as ts.FunctionDeclaration;
|
||||||
funcDecl.name && symbols.push({name: funcDecl.name.getText()});
|
funcDecl.name && symbols.push({name: stripSuffix(funcDecl.name.getText())});
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
// Left for easier debugging.
|
// Left for easier debugging.
|
||||||
@ -109,6 +109,11 @@ export class SymbolExtractor {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function stripSuffix(text: string): string {
|
||||||
|
const index = text.lastIndexOf('$');
|
||||||
|
return index > -1 ? text.substring(0, index) : text;
|
||||||
|
}
|
||||||
|
|
||||||
function toSymbol(v: string | Symbol): Symbol {
|
function toSymbol(v: string | Symbol): Symbol {
|
||||||
return typeof v == 'string' ? {'name': v} : v as Symbol;
|
return typeof v == 'string' ? {'name': v} : v as Symbol;
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,12 @@
|
|||||||
|
/**
|
||||||
|
* @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
|
||||||
|
*/
|
||||||
|
|
||||||
|
!function() {
|
||||||
|
'use strict';
|
||||||
|
var constant$1 = 1, method$2 = function() {}, clazz$3 = class {};
|
||||||
|
}();
|
@ -0,0 +1,5 @@
|
|||||||
|
[
|
||||||
|
"clazz",
|
||||||
|
"constant",
|
||||||
|
"method"
|
||||||
|
]
|
@ -1,9 +1,10 @@
|
|||||||
[ "EMPTY$1",
|
[
|
||||||
|
"EMPTY",
|
||||||
"NO_CHANGE",
|
"NO_CHANGE",
|
||||||
"Symbol$1",
|
"Symbol",
|
||||||
"__global$1",
|
"__global",
|
||||||
"__self$1",
|
"__self",
|
||||||
"__window$1",
|
"__window",
|
||||||
"_renderCompCount",
|
"_renderCompCount",
|
||||||
"_root",
|
"_root",
|
||||||
"createLNode",
|
"createLNode",
|
||||||
@ -13,11 +14,11 @@
|
|||||||
"invertObject",
|
"invertObject",
|
||||||
"leaveView",
|
"leaveView",
|
||||||
"locateHostElement",
|
"locateHostElement",
|
||||||
"noop$2",
|
"noop",
|
||||||
"refreshDynamicChildren",
|
"refreshDynamicChildren",
|
||||||
"renderComponentOrTemplate",
|
"renderComponentOrTemplate",
|
||||||
"renderEmbeddedTemplate",
|
"renderEmbeddedTemplate",
|
||||||
"stringify$1",
|
"stringify",
|
||||||
"canInsertNativeNode",
|
"canInsertNativeNode",
|
||||||
"createTView",
|
"createTView",
|
||||||
"executeHooks",
|
"executeHooks",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user