@angular/compiler 14.0.0-next.13 → 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.
- package/esm2020/src/compiler_facade_interface.mjs +7 -1
- package/esm2020/src/jit_compiler_facade.mjs +61 -25
- package/esm2020/src/render3/partial/api.mjs +1 -1
- package/esm2020/src/render3/partial/class_metadata.mjs +1 -1
- package/esm2020/src/render3/partial/component.mjs +27 -36
- package/esm2020/src/render3/partial/directive.mjs +5 -2
- package/esm2020/src/render3/partial/factory.mjs +1 -1
- package/esm2020/src/render3/partial/injectable.mjs +1 -1
- package/esm2020/src/render3/partial/injector.mjs +1 -1
- package/esm2020/src/render3/partial/ng_module.mjs +1 -1
- package/esm2020/src/render3/partial/pipe.mjs +5 -2
- package/esm2020/src/render3/r3_identifiers.mjs +2 -1
- package/esm2020/src/render3/r3_pipe_compiler.mjs +2 -1
- package/esm2020/src/render3/view/api.mjs +7 -2
- package/esm2020/src/render3/view/compiler.mjs +15 -15
- package/esm2020/src/render3/view/i18n/get_msg_utils.mjs +58 -5
- package/esm2020/src/render3/view/i18n/util.mjs +2 -2
- package/esm2020/src/render3/view/template.mjs +4 -4
- package/esm2020/src/version.mjs +1 -1
- package/fesm2015/compiler.mjs +183 -86
- package/fesm2015/compiler.mjs.map +1 -1
- package/fesm2015/testing.mjs +1 -1
- package/fesm2020/compiler.mjs +189 -97
- package/fesm2020/compiler.mjs.map +1 -1
- package/fesm2020/testing.mjs +1 -1
- package/package.json +2 -2
- package/src/compiler_facade_interface.d.ts +26 -11
- package/src/render3/partial/api.d.ts +25 -3
- package/src/render3/partial/component.d.ts +3 -3
- package/src/render3/r3_identifiers.d.ts +1 -0
- package/src/render3/view/api.d.ts +30 -16
- package/src/render3/view/compiler.d.ts +4 -4
- package/src/render3/view/i18n/get_msg_utils.d.ts +35 -1
- package/src/render3/view/i18n/util.d.ts +1 -1
package/fesm2015/testing.mjs
CHANGED
package/fesm2020/compiler.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular v14.0.0-next.
|
|
2
|
+
* @license Angular v14.0.0-next.14
|
|
3
3
|
* (c) 2010-2022 Google LLC. https://angular.io/
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
@@ -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
|
|
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]);
|
|
@@ -6173,9 +6174,24 @@ function createPipeType(metadata) {
|
|
|
6173
6174
|
return new ExpressionType(importExpr(Identifiers.PipeDeclaration, [
|
|
6174
6175
|
typeWithParameters(metadata.type.type, metadata.typeArgumentCount),
|
|
6175
6176
|
new ExpressionType(new LiteralExpr(metadata.pipeName)),
|
|
6177
|
+
new ExpressionType(new LiteralExpr(metadata.isStandalone)),
|
|
6176
6178
|
]));
|
|
6177
6179
|
}
|
|
6178
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
|
+
|
|
6179
6195
|
/**
|
|
6180
6196
|
* @license
|
|
6181
6197
|
* Copyright Google LLC All Rights Reserved.
|
|
@@ -16775,11 +16791,64 @@ function i18nMetaToJSDoc(meta) {
|
|
|
16775
16791
|
|
|
16776
16792
|
/** Closure uses `goog.getMsg(message)` to lookup translations */
|
|
16777
16793
|
const GOOG_GET_MSG = 'goog.getMsg';
|
|
16778
|
-
|
|
16794
|
+
/**
|
|
16795
|
+
* Generates a `goog.getMsg()` statement and reassignment. The template:
|
|
16796
|
+
*
|
|
16797
|
+
* ```html
|
|
16798
|
+
* <div i18n>Sent from {{ sender }} to <span class="receiver">{{ receiver }}</span></div>
|
|
16799
|
+
* ```
|
|
16800
|
+
*
|
|
16801
|
+
* Generates:
|
|
16802
|
+
*
|
|
16803
|
+
* ```typescript
|
|
16804
|
+
* const MSG_FOO = goog.getMsg(
|
|
16805
|
+
* // Message template.
|
|
16806
|
+
* 'Sent from {$interpolation} to {$startTagSpan}{$interpolation_1}{$closeTagSpan}.',
|
|
16807
|
+
* // Placeholder values, set to magic strings which get replaced by the Angular runtime.
|
|
16808
|
+
* {
|
|
16809
|
+
* 'interpolation': '\uFFFD0\uFFFD',
|
|
16810
|
+
* 'startTagSpan': '\uFFFD1\uFFFD',
|
|
16811
|
+
* 'interpolation_1': '\uFFFD2\uFFFD',
|
|
16812
|
+
* 'closeTagSpan': '\uFFFD3\uFFFD',
|
|
16813
|
+
* },
|
|
16814
|
+
* // Options bag.
|
|
16815
|
+
* {
|
|
16816
|
+
* // Maps each placeholder to the original Angular source code which generates it's value.
|
|
16817
|
+
* original_code: {
|
|
16818
|
+
* 'interpolation': '{{ sender }}',
|
|
16819
|
+
* 'startTagSpan': '<span class="receiver">',
|
|
16820
|
+
* 'interploation_1': '{{ receiver }}',
|
|
16821
|
+
* 'closeTagSpan': '</span>',
|
|
16822
|
+
* },
|
|
16823
|
+
* },
|
|
16824
|
+
* );
|
|
16825
|
+
* const I18N_0 = MSG_FOO;
|
|
16826
|
+
* ```
|
|
16827
|
+
*/
|
|
16828
|
+
function createGoogleGetMsgStatements(variable$1, message, closureVar, placeholderValues) {
|
|
16779
16829
|
const messageString = serializeI18nMessageForGetMsg(message);
|
|
16780
16830
|
const args = [literal(messageString)];
|
|
16781
|
-
if (Object.keys(
|
|
16782
|
-
|
|
16831
|
+
if (Object.keys(placeholderValues).length) {
|
|
16832
|
+
// Message template parameters containing the magic strings replaced by the Angular runtime with
|
|
16833
|
+
// real data, e.g. `{'interpolation': '\uFFFD0\uFFFD'}`.
|
|
16834
|
+
args.push(mapLiteral(formatI18nPlaceholderNamesInMap(placeholderValues, true /* useCamelCase */), true /* quoted */));
|
|
16835
|
+
// Message options object, which contains original source code for placeholders (as they are
|
|
16836
|
+
// present in a template, e.g.
|
|
16837
|
+
// `{original_code: {'interpolation': '{{ name }}', 'startTagSpan': '<span>'}}`.
|
|
16838
|
+
args.push(mapLiteral({
|
|
16839
|
+
original_code: literalMap(Object.keys(placeholderValues)
|
|
16840
|
+
.map((param) => ({
|
|
16841
|
+
key: formatI18nPlaceholderName(param),
|
|
16842
|
+
quoted: true,
|
|
16843
|
+
value: message.placeholders[param] ?
|
|
16844
|
+
// Get source span for typical placeholder if it exists.
|
|
16845
|
+
literal(message.placeholders[param].sourceSpan.toString()) :
|
|
16846
|
+
// Otherwise must be an ICU expression, get it's source span.
|
|
16847
|
+
literal(message.placeholderToMessage[param]
|
|
16848
|
+
.nodes.map((node) => node.sourceSpan.toString())
|
|
16849
|
+
.join('')),
|
|
16850
|
+
}))),
|
|
16851
|
+
}));
|
|
16783
16852
|
}
|
|
16784
16853
|
// /**
|
|
16785
16854
|
// * @desc description of message
|
|
@@ -17730,7 +17799,7 @@ class TemplateDefinitionBuilder {
|
|
|
17730
17799
|
// - all ICU vars (such as `VAR_SELECT` or `VAR_PLURAL`) are replaced with correct values
|
|
17731
17800
|
const transformFn = (raw) => {
|
|
17732
17801
|
const params = { ...vars, ...placeholders };
|
|
17733
|
-
const formatted =
|
|
17802
|
+
const formatted = formatI18nPlaceholderNamesInMap(params, /* useCamelCase */ false);
|
|
17734
17803
|
return invokeInstruction(null, Identifiers.i18nPostprocess, [raw, mapLiteral(formatted, true)]);
|
|
17735
17804
|
};
|
|
17736
17805
|
// in case the whole i18n message is a single ICU - we do not need to
|
|
@@ -18651,7 +18720,7 @@ const NG_I18N_CLOSURE_MODE = 'ngI18nClosureMode';
|
|
|
18651
18720
|
function getTranslationDeclStmts(message, variable, closureVar, params = {}, transformFn) {
|
|
18652
18721
|
const statements = [
|
|
18653
18722
|
declareI18nVariable(variable),
|
|
18654
|
-
ifStmt(createClosureModeGuard(), createGoogleGetMsgStatements(variable, message, closureVar,
|
|
18723
|
+
ifStmt(createClosureModeGuard(), createGoogleGetMsgStatements(variable, message, closureVar, params), createLocalizeStatements(variable, message, formatI18nPlaceholderNamesInMap(params, /* useCamelCase */ false))),
|
|
18655
18724
|
];
|
|
18656
18725
|
if (transformFn) {
|
|
18657
18726
|
statements.push(new ExpressionStatement(variable.set(transformFn(variable))));
|
|
@@ -18745,6 +18814,10 @@ function addFeatures(definitionMap, meta) {
|
|
|
18745
18814
|
if (meta.lifecycle.usesOnChanges) {
|
|
18746
18815
|
features.push(importExpr(Identifiers.NgOnChangesFeature));
|
|
18747
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
|
+
}
|
|
18748
18821
|
if (features.length) {
|
|
18749
18822
|
definitionMap.set('features', literalArr(features));
|
|
18750
18823
|
}
|
|
@@ -18808,17 +18881,8 @@ function compileComponentFromMetadata(meta, constantPool, bindingParser) {
|
|
|
18808
18881
|
definitionMap.set('consts', constsExpr);
|
|
18809
18882
|
}
|
|
18810
18883
|
definitionMap.set('template', templateFunctionExpression);
|
|
18811
|
-
|
|
18812
|
-
|
|
18813
|
-
const directivesList = literalArr(meta.directives.map(dir => dir.type));
|
|
18814
|
-
const directivesExpr = compileDeclarationList(directivesList, meta.declarationListEmitMode);
|
|
18815
|
-
definitionMap.set('directives', directivesExpr);
|
|
18816
|
-
}
|
|
18817
|
-
// e.g. `pipes: [MyPipe]`
|
|
18818
|
-
if (meta.pipes.size > 0) {
|
|
18819
|
-
const pipesList = literalArr(Array.from(meta.pipes.values()));
|
|
18820
|
-
const pipesExpr = compileDeclarationList(pipesList, meta.declarationListEmitMode);
|
|
18821
|
-
definitionMap.set('pipes', pipesExpr);
|
|
18884
|
+
if (meta.declarations.length > 0) {
|
|
18885
|
+
definitionMap.set('dependencies', compileDeclarationList(literalArr(meta.declarations.map(decl => decl.type)), meta.declarationListEmitMode));
|
|
18822
18886
|
}
|
|
18823
18887
|
if (meta.encapsulation === null) {
|
|
18824
18888
|
meta.encapsulation = ViewEncapsulation.Emulated;
|
|
@@ -18856,8 +18920,9 @@ function compileComponentFromMetadata(meta, constantPool, bindingParser) {
|
|
|
18856
18920
|
* to be consumed by upstream compilations.
|
|
18857
18921
|
*/
|
|
18858
18922
|
function createComponentType(meta) {
|
|
18859
|
-
const typeParams =
|
|
18923
|
+
const typeParams = createBaseDirectiveTypeParams(meta);
|
|
18860
18924
|
typeParams.push(stringArrayAsType(meta.template.ngContentSelectors));
|
|
18925
|
+
typeParams.push(expressionType(literal(meta.isStandalone)));
|
|
18861
18926
|
return expressionType(importExpr(Identifiers.ComponentDeclaration, typeParams));
|
|
18862
18927
|
}
|
|
18863
18928
|
/**
|
|
@@ -18948,7 +19013,7 @@ function stringArrayAsType(arr) {
|
|
|
18948
19013
|
return arr.length > 0 ? expressionType(literalArr(arr.map(value => literal(value)))) :
|
|
18949
19014
|
NONE_TYPE;
|
|
18950
19015
|
}
|
|
18951
|
-
function
|
|
19016
|
+
function createBaseDirectiveTypeParams(meta) {
|
|
18952
19017
|
// On the type side, remove newlines from the selector as it will need to fit into a TypeScript
|
|
18953
19018
|
// string literal, which must be on one line.
|
|
18954
19019
|
const selectorForType = meta.selector !== null ? meta.selector.replace(/\n/g, '') : null;
|
|
@@ -18966,7 +19031,11 @@ function createDirectiveTypeParams(meta) {
|
|
|
18966
19031
|
* to be consumed by upstream compilations.
|
|
18967
19032
|
*/
|
|
18968
19033
|
function createDirectiveType(meta) {
|
|
18969
|
-
const typeParams =
|
|
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)));
|
|
18970
19039
|
return expressionType(importExpr(Identifiers.DirectiveDeclaration, typeParams));
|
|
18971
19040
|
}
|
|
18972
19041
|
// Define and update any view queries
|
|
@@ -19414,6 +19483,7 @@ class CompilerFacadeImpl {
|
|
|
19414
19483
|
...convertDirectiveFacadeToMetadata(facade),
|
|
19415
19484
|
selector: facade.selector || this.elementSchemaRegistry.getDefaultComponentElementName(),
|
|
19416
19485
|
template,
|
|
19486
|
+
declarations: facade.declarations.map(convertDeclarationFacadeToMetadata),
|
|
19417
19487
|
declarationListEmitMode: 0 /* Direct */,
|
|
19418
19488
|
styles: [...facade.styles, ...template.styles],
|
|
19419
19489
|
encapsulation: facade.encapsulation,
|
|
@@ -19593,31 +19663,57 @@ function convertOpaqueValuesToExpressions(obj) {
|
|
|
19593
19663
|
}
|
|
19594
19664
|
return result;
|
|
19595
19665
|
}
|
|
19596
|
-
function convertDeclareComponentFacadeToMetadata(
|
|
19597
|
-
const { template, interpolation } = parseJitTemplate(
|
|
19666
|
+
function convertDeclareComponentFacadeToMetadata(decl, typeSourceSpan, sourceMapUrl) {
|
|
19667
|
+
const { template, interpolation } = parseJitTemplate(decl.template, decl.type.name, sourceMapUrl, decl.preserveWhitespaces ?? false, decl.interpolation);
|
|
19668
|
+
const declarations = [];
|
|
19669
|
+
if (decl.dependencies) {
|
|
19670
|
+
for (const innerDep of decl.dependencies) {
|
|
19671
|
+
switch (innerDep.kind) {
|
|
19672
|
+
case 'directive':
|
|
19673
|
+
case 'component':
|
|
19674
|
+
declarations.push(convertDirectiveDeclarationToMetadata(innerDep));
|
|
19675
|
+
break;
|
|
19676
|
+
case 'pipe':
|
|
19677
|
+
declarations.push(convertPipeDeclarationToMetadata(innerDep));
|
|
19678
|
+
break;
|
|
19679
|
+
}
|
|
19680
|
+
}
|
|
19681
|
+
}
|
|
19682
|
+
else if (decl.components || decl.directives || decl.pipes) {
|
|
19683
|
+
// Existing declarations on NPM may not be using the new `dependencies` merged field, and may
|
|
19684
|
+
// have separate fields for dependencies instead. Unify them for JIT compilation.
|
|
19685
|
+
decl.components &&
|
|
19686
|
+
declarations.push(...decl.components.map(dir => convertDirectiveDeclarationToMetadata(dir, /* isComponent */ true)));
|
|
19687
|
+
decl.directives &&
|
|
19688
|
+
declarations.push(...decl.directives.map(dir => convertDirectiveDeclarationToMetadata(dir)));
|
|
19689
|
+
decl.pipes && declarations.push(...convertPipeMapToMetadata(decl.pipes));
|
|
19690
|
+
}
|
|
19598
19691
|
return {
|
|
19599
|
-
...convertDeclareDirectiveFacadeToMetadata(
|
|
19692
|
+
...convertDeclareDirectiveFacadeToMetadata(decl, typeSourceSpan),
|
|
19600
19693
|
template,
|
|
19601
|
-
styles:
|
|
19602
|
-
|
|
19603
|
-
|
|
19604
|
-
.map(convertUsedDirectiveDeclarationToMetadata),
|
|
19605
|
-
pipes: convertUsedPipesToMetadata(declaration.pipes),
|
|
19606
|
-
viewProviders: declaration.viewProviders !== undefined ?
|
|
19607
|
-
new WrappedNodeExpr(declaration.viewProviders) :
|
|
19608
|
-
null,
|
|
19609
|
-
animations: declaration.animations !== undefined ? new WrappedNodeExpr(declaration.animations) :
|
|
19694
|
+
styles: decl.styles ?? [],
|
|
19695
|
+
declarations,
|
|
19696
|
+
viewProviders: decl.viewProviders !== undefined ? new WrappedNodeExpr(decl.viewProviders) :
|
|
19610
19697
|
null,
|
|
19611
|
-
|
|
19612
|
-
|
|
19698
|
+
animations: decl.animations !== undefined ? new WrappedNodeExpr(decl.animations) : null,
|
|
19699
|
+
changeDetection: decl.changeDetection ?? ChangeDetectionStrategy.Default,
|
|
19700
|
+
encapsulation: decl.encapsulation ?? ViewEncapsulation.Emulated,
|
|
19613
19701
|
interpolation,
|
|
19614
19702
|
declarationListEmitMode: 2 /* ClosureResolved */,
|
|
19615
19703
|
relativeContextFilePath: '',
|
|
19616
19704
|
i18nUseExternalIds: true,
|
|
19617
19705
|
};
|
|
19618
19706
|
}
|
|
19619
|
-
function
|
|
19707
|
+
function convertDeclarationFacadeToMetadata(declaration) {
|
|
19708
|
+
return {
|
|
19709
|
+
...declaration,
|
|
19710
|
+
type: new WrappedNodeExpr(declaration.type),
|
|
19711
|
+
};
|
|
19712
|
+
}
|
|
19713
|
+
function convertDirectiveDeclarationToMetadata(declaration, isComponent = null) {
|
|
19620
19714
|
return {
|
|
19715
|
+
kind: R3TemplateDependencyKind.Directive,
|
|
19716
|
+
isComponent: isComponent || declaration.kind === 'component',
|
|
19621
19717
|
selector: declaration.selector,
|
|
19622
19718
|
type: new WrappedNodeExpr(declaration.type),
|
|
19623
19719
|
inputs: declaration.inputs ?? [],
|
|
@@ -19625,16 +19721,24 @@ function convertUsedDirectiveDeclarationToMetadata(declaration) {
|
|
|
19625
19721
|
exportAs: declaration.exportAs ?? null,
|
|
19626
19722
|
};
|
|
19627
19723
|
}
|
|
19628
|
-
function
|
|
19629
|
-
|
|
19630
|
-
|
|
19631
|
-
return pipes;
|
|
19632
|
-
}
|
|
19633
|
-
for (const pipeName of Object.keys(declaredPipes)) {
|
|
19634
|
-
const pipeType = declaredPipes[pipeName];
|
|
19635
|
-
pipes.set(pipeName, new WrappedNodeExpr(pipeType));
|
|
19724
|
+
function convertPipeMapToMetadata(pipes) {
|
|
19725
|
+
if (!pipes) {
|
|
19726
|
+
return [];
|
|
19636
19727
|
}
|
|
19637
|
-
return pipes
|
|
19728
|
+
return Object.keys(pipes).map(name => {
|
|
19729
|
+
return {
|
|
19730
|
+
kind: R3TemplateDependencyKind.Pipe,
|
|
19731
|
+
name,
|
|
19732
|
+
type: new WrappedNodeExpr(pipes[name]),
|
|
19733
|
+
};
|
|
19734
|
+
});
|
|
19735
|
+
}
|
|
19736
|
+
function convertPipeDeclarationToMetadata(pipe) {
|
|
19737
|
+
return {
|
|
19738
|
+
kind: R3TemplateDependencyKind.Pipe,
|
|
19739
|
+
name: pipe.name,
|
|
19740
|
+
type: new WrappedNodeExpr(pipe.type),
|
|
19741
|
+
};
|
|
19638
19742
|
}
|
|
19639
19743
|
function parseJitTemplate(template, typeName, sourceMapUrl, preserveWhitespaces, interpolation) {
|
|
19640
19744
|
const interpolationConfig = interpolation ? InterpolationConfig.fromArray(interpolation) : DEFAULT_INTERPOLATION_CONFIG;
|
|
@@ -19781,7 +19885,7 @@ function publishFacade(global) {
|
|
|
19781
19885
|
* Use of this source code is governed by an MIT-style license that can be
|
|
19782
19886
|
* found in the LICENSE file at https://angular.io/license
|
|
19783
19887
|
*/
|
|
19784
|
-
const VERSION = new Version('14.0.0-next.
|
|
19888
|
+
const VERSION = new Version('14.0.0-next.14');
|
|
19785
19889
|
|
|
19786
19890
|
/**
|
|
19787
19891
|
* @license
|
|
@@ -21278,14 +21382,6 @@ var FactoryTarget;
|
|
|
21278
21382
|
* found in the LICENSE file at https://angular.io/license
|
|
21279
21383
|
*/
|
|
21280
21384
|
|
|
21281
|
-
/**
|
|
21282
|
-
* @license
|
|
21283
|
-
* Copyright Google LLC All Rights Reserved.
|
|
21284
|
-
*
|
|
21285
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
21286
|
-
* found in the LICENSE file at https://angular.io/license
|
|
21287
|
-
*/
|
|
21288
|
-
|
|
21289
21385
|
/**
|
|
21290
21386
|
* @license
|
|
21291
21387
|
* Copyright Google LLC All Rights Reserved.
|
|
@@ -21822,7 +21918,7 @@ const MINIMUM_PARTIAL_LINKER_VERSION$6 = '12.0.0';
|
|
|
21822
21918
|
function compileDeclareClassMetadata(metadata) {
|
|
21823
21919
|
const definitionMap = new DefinitionMap();
|
|
21824
21920
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$6));
|
|
21825
|
-
definitionMap.set('version', literal('14.0.0-next.
|
|
21921
|
+
definitionMap.set('version', literal('14.0.0-next.14'));
|
|
21826
21922
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
21827
21923
|
definitionMap.set('type', metadata.type);
|
|
21828
21924
|
definitionMap.set('decorators', metadata.decorators);
|
|
@@ -21939,9 +22035,12 @@ function compileDeclareDirectiveFromMetadata(meta) {
|
|
|
21939
22035
|
function createDirectiveDefinitionMap(meta) {
|
|
21940
22036
|
const definitionMap = new DefinitionMap();
|
|
21941
22037
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$5));
|
|
21942
|
-
definitionMap.set('version', literal('14.0.0-next.
|
|
22038
|
+
definitionMap.set('version', literal('14.0.0-next.14'));
|
|
21943
22039
|
// e.g. `type: MyDirective`
|
|
21944
22040
|
definitionMap.set('type', meta.internalType);
|
|
22041
|
+
if (meta.isStandalone) {
|
|
22042
|
+
definitionMap.set('isStandalone', literal(meta.isStandalone));
|
|
22043
|
+
}
|
|
21945
22044
|
// e.g. `selector: 'some-dir'`
|
|
21946
22045
|
if (meta.selector !== null) {
|
|
21947
22046
|
definitionMap.set('selector', literal(meta.selector));
|
|
@@ -22046,9 +22145,7 @@ function createComponentDefinitionMap(meta, template, templateInfo) {
|
|
|
22046
22145
|
definitionMap.set('isInline', literal(true));
|
|
22047
22146
|
}
|
|
22048
22147
|
definitionMap.set('styles', toOptionalLiteralArray(meta.styles, literal));
|
|
22049
|
-
definitionMap.set('
|
|
22050
|
-
definitionMap.set('directives', compileUsedDirectiveMetadata(meta, directive => directive.isComponent !== true));
|
|
22051
|
-
definitionMap.set('pipes', compileUsedPipeMetadata(meta));
|
|
22148
|
+
definitionMap.set('dependencies', compileUsedDependenciesMetadata(meta));
|
|
22052
22149
|
definitionMap.set('viewProviders', meta.viewProviders);
|
|
22053
22150
|
definitionMap.set('animations', meta.animations);
|
|
22054
22151
|
if (meta.changeDetection !== undefined) {
|
|
@@ -22104,43 +22201,35 @@ function computeEndLocation(file, contents) {
|
|
|
22104
22201
|
} while (lineStart !== -1);
|
|
22105
22202
|
return new ParseLocation(file, length, line, length - lastLineStart);
|
|
22106
22203
|
}
|
|
22107
|
-
|
|
22108
|
-
* Compiles the directives as registered in the component metadata into an array literal of the
|
|
22109
|
-
* individual directives. If the component does not use any directives, then null is returned.
|
|
22110
|
-
*/
|
|
22111
|
-
function compileUsedDirectiveMetadata(meta, predicate) {
|
|
22204
|
+
function compileUsedDependenciesMetadata(meta) {
|
|
22112
22205
|
const wrapType = meta.declarationListEmitMode !== 0 /* Direct */ ?
|
|
22113
22206
|
generateForwardRef :
|
|
22114
22207
|
(expr) => expr;
|
|
22115
|
-
|
|
22116
|
-
|
|
22117
|
-
|
|
22118
|
-
|
|
22119
|
-
|
|
22120
|
-
|
|
22121
|
-
|
|
22122
|
-
|
|
22123
|
-
|
|
22208
|
+
return toOptionalLiteralArray(meta.declarations, decl => {
|
|
22209
|
+
switch (decl.kind) {
|
|
22210
|
+
case R3TemplateDependencyKind.Directive:
|
|
22211
|
+
const dirMeta = new DefinitionMap();
|
|
22212
|
+
dirMeta.set('kind', literal(decl.isComponent ? 'component' : 'directive'));
|
|
22213
|
+
dirMeta.set('type', wrapType(decl.type));
|
|
22214
|
+
dirMeta.set('selector', literal(decl.selector));
|
|
22215
|
+
dirMeta.set('inputs', toOptionalLiteralArray(decl.inputs, literal));
|
|
22216
|
+
dirMeta.set('outputs', toOptionalLiteralArray(decl.outputs, literal));
|
|
22217
|
+
dirMeta.set('exportAs', toOptionalLiteralArray(decl.exportAs, literal));
|
|
22218
|
+
return dirMeta.toLiteralMap();
|
|
22219
|
+
case R3TemplateDependencyKind.Pipe:
|
|
22220
|
+
const pipeMeta = new DefinitionMap();
|
|
22221
|
+
pipeMeta.set('kind', literal('pipe'));
|
|
22222
|
+
pipeMeta.set('type', wrapType(decl.type));
|
|
22223
|
+
pipeMeta.set('name', literal(decl.name));
|
|
22224
|
+
return pipeMeta.toLiteralMap();
|
|
22225
|
+
case R3TemplateDependencyKind.NgModule:
|
|
22226
|
+
const ngModuleMeta = new DefinitionMap();
|
|
22227
|
+
ngModuleMeta.set('kind', literal('ngmodule'));
|
|
22228
|
+
ngModuleMeta.set('type', wrapType(decl.type));
|
|
22229
|
+
return ngModuleMeta.toLiteralMap();
|
|
22230
|
+
}
|
|
22124
22231
|
});
|
|
22125
22232
|
}
|
|
22126
|
-
/**
|
|
22127
|
-
* Compiles the pipes as registered in the component metadata into an object literal, where the
|
|
22128
|
-
* pipe's name is used as key and a reference to its type as value. If the component does not use
|
|
22129
|
-
* any pipes, then null is returned.
|
|
22130
|
-
*/
|
|
22131
|
-
function compileUsedPipeMetadata(meta) {
|
|
22132
|
-
if (meta.pipes.size === 0) {
|
|
22133
|
-
return null;
|
|
22134
|
-
}
|
|
22135
|
-
const wrapType = meta.declarationListEmitMode !== 0 /* Direct */ ?
|
|
22136
|
-
generateForwardRef :
|
|
22137
|
-
(expr) => expr;
|
|
22138
|
-
const entries = [];
|
|
22139
|
-
for (const [name, pipe] of meta.pipes) {
|
|
22140
|
-
entries.push({ key: name, value: wrapType(pipe), quoted: true });
|
|
22141
|
-
}
|
|
22142
|
-
return literalMap(entries);
|
|
22143
|
-
}
|
|
22144
22233
|
|
|
22145
22234
|
/**
|
|
22146
22235
|
* @license
|
|
@@ -22160,7 +22249,7 @@ const MINIMUM_PARTIAL_LINKER_VERSION$4 = '12.0.0';
|
|
|
22160
22249
|
function compileDeclareFactoryFunction(meta) {
|
|
22161
22250
|
const definitionMap = new DefinitionMap();
|
|
22162
22251
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$4));
|
|
22163
|
-
definitionMap.set('version', literal('14.0.0-next.
|
|
22252
|
+
definitionMap.set('version', literal('14.0.0-next.14'));
|
|
22164
22253
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
22165
22254
|
definitionMap.set('type', meta.internalType);
|
|
22166
22255
|
definitionMap.set('deps', compileDependencies(meta.deps));
|
|
@@ -22202,7 +22291,7 @@ function compileDeclareInjectableFromMetadata(meta) {
|
|
|
22202
22291
|
function createInjectableDefinitionMap(meta) {
|
|
22203
22292
|
const definitionMap = new DefinitionMap();
|
|
22204
22293
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$3));
|
|
22205
|
-
definitionMap.set('version', literal('14.0.0-next.
|
|
22294
|
+
definitionMap.set('version', literal('14.0.0-next.14'));
|
|
22206
22295
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
22207
22296
|
definitionMap.set('type', meta.internalType);
|
|
22208
22297
|
// Only generate providedIn property if it has a non-null value
|
|
@@ -22260,7 +22349,7 @@ function compileDeclareInjectorFromMetadata(meta) {
|
|
|
22260
22349
|
function createInjectorDefinitionMap(meta) {
|
|
22261
22350
|
const definitionMap = new DefinitionMap();
|
|
22262
22351
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$2));
|
|
22263
|
-
definitionMap.set('version', literal('14.0.0-next.
|
|
22352
|
+
definitionMap.set('version', literal('14.0.0-next.14'));
|
|
22264
22353
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
22265
22354
|
definitionMap.set('type', meta.internalType);
|
|
22266
22355
|
definitionMap.set('providers', meta.providers);
|
|
@@ -22297,7 +22386,7 @@ function compileDeclareNgModuleFromMetadata(meta) {
|
|
|
22297
22386
|
function createNgModuleDefinitionMap(meta) {
|
|
22298
22387
|
const definitionMap = new DefinitionMap();
|
|
22299
22388
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$1));
|
|
22300
|
-
definitionMap.set('version', literal('14.0.0-next.
|
|
22389
|
+
definitionMap.set('version', literal('14.0.0-next.14'));
|
|
22301
22390
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
22302
22391
|
definitionMap.set('type', meta.internalType);
|
|
22303
22392
|
// We only generate the keys in the metadata if the arrays contain values.
|
|
@@ -22355,10 +22444,13 @@ function compileDeclarePipeFromMetadata(meta) {
|
|
|
22355
22444
|
function createPipeDefinitionMap(meta) {
|
|
22356
22445
|
const definitionMap = new DefinitionMap();
|
|
22357
22446
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION));
|
|
22358
|
-
definitionMap.set('version', literal('14.0.0-next.
|
|
22447
|
+
definitionMap.set('version', literal('14.0.0-next.14'));
|
|
22359
22448
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
22360
22449
|
// e.g. `type: MyPipe`
|
|
22361
22450
|
definitionMap.set('type', meta.internalType);
|
|
22451
|
+
if (meta.isStandalone) {
|
|
22452
|
+
definitionMap.set('isStandalone', literal(meta.isStandalone));
|
|
22453
|
+
}
|
|
22362
22454
|
// e.g. `name: "myPipe"`
|
|
22363
22455
|
definitionMap.set('name', literal(meta.pipeName));
|
|
22364
22456
|
if (meta.pure === false) {
|
|
@@ -22405,5 +22497,5 @@ publishFacade(_global);
|
|
|
22405
22497
|
* found in the LICENSE file at https://angular.io/license
|
|
22406
22498
|
*/
|
|
22407
22499
|
|
|
22408
|
-
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 };
|
|
22500
|
+
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 };
|
|
22409
22501
|
//# sourceMappingURL=compiler.mjs.map
|