@angular/compiler 14.0.0-next.12 → 14.0.0-next.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (135) hide show
  1. package/esm2020/src/compiler.mjs +3 -2
  2. package/esm2020/src/compiler_facade_interface.mjs +7 -1
  3. package/esm2020/src/jit_compiler_facade.mjs +69 -37
  4. package/esm2020/src/render3/partial/api.mjs +1 -1
  5. package/esm2020/src/render3/partial/class_metadata.mjs +1 -1
  6. package/esm2020/src/render3/partial/component.mjs +27 -36
  7. package/esm2020/src/render3/partial/directive.mjs +5 -2
  8. package/esm2020/src/render3/partial/factory.mjs +1 -1
  9. package/esm2020/src/render3/partial/injectable.mjs +1 -1
  10. package/esm2020/src/render3/partial/injector.mjs +1 -1
  11. package/esm2020/src/render3/partial/ng_module.mjs +1 -1
  12. package/esm2020/src/render3/partial/pipe.mjs +5 -2
  13. package/esm2020/src/render3/r3_identifiers.mjs +2 -1
  14. package/esm2020/src/render3/r3_pipe_compiler.mjs +2 -1
  15. package/esm2020/src/render3/view/api.mjs +7 -2
  16. package/esm2020/src/render3/view/compiler.mjs +15 -15
  17. package/esm2020/src/render3/view/i18n/get_msg_utils.mjs +58 -5
  18. package/esm2020/src/render3/view/i18n/util.mjs +2 -2
  19. package/esm2020/src/render3/view/template.mjs +4 -4
  20. package/esm2020/src/render3/view/util.mjs +11 -2
  21. package/esm2020/src/shadow_css.mjs +291 -12
  22. package/esm2020/src/util.mjs +8 -8
  23. package/esm2020/src/version.mjs +1 -1
  24. package/fesm2015/compiler.mjs +495 -117
  25. package/fesm2015/compiler.mjs.map +1 -1
  26. package/fesm2015/testing.mjs +1 -1
  27. package/fesm2020/compiler.mjs +504 -128
  28. package/fesm2020/compiler.mjs.map +1 -1
  29. package/fesm2020/testing.mjs +1 -1
  30. package/index.d.ts +4964 -5
  31. package/package.json +3 -3
  32. package/testing/index.d.ts +22 -5
  33. package/compiler.d.ts +0 -8
  34. package/public_api.d.ts +0 -13
  35. package/src/assertions.d.ts +0 -8
  36. package/src/chars.d.ts +0 -75
  37. package/src/compiler.d.ts +0 -77
  38. package/src/compiler_facade_interface.d.ts +0 -284
  39. package/src/compiler_util/expression_converter.d.ts +0 -71
  40. package/src/config.d.ts +0 -25
  41. package/src/constant_pool.d.ts +0 -37
  42. package/src/core.d.ts +0 -216
  43. package/src/expression_parser/ast.d.ts +0 -440
  44. package/src/expression_parser/lexer.d.ts +0 -47
  45. package/src/expression_parser/parser.d.ts +0 -315
  46. package/src/i18n/big_integer.d.ts +0 -108
  47. package/src/i18n/digest.d.ts +0 -44
  48. package/src/i18n/extractor_merger.d.ts +0 -27
  49. package/src/i18n/i18n_ast.d.ts +0 -148
  50. package/src/i18n/i18n_html_parser.d.ts +0 -19
  51. package/src/i18n/i18n_parser.d.ts +0 -18
  52. package/src/i18n/index.d.ts +0 -15
  53. package/src/i18n/message_bundle.d.ts +0 -28
  54. package/src/i18n/parse_util.d.ts +0 -14
  55. package/src/i18n/serializers/placeholder.d.ts +0 -25
  56. package/src/i18n/serializers/serializer.d.ts +0 -46
  57. package/src/i18n/serializers/xliff.d.ts +0 -19
  58. package/src/i18n/serializers/xliff2.d.ts +0 -19
  59. package/src/i18n/serializers/xmb.d.ts +0 -22
  60. package/src/i18n/serializers/xml_helper.d.ts +0 -52
  61. package/src/i18n/serializers/xtb.d.ts +0 -20
  62. package/src/i18n/translation_bundle.d.ts +0 -27
  63. package/src/injectable_compiler_2.d.ts +0 -24
  64. package/src/jit_compiler_facade.d.ts +0 -46
  65. package/src/ml_parser/ast.d.ts +0 -89
  66. package/src/ml_parser/entities.d.ts +0 -9
  67. package/src/ml_parser/html_parser.d.ts +0 -13
  68. package/src/ml_parser/html_tags.d.ts +0 -33
  69. package/src/ml_parser/html_whitespaces.d.ts +0 -45
  70. package/src/ml_parser/icu_ast_expander.d.ts +0 -42
  71. package/src/ml_parser/interpolation_config.d.ts +0 -14
  72. package/src/ml_parser/lexer.d.ts +0 -114
  73. package/src/ml_parser/parser.d.ts +0 -26
  74. package/src/ml_parser/tags.d.ts +0 -29
  75. package/src/ml_parser/tokens.d.ts +0 -141
  76. package/src/ml_parser/xml_parser.d.ts +0 -13
  77. package/src/ml_parser/xml_tags.d.ts +0 -24
  78. package/src/output/abstract_emitter.d.ts +0 -66
  79. package/src/output/abstract_js_emitter.d.ts +0 -19
  80. package/src/output/map_util.d.ts +0 -18
  81. package/src/output/output_ast.d.ts +0 -575
  82. package/src/output/output_jit.d.ts +0 -73
  83. package/src/output/output_jit_trusted_types.d.ts +0 -43
  84. package/src/output/source_map.d.ts +0 -29
  85. package/src/parse_util.d.ts +0 -75
  86. package/src/render3/partial/api.d.ts +0 -441
  87. package/src/render3/partial/class_metadata.d.ts +0 -10
  88. package/src/render3/partial/component.d.ts +0 -39
  89. package/src/render3/partial/directive.d.ts +0 -13
  90. package/src/render3/partial/factory.d.ts +0 -3
  91. package/src/render3/partial/injectable.d.ts +0 -19
  92. package/src/render3/partial/injector.d.ts +0 -3
  93. package/src/render3/partial/ng_module.d.ts +0 -3
  94. package/src/render3/partial/pipe.d.ts +0 -12
  95. package/src/render3/partial/util.d.ts +0 -33
  96. package/src/render3/r3_ast.d.ts +0 -211
  97. package/src/render3/r3_class_metadata_compiler.d.ts +0 -35
  98. package/src/render3/r3_factory.d.ts +0 -94
  99. package/src/render3/r3_identifiers.d.ts +0 -182
  100. package/src/render3/r3_injector_compiler.d.ts +0 -18
  101. package/src/render3/r3_jit.d.ts +0 -22
  102. package/src/render3/r3_module_compiler.d.ts +0 -103
  103. package/src/render3/r3_pipe_compiler.d.ts +0 -50
  104. package/src/render3/r3_template_transform.d.ts +0 -24
  105. package/src/render3/util.d.ts +0 -94
  106. package/src/render3/view/api.d.ts +0 -328
  107. package/src/render3/view/compiler.d.ts +0 -86
  108. package/src/render3/view/i18n/context.d.ts +0 -68
  109. package/src/render3/view/i18n/get_msg_utils.d.ts +0 -13
  110. package/src/render3/view/i18n/icu_serializer.d.ts +0 -9
  111. package/src/render3/view/i18n/localize_utils.d.ts +0 -24
  112. package/src/render3/view/i18n/meta.d.ts +0 -78
  113. package/src/render3/view/i18n/util.d.ts +0 -78
  114. package/src/render3/view/style_parser.d.ts +0 -18
  115. package/src/render3/view/styling_builder.d.ts +0 -211
  116. package/src/render3/view/t2_api.d.ts +0 -152
  117. package/src/render3/view/t2_binder.d.ts +0 -57
  118. package/src/render3/view/template.d.ts +0 -450
  119. package/src/render3/view/util.d.ts +0 -94
  120. package/src/resource_loader.d.ts +0 -17
  121. package/src/schema/dom_element_schema_registry.d.ts +0 -45
  122. package/src/schema/dom_security_schema.d.ts +0 -11
  123. package/src/schema/element_schema_registry.d.ts +0 -29
  124. package/src/schema/trusted_types_sinks.d.ts +0 -15
  125. package/src/selector.d.ts +0 -105
  126. package/src/shadow_css.d.ts +0 -76
  127. package/src/style_url_resolver.d.ts +0 -8
  128. package/src/template_parser/binding_parser.d.ts +0 -91
  129. package/src/template_parser/template_preparser.d.ts +0 -24
  130. package/src/util.d.ts +0 -42
  131. package/src/version.d.ts +0 -14
  132. package/testing/package.json +0 -9
  133. package/testing/public_api.d.ts +0 -13
  134. package/testing/src/testing.d.ts +0 -23
  135. package/testing/testing.d.ts +0 -4
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v14.0.0-next.12
2
+ * @license Angular v14.0.0-next.15
3
3
  * (c) 2010-2022 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -756,13 +756,13 @@ class Version {
756
756
  this.patch = splits.slice(2).join('.');
757
757
  }
758
758
  }
759
- const __window = typeof window !== 'undefined' && window;
760
- const __self = typeof self !== 'undefined' && typeof WorkerGlobalScope !== 'undefined' &&
761
- self instanceof WorkerGlobalScope && self;
762
- const __global = typeof global !== 'undefined' && global;
763
- // Check __global first, because in Node tests both __global and __window may be defined and _global
764
- // should be __global in that case.
765
- const _global = __global || __window || __self;
759
+ // Check `global` first, because in Node tests both `global` and `window` may be defined and our
760
+ // `_global` variable should point to the NodeJS `global` in that case. Note: Typeof/Instanceof
761
+ // checks are considered side-effects in Terser. We explicitly mark this as side-effect free:
762
+ // https://github.com/terser/terser/issues/250.
763
+ const _global = ( /* @__PURE__ */(() => (typeof global !== 'undefined' && global) || (typeof window !== 'undefined' && window) ||
764
+ (typeof self !== 'undefined' && typeof WorkerGlobalScope !== 'undefined' &&
765
+ self instanceof WorkerGlobalScope && self))());
766
766
  function newArray(size, value) {
767
767
  const list = [];
768
768
  for (let i = 0; i < size; i++) {
@@ -2920,6 +2920,7 @@ Identifiers.contentQuery = { name: 'ɵɵcontentQuery', moduleName: CORE };
2920
2920
  Identifiers.NgOnChangesFeature = { name: 'ɵɵNgOnChangesFeature', moduleName: CORE };
2921
2921
  Identifiers.InheritDefinitionFeature = { name: 'ɵɵInheritDefinitionFeature', moduleName: CORE };
2922
2922
  Identifiers.CopyDefinitionFeature = { name: 'ɵɵCopyDefinitionFeature', moduleName: CORE };
2923
+ Identifiers.StandaloneFeature = { name: 'ɵɵStandaloneFeature', moduleName: CORE };
2923
2924
  Identifiers.ProvidersFeature = { name: 'ɵɵProvidersFeature', moduleName: CORE };
2924
2925
  Identifiers.listener = { name: 'ɵɵlistener', moduleName: CORE };
2925
2926
  Identifiers.getInheritedFactory = {
@@ -4791,7 +4792,7 @@ function assembleBoundTextPlaceholders(meta, bindingStartIndex = 0, contextId =
4791
4792
  * @param useCamelCase whether to camelCase the placeholder name when formatting.
4792
4793
  * @returns A new map of formatted placeholder names to expressions.
4793
4794
  */
4794
- function i18nFormatPlaceholderNames(params = {}, useCamelCase) {
4795
+ function formatI18nPlaceholderNamesInMap(params = {}, useCamelCase) {
4795
4796
  const _params = {};
4796
4797
  if (params && Object.keys(params).length) {
4797
4798
  Object.keys(params).forEach(key => _params[formatI18nPlaceholderName(key, useCamelCase)] = params[key]);
@@ -4874,6 +4875,12 @@ const IMPLICIT_REFERENCE = '$implicit';
4874
4875
  const NON_BINDABLE_ATTR = 'ngNonBindable';
4875
4876
  /** Name for the variable keeping track of the context returned by `ɵɵrestoreView`. */
4876
4877
  const RESTORED_VIEW_CONTEXT_NAME = 'restoredCtx';
4878
+ /**
4879
+ * Maximum length of a single instruction chain. Because our output AST uses recursion, we're
4880
+ * limited in how many expressions we can nest before we reach the call stack limit. This
4881
+ * length is set very conservatively in order to reduce the chance of problems.
4882
+ */
4883
+ const MAX_CHAIN_LENGTH = 500;
4877
4884
  /** Instructions that support chaining. */
4878
4885
  const CHAINABLE_INSTRUCTIONS = new Set([
4879
4886
  Identifiers.element,
@@ -5099,16 +5106,18 @@ function getInstructionStatements(instructions) {
5099
5106
  const statements = [];
5100
5107
  let pendingExpression = null;
5101
5108
  let pendingExpressionType = null;
5109
+ let chainLength = 0;
5102
5110
  for (const current of instructions) {
5103
5111
  const resolvedParams = (typeof current.paramsOrFn === 'function' ? current.paramsOrFn() : current.paramsOrFn) ??
5104
5112
  [];
5105
5113
  const params = Array.isArray(resolvedParams) ? resolvedParams : [resolvedParams];
5106
5114
  // If the current instruction is the same as the previous one
5107
5115
  // and it can be chained, add another call to the chain.
5108
- if (pendingExpressionType === current.reference &&
5116
+ if (chainLength < MAX_CHAIN_LENGTH && pendingExpressionType === current.reference &&
5109
5117
  CHAINABLE_INSTRUCTIONS.has(pendingExpressionType)) {
5110
5118
  // We'll always have a pending expression when there's a pending expression type.
5111
5119
  pendingExpression = pendingExpression.callFn(params, pendingExpression.sourceSpan);
5120
+ chainLength++;
5112
5121
  }
5113
5122
  else {
5114
5123
  if (pendingExpression !== null) {
@@ -5116,6 +5125,7 @@ function getInstructionStatements(instructions) {
5116
5125
  }
5117
5126
  pendingExpression = invokeInstruction(current.span, current.reference, params);
5118
5127
  pendingExpressionType = current.reference;
5128
+ chainLength = 0;
5119
5129
  }
5120
5130
  }
5121
5131
  // Since the current instruction adds the previous one to the statements,
@@ -6164,9 +6174,24 @@ function createPipeType(metadata) {
6164
6174
  return new ExpressionType(importExpr(Identifiers.PipeDeclaration, [
6165
6175
  typeWithParameters(metadata.type.type, metadata.typeArgumentCount),
6166
6176
  new ExpressionType(new LiteralExpr(metadata.pipeName)),
6177
+ new ExpressionType(new LiteralExpr(metadata.isStandalone)),
6167
6178
  ]));
6168
6179
  }
6169
6180
 
6181
+ /**
6182
+ * @license
6183
+ * Copyright Google LLC All Rights Reserved.
6184
+ *
6185
+ * Use of this source code is governed by an MIT-style license that can be
6186
+ * found in the LICENSE file at https://angular.io/license
6187
+ */
6188
+ var R3TemplateDependencyKind;
6189
+ (function (R3TemplateDependencyKind) {
6190
+ R3TemplateDependencyKind[R3TemplateDependencyKind["Directive"] = 0] = "Directive";
6191
+ R3TemplateDependencyKind[R3TemplateDependencyKind["Pipe"] = 1] = "Pipe";
6192
+ R3TemplateDependencyKind[R3TemplateDependencyKind["NgModule"] = 2] = "NgModule";
6193
+ })(R3TemplateDependencyKind || (R3TemplateDependencyKind = {}));
6194
+
6170
6195
  /**
6171
6196
  * @license
6172
6197
  * Copyright Google LLC All Rights Reserved.
@@ -7662,7 +7687,26 @@ class BuiltinFunctionCall extends Call {
7662
7687
  * found in the LICENSE file at https://angular.io/license
7663
7688
  */
7664
7689
  /**
7665
- * This file is a port of shadowCSS from webcomponents.js to TypeScript.
7690
+ * The following set contains all keywords that can be used in the animation css shorthand
7691
+ * property and is used during the scoping of keyframes to make sure such keywords
7692
+ * are not modified.
7693
+ */
7694
+ const animationKeywords = new Set([
7695
+ // global values
7696
+ 'inherit', 'initial', 'revert', 'unset',
7697
+ // animation-direction
7698
+ 'alternate', 'alternate-reverse', 'normal', 'reverse',
7699
+ // animation-fill-mode
7700
+ 'backwards', 'both', 'forwards', 'none',
7701
+ // animation-play-state
7702
+ 'paused', 'running',
7703
+ // animation-timing-function
7704
+ 'ease', 'ease-in', 'ease-in-out', 'ease-out', 'linear', 'step-start', 'step-end',
7705
+ // `steps()` function
7706
+ 'end', 'jump-both', 'jump-end', 'jump-none', 'jump-start', 'start'
7707
+ ]);
7708
+ /**
7709
+ * The following class is a port of shadowCSS from webcomponents.js to TypeScript.
7666
7710
  *
7667
7711
  * Please make sure to keep to edits in sync with the source file.
7668
7712
  *
@@ -7788,6 +7832,21 @@ class BuiltinFunctionCall extends Call {
7788
7832
  class ShadowCss {
7789
7833
  constructor() {
7790
7834
  this.strictStyling = true;
7835
+ /**
7836
+ * Regular expression used to extrapolate the possible keyframes from an
7837
+ * animation declaration (with possibly multiple animation definitions)
7838
+ *
7839
+ * The regular expression can be divided in three parts
7840
+ * - (^|\s+)
7841
+ * simply captures how many (if any) leading whitespaces are present
7842
+ * - (?:(?:(['"])((?:\\\\|\\\2|(?!\2).)+)\2)|(-?[A-Za-z][\w\-]*))
7843
+ * captures two different possible keyframes, ones which are quoted or ones which are valid css
7844
+ * idents (custom properties excluded)
7845
+ * - (?=[,\s;]|$)
7846
+ * simply matches the end of the possible keyframe, valid endings are: a comma, a space, a
7847
+ * semicolon or the end of the string
7848
+ */
7849
+ this._animationDeclarationKeyframesRe = /(^|\s+)(?:(?:(['"])((?:\\\\|\\\2|(?!\2).)+)\2)|(-?[A-Za-z][\w\-]*))(?=[,\s]|$)/g;
7791
7850
  }
7792
7851
  /*
7793
7852
  * Shim some cssText with the given selector. Returns cssText that can
@@ -7808,6 +7867,143 @@ class ShadowCss {
7808
7867
  cssText = this._insertPolyfillDirectivesInCssText(cssText);
7809
7868
  return this._insertPolyfillRulesInCssText(cssText);
7810
7869
  }
7870
+ /**
7871
+ * Process styles to add scope to keyframes.
7872
+ *
7873
+ * Modify both the names of the keyframes defined in the component styles and also the css
7874
+ * animation rules using them.
7875
+ *
7876
+ * Animation rules using keyframes defined elsewhere are not modified to allow for globally
7877
+ * defined keyframes.
7878
+ *
7879
+ * For example, we convert this css:
7880
+ *
7881
+ * ```
7882
+ * .box {
7883
+ * animation: box-animation 1s forwards;
7884
+ * }
7885
+ *
7886
+ * @keyframes box-animation {
7887
+ * to {
7888
+ * background-color: green;
7889
+ * }
7890
+ * }
7891
+ * ```
7892
+ *
7893
+ * to this:
7894
+ *
7895
+ * ```
7896
+ * .box {
7897
+ * animation: scopeName_box-animation 1s forwards;
7898
+ * }
7899
+ *
7900
+ * @keyframes scopeName_box-animation {
7901
+ * to {
7902
+ * background-color: green;
7903
+ * }
7904
+ * }
7905
+ * ```
7906
+ *
7907
+ * @param cssText the component's css text that needs to be scoped.
7908
+ * @param scopeSelector the component's scope selector.
7909
+ *
7910
+ * @returns the scoped css text.
7911
+ */
7912
+ _scopeKeyframesRelatedCss(cssText, scopeSelector) {
7913
+ const unscopedKeyframesSet = new Set();
7914
+ const scopedKeyframesCssText = processRules(cssText, rule => this._scopeLocalKeyframeDeclarations(rule, scopeSelector, unscopedKeyframesSet));
7915
+ return processRules(scopedKeyframesCssText, rule => this._scopeAnimationRule(rule, scopeSelector, unscopedKeyframesSet));
7916
+ }
7917
+ /**
7918
+ * Scopes local keyframes names, returning the updated css rule and it also
7919
+ * adds the original keyframe name to a provided set to collect all keyframes names
7920
+ * so that it can later be used to scope the animation rules.
7921
+ *
7922
+ * For example, it takes a rule such as:
7923
+ *
7924
+ * ```
7925
+ * @keyframes box-animation {
7926
+ * to {
7927
+ * background-color: green;
7928
+ * }
7929
+ * }
7930
+ * ```
7931
+ *
7932
+ * and returns:
7933
+ *
7934
+ * ```
7935
+ * @keyframes scopeName_box-animation {
7936
+ * to {
7937
+ * background-color: green;
7938
+ * }
7939
+ * }
7940
+ * ```
7941
+ * and as a side effect it adds "box-animation" to the `unscopedKeyframesSet` set
7942
+ *
7943
+ * @param cssRule the css rule to process.
7944
+ * @param scopeSelector the component's scope selector.
7945
+ * @param unscopedKeyframesSet the set of unscoped keyframes names (which can be
7946
+ * modified as a side effect)
7947
+ *
7948
+ * @returns the css rule modified with the scoped keyframes name.
7949
+ */
7950
+ _scopeLocalKeyframeDeclarations(rule, scopeSelector, unscopedKeyframesSet) {
7951
+ return {
7952
+ ...rule,
7953
+ selector: rule.selector.replace(/(^@(?:-webkit-)?keyframes(?:\s+))(['"]?)(.+)\2(\s*)$/, (_, start, quote, keyframeName, endSpaces) => {
7954
+ unscopedKeyframesSet.add(unescapeQuotes(keyframeName, quote));
7955
+ return `${start}${quote}${scopeSelector}_${keyframeName}${quote}${endSpaces}`;
7956
+ }),
7957
+ };
7958
+ }
7959
+ /**
7960
+ * Function used to scope a keyframes name (obtained from an animation declaration)
7961
+ * using an existing set of unscopedKeyframes names to discern if the scoping needs to be
7962
+ * performed (keyframes names of keyframes not defined in the component's css need not to be
7963
+ * scoped).
7964
+ *
7965
+ * @param keyframe the keyframes name to check.
7966
+ * @param scopeSelector the component's scope selector.
7967
+ * @param unscopedKeyframesSet the set of unscoped keyframes names.
7968
+ *
7969
+ * @returns the scoped name of the keyframe, or the original name is the name need not to be
7970
+ * scoped.
7971
+ */
7972
+ _scopeAnimationKeyframe(keyframe, scopeSelector, unscopedKeyframesSet) {
7973
+ return keyframe.replace(/^(\s*)(['"]?)(.+?)\2(\s*)$/, (_, spaces1, quote, name, spaces2) => {
7974
+ name = `${unscopedKeyframesSet.has(unescapeQuotes(name, quote)) ? scopeSelector + '_' : ''}${name}`;
7975
+ return `${spaces1}${quote}${name}${quote}${spaces2}`;
7976
+ });
7977
+ }
7978
+ /**
7979
+ * Scope an animation rule so that the keyframes mentioned in such rule
7980
+ * are scoped if defined in the component's css and left untouched otherwise.
7981
+ *
7982
+ * It can scope values of both the 'animation' and 'animation-name' properties.
7983
+ *
7984
+ * @param rule css rule to scope.
7985
+ * @param scopeSelector the component's scope selector.
7986
+ * @param unscopedKeyframesSet the set of unscoped keyframes names.
7987
+ *
7988
+ * @returns the updated css rule.
7989
+ **/
7990
+ _scopeAnimationRule(rule, scopeSelector, unscopedKeyframesSet) {
7991
+ let content = rule.content.replace(/((?:^|\s+)(?:-webkit-)?animation(?:\s*):(?:\s*))([^;]+)/g, (_, start, animationDeclarations) => start +
7992
+ animationDeclarations.replace(this._animationDeclarationKeyframesRe, (original, leadingSpaces, quote = '', quotedName, nonQuotedName) => {
7993
+ if (quotedName) {
7994
+ return `${leadingSpaces}${this._scopeAnimationKeyframe(`${quote}${quotedName}${quote}`, scopeSelector, unscopedKeyframesSet)}`;
7995
+ }
7996
+ else {
7997
+ return animationKeywords.has(nonQuotedName) ?
7998
+ original :
7999
+ `${leadingSpaces}${this._scopeAnimationKeyframe(nonQuotedName, scopeSelector, unscopedKeyframesSet)}`;
8000
+ }
8001
+ }));
8002
+ content = content.replace(/((?:^|\s+)(?:-webkit-)?animation-name(?:\s*):(?:\s*))([^;]+)/g, (_match, start, commaSeparatedKeyframes) => `${start}${commaSeparatedKeyframes.split(',')
8003
+ .map((keyframe) => this._scopeAnimationKeyframe(keyframe, scopeSelector, unscopedKeyframesSet))
8004
+ .join(',')}`);
8005
+ return { ...rule, content };
8006
+ }
7811
8007
  /*
7812
8008
  * Process styles to convert native ShadowDOM rules that will trip
7813
8009
  * up the css parser; we rely on decorating the stylesheet with inert rules.
@@ -7866,6 +8062,7 @@ class ShadowCss {
7866
8062
  cssText = this._convertColonHostContext(cssText);
7867
8063
  cssText = this._convertShadowDOMSelectors(cssText);
7868
8064
  if (scopeSelector) {
8065
+ cssText = this._scopeKeyframesRelatedCss(cssText, scopeSelector);
7869
8066
  cssText = this._scopeSelectors(cssText, scopeSelector, hostSelector);
7870
8067
  }
7871
8068
  cssText = cssText + '\n' + unscopedRules;
@@ -8237,11 +8434,14 @@ function extractCommentsWithHash(input) {
8237
8434
  return input.match(_commentWithHashRe) || [];
8238
8435
  }
8239
8436
  const BLOCK_PLACEHOLDER = '%BLOCK%';
8240
- const QUOTE_PLACEHOLDER = '%QUOTED%';
8241
8437
  const _ruleRe = /(\s*)([^;\{\}]+?)(\s*)((?:{%BLOCK%}?\s*;?)|(?:\s*;))/g;
8242
- const _quotedRe = /%QUOTED%/g;
8243
8438
  const CONTENT_PAIRS = new Map([['{', '}']]);
8244
- const QUOTE_PAIRS = new Map([[`"`, `"`], [`'`, `'`]]);
8439
+ const COMMA_IN_PLACEHOLDER = '%COMMA_IN_PLACEHOLDER%';
8440
+ const SEMI_IN_PLACEHOLDER = '%SEMI_IN_PLACEHOLDER%';
8441
+ const COLON_IN_PLACEHOLDER = '%COLON_IN_PLACEHOLDER%';
8442
+ const _cssCommaInPlaceholderReGlobal = new RegExp(COMMA_IN_PLACEHOLDER, 'g');
8443
+ const _cssSemiInPlaceholderReGlobal = new RegExp(SEMI_IN_PLACEHOLDER, 'g');
8444
+ const _cssColonInPlaceholderReGlobal = new RegExp(COLON_IN_PLACEHOLDER, 'g');
8245
8445
  class CssRule {
8246
8446
  constructor(selector, content) {
8247
8447
  this.selector = selector;
@@ -8249,12 +8449,10 @@ class CssRule {
8249
8449
  }
8250
8450
  }
8251
8451
  function processRules(input, ruleCallback) {
8252
- const inputWithEscapedQuotes = escapeBlocks(input, QUOTE_PAIRS, QUOTE_PLACEHOLDER);
8253
- const inputWithEscapedBlocks = escapeBlocks(inputWithEscapedQuotes.escapedString, CONTENT_PAIRS, BLOCK_PLACEHOLDER);
8452
+ const escaped = escapeInStrings(input);
8453
+ const inputWithEscapedBlocks = escapeBlocks(escaped, CONTENT_PAIRS, BLOCK_PLACEHOLDER);
8254
8454
  let nextBlockIndex = 0;
8255
- let nextQuoteIndex = 0;
8256
- return inputWithEscapedBlocks.escapedString
8257
- .replace(_ruleRe, (...m) => {
8455
+ const escapedResult = inputWithEscapedBlocks.escapedString.replace(_ruleRe, (...m) => {
8258
8456
  const selector = m[2];
8259
8457
  let content = '';
8260
8458
  let suffix = m[4];
@@ -8266,8 +8464,8 @@ function processRules(input, ruleCallback) {
8266
8464
  }
8267
8465
  const rule = ruleCallback(new CssRule(selector, content));
8268
8466
  return `${m[1]}${rule.selector}${m[3]}${contentPrefix}${rule.content}${suffix}`;
8269
- })
8270
- .replace(_quotedRe, () => inputWithEscapedQuotes.blocks[nextQuoteIndex++]);
8467
+ });
8468
+ return unescapeInStrings(escapedResult);
8271
8469
  }
8272
8470
  class StringWithEscapedBlocks {
8273
8471
  constructor(escapedString, blocks) {
@@ -8318,6 +8516,112 @@ function escapeBlocks(input, charPairs, placeholder) {
8318
8516
  }
8319
8517
  return new StringWithEscapedBlocks(resultParts.join(''), escapedBlocks);
8320
8518
  }
8519
+ /**
8520
+ * Object containing as keys characters that should be substituted by placeholders
8521
+ * when found in strings during the css text parsing, and as values the respective
8522
+ * placeholders
8523
+ */
8524
+ const ESCAPE_IN_STRING_MAP = {
8525
+ ';': SEMI_IN_PLACEHOLDER,
8526
+ ',': COMMA_IN_PLACEHOLDER,
8527
+ ':': COLON_IN_PLACEHOLDER
8528
+ };
8529
+ /**
8530
+ * Parse the provided css text and inside strings (meaning, inside pairs of unescaped single or
8531
+ * double quotes) replace specific characters with their respective placeholders as indicated
8532
+ * by the `ESCAPE_IN_STRING_MAP` map.
8533
+ *
8534
+ * For example convert the text
8535
+ * `animation: "my-anim:at\"ion" 1s;`
8536
+ * to
8537
+ * `animation: "my-anim%COLON_IN_PLACEHOLDER%at\"ion" 1s;`
8538
+ *
8539
+ * This is necessary in order to remove the meaning of some characters when found inside strings
8540
+ * (for example `;` indicates the end of a css declaration, `,` the sequence of values and `:` the
8541
+ * division between property and value during a declaration, none of these meanings apply when such
8542
+ * characters are within strings and so in order to prevent parsing issues they need to be replaced
8543
+ * with placeholder text for the duration of the css manipulation process).
8544
+ *
8545
+ * @param input the original css text.
8546
+ *
8547
+ * @returns the css text with specific characters in strings replaced by placeholders.
8548
+ **/
8549
+ function escapeInStrings(input) {
8550
+ let result = input;
8551
+ let currentQuoteChar = null;
8552
+ for (let i = 0; i < result.length; i++) {
8553
+ const char = result[i];
8554
+ if (char === '\\') {
8555
+ i++;
8556
+ }
8557
+ else {
8558
+ if (currentQuoteChar !== null) {
8559
+ // index i is inside a quoted sub-string
8560
+ if (char === currentQuoteChar) {
8561
+ currentQuoteChar = null;
8562
+ }
8563
+ else {
8564
+ const placeholder = ESCAPE_IN_STRING_MAP[char];
8565
+ if (placeholder) {
8566
+ result = `${result.substr(0, i)}${placeholder}${result.substr(i + 1)}`;
8567
+ i += placeholder.length - 1;
8568
+ }
8569
+ }
8570
+ }
8571
+ else if (char === '\'' || char === '"') {
8572
+ currentQuoteChar = char;
8573
+ }
8574
+ }
8575
+ }
8576
+ return result;
8577
+ }
8578
+ /**
8579
+ * Replace in a string all occurrences of keys in the `ESCAPE_IN_STRING_MAP` map with their
8580
+ * original representation, this is simply used to revert the changes applied by the
8581
+ * escapeInStrings function.
8582
+ *
8583
+ * For example it reverts the text:
8584
+ * `animation: "my-anim%COLON_IN_PLACEHOLDER%at\"ion" 1s;`
8585
+ * to it's original form of:
8586
+ * `animation: "my-anim:at\"ion" 1s;`
8587
+ *
8588
+ * Note: For the sake of simplicity this function does not check that the placeholders are
8589
+ * actually inside strings as it would anyway be extremely unlikely to find them outside of strings.
8590
+ *
8591
+ * @param input the css text containing the placeholders.
8592
+ *
8593
+ * @returns the css text without the placeholders.
8594
+ */
8595
+ function unescapeInStrings(input) {
8596
+ let result = input.replace(_cssCommaInPlaceholderReGlobal, ',');
8597
+ result = result.replace(_cssSemiInPlaceholderReGlobal, ';');
8598
+ result = result.replace(_cssColonInPlaceholderReGlobal, ':');
8599
+ return result;
8600
+ }
8601
+ /**
8602
+ * Unescape all quotes present in a string, but only if the string was actually already
8603
+ * quoted.
8604
+ *
8605
+ * This generates a "canonical" representation of strings which can be used to match strings
8606
+ * which would otherwise only differ because of differently escaped quotes.
8607
+ *
8608
+ * For example it converts the string (assumed to be quoted):
8609
+ * `this \\"is\\" a \\'\\\\'test`
8610
+ * to:
8611
+ * `this "is" a '\\\\'test`
8612
+ * (note that the latter backslashes are not removed as they are not actually escaping the single
8613
+ * quote)
8614
+ *
8615
+ *
8616
+ * @param input the string possibly containing escaped quotes.
8617
+ * @param isQuoted boolean indicating whether the string was quoted inside a bigger string (if not
8618
+ * then it means that it doesn't represent an inner string and thus no unescaping is required)
8619
+ *
8620
+ * @returns the string in the "canonical" representation without escaped quotes.
8621
+ */
8622
+ function unescapeQuotes(str, isQuoted) {
8623
+ return !isQuoted ? str : str.replace(/((?:^|[^\\])(?:\\\\)*)\\(?=['"])/g, '$1');
8624
+ }
8321
8625
  /**
8322
8626
  * Combine the `contextSelectors` with the `hostMarker` and the `otherSelectors`
8323
8627
  * to create a selector that matches the same as `:host-context()`.
@@ -16766,11 +17070,64 @@ function i18nMetaToJSDoc(meta) {
16766
17070
 
16767
17071
  /** Closure uses `goog.getMsg(message)` to lookup translations */
16768
17072
  const GOOG_GET_MSG = 'goog.getMsg';
16769
- function createGoogleGetMsgStatements(variable$1, message, closureVar, params) {
17073
+ /**
17074
+ * Generates a `goog.getMsg()` statement and reassignment. The template:
17075
+ *
17076
+ * ```html
17077
+ * <div i18n>Sent from {{ sender }} to <span class="receiver">{{ receiver }}</span></div>
17078
+ * ```
17079
+ *
17080
+ * Generates:
17081
+ *
17082
+ * ```typescript
17083
+ * const MSG_FOO = goog.getMsg(
17084
+ * // Message template.
17085
+ * 'Sent from {$interpolation} to {$startTagSpan}{$interpolation_1}{$closeTagSpan}.',
17086
+ * // Placeholder values, set to magic strings which get replaced by the Angular runtime.
17087
+ * {
17088
+ * 'interpolation': '\uFFFD0\uFFFD',
17089
+ * 'startTagSpan': '\uFFFD1\uFFFD',
17090
+ * 'interpolation_1': '\uFFFD2\uFFFD',
17091
+ * 'closeTagSpan': '\uFFFD3\uFFFD',
17092
+ * },
17093
+ * // Options bag.
17094
+ * {
17095
+ * // Maps each placeholder to the original Angular source code which generates it's value.
17096
+ * original_code: {
17097
+ * 'interpolation': '{{ sender }}',
17098
+ * 'startTagSpan': '<span class="receiver">',
17099
+ * 'interploation_1': '{{ receiver }}',
17100
+ * 'closeTagSpan': '</span>',
17101
+ * },
17102
+ * },
17103
+ * );
17104
+ * const I18N_0 = MSG_FOO;
17105
+ * ```
17106
+ */
17107
+ function createGoogleGetMsgStatements(variable$1, message, closureVar, placeholderValues) {
16770
17108
  const messageString = serializeI18nMessageForGetMsg(message);
16771
17109
  const args = [literal(messageString)];
16772
- if (Object.keys(params).length) {
16773
- args.push(mapLiteral(params, true));
17110
+ if (Object.keys(placeholderValues).length) {
17111
+ // Message template parameters containing the magic strings replaced by the Angular runtime with
17112
+ // real data, e.g. `{'interpolation': '\uFFFD0\uFFFD'}`.
17113
+ args.push(mapLiteral(formatI18nPlaceholderNamesInMap(placeholderValues, true /* useCamelCase */), true /* quoted */));
17114
+ // Message options object, which contains original source code for placeholders (as they are
17115
+ // present in a template, e.g.
17116
+ // `{original_code: {'interpolation': '{{ name }}', 'startTagSpan': '<span>'}}`.
17117
+ args.push(mapLiteral({
17118
+ original_code: literalMap(Object.keys(placeholderValues)
17119
+ .map((param) => ({
17120
+ key: formatI18nPlaceholderName(param),
17121
+ quoted: true,
17122
+ value: message.placeholders[param] ?
17123
+ // Get source span for typical placeholder if it exists.
17124
+ literal(message.placeholders[param].sourceSpan.toString()) :
17125
+ // Otherwise must be an ICU expression, get it's source span.
17126
+ literal(message.placeholderToMessage[param]
17127
+ .nodes.map((node) => node.sourceSpan.toString())
17128
+ .join('')),
17129
+ }))),
17130
+ }));
16774
17131
  }
16775
17132
  // /**
16776
17133
  // * @desc description of message
@@ -17721,7 +18078,7 @@ class TemplateDefinitionBuilder {
17721
18078
  // - all ICU vars (such as `VAR_SELECT` or `VAR_PLURAL`) are replaced with correct values
17722
18079
  const transformFn = (raw) => {
17723
18080
  const params = { ...vars, ...placeholders };
17724
- const formatted = i18nFormatPlaceholderNames(params, /* useCamelCase */ false);
18081
+ const formatted = formatI18nPlaceholderNamesInMap(params, /* useCamelCase */ false);
17725
18082
  return invokeInstruction(null, Identifiers.i18nPostprocess, [raw, mapLiteral(formatted, true)]);
17726
18083
  };
17727
18084
  // in case the whole i18n message is a single ICU - we do not need to
@@ -18642,7 +18999,7 @@ const NG_I18N_CLOSURE_MODE = 'ngI18nClosureMode';
18642
18999
  function getTranslationDeclStmts(message, variable, closureVar, params = {}, transformFn) {
18643
19000
  const statements = [
18644
19001
  declareI18nVariable(variable),
18645
- ifStmt(createClosureModeGuard(), createGoogleGetMsgStatements(variable, message, closureVar, i18nFormatPlaceholderNames(params, /* useCamelCase */ true)), createLocalizeStatements(variable, message, i18nFormatPlaceholderNames(params, /* useCamelCase */ false))),
19002
+ ifStmt(createClosureModeGuard(), createGoogleGetMsgStatements(variable, message, closureVar, params), createLocalizeStatements(variable, message, formatI18nPlaceholderNamesInMap(params, /* useCamelCase */ false))),
18646
19003
  ];
18647
19004
  if (transformFn) {
18648
19005
  statements.push(new ExpressionStatement(variable.set(transformFn(variable))));
@@ -18736,6 +19093,10 @@ function addFeatures(definitionMap, meta) {
18736
19093
  if (meta.lifecycle.usesOnChanges) {
18737
19094
  features.push(importExpr(Identifiers.NgOnChangesFeature));
18738
19095
  }
19096
+ // TODO: better way of differentiating component vs directive metadata.
19097
+ if (meta.hasOwnProperty('template') && meta.isStandalone) {
19098
+ features.push(importExpr(Identifiers.StandaloneFeature));
19099
+ }
18739
19100
  if (features.length) {
18740
19101
  definitionMap.set('features', literalArr(features));
18741
19102
  }
@@ -18799,17 +19160,8 @@ function compileComponentFromMetadata(meta, constantPool, bindingParser) {
18799
19160
  definitionMap.set('consts', constsExpr);
18800
19161
  }
18801
19162
  definitionMap.set('template', templateFunctionExpression);
18802
- // e.g. `directives: [MyDirective]`
18803
- if (meta.directives.length > 0) {
18804
- const directivesList = literalArr(meta.directives.map(dir => dir.type));
18805
- const directivesExpr = compileDeclarationList(directivesList, meta.declarationListEmitMode);
18806
- definitionMap.set('directives', directivesExpr);
18807
- }
18808
- // e.g. `pipes: [MyPipe]`
18809
- if (meta.pipes.size > 0) {
18810
- const pipesList = literalArr(Array.from(meta.pipes.values()));
18811
- const pipesExpr = compileDeclarationList(pipesList, meta.declarationListEmitMode);
18812
- definitionMap.set('pipes', pipesExpr);
19163
+ if (meta.declarations.length > 0) {
19164
+ definitionMap.set('dependencies', compileDeclarationList(literalArr(meta.declarations.map(decl => decl.type)), meta.declarationListEmitMode));
18813
19165
  }
18814
19166
  if (meta.encapsulation === null) {
18815
19167
  meta.encapsulation = ViewEncapsulation.Emulated;
@@ -18847,8 +19199,9 @@ function compileComponentFromMetadata(meta, constantPool, bindingParser) {
18847
19199
  * to be consumed by upstream compilations.
18848
19200
  */
18849
19201
  function createComponentType(meta) {
18850
- const typeParams = createDirectiveTypeParams(meta);
19202
+ const typeParams = createBaseDirectiveTypeParams(meta);
18851
19203
  typeParams.push(stringArrayAsType(meta.template.ngContentSelectors));
19204
+ typeParams.push(expressionType(literal(meta.isStandalone)));
18852
19205
  return expressionType(importExpr(Identifiers.ComponentDeclaration, typeParams));
18853
19206
  }
18854
19207
  /**
@@ -18939,7 +19292,7 @@ function stringArrayAsType(arr) {
18939
19292
  return arr.length > 0 ? expressionType(literalArr(arr.map(value => literal(value)))) :
18940
19293
  NONE_TYPE;
18941
19294
  }
18942
- function createDirectiveTypeParams(meta) {
19295
+ function createBaseDirectiveTypeParams(meta) {
18943
19296
  // On the type side, remove newlines from the selector as it will need to fit into a TypeScript
18944
19297
  // string literal, which must be on one line.
18945
19298
  const selectorForType = meta.selector !== null ? meta.selector.replace(/\n/g, '') : null;
@@ -18957,7 +19310,11 @@ function createDirectiveTypeParams(meta) {
18957
19310
  * to be consumed by upstream compilations.
18958
19311
  */
18959
19312
  function createDirectiveType(meta) {
18960
- const typeParams = createDirectiveTypeParams(meta);
19313
+ const typeParams = createBaseDirectiveTypeParams(meta);
19314
+ // Directives have no NgContentSelectors slot, but instead express a `never` type
19315
+ // so that future fields align.
19316
+ typeParams.push(NONE_TYPE);
19317
+ typeParams.push(expressionType(literal(meta.isStandalone)));
18961
19318
  return expressionType(importExpr(Identifiers.DirectiveDeclaration, typeParams));
18962
19319
  }
18963
19320
  // Define and update any view queries
@@ -19319,10 +19676,10 @@ class CompilerFacadeImpl {
19319
19676
  internalType: new WrappedNodeExpr(facade.type),
19320
19677
  typeArgumentCount: facade.typeArgumentCount,
19321
19678
  providedIn: computeProvidedIn(facade.providedIn),
19322
- useClass: convertToProviderExpression(facade, USE_CLASS),
19323
- useFactory: wrapExpression(facade, USE_FACTORY),
19324
- useValue: convertToProviderExpression(facade, USE_VALUE),
19325
- useExisting: convertToProviderExpression(facade, USE_EXISTING),
19679
+ useClass: convertToProviderExpression(facade, 'useClass'),
19680
+ useFactory: wrapExpression(facade, 'useFactory'),
19681
+ useValue: convertToProviderExpression(facade, 'useValue'),
19682
+ useExisting: convertToProviderExpression(facade, 'useExisting'),
19326
19683
  deps: facade.deps?.map(convertR3DependencyMetadata),
19327
19684
  },
19328
19685
  /* resolveForwardRefs */ true);
@@ -19335,10 +19692,10 @@ class CompilerFacadeImpl {
19335
19692
  internalType: new WrappedNodeExpr(facade.type),
19336
19693
  typeArgumentCount: 0,
19337
19694
  providedIn: computeProvidedIn(facade.providedIn),
19338
- useClass: convertToProviderExpression(facade, USE_CLASS),
19339
- useFactory: wrapExpression(facade, USE_FACTORY),
19340
- useValue: convertToProviderExpression(facade, USE_VALUE),
19341
- useExisting: convertToProviderExpression(facade, USE_EXISTING),
19695
+ useClass: convertToProviderExpression(facade, 'useClass'),
19696
+ useFactory: wrapExpression(facade, 'useFactory'),
19697
+ useValue: convertToProviderExpression(facade, 'useValue'),
19698
+ useExisting: convertToProviderExpression(facade, 'useExisting'),
19342
19699
  deps: facade.deps?.map(convertR3DeclareDependencyMetadata),
19343
19700
  },
19344
19701
  /* resolveForwardRefs */ true);
@@ -19405,6 +19762,7 @@ class CompilerFacadeImpl {
19405
19762
  ...convertDirectiveFacadeToMetadata(facade),
19406
19763
  selector: facade.selector || this.elementSchemaRegistry.getDefaultComponentElementName(),
19407
19764
  template,
19765
+ declarations: facade.declarations.map(convertDeclarationFacadeToMetadata),
19408
19766
  declarationListEmitMode: 0 /* Direct */,
19409
19767
  styles: [...facade.styles, ...template.styles],
19410
19768
  encapsulation: facade.encapsulation,
@@ -19477,10 +19835,6 @@ class CompilerFacadeImpl {
19477
19835
  return res['$def'];
19478
19836
  }
19479
19837
  }
19480
- const USE_CLASS = Object.keys({ useClass: null })[0];
19481
- const USE_FACTORY = Object.keys({ useFactory: null })[0];
19482
- const USE_VALUE = Object.keys({ useValue: null })[0];
19483
- const USE_EXISTING = Object.keys({ useExisting: null })[0];
19484
19838
  function convertToR3QueryMetadata(facade) {
19485
19839
  return {
19486
19840
  ...facade,
@@ -19584,31 +19938,57 @@ function convertOpaqueValuesToExpressions(obj) {
19584
19938
  }
19585
19939
  return result;
19586
19940
  }
19587
- function convertDeclareComponentFacadeToMetadata(declaration, typeSourceSpan, sourceMapUrl) {
19588
- const { template, interpolation } = parseJitTemplate(declaration.template, declaration.type.name, sourceMapUrl, declaration.preserveWhitespaces ?? false, declaration.interpolation);
19941
+ function convertDeclareComponentFacadeToMetadata(decl, typeSourceSpan, sourceMapUrl) {
19942
+ const { template, interpolation } = parseJitTemplate(decl.template, decl.type.name, sourceMapUrl, decl.preserveWhitespaces ?? false, decl.interpolation);
19943
+ const declarations = [];
19944
+ if (decl.dependencies) {
19945
+ for (const innerDep of decl.dependencies) {
19946
+ switch (innerDep.kind) {
19947
+ case 'directive':
19948
+ case 'component':
19949
+ declarations.push(convertDirectiveDeclarationToMetadata(innerDep));
19950
+ break;
19951
+ case 'pipe':
19952
+ declarations.push(convertPipeDeclarationToMetadata(innerDep));
19953
+ break;
19954
+ }
19955
+ }
19956
+ }
19957
+ else if (decl.components || decl.directives || decl.pipes) {
19958
+ // Existing declarations on NPM may not be using the new `dependencies` merged field, and may
19959
+ // have separate fields for dependencies instead. Unify them for JIT compilation.
19960
+ decl.components &&
19961
+ declarations.push(...decl.components.map(dir => convertDirectiveDeclarationToMetadata(dir, /* isComponent */ true)));
19962
+ decl.directives &&
19963
+ declarations.push(...decl.directives.map(dir => convertDirectiveDeclarationToMetadata(dir)));
19964
+ decl.pipes && declarations.push(...convertPipeMapToMetadata(decl.pipes));
19965
+ }
19589
19966
  return {
19590
- ...convertDeclareDirectiveFacadeToMetadata(declaration, typeSourceSpan),
19967
+ ...convertDeclareDirectiveFacadeToMetadata(decl, typeSourceSpan),
19591
19968
  template,
19592
- styles: declaration.styles ?? [],
19593
- directives: (declaration.components ?? [])
19594
- .concat(declaration.directives ?? [])
19595
- .map(convertUsedDirectiveDeclarationToMetadata),
19596
- pipes: convertUsedPipesToMetadata(declaration.pipes),
19597
- viewProviders: declaration.viewProviders !== undefined ?
19598
- new WrappedNodeExpr(declaration.viewProviders) :
19969
+ styles: decl.styles ?? [],
19970
+ declarations,
19971
+ viewProviders: decl.viewProviders !== undefined ? new WrappedNodeExpr(decl.viewProviders) :
19599
19972
  null,
19600
- animations: declaration.animations !== undefined ? new WrappedNodeExpr(declaration.animations) :
19601
- null,
19602
- changeDetection: declaration.changeDetection ?? ChangeDetectionStrategy.Default,
19603
- encapsulation: declaration.encapsulation ?? ViewEncapsulation.Emulated,
19973
+ animations: decl.animations !== undefined ? new WrappedNodeExpr(decl.animations) : null,
19974
+ changeDetection: decl.changeDetection ?? ChangeDetectionStrategy.Default,
19975
+ encapsulation: decl.encapsulation ?? ViewEncapsulation.Emulated,
19604
19976
  interpolation,
19605
19977
  declarationListEmitMode: 2 /* ClosureResolved */,
19606
19978
  relativeContextFilePath: '',
19607
19979
  i18nUseExternalIds: true,
19608
19980
  };
19609
19981
  }
19610
- function convertUsedDirectiveDeclarationToMetadata(declaration) {
19982
+ function convertDeclarationFacadeToMetadata(declaration) {
19611
19983
  return {
19984
+ ...declaration,
19985
+ type: new WrappedNodeExpr(declaration.type),
19986
+ };
19987
+ }
19988
+ function convertDirectiveDeclarationToMetadata(declaration, isComponent = null) {
19989
+ return {
19990
+ kind: R3TemplateDependencyKind.Directive,
19991
+ isComponent: isComponent || declaration.kind === 'component',
19612
19992
  selector: declaration.selector,
19613
19993
  type: new WrappedNodeExpr(declaration.type),
19614
19994
  inputs: declaration.inputs ?? [],
@@ -19616,16 +19996,24 @@ function convertUsedDirectiveDeclarationToMetadata(declaration) {
19616
19996
  exportAs: declaration.exportAs ?? null,
19617
19997
  };
19618
19998
  }
19619
- function convertUsedPipesToMetadata(declaredPipes) {
19620
- const pipes = new Map();
19621
- if (declaredPipes === undefined) {
19622
- return pipes;
19623
- }
19624
- for (const pipeName of Object.keys(declaredPipes)) {
19625
- const pipeType = declaredPipes[pipeName];
19626
- pipes.set(pipeName, new WrappedNodeExpr(pipeType));
19999
+ function convertPipeMapToMetadata(pipes) {
20000
+ if (!pipes) {
20001
+ return [];
19627
20002
  }
19628
- return pipes;
20003
+ return Object.keys(pipes).map(name => {
20004
+ return {
20005
+ kind: R3TemplateDependencyKind.Pipe,
20006
+ name,
20007
+ type: new WrappedNodeExpr(pipes[name]),
20008
+ };
20009
+ });
20010
+ }
20011
+ function convertPipeDeclarationToMetadata(pipe) {
20012
+ return {
20013
+ kind: R3TemplateDependencyKind.Pipe,
20014
+ name: pipe.name,
20015
+ type: new WrappedNodeExpr(pipe.type),
20016
+ };
19629
20017
  }
19630
20018
  function parseJitTemplate(template, typeName, sourceMapUrl, preserveWhitespaces, interpolation) {
19631
20019
  const interpolationConfig = interpolation ? InterpolationConfig.fromArray(interpolation) : DEFAULT_INTERPOLATION_CONFIG;
@@ -19772,7 +20160,7 @@ function publishFacade(global) {
19772
20160
  * Use of this source code is governed by an MIT-style license that can be
19773
20161
  * found in the LICENSE file at https://angular.io/license
19774
20162
  */
19775
- const VERSION = new Version('14.0.0-next.12');
20163
+ const VERSION = new Version('14.0.0-next.15');
19776
20164
 
19777
20165
  /**
19778
20166
  * @license
@@ -21269,14 +21657,6 @@ var FactoryTarget;
21269
21657
  * found in the LICENSE file at https://angular.io/license
21270
21658
  */
21271
21659
 
21272
- /**
21273
- * @license
21274
- * Copyright Google LLC All Rights Reserved.
21275
- *
21276
- * Use of this source code is governed by an MIT-style license that can be
21277
- * found in the LICENSE file at https://angular.io/license
21278
- */
21279
-
21280
21660
  /**
21281
21661
  * @license
21282
21662
  * Copyright Google LLC All Rights Reserved.
@@ -21813,7 +22193,7 @@ const MINIMUM_PARTIAL_LINKER_VERSION$6 = '12.0.0';
21813
22193
  function compileDeclareClassMetadata(metadata) {
21814
22194
  const definitionMap = new DefinitionMap();
21815
22195
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$6));
21816
- definitionMap.set('version', literal('14.0.0-next.12'));
22196
+ definitionMap.set('version', literal('14.0.0-next.15'));
21817
22197
  definitionMap.set('ngImport', importExpr(Identifiers.core));
21818
22198
  definitionMap.set('type', metadata.type);
21819
22199
  definitionMap.set('decorators', metadata.decorators);
@@ -21930,9 +22310,12 @@ function compileDeclareDirectiveFromMetadata(meta) {
21930
22310
  function createDirectiveDefinitionMap(meta) {
21931
22311
  const definitionMap = new DefinitionMap();
21932
22312
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$5));
21933
- definitionMap.set('version', literal('14.0.0-next.12'));
22313
+ definitionMap.set('version', literal('14.0.0-next.15'));
21934
22314
  // e.g. `type: MyDirective`
21935
22315
  definitionMap.set('type', meta.internalType);
22316
+ if (meta.isStandalone) {
22317
+ definitionMap.set('isStandalone', literal(meta.isStandalone));
22318
+ }
21936
22319
  // e.g. `selector: 'some-dir'`
21937
22320
  if (meta.selector !== null) {
21938
22321
  definitionMap.set('selector', literal(meta.selector));
@@ -22037,9 +22420,7 @@ function createComponentDefinitionMap(meta, template, templateInfo) {
22037
22420
  definitionMap.set('isInline', literal(true));
22038
22421
  }
22039
22422
  definitionMap.set('styles', toOptionalLiteralArray(meta.styles, literal));
22040
- definitionMap.set('components', compileUsedDirectiveMetadata(meta, directive => directive.isComponent === true));
22041
- definitionMap.set('directives', compileUsedDirectiveMetadata(meta, directive => directive.isComponent !== true));
22042
- definitionMap.set('pipes', compileUsedPipeMetadata(meta));
22423
+ definitionMap.set('dependencies', compileUsedDependenciesMetadata(meta));
22043
22424
  definitionMap.set('viewProviders', meta.viewProviders);
22044
22425
  definitionMap.set('animations', meta.animations);
22045
22426
  if (meta.changeDetection !== undefined) {
@@ -22095,43 +22476,35 @@ function computeEndLocation(file, contents) {
22095
22476
  } while (lineStart !== -1);
22096
22477
  return new ParseLocation(file, length, line, length - lastLineStart);
22097
22478
  }
22098
- /**
22099
- * Compiles the directives as registered in the component metadata into an array literal of the
22100
- * individual directives. If the component does not use any directives, then null is returned.
22101
- */
22102
- function compileUsedDirectiveMetadata(meta, predicate) {
22479
+ function compileUsedDependenciesMetadata(meta) {
22103
22480
  const wrapType = meta.declarationListEmitMode !== 0 /* Direct */ ?
22104
22481
  generateForwardRef :
22105
22482
  (expr) => expr;
22106
- const directives = meta.directives.filter(predicate);
22107
- return toOptionalLiteralArray(directives, directive => {
22108
- const dirMeta = new DefinitionMap();
22109
- dirMeta.set('type', wrapType(directive.type));
22110
- dirMeta.set('selector', literal(directive.selector));
22111
- dirMeta.set('inputs', toOptionalLiteralArray(directive.inputs, literal));
22112
- dirMeta.set('outputs', toOptionalLiteralArray(directive.outputs, literal));
22113
- dirMeta.set('exportAs', toOptionalLiteralArray(directive.exportAs, literal));
22114
- return dirMeta.toLiteralMap();
22483
+ return toOptionalLiteralArray(meta.declarations, decl => {
22484
+ switch (decl.kind) {
22485
+ case R3TemplateDependencyKind.Directive:
22486
+ const dirMeta = new DefinitionMap();
22487
+ dirMeta.set('kind', literal(decl.isComponent ? 'component' : 'directive'));
22488
+ dirMeta.set('type', wrapType(decl.type));
22489
+ dirMeta.set('selector', literal(decl.selector));
22490
+ dirMeta.set('inputs', toOptionalLiteralArray(decl.inputs, literal));
22491
+ dirMeta.set('outputs', toOptionalLiteralArray(decl.outputs, literal));
22492
+ dirMeta.set('exportAs', toOptionalLiteralArray(decl.exportAs, literal));
22493
+ return dirMeta.toLiteralMap();
22494
+ case R3TemplateDependencyKind.Pipe:
22495
+ const pipeMeta = new DefinitionMap();
22496
+ pipeMeta.set('kind', literal('pipe'));
22497
+ pipeMeta.set('type', wrapType(decl.type));
22498
+ pipeMeta.set('name', literal(decl.name));
22499
+ return pipeMeta.toLiteralMap();
22500
+ case R3TemplateDependencyKind.NgModule:
22501
+ const ngModuleMeta = new DefinitionMap();
22502
+ ngModuleMeta.set('kind', literal('ngmodule'));
22503
+ ngModuleMeta.set('type', wrapType(decl.type));
22504
+ return ngModuleMeta.toLiteralMap();
22505
+ }
22115
22506
  });
22116
22507
  }
22117
- /**
22118
- * Compiles the pipes as registered in the component metadata into an object literal, where the
22119
- * pipe's name is used as key and a reference to its type as value. If the component does not use
22120
- * any pipes, then null is returned.
22121
- */
22122
- function compileUsedPipeMetadata(meta) {
22123
- if (meta.pipes.size === 0) {
22124
- return null;
22125
- }
22126
- const wrapType = meta.declarationListEmitMode !== 0 /* Direct */ ?
22127
- generateForwardRef :
22128
- (expr) => expr;
22129
- const entries = [];
22130
- for (const [name, pipe] of meta.pipes) {
22131
- entries.push({ key: name, value: wrapType(pipe), quoted: true });
22132
- }
22133
- return literalMap(entries);
22134
- }
22135
22508
 
22136
22509
  /**
22137
22510
  * @license
@@ -22151,7 +22524,7 @@ const MINIMUM_PARTIAL_LINKER_VERSION$4 = '12.0.0';
22151
22524
  function compileDeclareFactoryFunction(meta) {
22152
22525
  const definitionMap = new DefinitionMap();
22153
22526
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$4));
22154
- definitionMap.set('version', literal('14.0.0-next.12'));
22527
+ definitionMap.set('version', literal('14.0.0-next.15'));
22155
22528
  definitionMap.set('ngImport', importExpr(Identifiers.core));
22156
22529
  definitionMap.set('type', meta.internalType);
22157
22530
  definitionMap.set('deps', compileDependencies(meta.deps));
@@ -22193,7 +22566,7 @@ function compileDeclareInjectableFromMetadata(meta) {
22193
22566
  function createInjectableDefinitionMap(meta) {
22194
22567
  const definitionMap = new DefinitionMap();
22195
22568
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$3));
22196
- definitionMap.set('version', literal('14.0.0-next.12'));
22569
+ definitionMap.set('version', literal('14.0.0-next.15'));
22197
22570
  definitionMap.set('ngImport', importExpr(Identifiers.core));
22198
22571
  definitionMap.set('type', meta.internalType);
22199
22572
  // Only generate providedIn property if it has a non-null value
@@ -22251,7 +22624,7 @@ function compileDeclareInjectorFromMetadata(meta) {
22251
22624
  function createInjectorDefinitionMap(meta) {
22252
22625
  const definitionMap = new DefinitionMap();
22253
22626
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$2));
22254
- definitionMap.set('version', literal('14.0.0-next.12'));
22627
+ definitionMap.set('version', literal('14.0.0-next.15'));
22255
22628
  definitionMap.set('ngImport', importExpr(Identifiers.core));
22256
22629
  definitionMap.set('type', meta.internalType);
22257
22630
  definitionMap.set('providers', meta.providers);
@@ -22288,7 +22661,7 @@ function compileDeclareNgModuleFromMetadata(meta) {
22288
22661
  function createNgModuleDefinitionMap(meta) {
22289
22662
  const definitionMap = new DefinitionMap();
22290
22663
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$1));
22291
- definitionMap.set('version', literal('14.0.0-next.12'));
22664
+ definitionMap.set('version', literal('14.0.0-next.15'));
22292
22665
  definitionMap.set('ngImport', importExpr(Identifiers.core));
22293
22666
  definitionMap.set('type', meta.internalType);
22294
22667
  // We only generate the keys in the metadata if the arrays contain values.
@@ -22346,10 +22719,13 @@ function compileDeclarePipeFromMetadata(meta) {
22346
22719
  function createPipeDefinitionMap(meta) {
22347
22720
  const definitionMap = new DefinitionMap();
22348
22721
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION));
22349
- definitionMap.set('version', literal('14.0.0-next.12'));
22722
+ definitionMap.set('version', literal('14.0.0-next.15'));
22350
22723
  definitionMap.set('ngImport', importExpr(Identifiers.core));
22351
22724
  // e.g. `type: MyPipe`
22352
22725
  definitionMap.set('type', meta.internalType);
22726
+ if (meta.isStandalone) {
22727
+ definitionMap.set('isStandalone', literal(meta.isStandalone));
22728
+ }
22353
22729
  // e.g. `name: "myPipe"`
22354
22730
  definitionMap.set('name', literal(meta.pipeName));
22355
22731
  if (meta.pure === false) {
@@ -22396,5 +22772,5 @@ publishFacade(_global);
22396
22772
  * found in the LICENSE file at https://angular.io/license
22397
22773
  */
22398
22774
 
22399
- export { AST, ASTWithName, ASTWithSource, AbsoluteSourceSpan, ArrayType, AstMemoryEfficientTransformer, AstTransformer, Attribute, Binary, BinaryOperator, BinaryOperatorExpr, BindingPipe, BoundElementProperty, BuiltinType, BuiltinTypeName, CUSTOM_ELEMENTS_SCHEMA, Call, Chain, ChangeDetectionStrategy, CommaExpr, Comment, CompilerConfig, Conditional, ConditionalExpr, ConstantPool, CssSelector, DEFAULT_INTERPOLATION_CONFIG, DYNAMIC_TYPE, DeclareFunctionStmt, DeclareVarStmt, DomElementSchemaRegistry, EOF, Element, ElementSchemaRegistry, EmitterVisitorContext, EmptyExpr, Expansion, ExpansionCase, Expression, ExpressionBinding, ExpressionStatement, ExpressionType, ExternalExpr, ExternalReference, FactoryTarget$1 as FactoryTarget, FunctionExpr, HtmlParser, HtmlTagDefinition, I18NHtmlParser, IfStmt, ImplicitReceiver, InstantiateExpr, Interpolation, InterpolationConfig, InvokeFunctionExpr, JSDocComment, JitEvaluator, KeyedRead, KeyedWrite, LeadingComment, Lexer, LiteralArray, LiteralArrayExpr, LiteralExpr, LiteralMap, LiteralMapExpr, LiteralPrimitive, LocalizedString, MapType, MessageBundle, NONE_TYPE, NO_ERRORS_SCHEMA, NodeWithI18n, NonNullAssert, NotExpr, ParseError, ParseErrorLevel, ParseLocation, ParseSourceFile, ParseSourceSpan, ParseSpan, ParseTreeResult, ParsedEvent, ParsedProperty, ParsedPropertyType, ParsedVariable, Parser$1 as Parser, ParserError, PrefixNot, PropertyRead, PropertyWrite, R3BoundTarget, Identifiers as R3Identifiers, R3SelectorScopeMode, R3TargetBinder, ReadKeyExpr, ReadPropExpr, ReadVarExpr, RecursiveAstVisitor, RecursiveVisitor, ResourceLoader, ReturnStatement, STRING_TYPE, SafeCall, SafeKeyedRead, SafePropertyRead, SelectorContext, SelectorListContext, SelectorMatcher, Serializer, SplitInterpolation, Statement, StmtModifier, TagContentType, TaggedTemplateExpr, TemplateBindingParseResult, TemplateLiteral, TemplateLiteralElement, Text, ThisReceiver, BoundAttribute as TmplAstBoundAttribute, BoundEvent as TmplAstBoundEvent, BoundText as TmplAstBoundText, Content as TmplAstContent, Element$1 as TmplAstElement, Icu$1 as TmplAstIcu, RecursiveVisitor$1 as TmplAstRecursiveVisitor, Reference as TmplAstReference, Template as TmplAstTemplate, Text$3 as TmplAstText, TextAttribute as TmplAstTextAttribute, Variable as TmplAstVariable, Token, TokenType, TreeError, Type, TypeModifier, TypeofExpr, Unary, UnaryOperator, UnaryOperatorExpr, VERSION, VariableBinding, Version, ViewEncapsulation, WrappedNodeExpr, WriteKeyExpr, WritePropExpr, WriteVarExpr, Xliff, Xliff2, Xmb, XmlParser, Xtb, _ParseAST, compileClassMetadata, compileComponentFromMetadata, compileDeclareClassMetadata, compileDeclareComponentFromMetadata, compileDeclareDirectiveFromMetadata, compileDeclareFactoryFunction, compileDeclareInjectableFromMetadata, compileDeclareInjectorFromMetadata, compileDeclareNgModuleFromMetadata, compileDeclarePipeFromMetadata, compileDirectiveFromMetadata, compileFactoryFunction, compileInjectable, compileInjector, compileNgModule, compilePipeFromMetadata, computeMsgId, core, createInjectableType, createMayBeForwardRefExpression, devOnlyGuardedExpression, emitDistinctChangesOnlyDefaultValue, getHtmlTagDefinition, getNsPrefix, getSafePropertyAccessString, identifierName, isIdentifier, isNgContainer, isNgContent, isNgTemplate, jsDocComment, leadingComment, literalMap, makeBindingParser, mergeNsAndName, output_ast as outputAst, parseHostBindings, parseTemplate, preserveWhitespacesDefault, publishFacade, r3JitTypeSourceSpan, sanitizeIdentifier, splitNsName, verifyHostBindings, visitAll };
22775
+ export { AST, ASTWithName, ASTWithSource, AbsoluteSourceSpan, ArrayType, AstMemoryEfficientTransformer, AstTransformer, Attribute, Binary, BinaryOperator, BinaryOperatorExpr, BindingPipe, BoundElementProperty, BuiltinType, BuiltinTypeName, CUSTOM_ELEMENTS_SCHEMA, Call, Chain, ChangeDetectionStrategy, CommaExpr, Comment, CompilerConfig, Conditional, ConditionalExpr, ConstantPool, CssSelector, DEFAULT_INTERPOLATION_CONFIG, DYNAMIC_TYPE, DeclareFunctionStmt, DeclareVarStmt, DomElementSchemaRegistry, EOF, Element, ElementSchemaRegistry, EmitterVisitorContext, EmptyExpr, Expansion, ExpansionCase, Expression, ExpressionBinding, ExpressionStatement, ExpressionType, ExternalExpr, ExternalReference, FactoryTarget$1 as FactoryTarget, FunctionExpr, HtmlParser, HtmlTagDefinition, I18NHtmlParser, IfStmt, ImplicitReceiver, InstantiateExpr, Interpolation, InterpolationConfig, InvokeFunctionExpr, JSDocComment, JitEvaluator, KeyedRead, KeyedWrite, LeadingComment, Lexer, LiteralArray, LiteralArrayExpr, LiteralExpr, LiteralMap, LiteralMapExpr, LiteralPrimitive, LocalizedString, MapType, MessageBundle, NONE_TYPE, NO_ERRORS_SCHEMA, NodeWithI18n, NonNullAssert, NotExpr, ParseError, ParseErrorLevel, ParseLocation, ParseSourceFile, ParseSourceSpan, ParseSpan, ParseTreeResult, ParsedEvent, ParsedProperty, ParsedPropertyType, ParsedVariable, Parser$1 as Parser, ParserError, PrefixNot, PropertyRead, PropertyWrite, R3BoundTarget, Identifiers as R3Identifiers, R3SelectorScopeMode, R3TargetBinder, R3TemplateDependencyKind, ReadKeyExpr, ReadPropExpr, ReadVarExpr, RecursiveAstVisitor, RecursiveVisitor, ResourceLoader, ReturnStatement, STRING_TYPE, SafeCall, SafeKeyedRead, SafePropertyRead, SelectorContext, SelectorListContext, SelectorMatcher, Serializer, SplitInterpolation, Statement, StmtModifier, TagContentType, TaggedTemplateExpr, TemplateBindingParseResult, TemplateLiteral, TemplateLiteralElement, Text, ThisReceiver, BoundAttribute as TmplAstBoundAttribute, BoundEvent as TmplAstBoundEvent, BoundText as TmplAstBoundText, Content as TmplAstContent, Element$1 as TmplAstElement, Icu$1 as TmplAstIcu, RecursiveVisitor$1 as TmplAstRecursiveVisitor, Reference as TmplAstReference, Template as TmplAstTemplate, Text$3 as TmplAstText, TextAttribute as TmplAstTextAttribute, Variable as TmplAstVariable, Token, TokenType, TreeError, Type, TypeModifier, TypeofExpr, Unary, UnaryOperator, UnaryOperatorExpr, VERSION, VariableBinding, Version, ViewEncapsulation, WrappedNodeExpr, WriteKeyExpr, WritePropExpr, WriteVarExpr, Xliff, Xliff2, Xmb, XmlParser, Xtb, _ParseAST, compileClassMetadata, compileComponentFromMetadata, compileDeclareClassMetadata, compileDeclareComponentFromMetadata, compileDeclareDirectiveFromMetadata, compileDeclareFactoryFunction, compileDeclareInjectableFromMetadata, compileDeclareInjectorFromMetadata, compileDeclareNgModuleFromMetadata, compileDeclarePipeFromMetadata, compileDirectiveFromMetadata, compileFactoryFunction, compileInjectable, compileInjector, compileNgModule, compilePipeFromMetadata, computeMsgId, core, createInjectableType, createMayBeForwardRefExpression, devOnlyGuardedExpression, emitDistinctChangesOnlyDefaultValue, getHtmlTagDefinition, getNsPrefix, getSafePropertyAccessString, identifierName, isIdentifier, isNgContainer, isNgContent, isNgTemplate, jsDocComment, leadingComment, literalMap, makeBindingParser, mergeNsAndName, output_ast as outputAst, parseHostBindings, parseTemplate, preserveWhitespacesDefault, publishFacade, r3JitTypeSourceSpan, sanitizeIdentifier, splitNsName, verifyHostBindings, visitAll };
22400
22776
  //# sourceMappingURL=compiler.mjs.map