@angular/compiler 14.0.0-next.11 → 14.0.0-next.14

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 (35) hide show
  1. package/esm2020/src/compiler_facade_interface.mjs +7 -1
  2. package/esm2020/src/jit_compiler_facade.mjs +61 -25
  3. package/esm2020/src/render3/partial/api.mjs +1 -1
  4. package/esm2020/src/render3/partial/class_metadata.mjs +1 -1
  5. package/esm2020/src/render3/partial/component.mjs +27 -36
  6. package/esm2020/src/render3/partial/directive.mjs +5 -2
  7. package/esm2020/src/render3/partial/factory.mjs +1 -1
  8. package/esm2020/src/render3/partial/injectable.mjs +1 -1
  9. package/esm2020/src/render3/partial/injector.mjs +1 -1
  10. package/esm2020/src/render3/partial/ng_module.mjs +1 -1
  11. package/esm2020/src/render3/partial/pipe.mjs +5 -2
  12. package/esm2020/src/render3/r3_identifiers.mjs +2 -1
  13. package/esm2020/src/render3/r3_pipe_compiler.mjs +2 -1
  14. package/esm2020/src/render3/view/api.mjs +7 -2
  15. package/esm2020/src/render3/view/compiler.mjs +15 -15
  16. package/esm2020/src/render3/view/i18n/get_msg_utils.mjs +58 -5
  17. package/esm2020/src/render3/view/i18n/util.mjs +2 -2
  18. package/esm2020/src/render3/view/template.mjs +4 -4
  19. package/esm2020/src/render3/view/util.mjs +11 -2
  20. package/esm2020/src/version.mjs +1 -1
  21. package/fesm2015/compiler.mjs +193 -87
  22. package/fesm2015/compiler.mjs.map +1 -1
  23. package/fesm2015/testing.mjs +1 -1
  24. package/fesm2020/compiler.mjs +199 -98
  25. package/fesm2020/compiler.mjs.map +1 -1
  26. package/fesm2020/testing.mjs +1 -1
  27. package/package.json +2 -2
  28. package/src/compiler_facade_interface.d.ts +26 -11
  29. package/src/render3/partial/api.d.ts +25 -3
  30. package/src/render3/partial/component.d.ts +3 -3
  31. package/src/render3/r3_identifiers.d.ts +1 -0
  32. package/src/render3/view/api.d.ts +30 -16
  33. package/src/render3/view/compiler.d.ts +4 -4
  34. package/src/render3/view/i18n/get_msg_utils.d.ts +35 -1
  35. package/src/render3/view/i18n/util.d.ts +1 -1
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v14.0.0-next.11
2
+ * @license Angular v14.0.0-next.14
3
3
  * (c) 2010-2022 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -2924,6 +2924,7 @@ Identifiers.contentQuery = { name: 'ɵɵcontentQuery', moduleName: CORE };
2924
2924
  Identifiers.NgOnChangesFeature = { name: 'ɵɵNgOnChangesFeature', moduleName: CORE };
2925
2925
  Identifiers.InheritDefinitionFeature = { name: 'ɵɵInheritDefinitionFeature', moduleName: CORE };
2926
2926
  Identifiers.CopyDefinitionFeature = { name: 'ɵɵCopyDefinitionFeature', moduleName: CORE };
2927
+ Identifiers.StandaloneFeature = { name: 'ɵɵStandaloneFeature', moduleName: CORE };
2927
2928
  Identifiers.ProvidersFeature = { name: 'ɵɵProvidersFeature', moduleName: CORE };
2928
2929
  Identifiers.listener = { name: 'ɵɵlistener', moduleName: CORE };
2929
2930
  Identifiers.getInheritedFactory = {
@@ -4795,7 +4796,7 @@ function assembleBoundTextPlaceholders(meta, bindingStartIndex = 0, contextId =
4795
4796
  * @param useCamelCase whether to camelCase the placeholder name when formatting.
4796
4797
  * @returns A new map of formatted placeholder names to expressions.
4797
4798
  */
4798
- function i18nFormatPlaceholderNames(params = {}, useCamelCase) {
4799
+ function formatI18nPlaceholderNamesInMap(params = {}, useCamelCase) {
4799
4800
  const _params = {};
4800
4801
  if (params && Object.keys(params).length) {
4801
4802
  Object.keys(params).forEach(key => _params[formatI18nPlaceholderName(key, useCamelCase)] = params[key]);
@@ -4878,6 +4879,12 @@ const IMPLICIT_REFERENCE = '$implicit';
4878
4879
  const NON_BINDABLE_ATTR = 'ngNonBindable';
4879
4880
  /** Name for the variable keeping track of the context returned by `ɵɵrestoreView`. */
4880
4881
  const RESTORED_VIEW_CONTEXT_NAME = 'restoredCtx';
4882
+ /**
4883
+ * Maximum length of a single instruction chain. Because our output AST uses recursion, we're
4884
+ * limited in how many expressions we can nest before we reach the call stack limit. This
4885
+ * length is set very conservatively in order to reduce the chance of problems.
4886
+ */
4887
+ const MAX_CHAIN_LENGTH = 500;
4881
4888
  /** Instructions that support chaining. */
4882
4889
  const CHAINABLE_INSTRUCTIONS = new Set([
4883
4890
  Identifiers.element,
@@ -5104,15 +5111,17 @@ function getInstructionStatements(instructions) {
5104
5111
  const statements = [];
5105
5112
  let pendingExpression = null;
5106
5113
  let pendingExpressionType = null;
5114
+ let chainLength = 0;
5107
5115
  for (const current of instructions) {
5108
5116
  const resolvedParams = (_a = (typeof current.paramsOrFn === 'function' ? current.paramsOrFn() : current.paramsOrFn)) !== null && _a !== void 0 ? _a : [];
5109
5117
  const params = Array.isArray(resolvedParams) ? resolvedParams : [resolvedParams];
5110
5118
  // If the current instruction is the same as the previous one
5111
5119
  // and it can be chained, add another call to the chain.
5112
- if (pendingExpressionType === current.reference &&
5120
+ if (chainLength < MAX_CHAIN_LENGTH && pendingExpressionType === current.reference &&
5113
5121
  CHAINABLE_INSTRUCTIONS.has(pendingExpressionType)) {
5114
5122
  // We'll always have a pending expression when there's a pending expression type.
5115
5123
  pendingExpression = pendingExpression.callFn(params, pendingExpression.sourceSpan);
5124
+ chainLength++;
5116
5125
  }
5117
5126
  else {
5118
5127
  if (pendingExpression !== null) {
@@ -5120,6 +5129,7 @@ function getInstructionStatements(instructions) {
5120
5129
  }
5121
5130
  pendingExpression = invokeInstruction(current.span, current.reference, params);
5122
5131
  pendingExpressionType = current.reference;
5132
+ chainLength = 0;
5123
5133
  }
5124
5134
  }
5125
5135
  // Since the current instruction adds the previous one to the statements,
@@ -6153,9 +6163,24 @@ function createPipeType(metadata) {
6153
6163
  return new ExpressionType(importExpr(Identifiers.PipeDeclaration, [
6154
6164
  typeWithParameters(metadata.type.type, metadata.typeArgumentCount),
6155
6165
  new ExpressionType(new LiteralExpr(metadata.pipeName)),
6166
+ new ExpressionType(new LiteralExpr(metadata.isStandalone)),
6156
6167
  ]));
6157
6168
  }
6158
6169
 
6170
+ /**
6171
+ * @license
6172
+ * Copyright Google LLC All Rights Reserved.
6173
+ *
6174
+ * Use of this source code is governed by an MIT-style license that can be
6175
+ * found in the LICENSE file at https://angular.io/license
6176
+ */
6177
+ var R3TemplateDependencyKind;
6178
+ (function (R3TemplateDependencyKind) {
6179
+ R3TemplateDependencyKind[R3TemplateDependencyKind["Directive"] = 0] = "Directive";
6180
+ R3TemplateDependencyKind[R3TemplateDependencyKind["Pipe"] = 1] = "Pipe";
6181
+ R3TemplateDependencyKind[R3TemplateDependencyKind["NgModule"] = 2] = "NgModule";
6182
+ })(R3TemplateDependencyKind || (R3TemplateDependencyKind = {}));
6183
+
6159
6184
  /**
6160
6185
  * @license
6161
6186
  * Copyright Google LLC All Rights Reserved.
@@ -16763,11 +16788,64 @@ function i18nMetaToJSDoc(meta) {
16763
16788
 
16764
16789
  /** Closure uses `goog.getMsg(message)` to lookup translations */
16765
16790
  const GOOG_GET_MSG = 'goog.getMsg';
16766
- function createGoogleGetMsgStatements(variable$1, message, closureVar, params) {
16791
+ /**
16792
+ * Generates a `goog.getMsg()` statement and reassignment. The template:
16793
+ *
16794
+ * ```html
16795
+ * <div i18n>Sent from {{ sender }} to <span class="receiver">{{ receiver }}</span></div>
16796
+ * ```
16797
+ *
16798
+ * Generates:
16799
+ *
16800
+ * ```typescript
16801
+ * const MSG_FOO = goog.getMsg(
16802
+ * // Message template.
16803
+ * 'Sent from {$interpolation} to {$startTagSpan}{$interpolation_1}{$closeTagSpan}.',
16804
+ * // Placeholder values, set to magic strings which get replaced by the Angular runtime.
16805
+ * {
16806
+ * 'interpolation': '\uFFFD0\uFFFD',
16807
+ * 'startTagSpan': '\uFFFD1\uFFFD',
16808
+ * 'interpolation_1': '\uFFFD2\uFFFD',
16809
+ * 'closeTagSpan': '\uFFFD3\uFFFD',
16810
+ * },
16811
+ * // Options bag.
16812
+ * {
16813
+ * // Maps each placeholder to the original Angular source code which generates it's value.
16814
+ * original_code: {
16815
+ * 'interpolation': '{{ sender }}',
16816
+ * 'startTagSpan': '<span class="receiver">',
16817
+ * 'interploation_1': '{{ receiver }}',
16818
+ * 'closeTagSpan': '</span>',
16819
+ * },
16820
+ * },
16821
+ * );
16822
+ * const I18N_0 = MSG_FOO;
16823
+ * ```
16824
+ */
16825
+ function createGoogleGetMsgStatements(variable$1, message, closureVar, placeholderValues) {
16767
16826
  const messageString = serializeI18nMessageForGetMsg(message);
16768
16827
  const args = [literal(messageString)];
16769
- if (Object.keys(params).length) {
16770
- args.push(mapLiteral(params, true));
16828
+ if (Object.keys(placeholderValues).length) {
16829
+ // Message template parameters containing the magic strings replaced by the Angular runtime with
16830
+ // real data, e.g. `{'interpolation': '\uFFFD0\uFFFD'}`.
16831
+ args.push(mapLiteral(formatI18nPlaceholderNamesInMap(placeholderValues, true /* useCamelCase */), true /* quoted */));
16832
+ // Message options object, which contains original source code for placeholders (as they are
16833
+ // present in a template, e.g.
16834
+ // `{original_code: {'interpolation': '{{ name }}', 'startTagSpan': '<span>'}}`.
16835
+ args.push(mapLiteral({
16836
+ original_code: literalMap(Object.keys(placeholderValues)
16837
+ .map((param) => ({
16838
+ key: formatI18nPlaceholderName(param),
16839
+ quoted: true,
16840
+ value: message.placeholders[param] ?
16841
+ // Get source span for typical placeholder if it exists.
16842
+ literal(message.placeholders[param].sourceSpan.toString()) :
16843
+ // Otherwise must be an ICU expression, get it's source span.
16844
+ literal(message.placeholderToMessage[param]
16845
+ .nodes.map((node) => node.sourceSpan.toString())
16846
+ .join('')),
16847
+ }))),
16848
+ }));
16771
16849
  }
16772
16850
  // /**
16773
16851
  // * @desc description of message
@@ -17721,7 +17799,7 @@ class TemplateDefinitionBuilder {
17721
17799
  // - all ICU vars (such as `VAR_SELECT` or `VAR_PLURAL`) are replaced with correct values
17722
17800
  const transformFn = (raw) => {
17723
17801
  const params = Object.assign(Object.assign({}, vars), placeholders);
17724
- const formatted = i18nFormatPlaceholderNames(params, /* useCamelCase */ false);
17802
+ const formatted = formatI18nPlaceholderNamesInMap(params, /* useCamelCase */ false);
17725
17803
  return invokeInstruction(null, Identifiers.i18nPostprocess, [raw, mapLiteral(formatted, true)]);
17726
17804
  };
17727
17805
  // in case the whole i18n message is a single ICU - we do not need to
@@ -18642,7 +18720,7 @@ const NG_I18N_CLOSURE_MODE = 'ngI18nClosureMode';
18642
18720
  function getTranslationDeclStmts(message, variable, closureVar, params = {}, transformFn) {
18643
18721
  const statements = [
18644
18722
  declareI18nVariable(variable),
18645
- ifStmt(createClosureModeGuard(), createGoogleGetMsgStatements(variable, message, closureVar, i18nFormatPlaceholderNames(params, /* useCamelCase */ true)), createLocalizeStatements(variable, message, i18nFormatPlaceholderNames(params, /* useCamelCase */ false))),
18723
+ ifStmt(createClosureModeGuard(), createGoogleGetMsgStatements(variable, message, closureVar, params), createLocalizeStatements(variable, message, formatI18nPlaceholderNamesInMap(params, /* useCamelCase */ false))),
18646
18724
  ];
18647
18725
  if (transformFn) {
18648
18726
  statements.push(new ExpressionStatement(variable.set(transformFn(variable))));
@@ -18736,6 +18814,10 @@ function addFeatures(definitionMap, meta) {
18736
18814
  if (meta.lifecycle.usesOnChanges) {
18737
18815
  features.push(importExpr(Identifiers.NgOnChangesFeature));
18738
18816
  }
18817
+ // TODO: better way of differentiating component vs directive metadata.
18818
+ if (meta.hasOwnProperty('template') && meta.isStandalone) {
18819
+ features.push(importExpr(Identifiers.StandaloneFeature));
18820
+ }
18739
18821
  if (features.length) {
18740
18822
  definitionMap.set('features', literalArr(features));
18741
18823
  }
@@ -18799,17 +18881,8 @@ function compileComponentFromMetadata(meta, constantPool, bindingParser) {
18799
18881
  definitionMap.set('consts', constsExpr);
18800
18882
  }
18801
18883
  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);
18884
+ if (meta.declarations.length > 0) {
18885
+ definitionMap.set('dependencies', compileDeclarationList(literalArr(meta.declarations.map(decl => decl.type)), meta.declarationListEmitMode));
18813
18886
  }
18814
18887
  if (meta.encapsulation === null) {
18815
18888
  meta.encapsulation = ViewEncapsulation.Emulated;
@@ -18847,8 +18920,9 @@ function compileComponentFromMetadata(meta, constantPool, bindingParser) {
18847
18920
  * to be consumed by upstream compilations.
18848
18921
  */
18849
18922
  function createComponentType(meta) {
18850
- const typeParams = createDirectiveTypeParams(meta);
18923
+ const typeParams = createBaseDirectiveTypeParams(meta);
18851
18924
  typeParams.push(stringArrayAsType(meta.template.ngContentSelectors));
18925
+ typeParams.push(expressionType(literal(meta.isStandalone)));
18852
18926
  return expressionType(importExpr(Identifiers.ComponentDeclaration, typeParams));
18853
18927
  }
18854
18928
  /**
@@ -18939,7 +19013,7 @@ function stringArrayAsType(arr) {
18939
19013
  return arr.length > 0 ? expressionType(literalArr(arr.map(value => literal(value)))) :
18940
19014
  NONE_TYPE;
18941
19015
  }
18942
- function createDirectiveTypeParams(meta) {
19016
+ function createBaseDirectiveTypeParams(meta) {
18943
19017
  // On the type side, remove newlines from the selector as it will need to fit into a TypeScript
18944
19018
  // string literal, which must be on one line.
18945
19019
  const selectorForType = meta.selector !== null ? meta.selector.replace(/\n/g, '') : null;
@@ -18957,7 +19031,11 @@ function createDirectiveTypeParams(meta) {
18957
19031
  * to be consumed by upstream compilations.
18958
19032
  */
18959
19033
  function createDirectiveType(meta) {
18960
- const typeParams = createDirectiveTypeParams(meta);
19034
+ const typeParams = createBaseDirectiveTypeParams(meta);
19035
+ // Directives have no NgContentSelectors slot, but instead express a `never` type
19036
+ // so that future fields align.
19037
+ typeParams.push(NONE_TYPE);
19038
+ typeParams.push(expressionType(literal(meta.isStandalone)));
18961
19039
  return expressionType(importExpr(Identifiers.DirectiveDeclaration, typeParams));
18962
19040
  }
18963
19041
  // Define and update any view queries
@@ -19402,7 +19480,7 @@ class CompilerFacadeImpl {
19402
19480
  // Parse the template and check for errors.
19403
19481
  const { template, interpolation } = parseJitTemplate(facade.template, facade.name, sourceMapUrl, facade.preserveWhitespaces, facade.interpolation);
19404
19482
  // Compile the component metadata, including template, into an expression.
19405
- const meta = Object.assign(Object.assign(Object.assign({}, facade), convertDirectiveFacadeToMetadata(facade)), { selector: facade.selector || this.elementSchemaRegistry.getDefaultComponentElementName(), template, declarationListEmitMode: 0 /* Direct */, styles: [...facade.styles, ...template.styles], encapsulation: facade.encapsulation, interpolation, changeDetection: facade.changeDetection, animations: facade.animations != null ? new WrappedNodeExpr(facade.animations) : null, viewProviders: facade.viewProviders != null ? new WrappedNodeExpr(facade.viewProviders) :
19483
+ const meta = Object.assign(Object.assign(Object.assign({}, facade), convertDirectiveFacadeToMetadata(facade)), { selector: facade.selector || this.elementSchemaRegistry.getDefaultComponentElementName(), template, declarations: facade.declarations.map(convertDeclarationFacadeToMetadata), declarationListEmitMode: 0 /* Direct */, styles: [...facade.styles, ...template.styles], encapsulation: facade.encapsulation, interpolation, changeDetection: facade.changeDetection, animations: facade.animations != null ? new WrappedNodeExpr(facade.animations) : null, viewProviders: facade.viewProviders != null ? new WrappedNodeExpr(facade.viewProviders) :
19406
19484
  null, relativeContextFilePath: '', i18nUseExternalIds: true });
19407
19485
  const jitExpressionSourceMap = `ng:///${facade.name}.js`;
19408
19486
  return this.compileComponentFromMeta(angularCoreEnv, jitExpressionSourceMap, meta);
@@ -19555,19 +19633,43 @@ function convertOpaqueValuesToExpressions(obj) {
19555
19633
  }
19556
19634
  return result;
19557
19635
  }
19558
- function convertDeclareComponentFacadeToMetadata(declaration, typeSourceSpan, sourceMapUrl) {
19559
- var _a, _b, _c, _d, _e, _f;
19560
- const { template, interpolation } = parseJitTemplate(declaration.template, declaration.type.name, sourceMapUrl, (_a = declaration.preserveWhitespaces) !== null && _a !== void 0 ? _a : false, declaration.interpolation);
19561
- return Object.assign(Object.assign({}, convertDeclareDirectiveFacadeToMetadata(declaration, typeSourceSpan)), { template, styles: (_b = declaration.styles) !== null && _b !== void 0 ? _b : [], directives: ((_c = declaration.components) !== null && _c !== void 0 ? _c : [])
19562
- .concat((_d = declaration.directives) !== null && _d !== void 0 ? _d : [])
19563
- .map(convertUsedDirectiveDeclarationToMetadata), pipes: convertUsedPipesToMetadata(declaration.pipes), viewProviders: declaration.viewProviders !== undefined ?
19564
- new WrappedNodeExpr(declaration.viewProviders) :
19565
- null, animations: declaration.animations !== undefined ? new WrappedNodeExpr(declaration.animations) :
19566
- null, changeDetection: (_e = declaration.changeDetection) !== null && _e !== void 0 ? _e : ChangeDetectionStrategy.Default, encapsulation: (_f = declaration.encapsulation) !== null && _f !== void 0 ? _f : ViewEncapsulation.Emulated, interpolation, declarationListEmitMode: 2 /* ClosureResolved */, relativeContextFilePath: '', i18nUseExternalIds: true });
19567
- }
19568
- function convertUsedDirectiveDeclarationToMetadata(declaration) {
19636
+ function convertDeclareComponentFacadeToMetadata(decl, typeSourceSpan, sourceMapUrl) {
19637
+ var _a, _b, _c, _d;
19638
+ const { template, interpolation } = parseJitTemplate(decl.template, decl.type.name, sourceMapUrl, (_a = decl.preserveWhitespaces) !== null && _a !== void 0 ? _a : false, decl.interpolation);
19639
+ const declarations = [];
19640
+ if (decl.dependencies) {
19641
+ for (const innerDep of decl.dependencies) {
19642
+ switch (innerDep.kind) {
19643
+ case 'directive':
19644
+ case 'component':
19645
+ declarations.push(convertDirectiveDeclarationToMetadata(innerDep));
19646
+ break;
19647
+ case 'pipe':
19648
+ declarations.push(convertPipeDeclarationToMetadata(innerDep));
19649
+ break;
19650
+ }
19651
+ }
19652
+ }
19653
+ else if (decl.components || decl.directives || decl.pipes) {
19654
+ // Existing declarations on NPM may not be using the new `dependencies` merged field, and may
19655
+ // have separate fields for dependencies instead. Unify them for JIT compilation.
19656
+ decl.components &&
19657
+ declarations.push(...decl.components.map(dir => convertDirectiveDeclarationToMetadata(dir, /* isComponent */ true)));
19658
+ decl.directives &&
19659
+ declarations.push(...decl.directives.map(dir => convertDirectiveDeclarationToMetadata(dir)));
19660
+ decl.pipes && declarations.push(...convertPipeMapToMetadata(decl.pipes));
19661
+ }
19662
+ return Object.assign(Object.assign({}, convertDeclareDirectiveFacadeToMetadata(decl, typeSourceSpan)), { template, styles: (_b = decl.styles) !== null && _b !== void 0 ? _b : [], declarations, viewProviders: decl.viewProviders !== undefined ? new WrappedNodeExpr(decl.viewProviders) :
19663
+ null, animations: decl.animations !== undefined ? new WrappedNodeExpr(decl.animations) : null, changeDetection: (_c = decl.changeDetection) !== null && _c !== void 0 ? _c : ChangeDetectionStrategy.Default, encapsulation: (_d = decl.encapsulation) !== null && _d !== void 0 ? _d : ViewEncapsulation.Emulated, interpolation, declarationListEmitMode: 2 /* ClosureResolved */, relativeContextFilePath: '', i18nUseExternalIds: true });
19664
+ }
19665
+ function convertDeclarationFacadeToMetadata(declaration) {
19666
+ return Object.assign(Object.assign({}, declaration), { type: new WrappedNodeExpr(declaration.type) });
19667
+ }
19668
+ function convertDirectiveDeclarationToMetadata(declaration, isComponent = null) {
19569
19669
  var _a, _b, _c;
19570
19670
  return {
19671
+ kind: R3TemplateDependencyKind.Directive,
19672
+ isComponent: isComponent || declaration.kind === 'component',
19571
19673
  selector: declaration.selector,
19572
19674
  type: new WrappedNodeExpr(declaration.type),
19573
19675
  inputs: (_a = declaration.inputs) !== null && _a !== void 0 ? _a : [],
@@ -19575,16 +19677,24 @@ function convertUsedDirectiveDeclarationToMetadata(declaration) {
19575
19677
  exportAs: (_c = declaration.exportAs) !== null && _c !== void 0 ? _c : null,
19576
19678
  };
19577
19679
  }
19578
- function convertUsedPipesToMetadata(declaredPipes) {
19579
- const pipes = new Map();
19580
- if (declaredPipes === undefined) {
19581
- return pipes;
19582
- }
19583
- for (const pipeName of Object.keys(declaredPipes)) {
19584
- const pipeType = declaredPipes[pipeName];
19585
- pipes.set(pipeName, new WrappedNodeExpr(pipeType));
19680
+ function convertPipeMapToMetadata(pipes) {
19681
+ if (!pipes) {
19682
+ return [];
19586
19683
  }
19587
- return pipes;
19684
+ return Object.keys(pipes).map(name => {
19685
+ return {
19686
+ kind: R3TemplateDependencyKind.Pipe,
19687
+ name,
19688
+ type: new WrappedNodeExpr(pipes[name]),
19689
+ };
19690
+ });
19691
+ }
19692
+ function convertPipeDeclarationToMetadata(pipe) {
19693
+ return {
19694
+ kind: R3TemplateDependencyKind.Pipe,
19695
+ name: pipe.name,
19696
+ type: new WrappedNodeExpr(pipe.type),
19697
+ };
19588
19698
  }
19589
19699
  function parseJitTemplate(template, typeName, sourceMapUrl, preserveWhitespaces, interpolation) {
19590
19700
  const interpolationConfig = interpolation ? InterpolationConfig.fromArray(interpolation) : DEFAULT_INTERPOLATION_CONFIG;
@@ -19733,7 +19843,7 @@ function publishFacade(global) {
19733
19843
  * Use of this source code is governed by an MIT-style license that can be
19734
19844
  * found in the LICENSE file at https://angular.io/license
19735
19845
  */
19736
- const VERSION = new Version('14.0.0-next.11');
19846
+ const VERSION = new Version('14.0.0-next.14');
19737
19847
 
19738
19848
  /**
19739
19849
  * @license
@@ -21760,7 +21870,7 @@ const MINIMUM_PARTIAL_LINKER_VERSION$6 = '12.0.0';
21760
21870
  function compileDeclareClassMetadata(metadata) {
21761
21871
  const definitionMap = new DefinitionMap();
21762
21872
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$6));
21763
- definitionMap.set('version', literal('14.0.0-next.11'));
21873
+ definitionMap.set('version', literal('14.0.0-next.14'));
21764
21874
  definitionMap.set('ngImport', importExpr(Identifiers.core));
21765
21875
  definitionMap.set('type', metadata.type);
21766
21876
  definitionMap.set('decorators', metadata.decorators);
@@ -21877,9 +21987,12 @@ function compileDeclareDirectiveFromMetadata(meta) {
21877
21987
  function createDirectiveDefinitionMap(meta) {
21878
21988
  const definitionMap = new DefinitionMap();
21879
21989
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$5));
21880
- definitionMap.set('version', literal('14.0.0-next.11'));
21990
+ definitionMap.set('version', literal('14.0.0-next.14'));
21881
21991
  // e.g. `type: MyDirective`
21882
21992
  definitionMap.set('type', meta.internalType);
21993
+ if (meta.isStandalone) {
21994
+ definitionMap.set('isStandalone', literal(meta.isStandalone));
21995
+ }
21883
21996
  // e.g. `selector: 'some-dir'`
21884
21997
  if (meta.selector !== null) {
21885
21998
  definitionMap.set('selector', literal(meta.selector));
@@ -21984,9 +22097,7 @@ function createComponentDefinitionMap(meta, template, templateInfo) {
21984
22097
  definitionMap.set('isInline', literal(true));
21985
22098
  }
21986
22099
  definitionMap.set('styles', toOptionalLiteralArray(meta.styles, literal));
21987
- definitionMap.set('components', compileUsedDirectiveMetadata(meta, directive => directive.isComponent === true));
21988
- definitionMap.set('directives', compileUsedDirectiveMetadata(meta, directive => directive.isComponent !== true));
21989
- definitionMap.set('pipes', compileUsedPipeMetadata(meta));
22100
+ definitionMap.set('dependencies', compileUsedDependenciesMetadata(meta));
21990
22101
  definitionMap.set('viewProviders', meta.viewProviders);
21991
22102
  definitionMap.set('animations', meta.animations);
21992
22103
  if (meta.changeDetection !== undefined) {
@@ -22042,43 +22153,35 @@ function computeEndLocation(file, contents) {
22042
22153
  } while (lineStart !== -1);
22043
22154
  return new ParseLocation(file, length, line, length - lastLineStart);
22044
22155
  }
22045
- /**
22046
- * Compiles the directives as registered in the component metadata into an array literal of the
22047
- * individual directives. If the component does not use any directives, then null is returned.
22048
- */
22049
- function compileUsedDirectiveMetadata(meta, predicate) {
22156
+ function compileUsedDependenciesMetadata(meta) {
22050
22157
  const wrapType = meta.declarationListEmitMode !== 0 /* Direct */ ?
22051
22158
  generateForwardRef :
22052
22159
  (expr) => expr;
22053
- const directives = meta.directives.filter(predicate);
22054
- return toOptionalLiteralArray(directives, directive => {
22055
- const dirMeta = new DefinitionMap();
22056
- dirMeta.set('type', wrapType(directive.type));
22057
- dirMeta.set('selector', literal(directive.selector));
22058
- dirMeta.set('inputs', toOptionalLiteralArray(directive.inputs, literal));
22059
- dirMeta.set('outputs', toOptionalLiteralArray(directive.outputs, literal));
22060
- dirMeta.set('exportAs', toOptionalLiteralArray(directive.exportAs, literal));
22061
- return dirMeta.toLiteralMap();
22160
+ return toOptionalLiteralArray(meta.declarations, decl => {
22161
+ switch (decl.kind) {
22162
+ case R3TemplateDependencyKind.Directive:
22163
+ const dirMeta = new DefinitionMap();
22164
+ dirMeta.set('kind', literal(decl.isComponent ? 'component' : 'directive'));
22165
+ dirMeta.set('type', wrapType(decl.type));
22166
+ dirMeta.set('selector', literal(decl.selector));
22167
+ dirMeta.set('inputs', toOptionalLiteralArray(decl.inputs, literal));
22168
+ dirMeta.set('outputs', toOptionalLiteralArray(decl.outputs, literal));
22169
+ dirMeta.set('exportAs', toOptionalLiteralArray(decl.exportAs, literal));
22170
+ return dirMeta.toLiteralMap();
22171
+ case R3TemplateDependencyKind.Pipe:
22172
+ const pipeMeta = new DefinitionMap();
22173
+ pipeMeta.set('kind', literal('pipe'));
22174
+ pipeMeta.set('type', wrapType(decl.type));
22175
+ pipeMeta.set('name', literal(decl.name));
22176
+ return pipeMeta.toLiteralMap();
22177
+ case R3TemplateDependencyKind.NgModule:
22178
+ const ngModuleMeta = new DefinitionMap();
22179
+ ngModuleMeta.set('kind', literal('ngmodule'));
22180
+ ngModuleMeta.set('type', wrapType(decl.type));
22181
+ return ngModuleMeta.toLiteralMap();
22182
+ }
22062
22183
  });
22063
22184
  }
22064
- /**
22065
- * Compiles the pipes as registered in the component metadata into an object literal, where the
22066
- * pipe's name is used as key and a reference to its type as value. If the component does not use
22067
- * any pipes, then null is returned.
22068
- */
22069
- function compileUsedPipeMetadata(meta) {
22070
- if (meta.pipes.size === 0) {
22071
- return null;
22072
- }
22073
- const wrapType = meta.declarationListEmitMode !== 0 /* Direct */ ?
22074
- generateForwardRef :
22075
- (expr) => expr;
22076
- const entries = [];
22077
- for (const [name, pipe] of meta.pipes) {
22078
- entries.push({ key: name, value: wrapType(pipe), quoted: true });
22079
- }
22080
- return literalMap(entries);
22081
- }
22082
22185
 
22083
22186
  /**
22084
22187
  * @license
@@ -22098,7 +22201,7 @@ const MINIMUM_PARTIAL_LINKER_VERSION$4 = '12.0.0';
22098
22201
  function compileDeclareFactoryFunction(meta) {
22099
22202
  const definitionMap = new DefinitionMap();
22100
22203
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$4));
22101
- definitionMap.set('version', literal('14.0.0-next.11'));
22204
+ definitionMap.set('version', literal('14.0.0-next.14'));
22102
22205
  definitionMap.set('ngImport', importExpr(Identifiers.core));
22103
22206
  definitionMap.set('type', meta.internalType);
22104
22207
  definitionMap.set('deps', compileDependencies(meta.deps));
@@ -22140,7 +22243,7 @@ function compileDeclareInjectableFromMetadata(meta) {
22140
22243
  function createInjectableDefinitionMap(meta) {
22141
22244
  const definitionMap = new DefinitionMap();
22142
22245
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$3));
22143
- definitionMap.set('version', literal('14.0.0-next.11'));
22246
+ definitionMap.set('version', literal('14.0.0-next.14'));
22144
22247
  definitionMap.set('ngImport', importExpr(Identifiers.core));
22145
22248
  definitionMap.set('type', meta.internalType);
22146
22249
  // Only generate providedIn property if it has a non-null value
@@ -22198,7 +22301,7 @@ function compileDeclareInjectorFromMetadata(meta) {
22198
22301
  function createInjectorDefinitionMap(meta) {
22199
22302
  const definitionMap = new DefinitionMap();
22200
22303
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$2));
22201
- definitionMap.set('version', literal('14.0.0-next.11'));
22304
+ definitionMap.set('version', literal('14.0.0-next.14'));
22202
22305
  definitionMap.set('ngImport', importExpr(Identifiers.core));
22203
22306
  definitionMap.set('type', meta.internalType);
22204
22307
  definitionMap.set('providers', meta.providers);
@@ -22235,7 +22338,7 @@ function compileDeclareNgModuleFromMetadata(meta) {
22235
22338
  function createNgModuleDefinitionMap(meta) {
22236
22339
  const definitionMap = new DefinitionMap();
22237
22340
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$1));
22238
- definitionMap.set('version', literal('14.0.0-next.11'));
22341
+ definitionMap.set('version', literal('14.0.0-next.14'));
22239
22342
  definitionMap.set('ngImport', importExpr(Identifiers.core));
22240
22343
  definitionMap.set('type', meta.internalType);
22241
22344
  // We only generate the keys in the metadata if the arrays contain values.
@@ -22293,10 +22396,13 @@ function compileDeclarePipeFromMetadata(meta) {
22293
22396
  function createPipeDefinitionMap(meta) {
22294
22397
  const definitionMap = new DefinitionMap();
22295
22398
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION));
22296
- definitionMap.set('version', literal('14.0.0-next.11'));
22399
+ definitionMap.set('version', literal('14.0.0-next.14'));
22297
22400
  definitionMap.set('ngImport', importExpr(Identifiers.core));
22298
22401
  // e.g. `type: MyPipe`
22299
22402
  definitionMap.set('type', meta.internalType);
22403
+ if (meta.isStandalone) {
22404
+ definitionMap.set('isStandalone', literal(meta.isStandalone));
22405
+ }
22300
22406
  // e.g. `name: "myPipe"`
22301
22407
  definitionMap.set('name', literal(meta.pipeName));
22302
22408
  if (meta.pure === false) {
@@ -22343,5 +22449,5 @@ publishFacade(_global);
22343
22449
  * found in the LICENSE file at https://angular.io/license
22344
22450
  */
22345
22451
 
22346
- 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 };
22452
+ 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 };
22347
22453
  //# sourceMappingURL=compiler.mjs.map