build(ivy): run latest build-optimizer on ngtsc compiled code (#24677)

Previously the repo was depending on an old version of build optimizer.
This change updates to the latest (an RC release in the CLI package).

Additionally, this changes the behavior of ng_rollup_bundle to apply
the optimizer to ngtsc compiled code, and configures it to treat the
@angular/compiler package as side-effect-free.

This results in a substantial size reduction of ngtsc compiled code.

PR Close #24677
This commit is contained in:
Alex Rickabaugh 2018-06-20 15:58:33 -07:00 committed by Miško Hevery
parent fc4dc35426
commit 2ecaa40e64
3 changed files with 19 additions and 247 deletions

View File

@ -59,9 +59,9 @@ http_archive(
# ts_library rules in the devkit repository.
http_archive(
name = "angular_devkit",
url = "https://github.com/angular/devkit/archive/v0.3.1.zip",
strip_prefix = "devkit-0.3.1",
sha256 = "31d4b597fe9336650acf13df053c1c84dcbe9c29c6a833bcac3819cd3fd8cad3",
url = "https://github.com/angular/angular-cli/archive/v6.1.0-rc.0.zip",
strip_prefix = "angular-cli-6.1.0-rc.0",
sha256 = "8cf320ea58c321e103f39087376feea502f20eaf79c61a4fdb05c7286c8684fd",
)
http_archive(

View File

@ -21,7 +21,7 @@ load("@build_bazel_rules_nodejs//internal/rollup:rollup_bundle.bzl",
load("@build_bazel_rules_nodejs//internal:collect_es6_sources.bzl", collect_es2015_sources = "collect_es6_sources")
load(":esm5.bzl", "esm5_outputs_aspect", "flatten_esm5", "esm5_root_dir")
PACKAGES=["packages/core/src", "packages/common/src", "external/rxjs"]
PACKAGES=["packages/core/src", "packages/common/src", "packages/compiler/src", "external/rxjs"]
PLUGIN_CONFIG="{sideEffectFreeModules: [\n%s]}" % ",\n".join(
[" '.esm5/{0}'".format(p) for p in PACKAGES])
BO_ROLLUP="angular_devkit/packages/angular_devkit/build_optimizer/src/build-optimizer/rollup-plugin.js"
@ -30,10 +30,10 @@ BO_PLUGIN="require('%s').default(%s)" % (BO_ROLLUP, PLUGIN_CONFIG)
def _use_plain_rollup(ctx):
"""Determine whether to use the Angular or upstream versions of the rollup_bundle rule.
In legacy mode, the Angular version of rollup is used. This runs build optimizer as part of its
In most modes, the Angular version of rollup is used. This runs build optimizer as part of its
processing, which affects decorators and annotations.
In other modes, an emulation of the upstream rollup_bundle rule is used. This avoids running
In JIT modes, an emulation of the upstream rollup_bundle rule is used. This avoids running
build optimizer on code which isn't designed to be optimized by it.
Args:
@ -47,7 +47,7 @@ def _use_plain_rollup(ctx):
return False
strategy = ctx.var['compile']
return strategy != 'legacy'
return strategy == 'jit'
def run_brotli(ctx, input, output):

View File

@ -164,9 +164,6 @@
{
"name": "$z"
},
{
"name": "ADD_EVENT_LISTENER"
},
{
"name": "ALLOW_DEFAULT_VAR"
},
@ -176,9 +173,6 @@
{
"name": "ANALYZE_FOR_ENTRY_COMPONENTS"
},
{
"name": "ANGULAR"
},
{
"name": "ANIMATE_PROP_PREFIX"
},
@ -200,9 +194,6 @@
{
"name": "ATTRIBUTE_PREFIX"
},
{
"name": "AT_CHARCODE"
},
{
"name": "AbstractClassPart"
},
@ -224,9 +215,6 @@
{
"name": "AssertNotNull"
},
{
"name": "AstMemoryEfficientTransformer"
},
{
"name": "AstTransformer"
},
@ -272,9 +260,6 @@
{
"name": "BindingPipe"
},
{
"name": "BindingScope$1"
},
{
"name": "BoundDirectivePropertyAst"
},
@ -356,15 +341,9 @@
{
"name": "COMPILER_PROVIDERS"
},
{
"name": "COMPONENT_REGEX"
},
{
"name": "COMPONENT_VARIABLE"
},
{
"name": "COMPONENT_VARIABLE$1"
},
{
"name": "COMP_VAR"
},
@ -374,9 +353,6 @@
{
"name": "CONTENT_ATTR"
},
{
"name": "CONTENT_ATTR$1"
},
{
"name": "CORE"
},
@ -401,6 +377,9 @@
{
"name": "Chain"
},
{
"name": "ChangeDetectionStrategy"
},
{
"name": "ChangeDetectionStrategy$1"
},
@ -419,9 +398,6 @@
{
"name": "ClassStmt"
},
{
"name": "CloneVisitor"
},
{
"name": "CodegenComponentFactoryResolver"
},
@ -524,9 +500,6 @@
{
"name": "DASH_CASE_REGEXP"
},
{
"name": "DATA_URL_PATTERN"
},
{
"name": "DEFAULT_INTERPOLATION_CONFIG"
},
@ -578,9 +551,6 @@
{
"name": "DeclareVarStmt"
},
{
"name": "DefaultDomRenderer2"
},
{
"name": "DefaultLocalResolver"
},
@ -650,9 +620,6 @@
{
"name": "ERROR_SYNTAX_ERROR"
},
{
"name": "EVENT_NAMES"
},
{
"name": "EVENT_NAME_VAR"
},
@ -701,9 +668,6 @@
{
"name": "EventListener"
},
{
"name": "EventManagerPlugin"
},
{
"name": "ExampleVisitor"
},
@ -734,9 +698,6 @@
{
"name": "ExtractionResult"
},
{
"name": "FALSE"
},
{
"name": "FixupExpression"
},
@ -758,15 +719,9 @@
{
"name": "GOOG_GET_MSG"
},
{
"name": "GenericBrowserDomAdapter"
},
{
"name": "HOST_ATTR"
},
{
"name": "HOST_ATTR$1"
},
{
"name": "HOST_REG_EXP"
},
@ -857,9 +812,6 @@
{
"name": "ImplicitReceiver"
},
{
"name": "InertBodyHelper"
},
{
"name": "Inject"
},
@ -974,9 +926,6 @@
{
"name": "LOG_VAR$1"
},
{
"name": "LOWERED_SYMBOL"
},
{
"name": "Lexer"
},
@ -1007,12 +956,6 @@
{
"name": "MEANING_SEPARATOR"
},
{
"name": "MODIFIER_KEYS"
},
{
"name": "MODIFIER_KEY_GETTERS"
},
{
"name": "MODULE_SUFFIX"
},
@ -1052,15 +995,6 @@
{
"name": "NAMED_ENTITIES"
},
{
"name": "NAMESPACE_URIS"
},
{
"name": "NATIVE_ADD_LISTENER"
},
{
"name": "NATIVE_REMOVE_LISTENER"
},
{
"name": "NEW_LINE"
},
@ -1082,9 +1016,6 @@
{
"name": "NG_TOKEN_PATH"
},
{
"name": "NON_ALPHANUMERIC_REGEXP"
},
{
"name": "NON_BINDABLE_VISITOR"
},
@ -1169,15 +1100,6 @@
{
"name": "OPEN_CURLY"
},
{
"name": "OPTIONAL_END_TAG_BLOCK_ELEMENTS"
},
{
"name": "OPTIONAL_END_TAG_ELEMENTS"
},
{
"name": "OPTIONAL_END_TAG_INLINE_ELEMENTS"
},
{
"name": "ObjectUnsubscribedError"
},
@ -1205,9 +1127,6 @@
{
"name": "PLATFORM_INITIALIZER"
},
{
"name": "PLATFORM_SERVER_ID"
},
{
"name": "PLURAL_CASES"
},
@ -1280,9 +1199,6 @@
{
"name": "PlatformRef"
},
{
"name": "PopulatedScope"
},
{
"name": "PrefixNot"
},
@ -1334,9 +1250,6 @@
{
"name": "R3_COMPILE_INJECTABLE"
},
{
"name": "REMOVE_EVENT_LISTENER"
},
{
"name": "ReadKeyExpr"
},
@ -1352,9 +1265,6 @@
{
"name": "RecursiveAstVisitor"
},
{
"name": "RecursiveAstVisitor$1"
},
{
"name": "RefCountOperator$1"
},
@ -1394,12 +1304,6 @@
{
"name": "ReturnValue"
},
{
"name": "SAFE_STYLE_VALUE"
},
{
"name": "SAFE_URL_PATTERN"
},
{
"name": "SCHEMA"
},
@ -1415,9 +1319,6 @@
{
"name": "SOURCE"
},
{
"name": "SRCSET_ATTRS"
},
{
"name": "STRING"
},
@ -1433,45 +1334,21 @@
{
"name": "STYLE_PREFIX"
},
{
"name": "SURROGATE_PAIR_REGEXP"
},
{
"name": "SafeHtmlImpl"
},
{
"name": "SafeMethodCall"
},
{
"name": "SafePropertyRead"
},
{
"name": "SafeResourceUrlImpl"
},
{
"name": "SafeScriptImpl"
},
{
"name": "SafeSelector"
},
{
"name": "SafeStyleImpl"
},
{
"name": "SafeSubscriber"
},
{
"name": "SafeUrlImpl"
},
{
"name": "SafeValueImpl"
},
{
"name": "Sanitizer"
},
{
"name": "SanitizingHtmlSerializer"
},
{
"name": "SecurityContext"
},
@ -1664,6 +1541,9 @@
{
"name": "TokenType"
},
{
"name": "TokenType$1"
},
{
"name": "TokenizeResult"
},
@ -1697,12 +1577,6 @@
{
"name": "UNDEFINED_VALUE"
},
{
"name": "URI_ATTRS"
},
{
"name": "URL_RE"
},
{
"name": "URL_WITH_SCHEMA_REGEXP"
},
@ -1718,12 +1592,6 @@
{
"name": "UrlResolver"
},
{
"name": "VALID_ATTRS"
},
{
"name": "VALID_ELEMENTS"
},
{
"name": "VERSION"
},
@ -1733,9 +1601,6 @@
{
"name": "VIEW_VAR"
},
{
"name": "VOID_ELEMENTS"
},
{
"name": "ValueTransformer"
},
@ -1766,6 +1631,9 @@
{
"name": "ViewContainerRef_"
},
{
"name": "ViewEncapsulation"
},
{
"name": "ViewEncapsulation$1"
},
@ -1853,6 +1721,9 @@
{
"name": "_CompileValueConverter"
},
{
"name": "_ComponentIndex"
},
{
"name": "_ControlFlowError"
},
@ -2297,15 +2168,6 @@
{
"name": "_ruleRe"
},
{
"name": "_sanitizeHtml"
},
{
"name": "_sanitizeStyle"
},
{
"name": "_sanitizeUrl"
},
{
"name": "_selectorReSuffix"
},
@ -2558,9 +2420,6 @@
{
"name": "checkNoChangesView"
},
{
"name": "checkNoSyntheticProp"
},
{
"name": "checkStable"
},
@ -2861,9 +2720,6 @@
{
"name": "declaredViewContainer"
},
{
"name": "decoratePreventDefault"
},
{
"name": "dedupeArray"
},
@ -2927,9 +2783,6 @@
{
"name": "empty"
},
{
"name": "encodeEntities"
},
{
"name": "ensureExpressionMode"
},
@ -3038,9 +2891,6 @@
{
"name": "flattenStatements"
},
{
"name": "flattenStyles"
},
{
"name": "flattenUnsubscriptionErrors"
},
@ -3110,9 +2960,6 @@
{
"name": "getHtmlTagDefinition"
},
{
"name": "getLiteralFactory"
},
{
"name": "getNgZone"
},
@ -3149,9 +2996,6 @@
{
"name": "getSymbolIterator$1"
},
{
"name": "getTemplateContent"
},
{
"name": "getTypeForTag"
},
@ -3161,12 +3005,6 @@
{
"name": "getXmlTagDefinition"
},
{
"name": "globalListener"
},
{
"name": "hasBalancedQuotes"
},
{
"name": "hasLifecycleHook"
},
@ -3254,18 +3092,9 @@
{
"name": "isAsciiLetter"
},
{
"name": "isBlackListedEvent"
},
{
"name": "isCall"
},
{
"name": "isComponentView"
},
{
"name": "isDOMParserAvailable"
},
{
"name": "isDefined"
},
@ -3302,9 +3131,6 @@
{
"name": "isFunction"
},
{
"name": "isFunctionCall"
},
{
"name": "isIdentifier"
},
@ -3323,12 +3149,6 @@
{
"name": "isListLikeIterable"
},
{
"name": "isLoweredSymbol"
},
{
"name": "isMethodCallOnVariable"
},
{
"name": "isNameEnd"
},
@ -3356,9 +3176,6 @@
{
"name": "isObservable"
},
{
"name": "isPlatformServer"
},
{
"name": "isPrefixEnd"
},
@ -3383,9 +3200,6 @@
{
"name": "isStyleUrlResolvable"
},
{
"name": "isTemplateElement"
},
{
"name": "isTrustedSubscriber"
},
@ -3467,9 +3281,6 @@
{
"name": "merge"
},
{
"name": "merge$2"
},
{
"name": "mergeAll"
},
@ -3611,12 +3422,6 @@
{
"name": "parseIntAutoRadix"
},
{
"name": "pipeBindingCallInfo"
},
{
"name": "pipeBindingIdentifiers"
},
{
"name": "pipeDef"
},
@ -3671,12 +3476,6 @@
{
"name": "pureArrayDef"
},
{
"name": "pureFunctionCallInfo"
},
{
"name": "pureFunctionIdentifiers"
},
{
"name": "pureObjectDef"
},
@ -3692,9 +3491,6 @@
{
"name": "refCount"
},
{
"name": "registerContext"
},
{
"name": "registerModuleFactory"
},
@ -3773,9 +3569,6 @@
{
"name": "sanitizeIdentifier"
},
{
"name": "sanitizeSrcset"
},
{
"name": "scheduleMicroTask"
},
@ -3827,12 +3620,6 @@
{
"name": "shiftInitState"
},
{
"name": "shimContentAttribute"
},
{
"name": "shimHostAttribute"
},
{
"name": "shouldCallLifecycleInitHook"
},
@ -3872,12 +3659,6 @@
{
"name": "staticViewQueryIds"
},
{
"name": "stopMethodSymbol"
},
{
"name": "stopSymbol"
},
{
"name": "stringToWords32"
},
@ -3917,15 +3698,9 @@
{
"name": "supportsState"
},
{
"name": "symbolNames"
},
{
"name": "syntaxError"
},
{
"name": "tagSet"
},
{
"name": "tagToString"
},
@ -3998,9 +3773,6 @@
{
"name": "unescape"
},
{
"name": "unwrapResolvedMetadata"
},
{
"name": "unwrapValue"
},