@angular/core 21.0.0-next.4 → 21.0.0-next.6
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/fesm2022/{attribute.mjs → _attribute-chunk.mjs} +2 -2
- package/fesm2022/_attribute-chunk.mjs.map +1 -0
- package/fesm2022/{debug_node.mjs → _debug_node-chunk.mjs} +70 -69
- package/fesm2022/_debug_node-chunk.mjs.map +1 -0
- package/fesm2022/{effect.mjs → _effect-chunk.mjs} +5 -6
- package/fesm2022/_effect-chunk.mjs.map +1 -0
- package/fesm2022/{not_found.mjs → _not_found-chunk.mjs} +2 -2
- package/fesm2022/_not_found-chunk.mjs.map +1 -0
- package/fesm2022/{resource.mjs → _resource-chunk.mjs} +9 -8
- package/fesm2022/_resource-chunk.mjs.map +1 -0
- package/fesm2022/{root_effect_scheduler.mjs → _root_effect_scheduler-chunk.mjs} +11 -11
- package/fesm2022/_root_effect_scheduler-chunk.mjs.map +1 -0
- package/fesm2022/{signal.mjs → _signal-chunk.mjs} +9 -9
- package/fesm2022/_signal-chunk.mjs.map +1 -0
- package/fesm2022/{weak_ref.mjs → _weak_ref-chunk.mjs} +2 -2
- package/fesm2022/_weak_ref-chunk.mjs.map +1 -0
- package/fesm2022/core.mjs +21 -22
- package/fesm2022/core.mjs.map +1 -1
- package/fesm2022/{primitives/di.mjs → primitives-di.mjs} +3 -3
- package/fesm2022/primitives-di.mjs.map +1 -0
- package/fesm2022/{primitives/event-dispatch.mjs → primitives-event-dispatch.mjs} +3 -3
- package/fesm2022/primitives-event-dispatch.mjs.map +1 -0
- package/fesm2022/primitives-signals.mjs +221 -0
- package/fesm2022/primitives-signals.mjs.map +1 -0
- package/fesm2022/rxjs-interop.mjs +6 -6
- package/fesm2022/rxjs-interop.mjs.map +1 -1
- package/fesm2022/testing.mjs +6 -6
- package/fesm2022/testing.mjs.map +1 -1
- package/package.json +12 -12
- package/schematics/bundles/add-bootstrap-context-to-server-main.cjs +5 -5
- package/schematics/bundles/application-config-core.cjs +5 -5
- package/schematics/bundles/{apply_import_manager-DroqamMP.cjs → apply_import_manager-pLtndDki.cjs} +3 -3
- package/schematics/bundles/bootstrap-options-migration.cjs +13 -91
- package/schematics/bundles/cleanup-unused-imports.cjs +5 -5
- package/schematics/bundles/{compiler_host-aKaS4KRz.cjs → compiler_host-BJEh7-L1.cjs} +2 -2
- package/schematics/bundles/control-flow-migration.cjs +71 -39
- package/schematics/bundles/imports-DwPXlGFl.cjs +1 -1
- package/schematics/bundles/{index-BI97t1U8.cjs → index-DCfgOEYE.cjs} +55 -45
- package/schematics/bundles/{index-DaB-z4lP.cjs → index-bqpULzLD.cjs} +4 -6
- package/schematics/bundles/inject-migration.cjs +3 -3
- package/schematics/bundles/leading_space-D9nQ8UQC.cjs +1 -1
- package/schematics/bundles/{migrate_ts_type_references-DPuwhGod.cjs → migrate_ts_type_references-COE6BA7E.cjs} +5 -5
- package/schematics/bundles/{ng_component_template-CytqBs-q.cjs → ng_component_template-pDoKlgPP.cjs} +2 -2
- package/schematics/bundles/ng_decorators-BI0uV7KI.cjs +1 -1
- package/schematics/bundles/ngclass-to-class-migration.cjs +108 -96
- package/schematics/bundles/ngstyle-to-style-migration.cjs +7 -7
- package/schematics/bundles/nodes-B16H9JUd.cjs +1 -1
- package/schematics/bundles/output-migration.cjs +6 -6
- package/schematics/bundles/{parse_html-CeQjkdOK.cjs → parse_html-B6fblY_V.cjs} +2 -2
- package/schematics/bundles/{project_paths-Cz4x-QiT.cjs → project_paths-i0Wjiiq1.cjs} +3 -3
- package/schematics/bundles/{project_tsconfig_paths-Clg7WX1w.cjs → project_tsconfig_paths-sFatqIE5.cjs} +330 -170
- package/schematics/bundles/property_name-BBwFuqMe.cjs +1 -1
- package/schematics/bundles/route-lazy-loading.cjs +3 -3
- package/schematics/bundles/router-current-navigation.cjs +4 -4
- package/schematics/bundles/router-last-successful-navigation.cjs +4 -4
- package/schematics/bundles/self-closing-tags-migration.cjs +6 -6
- package/schematics/bundles/signal-input-migration.cjs +67 -8
- package/schematics/bundles/signal-queries-migration.cjs +7 -7
- package/schematics/bundles/signals.cjs +7 -7
- package/schematics/bundles/standalone-migration.cjs +70 -43
- package/schematics/bundles/symbol-BObKoqes.cjs +1 -1
- package/schematics/migrations.json +1 -2
- package/{api.d.d.ts → types/_api-chunk.d.ts} +8 -5
- package/{chrome_dev_tools_performance.d.d.ts → types/_chrome_dev_tools_performance-chunk.d.ts} +3 -3
- package/{discovery.d.d.ts → types/_discovery-chunk.d.ts} +10 -9
- package/{effect.d.d.ts → types/_effect-chunk.d.ts} +2 -3
- package/{event_dispatcher.d.d.ts → types/_event_dispatcher-chunk.d.ts} +1 -1
- package/{graph.d.d.ts → types/_formatter-chunk.d.ts} +14 -2
- package/{weak_ref.d.d.ts → types/_weak_ref-chunk.d.ts} +1 -1
- package/{index.d.ts → types/core.d.ts} +21 -24
- package/{primitives/di/index.d.ts → types/primitives-di.d.ts} +1 -1
- package/{primitives/event-dispatch/index.d.ts → types/primitives-event-dispatch.d.ts} +3 -3
- package/{primitives/signals/index.d.ts → types/primitives-signals.d.ts} +6 -7
- package/{rxjs-interop/index.d.ts → types/rxjs-interop.d.ts} +5 -5
- package/{testing/index.d.ts → types/testing.d.ts} +6 -6
- package/fesm2022/attribute.mjs.map +0 -1
- package/fesm2022/debug_node.mjs.map +0 -1
- package/fesm2022/effect.mjs.map +0 -1
- package/fesm2022/not_found.mjs.map +0 -1
- package/fesm2022/primitives/di.mjs.map +0 -1
- package/fesm2022/primitives/event-dispatch.mjs.map +0 -1
- package/fesm2022/primitives/signals.mjs +0 -89
- package/fesm2022/primitives/signals.mjs.map +0 -1
- package/fesm2022/resource.mjs.map +0 -1
- package/fesm2022/root_effect_scheduler.mjs.map +0 -1
- package/fesm2022/signal.mjs.map +0 -1
- package/fesm2022/weak_ref.mjs.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
/**
|
|
3
|
-
* @license Angular v21.0.0-next.
|
|
3
|
+
* @license Angular v21.0.0-next.6
|
|
4
4
|
* (c) 2010-2025 Google LLC. https://angular.io/
|
|
5
5
|
* License: MIT
|
|
6
6
|
*/
|
|
@@ -1233,6 +1233,27 @@ class InstantiateExpr extends Expression {
|
|
|
1233
1233
|
return new InstantiateExpr(this.classExpr.clone(), this.args.map((arg) => arg.clone()), this.type, this.sourceSpan);
|
|
1234
1234
|
}
|
|
1235
1235
|
}
|
|
1236
|
+
let RegularExpressionLiteral$1 = class RegularExpressionLiteral extends Expression {
|
|
1237
|
+
body;
|
|
1238
|
+
flags;
|
|
1239
|
+
constructor(body, flags, sourceSpan) {
|
|
1240
|
+
super(null, sourceSpan);
|
|
1241
|
+
this.body = body;
|
|
1242
|
+
this.flags = flags;
|
|
1243
|
+
}
|
|
1244
|
+
isEquivalent(e) {
|
|
1245
|
+
return e instanceof RegularExpressionLiteral && this.body === e.body && this.flags === e.flags;
|
|
1246
|
+
}
|
|
1247
|
+
isConstant() {
|
|
1248
|
+
return true;
|
|
1249
|
+
}
|
|
1250
|
+
visitExpression(visitor, context) {
|
|
1251
|
+
return visitor.visitRegularExpressionLiteral(this, context);
|
|
1252
|
+
}
|
|
1253
|
+
clone() {
|
|
1254
|
+
return new RegularExpressionLiteral(this.body, this.flags, this.sourceSpan);
|
|
1255
|
+
}
|
|
1256
|
+
};
|
|
1236
1257
|
class LiteralExpr extends Expression {
|
|
1237
1258
|
value;
|
|
1238
1259
|
constructor(value, type, sourceSpan) {
|
|
@@ -2007,6 +2028,9 @@ let RecursiveAstVisitor$1 = class RecursiveAstVisitor {
|
|
|
2007
2028
|
visitLiteralExpr(ast, context) {
|
|
2008
2029
|
return this.visitExpression(ast, context);
|
|
2009
2030
|
}
|
|
2031
|
+
visitRegularExpressionLiteral(ast, context) {
|
|
2032
|
+
return this.visitExpression(ast, context);
|
|
2033
|
+
}
|
|
2010
2034
|
visitLocalizedString(ast, context) {
|
|
2011
2035
|
return this.visitExpression(ast, context);
|
|
2012
2036
|
}
|
|
@@ -2447,6 +2471,9 @@ class GenericKeyFn {
|
|
|
2447
2471
|
else if (expr instanceof LiteralExpr) {
|
|
2448
2472
|
return String(expr.value);
|
|
2449
2473
|
}
|
|
2474
|
+
else if (expr instanceof RegularExpressionLiteral$1) {
|
|
2475
|
+
return `/${expr.body}/${expr.flags ?? ''}`;
|
|
2476
|
+
}
|
|
2450
2477
|
else if (expr instanceof LiteralArrayExpr) {
|
|
2451
2478
|
const entries = [];
|
|
2452
2479
|
for (const entry of expr.entries) {
|
|
@@ -3441,6 +3468,10 @@ class AbstractEmitterVisitor {
|
|
|
3441
3468
|
}
|
|
3442
3469
|
return null;
|
|
3443
3470
|
}
|
|
3471
|
+
visitRegularExpressionLiteral(ast, ctx) {
|
|
3472
|
+
ctx.print(ast, `/${ast.body}/${ast.flags || ''}`);
|
|
3473
|
+
return null;
|
|
3474
|
+
}
|
|
3444
3475
|
visitLocalizedString(ast, ctx) {
|
|
3445
3476
|
const head = ast.serializeI18nHead();
|
|
3446
3477
|
ctx.print(ast, '$localize `' + head.raw);
|
|
@@ -4249,6 +4280,18 @@ class ParenthesizedExpression extends AST {
|
|
|
4249
4280
|
return visitor.visitParenthesizedExpression(this, context);
|
|
4250
4281
|
}
|
|
4251
4282
|
}
|
|
4283
|
+
class RegularExpressionLiteral extends AST {
|
|
4284
|
+
body;
|
|
4285
|
+
flags;
|
|
4286
|
+
constructor(span, sourceSpan, body, flags) {
|
|
4287
|
+
super(span, sourceSpan);
|
|
4288
|
+
this.body = body;
|
|
4289
|
+
this.flags = flags;
|
|
4290
|
+
}
|
|
4291
|
+
visit(visitor, context) {
|
|
4292
|
+
return visitor.visitRegularExpressionLiteral(this, context);
|
|
4293
|
+
}
|
|
4294
|
+
}
|
|
4252
4295
|
/**
|
|
4253
4296
|
* Records the absolute position of a text span in a source file, where `start` and `end` are the
|
|
4254
4297
|
* starting and ending byte offsets, respectively, of the text span in a source file.
|
|
@@ -4409,6 +4452,7 @@ class RecursiveAstVisitor {
|
|
|
4409
4452
|
visitParenthesizedExpression(ast, context) {
|
|
4410
4453
|
this.visit(ast.expression, context);
|
|
4411
4454
|
}
|
|
4455
|
+
visitRegularExpressionLiteral(ast, context) { }
|
|
4412
4456
|
// This is not part of the AstVisitor interface, just a helper method
|
|
4413
4457
|
visitAll(asts, context) {
|
|
4414
4458
|
for (const ast of asts) {
|
|
@@ -6260,48 +6304,6 @@ function createFactoryFunction(type) {
|
|
|
6260
6304
|
return arrowFn([t], type.prop('ɵfac').callFn([variable(t.name)]));
|
|
6261
6305
|
}
|
|
6262
6306
|
|
|
6263
|
-
const UNUSABLE_INTERPOLATION_REGEXPS = [
|
|
6264
|
-
/@/, // control flow reserved symbol
|
|
6265
|
-
/^\s*$/, // empty
|
|
6266
|
-
/[<>]/, // html tag
|
|
6267
|
-
/^[{}]$/, // i18n expansion
|
|
6268
|
-
/&(#|[a-z])/i, // character reference,
|
|
6269
|
-
/^\/\//, // comment
|
|
6270
|
-
];
|
|
6271
|
-
function assertInterpolationSymbols(identifier, value) {
|
|
6272
|
-
if (value != null && !(Array.isArray(value) && value.length == 2)) {
|
|
6273
|
-
throw new Error(`Expected '${identifier}' to be an array, [start, end].`);
|
|
6274
|
-
}
|
|
6275
|
-
else if (value != null) {
|
|
6276
|
-
const start = value[0];
|
|
6277
|
-
const end = value[1];
|
|
6278
|
-
// Check for unusable interpolation symbols
|
|
6279
|
-
UNUSABLE_INTERPOLATION_REGEXPS.forEach((regexp) => {
|
|
6280
|
-
if (regexp.test(start) || regexp.test(end)) {
|
|
6281
|
-
throw new Error(`['${start}', '${end}'] contains unusable interpolation symbol.`);
|
|
6282
|
-
}
|
|
6283
|
-
});
|
|
6284
|
-
}
|
|
6285
|
-
}
|
|
6286
|
-
|
|
6287
|
-
class InterpolationConfig {
|
|
6288
|
-
start;
|
|
6289
|
-
end;
|
|
6290
|
-
static fromArray(markers) {
|
|
6291
|
-
if (!markers) {
|
|
6292
|
-
return DEFAULT_INTERPOLATION_CONFIG;
|
|
6293
|
-
}
|
|
6294
|
-
assertInterpolationSymbols('interpolation', markers);
|
|
6295
|
-
return new InterpolationConfig(markers[0], markers[1]);
|
|
6296
|
-
}
|
|
6297
|
-
constructor(start, end) {
|
|
6298
|
-
this.start = start;
|
|
6299
|
-
this.end = end;
|
|
6300
|
-
}
|
|
6301
|
-
}
|
|
6302
|
-
const DEFAULT_INTERPOLATION_CONFIG = new InterpolationConfig('{{', '}}');
|
|
6303
|
-
const DEFAULT_CONTAINER_BLOCKS = new Set(['switch']);
|
|
6304
|
-
|
|
6305
6307
|
const $EOF = 0;
|
|
6306
6308
|
const $BSPACE = 8;
|
|
6307
6309
|
const $TAB = 9;
|
|
@@ -10324,7 +10326,8 @@ function transformExpressionsInExpression(expr, transform, flags) {
|
|
|
10324
10326
|
}
|
|
10325
10327
|
else if (expr instanceof ReadVarExpr ||
|
|
10326
10328
|
expr instanceof ExternalExpr ||
|
|
10327
|
-
expr instanceof LiteralExpr
|
|
10329
|
+
expr instanceof LiteralExpr ||
|
|
10330
|
+
expr instanceof RegularExpressionLiteral$1) ;
|
|
10328
10331
|
else {
|
|
10329
10332
|
throw new Error(`Unhandled expression kind: ${expr.constructor.name}`);
|
|
10330
10333
|
}
|
|
@@ -11702,6 +11705,16 @@ function extractAttributeOp(unit, op, elements) {
|
|
|
11702
11705
|
}
|
|
11703
11706
|
}
|
|
11704
11707
|
|
|
11708
|
+
const ARIA_PREFIX = 'aria-';
|
|
11709
|
+
/**
|
|
11710
|
+
* Returns whether `name` is an ARIA attribute name.
|
|
11711
|
+
*
|
|
11712
|
+
* This is a heuristic based on whether name begins with and is longer than `aria-`.
|
|
11713
|
+
*/
|
|
11714
|
+
function isAriaAttribute(name) {
|
|
11715
|
+
return name.startsWith(ARIA_PREFIX) && name.length > ARIA_PREFIX.length;
|
|
11716
|
+
}
|
|
11717
|
+
|
|
11705
11718
|
/**
|
|
11706
11719
|
* Looks up an element in the given map by xref ID.
|
|
11707
11720
|
*/
|
|
@@ -11747,7 +11760,15 @@ function specializeBindings(job) {
|
|
|
11747
11760
|
break;
|
|
11748
11761
|
case BindingKind.Property:
|
|
11749
11762
|
case BindingKind.LegacyAnimation:
|
|
11750
|
-
|
|
11763
|
+
// Convert a property binding targeting an ARIA attribute (e.g. [aria-label]) into an
|
|
11764
|
+
// attribute binding when we know it can't also target an input. Note that a `Host` job is
|
|
11765
|
+
// always `DomOnly`, so this condition must be checked first.
|
|
11766
|
+
if (job.mode === TemplateCompilationMode.DomOnly && isAriaAttribute(op.name)) {
|
|
11767
|
+
OpList.replace(op, createAttributeOp(op.target,
|
|
11768
|
+
/* namespace= */ null, op.name, op.expression, op.securityContext,
|
|
11769
|
+
/* isTextAttribute= */ false, op.isStructuralTemplateAttribute, op.templateKind, op.i18nMessage, op.sourceSpan));
|
|
11770
|
+
}
|
|
11771
|
+
else if (job.kind === CompilationJobKind.Host) {
|
|
11751
11772
|
OpList.replace(op, createDomPropertyOp(op.name, op.expression, op.bindingKind, op.i18nContext, op.securityContext, op.sourceSpan));
|
|
11752
11773
|
}
|
|
11753
11774
|
else {
|
|
@@ -15873,12 +15894,15 @@ const SUPPORTED_BLOCKS = [
|
|
|
15873
15894
|
'@loading',
|
|
15874
15895
|
'@error',
|
|
15875
15896
|
];
|
|
15897
|
+
const INTERPOLATION = {
|
|
15898
|
+
start: '{{',
|
|
15899
|
+
end: '}}',
|
|
15900
|
+
};
|
|
15876
15901
|
// See https://www.w3.org/TR/html51/syntax.html#writing-html-documents
|
|
15877
15902
|
class _Tokenizer {
|
|
15878
15903
|
_getTagDefinition;
|
|
15879
15904
|
_cursor;
|
|
15880
15905
|
_tokenizeIcu;
|
|
15881
|
-
_interpolationConfig;
|
|
15882
15906
|
_leadingTriviaCodePoints;
|
|
15883
15907
|
_currentTokenStart = null;
|
|
15884
15908
|
_currentTokenType = null;
|
|
@@ -15901,7 +15925,6 @@ class _Tokenizer {
|
|
|
15901
15925
|
constructor(_file, _getTagDefinition, options) {
|
|
15902
15926
|
this._getTagDefinition = _getTagDefinition;
|
|
15903
15927
|
this._tokenizeIcu = options.tokenizeExpansionForms || false;
|
|
15904
|
-
this._interpolationConfig = options.interpolationConfig || DEFAULT_INTERPOLATION_CONFIG;
|
|
15905
15928
|
this._leadingTriviaCodePoints =
|
|
15906
15929
|
options.leadingTriviaChars && options.leadingTriviaChars.map((c) => c.codePointAt(0) || 0);
|
|
15907
15930
|
const range = options.range || {
|
|
@@ -16732,7 +16755,7 @@ class _Tokenizer {
|
|
|
16732
16755
|
const parts = [];
|
|
16733
16756
|
while (!endPredicate()) {
|
|
16734
16757
|
const current = this._cursor.clone();
|
|
16735
|
-
if (this.
|
|
16758
|
+
if (this._attemptStr(INTERPOLATION.start)) {
|
|
16736
16759
|
this._endToken([this._processCarriageReturns(parts.join(''))], current);
|
|
16737
16760
|
parts.length = 0;
|
|
16738
16761
|
this._consumeInterpolation(interpolationTokenType, current, endInterpolation);
|
|
@@ -16764,7 +16787,7 @@ class _Tokenizer {
|
|
|
16764
16787
|
_consumeInterpolation(interpolationTokenType, interpolationStart, prematureEndPredicate) {
|
|
16765
16788
|
const parts = [];
|
|
16766
16789
|
this._beginToken(interpolationTokenType, interpolationStart);
|
|
16767
|
-
parts.push(
|
|
16790
|
+
parts.push(INTERPOLATION.start);
|
|
16768
16791
|
// Find the end of the interpolation, ignoring content inside quotes.
|
|
16769
16792
|
const expressionStart = this._cursor.clone();
|
|
16770
16793
|
let inQuote = null;
|
|
@@ -16782,10 +16805,10 @@ class _Tokenizer {
|
|
|
16782
16805
|
return;
|
|
16783
16806
|
}
|
|
16784
16807
|
if (inQuote === null) {
|
|
16785
|
-
if (this._attemptStr(
|
|
16808
|
+
if (this._attemptStr(INTERPOLATION.end)) {
|
|
16786
16809
|
// We are not in a string, and we hit the end interpolation marker
|
|
16787
16810
|
parts.push(this._getProcessedChars(expressionStart, current));
|
|
16788
|
-
parts.push(
|
|
16811
|
+
parts.push(INTERPOLATION.end);
|
|
16789
16812
|
this._endToken(parts);
|
|
16790
16813
|
return;
|
|
16791
16814
|
}
|
|
@@ -16924,13 +16947,10 @@ class _Tokenizer {
|
|
|
16924
16947
|
if (this._cursor.peek() !== $LBRACE) {
|
|
16925
16948
|
return false;
|
|
16926
16949
|
}
|
|
16927
|
-
|
|
16928
|
-
|
|
16929
|
-
|
|
16930
|
-
|
|
16931
|
-
return !isInterpolation;
|
|
16932
|
-
}
|
|
16933
|
-
return true;
|
|
16950
|
+
const start = this._cursor.clone();
|
|
16951
|
+
const isInterpolation = this._attemptStr(INTERPOLATION.start);
|
|
16952
|
+
this._cursor = start;
|
|
16953
|
+
return !isInterpolation;
|
|
16934
16954
|
}
|
|
16935
16955
|
}
|
|
16936
16956
|
function isNotWhitespace(code) {
|
|
@@ -18133,7 +18153,9 @@ var TokenType;
|
|
|
18133
18153
|
TokenType[TokenType["String"] = 4] = "String";
|
|
18134
18154
|
TokenType[TokenType["Operator"] = 5] = "Operator";
|
|
18135
18155
|
TokenType[TokenType["Number"] = 6] = "Number";
|
|
18136
|
-
TokenType[TokenType["
|
|
18156
|
+
TokenType[TokenType["RegExpBody"] = 7] = "RegExpBody";
|
|
18157
|
+
TokenType[TokenType["RegExpFlags"] = 8] = "RegExpFlags";
|
|
18158
|
+
TokenType[TokenType["Error"] = 9] = "Error";
|
|
18137
18159
|
})(TokenType || (TokenType = {}));
|
|
18138
18160
|
var StringTokenKind;
|
|
18139
18161
|
(function (StringTokenKind) {
|
|
@@ -18228,6 +18250,12 @@ class Token {
|
|
|
18228
18250
|
isError() {
|
|
18229
18251
|
return this.type === TokenType.Error;
|
|
18230
18252
|
}
|
|
18253
|
+
isRegExpBody() {
|
|
18254
|
+
return this.type === TokenType.RegExpBody;
|
|
18255
|
+
}
|
|
18256
|
+
isRegExpFlags() {
|
|
18257
|
+
return this.type === TokenType.RegExpFlags;
|
|
18258
|
+
}
|
|
18231
18259
|
toNumber() {
|
|
18232
18260
|
return this.type === TokenType.Number ? this.numValue : -1;
|
|
18233
18261
|
}
|
|
@@ -18242,9 +18270,6 @@ class Token {
|
|
|
18242
18270
|
isTemplateLiteralInterpolationStart() {
|
|
18243
18271
|
return this.isOperator('${');
|
|
18244
18272
|
}
|
|
18245
|
-
isTemplateLiteralInterpolationEnd() {
|
|
18246
|
-
return this.isOperator('}');
|
|
18247
|
-
}
|
|
18248
18273
|
toString() {
|
|
18249
18274
|
switch (this.type) {
|
|
18250
18275
|
case TokenType.Character:
|
|
@@ -18254,6 +18279,8 @@ class Token {
|
|
|
18254
18279
|
case TokenType.PrivateIdentifier:
|
|
18255
18280
|
case TokenType.String:
|
|
18256
18281
|
case TokenType.Error:
|
|
18282
|
+
case TokenType.RegExpBody:
|
|
18283
|
+
case TokenType.RegExpFlags:
|
|
18257
18284
|
return this.strValue;
|
|
18258
18285
|
case TokenType.Number:
|
|
18259
18286
|
return this.numValue.toString();
|
|
@@ -18290,6 +18317,12 @@ function newNumberToken(index, end, n) {
|
|
|
18290
18317
|
function newErrorToken(index, end, message) {
|
|
18291
18318
|
return new Token(index, end, TokenType.Error, 0, message);
|
|
18292
18319
|
}
|
|
18320
|
+
function newRegExpBodyToken(index, end, text) {
|
|
18321
|
+
return new Token(index, end, TokenType.RegExpBody, 0, text);
|
|
18322
|
+
}
|
|
18323
|
+
function newRegExpFlagsToken(index, end, text) {
|
|
18324
|
+
return new Token(index, end, TokenType.RegExpFlags, 0, text);
|
|
18325
|
+
}
|
|
18293
18326
|
const EOF = new Token(-1, -1, TokenType.Character, 0, '');
|
|
18294
18327
|
class _Scanner {
|
|
18295
18328
|
input;
|
|
@@ -18373,7 +18406,9 @@ class _Scanner {
|
|
|
18373
18406
|
case $MINUS:
|
|
18374
18407
|
return this.scanComplexOperator(start, '-', $EQ, '=');
|
|
18375
18408
|
case $SLASH:
|
|
18376
|
-
return this.
|
|
18409
|
+
return this.isStartOfRegex()
|
|
18410
|
+
? this.scanRegex(index)
|
|
18411
|
+
: this.scanComplexOperator(start, '/', $EQ, '=');
|
|
18377
18412
|
case $PERCENT:
|
|
18378
18413
|
return this.scanComplexOperator(start, '%', $EQ, '=');
|
|
18379
18414
|
case $CARET:
|
|
@@ -18417,7 +18452,7 @@ class _Scanner {
|
|
|
18417
18452
|
this.advance();
|
|
18418
18453
|
const currentBrace = this.braceStack.pop();
|
|
18419
18454
|
if (currentBrace === 'interpolation') {
|
|
18420
|
-
this.tokens.push(
|
|
18455
|
+
this.tokens.push(newCharacterToken(start, this.index, $RBRACE));
|
|
18421
18456
|
return this.scanTemplateLiteralPart(this.index);
|
|
18422
18457
|
}
|
|
18423
18458
|
return newCharacterToken(start, this.index, code);
|
|
@@ -18636,6 +18671,81 @@ class _Scanner {
|
|
|
18636
18671
|
}
|
|
18637
18672
|
return newOperatorToken(start, this.index, operator);
|
|
18638
18673
|
}
|
|
18674
|
+
isStartOfRegex() {
|
|
18675
|
+
if (this.tokens.length === 0) {
|
|
18676
|
+
return true;
|
|
18677
|
+
}
|
|
18678
|
+
const prevToken = this.tokens[this.tokens.length - 1];
|
|
18679
|
+
// If a slash is preceded by a `!` operator, we need to distinguish whether it's a
|
|
18680
|
+
// negation or a non-null assertion. Regexes can only be precded by negations.
|
|
18681
|
+
if (prevToken.isOperator('!')) {
|
|
18682
|
+
const beforePrevToken = this.tokens.length > 1 ? this.tokens[this.tokens.length - 2] : null;
|
|
18683
|
+
const isNegation = beforePrevToken === null ||
|
|
18684
|
+
(beforePrevToken.type !== TokenType.Identifier &&
|
|
18685
|
+
!beforePrevToken.isCharacter($RPAREN) &&
|
|
18686
|
+
!beforePrevToken.isCharacter($RBRACKET));
|
|
18687
|
+
return isNegation;
|
|
18688
|
+
}
|
|
18689
|
+
// Only consider the slash a regex if it's preceded either by:
|
|
18690
|
+
// - Any operator, aside from `!` which is special-cased above.
|
|
18691
|
+
// - Opening paren (e.g. `(/a/)`).
|
|
18692
|
+
// - Opening bracket (e.g. `[/a/]`).
|
|
18693
|
+
// - A comma (e.g. `[1, /a/]`).
|
|
18694
|
+
// - A colon (e.g. `{foo: /a/}`).
|
|
18695
|
+
return (prevToken.type === TokenType.Operator ||
|
|
18696
|
+
prevToken.isCharacter($LPAREN) ||
|
|
18697
|
+
prevToken.isCharacter($LBRACKET) ||
|
|
18698
|
+
prevToken.isCharacter($COMMA) ||
|
|
18699
|
+
prevToken.isCharacter($COLON));
|
|
18700
|
+
}
|
|
18701
|
+
scanRegex(tokenStart) {
|
|
18702
|
+
this.advance();
|
|
18703
|
+
const textStart = this.index;
|
|
18704
|
+
let inEscape = false;
|
|
18705
|
+
let inCharacterClass = false;
|
|
18706
|
+
while (true) {
|
|
18707
|
+
const peek = this.peek;
|
|
18708
|
+
if (peek === $EOF) {
|
|
18709
|
+
return this.error('Unterminated regular expression', 0);
|
|
18710
|
+
}
|
|
18711
|
+
if (inEscape) {
|
|
18712
|
+
inEscape = false;
|
|
18713
|
+
}
|
|
18714
|
+
else if (peek === $BACKSLASH) {
|
|
18715
|
+
inEscape = true;
|
|
18716
|
+
}
|
|
18717
|
+
else if (peek === $LBRACKET) {
|
|
18718
|
+
inCharacterClass = true;
|
|
18719
|
+
}
|
|
18720
|
+
else if (peek === $RBRACKET) {
|
|
18721
|
+
inCharacterClass = false;
|
|
18722
|
+
}
|
|
18723
|
+
else if (peek === $SLASH && !inCharacterClass) {
|
|
18724
|
+
break;
|
|
18725
|
+
}
|
|
18726
|
+
this.advance();
|
|
18727
|
+
}
|
|
18728
|
+
// Note that we want the text without the slashes,
|
|
18729
|
+
// but we still want the slashes to be part of the span.
|
|
18730
|
+
const value = this.input.substring(textStart, this.index);
|
|
18731
|
+
this.advance();
|
|
18732
|
+
const bodyToken = newRegExpBodyToken(tokenStart, this.index, value);
|
|
18733
|
+
const flagsToken = this.scanRegexFlags(this.index);
|
|
18734
|
+
if (flagsToken !== null) {
|
|
18735
|
+
this.tokens.push(bodyToken);
|
|
18736
|
+
return flagsToken;
|
|
18737
|
+
}
|
|
18738
|
+
return bodyToken;
|
|
18739
|
+
}
|
|
18740
|
+
scanRegexFlags(start) {
|
|
18741
|
+
if (!isAsciiLetter(this.peek)) {
|
|
18742
|
+
return null;
|
|
18743
|
+
}
|
|
18744
|
+
while (isAsciiLetter(this.peek)) {
|
|
18745
|
+
this.advance();
|
|
18746
|
+
}
|
|
18747
|
+
return newRegExpFlagsToken(start, this.index, this.input.substring(start, this.index));
|
|
18748
|
+
}
|
|
18639
18749
|
}
|
|
18640
18750
|
function isIdentifierStart(code) {
|
|
18641
18751
|
return (($a <= code && code <= $z) ||
|
|
@@ -18706,17 +18816,17 @@ class Parser {
|
|
|
18706
18816
|
this._lexer = _lexer;
|
|
18707
18817
|
this._supportsDirectPipeReferences = _supportsDirectPipeReferences;
|
|
18708
18818
|
}
|
|
18709
|
-
parseAction(input, parseSourceSpan, absoluteOffset
|
|
18819
|
+
parseAction(input, parseSourceSpan, absoluteOffset) {
|
|
18710
18820
|
const errors = [];
|
|
18711
|
-
this._checkNoInterpolation(errors, input, parseSourceSpan
|
|
18821
|
+
this._checkNoInterpolation(errors, input, parseSourceSpan);
|
|
18712
18822
|
const { stripped: sourceToLex } = this._stripComments(input);
|
|
18713
18823
|
const tokens = this._lexer.tokenize(sourceToLex);
|
|
18714
18824
|
const ast = new _ParseAST(input, parseSourceSpan, absoluteOffset, tokens, 1 /* ParseFlags.Action */, errors, 0, this._supportsDirectPipeReferences).parseChain();
|
|
18715
18825
|
return new ASTWithSource(ast, input, getLocation(parseSourceSpan), absoluteOffset, errors);
|
|
18716
18826
|
}
|
|
18717
|
-
parseBinding(input, parseSourceSpan, absoluteOffset
|
|
18827
|
+
parseBinding(input, parseSourceSpan, absoluteOffset) {
|
|
18718
18828
|
const errors = [];
|
|
18719
|
-
const ast = this._parseBindingAst(input, parseSourceSpan, absoluteOffset,
|
|
18829
|
+
const ast = this._parseBindingAst(input, parseSourceSpan, absoluteOffset, errors);
|
|
18720
18830
|
return new ASTWithSource(ast, input, getLocation(parseSourceSpan), absoluteOffset, errors);
|
|
18721
18831
|
}
|
|
18722
18832
|
checkSimpleExpression(ast) {
|
|
@@ -18725,17 +18835,17 @@ class Parser {
|
|
|
18725
18835
|
return checker.errors;
|
|
18726
18836
|
}
|
|
18727
18837
|
// Host bindings parsed here
|
|
18728
|
-
parseSimpleBinding(input, parseSourceSpan, absoluteOffset
|
|
18838
|
+
parseSimpleBinding(input, parseSourceSpan, absoluteOffset) {
|
|
18729
18839
|
const errors = [];
|
|
18730
|
-
const ast = this._parseBindingAst(input, parseSourceSpan, absoluteOffset,
|
|
18840
|
+
const ast = this._parseBindingAst(input, parseSourceSpan, absoluteOffset, errors);
|
|
18731
18841
|
const simplExpressionErrors = this.checkSimpleExpression(ast);
|
|
18732
18842
|
if (simplExpressionErrors.length > 0) {
|
|
18733
18843
|
errors.push(getParseError(`Host binding expression cannot contain ${simplExpressionErrors.join(' ')}`, input, '', parseSourceSpan));
|
|
18734
18844
|
}
|
|
18735
18845
|
return new ASTWithSource(ast, input, getLocation(parseSourceSpan), absoluteOffset, errors);
|
|
18736
18846
|
}
|
|
18737
|
-
_parseBindingAst(input, parseSourceSpan, absoluteOffset,
|
|
18738
|
-
this._checkNoInterpolation(errors, input, parseSourceSpan
|
|
18847
|
+
_parseBindingAst(input, parseSourceSpan, absoluteOffset, errors) {
|
|
18848
|
+
this._checkNoInterpolation(errors, input, parseSourceSpan);
|
|
18739
18849
|
const { stripped: sourceToLex } = this._stripComments(input);
|
|
18740
18850
|
const tokens = this._lexer.tokenize(sourceToLex);
|
|
18741
18851
|
return new _ParseAST(input, parseSourceSpan, absoluteOffset, tokens, 0 /* ParseFlags.None */, errors, 0, this._supportsDirectPipeReferences).parseChain();
|
|
@@ -18775,9 +18885,9 @@ class Parser {
|
|
|
18775
18885
|
span: new AbsoluteSourceSpan(absoluteKeyOffset, absoluteKeyOffset + templateKey.length),
|
|
18776
18886
|
});
|
|
18777
18887
|
}
|
|
18778
|
-
parseInterpolation(input, parseSourceSpan, absoluteOffset, interpolatedTokens
|
|
18888
|
+
parseInterpolation(input, parseSourceSpan, absoluteOffset, interpolatedTokens) {
|
|
18779
18889
|
const errors = [];
|
|
18780
|
-
const { strings, expressions, offsets } = this.splitInterpolation(input, parseSourceSpan, errors, interpolatedTokens
|
|
18890
|
+
const { strings, expressions, offsets } = this.splitInterpolation(input, parseSourceSpan, errors, interpolatedTokens);
|
|
18781
18891
|
if (expressions.length === 0)
|
|
18782
18892
|
return null;
|
|
18783
18893
|
const expressionNodes = [];
|
|
@@ -18824,7 +18934,7 @@ class Parser {
|
|
|
18824
18934
|
* `SplitInterpolation` with splits that look like
|
|
18825
18935
|
* <raw text> <expression> <raw text> ... <raw text> <expression> <raw text>
|
|
18826
18936
|
*/
|
|
18827
|
-
splitInterpolation(input, parseSourceSpan, errors, interpolatedTokens
|
|
18937
|
+
splitInterpolation(input, parseSourceSpan, errors, interpolatedTokens) {
|
|
18828
18938
|
const strings = [];
|
|
18829
18939
|
const expressions = [];
|
|
18830
18940
|
const offsets = [];
|
|
@@ -18834,7 +18944,8 @@ class Parser {
|
|
|
18834
18944
|
let i = 0;
|
|
18835
18945
|
let atInterpolation = false;
|
|
18836
18946
|
let extendLastString = false;
|
|
18837
|
-
|
|
18947
|
+
const interpStart = '{{';
|
|
18948
|
+
const interpEnd = '}}';
|
|
18838
18949
|
while (i < input.length) {
|
|
18839
18950
|
if (!atInterpolation) {
|
|
18840
18951
|
// parse until starting {{
|
|
@@ -18913,24 +19024,24 @@ class Parser {
|
|
|
18913
19024
|
}
|
|
18914
19025
|
return null;
|
|
18915
19026
|
}
|
|
18916
|
-
_checkNoInterpolation(errors, input, parseSourceSpan
|
|
19027
|
+
_checkNoInterpolation(errors, input, parseSourceSpan) {
|
|
18917
19028
|
let startIndex = -1;
|
|
18918
19029
|
let endIndex = -1;
|
|
18919
19030
|
for (const charIndex of this._forEachUnquotedChar(input, 0)) {
|
|
18920
19031
|
if (startIndex === -1) {
|
|
18921
|
-
if (input.startsWith(
|
|
19032
|
+
if (input.startsWith('{{')) {
|
|
18922
19033
|
startIndex = charIndex;
|
|
18923
19034
|
}
|
|
18924
19035
|
}
|
|
18925
19036
|
else {
|
|
18926
|
-
endIndex = this._getInterpolationEndIndex(input,
|
|
19037
|
+
endIndex = this._getInterpolationEndIndex(input, '}}', charIndex);
|
|
18927
19038
|
if (endIndex > -1) {
|
|
18928
19039
|
break;
|
|
18929
19040
|
}
|
|
18930
19041
|
}
|
|
18931
19042
|
}
|
|
18932
19043
|
if (startIndex > -1 && endIndex > -1) {
|
|
18933
|
-
errors.push(getParseError(`Got interpolation (
|
|
19044
|
+
errors.push(getParseError(`Got interpolation ({{}}) where expression was expected`, input, `at column ${startIndex} in`, parseSourceSpan));
|
|
18934
19045
|
}
|
|
18935
19046
|
}
|
|
18936
19047
|
/**
|
|
@@ -18987,6 +19098,8 @@ var ParseContextFlags;
|
|
|
18987
19098
|
*/
|
|
18988
19099
|
ParseContextFlags[ParseContextFlags["Writable"] = 1] = "Writable";
|
|
18989
19100
|
})(ParseContextFlags || (ParseContextFlags = {}));
|
|
19101
|
+
/** Possible flags that can be used in a regex literal. */
|
|
19102
|
+
const SUPPORTED_REGEX_FLAGS = new Set(['d', 'g', 'i', 'm', 's', 'u', 'v', 'y']);
|
|
18990
19103
|
class _ParseAST {
|
|
18991
19104
|
input;
|
|
18992
19105
|
parseSourceSpan;
|
|
@@ -19556,6 +19669,9 @@ class _ParseAST {
|
|
|
19556
19669
|
this._reportErrorForPrivateIdentifier(this.next, null);
|
|
19557
19670
|
return new EmptyExpr$1(this.span(start), this.sourceSpan(start));
|
|
19558
19671
|
}
|
|
19672
|
+
else if (this.next.isRegExpBody()) {
|
|
19673
|
+
return this.parseRegularExpressionLiteral();
|
|
19674
|
+
}
|
|
19559
19675
|
else if (this.index >= this.tokens.length) {
|
|
19560
19676
|
this.error(`Unexpected end of expression: ${this.input}`);
|
|
19561
19677
|
return new EmptyExpr$1(this.span(start), this.sourceSpan(start));
|
|
@@ -19911,6 +20027,7 @@ class _ParseAST {
|
|
|
19911
20027
|
}
|
|
19912
20028
|
else if (token.isTemplateLiteralInterpolationStart()) {
|
|
19913
20029
|
this.advance();
|
|
20030
|
+
this.rbracesExpected++;
|
|
19914
20031
|
const expression = this.parsePipe();
|
|
19915
20032
|
if (expression instanceof EmptyExpr$1) {
|
|
19916
20033
|
this.error('Template literal interpolation cannot be empty');
|
|
@@ -19918,6 +20035,7 @@ class _ParseAST {
|
|
|
19918
20035
|
else {
|
|
19919
20036
|
expressions.push(expression);
|
|
19920
20037
|
}
|
|
20038
|
+
this.rbracesExpected--;
|
|
19921
20039
|
}
|
|
19922
20040
|
else {
|
|
19923
20041
|
this.advance();
|
|
@@ -19925,6 +20043,35 @@ class _ParseAST {
|
|
|
19925
20043
|
}
|
|
19926
20044
|
return new TemplateLiteral(this.span(start), this.sourceSpan(start), elements, expressions);
|
|
19927
20045
|
}
|
|
20046
|
+
parseRegularExpressionLiteral() {
|
|
20047
|
+
const bodyToken = this.next;
|
|
20048
|
+
this.advance();
|
|
20049
|
+
if (!bodyToken.isRegExpBody()) {
|
|
20050
|
+
return new EmptyExpr$1(this.span(this.inputIndex), this.sourceSpan(this.inputIndex));
|
|
20051
|
+
}
|
|
20052
|
+
let flagsToken = null;
|
|
20053
|
+
if (this.next.isRegExpFlags()) {
|
|
20054
|
+
flagsToken = this.next;
|
|
20055
|
+
this.advance();
|
|
20056
|
+
const seenFlags = new Set();
|
|
20057
|
+
for (let i = 0; i < flagsToken.strValue.length; i++) {
|
|
20058
|
+
const char = flagsToken.strValue[i];
|
|
20059
|
+
if (!SUPPORTED_REGEX_FLAGS.has(char)) {
|
|
20060
|
+
this.error(`Unsupported regular expression flag "${char}". The supported flags are: ` +
|
|
20061
|
+
Array.from(SUPPORTED_REGEX_FLAGS, (f) => `"${f}"`).join(', '), flagsToken.index + i);
|
|
20062
|
+
}
|
|
20063
|
+
else if (seenFlags.has(char)) {
|
|
20064
|
+
this.error(`Duplicate regular expression flag "${char}"`, flagsToken.index + i);
|
|
20065
|
+
}
|
|
20066
|
+
else {
|
|
20067
|
+
seenFlags.add(char);
|
|
20068
|
+
}
|
|
20069
|
+
}
|
|
20070
|
+
}
|
|
20071
|
+
const start = bodyToken.index;
|
|
20072
|
+
const end = flagsToken ? flagsToken.end : bodyToken.end;
|
|
20073
|
+
return new RegularExpressionLiteral(this.span(start, end), this.sourceSpan(start, end), bodyToken.strValue, flagsToken ? flagsToken.strValue : null);
|
|
20074
|
+
}
|
|
19928
20075
|
/**
|
|
19929
20076
|
* Consume the optional statement terminator: semicolon or comma.
|
|
19930
20077
|
*/
|
|
@@ -20138,6 +20285,9 @@ class SerializeExpressionVisitor {
|
|
|
20138
20285
|
visitVoidExpression(ast, context) {
|
|
20139
20286
|
return `void ${ast.expression.visit(this, context)}`;
|
|
20140
20287
|
}
|
|
20288
|
+
visitRegularExpressionLiteral(ast, context) {
|
|
20289
|
+
return `/${ast.body}/${ast.flags || ''}`;
|
|
20290
|
+
}
|
|
20141
20291
|
visitASTWithSource(ast, context) {
|
|
20142
20292
|
return ast.ast.visit(this, context);
|
|
20143
20293
|
}
|
|
@@ -21059,10 +21209,10 @@ class PlaceholderRegistry {
|
|
|
21059
21209
|
|
|
21060
21210
|
const _expParser = new Parser(new Lexer());
|
|
21061
21211
|
/**
|
|
21062
|
-
* Returns a function converting html nodes to an i18n Message
|
|
21212
|
+
* Returns a function converting html nodes to an i18n Message
|
|
21063
21213
|
*/
|
|
21064
|
-
function createI18nMessageFactory(
|
|
21065
|
-
const visitor = new _I18nVisitor(_expParser,
|
|
21214
|
+
function createI18nMessageFactory(containerBlocks, retainEmptyTokens, preserveExpressionWhitespace) {
|
|
21215
|
+
const visitor = new _I18nVisitor(_expParser, containerBlocks, retainEmptyTokens, preserveExpressionWhitespace);
|
|
21066
21216
|
return (nodes, meaning, description, customId, visitNodeFn) => visitor.toI18nMessage(nodes, meaning, description, customId, visitNodeFn);
|
|
21067
21217
|
}
|
|
21068
21218
|
function noopVisitNodeFn(_html, i18n) {
|
|
@@ -21070,13 +21220,11 @@ function noopVisitNodeFn(_html, i18n) {
|
|
|
21070
21220
|
}
|
|
21071
21221
|
class _I18nVisitor {
|
|
21072
21222
|
_expressionParser;
|
|
21073
|
-
_interpolationConfig;
|
|
21074
21223
|
_containerBlocks;
|
|
21075
21224
|
_retainEmptyTokens;
|
|
21076
21225
|
_preserveExpressionWhitespace;
|
|
21077
|
-
constructor(_expressionParser,
|
|
21226
|
+
constructor(_expressionParser, _containerBlocks, _retainEmptyTokens, _preserveExpressionWhitespace) {
|
|
21078
21227
|
this._expressionParser = _expressionParser;
|
|
21079
|
-
this._interpolationConfig = _interpolationConfig;
|
|
21080
21228
|
this._containerBlocks = _containerBlocks;
|
|
21081
21229
|
this._retainEmptyTokens = _retainEmptyTokens;
|
|
21082
21230
|
this._preserveExpressionWhitespace = _preserveExpressionWhitespace;
|
|
@@ -21298,7 +21446,7 @@ class _I18nVisitor {
|
|
|
21298
21446
|
const expression = token.parts[1];
|
|
21299
21447
|
const expr = this._expressionParser.parseBinding(expression,
|
|
21300
21448
|
/* location */ token.sourceSpan,
|
|
21301
|
-
/* absoluteOffset */ token.sourceSpan.start.offset
|
|
21449
|
+
/* absoluteOffset */ token.sourceSpan.start.offset);
|
|
21302
21450
|
return serialize(expr);
|
|
21303
21451
|
}
|
|
21304
21452
|
}
|
|
@@ -21363,6 +21511,8 @@ function extractPlaceholderName(input) {
|
|
|
21363
21511
|
return input.split(_CUSTOM_PH_EXP)[2];
|
|
21364
21512
|
}
|
|
21365
21513
|
|
|
21514
|
+
const DEFAULT_CONTAINER_BLOCKS = new Set(['switch']);
|
|
21515
|
+
|
|
21366
21516
|
/**
|
|
21367
21517
|
* Set of tagName|propertyName corresponding to Trusted Types sinks. Properties applying to all
|
|
21368
21518
|
* tags use '*'.
|
|
@@ -21424,7 +21574,6 @@ const setI18nRefs = (originalNodeMap) => {
|
|
|
21424
21574
|
* stored with other element's and attribute's information.
|
|
21425
21575
|
*/
|
|
21426
21576
|
class I18nMetaVisitor {
|
|
21427
|
-
interpolationConfig;
|
|
21428
21577
|
keepI18nAttrs;
|
|
21429
21578
|
enableI18nLegacyMessageIdFormat;
|
|
21430
21579
|
containerBlocks;
|
|
@@ -21433,7 +21582,7 @@ class I18nMetaVisitor {
|
|
|
21433
21582
|
// whether visited nodes contain i18n information
|
|
21434
21583
|
hasI18nMeta = false;
|
|
21435
21584
|
_errors = [];
|
|
21436
|
-
constructor(
|
|
21585
|
+
constructor(keepI18nAttrs = false, enableI18nLegacyMessageIdFormat = false, containerBlocks = DEFAULT_CONTAINER_BLOCKS, preserveSignificantWhitespace = true,
|
|
21437
21586
|
// When dropping significant whitespace we need to retain empty tokens or
|
|
21438
21587
|
// else we won't be able to reuse source spans because empty tokens would be
|
|
21439
21588
|
// removed and cause a mismatch. Unfortunately this still needs to be
|
|
@@ -21441,7 +21590,6 @@ class I18nMetaVisitor {
|
|
|
21441
21590
|
// sure the number of nodes don't change between parses, even when
|
|
21442
21591
|
// `preserveSignificantWhitespace` changes.
|
|
21443
21592
|
retainEmptyTokens = !preserveSignificantWhitespace) {
|
|
21444
|
-
this.interpolationConfig = interpolationConfig;
|
|
21445
21593
|
this.keepI18nAttrs = keepI18nAttrs;
|
|
21446
21594
|
this.enableI18nLegacyMessageIdFormat = enableI18nLegacyMessageIdFormat;
|
|
21447
21595
|
this.containerBlocks = containerBlocks;
|
|
@@ -21450,7 +21598,7 @@ class I18nMetaVisitor {
|
|
|
21450
21598
|
}
|
|
21451
21599
|
_generateI18nMessage(nodes, meta = '', visitNodeFn) {
|
|
21452
21600
|
const { meaning, description, customId } = this._parseMetadata(meta);
|
|
21453
|
-
const createI18nMessage = createI18nMessageFactory(this.
|
|
21601
|
+
const createI18nMessage = createI18nMessageFactory(this.containerBlocks, this.retainEmptyTokens,
|
|
21454
21602
|
/* preserveExpressionWhitespace */ this.preserveSignificantWhitespace);
|
|
21455
21603
|
const message = createI18nMessage(nodes, meaning, description, customId, visitNodeFn);
|
|
21456
21604
|
this._setMessageId(message, meta);
|
|
@@ -23240,6 +23388,27 @@ function transformLiteralMap(expr) {
|
|
|
23240
23388
|
return new PureFunctionExpr(literalMap(derivedEntries), nonConstantArgs);
|
|
23241
23389
|
}
|
|
23242
23390
|
|
|
23391
|
+
/** Optimizes regular expressions used in expressions. */
|
|
23392
|
+
function optimizeRegularExpressions(job) {
|
|
23393
|
+
for (const view of job.units) {
|
|
23394
|
+
for (const op of view.ops()) {
|
|
23395
|
+
transformExpressionsInOp(op, (expr) => {
|
|
23396
|
+
if (expr instanceof RegularExpressionLiteral$1 &&
|
|
23397
|
+
// We can't optimize global regexes, because they're stateful.
|
|
23398
|
+
(expr.flags === null || !expr.flags.includes('g'))) {
|
|
23399
|
+
return job.pool.getSharedConstant(new RegularExpressionConstant(), expr);
|
|
23400
|
+
}
|
|
23401
|
+
return expr;
|
|
23402
|
+
}, VisitorContextFlag.None);
|
|
23403
|
+
}
|
|
23404
|
+
}
|
|
23405
|
+
}
|
|
23406
|
+
class RegularExpressionConstant extends GenericKeyFn {
|
|
23407
|
+
toSharedConstantDeclaration(declName, keyExpr) {
|
|
23408
|
+
return new DeclareVarStmt(declName, keyExpr, undefined, exports.StmtModifier.Final);
|
|
23409
|
+
}
|
|
23410
|
+
}
|
|
23411
|
+
|
|
23243
23412
|
// This file contains helpers for generating calls to Ivy instructions. In particular, each
|
|
23244
23413
|
// instruction type is represented as a function, which may select a specific instruction variant
|
|
23245
23414
|
// depending on the exact arguments.
|
|
@@ -23853,7 +24022,6 @@ function callVariadicInstruction(config, baseArgs, interpolationArgs, extraArgs,
|
|
|
23853
24022
|
return createStatementOp(callVariadicInstructionExpr(config, baseArgs, interpolationArgs, extraArgs, sourceSpan).toStmt());
|
|
23854
24023
|
}
|
|
23855
24024
|
|
|
23856
|
-
const ARIA_PREFIX = 'aria';
|
|
23857
24025
|
/**
|
|
23858
24026
|
* Map of target resolvers for event listeners.
|
|
23859
24027
|
*/
|
|
@@ -24232,33 +24400,6 @@ function reifyUpdateOperations(unit, ops) {
|
|
|
24232
24400
|
}
|
|
24233
24401
|
}
|
|
24234
24402
|
}
|
|
24235
|
-
/**
|
|
24236
|
-
* Converts an ARIA property name to its corresponding attribute name, if necessary.
|
|
24237
|
-
*
|
|
24238
|
-
* For example, converts `ariaLabel` to `aria-label`.
|
|
24239
|
-
*
|
|
24240
|
-
* https://www.w3.org/TR/wai-aria-1.2/#accessibilityroleandproperties-correspondence
|
|
24241
|
-
*
|
|
24242
|
-
* This must be kept in sync with the the function of the same name in
|
|
24243
|
-
* packages/core/src/render3/instructions/aria_property.ts.
|
|
24244
|
-
*
|
|
24245
|
-
* @param name A property name that starts with `aria`.
|
|
24246
|
-
* @returns The corresponding attribute name.
|
|
24247
|
-
*/
|
|
24248
|
-
function ariaAttrName(name) {
|
|
24249
|
-
return name.charAt(ARIA_PREFIX.length) !== '-'
|
|
24250
|
-
? ARIA_PREFIX + '-' + name.slice(ARIA_PREFIX.length).toLowerCase()
|
|
24251
|
-
: name; // Property already has attribute name.
|
|
24252
|
-
}
|
|
24253
|
-
/**
|
|
24254
|
-
* Returns whether `name` is an ARIA property (or attribute) name.
|
|
24255
|
-
*
|
|
24256
|
-
* This is a heuristic based on whether name begins with and is longer than `aria`. For example,
|
|
24257
|
-
* this returns true for both `ariaLabel` and `aria-label`.
|
|
24258
|
-
*/
|
|
24259
|
-
function isAriaProperty(name) {
|
|
24260
|
-
return name.startsWith(ARIA_PREFIX) && name.length > ARIA_PREFIX.length;
|
|
24261
|
-
}
|
|
24262
24403
|
/**
|
|
24263
24404
|
* Reifies a DOM property binding operation.
|
|
24264
24405
|
*
|
|
@@ -24269,9 +24410,7 @@ function isAriaProperty(name) {
|
|
|
24269
24410
|
* @returns A statement to update the property at runtime.
|
|
24270
24411
|
*/
|
|
24271
24412
|
function reifyDomProperty(op) {
|
|
24272
|
-
return
|
|
24273
|
-
? attribute(ariaAttrName(op.name), op.expression, null, null, op.sourceSpan)
|
|
24274
|
-
: domProperty(DOM_PROPERTY_REMAPPING.get(op.name) ?? op.name, op.expression, op.sanitizer, op.sourceSpan);
|
|
24413
|
+
return domProperty(DOM_PROPERTY_REMAPPING.get(op.name) ?? op.name, op.expression, op.sanitizer, op.sourceSpan);
|
|
24275
24414
|
}
|
|
24276
24415
|
/**
|
|
24277
24416
|
* Reifies a property binding operation.
|
|
@@ -24283,7 +24422,7 @@ function reifyDomProperty(op) {
|
|
|
24283
24422
|
* @returns A statement to update the property at runtime.
|
|
24284
24423
|
*/
|
|
24285
24424
|
function reifyProperty(op) {
|
|
24286
|
-
return
|
|
24425
|
+
return isAriaAttribute(op.name)
|
|
24287
24426
|
? ariaProperty(op.name, op.expression, op.sourceSpan)
|
|
24288
24427
|
: property(op.name, op.expression, op.sanitizer, op.sourceSpan);
|
|
24289
24428
|
}
|
|
@@ -26331,6 +26470,7 @@ function wrapI18nIcus(job) {
|
|
|
26331
26470
|
*/
|
|
26332
26471
|
const phases = [
|
|
26333
26472
|
{ kind: CompilationJobKind.Tmpl, fn: removeContentSelectors },
|
|
26473
|
+
{ kind: CompilationJobKind.Both, fn: optimizeRegularExpressions },
|
|
26334
26474
|
{ kind: CompilationJobKind.Host, fn: parseHostStyleProperties },
|
|
26335
26475
|
{ kind: CompilationJobKind.Tmpl, fn: emitNamespaceChanges },
|
|
26336
26476
|
{ kind: CompilationJobKind.Tmpl, fn: propagateI18nBlocks },
|
|
@@ -27177,6 +27317,9 @@ function convertAst(ast, job, baseSourceSpan) {
|
|
|
27177
27317
|
else if (ast instanceof ParenthesizedExpression) {
|
|
27178
27318
|
return new ParenthesizedExpr(convertAst(ast.expression, job, baseSourceSpan), undefined, convertSourceSpan(ast.span, baseSourceSpan));
|
|
27179
27319
|
}
|
|
27320
|
+
else if (ast instanceof RegularExpressionLiteral) {
|
|
27321
|
+
return new RegularExpressionLiteral$1(ast.body, ast.flags, baseSourceSpan);
|
|
27322
|
+
}
|
|
27180
27323
|
else {
|
|
27181
27324
|
throw new Error(`Unhandled expression type "${ast.constructor.name}" in file "${baseSourceSpan?.start.file.url}"`);
|
|
27182
27325
|
}
|
|
@@ -27776,18 +27919,13 @@ const LEGACY_ANIMATE_PROP_PREFIX = 'animate-';
|
|
|
27776
27919
|
*/
|
|
27777
27920
|
class BindingParser {
|
|
27778
27921
|
_exprParser;
|
|
27779
|
-
_interpolationConfig;
|
|
27780
27922
|
_schemaRegistry;
|
|
27781
27923
|
errors;
|
|
27782
|
-
constructor(_exprParser,
|
|
27924
|
+
constructor(_exprParser, _schemaRegistry, errors) {
|
|
27783
27925
|
this._exprParser = _exprParser;
|
|
27784
|
-
this._interpolationConfig = _interpolationConfig;
|
|
27785
27926
|
this._schemaRegistry = _schemaRegistry;
|
|
27786
27927
|
this.errors = errors;
|
|
27787
27928
|
}
|
|
27788
|
-
get interpolationConfig() {
|
|
27789
|
-
return this._interpolationConfig;
|
|
27790
|
-
}
|
|
27791
27929
|
createBoundHostProperties(properties, sourceSpan) {
|
|
27792
27930
|
const boundProps = [];
|
|
27793
27931
|
for (const propName of Object.keys(properties)) {
|
|
@@ -27831,7 +27969,7 @@ class BindingParser {
|
|
|
27831
27969
|
parseInterpolation(value, sourceSpan, interpolatedTokens) {
|
|
27832
27970
|
const absoluteOffset = sourceSpan.fullStart.offset;
|
|
27833
27971
|
try {
|
|
27834
|
-
const ast = this._exprParser.parseInterpolation(value, sourceSpan, absoluteOffset, interpolatedTokens
|
|
27972
|
+
const ast = this._exprParser.parseInterpolation(value, sourceSpan, absoluteOffset, interpolatedTokens);
|
|
27835
27973
|
if (ast) {
|
|
27836
27974
|
this.errors.push(...ast.errors);
|
|
27837
27975
|
}
|
|
@@ -28003,8 +28141,8 @@ class BindingParser {
|
|
|
28003
28141
|
parseBinding(value, isHostBinding, sourceSpan, absoluteOffset) {
|
|
28004
28142
|
try {
|
|
28005
28143
|
const ast = isHostBinding
|
|
28006
|
-
? this._exprParser.parseSimpleBinding(value, sourceSpan, absoluteOffset
|
|
28007
|
-
: this._exprParser.parseBinding(value, sourceSpan, absoluteOffset
|
|
28144
|
+
? this._exprParser.parseSimpleBinding(value, sourceSpan, absoluteOffset)
|
|
28145
|
+
: this._exprParser.parseBinding(value, sourceSpan, absoluteOffset);
|
|
28008
28146
|
if (ast) {
|
|
28009
28147
|
this.errors.push(...ast.errors);
|
|
28010
28148
|
}
|
|
@@ -28139,7 +28277,7 @@ class BindingParser {
|
|
|
28139
28277
|
_parseAction(value, sourceSpan) {
|
|
28140
28278
|
const absoluteOffset = sourceSpan && sourceSpan.start ? sourceSpan.start.offset : 0;
|
|
28141
28279
|
try {
|
|
28142
|
-
const ast = this._exprParser.parseAction(value, sourceSpan, absoluteOffset
|
|
28280
|
+
const ast = this._exprParser.parseAction(value, sourceSpan, absoluteOffset);
|
|
28143
28281
|
if (ast) {
|
|
28144
28282
|
this.errors.push(...ast.errors);
|
|
28145
28283
|
}
|
|
@@ -29405,6 +29543,13 @@ class HtmlAstToIvyAst {
|
|
|
29405
29543
|
}
|
|
29406
29544
|
else {
|
|
29407
29545
|
const attrs = this.categorizePropertyAttributes(element.name, parsedProperties, i18nAttrsMeta);
|
|
29546
|
+
if (element.name === 'ng-container') {
|
|
29547
|
+
for (const bound of attrs.bound) {
|
|
29548
|
+
if (bound.type === exports.BindingType.Attribute) {
|
|
29549
|
+
this.reportError(`Attribute bindings are not supported on ng-container. Use property bindings instead.`, bound.sourceSpan);
|
|
29550
|
+
}
|
|
29551
|
+
}
|
|
29552
|
+
}
|
|
29408
29553
|
parsedElement = new Element$1(element.name, attributes, attrs.bound, boundEvents, directives, children, references, element.isSelfClosing, element.sourceSpan, element.startSourceSpan, element.endSourceSpan, element.isVoid, element.i18n);
|
|
29409
29554
|
}
|
|
29410
29555
|
if (elementHasInlineTemplate) {
|
|
@@ -29989,9 +30134,9 @@ const LEADING_TRIVIA_CHARS = [' ', '\n', '\r', '\t'];
|
|
|
29989
30134
|
* @param options options to modify how the template is parsed
|
|
29990
30135
|
*/
|
|
29991
30136
|
function parseTemplate(template, templateUrl, options = {}) {
|
|
29992
|
-
const {
|
|
30137
|
+
const { preserveWhitespaces, enableI18nLegacyMessageIdFormat } = options;
|
|
29993
30138
|
const selectorlessEnabled = options.enableSelectorless ?? false;
|
|
29994
|
-
const bindingParser = makeBindingParser(
|
|
30139
|
+
const bindingParser = makeBindingParser(selectorlessEnabled);
|
|
29995
30140
|
const htmlParser = new HtmlParser();
|
|
29996
30141
|
const parseResult = htmlParser.parse(template, templateUrl, {
|
|
29997
30142
|
leadingTriviaChars: LEADING_TRIVIA_CHARS,
|
|
@@ -30005,7 +30150,6 @@ function parseTemplate(template, templateUrl, options = {}) {
|
|
|
30005
30150
|
parseResult.errors &&
|
|
30006
30151
|
parseResult.errors.length > 0) {
|
|
30007
30152
|
const parsedTemplate = {
|
|
30008
|
-
interpolationConfig,
|
|
30009
30153
|
preserveWhitespaces,
|
|
30010
30154
|
errors: parseResult.errors,
|
|
30011
30155
|
nodes: [],
|
|
@@ -30028,7 +30172,7 @@ function parseTemplate(template, templateUrl, options = {}) {
|
|
|
30028
30172
|
// before we run whitespace removal process, because existing i18n
|
|
30029
30173
|
// extraction process (ng extract-i18n) relies on a raw content to generate
|
|
30030
30174
|
// message ids
|
|
30031
|
-
const i18nMetaVisitor = new I18nMetaVisitor(
|
|
30175
|
+
const i18nMetaVisitor = new I18nMetaVisitor(
|
|
30032
30176
|
/* keepI18nAttrs */ !preserveWhitespaces, enableI18nLegacyMessageIdFormat,
|
|
30033
30177
|
/* containerBlocks */ undefined, options.preserveSignificantWhitespace, retainEmptyTokens);
|
|
30034
30178
|
const i18nMetaResult = i18nMetaVisitor.visitAllWithErrors(rootNodes);
|
|
@@ -30036,7 +30180,6 @@ function parseTemplate(template, templateUrl, options = {}) {
|
|
|
30036
30180
|
i18nMetaResult.errors &&
|
|
30037
30181
|
i18nMetaResult.errors.length > 0) {
|
|
30038
30182
|
const parsedTemplate = {
|
|
30039
|
-
interpolationConfig,
|
|
30040
30183
|
preserveWhitespaces,
|
|
30041
30184
|
errors: i18nMetaResult.errors,
|
|
30042
30185
|
nodes: [],
|
|
@@ -30071,7 +30214,7 @@ function parseTemplate(template, templateUrl, options = {}) {
|
|
|
30071
30214
|
// template. During this pass i18n IDs generated at the first pass will be preserved, so we can
|
|
30072
30215
|
// mimic existing extraction process (ng extract-i18n)
|
|
30073
30216
|
if (i18nMetaVisitor.hasI18nMeta) {
|
|
30074
|
-
rootNodes = visitAll(new I18nMetaVisitor(
|
|
30217
|
+
rootNodes = visitAll(new I18nMetaVisitor(
|
|
30075
30218
|
/* keepI18nAttrs */ false,
|
|
30076
30219
|
/* enableI18nLegacyMessageIdFormat */ undefined,
|
|
30077
30220
|
/* containerBlocks */ undefined,
|
|
@@ -30081,7 +30224,6 @@ function parseTemplate(template, templateUrl, options = {}) {
|
|
|
30081
30224
|
const { nodes, errors, styleUrls, styles, ngContentSelectors, commentNodes } = htmlAstToRender3Ast(rootNodes, bindingParser, { collectCommentNodes: !!options.collectCommentNodes });
|
|
30082
30225
|
errors.push(...parseResult.errors, ...i18nMetaResult.errors);
|
|
30083
30226
|
const parsedTemplate = {
|
|
30084
|
-
interpolationConfig,
|
|
30085
30227
|
preserveWhitespaces,
|
|
30086
30228
|
errors: errors.length > 0 ? errors : null,
|
|
30087
30229
|
nodes,
|
|
@@ -30098,8 +30240,8 @@ const elementRegistry = new DomElementSchemaRegistry();
|
|
|
30098
30240
|
/**
|
|
30099
30241
|
* Construct a `BindingParser` with a default configuration.
|
|
30100
30242
|
*/
|
|
30101
|
-
function makeBindingParser(
|
|
30102
|
-
return new BindingParser(new Parser(new Lexer(), selectorlessEnabled),
|
|
30243
|
+
function makeBindingParser(selectorlessEnabled = false) {
|
|
30244
|
+
return new BindingParser(new Parser(new Lexer(), selectorlessEnabled), elementRegistry, []);
|
|
30103
30245
|
}
|
|
30104
30246
|
|
|
30105
30247
|
const COMPONENT_VARIABLE = '%COMP%';
|
|
@@ -31739,7 +31881,7 @@ class CompilerFacadeImpl {
|
|
|
31739
31881
|
}
|
|
31740
31882
|
compileComponent(angularCoreEnv, sourceMapUrl, facade) {
|
|
31741
31883
|
// Parse the template and check for errors.
|
|
31742
|
-
const { template,
|
|
31884
|
+
const { template, defer } = parseJitTemplate(facade.template, facade.name, sourceMapUrl, facade.preserveWhitespaces, undefined);
|
|
31743
31885
|
// Compile the component metadata, including template, into an expression.
|
|
31744
31886
|
const meta = {
|
|
31745
31887
|
...facade,
|
|
@@ -31751,7 +31893,6 @@ class CompilerFacadeImpl {
|
|
|
31751
31893
|
defer,
|
|
31752
31894
|
styles: [...facade.styles, ...template.styles],
|
|
31753
31895
|
encapsulation: facade.encapsulation,
|
|
31754
|
-
interpolation,
|
|
31755
31896
|
changeDetection: facade.changeDetection ?? null,
|
|
31756
31897
|
animations: facade.animations != null ? new WrappedNodeExpr(facade.animations) : null,
|
|
31757
31898
|
viewProviders: facade.viewProviders != null ? new WrappedNodeExpr(facade.viewProviders) : null,
|
|
@@ -31769,7 +31910,7 @@ class CompilerFacadeImpl {
|
|
|
31769
31910
|
}
|
|
31770
31911
|
compileComponentFromMeta(angularCoreEnv, sourceMapUrl, meta) {
|
|
31771
31912
|
const constantPool = new ConstantPool();
|
|
31772
|
-
const bindingParser = makeBindingParser(
|
|
31913
|
+
const bindingParser = makeBindingParser();
|
|
31773
31914
|
const res = compileComponentFromMetadata(meta, constantPool, bindingParser);
|
|
31774
31915
|
return this.jitExpression(res.expression, angularCoreEnv, sourceMapUrl, constantPool.statements);
|
|
31775
31916
|
}
|
|
@@ -31975,7 +32116,7 @@ function convertOpaqueValuesToExpressions(obj) {
|
|
|
31975
32116
|
return result;
|
|
31976
32117
|
}
|
|
31977
32118
|
function convertDeclareComponentFacadeToMetadata(decl, typeSourceSpan, sourceMapUrl) {
|
|
31978
|
-
const { template,
|
|
32119
|
+
const { template, defer } = parseJitTemplate(decl.template, decl.type.name, sourceMapUrl, decl.preserveWhitespaces ?? false, decl.deferBlockDependencies);
|
|
31979
32120
|
const declarations = [];
|
|
31980
32121
|
if (decl.dependencies) {
|
|
31981
32122
|
for (const innerDep of decl.dependencies) {
|
|
@@ -32010,7 +32151,6 @@ function convertDeclareComponentFacadeToMetadata(decl, typeSourceSpan, sourceMap
|
|
|
32010
32151
|
defer,
|
|
32011
32152
|
changeDetection: decl.changeDetection ?? exports.ChangeDetectionStrategy.Default,
|
|
32012
32153
|
encapsulation: decl.encapsulation ?? exports.ViewEncapsulation.Emulated,
|
|
32013
|
-
interpolation,
|
|
32014
32154
|
declarationListEmitMode: 2 /* DeclarationListEmitMode.ClosureResolved */,
|
|
32015
32155
|
relativeContextFilePath: '',
|
|
32016
32156
|
i18nUseExternalIds: true,
|
|
@@ -32054,15 +32194,9 @@ function convertPipeDeclarationToMetadata(pipe) {
|
|
|
32054
32194
|
type: new WrappedNodeExpr(pipe.type),
|
|
32055
32195
|
};
|
|
32056
32196
|
}
|
|
32057
|
-
function parseJitTemplate(template, typeName, sourceMapUrl, preserveWhitespaces,
|
|
32058
|
-
const interpolationConfig = interpolation
|
|
32059
|
-
? InterpolationConfig.fromArray(interpolation)
|
|
32060
|
-
: DEFAULT_INTERPOLATION_CONFIG;
|
|
32197
|
+
function parseJitTemplate(template, typeName, sourceMapUrl, preserveWhitespaces, deferBlockDependencies) {
|
|
32061
32198
|
// Parse the template and check for errors.
|
|
32062
|
-
const parsed = parseTemplate(template, sourceMapUrl, {
|
|
32063
|
-
preserveWhitespaces,
|
|
32064
|
-
interpolationConfig,
|
|
32065
|
-
});
|
|
32199
|
+
const parsed = parseTemplate(template, sourceMapUrl, { preserveWhitespaces });
|
|
32066
32200
|
if (parsed.errors !== null) {
|
|
32067
32201
|
const errors = parsed.errors.map((err) => err.toString()).join(', ');
|
|
32068
32202
|
throw new Error(`Errors during JIT compilation of template for ${typeName}: ${errors}`);
|
|
@@ -32071,7 +32205,6 @@ function parseJitTemplate(template, typeName, sourceMapUrl, preserveWhitespaces,
|
|
|
32071
32205
|
const boundTarget = binder.bind({ template: parsed.nodes });
|
|
32072
32206
|
return {
|
|
32073
32207
|
template: parsed,
|
|
32074
|
-
interpolation: interpolationConfig,
|
|
32075
32208
|
defer: createR3ComponentDeferMetadata(boundTarget, deferBlockDependencies),
|
|
32076
32209
|
};
|
|
32077
32210
|
}
|
|
@@ -32295,9 +32428,9 @@ let i18nCommentsWarned = false;
|
|
|
32295
32428
|
/**
|
|
32296
32429
|
* Extract translatable messages from an html AST
|
|
32297
32430
|
*/
|
|
32298
|
-
function extractMessages(nodes,
|
|
32431
|
+
function extractMessages(nodes, implicitTags, implicitAttrs, preserveSignificantWhitespace) {
|
|
32299
32432
|
const visitor = new _Visitor(implicitTags, implicitAttrs, preserveSignificantWhitespace);
|
|
32300
|
-
return visitor.extract(nodes
|
|
32433
|
+
return visitor.extract(nodes);
|
|
32301
32434
|
}
|
|
32302
32435
|
class ExtractionResult {
|
|
32303
32436
|
messages;
|
|
@@ -32352,8 +32485,8 @@ class _Visitor {
|
|
|
32352
32485
|
/**
|
|
32353
32486
|
* Extracts the messages from the tree
|
|
32354
32487
|
*/
|
|
32355
|
-
extract(nodes
|
|
32356
|
-
this._init(_VisitorMode.Extract
|
|
32488
|
+
extract(nodes) {
|
|
32489
|
+
this._init(_VisitorMode.Extract);
|
|
32357
32490
|
nodes.forEach((node) => node.visit(this, null));
|
|
32358
32491
|
if (this._inI18nBlock) {
|
|
32359
32492
|
this._reportError(nodes[nodes.length - 1], 'Unclosed block');
|
|
@@ -32363,8 +32496,8 @@ class _Visitor {
|
|
|
32363
32496
|
/**
|
|
32364
32497
|
* Returns a tree where all translatable nodes are translated
|
|
32365
32498
|
*/
|
|
32366
|
-
merge(nodes, translations
|
|
32367
|
-
this._init(_VisitorMode.Merge
|
|
32499
|
+
merge(nodes, translations) {
|
|
32500
|
+
this._init(_VisitorMode.Merge);
|
|
32368
32501
|
this._translations = translations;
|
|
32369
32502
|
// Construct a single fake root element
|
|
32370
32503
|
const wrapper = new Element('wrapper', [], [], nodes, false, undefined, undefined, undefined, false);
|
|
@@ -32469,7 +32602,7 @@ class _Visitor {
|
|
|
32469
32602
|
visitDirective(directive, context) {
|
|
32470
32603
|
throw new Error('unreachable code');
|
|
32471
32604
|
}
|
|
32472
|
-
_init(mode
|
|
32605
|
+
_init(mode) {
|
|
32473
32606
|
this._mode = mode;
|
|
32474
32607
|
this._inI18nBlock = false;
|
|
32475
32608
|
this._inI18nNode = false;
|
|
@@ -32479,7 +32612,7 @@ class _Visitor {
|
|
|
32479
32612
|
this._errors = [];
|
|
32480
32613
|
this._messages = [];
|
|
32481
32614
|
this._inImplicitNode = false;
|
|
32482
|
-
this._createI18nMessage = createI18nMessageFactory(
|
|
32615
|
+
this._createI18nMessage = createI18nMessageFactory(DEFAULT_CONTAINER_BLOCKS,
|
|
32483
32616
|
// When dropping significant whitespace we need to retain whitespace tokens or
|
|
32484
32617
|
// else we won't be able to reuse source spans because empty tokens would be
|
|
32485
32618
|
// removed and cause a mismatch.
|
|
@@ -32776,7 +32909,7 @@ function isAttrNode(ast) {
|
|
|
32776
32909
|
* @description
|
|
32777
32910
|
* Entry point for all public APIs of the compiler package.
|
|
32778
32911
|
*/
|
|
32779
|
-
const VERSION = new Version('21.0.0-next.
|
|
32912
|
+
const VERSION = new Version('21.0.0-next.6');
|
|
32780
32913
|
|
|
32781
32914
|
//////////////////////////////////////
|
|
32782
32915
|
// THIS FILE HAS GLOBAL SIDE EFFECT //
|
|
@@ -33839,7 +33972,7 @@ class NodeJSPathManipulation {
|
|
|
33839
33972
|
// G3-ESM-MARKER: G3 uses CommonJS, but externally everything in ESM.
|
|
33840
33973
|
// CommonJS/ESM interop for determining the current file name and containing dir.
|
|
33841
33974
|
const isCommonJS = typeof __filename !== 'undefined';
|
|
33842
|
-
const currentFileUrl = isCommonJS ? null : (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('project_tsconfig_paths-
|
|
33975
|
+
const currentFileUrl = isCommonJS ? null : (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('project_tsconfig_paths-sFatqIE5.cjs', document.baseURI).href));
|
|
33843
33976
|
// Note, when this code loads in the browser, `url` may be an empty `{}` due to the Closure shims.
|
|
33844
33977
|
const currentFileName = isCommonJS
|
|
33845
33978
|
? __filename
|
|
@@ -38239,6 +38372,9 @@ class ExpressionTranslatorVisitor {
|
|
|
38239
38372
|
visitLiteralExpr(ast, _context) {
|
|
38240
38373
|
return this.setSourceMapRange(this.factory.createLiteral(ast.value), ast.sourceSpan);
|
|
38241
38374
|
}
|
|
38375
|
+
visitRegularExpressionLiteral(ast, context) {
|
|
38376
|
+
return this.setSourceMapRange(this.factory.createRegularExpressionLiteral(ast.body, ast.flags), ast.sourceSpan);
|
|
38377
|
+
}
|
|
38242
38378
|
visitLocalizedString(ast, context) {
|
|
38243
38379
|
// A `$localize` message consists of `messageParts` and `expressions`, which get interleaved
|
|
38244
38380
|
// together. The interleaved pieces look like:
|
|
@@ -38736,6 +38872,9 @@ class TypeTranslatorVisitor {
|
|
|
38736
38872
|
visitDynamicImportExpr(ast, context) {
|
|
38737
38873
|
throw new Error('Method not implemented.');
|
|
38738
38874
|
}
|
|
38875
|
+
visitRegularExpressionLiteral(ast, context) {
|
|
38876
|
+
throw new Error('Method not implemented.');
|
|
38877
|
+
}
|
|
38739
38878
|
visitNotExpr(ast, context) {
|
|
38740
38879
|
throw new Error('Method not implemented.');
|
|
38741
38880
|
}
|
|
@@ -39039,6 +39178,9 @@ class TypeScriptAstFactory {
|
|
|
39039
39178
|
ts.factory.createVariableDeclaration(variableName, undefined, undefined, initializer ?? undefined),
|
|
39040
39179
|
], this.VAR_TYPES[type]));
|
|
39041
39180
|
}
|
|
39181
|
+
createRegularExpressionLiteral(body, flags) {
|
|
39182
|
+
return ts.factory.createRegularExpressionLiteral(`/${body}/${flags ?? ''}`);
|
|
39183
|
+
}
|
|
39042
39184
|
setSourceMapRange(node, sourceMapRange) {
|
|
39043
39185
|
if (sourceMapRange === null) {
|
|
39044
39186
|
return node;
|
|
@@ -42438,6 +42580,10 @@ class MagicString {
|
|
|
42438
42580
|
if (chunk.outro.length) mappings.advance(chunk.outro);
|
|
42439
42581
|
});
|
|
42440
42582
|
|
|
42583
|
+
if (this.outro) {
|
|
42584
|
+
mappings.advance(this.outro);
|
|
42585
|
+
}
|
|
42586
|
+
|
|
42441
42587
|
return {
|
|
42442
42588
|
file: options.file ? options.file.split(/[/\\]/).pop() : undefined,
|
|
42443
42589
|
sources: [
|
|
@@ -43103,7 +43249,12 @@ class MagicString {
|
|
|
43103
43249
|
const index = original.indexOf(string);
|
|
43104
43250
|
|
|
43105
43251
|
if (index !== -1) {
|
|
43106
|
-
|
|
43252
|
+
if (typeof replacement === 'function') {
|
|
43253
|
+
replacement = replacement(string, index, original);
|
|
43254
|
+
}
|
|
43255
|
+
if (string !== replacement) {
|
|
43256
|
+
this.overwrite(index, index + string.length, replacement);
|
|
43257
|
+
}
|
|
43107
43258
|
}
|
|
43108
43259
|
|
|
43109
43260
|
return this;
|
|
@@ -43126,7 +43277,11 @@ class MagicString {
|
|
|
43126
43277
|
index = original.indexOf(string, index + stringLength)
|
|
43127
43278
|
) {
|
|
43128
43279
|
const previous = original.slice(index, index + stringLength);
|
|
43129
|
-
|
|
43280
|
+
let _replacement = replacement;
|
|
43281
|
+
if (typeof replacement === 'function') {
|
|
43282
|
+
_replacement = replacement(previous, index, original);
|
|
43283
|
+
}
|
|
43284
|
+
if (previous !== _replacement) this.overwrite(index, index + stringLength, _replacement);
|
|
43130
43285
|
}
|
|
43131
43286
|
|
|
43132
43287
|
return this;
|
|
@@ -44807,6 +44962,9 @@ class AstTranslator {
|
|
|
44807
44962
|
visitThisReceiver(ast) {
|
|
44808
44963
|
throw new Error('Method not implemented.');
|
|
44809
44964
|
}
|
|
44965
|
+
visitRegularExpressionLiteral(ast, context) {
|
|
44966
|
+
return wrapForTypeChecker(ts.factory.createRegularExpressionLiteral(`/${ast.body}/${ast.flags ?? ''}`));
|
|
44967
|
+
}
|
|
44810
44968
|
visitInterpolation(ast) {
|
|
44811
44969
|
// Build up a chain of binary + operations to simulate the string concatenation of the
|
|
44812
44970
|
// interpolation's expressions. The chain is started using an actual string literal to ensure
|
|
@@ -45133,6 +45291,9 @@ class VeSafeLhsInferenceBugDetector {
|
|
|
45133
45291
|
visitParenthesizedExpression(ast, context) {
|
|
45134
45292
|
return ast.expression.visit(this);
|
|
45135
45293
|
}
|
|
45294
|
+
visitRegularExpressionLiteral(ast, context) {
|
|
45295
|
+
return false;
|
|
45296
|
+
}
|
|
45136
45297
|
}
|
|
45137
45298
|
|
|
45138
45299
|
/**
|
|
@@ -50826,7 +50987,6 @@ exports.Conditional = Conditional;
|
|
|
50826
50987
|
exports.ConstantPool = ConstantPool;
|
|
50827
50988
|
exports.Container = Container;
|
|
50828
50989
|
exports.CssSelector = CssSelector;
|
|
50829
|
-
exports.DEFAULT_INTERPOLATION_CONFIG = DEFAULT_INTERPOLATION_CONFIG;
|
|
50830
50990
|
exports.DYNAMIC_TYPE = DYNAMIC_TYPE;
|
|
50831
50991
|
exports.Declaration = Declaration;
|
|
50832
50992
|
exports.DeclareFunctionStmt = DeclareFunctionStmt;
|
|
@@ -50855,8 +51015,8 @@ exports.IfBlock = IfBlock;
|
|
|
50855
51015
|
exports.ImplicitReceiver = ImplicitReceiver;
|
|
50856
51016
|
exports.ImportManager = ImportManager;
|
|
50857
51017
|
exports.Interpolation = Interpolation$1;
|
|
50858
|
-
exports.InterpolationConfig = InterpolationConfig;
|
|
50859
51018
|
exports.InvokeFunctionExpr = InvokeFunctionExpr;
|
|
51019
|
+
exports.KeyedRead = KeyedRead;
|
|
50860
51020
|
exports.KnownFn = KnownFn;
|
|
50861
51021
|
exports.LetDeclaration = LetDeclaration$1;
|
|
50862
51022
|
exports.LiteralArrayExpr = LiteralArrayExpr;
|