@angular/language-service 11.0.4 → 11.0.8
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/bundles/ivy.js +81 -42
- package/bundles/language-service.js +178 -66
- package/package.json +1 -1
package/bundles/ivy.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular v11.0.
|
|
2
|
+
* @license Angular v11.0.8
|
|
3
3
|
* Copyright Google LLC All Rights Reserved.
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
@@ -5058,10 +5058,6 @@ define(['exports', 'os', 'typescript', 'fs', 'constants', 'stream', 'util', 'ass
|
|
|
5058
5058
|
function error(msg) {
|
|
5059
5059
|
throw new Error(`Internal Error: ${msg}`);
|
|
5060
5060
|
}
|
|
5061
|
-
// Escape characters that have a special meaning in Regular Expressions
|
|
5062
|
-
function escapeRegExp(s) {
|
|
5063
|
-
return s.replace(/([.*+?^=!:${}()|[\]\/\\])/g, '\\$1');
|
|
5064
|
-
}
|
|
5065
5061
|
function utf8Encode(str) {
|
|
5066
5062
|
let encoded = [];
|
|
5067
5063
|
for (let index = 0; index < str.length; index++) {
|
|
@@ -10964,12 +10960,13 @@ define(['exports', 'os', 'typescript', 'fs', 'constants', 'stream', 'util', 'ass
|
|
|
10964
10960
|
this.index = 0;
|
|
10965
10961
|
// Replaces attribute selectors with placeholders.
|
|
10966
10962
|
// The WS in [attr="va lue"] would otherwise be interpreted as a selector separator.
|
|
10967
|
-
selector =
|
|
10968
|
-
|
|
10969
|
-
|
|
10970
|
-
|
|
10971
|
-
|
|
10972
|
-
|
|
10963
|
+
selector = this._escapeRegexMatches(selector, /(\[[^\]]*\])/g);
|
|
10964
|
+
// CSS allows for certain special characters to be used in selectors if they're escaped.
|
|
10965
|
+
// E.g. `.foo:blue` won't match a class called `foo:blue`, because the colon denotes a
|
|
10966
|
+
// pseudo-class, but writing `.foo\:blue` will match, because the colon was escaped.
|
|
10967
|
+
// Replace all escape sequences (`\` followed by a character) with a placeholder so
|
|
10968
|
+
// that our handling of pseudo-selectors doesn't mess with them.
|
|
10969
|
+
selector = this._escapeRegexMatches(selector, /(\\.)/g);
|
|
10973
10970
|
// Replaces the expression in `:nth-child(2n + 1)` with a placeholder.
|
|
10974
10971
|
// WS and "+" would otherwise be interpreted as selector separators.
|
|
10975
10972
|
this._content = selector.replace(/(:nth-[-\w]+)(\([^)]+\))/g, (_, pseudo, exp) => {
|
|
@@ -10980,11 +10977,23 @@ define(['exports', 'os', 'typescript', 'fs', 'constants', 'stream', 'util', 'ass
|
|
|
10980
10977
|
});
|
|
10981
10978
|
}
|
|
10982
10979
|
restore(content) {
|
|
10983
|
-
return content.replace(/__ph-(\d+)__/g, (
|
|
10980
|
+
return content.replace(/__ph-(\d+)__/g, (_ph, index) => this.placeholders[+index]);
|
|
10984
10981
|
}
|
|
10985
10982
|
content() {
|
|
10986
10983
|
return this._content;
|
|
10987
10984
|
}
|
|
10985
|
+
/**
|
|
10986
|
+
* Replaces all of the substrings that match a regex within a
|
|
10987
|
+
* special string (e.g. `__ph-0__`, `__ph-1__`, etc).
|
|
10988
|
+
*/
|
|
10989
|
+
_escapeRegexMatches(content, pattern) {
|
|
10990
|
+
return content.replace(pattern, (_, keep) => {
|
|
10991
|
+
const replaceBy = `__ph-${this.index}__`;
|
|
10992
|
+
this.placeholders.push(keep);
|
|
10993
|
+
this.index++;
|
|
10994
|
+
return replaceBy;
|
|
10995
|
+
});
|
|
10996
|
+
}
|
|
10988
10997
|
}
|
|
10989
10998
|
const _cssContentNextSelectorRe = /polyfill-next-selector[^}]*content:[\s]*?(['"])(.*?)\1[;\s]*}([^{]*?){/gim;
|
|
10990
10999
|
const _cssContentRuleRe = /(polyfill-rule)[^}]*(content:[\s]*(['"])(.*?)\3)[;\s]*[^}]*}/gim;
|
|
@@ -14149,19 +14158,6 @@ define(['exports', 'os', 'typescript', 'fs', 'constants', 'stream', 'util', 'ass
|
|
|
14149
14158
|
this.errors = errors;
|
|
14150
14159
|
}
|
|
14151
14160
|
}
|
|
14152
|
-
const defaultInterpolateRegExp = _createInterpolateRegExp(DEFAULT_INTERPOLATION_CONFIG);
|
|
14153
|
-
function _getInterpolateRegExp(config) {
|
|
14154
|
-
if (config === DEFAULT_INTERPOLATION_CONFIG) {
|
|
14155
|
-
return defaultInterpolateRegExp;
|
|
14156
|
-
}
|
|
14157
|
-
else {
|
|
14158
|
-
return _createInterpolateRegExp(config);
|
|
14159
|
-
}
|
|
14160
|
-
}
|
|
14161
|
-
function _createInterpolateRegExp(config) {
|
|
14162
|
-
const pattern = escapeRegExp(config.start) + '([\\s\\S]*?)' + escapeRegExp(config.end);
|
|
14163
|
-
return new RegExp(pattern, 'g');
|
|
14164
|
-
}
|
|
14165
14161
|
class Parser$1 {
|
|
14166
14162
|
constructor(_lexer) {
|
|
14167
14163
|
this._lexer = _lexer;
|
|
@@ -14318,10 +14314,10 @@ define(['exports', 'os', 'typescript', 'fs', 'constants', 'stream', 'util', 'ass
|
|
|
14318
14314
|
atInterpolation = true;
|
|
14319
14315
|
}
|
|
14320
14316
|
else {
|
|
14321
|
-
// parse from starting {{ to ending }}
|
|
14317
|
+
// parse from starting {{ to ending }} while ignoring content inside quotes.
|
|
14322
14318
|
const fullStart = i;
|
|
14323
14319
|
const exprStart = fullStart + interpStart.length;
|
|
14324
|
-
const exprEnd =
|
|
14320
|
+
const exprEnd = this._getInterpolationEndIndex(input, interpEnd, exprStart);
|
|
14325
14321
|
if (exprEnd === -1) {
|
|
14326
14322
|
// Could not find the end of the interpolation; do not parse an expression.
|
|
14327
14323
|
// Instead we should extend the content on the last raw string.
|
|
@@ -14380,27 +14376,70 @@ define(['exports', 'os', 'typescript', 'fs', 'constants', 'stream', 'util', 'ass
|
|
|
14380
14376
|
}
|
|
14381
14377
|
return null;
|
|
14382
14378
|
}
|
|
14383
|
-
_checkNoInterpolation(input, location,
|
|
14384
|
-
|
|
14385
|
-
|
|
14386
|
-
|
|
14387
|
-
|
|
14379
|
+
_checkNoInterpolation(input, location, { start, end }) {
|
|
14380
|
+
let startIndex = -1;
|
|
14381
|
+
let endIndex = -1;
|
|
14382
|
+
for (const charIndex of this._forEachUnquotedChar(input, 0)) {
|
|
14383
|
+
if (startIndex === -1) {
|
|
14384
|
+
if (input.startsWith(start)) {
|
|
14385
|
+
startIndex = charIndex;
|
|
14386
|
+
}
|
|
14387
|
+
}
|
|
14388
|
+
else {
|
|
14389
|
+
endIndex = this._getInterpolationEndIndex(input, end, charIndex);
|
|
14390
|
+
if (endIndex > -1) {
|
|
14391
|
+
break;
|
|
14392
|
+
}
|
|
14393
|
+
}
|
|
14394
|
+
}
|
|
14395
|
+
if (startIndex > -1 && endIndex > -1) {
|
|
14396
|
+
this._reportError(`Got interpolation (${start}${end}) where expression was expected`, input, `at column ${startIndex} in`, location);
|
|
14388
14397
|
}
|
|
14389
14398
|
}
|
|
14390
|
-
|
|
14391
|
-
|
|
14392
|
-
|
|
14393
|
-
|
|
14394
|
-
|
|
14395
|
-
|
|
14399
|
+
/**
|
|
14400
|
+
* Finds the index of the end of an interpolation expression
|
|
14401
|
+
* while ignoring comments and quoted content.
|
|
14402
|
+
*/
|
|
14403
|
+
_getInterpolationEndIndex(input, expressionEnd, start) {
|
|
14404
|
+
for (const charIndex of this._forEachUnquotedChar(input, start)) {
|
|
14405
|
+
if (input.startsWith(expressionEnd, charIndex)) {
|
|
14406
|
+
return charIndex;
|
|
14407
|
+
}
|
|
14408
|
+
// Nothing else in the expression matters after we've
|
|
14409
|
+
// hit a comment so look directly for the end token.
|
|
14410
|
+
if (input.startsWith('//', charIndex)) {
|
|
14411
|
+
return input.indexOf(expressionEnd, charIndex);
|
|
14412
|
+
}
|
|
14413
|
+
}
|
|
14414
|
+
return -1;
|
|
14415
|
+
}
|
|
14416
|
+
/**
|
|
14417
|
+
* Generator used to iterate over the character indexes of a string that are outside of quotes.
|
|
14418
|
+
* @param input String to loop through.
|
|
14419
|
+
* @param start Index within the string at which to start.
|
|
14420
|
+
*/
|
|
14421
|
+
*_forEachUnquotedChar(input, start) {
|
|
14422
|
+
let currentQuote = null;
|
|
14423
|
+
let escapeCount = 0;
|
|
14424
|
+
for (let i = start; i < input.length; i++) {
|
|
14425
|
+
const char = input[i];
|
|
14426
|
+
// Skip the characters inside quotes. Note that we only care about the outer-most
|
|
14427
|
+
// quotes matching up and we need to account for escape characters.
|
|
14428
|
+
if (isQuote(input.charCodeAt(i)) && (currentQuote === null || currentQuote === char) &&
|
|
14429
|
+
escapeCount % 2 === 0) {
|
|
14430
|
+
currentQuote = currentQuote === null ? char : null;
|
|
14431
|
+
}
|
|
14432
|
+
else if (currentQuote === null) {
|
|
14433
|
+
yield i;
|
|
14434
|
+
}
|
|
14435
|
+
escapeCount = char === '\\' ? escapeCount + 1 : 0;
|
|
14396
14436
|
}
|
|
14397
|
-
return errLocation.length;
|
|
14398
14437
|
}
|
|
14399
14438
|
}
|
|
14400
14439
|
class IvyParser extends Parser$1 {
|
|
14401
14440
|
constructor() {
|
|
14402
14441
|
super(...arguments);
|
|
14403
|
-
this.simpleExpressionChecker = IvySimpleExpressionChecker;
|
|
14442
|
+
this.simpleExpressionChecker = IvySimpleExpressionChecker;
|
|
14404
14443
|
}
|
|
14405
14444
|
}
|
|
14406
14445
|
/** Describes a stateful context an expression parser is in. */
|
|
@@ -19610,7 +19649,7 @@ define(['exports', 'os', 'typescript', 'fs', 'constants', 'stream', 'util', 'ass
|
|
|
19610
19649
|
* Use of this source code is governed by an MIT-style license that can be
|
|
19611
19650
|
* found in the LICENSE file at https://angular.io/license
|
|
19612
19651
|
*/
|
|
19613
|
-
const VERSION$1 = new Version('11.0.
|
|
19652
|
+
const VERSION$1 = new Version('11.0.8');
|
|
19614
19653
|
|
|
19615
19654
|
/**
|
|
19616
19655
|
* @license
|
|
@@ -20245,7 +20284,7 @@ define(['exports', 'os', 'typescript', 'fs', 'constants', 'stream', 'util', 'ass
|
|
|
20245
20284
|
* Use of this source code is governed by an MIT-style license that can be
|
|
20246
20285
|
* found in the LICENSE file at https://angular.io/license
|
|
20247
20286
|
*/
|
|
20248
|
-
const VERSION$2 = new Version('11.0.
|
|
20287
|
+
const VERSION$2 = new Version('11.0.8');
|
|
20249
20288
|
|
|
20250
20289
|
/**
|
|
20251
20290
|
* @license
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular v11.0.
|
|
2
|
+
* @license Angular v11.0.8
|
|
3
3
|
* Copyright Google LLC All Rights Reserved.
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
@@ -1921,10 +1921,6 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
|
|
|
1921
1921
|
}
|
|
1922
1922
|
const ERROR_SYNTAX_ERROR = 'ngSyntaxError';
|
|
1923
1923
|
const ERROR_PARSE_ERRORS = 'ngParseErrors';
|
|
1924
|
-
// Escape characters that have a special meaning in Regular Expressions
|
|
1925
|
-
function escapeRegExp(s) {
|
|
1926
|
-
return s.replace(/([.*+?^=!:${}()|[\]\/\\])/g, '\\$1');
|
|
1927
|
-
}
|
|
1928
1924
|
const STRING_MAP_PROTO = Object.getPrototypeOf({});
|
|
1929
1925
|
function isStrictStringMap(obj) {
|
|
1930
1926
|
return typeof obj === 'object' && obj !== null && Object.getPrototypeOf(obj) === STRING_MAP_PROTO;
|
|
@@ -8188,12 +8184,13 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
|
|
|
8188
8184
|
this.index = 0;
|
|
8189
8185
|
// Replaces attribute selectors with placeholders.
|
|
8190
8186
|
// The WS in [attr="va lue"] would otherwise be interpreted as a selector separator.
|
|
8191
|
-
selector =
|
|
8192
|
-
|
|
8193
|
-
|
|
8194
|
-
|
|
8195
|
-
|
|
8196
|
-
|
|
8187
|
+
selector = this._escapeRegexMatches(selector, /(\[[^\]]*\])/g);
|
|
8188
|
+
// CSS allows for certain special characters to be used in selectors if they're escaped.
|
|
8189
|
+
// E.g. `.foo:blue` won't match a class called `foo:blue`, because the colon denotes a
|
|
8190
|
+
// pseudo-class, but writing `.foo\:blue` will match, because the colon was escaped.
|
|
8191
|
+
// Replace all escape sequences (`\` followed by a character) with a placeholder so
|
|
8192
|
+
// that our handling of pseudo-selectors doesn't mess with them.
|
|
8193
|
+
selector = this._escapeRegexMatches(selector, /(\\.)/g);
|
|
8197
8194
|
// Replaces the expression in `:nth-child(2n + 1)` with a placeholder.
|
|
8198
8195
|
// WS and "+" would otherwise be interpreted as selector separators.
|
|
8199
8196
|
this._content = selector.replace(/(:nth-[-\w]+)(\([^)]+\))/g, (_, pseudo, exp) => {
|
|
@@ -8204,11 +8201,23 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
|
|
|
8204
8201
|
});
|
|
8205
8202
|
}
|
|
8206
8203
|
restore(content) {
|
|
8207
|
-
return content.replace(/__ph-(\d+)__/g, (
|
|
8204
|
+
return content.replace(/__ph-(\d+)__/g, (_ph, index) => this.placeholders[+index]);
|
|
8208
8205
|
}
|
|
8209
8206
|
content() {
|
|
8210
8207
|
return this._content;
|
|
8211
8208
|
}
|
|
8209
|
+
/**
|
|
8210
|
+
* Replaces all of the substrings that match a regex within a
|
|
8211
|
+
* special string (e.g. `__ph-0__`, `__ph-1__`, etc).
|
|
8212
|
+
*/
|
|
8213
|
+
_escapeRegexMatches(content, pattern) {
|
|
8214
|
+
return content.replace(pattern, (_, keep) => {
|
|
8215
|
+
const replaceBy = `__ph-${this.index}__`;
|
|
8216
|
+
this.placeholders.push(keep);
|
|
8217
|
+
this.index++;
|
|
8218
|
+
return replaceBy;
|
|
8219
|
+
});
|
|
8220
|
+
}
|
|
8212
8221
|
}
|
|
8213
8222
|
const _cssContentNextSelectorRe = /polyfill-next-selector[^}]*content:[\s]*?(['"])(.*?)\1[;\s]*}([^{]*?){/gim;
|
|
8214
8223
|
const _cssContentRuleRe = /(polyfill-rule)[^}]*(content:[\s]*(['"])(.*?)\3)[;\s]*[^}]*}/gim;
|
|
@@ -12946,19 +12955,6 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
|
|
|
12946
12955
|
this.errors = errors;
|
|
12947
12956
|
}
|
|
12948
12957
|
}
|
|
12949
|
-
const defaultInterpolateRegExp = _createInterpolateRegExp(DEFAULT_INTERPOLATION_CONFIG);
|
|
12950
|
-
function _getInterpolateRegExp(config) {
|
|
12951
|
-
if (config === DEFAULT_INTERPOLATION_CONFIG) {
|
|
12952
|
-
return defaultInterpolateRegExp;
|
|
12953
|
-
}
|
|
12954
|
-
else {
|
|
12955
|
-
return _createInterpolateRegExp(config);
|
|
12956
|
-
}
|
|
12957
|
-
}
|
|
12958
|
-
function _createInterpolateRegExp(config) {
|
|
12959
|
-
const pattern = escapeRegExp(config.start) + '([\\s\\S]*?)' + escapeRegExp(config.end);
|
|
12960
|
-
return new RegExp(pattern, 'g');
|
|
12961
|
-
}
|
|
12962
12958
|
class Parser$1 {
|
|
12963
12959
|
constructor(_lexer) {
|
|
12964
12960
|
this._lexer = _lexer;
|
|
@@ -13115,10 +13111,10 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
|
|
|
13115
13111
|
atInterpolation = true;
|
|
13116
13112
|
}
|
|
13117
13113
|
else {
|
|
13118
|
-
// parse from starting {{ to ending }}
|
|
13114
|
+
// parse from starting {{ to ending }} while ignoring content inside quotes.
|
|
13119
13115
|
const fullStart = i;
|
|
13120
13116
|
const exprStart = fullStart + interpStart.length;
|
|
13121
|
-
const exprEnd =
|
|
13117
|
+
const exprEnd = this._getInterpolationEndIndex(input, interpEnd, exprStart);
|
|
13122
13118
|
if (exprEnd === -1) {
|
|
13123
13119
|
// Could not find the end of the interpolation; do not parse an expression.
|
|
13124
13120
|
// Instead we should extend the content on the last raw string.
|
|
@@ -13177,27 +13173,70 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
|
|
|
13177
13173
|
}
|
|
13178
13174
|
return null;
|
|
13179
13175
|
}
|
|
13180
|
-
_checkNoInterpolation(input, location,
|
|
13181
|
-
|
|
13182
|
-
|
|
13183
|
-
|
|
13184
|
-
|
|
13176
|
+
_checkNoInterpolation(input, location, { start, end }) {
|
|
13177
|
+
let startIndex = -1;
|
|
13178
|
+
let endIndex = -1;
|
|
13179
|
+
for (const charIndex of this._forEachUnquotedChar(input, 0)) {
|
|
13180
|
+
if (startIndex === -1) {
|
|
13181
|
+
if (input.startsWith(start)) {
|
|
13182
|
+
startIndex = charIndex;
|
|
13183
|
+
}
|
|
13184
|
+
}
|
|
13185
|
+
else {
|
|
13186
|
+
endIndex = this._getInterpolationEndIndex(input, end, charIndex);
|
|
13187
|
+
if (endIndex > -1) {
|
|
13188
|
+
break;
|
|
13189
|
+
}
|
|
13190
|
+
}
|
|
13191
|
+
}
|
|
13192
|
+
if (startIndex > -1 && endIndex > -1) {
|
|
13193
|
+
this._reportError(`Got interpolation (${start}${end}) where expression was expected`, input, `at column ${startIndex} in`, location);
|
|
13185
13194
|
}
|
|
13186
13195
|
}
|
|
13187
|
-
|
|
13188
|
-
|
|
13189
|
-
|
|
13190
|
-
|
|
13191
|
-
|
|
13192
|
-
|
|
13196
|
+
/**
|
|
13197
|
+
* Finds the index of the end of an interpolation expression
|
|
13198
|
+
* while ignoring comments and quoted content.
|
|
13199
|
+
*/
|
|
13200
|
+
_getInterpolationEndIndex(input, expressionEnd, start) {
|
|
13201
|
+
for (const charIndex of this._forEachUnquotedChar(input, start)) {
|
|
13202
|
+
if (input.startsWith(expressionEnd, charIndex)) {
|
|
13203
|
+
return charIndex;
|
|
13204
|
+
}
|
|
13205
|
+
// Nothing else in the expression matters after we've
|
|
13206
|
+
// hit a comment so look directly for the end token.
|
|
13207
|
+
if (input.startsWith('//', charIndex)) {
|
|
13208
|
+
return input.indexOf(expressionEnd, charIndex);
|
|
13209
|
+
}
|
|
13210
|
+
}
|
|
13211
|
+
return -1;
|
|
13212
|
+
}
|
|
13213
|
+
/**
|
|
13214
|
+
* Generator used to iterate over the character indexes of a string that are outside of quotes.
|
|
13215
|
+
* @param input String to loop through.
|
|
13216
|
+
* @param start Index within the string at which to start.
|
|
13217
|
+
*/
|
|
13218
|
+
*_forEachUnquotedChar(input, start) {
|
|
13219
|
+
let currentQuote = null;
|
|
13220
|
+
let escapeCount = 0;
|
|
13221
|
+
for (let i = start; i < input.length; i++) {
|
|
13222
|
+
const char = input[i];
|
|
13223
|
+
// Skip the characters inside quotes. Note that we only care about the outer-most
|
|
13224
|
+
// quotes matching up and we need to account for escape characters.
|
|
13225
|
+
if (isQuote(input.charCodeAt(i)) && (currentQuote === null || currentQuote === char) &&
|
|
13226
|
+
escapeCount % 2 === 0) {
|
|
13227
|
+
currentQuote = currentQuote === null ? char : null;
|
|
13228
|
+
}
|
|
13229
|
+
else if (currentQuote === null) {
|
|
13230
|
+
yield i;
|
|
13231
|
+
}
|
|
13232
|
+
escapeCount = char === '\\' ? escapeCount + 1 : 0;
|
|
13193
13233
|
}
|
|
13194
|
-
return errLocation.length;
|
|
13195
13234
|
}
|
|
13196
13235
|
}
|
|
13197
13236
|
class IvyParser extends Parser$1 {
|
|
13198
13237
|
constructor() {
|
|
13199
13238
|
super(...arguments);
|
|
13200
|
-
this.simpleExpressionChecker = IvySimpleExpressionChecker;
|
|
13239
|
+
this.simpleExpressionChecker = IvySimpleExpressionChecker;
|
|
13201
13240
|
}
|
|
13202
13241
|
}
|
|
13203
13242
|
/** Describes a stateful context an expression parser is in. */
|
|
@@ -18407,7 +18446,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
|
|
|
18407
18446
|
* Use of this source code is governed by an MIT-style license that can be
|
|
18408
18447
|
* found in the LICENSE file at https://angular.io/license
|
|
18409
18448
|
*/
|
|
18410
|
-
const VERSION$1 = new Version('11.0.
|
|
18449
|
+
const VERSION$1 = new Version('11.0.8');
|
|
18411
18450
|
|
|
18412
18451
|
/**
|
|
18413
18452
|
* @license
|
|
@@ -26904,6 +26943,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
|
|
|
26904
26943
|
// T_HOST is index 6
|
|
26905
26944
|
// We already have this constants in LView, we don't need to re-create it.
|
|
26906
26945
|
const NATIVE = 7;
|
|
26946
|
+
const VIEW_REFS = 8;
|
|
26907
26947
|
const MOVED_VIEWS = 9;
|
|
26908
26948
|
/**
|
|
26909
26949
|
* Size of LContainer's header. Represents the index after which all views in the
|
|
@@ -27862,8 +27902,9 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
|
|
|
27862
27902
|
(currentView[PREORDER_HOOK_FLAGS] & 65535 /* IndexOfTheNextPreOrderHookMaskMask */) :
|
|
27863
27903
|
0;
|
|
27864
27904
|
const nodeIndexLimit = currentNodeIndex != null ? currentNodeIndex : -1;
|
|
27905
|
+
const max = arr.length - 1; // Stop the loop at length - 1, because we look for the hook at i + 1
|
|
27865
27906
|
let lastNodeIndexFound = 0;
|
|
27866
|
-
for (let i = startIndex; i <
|
|
27907
|
+
for (let i = startIndex; i < max; i++) {
|
|
27867
27908
|
const hook = arr[i + 1];
|
|
27868
27909
|
if (typeof hook === 'number') {
|
|
27869
27910
|
lastNodeIndexFound = arr[i];
|
|
@@ -27900,8 +27941,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
|
|
|
27900
27941
|
const directive = currentView[directiveIndex];
|
|
27901
27942
|
if (isInitHook) {
|
|
27902
27943
|
const indexWithintInitPhase = currentView[FLAGS] >> 11 /* IndexWithinInitPhaseShift */;
|
|
27903
|
-
// The init phase state must be always checked here as it may have been recursively
|
|
27904
|
-
// updated
|
|
27944
|
+
// The init phase state must be always checked here as it may have been recursively updated.
|
|
27905
27945
|
if (indexWithintInitPhase <
|
|
27906
27946
|
(currentView[PREORDER_HOOK_FLAGS] >> 16 /* NumberOfInitHooksCalledShift */) &&
|
|
27907
27947
|
(currentView[FLAGS] & 3 /* InitPhaseStateMask */) === initPhase) {
|
|
@@ -29128,6 +29168,15 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
|
|
|
29128
29168
|
* Use of this source code is governed by an MIT-style license that can be
|
|
29129
29169
|
* found in the LICENSE file at https://angular.io/license
|
|
29130
29170
|
*/
|
|
29171
|
+
function removeFromArray(arr, index) {
|
|
29172
|
+
// perf: array.pop is faster than array.splice!
|
|
29173
|
+
if (index >= arr.length - 1) {
|
|
29174
|
+
return arr.pop();
|
|
29175
|
+
}
|
|
29176
|
+
else {
|
|
29177
|
+
return arr.splice(index, 1)[0];
|
|
29178
|
+
}
|
|
29179
|
+
}
|
|
29131
29180
|
function newArray$1(size, value) {
|
|
29132
29181
|
const list = [];
|
|
29133
29182
|
for (let i = 0; i < size; i++) {
|
|
@@ -29529,6 +29578,9 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
|
|
|
29529
29578
|
else if (meta instanceof Self || meta.ngMetadataName === 'Self' || meta === Self) {
|
|
29530
29579
|
flags |= InjectFlags.Self;
|
|
29531
29580
|
}
|
|
29581
|
+
else if (meta instanceof Host || meta.ngMetadataName === 'Host' || meta === Host) {
|
|
29582
|
+
flags |= InjectFlags.Host;
|
|
29583
|
+
}
|
|
29532
29584
|
else if (meta instanceof Inject || meta === Inject) {
|
|
29533
29585
|
type = meta.token;
|
|
29534
29586
|
}
|
|
@@ -30087,6 +30139,22 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
|
|
|
30087
30139
|
renderer.createElementNS(namespace, name);
|
|
30088
30140
|
}
|
|
30089
30141
|
}
|
|
30142
|
+
/**
|
|
30143
|
+
* Removes all DOM elements associated with a view.
|
|
30144
|
+
*
|
|
30145
|
+
* Because some root nodes of the view may be containers, we sometimes need
|
|
30146
|
+
* to propagate deeply into the nested containers to remove all elements in the
|
|
30147
|
+
* views beneath it.
|
|
30148
|
+
*
|
|
30149
|
+
* @param tView The `TView' of the `LView` from which elements should be added or removed
|
|
30150
|
+
* @param lView The view from which elements should be added or removed
|
|
30151
|
+
*/
|
|
30152
|
+
function removeViewFromContainer(tView, lView) {
|
|
30153
|
+
const renderer = lView[RENDERER];
|
|
30154
|
+
applyView(tView, lView, renderer, 2 /* Detach */, null, null);
|
|
30155
|
+
lView[HOST] = null;
|
|
30156
|
+
lView[T_HOST] = null;
|
|
30157
|
+
}
|
|
30090
30158
|
/**
|
|
30091
30159
|
* Detach a `LView` from the DOM by detaching its nodes.
|
|
30092
30160
|
*
|
|
@@ -30164,6 +30232,43 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
|
|
|
30164
30232
|
}
|
|
30165
30233
|
movedViews.splice(declarationViewIndex, 1);
|
|
30166
30234
|
}
|
|
30235
|
+
/**
|
|
30236
|
+
* Detaches a view from a container.
|
|
30237
|
+
*
|
|
30238
|
+
* This method removes the view from the container's array of active views. It also
|
|
30239
|
+
* removes the view's elements from the DOM.
|
|
30240
|
+
*
|
|
30241
|
+
* @param lContainer The container from which to detach a view
|
|
30242
|
+
* @param removeIndex The index of the view to detach
|
|
30243
|
+
* @returns Detached LView instance.
|
|
30244
|
+
*/
|
|
30245
|
+
function detachView(lContainer, removeIndex) {
|
|
30246
|
+
if (lContainer.length <= CONTAINER_HEADER_OFFSET)
|
|
30247
|
+
return;
|
|
30248
|
+
const indexInContainer = CONTAINER_HEADER_OFFSET + removeIndex;
|
|
30249
|
+
const viewToDetach = lContainer[indexInContainer];
|
|
30250
|
+
if (viewToDetach) {
|
|
30251
|
+
const declarationLContainer = viewToDetach[DECLARATION_LCONTAINER];
|
|
30252
|
+
if (declarationLContainer !== null && declarationLContainer !== lContainer) {
|
|
30253
|
+
detachMovedView(declarationLContainer, viewToDetach);
|
|
30254
|
+
}
|
|
30255
|
+
if (removeIndex > 0) {
|
|
30256
|
+
lContainer[indexInContainer - 1][NEXT] = viewToDetach[NEXT];
|
|
30257
|
+
}
|
|
30258
|
+
const removedLView = removeFromArray(lContainer, CONTAINER_HEADER_OFFSET + removeIndex);
|
|
30259
|
+
removeViewFromContainer(viewToDetach[TVIEW], viewToDetach);
|
|
30260
|
+
// notify query that a view has been removed
|
|
30261
|
+
const lQueries = removedLView[QUERIES];
|
|
30262
|
+
if (lQueries !== null) {
|
|
30263
|
+
lQueries.detachView(removedLView[TVIEW]);
|
|
30264
|
+
}
|
|
30265
|
+
viewToDetach[PARENT] = null;
|
|
30266
|
+
viewToDetach[NEXT] = null;
|
|
30267
|
+
// Unsets the attached flag
|
|
30268
|
+
viewToDetach[FLAGS] &= ~128 /* Attached */;
|
|
30269
|
+
}
|
|
30270
|
+
return viewToDetach;
|
|
30271
|
+
}
|
|
30167
30272
|
/**
|
|
30168
30273
|
* A standalone function which destroys an LView,
|
|
30169
30274
|
* conducting clean up (e.g. removing listeners, calling onDestroys).
|
|
@@ -30261,12 +30366,12 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
|
|
|
30261
30366
|
tCleanup[i].call(context);
|
|
30262
30367
|
}
|
|
30263
30368
|
}
|
|
30264
|
-
|
|
30265
|
-
|
|
30266
|
-
|
|
30267
|
-
|
|
30268
|
-
|
|
30269
|
-
|
|
30369
|
+
}
|
|
30370
|
+
if (lCleanup !== null) {
|
|
30371
|
+
for (let i = lastLCleanupIndex + 1; i < lCleanup.length; i++) {
|
|
30372
|
+
const instanceCleanupFn = lCleanup[i];
|
|
30373
|
+
ngDevMode && assertFunction(instanceCleanupFn, 'Expecting instance cleanup function.');
|
|
30374
|
+
instanceCleanupFn();
|
|
30270
30375
|
}
|
|
30271
30376
|
lView[CLEANUP] = null;
|
|
30272
30377
|
}
|
|
@@ -31895,19 +32000,19 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
|
|
|
31895
32000
|
* is `null` and the function is store in `LView` (rather than it `TView`).
|
|
31896
32001
|
*/
|
|
31897
32002
|
function storeCleanupWithContext(tView, lView, context, cleanupFn) {
|
|
31898
|
-
const lCleanup =
|
|
32003
|
+
const lCleanup = getOrCreateLViewCleanup(lView);
|
|
31899
32004
|
if (context === null) {
|
|
31900
32005
|
// If context is null that this is instance specific callback. These callbacks can only be
|
|
31901
32006
|
// inserted after template shared instances. For this reason in ngDevMode we freeze the TView.
|
|
31902
32007
|
if (ngDevMode) {
|
|
31903
|
-
Object.freeze(
|
|
32008
|
+
Object.freeze(getOrCreateTViewCleanup(tView));
|
|
31904
32009
|
}
|
|
31905
32010
|
lCleanup.push(cleanupFn);
|
|
31906
32011
|
}
|
|
31907
32012
|
else {
|
|
31908
32013
|
lCleanup.push(context);
|
|
31909
32014
|
if (tView.firstCreatePass) {
|
|
31910
|
-
|
|
32015
|
+
getOrCreateTViewCleanup(tView).push(cleanupFn, lCleanup.length - 1);
|
|
31911
32016
|
}
|
|
31912
32017
|
}
|
|
31913
32018
|
}
|
|
@@ -32379,11 +32484,11 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
|
|
|
32379
32484
|
viewQueryFn(flags, component);
|
|
32380
32485
|
}
|
|
32381
32486
|
const CLEAN_PROMISE = _CLEAN_PROMISE;
|
|
32382
|
-
function
|
|
32487
|
+
function getOrCreateLViewCleanup(view) {
|
|
32383
32488
|
// top level variables should not be exported for performance reasons (PERF_NOTES.md)
|
|
32384
32489
|
return view[CLEANUP] || (view[CLEANUP] = ngDevMode ? new LCleanup() : []);
|
|
32385
32490
|
}
|
|
32386
|
-
function
|
|
32491
|
+
function getOrCreateTViewCleanup(tView) {
|
|
32387
32492
|
return tView.cleanup || (tView.cleanup = ngDevMode ? new TCleanup() : []);
|
|
32388
32493
|
}
|
|
32389
32494
|
/** Handles an error thrown in an LView. */
|
|
@@ -34302,7 +34407,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
|
|
|
34302
34407
|
/**
|
|
34303
34408
|
* @publicApi
|
|
34304
34409
|
*/
|
|
34305
|
-
const VERSION$2 = new Version$1('11.0.
|
|
34410
|
+
const VERSION$2 = new Version$1('11.0.8');
|
|
34306
34411
|
|
|
34307
34412
|
/**
|
|
34308
34413
|
* @license
|
|
@@ -35461,7 +35566,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
|
|
|
35461
35566
|
this._lView = _lView;
|
|
35462
35567
|
this._cdRefInjectingView = _cdRefInjectingView;
|
|
35463
35568
|
this._appRef = null;
|
|
35464
|
-
this.
|
|
35569
|
+
this._attachedToViewContainer = false;
|
|
35465
35570
|
}
|
|
35466
35571
|
get rootNodes() {
|
|
35467
35572
|
const lView = this._lView;
|
|
@@ -35478,12 +35583,19 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
|
|
|
35478
35583
|
if (this._appRef) {
|
|
35479
35584
|
this._appRef.detachView(this);
|
|
35480
35585
|
}
|
|
35481
|
-
else if (this.
|
|
35482
|
-
const
|
|
35483
|
-
if (
|
|
35484
|
-
|
|
35586
|
+
else if (this._attachedToViewContainer) {
|
|
35587
|
+
const parent = this._lView[PARENT];
|
|
35588
|
+
if (isLContainer(parent)) {
|
|
35589
|
+
const viewRefs = parent[VIEW_REFS];
|
|
35590
|
+
const index = viewRefs ? viewRefs.indexOf(this) : -1;
|
|
35591
|
+
if (index > -1) {
|
|
35592
|
+
ngDevMode &&
|
|
35593
|
+
assertEqual(index, parent.indexOf(this._lView) - CONTAINER_HEADER_OFFSET, 'An attached view should be in the same position within its container as its ViewRef in the VIEW_REFS array.');
|
|
35594
|
+
detachView(parent, index);
|
|
35595
|
+
removeFromArray(viewRefs, index);
|
|
35596
|
+
}
|
|
35485
35597
|
}
|
|
35486
|
-
this.
|
|
35598
|
+
this._attachedToViewContainer = false;
|
|
35487
35599
|
}
|
|
35488
35600
|
destroyLView(this._lView[TVIEW], this._lView);
|
|
35489
35601
|
}
|
|
@@ -35675,18 +35787,18 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
|
|
|
35675
35787
|
checkNoChanges() {
|
|
35676
35788
|
checkNoChangesInternal(this._lView[TVIEW], this._lView, this.context);
|
|
35677
35789
|
}
|
|
35678
|
-
attachToViewContainerRef(
|
|
35790
|
+
attachToViewContainerRef() {
|
|
35679
35791
|
if (this._appRef) {
|
|
35680
35792
|
throw new Error('This view is already attached directly to the ApplicationRef!');
|
|
35681
35793
|
}
|
|
35682
|
-
this.
|
|
35794
|
+
this._attachedToViewContainer = true;
|
|
35683
35795
|
}
|
|
35684
35796
|
detachFromAppRef() {
|
|
35685
35797
|
this._appRef = null;
|
|
35686
35798
|
renderDetachView(this._lView[TVIEW], this._lView);
|
|
35687
35799
|
}
|
|
35688
35800
|
attachToAppRef(appRef) {
|
|
35689
|
-
if (this.
|
|
35801
|
+
if (this._attachedToViewContainer) {
|
|
35690
35802
|
throw new Error('This view is already attached to a ViewContainer!');
|
|
35691
35803
|
}
|
|
35692
35804
|
this._appRef = appRef;
|
|
@@ -38928,7 +39040,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
|
|
|
38928
39040
|
}
|
|
38929
39041
|
/**
|
|
38930
39042
|
* Creates a factory for a platform. Can be used to provide or override `Providers` specific to
|
|
38931
|
-
* your
|
|
39043
|
+
* your application's runtime needs, such as `PLATFORM_INITIALIZER` and `PLATFORM_ID`.
|
|
38932
39044
|
* @param parentPlatformFactory Another platform factory to modify. Allows you to compose factories
|
|
38933
39045
|
* to build up configurations that might be required by different libraries or parts of the
|
|
38934
39046
|
* application.
|