@angular/compiler 13.3.0 → 14.0.0-next.10
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.mjs +2 -2
- package/esm2020/src/compiler_facade_interface.mjs +1 -1
- package/esm2020/src/compiler_util/expression_converter.mjs +1 -11
- package/esm2020/src/expression_parser/ast.mjs +1 -35
- package/esm2020/src/expression_parser/parser.mjs +3 -22
- package/esm2020/src/jit_compiler_facade.mjs +6 -3
- package/esm2020/src/ml_parser/lexer.mjs +2 -2
- package/esm2020/src/parse_util.mjs +2 -2
- package/esm2020/src/render3/partial/api.mjs +1 -1
- package/esm2020/src/render3/partial/class_metadata.mjs +1 -1
- package/esm2020/src/render3/partial/directive.mjs +1 -1
- 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 +1 -1
- package/esm2020/src/render3/r3_identifiers.mjs +3 -1
- package/esm2020/src/render3/r3_module_compiler.mjs +45 -8
- package/esm2020/src/render3/r3_pipe_compiler.mjs +4 -1
- package/esm2020/src/render3/view/api.mjs +1 -1
- package/esm2020/src/render3/view/compiler.mjs +4 -1
- package/esm2020/src/render3/view/style_parser.mjs +2 -2
- package/esm2020/src/render3/view/styling_builder.mjs +3 -3
- package/esm2020/src/render3/view/template.mjs +21 -8
- package/esm2020/src/selector.mjs +3 -3
- package/esm2020/src/shadow_css.mjs +2 -2
- package/esm2020/src/template_parser/binding_parser.mjs +2 -2
- package/esm2020/src/version.mjs +1 -1
- package/fesm2015/compiler.mjs +97 -99
- package/fesm2015/compiler.mjs.map +1 -1
- package/fesm2015/testing.mjs +1 -1
- package/fesm2015/testing.mjs.map +1 -1
- package/fesm2020/compiler.mjs +95 -97
- package/fesm2020/compiler.mjs.map +1 -1
- package/fesm2020/testing.mjs +1 -1
- package/fesm2020/testing.mjs.map +1 -1
- package/package.json +10 -2
- package/src/compiler.d.ts +1 -1
- package/src/compiler_facade_interface.d.ts +4 -0
- package/src/expression_parser/ast.d.ts +0 -25
- package/src/expression_parser/parser.d.ts +0 -1
- package/src/render3/partial/api.d.ts +10 -0
- package/src/render3/r3_identifiers.d.ts +2 -0
- package/src/render3/r3_module_compiler.d.ts +30 -4
- package/src/render3/r3_pipe_compiler.d.ts +4 -0
- package/src/render3/view/api.d.ts +4 -0
- package/src/render3/view/template.d.ts +1 -1
package/fesm2015/testing.mjs
CHANGED
package/fesm2015/testing.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"testing.mjs","sources":["../../../../../../packages/compiler/testing/src/testing.ts","../../../../../../packages/compiler/testing/public_api.ts","../../../../../../packages/compiler/testing/index.ts","../../../../../../packages/compiler/testing/testing.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\n/**\n * @module\n * @description\n * Entry point for all APIs of the compiler package.\n *\n * <div class=\"callout is-critical\">\n * <header>Unstable APIs</header>\n * <p>\n * All compiler apis are currently considered experimental and private!\n * </p>\n * <p>\n * We expect the APIs in this package to keep on changing. Do not rely on them.\n * </p>\n * </div>\n */\n\n// TODO(alxhub): @angular/compiler/testing is unused in Ivy. A placeholder\n// is left here because the components repo still depends on this package\n// directly. It will be cleaned up at a later date.\n//\n// This export ensures this package is not empty.\nexport const unusedExport = true;\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\n/// <reference types=\"node\" />\n\n/**\n * @module\n * @description\n * Entry point for all public APIs of this package.\n */\nexport * from './src/testing';\n\n// This file only reexports content of the `src` folder. Keep it that way.\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\n// This file is not used to build this module. It is only used during editing\n// by the TypeScript language service and during build for verification. `ngc`\n// replaces this file with production index.ts when it rewrites private symbol\n// names.\n\nexport * from './public_api';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;AAAA
|
|
1
|
+
{"version":3,"file":"testing.mjs","sources":["../../../../../../packages/compiler/testing/src/testing.ts","../../../../../../packages/compiler/testing/public_api.ts","../../../../../../packages/compiler/testing/index.ts","../../../../../../packages/compiler/testing/testing.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\n/**\n * @module\n * @description\n * Entry point for all APIs of the compiler package.\n *\n * <div class=\"callout is-critical\">\n * <header>Unstable APIs</header>\n * <p>\n * All compiler apis are currently considered experimental and private!\n * </p>\n * <p>\n * We expect the APIs in this package to keep on changing. Do not rely on them.\n * </p>\n * </div>\n */\n\n// TODO(alxhub): @angular/compiler/testing is unused in Ivy. A placeholder\n// is left here because the components repo still depends on this package\n// directly. It will be cleaned up at a later date.\n//\n// This export ensures this package is not empty.\nexport const unusedExport = true;\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\n/// <reference types=\"node\" />\n\n/**\n * @module\n * @description\n * Entry point for all public APIs of this package.\n */\nexport * from './src/testing';\n\n// This file only reexports content of the `src` folder. Keep it that way.\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\n// This file is not used to build this module. It is only used during editing\n// by the TypeScript language service and during build for verification. `ngc`\n// replaces this file with production index.ts when it rewrites private symbol\n// names.\n\nexport * from './public_api';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;AAAA;;;;;;AAMG;AAEH;;;;;;;;;;;;;;AAcG;AAEH;AACA;AACA;AACA;AACA;AACO,MAAM,YAAY,GAAG;;AC7B5B;;;;;;AAMG;AAWH;;ACjBA;;;;;;AAMG;;ACNH;;AAEG;;;;"}
|
package/fesm2020/compiler.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular
|
|
2
|
+
* @license Angular v14.0.0-next.10
|
|
3
3
|
* (c) 2010-2022 Google LLC. https://angular.io/
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
@@ -224,11 +224,11 @@ class CssSelector {
|
|
|
224
224
|
const prefix = match[3 /* PREFIX */];
|
|
225
225
|
if (prefix === '#') {
|
|
226
226
|
// #hash
|
|
227
|
-
current.addAttribute('id', tag.
|
|
227
|
+
current.addAttribute('id', tag.slice(1));
|
|
228
228
|
}
|
|
229
229
|
else if (prefix === '.') {
|
|
230
230
|
// Class
|
|
231
|
-
current.addClassName(tag.
|
|
231
|
+
current.addClassName(tag.slice(1));
|
|
232
232
|
}
|
|
233
233
|
else {
|
|
234
234
|
// Element
|
|
@@ -2796,6 +2796,7 @@ Identifiers.stylePropInterpolate7 = { name: 'ɵɵstylePropInterpolate7', moduleN
|
|
|
2796
2796
|
Identifiers.stylePropInterpolate8 = { name: 'ɵɵstylePropInterpolate8', moduleName: CORE };
|
|
2797
2797
|
Identifiers.stylePropInterpolateV = { name: 'ɵɵstylePropInterpolateV', moduleName: CORE };
|
|
2798
2798
|
Identifiers.nextContext = { name: 'ɵɵnextContext', moduleName: CORE };
|
|
2799
|
+
Identifiers.resetView = { name: 'ɵɵresetView', moduleName: CORE };
|
|
2799
2800
|
Identifiers.templateCreate = { name: 'ɵɵtemplate', moduleName: CORE };
|
|
2800
2801
|
Identifiers.text = { name: 'ɵɵtext', moduleName: CORE };
|
|
2801
2802
|
Identifiers.enableBindings = { name: 'ɵɵenableBindings', moduleName: CORE };
|
|
@@ -2906,6 +2907,7 @@ Identifiers.ModuleWithProviders = {
|
|
|
2906
2907
|
Identifiers.defineNgModule = { name: 'ɵɵdefineNgModule', moduleName: CORE };
|
|
2907
2908
|
Identifiers.declareNgModule = { name: 'ɵɵngDeclareNgModule', moduleName: CORE };
|
|
2908
2909
|
Identifiers.setNgModuleScope = { name: 'ɵɵsetNgModuleScope', moduleName: CORE };
|
|
2910
|
+
Identifiers.registerNgModuleType = { name: 'ɵɵregisterNgModuleType', moduleName: CORE };
|
|
2909
2911
|
Identifiers.PipeDeclaration = { name: 'ɵɵPipeDeclaration', moduleName: CORE };
|
|
2910
2912
|
Identifiers.definePipe = { name: 'ɵɵdefinePipe', moduleName: CORE };
|
|
2911
2913
|
Identifiers.declarePipe = { name: 'ɵɵngDeclarePipe', moduleName: CORE };
|
|
@@ -5428,7 +5430,7 @@ class ParseLocation {
|
|
|
5428
5430
|
const ch = source.charCodeAt(offset);
|
|
5429
5431
|
if (ch == $LF) {
|
|
5430
5432
|
line--;
|
|
5431
|
-
const priorLine = source.
|
|
5433
|
+
const priorLine = source.substring(0, offset - 1).lastIndexOf(String.fromCharCode($LF));
|
|
5432
5434
|
col = priorLine > 0 ? offset - priorLine : offset;
|
|
5433
5435
|
}
|
|
5434
5436
|
else {
|
|
@@ -5982,20 +5984,49 @@ class R3JitReflector {
|
|
|
5982
5984
|
* Use of this source code is governed by an MIT-style license that can be
|
|
5983
5985
|
* found in the LICENSE file at https://angular.io/license
|
|
5984
5986
|
*/
|
|
5987
|
+
/**
|
|
5988
|
+
* How the selector scope of an NgModule (its declarations, imports, and exports) should be emitted
|
|
5989
|
+
* as a part of the NgModule definition.
|
|
5990
|
+
*/
|
|
5991
|
+
var R3SelectorScopeMode;
|
|
5992
|
+
(function (R3SelectorScopeMode) {
|
|
5993
|
+
/**
|
|
5994
|
+
* Emit the declarations inline into the module definition.
|
|
5995
|
+
*
|
|
5996
|
+
* This option is useful in certain contexts where it's known that JIT support is required. The
|
|
5997
|
+
* tradeoff here is that this emit style prevents directives and pipes from being tree-shaken if
|
|
5998
|
+
* they are unused, but the NgModule is used.
|
|
5999
|
+
*/
|
|
6000
|
+
R3SelectorScopeMode[R3SelectorScopeMode["Inline"] = 0] = "Inline";
|
|
6001
|
+
/**
|
|
6002
|
+
* Emit the declarations using a side effectful function call, `ɵɵsetNgModuleScope`, that is
|
|
6003
|
+
* guarded with the `ngJitMode` flag.
|
|
6004
|
+
*
|
|
6005
|
+
* This form of emit supports JIT and can be optimized away if the `ngJitMode` flag is set to
|
|
6006
|
+
* false, which allows unused directives and pipes to be tree-shaken.
|
|
6007
|
+
*/
|
|
6008
|
+
R3SelectorScopeMode[R3SelectorScopeMode["SideEffect"] = 1] = "SideEffect";
|
|
6009
|
+
/**
|
|
6010
|
+
* Don't generate selector scopes at all.
|
|
6011
|
+
*
|
|
6012
|
+
* This is useful for contexts where JIT support is known to be unnecessary.
|
|
6013
|
+
*/
|
|
6014
|
+
R3SelectorScopeMode[R3SelectorScopeMode["Omit"] = 2] = "Omit";
|
|
6015
|
+
})(R3SelectorScopeMode || (R3SelectorScopeMode = {}));
|
|
5985
6016
|
/**
|
|
5986
6017
|
* Construct an `R3NgModuleDef` for the given `R3NgModuleMetadata`.
|
|
5987
6018
|
*/
|
|
5988
6019
|
function compileNgModule(meta) {
|
|
5989
|
-
const { internalType, bootstrap, declarations, imports, exports, schemas, containsForwardDecls,
|
|
6020
|
+
const { adjacentType, internalType, bootstrap, declarations, imports, exports, schemas, containsForwardDecls, selectorScopeMode, id } = meta;
|
|
5990
6021
|
const statements = [];
|
|
5991
6022
|
const definitionMap = new DefinitionMap();
|
|
5992
6023
|
definitionMap.set('type', internalType);
|
|
5993
6024
|
if (bootstrap.length > 0) {
|
|
5994
6025
|
definitionMap.set('bootstrap', refsToArray(bootstrap, containsForwardDecls));
|
|
5995
6026
|
}
|
|
5996
|
-
|
|
5997
|
-
|
|
5998
|
-
|
|
6027
|
+
if (selectorScopeMode === R3SelectorScopeMode.Inline) {
|
|
6028
|
+
// If requested to emit scope information inline, pass the `declarations`, `imports` and
|
|
6029
|
+
// `exports` to the `ɵɵdefineNgModule()` call directly.
|
|
5999
6030
|
if (declarations.length > 0) {
|
|
6000
6031
|
definitionMap.set('declarations', refsToArray(declarations, containsForwardDecls));
|
|
6001
6032
|
}
|
|
@@ -6006,19 +6037,27 @@ function compileNgModule(meta) {
|
|
|
6006
6037
|
definitionMap.set('exports', refsToArray(exports, containsForwardDecls));
|
|
6007
6038
|
}
|
|
6008
6039
|
}
|
|
6009
|
-
|
|
6010
|
-
|
|
6011
|
-
|
|
6040
|
+
else if (selectorScopeMode === R3SelectorScopeMode.SideEffect) {
|
|
6041
|
+
// In this mode, scope information is not passed into `ɵɵdefineNgModule` as it
|
|
6042
|
+
// would prevent tree-shaking of the declarations, imports and exports references. Instead, it's
|
|
6043
|
+
// patched onto the NgModule definition with a `ɵɵsetNgModuleScope` call that's guarded by the
|
|
6044
|
+
// `ngJitMode` flag.
|
|
6012
6045
|
const setNgModuleScopeCall = generateSetNgModuleScopeCall(meta);
|
|
6013
6046
|
if (setNgModuleScopeCall !== null) {
|
|
6014
6047
|
statements.push(setNgModuleScopeCall);
|
|
6015
6048
|
}
|
|
6016
6049
|
}
|
|
6050
|
+
else {
|
|
6051
|
+
// Selector scope emit was not requested, so skip it.
|
|
6052
|
+
}
|
|
6017
6053
|
if (schemas !== null && schemas.length > 0) {
|
|
6018
6054
|
definitionMap.set('schemas', literalArr(schemas.map(ref => ref.value)));
|
|
6019
6055
|
}
|
|
6020
6056
|
if (id !== null) {
|
|
6021
6057
|
definitionMap.set('id', id);
|
|
6058
|
+
// Generate a side-effectful call to register this NgModule by its id, as per the semantics of
|
|
6059
|
+
// NgModule ids.
|
|
6060
|
+
statements.push(importExpr(Identifiers.registerNgModuleType).callFn([adjacentType, id]).toStmt());
|
|
6022
6061
|
}
|
|
6023
6062
|
const expression = importExpr(Identifiers.defineNgModule).callFn([definitionMap.toLiteralMap()], undefined, true);
|
|
6024
6063
|
const type = createNgModuleType(meta);
|
|
@@ -6114,6 +6153,9 @@ function compilePipeFromMetadata(metadata) {
|
|
|
6114
6153
|
definitionMapValues.push({ key: 'type', value: metadata.type.value, quoted: false });
|
|
6115
6154
|
// e.g. `pure: true`
|
|
6116
6155
|
definitionMapValues.push({ key: 'pure', value: literal(metadata.pure), quoted: false });
|
|
6156
|
+
if (metadata.isStandalone) {
|
|
6157
|
+
definitionMapValues.push({ key: 'standalone', value: literal(true), quoted: false });
|
|
6158
|
+
}
|
|
6117
6159
|
const expression = importExpr(Identifiers.definePipe).callFn([literalMap(definitionMapValues)], undefined, true);
|
|
6118
6160
|
const type = createPipeType(metadata);
|
|
6119
6161
|
return { expression, type, statements: [] };
|
|
@@ -6168,33 +6210,6 @@ class ASTWithName extends AST {
|
|
|
6168
6210
|
this.nameSpan = nameSpan;
|
|
6169
6211
|
}
|
|
6170
6212
|
}
|
|
6171
|
-
/**
|
|
6172
|
-
* Represents a quoted expression of the form:
|
|
6173
|
-
*
|
|
6174
|
-
* quote = prefix `:` uninterpretedExpression
|
|
6175
|
-
* prefix = identifier
|
|
6176
|
-
* uninterpretedExpression = arbitrary string
|
|
6177
|
-
*
|
|
6178
|
-
* A quoted expression is meant to be pre-processed by an AST transformer that
|
|
6179
|
-
* converts it into another AST that no longer contains quoted expressions.
|
|
6180
|
-
* It is meant to allow third-party developers to extend Angular template
|
|
6181
|
-
* expression language. The `uninterpretedExpression` part of the quote is
|
|
6182
|
-
* therefore not interpreted by the Angular's own expression parser.
|
|
6183
|
-
*/
|
|
6184
|
-
class Quote extends AST {
|
|
6185
|
-
constructor(span, sourceSpan, prefix, uninterpretedExpression, location) {
|
|
6186
|
-
super(span, sourceSpan);
|
|
6187
|
-
this.prefix = prefix;
|
|
6188
|
-
this.uninterpretedExpression = uninterpretedExpression;
|
|
6189
|
-
this.location = location;
|
|
6190
|
-
}
|
|
6191
|
-
visit(visitor, context = null) {
|
|
6192
|
-
return visitor.visitQuote(this, context);
|
|
6193
|
-
}
|
|
6194
|
-
toString() {
|
|
6195
|
-
return 'Quote';
|
|
6196
|
-
}
|
|
6197
|
-
}
|
|
6198
6213
|
class EmptyExpr extends AST {
|
|
6199
6214
|
visit(visitor, context = null) {
|
|
6200
6215
|
// do nothing
|
|
@@ -6574,7 +6589,6 @@ class RecursiveAstVisitor {
|
|
|
6574
6589
|
this.visit(ast.receiver, context);
|
|
6575
6590
|
this.visitAll(ast.args, context);
|
|
6576
6591
|
}
|
|
6577
|
-
visitQuote(ast, context) { }
|
|
6578
6592
|
// This is not part of the AstVisitor interface, just a helper method
|
|
6579
6593
|
visitAll(asts, context) {
|
|
6580
6594
|
for (const ast of asts) {
|
|
@@ -6657,9 +6671,6 @@ class AstTransformer {
|
|
|
6657
6671
|
visitChain(ast, context) {
|
|
6658
6672
|
return new Chain(ast.span, ast.sourceSpan, this.visitAll(ast.expressions));
|
|
6659
6673
|
}
|
|
6660
|
-
visitQuote(ast, context) {
|
|
6661
|
-
return new Quote(ast.span, ast.sourceSpan, ast.prefix, ast.uninterpretedExpression, ast.location);
|
|
6662
|
-
}
|
|
6663
6674
|
visitSafeKeyedRead(ast, context) {
|
|
6664
6675
|
return new SafeKeyedRead(ast.span, ast.sourceSpan, ast.receiver.visit(this), ast.key.visit(this));
|
|
6665
6676
|
}
|
|
@@ -6822,9 +6833,6 @@ class AstMemoryEfficientTransformer {
|
|
|
6822
6833
|
}
|
|
6823
6834
|
return ast;
|
|
6824
6835
|
}
|
|
6825
|
-
visitQuote(ast, context) {
|
|
6826
|
-
return ast;
|
|
6827
|
-
}
|
|
6828
6836
|
visitSafeKeyedRead(ast, context) {
|
|
6829
6837
|
const obj = ast.receiver.visit(this);
|
|
6830
6838
|
const key = ast.key.visit(this);
|
|
@@ -7297,10 +7305,6 @@ class _AstToIrVisitor {
|
|
|
7297
7305
|
visitAll(asts, mode) {
|
|
7298
7306
|
return asts.map(ast => this._visit(ast, mode));
|
|
7299
7307
|
}
|
|
7300
|
-
visitQuote(ast, mode) {
|
|
7301
|
-
throw new Error(`Quotes are not supported for evaluation!
|
|
7302
|
-
Statement: ${ast.uninterpretedExpression} located at ${ast.location}`);
|
|
7303
|
-
}
|
|
7304
7308
|
visitCall(ast, mode) {
|
|
7305
7309
|
const leftMostSafe = this.leftMostSafeNode(ast);
|
|
7306
7310
|
if (leftMostSafe) {
|
|
@@ -7486,9 +7490,6 @@ class _AstToIrVisitor {
|
|
|
7486
7490
|
visitPropertyWrite(ast) {
|
|
7487
7491
|
return null;
|
|
7488
7492
|
},
|
|
7489
|
-
visitQuote(ast) {
|
|
7490
|
-
return null;
|
|
7491
|
-
},
|
|
7492
7493
|
visitSafePropertyRead(ast) {
|
|
7493
7494
|
return visit(this, ast.receiver) || ast;
|
|
7494
7495
|
},
|
|
@@ -7565,9 +7566,6 @@ class _AstToIrVisitor {
|
|
|
7565
7566
|
visitPropertyWrite(ast) {
|
|
7566
7567
|
return false;
|
|
7567
7568
|
},
|
|
7568
|
-
visitQuote(ast) {
|
|
7569
|
-
return false;
|
|
7570
|
-
},
|
|
7571
7569
|
visitSafePropertyRead(ast) {
|
|
7572
7570
|
return false;
|
|
7573
7571
|
},
|
|
@@ -8009,7 +8007,7 @@ class ShadowCss {
|
|
|
8009
8007
|
this._scopeSelector(rule.selector, scopeSelector, hostSelector, this.strictStyling);
|
|
8010
8008
|
}
|
|
8011
8009
|
else if (rule.selector.startsWith('@media') || rule.selector.startsWith('@supports') ||
|
|
8012
|
-
rule.selector.startsWith('@document')) {
|
|
8010
|
+
rule.selector.startsWith('@document') || rule.selector.startsWith('@layer')) {
|
|
8013
8011
|
content = this._scopeSelectors(rule.content, scopeSelector, hostSelector);
|
|
8014
8012
|
}
|
|
8015
8013
|
else if (rule.selector.startsWith('@font-face') || rule.selector.startsWith('@page')) {
|
|
@@ -8472,7 +8470,7 @@ function parse(value) {
|
|
|
8472
8470
|
}
|
|
8473
8471
|
}
|
|
8474
8472
|
if (currentProp && valueStart) {
|
|
8475
|
-
const styleVal = value.
|
|
8473
|
+
const styleVal = value.slice(valueStart).trim();
|
|
8476
8474
|
styles.push(currentProp, valueHasQuotes ? stripUnnecessaryQuotes(styleVal) : styleVal);
|
|
8477
8475
|
}
|
|
8478
8476
|
return styles;
|
|
@@ -8650,7 +8648,7 @@ class StylingBuilder {
|
|
|
8650
8648
|
const isClass = !isStyle && (name === 'class' || prefix === 'class.' || prefix === 'class!');
|
|
8651
8649
|
if (isStyle || isClass) {
|
|
8652
8650
|
const isMapBased = name.charAt(5) !== '.'; // style.prop or class.prop makes this a no
|
|
8653
|
-
const property = name.
|
|
8651
|
+
const property = name.slice(isMapBased ? 5 : 6); // the dot explains why there's a +1
|
|
8654
8652
|
if (isStyle) {
|
|
8655
8653
|
binding = this.registerStyleInput(property, isMapBased, expression, sourceSpan);
|
|
8656
8654
|
}
|
|
@@ -8924,7 +8922,7 @@ function parseProperty(name) {
|
|
|
8924
8922
|
let property = name;
|
|
8925
8923
|
const unitIndex = name.lastIndexOf('.');
|
|
8926
8924
|
if (unitIndex > 0) {
|
|
8927
|
-
suffix = name.
|
|
8925
|
+
suffix = name.slice(unitIndex + 1);
|
|
8928
8926
|
property = name.substring(0, unitIndex);
|
|
8929
8927
|
}
|
|
8930
8928
|
return { property, suffix, hasOverrideFlag };
|
|
@@ -9503,31 +9501,12 @@ class Parser$1 {
|
|
|
9503
9501
|
this.errors.push(new ParserError(message, input, errLocation, ctxLocation));
|
|
9504
9502
|
}
|
|
9505
9503
|
_parseBindingAst(input, location, absoluteOffset, interpolationConfig) {
|
|
9506
|
-
// Quotes expressions use 3rd-party expression language. We don't want to use
|
|
9507
|
-
// our lexer or parser for that, so we check for that ahead of time.
|
|
9508
|
-
const quote = this._parseQuote(input, location, absoluteOffset);
|
|
9509
|
-
if (quote != null) {
|
|
9510
|
-
return quote;
|
|
9511
|
-
}
|
|
9512
9504
|
this._checkNoInterpolation(input, location, interpolationConfig);
|
|
9513
9505
|
const sourceToLex = this._stripComments(input);
|
|
9514
9506
|
const tokens = this._lexer.tokenize(sourceToLex);
|
|
9515
9507
|
return new _ParseAST(input, location, absoluteOffset, tokens, 0 /* None */, this.errors, 0)
|
|
9516
9508
|
.parseChain();
|
|
9517
9509
|
}
|
|
9518
|
-
_parseQuote(input, location, absoluteOffset) {
|
|
9519
|
-
if (input == null)
|
|
9520
|
-
return null;
|
|
9521
|
-
const prefixSeparatorIndex = input.indexOf(':');
|
|
9522
|
-
if (prefixSeparatorIndex == -1)
|
|
9523
|
-
return null;
|
|
9524
|
-
const prefix = input.substring(0, prefixSeparatorIndex).trim();
|
|
9525
|
-
if (!isIdentifier(prefix))
|
|
9526
|
-
return null;
|
|
9527
|
-
const uninterpretedExpression = input.substring(prefixSeparatorIndex + 1);
|
|
9528
|
-
const span = new ParseSpan(0, input.length);
|
|
9529
|
-
return new Quote(span, span.toAbsolute(absoluteOffset), prefix, uninterpretedExpression, location);
|
|
9530
|
-
}
|
|
9531
9510
|
/**
|
|
9532
9511
|
* Parse microsyntax template expression and return a list of bindings or
|
|
9533
9512
|
* parsing errors in case the given expression is invalid.
|
|
@@ -13927,7 +13906,7 @@ class EscapedCharacterCursor extends PlainCharacterCursor {
|
|
|
13927
13906
|
}
|
|
13928
13907
|
}
|
|
13929
13908
|
decodeHexDigits(start, length) {
|
|
13930
|
-
const hex = this.input.
|
|
13909
|
+
const hex = this.input.slice(start.internalState.offset, start.internalState.offset + length);
|
|
13931
13910
|
const charCode = parseInt(hex, 16);
|
|
13932
13911
|
if (!isNaN(charCode)) {
|
|
13933
13912
|
return charCode;
|
|
@@ -15325,7 +15304,7 @@ class BindingParser {
|
|
|
15325
15304
|
this._reportError(`Event name is missing in binding`, sourceSpan);
|
|
15326
15305
|
}
|
|
15327
15306
|
if (isAnimationLabel(name)) {
|
|
15328
|
-
name = name.
|
|
15307
|
+
name = name.slice(1);
|
|
15329
15308
|
if (keySpan !== undefined) {
|
|
15330
15309
|
keySpan = moveParseSourceSpan(keySpan, new AbsoluteSourceSpan(keySpan.start.offset + 1, keySpan.end.offset));
|
|
15331
15310
|
}
|
|
@@ -16980,13 +16959,27 @@ function prepareEventListenerParameters(eventAst, handlerName = null, scope = nu
|
|
|
16980
16959
|
scope.getOrCreateSharedContextVar(0);
|
|
16981
16960
|
const bindingStatements = convertActionBinding(scope, implicitReceiverExpr, handler, 'b', eventAst.handlerSpan, implicitReceiverAccesses, EVENT_BINDING_SCOPE_GLOBALS);
|
|
16982
16961
|
const statements = [];
|
|
16983
|
-
|
|
16962
|
+
const variableDeclarations = scope?.variableDeclarations();
|
|
16963
|
+
const restoreViewStatement = scope?.restoreViewStatement();
|
|
16964
|
+
if (variableDeclarations) {
|
|
16984
16965
|
// `variableDeclarations` needs to run first, because
|
|
16985
16966
|
// `restoreViewStatement` depends on the result.
|
|
16986
|
-
statements.push(...
|
|
16987
|
-
statements.unshift(...scope.restoreViewStatement());
|
|
16967
|
+
statements.push(...variableDeclarations);
|
|
16988
16968
|
}
|
|
16989
16969
|
statements.push(...bindingStatements);
|
|
16970
|
+
if (restoreViewStatement) {
|
|
16971
|
+
statements.unshift(restoreViewStatement);
|
|
16972
|
+
// If there's a `restoreView` call, we need to reset the view at the end of the listener
|
|
16973
|
+
// in order to avoid a leak. If there's a `return` statement already, we wrap it in the
|
|
16974
|
+
// call, e.g. `return resetView(ctx.foo())`. Otherwise we add the call as the last statement.
|
|
16975
|
+
const lastStatement = statements[statements.length - 1];
|
|
16976
|
+
if (lastStatement instanceof ReturnStatement) {
|
|
16977
|
+
statements[statements.length - 1] = new ReturnStatement(invokeInstruction(lastStatement.value.sourceSpan, Identifiers.resetView, [lastStatement.value]));
|
|
16978
|
+
}
|
|
16979
|
+
else {
|
|
16980
|
+
statements.push(new ExpressionStatement(invokeInstruction(null, Identifiers.resetView, [])));
|
|
16981
|
+
}
|
|
16982
|
+
}
|
|
16990
16983
|
const eventName = type === 1 /* Animation */ ? prepareSyntheticListenerName(name, phase) : name;
|
|
16991
16984
|
const fnName = handlerName && sanitizeIdentifier(handlerName);
|
|
16992
16985
|
const fnArgs = [];
|
|
@@ -18316,16 +18309,15 @@ class BindingScope {
|
|
|
18316
18309
|
}
|
|
18317
18310
|
}
|
|
18318
18311
|
restoreViewStatement() {
|
|
18319
|
-
const statements = [];
|
|
18320
18312
|
if (this.restoreViewVariable) {
|
|
18321
18313
|
const restoreCall = invokeInstruction(null, Identifiers.restoreView, [this.restoreViewVariable]);
|
|
18322
18314
|
// Either `const restoredCtx = restoreView($state$);` or `restoreView($state$);`
|
|
18323
18315
|
// depending on whether it is being used.
|
|
18324
|
-
|
|
18316
|
+
return this.usesRestoredViewContext ?
|
|
18325
18317
|
variable(RESTORED_VIEW_CONTEXT_NAME).set(restoreCall).toConstDecl() :
|
|
18326
|
-
restoreCall.toStmt()
|
|
18318
|
+
restoreCall.toStmt();
|
|
18327
18319
|
}
|
|
18328
|
-
return
|
|
18320
|
+
return null;
|
|
18329
18321
|
}
|
|
18330
18322
|
viewSnapshotStatements() {
|
|
18331
18323
|
// const $state$ = getCurrentView();
|
|
@@ -18715,6 +18707,9 @@ function baseDirectiveFields(meta, constantPool, bindingParser) {
|
|
|
18715
18707
|
if (meta.exportAs !== null) {
|
|
18716
18708
|
definitionMap.set('exportAs', literalArr(meta.exportAs.map(e => literal(e))));
|
|
18717
18709
|
}
|
|
18710
|
+
if (meta.isStandalone) {
|
|
18711
|
+
definitionMap.set('standalone', literal(true));
|
|
18712
|
+
}
|
|
18718
18713
|
return definitionMap;
|
|
18719
18714
|
}
|
|
18720
18715
|
/**
|
|
@@ -19307,6 +19302,7 @@ class CompilerFacadeImpl {
|
|
|
19307
19302
|
deps: null,
|
|
19308
19303
|
pipeName: facade.pipeName,
|
|
19309
19304
|
pure: facade.pure,
|
|
19305
|
+
isStandalone: facade.isStandalone,
|
|
19310
19306
|
};
|
|
19311
19307
|
const res = compilePipeFromMetadata(metadata);
|
|
19312
19308
|
return this.jitExpression(res.expression, angularCoreEnv, sourceMapUrl, []);
|
|
@@ -19373,7 +19369,7 @@ class CompilerFacadeImpl {
|
|
|
19373
19369
|
declarations: facade.declarations.map(wrapReference),
|
|
19374
19370
|
imports: facade.imports.map(wrapReference),
|
|
19375
19371
|
exports: facade.exports.map(wrapReference),
|
|
19376
|
-
|
|
19372
|
+
selectorScopeMode: R3SelectorScopeMode.Inline,
|
|
19377
19373
|
containsForwardDecls: false,
|
|
19378
19374
|
schemas: facade.schemas ? facade.schemas.map(wrapReference) : null,
|
|
19379
19375
|
id: facade.id ? new WrappedNodeExpr(facade.id) : null,
|
|
@@ -19567,6 +19563,7 @@ function convertDeclareDirectiveFacadeToMetadata(declaration, typeSourceSpan) {
|
|
|
19567
19563
|
deps: null,
|
|
19568
19564
|
typeArgumentCount: 0,
|
|
19569
19565
|
fullInheritance: false,
|
|
19566
|
+
isStandalone: declaration.isStandalone ?? false,
|
|
19570
19567
|
};
|
|
19571
19568
|
}
|
|
19572
19569
|
function convertHostDeclarationToMetadata(host = {}) {
|
|
@@ -19748,6 +19745,7 @@ function convertDeclarePipeFacadeToMetadata(declaration) {
|
|
|
19748
19745
|
pipeName: declaration.name,
|
|
19749
19746
|
deps: null,
|
|
19750
19747
|
pure: declaration.pure ?? true,
|
|
19748
|
+
isStandalone: declaration.isStandalone ?? false,
|
|
19751
19749
|
};
|
|
19752
19750
|
}
|
|
19753
19751
|
function convertDeclareInjectorFacadeToMetadata(declaration) {
|
|
@@ -19774,7 +19772,7 @@ function publishFacade(global) {
|
|
|
19774
19772
|
* Use of this source code is governed by an MIT-style license that can be
|
|
19775
19773
|
* found in the LICENSE file at https://angular.io/license
|
|
19776
19774
|
*/
|
|
19777
|
-
const VERSION = new Version('
|
|
19775
|
+
const VERSION = new Version('14.0.0-next.10');
|
|
19778
19776
|
|
|
19779
19777
|
/**
|
|
19780
19778
|
* @license
|
|
@@ -21815,7 +21813,7 @@ const MINIMUM_PARTIAL_LINKER_VERSION$6 = '12.0.0';
|
|
|
21815
21813
|
function compileDeclareClassMetadata(metadata) {
|
|
21816
21814
|
const definitionMap = new DefinitionMap();
|
|
21817
21815
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$6));
|
|
21818
|
-
definitionMap.set('version', literal('
|
|
21816
|
+
definitionMap.set('version', literal('14.0.0-next.10'));
|
|
21819
21817
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
21820
21818
|
definitionMap.set('type', metadata.type);
|
|
21821
21819
|
definitionMap.set('decorators', metadata.decorators);
|
|
@@ -21932,7 +21930,7 @@ function compileDeclareDirectiveFromMetadata(meta) {
|
|
|
21932
21930
|
function createDirectiveDefinitionMap(meta) {
|
|
21933
21931
|
const definitionMap = new DefinitionMap();
|
|
21934
21932
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$5));
|
|
21935
|
-
definitionMap.set('version', literal('
|
|
21933
|
+
definitionMap.set('version', literal('14.0.0-next.10'));
|
|
21936
21934
|
// e.g. `type: MyDirective`
|
|
21937
21935
|
definitionMap.set('type', meta.internalType);
|
|
21938
21936
|
// e.g. `selector: 'some-dir'`
|
|
@@ -22153,7 +22151,7 @@ const MINIMUM_PARTIAL_LINKER_VERSION$4 = '12.0.0';
|
|
|
22153
22151
|
function compileDeclareFactoryFunction(meta) {
|
|
22154
22152
|
const definitionMap = new DefinitionMap();
|
|
22155
22153
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$4));
|
|
22156
|
-
definitionMap.set('version', literal('
|
|
22154
|
+
definitionMap.set('version', literal('14.0.0-next.10'));
|
|
22157
22155
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
22158
22156
|
definitionMap.set('type', meta.internalType);
|
|
22159
22157
|
definitionMap.set('deps', compileDependencies(meta.deps));
|
|
@@ -22195,7 +22193,7 @@ function compileDeclareInjectableFromMetadata(meta) {
|
|
|
22195
22193
|
function createInjectableDefinitionMap(meta) {
|
|
22196
22194
|
const definitionMap = new DefinitionMap();
|
|
22197
22195
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$3));
|
|
22198
|
-
definitionMap.set('version', literal('
|
|
22196
|
+
definitionMap.set('version', literal('14.0.0-next.10'));
|
|
22199
22197
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
22200
22198
|
definitionMap.set('type', meta.internalType);
|
|
22201
22199
|
// Only generate providedIn property if it has a non-null value
|
|
@@ -22253,7 +22251,7 @@ function compileDeclareInjectorFromMetadata(meta) {
|
|
|
22253
22251
|
function createInjectorDefinitionMap(meta) {
|
|
22254
22252
|
const definitionMap = new DefinitionMap();
|
|
22255
22253
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$2));
|
|
22256
|
-
definitionMap.set('version', literal('
|
|
22254
|
+
definitionMap.set('version', literal('14.0.0-next.10'));
|
|
22257
22255
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
22258
22256
|
definitionMap.set('type', meta.internalType);
|
|
22259
22257
|
definitionMap.set('providers', meta.providers);
|
|
@@ -22290,7 +22288,7 @@ function compileDeclareNgModuleFromMetadata(meta) {
|
|
|
22290
22288
|
function createNgModuleDefinitionMap(meta) {
|
|
22291
22289
|
const definitionMap = new DefinitionMap();
|
|
22292
22290
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$1));
|
|
22293
|
-
definitionMap.set('version', literal('
|
|
22291
|
+
definitionMap.set('version', literal('14.0.0-next.10'));
|
|
22294
22292
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
22295
22293
|
definitionMap.set('type', meta.internalType);
|
|
22296
22294
|
// We only generate the keys in the metadata if the arrays contain values.
|
|
@@ -22348,7 +22346,7 @@ function compileDeclarePipeFromMetadata(meta) {
|
|
|
22348
22346
|
function createPipeDefinitionMap(meta) {
|
|
22349
22347
|
const definitionMap = new DefinitionMap();
|
|
22350
22348
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION));
|
|
22351
|
-
definitionMap.set('version', literal('
|
|
22349
|
+
definitionMap.set('version', literal('14.0.0-next.10'));
|
|
22352
22350
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
22353
22351
|
// e.g. `type: MyPipe`
|
|
22354
22352
|
definitionMap.set('type', meta.internalType);
|
|
@@ -22398,5 +22396,5 @@ publishFacade(_global);
|
|
|
22398
22396
|
* found in the LICENSE file at https://angular.io/license
|
|
22399
22397
|
*/
|
|
22400
22398
|
|
|
22401
|
-
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,
|
|
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 };
|
|
22402
22400
|
//# sourceMappingURL=compiler.mjs.map
|