build: extract interface and util sub compilation from core (#28028)
PR Close #28028
This commit is contained in:

committed by
Andrew Kushnir

parent
b05baa59e0
commit
885f1af509
@ -6,61 +6,12 @@
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
import {assertDefined, assertEqual, throwError} from '../util/assert';
|
||||
|
||||
import {getComponentDef, getNgModuleDef} from './definition';
|
||||
import {TNode} from './interfaces/node';
|
||||
import {LView} from './interfaces/view';
|
||||
|
||||
// The functions in this file verify that the assumptions we are making
|
||||
// about state in an instruction are correct before implementing any logic.
|
||||
// They are meant only to be called in dev mode as sanity checks.
|
||||
|
||||
export function assertNumber(actual: any, msg: string) {
|
||||
if (typeof actual != 'number') {
|
||||
throwError(msg);
|
||||
}
|
||||
}
|
||||
|
||||
export function assertEqual<T>(actual: T, expected: T, msg: string) {
|
||||
if (actual != expected) {
|
||||
throwError(msg);
|
||||
}
|
||||
}
|
||||
|
||||
export function assertNotEqual<T>(actual: T, expected: T, msg: string) {
|
||||
if (actual == expected) {
|
||||
throwError(msg);
|
||||
}
|
||||
}
|
||||
|
||||
export function assertSame<T>(actual: T, expected: T, msg: string) {
|
||||
if (actual !== expected) {
|
||||
throwError(msg);
|
||||
}
|
||||
}
|
||||
|
||||
export function assertLessThan<T>(actual: T, expected: T, msg: string) {
|
||||
if (actual >= expected) {
|
||||
throwError(msg);
|
||||
}
|
||||
}
|
||||
|
||||
export function assertGreaterThan<T>(actual: T, expected: T, msg: string) {
|
||||
if (actual <= expected) {
|
||||
throwError(msg);
|
||||
}
|
||||
}
|
||||
|
||||
export function assertNotDefined<T>(actual: T, msg: string) {
|
||||
if (actual != null) {
|
||||
throwError(msg);
|
||||
}
|
||||
}
|
||||
|
||||
export function assertDefined<T>(actual: T, msg: string) {
|
||||
if (actual == null) {
|
||||
throwError(msg);
|
||||
}
|
||||
}
|
||||
|
||||
export function assertComponentType(
|
||||
actual: any,
|
||||
@ -80,17 +31,6 @@ export function assertNgModuleType(
|
||||
}
|
||||
}
|
||||
|
||||
function throwError(msg: string): never {
|
||||
// tslint:disable-next-line
|
||||
debugger; // Left intentionally for better debugger experience.
|
||||
throw new Error(`ASSERTION ERROR: ${msg}`);
|
||||
}
|
||||
|
||||
export function assertDomNode(node: any) {
|
||||
assertEqual(node instanceof Node, true, 'The provided value must be an instance of a DOM Node');
|
||||
}
|
||||
|
||||
|
||||
export function assertPreviousIsParent(isParent: boolean) {
|
||||
assertEqual(isParent, true, 'previousOrParentTNode should be a parent');
|
||||
}
|
||||
@ -104,7 +44,3 @@ export function assertDataNext(lView: LView, index: number, arr?: any[]) {
|
||||
assertEqual(
|
||||
arr.length, index, `index ${index} expected to be at the end of arr (length ${arr.length})`);
|
||||
}
|
||||
|
||||
export function assertDataInRange(arr: any[], index: number) {
|
||||
assertLessThan(index, arr ? arr.length : 0, 'index expected to be a valid data index');
|
||||
}
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
import {devModeEqual} from '../change_detection/change_detection_util';
|
||||
|
||||
import {assertDataInRange, assertLessThan, assertNotEqual} from './assert';
|
||||
import {assertDataInRange, assertLessThan, assertNotEqual} from '../util/assert';
|
||||
import {throwErrorIfNoChangesMode} from './errors';
|
||||
import {BINDING_INDEX, LView} from './interfaces/view';
|
||||
import {getCheckNoChangesMode, isCreationMode} from './state';
|
||||
|
@ -11,8 +11,9 @@
|
||||
import {Type} from '../core';
|
||||
import {Injector} from '../di/injector';
|
||||
import {Sanitizer} from '../sanitization/security';
|
||||
import {assertDefined} from '../util/assert';
|
||||
|
||||
import {assertComponentType, assertDefined} from './assert';
|
||||
import {assertComponentType} from './assert';
|
||||
import {getComponentDef} from './definition';
|
||||
import {diPublicInInjector, getOrCreateNodeInjectorForNode} from './di';
|
||||
import {publishDefaultGlobalUtils} from './global_utils';
|
||||
|
@ -10,15 +10,17 @@ import {ChangeDetectorRef as ViewEngine_ChangeDetectorRef} from '../change_detec
|
||||
import {InjectionToken} from '../di/injection_token';
|
||||
import {Injector} from '../di/injector';
|
||||
import {inject} from '../di/injector_compatibility';
|
||||
import {Type} from '../interface/type';
|
||||
import {ComponentFactory as viewEngine_ComponentFactory, ComponentRef as viewEngine_ComponentRef} from '../linker/component_factory';
|
||||
import {ComponentFactoryResolver as viewEngine_ComponentFactoryResolver} from '../linker/component_factory_resolver';
|
||||
import {ElementRef as viewEngine_ElementRef} from '../linker/element_ref';
|
||||
import {NgModuleRef as viewEngine_NgModuleRef} from '../linker/ng_module_factory';
|
||||
import {RendererFactory2} from '../render/api';
|
||||
import {Sanitizer} from '../sanitization/security';
|
||||
import {Type} from '../type';
|
||||
import {assertDefined} from '../util/assert';
|
||||
import {VERSION} from '../version';
|
||||
import {assertComponentType, assertDefined} from './assert';
|
||||
|
||||
import {assertComponentType} from './assert';
|
||||
import {LifecycleHooksFeature, createRootComponent, createRootComponentView, createRootContext} from './component';
|
||||
import {getComponentDef} from './definition';
|
||||
import {NodeInjector} from './di';
|
||||
|
@ -5,8 +5,8 @@
|
||||
* 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 './ng_dev_mode';
|
||||
import {assertDomNode} from './assert';
|
||||
import '../util/ng_dev_mode';
|
||||
import {assertDomNode} from '../util/assert';
|
||||
import {EMPTY_ARRAY} from './empty';
|
||||
import {LContext, MONKEY_PATCH_KEY_NAME} from './interfaces/context';
|
||||
import {TNode, TNodeFlags} from './interfaces/node';
|
||||
|
@ -6,13 +6,15 @@
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
import './ng_dev_mode';
|
||||
import '../util/ng_dev_mode';
|
||||
|
||||
import {ChangeDetectionStrategy} from '../change_detection/constants';
|
||||
import {Mutable, Type} from '../interface/type';
|
||||
import {NgModuleDef} from '../metadata/ng_module';
|
||||
import {ViewEncapsulation} from '../metadata/view';
|
||||
import {Mutable, Type} from '../type';
|
||||
import {noSideEffects, stringify} from '../util';
|
||||
import {noSideEffects} from '../util/closure';
|
||||
import {stringify} from '../util/stringify';
|
||||
|
||||
import {EMPTY_ARRAY, EMPTY_OBJ} from './empty';
|
||||
import {NG_COMPONENT_DEF, NG_DIRECTIVE_DEF, NG_MODULE_DEF, NG_PIPE_DEF} from './fields';
|
||||
import {BaseDef, ComponentDef, ComponentDefFeature, ComponentQuery, ComponentTemplate, ComponentType, DirectiveDef, DirectiveDefFeature, DirectiveType, DirectiveTypesOrFactory, HostBindingsFunction, PipeDef, PipeType, PipeTypesOrFactory} from './interfaces/definition';
|
||||
|
@ -6,13 +6,13 @@
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
import {getInjectableDef, getInjectorDef} from '../di/defs';
|
||||
import {InjectionToken} from '../di/injection_token';
|
||||
import {Injector} from '../di/injector';
|
||||
import {InjectFlags, injectRootLimpMode, setInjectImplementation} from '../di/injector_compatibility';
|
||||
import {Type} from '../type';
|
||||
import {getInjectableDef, getInjectorDef} from '../di/interface/defs';
|
||||
import {Type} from '../interface/type';
|
||||
|
||||
import {assertDefined, assertEqual} from './assert';
|
||||
import {assertDefined, assertEqual} from '../util/assert';
|
||||
import {getComponentDef, getDirectiveDef, getPipeDef} from './definition';
|
||||
import {NG_ELEMENT_ID} from './fields';
|
||||
import {DirectiveDef} from './interfaces/definition';
|
||||
@ -24,6 +24,7 @@ import {getLView, getPreviousOrParentTNode, setTNodeAndViewData} from './state';
|
||||
import {findComponentView, getParentInjectorIndex, getParentInjectorView, hasParentInjector, isComponent, isComponentDef, stringify} from './util';
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Defines if the call to `inject` should include `viewProviders` in its resolution.
|
||||
*
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
|
||||
import {resolveForwardRef} from '../di/forward_ref';
|
||||
import {Provider} from '../di/provider';
|
||||
import {Provider} from '../di/interface/provider';
|
||||
import {isTypeProvider, providerToFactory} from '../di/r3_injector';
|
||||
|
||||
import {DirectiveDef} from '.';
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
import {Injector} from '../di/injector';
|
||||
|
||||
import {assertDefined} from './assert';
|
||||
import {assertDefined} from '../util/assert';
|
||||
import {discoverLocalRefs, getComponentAtNodeIndex, getDirectivesAtNodeIndex, getLContext} from './context_discovery';
|
||||
import {NodeInjector} from './di';
|
||||
import {LContext} from './interfaces/context';
|
||||
|
@ -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 './ng_dev_mode';
|
||||
import '../util/ng_dev_mode';
|
||||
|
||||
/**
|
||||
* This file contains reuseable "empty" symbols that can be used as default return values
|
||||
|
@ -6,7 +6,7 @@
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
import {Type} from '../../type';
|
||||
import {Type} from '../../interface/type';
|
||||
import {fillProperties} from '../../util/property';
|
||||
import {EMPTY_ARRAY, EMPTY_OBJ} from '../empty';
|
||||
import {ComponentDef, DirectiveDef, DirectiveDefFeature, RenderFlags} from '../interfaces/definition';
|
||||
|
@ -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 {Provider} from '../../di/provider';
|
||||
import {Provider} from '../../di/interface/provider';
|
||||
import {providersResolver} from '../di_setup';
|
||||
import {DirectiveDef} from '../interfaces/definition';
|
||||
|
||||
|
@ -10,8 +10,6 @@ import {getClosureSafeProperty} from '../util/property';
|
||||
|
||||
export const NG_COMPONENT_DEF = getClosureSafeProperty({ngComponentDef: getClosureSafeProperty});
|
||||
export const NG_DIRECTIVE_DEF = getClosureSafeProperty({ngDirectiveDef: getClosureSafeProperty});
|
||||
export const NG_INJECTABLE_DEF = getClosureSafeProperty({ngInjectableDef: getClosureSafeProperty});
|
||||
export const NG_INJECTOR_DEF = getClosureSafeProperty({ngInjectorDef: getClosureSafeProperty});
|
||||
export const NG_PIPE_DEF = getClosureSafeProperty({ngPipeDef: getClosureSafeProperty});
|
||||
export const NG_MODULE_DEF = getClosureSafeProperty({ngModuleDef: getClosureSafeProperty});
|
||||
export const NG_BASE_DEF = getClosureSafeProperty({ngBaseDef: getClosureSafeProperty});
|
||||
|
@ -5,9 +5,9 @@
|
||||
* 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 {global} from '../util';
|
||||
import {assertDefined} from '../util/assert';
|
||||
import {global} from '../util/global';
|
||||
|
||||
import {assertDefined} from './assert';
|
||||
import {getComponent, getContext, getDirectives, getHostElement, getInjector, getListeners, getPlayers, getRootComponents, getViewComponent, markDirty} from './global_utils_api';
|
||||
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
import {assertEqual} from './assert';
|
||||
import {assertEqual} from '../util/assert';
|
||||
import {DirectiveDef} from './interfaces/definition';
|
||||
import {TNode} from './interfaces/node';
|
||||
import {FLAGS, HookData, LView, LViewFlags, TView} from './interfaces/view';
|
||||
|
@ -9,7 +9,7 @@
|
||||
import {SRCSET_ATTRS, URI_ATTRS, VALID_ATTRS, VALID_ELEMENTS, getTemplateContent} from '../sanitization/html_sanitizer';
|
||||
import {InertBodyHelper} from '../sanitization/inert_body';
|
||||
import {_sanitizeUrl, sanitizeSrcset} from '../sanitization/url_sanitizer';
|
||||
import {assertDefined, assertEqual, assertGreaterThan} from './assert';
|
||||
import {assertDefined, assertEqual, assertGreaterThan} from '../util/assert';
|
||||
import {attachPatchData} from './context_discovery';
|
||||
import {allocExpando, createNodeAtIndex, elementAttribute, load, textBinding} from './instructions';
|
||||
import {LContainer, NATIVE} from './interfaces/container';
|
||||
|
@ -10,13 +10,14 @@ import {resolveForwardRef} from '../di/forward_ref';
|
||||
import {InjectionToken} from '../di/injection_token';
|
||||
import {Injector} from '../di/injector';
|
||||
import {InjectFlags} from '../di/injector_compatibility';
|
||||
import {Type} from '../interface/type';
|
||||
import {QueryList} from '../linker';
|
||||
import {Sanitizer} from '../sanitization/security';
|
||||
import {StyleSanitizeFn} from '../sanitization/style_sanitizer';
|
||||
import {Type} from '../type';
|
||||
import {assertDataInRange, assertDefined, assertEqual, assertLessThan, assertNotEqual} from '../util/assert';
|
||||
import {normalizeDebugBindingName, normalizeDebugBindingValue} from '../util/ng_reflect';
|
||||
|
||||
import {assertDataInRange, assertDefined, assertEqual, assertHasParent, assertLessThan, assertNotEqual, assertPreviousIsParent} from './assert';
|
||||
import {assertHasParent, assertPreviousIsParent} from './assert';
|
||||
import {bindingUpdated, bindingUpdated2, bindingUpdated3, bindingUpdated4} from './bindings';
|
||||
import {attachPatchData, getComponentViewByInstance} from './context_discovery';
|
||||
import {diPublicInInjector, getNodeInjectable, getOrCreateInjectable, getOrCreateNodeInjectorForNode, injectAttributeImpl} from './di';
|
||||
|
@ -7,7 +7,7 @@
|
||||
*/
|
||||
|
||||
import {ViewEncapsulation} from '../../core';
|
||||
import {Type} from '../../type';
|
||||
import {Type} from '../../interface/type';
|
||||
import {CssSelectorList} from './projection';
|
||||
|
||||
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
import {InjectionToken} from '../../di/injection_token';
|
||||
import {InjectFlags} from '../../di/injector_compatibility';
|
||||
import {Type} from '../../type';
|
||||
import {Type} from '../../interface/type';
|
||||
import {TElementNode} from './node';
|
||||
import {LView, TData} from './view';
|
||||
|
||||
|
@ -6,10 +6,12 @@
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
import {Type} from '../../interface/type';
|
||||
import {QueryList} from '../../linker';
|
||||
import {Type} from '../../type';
|
||||
|
||||
import {TContainerNode, TElementContainerNode, TElementNode, TNode} from './node';
|
||||
|
||||
|
||||
/** Used for tracking queries (e.g. ViewChild, ContentChild). */
|
||||
export interface LQueries {
|
||||
/**
|
||||
|
@ -8,9 +8,10 @@
|
||||
|
||||
import {InjectionToken} from '../../di/injection_token';
|
||||
import {Injector} from '../../di/injector';
|
||||
import {Type} from '../../interface/type';
|
||||
import {QueryList} from '../../linker';
|
||||
import {Sanitizer} from '../../sanitization/security';
|
||||
import {Type} from '../../type';
|
||||
|
||||
import {LContainer} from './container';
|
||||
import {ComponentDef, ComponentQuery, ComponentTemplate, DirectiveDef, DirectiveDefList, HostBindingsFunction, PipeDef, PipeDefList} from './definition';
|
||||
import {I18nUpdateOpCodes, TI18n} from './i18n';
|
||||
@ -21,6 +22,7 @@ import {RElement, Renderer3, RendererFactory3} from './renderer';
|
||||
import {StylingContext} from './styling';
|
||||
|
||||
|
||||
|
||||
// Below are constants for LView indices to help us look up LView members
|
||||
// without having to remember the specific indices.
|
||||
// Uglify will inline these when minifying so there shouldn't be a cost.
|
||||
|
@ -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 {global} from '../../util';
|
||||
import {global} from '../../util/global';
|
||||
import {CompilerFacade, ExportedCompilerFacade} from './compiler_facade_interface';
|
||||
export * from './compiler_facade_interface';
|
||||
|
||||
|
@ -8,11 +8,11 @@
|
||||
|
||||
import {ComponentType} from '..';
|
||||
import {resolveForwardRef} from '../../di/forward_ref';
|
||||
import {Type} from '../../interface/type';
|
||||
import {Query} from '../../metadata/di';
|
||||
import {Component, Directive} from '../../metadata/directives';
|
||||
import {componentNeedsResolution, maybeQueueResolutionOfComponentResources} from '../../metadata/resource_loading';
|
||||
import {ViewEncapsulation} from '../../metadata/view';
|
||||
import {Type} from '../../type';
|
||||
import {EMPTY_ARRAY, EMPTY_OBJ} from '../empty';
|
||||
import {NG_COMPONENT_DEF, NG_DIRECTIVE_DEF} from '../fields';
|
||||
import {stringify} from '../util';
|
||||
|
@ -6,7 +6,7 @@
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
import {defineInjectable, defineInjector,} from '../../di/defs';
|
||||
import {defineInjectable, defineInjector,} from '../../di/interface/defs';
|
||||
import {inject} from '../../di/injector_compatibility';
|
||||
import * as r3 from '../index';
|
||||
import * as sanitization from '../../sanitization/sanitization';
|
||||
|
@ -7,10 +7,10 @@
|
||||
*/
|
||||
|
||||
import {Injectable} from '../../di/injectable';
|
||||
import {ClassSansProvider, ExistingSansProvider, FactorySansProvider, ValueProvider, ValueSansProvider} from '../../di/provider';
|
||||
import {Type} from '../../type';
|
||||
import {NG_INJECTABLE_DEF} from '../../di/interface/defs';
|
||||
import {ClassSansProvider, ExistingSansProvider, FactorySansProvider, ValueProvider, ValueSansProvider} from '../../di/interface/provider';
|
||||
import {Type} from '../../interface/type';
|
||||
import {getClosureSafeProperty} from '../../util/property';
|
||||
import {NG_INJECTABLE_DEF} from '../fields';
|
||||
|
||||
import {R3InjectableMetadataFacade, getCompilerFacade} from './compiler_facade';
|
||||
import {angularCoreEnv} from './environment';
|
||||
|
@ -7,13 +7,14 @@
|
||||
*/
|
||||
|
||||
import {resolveForwardRef} from '../../di/forward_ref';
|
||||
import {NG_INJECTOR_DEF} from '../../di/interface/defs';
|
||||
import {Type} from '../../interface/type';
|
||||
import {registerNgModuleType} from '../../linker/ng_module_factory_loader';
|
||||
import {Component} from '../../metadata';
|
||||
import {ModuleWithProviders, NgModule, NgModuleDef, NgModuleTransitiveScopes} from '../../metadata/ng_module';
|
||||
import {Type} from '../../type';
|
||||
import {assertDefined} from '../assert';
|
||||
import {assertDefined} from '../../util/assert';
|
||||
import {getComponentDef, getDirectiveDef, getNgModuleDef, getPipeDef} from '../definition';
|
||||
import {NG_COMPONENT_DEF, NG_DIRECTIVE_DEF, NG_INJECTOR_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 {NgModuleType} from '../ng_module_ref';
|
||||
import {stringify} from '../util';
|
||||
|
@ -6,8 +6,8 @@
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
import {Type} from '../../interface/type';
|
||||
import {Pipe} from '../../metadata/directives';
|
||||
import {Type} from '../../type';
|
||||
import {NG_PIPE_DEF} from '../fields';
|
||||
import {stringify} from '../util';
|
||||
|
||||
|
@ -7,9 +7,9 @@
|
||||
*/
|
||||
|
||||
import {Host, Inject, Optional, Self, SkipSelf} from '../../di/metadata';
|
||||
import {Type} from '../../interface/type';
|
||||
import {Attribute} from '../../metadata/di';
|
||||
import {ReflectionCapabilities} from '../../reflection/reflection_capabilities';
|
||||
import {Type} from '../../type';
|
||||
|
||||
import {CompilerFacade, R3DependencyMetadataFacade, getCompilerFacade} from './compiler_facade';
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
import {Type} from '../type';
|
||||
import {Type} from '../interface/type';
|
||||
|
||||
interface TypeWithMetadata extends Type<any> {
|
||||
decorators?: any[];
|
||||
|
@ -1,87 +0,0 @@
|
||||
/**
|
||||
* @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
|
||||
*/
|
||||
|
||||
declare global {
|
||||
const ngDevMode: null|NgDevModePerfCounters;
|
||||
interface NgDevModePerfCounters {
|
||||
firstTemplatePass: number;
|
||||
tNode: number;
|
||||
tView: number;
|
||||
rendererCreateTextNode: number;
|
||||
rendererSetText: number;
|
||||
rendererCreateElement: number;
|
||||
rendererAddEventListener: number;
|
||||
rendererSetAttribute: number;
|
||||
rendererRemoveAttribute: number;
|
||||
rendererSetProperty: number;
|
||||
rendererSetClassName: number;
|
||||
rendererAddClass: number;
|
||||
rendererRemoveClass: number;
|
||||
rendererSetStyle: number;
|
||||
rendererRemoveStyle: number;
|
||||
rendererDestroy: number;
|
||||
rendererDestroyNode: number;
|
||||
rendererMoveNode: number;
|
||||
rendererRemoveNode: number;
|
||||
rendererCreateComment: number;
|
||||
}
|
||||
}
|
||||
|
||||
declare let global: any;
|
||||
|
||||
export function ngDevModeResetPerfCounters(): NgDevModePerfCounters {
|
||||
const newCounters: NgDevModePerfCounters = {
|
||||
firstTemplatePass: 0,
|
||||
tNode: 0,
|
||||
tView: 0,
|
||||
rendererCreateTextNode: 0,
|
||||
rendererSetText: 0,
|
||||
rendererCreateElement: 0,
|
||||
rendererAddEventListener: 0,
|
||||
rendererSetAttribute: 0,
|
||||
rendererRemoveAttribute: 0,
|
||||
rendererSetProperty: 0,
|
||||
rendererSetClassName: 0,
|
||||
rendererAddClass: 0,
|
||||
rendererRemoveClass: 0,
|
||||
rendererSetStyle: 0,
|
||||
rendererRemoveStyle: 0,
|
||||
rendererDestroy: 0,
|
||||
rendererDestroyNode: 0,
|
||||
rendererMoveNode: 0,
|
||||
rendererRemoveNode: 0,
|
||||
rendererCreateComment: 0,
|
||||
};
|
||||
// NOTE: Under Ivy we may have both window & global defined in the Node
|
||||
// environment since ensureDocument() in render3.ts sets global.window.
|
||||
if (typeof window != 'undefined') {
|
||||
// Make sure to refer to ngDevMode as ['ngDevMode'] for closure.
|
||||
(window as any)['ngDevMode'] = newCounters;
|
||||
}
|
||||
if (typeof global != 'undefined') {
|
||||
// Make sure to refer to ngDevMode as ['ngDevMode'] for closure.
|
||||
(global as any)['ngDevMode'] = newCounters;
|
||||
}
|
||||
if (typeof self != 'undefined') {
|
||||
// Make sure to refer to ngDevMode as ['ngDevMode'] for closure.
|
||||
(self as any)['ngDevMode'] = newCounters;
|
||||
}
|
||||
return newCounters;
|
||||
}
|
||||
|
||||
/**
|
||||
* This checks to see if the `ngDevMode` has been set. If yes,
|
||||
* than we honor it, otherwise we default to dev mode with additional checks.
|
||||
*
|
||||
* The idea is that unless we are doing production build where we explicitly
|
||||
* set `ngDevMode == false` we should be helping the developer by providing
|
||||
* as much early warning and errors as possible.
|
||||
*/
|
||||
if (typeof ngDevMode === 'undefined' || ngDevMode) {
|
||||
ngDevModeResetPerfCounters();
|
||||
}
|
@ -8,15 +8,15 @@
|
||||
|
||||
import {INJECTOR, Injector} from '../di/injector';
|
||||
import {InjectFlags} from '../di/injector_compatibility';
|
||||
import {StaticProvider} from '../di/provider';
|
||||
import {StaticProvider} from '../di/interface/provider';
|
||||
import {createInjector} from '../di/r3_injector';
|
||||
import {Type} from '../interface/type';
|
||||
import {ComponentFactoryResolver as viewEngine_ComponentFactoryResolver} from '../linker/component_factory_resolver';
|
||||
import {InternalNgModuleRef, NgModuleFactory as viewEngine_NgModuleFactory, NgModuleRef as viewEngine_NgModuleRef} from '../linker/ng_module_factory';
|
||||
import {NgModuleDef} from '../metadata/ng_module';
|
||||
import {Type} from '../type';
|
||||
import {stringify} from '../util';
|
||||
import {assertDefined} from '../util/assert';
|
||||
import {stringify} from '../util/stringify';
|
||||
|
||||
import {assertDefined} from './assert';
|
||||
import {ComponentFactoryResolver} from './component_ref';
|
||||
import {getNgModuleDef} from './definition';
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
import {assertDefined, assertEqual} from './assert';
|
||||
import {assertDefined, assertEqual} from '../util/assert';
|
||||
import {TNode, TNodeType} from './interfaces/node';
|
||||
|
||||
export function assertNodeType(tNode: TNode, type: TNodeType) {
|
||||
|
@ -6,9 +6,9 @@
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
import './ng_dev_mode';
|
||||
import '../util/ng_dev_mode';
|
||||
|
||||
import {assertDefined, assertNotEqual} from './assert';
|
||||
import {assertDefined, assertNotEqual} from '../util/assert';
|
||||
import {AttributeMarker, TAttributes, TNode, TNodeType, unusedValueExportToPlacateAjd as unused1} from './interfaces/node';
|
||||
import {CssSelector, CssSelectorList, NG_PROJECT_AS_ATTR_NAME, SelectorFlags, unusedValueExportToPlacateAjd as unused2} from './interfaces/projection';
|
||||
|
||||
|
@ -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 './ng_dev_mode';
|
||||
import '../util/ng_dev_mode';
|
||||
|
||||
import {getLContext} from './context_discovery';
|
||||
import {getRootContext} from './discovery_utils';
|
||||
|
@ -8,16 +8,14 @@
|
||||
|
||||
// We are temporarily importing the existing viewEngine_from core so we can be sure we are
|
||||
// correctly implementing its interfaces for backwards compatibility.
|
||||
import {Observable} from 'rxjs';
|
||||
|
||||
import {EventEmitter} from '../event_emitter';
|
||||
import {Type} from '../interface/type';
|
||||
import {ElementRef as ViewEngine_ElementRef} from '../linker/element_ref';
|
||||
import {QueryList} from '../linker/query_list';
|
||||
import {TemplateRef as ViewEngine_TemplateRef} from '../linker/template_ref';
|
||||
import {Type} from '../type';
|
||||
import {getSymbolIterator} from '../util';
|
||||
import {assertDefined, assertEqual} from '../util/assert';
|
||||
|
||||
import {assertDefined, assertEqual, assertPreviousIsParent} from './assert';
|
||||
import {assertPreviousIsParent} from './assert';
|
||||
import {getNodeInjectable, locateDirectiveOrProvider} from './di';
|
||||
import {NG_ELEMENT_ID} from './fields';
|
||||
import {store, storeCleanupWithContext} from './instructions';
|
||||
|
@ -6,7 +6,7 @@
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
import {assertDefined} from './assert';
|
||||
import {assertDefined} from '../util/assert';
|
||||
import {executeHooks} from './hooks';
|
||||
import {ComponentDef, DirectiveDef} from './interfaces/definition';
|
||||
import {TElementNode, TNode, TNodeFlags, TViewNode} from './interfaces/node';
|
||||
|
@ -6,7 +6,7 @@
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
import {StyleSanitizeFn} from '../../sanitization/style_sanitizer';
|
||||
import {assertNotEqual} from '../assert';
|
||||
import {assertNotEqual} from '../../util/assert';
|
||||
import {EMPTY_ARRAY, EMPTY_OBJ} from '../empty';
|
||||
import {AttributeMarker, TAttributes} from '../interfaces/node';
|
||||
import {BindingStore, BindingType, Player, PlayerBuilder, PlayerFactory, PlayerIndex} from '../interfaces/player';
|
||||
@ -20,6 +20,7 @@ import {BoundPlayerFactory} from './player_factory';
|
||||
import {addPlayerInternal, allocPlayerContext, createEmptyStylingContext, getPlayerContext} from './util';
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* This file includes the code to power all styling-binding operations in Angular.
|
||||
*
|
||||
|
@ -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 '../ng_dev_mode';
|
||||
import '../../util/ng_dev_mode';
|
||||
|
||||
import {StyleSanitizeFn} from '../../sanitization/style_sanitizer';
|
||||
import {getLContext} from '../context_discovery';
|
||||
|
@ -6,9 +6,9 @@
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
import {global} from '../util';
|
||||
import {assertDataInRange, assertDefined, assertGreaterThan, assertLessThan} from '../util/assert';
|
||||
import {global} from '../util/global';
|
||||
|
||||
import {assertDataInRange, assertDefined, assertGreaterThan, assertLessThan} from './assert';
|
||||
import {ACTIVE_INDEX, LCONTAINER_LENGTH, LContainer} from './interfaces/container';
|
||||
import {LContext, MONKEY_PATCH_KEY_NAME} from './interfaces/context';
|
||||
import {ComponentDef, DirectiveDef} from './interfaces/definition';
|
||||
@ -18,6 +18,7 @@ import {GlobalTargetName, GlobalTargetResolver, RComment, RElement, RText} from
|
||||
import {StylingContext} from './interfaces/styling';
|
||||
import {CONTEXT, DECLARATION_VIEW, FLAGS, HEADER_OFFSET, HOST, HOST_NODE, LView, LViewFlags, PARENT, RootContext, TData, TVIEW, TView} from './interfaces/view';
|
||||
|
||||
|
||||
/**
|
||||
* Returns whether the values are different from a change detection stand point.
|
||||
*
|
||||
|
@ -15,7 +15,7 @@ import {TemplateRef as ViewEngine_TemplateRef} from '../linker/template_ref';
|
||||
import {ViewContainerRef as ViewEngine_ViewContainerRef} from '../linker/view_container_ref';
|
||||
import {EmbeddedViewRef as viewEngine_EmbeddedViewRef, ViewRef as viewEngine_ViewRef} from '../linker/view_ref';
|
||||
import {Renderer2} from '../render/api';
|
||||
import {assertDefined, assertGreaterThan, assertLessThan} from './assert';
|
||||
import {assertDefined, assertGreaterThan, assertLessThan} from '../util/assert';
|
||||
import {NodeInjector, getParentInjectorLocation} from './di';
|
||||
import {addToViewTree, createEmbeddedViewAndNode, createLContainer, renderEmbeddedTemplate} from './instructions';
|
||||
import {ACTIVE_INDEX, LContainer, NATIVE, VIEWS} from './interfaces/container';
|
||||
|
Reference in New Issue
Block a user