@angular/language-service 13.0.3 → 13.1.0-next.3
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/language-service.js +927 -836
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular v13.0.3
|
|
2
|
+
* @license Angular v13.1.0-next.3
|
|
3
3
|
* Copyright Google LLC All Rights Reserved.
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
@@ -27,7 +27,7 @@ module.exports = function(provided) {
|
|
|
27
27
|
return results;
|
|
28
28
|
};
|
|
29
29
|
|
|
30
|
-
define(['exports', 'typescript/lib/tsserverlibrary', 'os', 'typescript', 'fs', 'module', 'path', 'url'], (function (exports, ts$1, os, ts, fs$1, module,
|
|
30
|
+
define(['exports', 'typescript/lib/tsserverlibrary', 'os', 'typescript', 'fs', 'module', 'path', 'url'], (function (exports, ts$1, os, ts, fs$1, module, p, url) { 'use strict';
|
|
31
31
|
|
|
32
32
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
33
33
|
|
|
@@ -53,7 +53,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'os', 'typescript', 'fs', '
|
|
|
53
53
|
var ts__default = /*#__PURE__*/_interopDefaultLegacy(ts);
|
|
54
54
|
var fs__namespace = /*#__PURE__*/_interopNamespace(fs$1);
|
|
55
55
|
var module__default = /*#__PURE__*/_interopDefaultLegacy(module);
|
|
56
|
-
var
|
|
56
|
+
var p__namespace = /*#__PURE__*/_interopNamespace(p);
|
|
57
57
|
|
|
58
58
|
/**
|
|
59
59
|
* The default `FileSystem` that will always fail.
|
|
@@ -342,28 +342,28 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'os', 'typescript', 'fs', '
|
|
|
342
342
|
process.chdir(dir);
|
|
343
343
|
}
|
|
344
344
|
resolve(...paths) {
|
|
345
|
-
return this.normalize(
|
|
345
|
+
return this.normalize(p__namespace.resolve(...paths));
|
|
346
346
|
}
|
|
347
347
|
dirname(file) {
|
|
348
|
-
return this.normalize(
|
|
348
|
+
return this.normalize(p__namespace.dirname(file));
|
|
349
349
|
}
|
|
350
350
|
join(basePath, ...paths) {
|
|
351
|
-
return this.normalize(
|
|
351
|
+
return this.normalize(p__namespace.join(basePath, ...paths));
|
|
352
352
|
}
|
|
353
353
|
isRoot(path) {
|
|
354
354
|
return this.dirname(path) === this.normalize(path);
|
|
355
355
|
}
|
|
356
356
|
isRooted(path) {
|
|
357
|
-
return
|
|
357
|
+
return p__namespace.isAbsolute(path);
|
|
358
358
|
}
|
|
359
359
|
relative(from, to) {
|
|
360
|
-
return this.normalize(
|
|
360
|
+
return this.normalize(p__namespace.relative(from, to));
|
|
361
361
|
}
|
|
362
362
|
basename(filePath, extension) {
|
|
363
|
-
return
|
|
363
|
+
return p__namespace.basename(filePath, extension);
|
|
364
364
|
}
|
|
365
365
|
extname(path) {
|
|
366
|
-
return
|
|
366
|
+
return p__namespace.extname(path);
|
|
367
367
|
}
|
|
368
368
|
normalize(path) {
|
|
369
369
|
// Convert backslashes to forward slashes
|
|
@@ -1112,6 +1112,624 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'os', 'typescript', 'fs', '
|
|
|
1112
1112
|
return selector ? CssSelector.parse(selector).map(parserSelectorToR3Selector) : [];
|
|
1113
1113
|
}
|
|
1114
1114
|
|
|
1115
|
+
/**
|
|
1116
|
+
* @license
|
|
1117
|
+
* Copyright Google LLC All Rights Reserved.
|
|
1118
|
+
*
|
|
1119
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
1120
|
+
* found in the LICENSE file at https://angular.io/license
|
|
1121
|
+
*/
|
|
1122
|
+
const DASH_CASE_REGEXP = /-+([a-z0-9])/g;
|
|
1123
|
+
function dashCaseToCamelCase(input) {
|
|
1124
|
+
return input.replace(DASH_CASE_REGEXP, (...m) => m[1].toUpperCase());
|
|
1125
|
+
}
|
|
1126
|
+
function splitAtColon(input, defaultValues) {
|
|
1127
|
+
return _splitAt(input, ':', defaultValues);
|
|
1128
|
+
}
|
|
1129
|
+
function splitAtPeriod(input, defaultValues) {
|
|
1130
|
+
return _splitAt(input, '.', defaultValues);
|
|
1131
|
+
}
|
|
1132
|
+
function _splitAt(input, character, defaultValues) {
|
|
1133
|
+
const characterIndex = input.indexOf(character);
|
|
1134
|
+
if (characterIndex == -1)
|
|
1135
|
+
return defaultValues;
|
|
1136
|
+
return [input.slice(0, characterIndex).trim(), input.slice(characterIndex + 1).trim()];
|
|
1137
|
+
}
|
|
1138
|
+
function error(msg) {
|
|
1139
|
+
throw new Error(`Internal Error: ${msg}`);
|
|
1140
|
+
}
|
|
1141
|
+
function utf8Encode(str) {
|
|
1142
|
+
let encoded = [];
|
|
1143
|
+
for (let index = 0; index < str.length; index++) {
|
|
1144
|
+
let codePoint = str.charCodeAt(index);
|
|
1145
|
+
// decode surrogate
|
|
1146
|
+
// see https://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae
|
|
1147
|
+
if (codePoint >= 0xd800 && codePoint <= 0xdbff && str.length > (index + 1)) {
|
|
1148
|
+
const low = str.charCodeAt(index + 1);
|
|
1149
|
+
if (low >= 0xdc00 && low <= 0xdfff) {
|
|
1150
|
+
index++;
|
|
1151
|
+
codePoint = ((codePoint - 0xd800) << 10) + low - 0xdc00 + 0x10000;
|
|
1152
|
+
}
|
|
1153
|
+
}
|
|
1154
|
+
if (codePoint <= 0x7f) {
|
|
1155
|
+
encoded.push(codePoint);
|
|
1156
|
+
}
|
|
1157
|
+
else if (codePoint <= 0x7ff) {
|
|
1158
|
+
encoded.push(((codePoint >> 6) & 0x1F) | 0xc0, (codePoint & 0x3f) | 0x80);
|
|
1159
|
+
}
|
|
1160
|
+
else if (codePoint <= 0xffff) {
|
|
1161
|
+
encoded.push((codePoint >> 12) | 0xe0, ((codePoint >> 6) & 0x3f) | 0x80, (codePoint & 0x3f) | 0x80);
|
|
1162
|
+
}
|
|
1163
|
+
else if (codePoint <= 0x1fffff) {
|
|
1164
|
+
encoded.push(((codePoint >> 18) & 0x07) | 0xf0, ((codePoint >> 12) & 0x3f) | 0x80, ((codePoint >> 6) & 0x3f) | 0x80, (codePoint & 0x3f) | 0x80);
|
|
1165
|
+
}
|
|
1166
|
+
}
|
|
1167
|
+
return encoded;
|
|
1168
|
+
}
|
|
1169
|
+
function stringify(token) {
|
|
1170
|
+
if (typeof token === 'string') {
|
|
1171
|
+
return token;
|
|
1172
|
+
}
|
|
1173
|
+
if (Array.isArray(token)) {
|
|
1174
|
+
return '[' + token.map(stringify).join(', ') + ']';
|
|
1175
|
+
}
|
|
1176
|
+
if (token == null) {
|
|
1177
|
+
return '' + token;
|
|
1178
|
+
}
|
|
1179
|
+
if (token.overriddenName) {
|
|
1180
|
+
return `${token.overriddenName}`;
|
|
1181
|
+
}
|
|
1182
|
+
if (token.name) {
|
|
1183
|
+
return `${token.name}`;
|
|
1184
|
+
}
|
|
1185
|
+
if (!token.toString) {
|
|
1186
|
+
return 'object';
|
|
1187
|
+
}
|
|
1188
|
+
// WARNING: do not try to `JSON.stringify(token)` here
|
|
1189
|
+
// see https://github.com/angular/angular/issues/23440
|
|
1190
|
+
const res = token.toString();
|
|
1191
|
+
if (res == null) {
|
|
1192
|
+
return '' + res;
|
|
1193
|
+
}
|
|
1194
|
+
const newLineIndex = res.indexOf('\n');
|
|
1195
|
+
return newLineIndex === -1 ? res : res.substring(0, newLineIndex);
|
|
1196
|
+
}
|
|
1197
|
+
class Version {
|
|
1198
|
+
constructor(full) {
|
|
1199
|
+
this.full = full;
|
|
1200
|
+
const splits = full.split('.');
|
|
1201
|
+
this.major = splits[0];
|
|
1202
|
+
this.minor = splits[1];
|
|
1203
|
+
this.patch = splits.slice(2).join('.');
|
|
1204
|
+
}
|
|
1205
|
+
}
|
|
1206
|
+
const __window = typeof window !== 'undefined' && window;
|
|
1207
|
+
const __self = typeof self !== 'undefined' && typeof WorkerGlobalScope !== 'undefined' &&
|
|
1208
|
+
self instanceof WorkerGlobalScope && self;
|
|
1209
|
+
const __global = typeof global !== 'undefined' && global;
|
|
1210
|
+
// Check __global first, because in Node tests both __global and __window may be defined and _global
|
|
1211
|
+
// should be __global in that case.
|
|
1212
|
+
const _global = __global || __window || __self;
|
|
1213
|
+
function newArray(size, value) {
|
|
1214
|
+
const list = [];
|
|
1215
|
+
for (let i = 0; i < size; i++) {
|
|
1216
|
+
list.push(value);
|
|
1217
|
+
}
|
|
1218
|
+
return list;
|
|
1219
|
+
}
|
|
1220
|
+
/**
|
|
1221
|
+
* Partitions a given array into 2 arrays, based on a boolean value returned by the condition
|
|
1222
|
+
* function.
|
|
1223
|
+
*
|
|
1224
|
+
* @param arr Input array that should be partitioned
|
|
1225
|
+
* @param conditionFn Condition function that is called for each item in a given array and returns a
|
|
1226
|
+
* boolean value.
|
|
1227
|
+
*/
|
|
1228
|
+
function partitionArray(arr, conditionFn) {
|
|
1229
|
+
const truthy = [];
|
|
1230
|
+
const falsy = [];
|
|
1231
|
+
for (const item of arr) {
|
|
1232
|
+
(conditionFn(item) ? truthy : falsy).push(item);
|
|
1233
|
+
}
|
|
1234
|
+
return [truthy, falsy];
|
|
1235
|
+
}
|
|
1236
|
+
|
|
1237
|
+
/**
|
|
1238
|
+
* @license
|
|
1239
|
+
* Copyright Google LLC All Rights Reserved.
|
|
1240
|
+
*
|
|
1241
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
1242
|
+
* found in the LICENSE file at https://angular.io/license
|
|
1243
|
+
*/
|
|
1244
|
+
/**
|
|
1245
|
+
* Represents a big integer using a buffer of its individual digits, with the least significant
|
|
1246
|
+
* digit stored at the beginning of the array (little endian).
|
|
1247
|
+
*
|
|
1248
|
+
* For performance reasons, each instance is mutable. The addition operation can be done in-place
|
|
1249
|
+
* to reduce memory pressure of allocation for the digits array.
|
|
1250
|
+
*/
|
|
1251
|
+
class BigInteger {
|
|
1252
|
+
/**
|
|
1253
|
+
* Creates a big integer using its individual digits in little endian storage.
|
|
1254
|
+
*/
|
|
1255
|
+
constructor(digits) {
|
|
1256
|
+
this.digits = digits;
|
|
1257
|
+
}
|
|
1258
|
+
static zero() {
|
|
1259
|
+
return new BigInteger([0]);
|
|
1260
|
+
}
|
|
1261
|
+
static one() {
|
|
1262
|
+
return new BigInteger([1]);
|
|
1263
|
+
}
|
|
1264
|
+
/**
|
|
1265
|
+
* Creates a clone of this instance.
|
|
1266
|
+
*/
|
|
1267
|
+
clone() {
|
|
1268
|
+
return new BigInteger(this.digits.slice());
|
|
1269
|
+
}
|
|
1270
|
+
/**
|
|
1271
|
+
* Returns a new big integer with the sum of `this` and `other` as its value. This does not mutate
|
|
1272
|
+
* `this` but instead returns a new instance, unlike `addToSelf`.
|
|
1273
|
+
*/
|
|
1274
|
+
add(other) {
|
|
1275
|
+
const result = this.clone();
|
|
1276
|
+
result.addToSelf(other);
|
|
1277
|
+
return result;
|
|
1278
|
+
}
|
|
1279
|
+
/**
|
|
1280
|
+
* Adds `other` to the instance itself, thereby mutating its value.
|
|
1281
|
+
*/
|
|
1282
|
+
addToSelf(other) {
|
|
1283
|
+
const maxNrOfDigits = Math.max(this.digits.length, other.digits.length);
|
|
1284
|
+
let carry = 0;
|
|
1285
|
+
for (let i = 0; i < maxNrOfDigits; i++) {
|
|
1286
|
+
let digitSum = carry;
|
|
1287
|
+
if (i < this.digits.length) {
|
|
1288
|
+
digitSum += this.digits[i];
|
|
1289
|
+
}
|
|
1290
|
+
if (i < other.digits.length) {
|
|
1291
|
+
digitSum += other.digits[i];
|
|
1292
|
+
}
|
|
1293
|
+
if (digitSum >= 10) {
|
|
1294
|
+
this.digits[i] = digitSum - 10;
|
|
1295
|
+
carry = 1;
|
|
1296
|
+
}
|
|
1297
|
+
else {
|
|
1298
|
+
this.digits[i] = digitSum;
|
|
1299
|
+
carry = 0;
|
|
1300
|
+
}
|
|
1301
|
+
}
|
|
1302
|
+
// Apply a remaining carry if needed.
|
|
1303
|
+
if (carry > 0) {
|
|
1304
|
+
this.digits[maxNrOfDigits] = 1;
|
|
1305
|
+
}
|
|
1306
|
+
}
|
|
1307
|
+
/**
|
|
1308
|
+
* Builds the decimal string representation of the big integer. As this is stored in
|
|
1309
|
+
* little endian, the digits are concatenated in reverse order.
|
|
1310
|
+
*/
|
|
1311
|
+
toString() {
|
|
1312
|
+
let res = '';
|
|
1313
|
+
for (let i = this.digits.length - 1; i >= 0; i--) {
|
|
1314
|
+
res += this.digits[i];
|
|
1315
|
+
}
|
|
1316
|
+
return res;
|
|
1317
|
+
}
|
|
1318
|
+
}
|
|
1319
|
+
/**
|
|
1320
|
+
* Represents a big integer which is optimized for multiplication operations, as its power-of-twos
|
|
1321
|
+
* are memoized. See `multiplyBy()` for details on the multiplication algorithm.
|
|
1322
|
+
*/
|
|
1323
|
+
class BigIntForMultiplication {
|
|
1324
|
+
constructor(value) {
|
|
1325
|
+
this.powerOfTwos = [value];
|
|
1326
|
+
}
|
|
1327
|
+
/**
|
|
1328
|
+
* Returns the big integer itself.
|
|
1329
|
+
*/
|
|
1330
|
+
getValue() {
|
|
1331
|
+
return this.powerOfTwos[0];
|
|
1332
|
+
}
|
|
1333
|
+
/**
|
|
1334
|
+
* Computes the value for `num * b`, where `num` is a JS number and `b` is a big integer. The
|
|
1335
|
+
* value for `b` is represented by a storage model that is optimized for this computation.
|
|
1336
|
+
*
|
|
1337
|
+
* This operation is implemented in N(log2(num)) by continuous halving of the number, where the
|
|
1338
|
+
* least-significant bit (LSB) is tested in each iteration. If the bit is set, the bit's index is
|
|
1339
|
+
* used as exponent into the power-of-two multiplication of `b`.
|
|
1340
|
+
*
|
|
1341
|
+
* As an example, consider the multiplication num=42, b=1337. In binary 42 is 0b00101010 and the
|
|
1342
|
+
* algorithm unrolls into the following iterations:
|
|
1343
|
+
*
|
|
1344
|
+
* Iteration | num | LSB | b * 2^iter | Add? | product
|
|
1345
|
+
* -----------|------------|------|------------|------|--------
|
|
1346
|
+
* 0 | 0b00101010 | 0 | 1337 | No | 0
|
|
1347
|
+
* 1 | 0b00010101 | 1 | 2674 | Yes | 2674
|
|
1348
|
+
* 2 | 0b00001010 | 0 | 5348 | No | 2674
|
|
1349
|
+
* 3 | 0b00000101 | 1 | 10696 | Yes | 13370
|
|
1350
|
+
* 4 | 0b00000010 | 0 | 21392 | No | 13370
|
|
1351
|
+
* 5 | 0b00000001 | 1 | 42784 | Yes | 56154
|
|
1352
|
+
* 6 | 0b00000000 | 0 | 85568 | No | 56154
|
|
1353
|
+
*
|
|
1354
|
+
* The computed product of 56154 is indeed the correct result.
|
|
1355
|
+
*
|
|
1356
|
+
* The `BigIntForMultiplication` representation for a big integer provides memoized access to the
|
|
1357
|
+
* power-of-two values to reduce the workload in computing those values.
|
|
1358
|
+
*/
|
|
1359
|
+
multiplyBy(num) {
|
|
1360
|
+
const product = BigInteger.zero();
|
|
1361
|
+
this.multiplyByAndAddTo(num, product);
|
|
1362
|
+
return product;
|
|
1363
|
+
}
|
|
1364
|
+
/**
|
|
1365
|
+
* See `multiplyBy()` for details. This function allows for the computed product to be added
|
|
1366
|
+
* directly to the provided result big integer.
|
|
1367
|
+
*/
|
|
1368
|
+
multiplyByAndAddTo(num, result) {
|
|
1369
|
+
for (let exponent = 0; num !== 0; num = num >>> 1, exponent++) {
|
|
1370
|
+
if (num & 1) {
|
|
1371
|
+
const value = this.getMultipliedByPowerOfTwo(exponent);
|
|
1372
|
+
result.addToSelf(value);
|
|
1373
|
+
}
|
|
1374
|
+
}
|
|
1375
|
+
}
|
|
1376
|
+
/**
|
|
1377
|
+
* Computes and memoizes the big integer value for `this.number * 2^exponent`.
|
|
1378
|
+
*/
|
|
1379
|
+
getMultipliedByPowerOfTwo(exponent) {
|
|
1380
|
+
// Compute the powers up until the requested exponent, where each value is computed from its
|
|
1381
|
+
// predecessor. This is simple as `this.number * 2^(exponent - 1)` only has to be doubled (i.e.
|
|
1382
|
+
// added to itself) to reach `this.number * 2^exponent`.
|
|
1383
|
+
for (let i = this.powerOfTwos.length; i <= exponent; i++) {
|
|
1384
|
+
const previousPower = this.powerOfTwos[i - 1];
|
|
1385
|
+
this.powerOfTwos[i] = previousPower.add(previousPower);
|
|
1386
|
+
}
|
|
1387
|
+
return this.powerOfTwos[exponent];
|
|
1388
|
+
}
|
|
1389
|
+
}
|
|
1390
|
+
/**
|
|
1391
|
+
* Represents an exponentiation operation for the provided base, of which exponents are computed and
|
|
1392
|
+
* memoized. The results are represented by a `BigIntForMultiplication` which is tailored for
|
|
1393
|
+
* multiplication operations by memoizing the power-of-twos. This effectively results in a matrix
|
|
1394
|
+
* representation that is lazily computed upon request.
|
|
1395
|
+
*/
|
|
1396
|
+
class BigIntExponentiation {
|
|
1397
|
+
constructor(base) {
|
|
1398
|
+
this.base = base;
|
|
1399
|
+
this.exponents = [new BigIntForMultiplication(BigInteger.one())];
|
|
1400
|
+
}
|
|
1401
|
+
/**
|
|
1402
|
+
* Compute the value for `this.base^exponent`, resulting in a big integer that is optimized for
|
|
1403
|
+
* further multiplication operations.
|
|
1404
|
+
*/
|
|
1405
|
+
toThePowerOf(exponent) {
|
|
1406
|
+
// Compute the results up until the requested exponent, where every value is computed from its
|
|
1407
|
+
// predecessor. This is because `this.base^(exponent - 1)` only has to be multiplied by `base`
|
|
1408
|
+
// to reach `this.base^exponent`.
|
|
1409
|
+
for (let i = this.exponents.length; i <= exponent; i++) {
|
|
1410
|
+
const value = this.exponents[i - 1].multiplyBy(this.base);
|
|
1411
|
+
this.exponents[i] = new BigIntForMultiplication(value);
|
|
1412
|
+
}
|
|
1413
|
+
return this.exponents[exponent];
|
|
1414
|
+
}
|
|
1415
|
+
}
|
|
1416
|
+
|
|
1417
|
+
/**
|
|
1418
|
+
* @license
|
|
1419
|
+
* Copyright Google LLC All Rights Reserved.
|
|
1420
|
+
*
|
|
1421
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
1422
|
+
* found in the LICENSE file at https://angular.io/license
|
|
1423
|
+
*/
|
|
1424
|
+
/**
|
|
1425
|
+
* Compute the message id using the XLIFF1 digest.
|
|
1426
|
+
*/
|
|
1427
|
+
function computeDigest(message) {
|
|
1428
|
+
return sha1(serializeNodes(message.nodes).join('') + `[${message.meaning}]`);
|
|
1429
|
+
}
|
|
1430
|
+
/**
|
|
1431
|
+
* Return the message id or compute it using the XLIFF2/XMB/$localize digest.
|
|
1432
|
+
*/
|
|
1433
|
+
function decimalDigest(message) {
|
|
1434
|
+
return message.id || computeDecimalDigest(message);
|
|
1435
|
+
}
|
|
1436
|
+
/**
|
|
1437
|
+
* Compute the message id using the XLIFF2/XMB/$localize digest.
|
|
1438
|
+
*/
|
|
1439
|
+
function computeDecimalDigest(message) {
|
|
1440
|
+
const visitor = new _SerializerIgnoreIcuExpVisitor();
|
|
1441
|
+
const parts = message.nodes.map(a => a.visit(visitor, null));
|
|
1442
|
+
return computeMsgId(parts.join(''), message.meaning);
|
|
1443
|
+
}
|
|
1444
|
+
/**
|
|
1445
|
+
* Serialize the i18n ast to something xml-like in order to generate an UID.
|
|
1446
|
+
*
|
|
1447
|
+
* The visitor is also used in the i18n parser tests
|
|
1448
|
+
*
|
|
1449
|
+
* @internal
|
|
1450
|
+
*/
|
|
1451
|
+
class _SerializerVisitor {
|
|
1452
|
+
visitText(text, context) {
|
|
1453
|
+
return text.value;
|
|
1454
|
+
}
|
|
1455
|
+
visitContainer(container, context) {
|
|
1456
|
+
return `[${container.children.map(child => child.visit(this)).join(', ')}]`;
|
|
1457
|
+
}
|
|
1458
|
+
visitIcu(icu, context) {
|
|
1459
|
+
const strCases = Object.keys(icu.cases).map((k) => `${k} {${icu.cases[k].visit(this)}}`);
|
|
1460
|
+
return `{${icu.expression}, ${icu.type}, ${strCases.join(', ')}}`;
|
|
1461
|
+
}
|
|
1462
|
+
visitTagPlaceholder(ph, context) {
|
|
1463
|
+
return ph.isVoid ?
|
|
1464
|
+
`<ph tag name="${ph.startName}"/>` :
|
|
1465
|
+
`<ph tag name="${ph.startName}">${ph.children.map(child => child.visit(this)).join(', ')}</ph name="${ph.closeName}">`;
|
|
1466
|
+
}
|
|
1467
|
+
visitPlaceholder(ph, context) {
|
|
1468
|
+
return ph.value ? `<ph name="${ph.name}">${ph.value}</ph>` : `<ph name="${ph.name}"/>`;
|
|
1469
|
+
}
|
|
1470
|
+
visitIcuPlaceholder(ph, context) {
|
|
1471
|
+
return `<ph icu name="${ph.name}">${ph.value.visit(this)}</ph>`;
|
|
1472
|
+
}
|
|
1473
|
+
}
|
|
1474
|
+
const serializerVisitor$1 = new _SerializerVisitor();
|
|
1475
|
+
function serializeNodes(nodes) {
|
|
1476
|
+
return nodes.map(a => a.visit(serializerVisitor$1, null));
|
|
1477
|
+
}
|
|
1478
|
+
/**
|
|
1479
|
+
* Serialize the i18n ast to something xml-like in order to generate an UID.
|
|
1480
|
+
*
|
|
1481
|
+
* Ignore the ICU expressions so that message IDs stays identical if only the expression changes.
|
|
1482
|
+
*
|
|
1483
|
+
* @internal
|
|
1484
|
+
*/
|
|
1485
|
+
class _SerializerIgnoreIcuExpVisitor extends _SerializerVisitor {
|
|
1486
|
+
visitIcu(icu, context) {
|
|
1487
|
+
let strCases = Object.keys(icu.cases).map((k) => `${k} {${icu.cases[k].visit(this)}}`);
|
|
1488
|
+
// Do not take the expression into account
|
|
1489
|
+
return `{${icu.type}, ${strCases.join(', ')}}`;
|
|
1490
|
+
}
|
|
1491
|
+
}
|
|
1492
|
+
/**
|
|
1493
|
+
* Compute the SHA1 of the given string
|
|
1494
|
+
*
|
|
1495
|
+
* see https://csrc.nist.gov/publications/fips/fips180-4/fips-180-4.pdf
|
|
1496
|
+
*
|
|
1497
|
+
* WARNING: this function has not been designed not tested with security in mind.
|
|
1498
|
+
* DO NOT USE IT IN A SECURITY SENSITIVE CONTEXT.
|
|
1499
|
+
*/
|
|
1500
|
+
function sha1(str) {
|
|
1501
|
+
const utf8 = utf8Encode(str);
|
|
1502
|
+
const words32 = bytesToWords32(utf8, Endian.Big);
|
|
1503
|
+
const len = utf8.length * 8;
|
|
1504
|
+
const w = newArray(80);
|
|
1505
|
+
let a = 0x67452301, b = 0xefcdab89, c = 0x98badcfe, d = 0x10325476, e = 0xc3d2e1f0;
|
|
1506
|
+
words32[len >> 5] |= 0x80 << (24 - len % 32);
|
|
1507
|
+
words32[((len + 64 >> 9) << 4) + 15] = len;
|
|
1508
|
+
for (let i = 0; i < words32.length; i += 16) {
|
|
1509
|
+
const h0 = a, h1 = b, h2 = c, h3 = d, h4 = e;
|
|
1510
|
+
for (let j = 0; j < 80; j++) {
|
|
1511
|
+
if (j < 16) {
|
|
1512
|
+
w[j] = words32[i + j];
|
|
1513
|
+
}
|
|
1514
|
+
else {
|
|
1515
|
+
w[j] = rol32(w[j - 3] ^ w[j - 8] ^ w[j - 14] ^ w[j - 16], 1);
|
|
1516
|
+
}
|
|
1517
|
+
const fkVal = fk(j, b, c, d);
|
|
1518
|
+
const f = fkVal[0];
|
|
1519
|
+
const k = fkVal[1];
|
|
1520
|
+
const temp = [rol32(a, 5), f, e, k, w[j]].reduce(add32);
|
|
1521
|
+
e = d;
|
|
1522
|
+
d = c;
|
|
1523
|
+
c = rol32(b, 30);
|
|
1524
|
+
b = a;
|
|
1525
|
+
a = temp;
|
|
1526
|
+
}
|
|
1527
|
+
a = add32(a, h0);
|
|
1528
|
+
b = add32(b, h1);
|
|
1529
|
+
c = add32(c, h2);
|
|
1530
|
+
d = add32(d, h3);
|
|
1531
|
+
e = add32(e, h4);
|
|
1532
|
+
}
|
|
1533
|
+
return bytesToHexString(words32ToByteString([a, b, c, d, e]));
|
|
1534
|
+
}
|
|
1535
|
+
function fk(index, b, c, d) {
|
|
1536
|
+
if (index < 20) {
|
|
1537
|
+
return [(b & c) | (~b & d), 0x5a827999];
|
|
1538
|
+
}
|
|
1539
|
+
if (index < 40) {
|
|
1540
|
+
return [b ^ c ^ d, 0x6ed9eba1];
|
|
1541
|
+
}
|
|
1542
|
+
if (index < 60) {
|
|
1543
|
+
return [(b & c) | (b & d) | (c & d), 0x8f1bbcdc];
|
|
1544
|
+
}
|
|
1545
|
+
return [b ^ c ^ d, 0xca62c1d6];
|
|
1546
|
+
}
|
|
1547
|
+
/**
|
|
1548
|
+
* Compute the fingerprint of the given string
|
|
1549
|
+
*
|
|
1550
|
+
* The output is 64 bit number encoded as a decimal string
|
|
1551
|
+
*
|
|
1552
|
+
* based on:
|
|
1553
|
+
* https://github.com/google/closure-compiler/blob/master/src/com/google/javascript/jscomp/GoogleJsMessageIdGenerator.java
|
|
1554
|
+
*/
|
|
1555
|
+
function fingerprint(str) {
|
|
1556
|
+
const utf8 = utf8Encode(str);
|
|
1557
|
+
let hi = hash32(utf8, 0);
|
|
1558
|
+
let lo = hash32(utf8, 102072);
|
|
1559
|
+
if (hi == 0 && (lo == 0 || lo == 1)) {
|
|
1560
|
+
hi = hi ^ 0x130f9bef;
|
|
1561
|
+
lo = lo ^ -0x6b5f56d8;
|
|
1562
|
+
}
|
|
1563
|
+
return [hi, lo];
|
|
1564
|
+
}
|
|
1565
|
+
function computeMsgId(msg, meaning = '') {
|
|
1566
|
+
let msgFingerprint = fingerprint(msg);
|
|
1567
|
+
if (meaning) {
|
|
1568
|
+
const meaningFingerprint = fingerprint(meaning);
|
|
1569
|
+
msgFingerprint = add64(rol64(msgFingerprint, 1), meaningFingerprint);
|
|
1570
|
+
}
|
|
1571
|
+
const hi = msgFingerprint[0];
|
|
1572
|
+
const lo = msgFingerprint[1];
|
|
1573
|
+
return wordsToDecimalString(hi & 0x7fffffff, lo);
|
|
1574
|
+
}
|
|
1575
|
+
function hash32(bytes, c) {
|
|
1576
|
+
let a = 0x9e3779b9, b = 0x9e3779b9;
|
|
1577
|
+
let i;
|
|
1578
|
+
const len = bytes.length;
|
|
1579
|
+
for (i = 0; i + 12 <= len; i += 12) {
|
|
1580
|
+
a = add32(a, wordAt(bytes, i, Endian.Little));
|
|
1581
|
+
b = add32(b, wordAt(bytes, i + 4, Endian.Little));
|
|
1582
|
+
c = add32(c, wordAt(bytes, i + 8, Endian.Little));
|
|
1583
|
+
const res = mix(a, b, c);
|
|
1584
|
+
a = res[0], b = res[1], c = res[2];
|
|
1585
|
+
}
|
|
1586
|
+
a = add32(a, wordAt(bytes, i, Endian.Little));
|
|
1587
|
+
b = add32(b, wordAt(bytes, i + 4, Endian.Little));
|
|
1588
|
+
// the first byte of c is reserved for the length
|
|
1589
|
+
c = add32(c, len);
|
|
1590
|
+
c = add32(c, wordAt(bytes, i + 8, Endian.Little) << 8);
|
|
1591
|
+
return mix(a, b, c)[2];
|
|
1592
|
+
}
|
|
1593
|
+
// clang-format off
|
|
1594
|
+
function mix(a, b, c) {
|
|
1595
|
+
a = sub32(a, b);
|
|
1596
|
+
a = sub32(a, c);
|
|
1597
|
+
a ^= c >>> 13;
|
|
1598
|
+
b = sub32(b, c);
|
|
1599
|
+
b = sub32(b, a);
|
|
1600
|
+
b ^= a << 8;
|
|
1601
|
+
c = sub32(c, a);
|
|
1602
|
+
c = sub32(c, b);
|
|
1603
|
+
c ^= b >>> 13;
|
|
1604
|
+
a = sub32(a, b);
|
|
1605
|
+
a = sub32(a, c);
|
|
1606
|
+
a ^= c >>> 12;
|
|
1607
|
+
b = sub32(b, c);
|
|
1608
|
+
b = sub32(b, a);
|
|
1609
|
+
b ^= a << 16;
|
|
1610
|
+
c = sub32(c, a);
|
|
1611
|
+
c = sub32(c, b);
|
|
1612
|
+
c ^= b >>> 5;
|
|
1613
|
+
a = sub32(a, b);
|
|
1614
|
+
a = sub32(a, c);
|
|
1615
|
+
a ^= c >>> 3;
|
|
1616
|
+
b = sub32(b, c);
|
|
1617
|
+
b = sub32(b, a);
|
|
1618
|
+
b ^= a << 10;
|
|
1619
|
+
c = sub32(c, a);
|
|
1620
|
+
c = sub32(c, b);
|
|
1621
|
+
c ^= b >>> 15;
|
|
1622
|
+
return [a, b, c];
|
|
1623
|
+
}
|
|
1624
|
+
// clang-format on
|
|
1625
|
+
// Utils
|
|
1626
|
+
var Endian;
|
|
1627
|
+
(function (Endian) {
|
|
1628
|
+
Endian[Endian["Little"] = 0] = "Little";
|
|
1629
|
+
Endian[Endian["Big"] = 1] = "Big";
|
|
1630
|
+
})(Endian || (Endian = {}));
|
|
1631
|
+
function add32(a, b) {
|
|
1632
|
+
return add32to64(a, b)[1];
|
|
1633
|
+
}
|
|
1634
|
+
function add32to64(a, b) {
|
|
1635
|
+
const low = (a & 0xffff) + (b & 0xffff);
|
|
1636
|
+
const high = (a >>> 16) + (b >>> 16) + (low >>> 16);
|
|
1637
|
+
return [high >>> 16, (high << 16) | (low & 0xffff)];
|
|
1638
|
+
}
|
|
1639
|
+
function add64(a, b) {
|
|
1640
|
+
const ah = a[0], al = a[1];
|
|
1641
|
+
const bh = b[0], bl = b[1];
|
|
1642
|
+
const result = add32to64(al, bl);
|
|
1643
|
+
const carry = result[0];
|
|
1644
|
+
const l = result[1];
|
|
1645
|
+
const h = add32(add32(ah, bh), carry);
|
|
1646
|
+
return [h, l];
|
|
1647
|
+
}
|
|
1648
|
+
function sub32(a, b) {
|
|
1649
|
+
const low = (a & 0xffff) - (b & 0xffff);
|
|
1650
|
+
const high = (a >> 16) - (b >> 16) + (low >> 16);
|
|
1651
|
+
return (high << 16) | (low & 0xffff);
|
|
1652
|
+
}
|
|
1653
|
+
// Rotate a 32b number left `count` position
|
|
1654
|
+
function rol32(a, count) {
|
|
1655
|
+
return (a << count) | (a >>> (32 - count));
|
|
1656
|
+
}
|
|
1657
|
+
// Rotate a 64b number left `count` position
|
|
1658
|
+
function rol64(num, count) {
|
|
1659
|
+
const hi = num[0], lo = num[1];
|
|
1660
|
+
const h = (hi << count) | (lo >>> (32 - count));
|
|
1661
|
+
const l = (lo << count) | (hi >>> (32 - count));
|
|
1662
|
+
return [h, l];
|
|
1663
|
+
}
|
|
1664
|
+
function bytesToWords32(bytes, endian) {
|
|
1665
|
+
const size = (bytes.length + 3) >>> 2;
|
|
1666
|
+
const words32 = [];
|
|
1667
|
+
for (let i = 0; i < size; i++) {
|
|
1668
|
+
words32[i] = wordAt(bytes, i * 4, endian);
|
|
1669
|
+
}
|
|
1670
|
+
return words32;
|
|
1671
|
+
}
|
|
1672
|
+
function byteAt(bytes, index) {
|
|
1673
|
+
return index >= bytes.length ? 0 : bytes[index];
|
|
1674
|
+
}
|
|
1675
|
+
function wordAt(bytes, index, endian) {
|
|
1676
|
+
let word = 0;
|
|
1677
|
+
if (endian === Endian.Big) {
|
|
1678
|
+
for (let i = 0; i < 4; i++) {
|
|
1679
|
+
word += byteAt(bytes, index + i) << (24 - 8 * i);
|
|
1680
|
+
}
|
|
1681
|
+
}
|
|
1682
|
+
else {
|
|
1683
|
+
for (let i = 0; i < 4; i++) {
|
|
1684
|
+
word += byteAt(bytes, index + i) << 8 * i;
|
|
1685
|
+
}
|
|
1686
|
+
}
|
|
1687
|
+
return word;
|
|
1688
|
+
}
|
|
1689
|
+
function words32ToByteString(words32) {
|
|
1690
|
+
return words32.reduce((bytes, word) => bytes.concat(word32ToByteString(word)), []);
|
|
1691
|
+
}
|
|
1692
|
+
function word32ToByteString(word) {
|
|
1693
|
+
let bytes = [];
|
|
1694
|
+
for (let i = 0; i < 4; i++) {
|
|
1695
|
+
bytes.push((word >>> 8 * (3 - i)) & 0xff);
|
|
1696
|
+
}
|
|
1697
|
+
return bytes;
|
|
1698
|
+
}
|
|
1699
|
+
function bytesToHexString(bytes) {
|
|
1700
|
+
let hex = '';
|
|
1701
|
+
for (let i = 0; i < bytes.length; i++) {
|
|
1702
|
+
const b = byteAt(bytes, i);
|
|
1703
|
+
hex += (b >>> 4).toString(16) + (b & 0x0f).toString(16);
|
|
1704
|
+
}
|
|
1705
|
+
return hex.toLowerCase();
|
|
1706
|
+
}
|
|
1707
|
+
/**
|
|
1708
|
+
* Create a shared exponentiation pool for base-256 computations. This shared pool provides memoized
|
|
1709
|
+
* power-of-256 results with memoized power-of-two computations for efficient multiplication.
|
|
1710
|
+
*
|
|
1711
|
+
* For our purposes, this can be safely stored as a global without memory concerns. The reason is
|
|
1712
|
+
* that we encode two words, so only need the 0th (for the low word) and 4th (for the high word)
|
|
1713
|
+
* exponent.
|
|
1714
|
+
*/
|
|
1715
|
+
const base256 = new BigIntExponentiation(256);
|
|
1716
|
+
/**
|
|
1717
|
+
* Represents two 32-bit words as a single decimal number. This requires a big integer storage
|
|
1718
|
+
* model as JS numbers are not accurate enough to represent the 64-bit number.
|
|
1719
|
+
*
|
|
1720
|
+
* Based on https://www.danvk.org/hex2dec.html
|
|
1721
|
+
*/
|
|
1722
|
+
function wordsToDecimalString(hi, lo) {
|
|
1723
|
+
// Encode the four bytes in lo in the lower digits of the decimal number.
|
|
1724
|
+
// Note: the multiplication results in lo itself but represented by a big integer using its
|
|
1725
|
+
// decimal digits.
|
|
1726
|
+
const decimal = base256.toThePowerOf(0).multiplyBy(lo);
|
|
1727
|
+
// Encode the four bytes in hi above the four lo bytes. lo is a maximum of (2^8)^4, which is why
|
|
1728
|
+
// this multiplication factor is applied.
|
|
1729
|
+
base256.toThePowerOf(4).multiplyByAndAddTo(hi, decimal);
|
|
1730
|
+
return decimal.toString();
|
|
1731
|
+
}
|
|
1732
|
+
|
|
1115
1733
|
/**
|
|
1116
1734
|
* @license
|
|
1117
1735
|
* Copyright Google LLC All Rights Reserved.
|
|
@@ -1517,16 +2135,31 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'os', 'typescript', 'fs', '
|
|
|
1517
2135
|
rawText ?? sourceSpan?.toString() ?? escapeForTemplateLiteral(escapeSlashes(text));
|
|
1518
2136
|
}
|
|
1519
2137
|
}
|
|
1520
|
-
class
|
|
2138
|
+
class LiteralPiece {
|
|
1521
2139
|
constructor(text, sourceSpan) {
|
|
1522
2140
|
this.text = text;
|
|
1523
2141
|
this.sourceSpan = sourceSpan;
|
|
1524
2142
|
}
|
|
1525
2143
|
}
|
|
1526
|
-
class
|
|
1527
|
-
|
|
1528
|
-
|
|
2144
|
+
class PlaceholderPiece {
|
|
2145
|
+
/**
|
|
2146
|
+
* Create a new instance of a `PlaceholderPiece`.
|
|
2147
|
+
*
|
|
2148
|
+
* @param text the name of this placeholder (e.g. `PH_1`).
|
|
2149
|
+
* @param sourceSpan the location of this placeholder in its localized message the source code.
|
|
2150
|
+
* @param associatedMessage reference to another message that this placeholder is associated with.
|
|
2151
|
+
* The `associatedMessage` is mainly used to provide a relationship to an ICU message that has
|
|
2152
|
+
* been extracted out from the message containing the placeholder.
|
|
2153
|
+
*/
|
|
2154
|
+
constructor(text, sourceSpan, associatedMessage) {
|
|
2155
|
+
this.text = text;
|
|
2156
|
+
this.sourceSpan = sourceSpan;
|
|
2157
|
+
this.associatedMessage = associatedMessage;
|
|
2158
|
+
}
|
|
1529
2159
|
}
|
|
2160
|
+
const MEANING_SEPARATOR = '|';
|
|
2161
|
+
const ID_SEPARATOR = '@@';
|
|
2162
|
+
const LEGACY_ID_INDICATOR = '␟';
|
|
1530
2163
|
class LocalizedString extends Expression {
|
|
1531
2164
|
constructor(metaBlock, messageParts, placeHolderNames, expressions, sourceSpan) {
|
|
1532
2165
|
super(STRING_TYPE, sourceSpan);
|
|
@@ -1554,9 +2187,6 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'os', 'typescript', 'fs', '
|
|
|
1554
2187
|
* @param messagePart The first part of the tagged string
|
|
1555
2188
|
*/
|
|
1556
2189
|
serializeI18nHead() {
|
|
1557
|
-
const MEANING_SEPARATOR = '|';
|
|
1558
|
-
const ID_SEPARATOR = '@@';
|
|
1559
|
-
const LEGACY_ID_INDICATOR = '␟';
|
|
1560
2190
|
let metaBlock = this.metaBlock.description || '';
|
|
1561
2191
|
if (this.metaBlock.meaning) {
|
|
1562
2192
|
metaBlock = `${this.metaBlock.meaning}${MEANING_SEPARATOR}${metaBlock}`;
|
|
@@ -1582,13 +2212,21 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'os', 'typescript', 'fs', '
|
|
|
1582
2212
|
* Serialize the given `placeholderName` and `messagePart` into "cooked" and "raw" strings that
|
|
1583
2213
|
* can be used in a `$localize` tagged string.
|
|
1584
2214
|
*
|
|
1585
|
-
*
|
|
1586
|
-
*
|
|
2215
|
+
* The format is `:<placeholder-name>[@@<associated-id>]:`.
|
|
2216
|
+
*
|
|
2217
|
+
* The `associated-id` is the message id of the (usually an ICU) message to which this placeholder
|
|
2218
|
+
* refers.
|
|
2219
|
+
*
|
|
2220
|
+
* @param partIndex The index of the message part to serialize.
|
|
1587
2221
|
*/
|
|
1588
2222
|
serializeI18nTemplatePart(partIndex) {
|
|
1589
|
-
const
|
|
2223
|
+
const placeholder = this.placeHolderNames[partIndex - 1];
|
|
1590
2224
|
const messagePart = this.messageParts[partIndex];
|
|
1591
|
-
|
|
2225
|
+
let metaBlock = placeholder.text;
|
|
2226
|
+
if (placeholder.associatedMessage?.legacyIds.length === 0) {
|
|
2227
|
+
metaBlock += `${ID_SEPARATOR}${computeMsgId(placeholder.associatedMessage.messageString, placeholder.associatedMessage.meaning)}`;
|
|
2228
|
+
}
|
|
2229
|
+
return createCookedRawString(metaBlock, messagePart.text, this.getMessagePartSourceSpan(partIndex));
|
|
1592
2230
|
}
|
|
1593
2231
|
}
|
|
1594
2232
|
const escapeSlashes = (str) => str.replace(/\\/g, '\\\\');
|
|
@@ -2561,128 +3199,6 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'os', 'typescript', 'fs', '
|
|
|
2561
3199
|
Identifiers$1.trustConstantHtml = { name: 'ɵɵtrustConstantHtml', moduleName: CORE$1 };
|
|
2562
3200
|
Identifiers$1.trustConstantResourceUrl = { name: 'ɵɵtrustConstantResourceUrl', moduleName: CORE$1 };
|
|
2563
3201
|
|
|
2564
|
-
/**
|
|
2565
|
-
* @license
|
|
2566
|
-
* Copyright Google LLC All Rights Reserved.
|
|
2567
|
-
*
|
|
2568
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
2569
|
-
* found in the LICENSE file at https://angular.io/license
|
|
2570
|
-
*/
|
|
2571
|
-
const DASH_CASE_REGEXP = /-+([a-z0-9])/g;
|
|
2572
|
-
function dashCaseToCamelCase(input) {
|
|
2573
|
-
return input.replace(DASH_CASE_REGEXP, (...m) => m[1].toUpperCase());
|
|
2574
|
-
}
|
|
2575
|
-
function splitAtColon(input, defaultValues) {
|
|
2576
|
-
return _splitAt(input, ':', defaultValues);
|
|
2577
|
-
}
|
|
2578
|
-
function splitAtPeriod(input, defaultValues) {
|
|
2579
|
-
return _splitAt(input, '.', defaultValues);
|
|
2580
|
-
}
|
|
2581
|
-
function _splitAt(input, character, defaultValues) {
|
|
2582
|
-
const characterIndex = input.indexOf(character);
|
|
2583
|
-
if (characterIndex == -1)
|
|
2584
|
-
return defaultValues;
|
|
2585
|
-
return [input.slice(0, characterIndex).trim(), input.slice(characterIndex + 1).trim()];
|
|
2586
|
-
}
|
|
2587
|
-
function error(msg) {
|
|
2588
|
-
throw new Error(`Internal Error: ${msg}`);
|
|
2589
|
-
}
|
|
2590
|
-
function utf8Encode(str) {
|
|
2591
|
-
let encoded = [];
|
|
2592
|
-
for (let index = 0; index < str.length; index++) {
|
|
2593
|
-
let codePoint = str.charCodeAt(index);
|
|
2594
|
-
// decode surrogate
|
|
2595
|
-
// see https://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae
|
|
2596
|
-
if (codePoint >= 0xd800 && codePoint <= 0xdbff && str.length > (index + 1)) {
|
|
2597
|
-
const low = str.charCodeAt(index + 1);
|
|
2598
|
-
if (low >= 0xdc00 && low <= 0xdfff) {
|
|
2599
|
-
index++;
|
|
2600
|
-
codePoint = ((codePoint - 0xd800) << 10) + low - 0xdc00 + 0x10000;
|
|
2601
|
-
}
|
|
2602
|
-
}
|
|
2603
|
-
if (codePoint <= 0x7f) {
|
|
2604
|
-
encoded.push(codePoint);
|
|
2605
|
-
}
|
|
2606
|
-
else if (codePoint <= 0x7ff) {
|
|
2607
|
-
encoded.push(((codePoint >> 6) & 0x1F) | 0xc0, (codePoint & 0x3f) | 0x80);
|
|
2608
|
-
}
|
|
2609
|
-
else if (codePoint <= 0xffff) {
|
|
2610
|
-
encoded.push((codePoint >> 12) | 0xe0, ((codePoint >> 6) & 0x3f) | 0x80, (codePoint & 0x3f) | 0x80);
|
|
2611
|
-
}
|
|
2612
|
-
else if (codePoint <= 0x1fffff) {
|
|
2613
|
-
encoded.push(((codePoint >> 18) & 0x07) | 0xf0, ((codePoint >> 12) & 0x3f) | 0x80, ((codePoint >> 6) & 0x3f) | 0x80, (codePoint & 0x3f) | 0x80);
|
|
2614
|
-
}
|
|
2615
|
-
}
|
|
2616
|
-
return encoded;
|
|
2617
|
-
}
|
|
2618
|
-
function stringify(token) {
|
|
2619
|
-
if (typeof token === 'string') {
|
|
2620
|
-
return token;
|
|
2621
|
-
}
|
|
2622
|
-
if (Array.isArray(token)) {
|
|
2623
|
-
return '[' + token.map(stringify).join(', ') + ']';
|
|
2624
|
-
}
|
|
2625
|
-
if (token == null) {
|
|
2626
|
-
return '' + token;
|
|
2627
|
-
}
|
|
2628
|
-
if (token.overriddenName) {
|
|
2629
|
-
return `${token.overriddenName}`;
|
|
2630
|
-
}
|
|
2631
|
-
if (token.name) {
|
|
2632
|
-
return `${token.name}`;
|
|
2633
|
-
}
|
|
2634
|
-
if (!token.toString) {
|
|
2635
|
-
return 'object';
|
|
2636
|
-
}
|
|
2637
|
-
// WARNING: do not try to `JSON.stringify(token)` here
|
|
2638
|
-
// see https://github.com/angular/angular/issues/23440
|
|
2639
|
-
const res = token.toString();
|
|
2640
|
-
if (res == null) {
|
|
2641
|
-
return '' + res;
|
|
2642
|
-
}
|
|
2643
|
-
const newLineIndex = res.indexOf('\n');
|
|
2644
|
-
return newLineIndex === -1 ? res : res.substring(0, newLineIndex);
|
|
2645
|
-
}
|
|
2646
|
-
class Version {
|
|
2647
|
-
constructor(full) {
|
|
2648
|
-
this.full = full;
|
|
2649
|
-
const splits = full.split('.');
|
|
2650
|
-
this.major = splits[0];
|
|
2651
|
-
this.minor = splits[1];
|
|
2652
|
-
this.patch = splits.slice(2).join('.');
|
|
2653
|
-
}
|
|
2654
|
-
}
|
|
2655
|
-
const __window = typeof window !== 'undefined' && window;
|
|
2656
|
-
const __self = typeof self !== 'undefined' && typeof WorkerGlobalScope !== 'undefined' &&
|
|
2657
|
-
self instanceof WorkerGlobalScope && self;
|
|
2658
|
-
const __global = typeof global !== 'undefined' && global;
|
|
2659
|
-
// Check __global first, because in Node tests both __global and __window may be defined and _global
|
|
2660
|
-
// should be __global in that case.
|
|
2661
|
-
const _global = __global || __window || __self;
|
|
2662
|
-
function newArray(size, value) {
|
|
2663
|
-
const list = [];
|
|
2664
|
-
for (let i = 0; i < size; i++) {
|
|
2665
|
-
list.push(value);
|
|
2666
|
-
}
|
|
2667
|
-
return list;
|
|
2668
|
-
}
|
|
2669
|
-
/**
|
|
2670
|
-
* Partitions a given array into 2 arrays, based on a boolean value returned by the condition
|
|
2671
|
-
* function.
|
|
2672
|
-
*
|
|
2673
|
-
* @param arr Input array that should be partitioned
|
|
2674
|
-
* @param conditionFn Condition function that is called for each item in a given array and returns a
|
|
2675
|
-
* boolean value.
|
|
2676
|
-
*/
|
|
2677
|
-
function partitionArray(arr, conditionFn) {
|
|
2678
|
-
const truthy = [];
|
|
2679
|
-
const falsy = [];
|
|
2680
|
-
for (const item of arr) {
|
|
2681
|
-
(conditionFn(item) ? truthy : falsy).push(item);
|
|
2682
|
-
}
|
|
2683
|
-
return [truthy, falsy];
|
|
2684
|
-
}
|
|
2685
|
-
|
|
2686
3202
|
/**
|
|
2687
3203
|
* @license
|
|
2688
3204
|
* Copyright Google LLC All Rights Reserved.
|
|
@@ -3847,343 +4363,54 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'os', 'typescript', 'fs', '
|
|
|
3847
4363
|
this.vars = vars;
|
|
3848
4364
|
this.placeholders = placeholders;
|
|
3849
4365
|
this.sourceSpan = sourceSpan;
|
|
3850
|
-
this.i18n = i18n;
|
|
3851
|
-
}
|
|
3852
|
-
visit(visitor) {
|
|
3853
|
-
return visitor.visitIcu(this);
|
|
3854
|
-
}
|
|
3855
|
-
}
|
|
3856
|
-
class RecursiveVisitor {
|
|
3857
|
-
visitElement(element) {
|
|
3858
|
-
visitAll$1(this, element.attributes);
|
|
3859
|
-
visitAll$1(this, element.inputs);
|
|
3860
|
-
visitAll$1(this, element.outputs);
|
|
3861
|
-
visitAll$1(this, element.children);
|
|
3862
|
-
visitAll$1(this, element.references);
|
|
3863
|
-
}
|
|
3864
|
-
visitTemplate(template) {
|
|
3865
|
-
visitAll$1(this, template.attributes);
|
|
3866
|
-
visitAll$1(this, template.inputs);
|
|
3867
|
-
visitAll$1(this, template.outputs);
|
|
3868
|
-
visitAll$1(this, template.children);
|
|
3869
|
-
visitAll$1(this, template.references);
|
|
3870
|
-
visitAll$1(this, template.variables);
|
|
3871
|
-
}
|
|
3872
|
-
visitContent(content) { }
|
|
3873
|
-
visitVariable(variable) { }
|
|
3874
|
-
visitReference(reference) { }
|
|
3875
|
-
visitTextAttribute(attribute) { }
|
|
3876
|
-
visitBoundAttribute(attribute) { }
|
|
3877
|
-
visitBoundEvent(attribute) { }
|
|
3878
|
-
visitText(text) { }
|
|
3879
|
-
visitBoundText(text) { }
|
|
3880
|
-
visitIcu(icu) { }
|
|
3881
|
-
}
|
|
3882
|
-
function visitAll$1(visitor, nodes) {
|
|
3883
|
-
const result = [];
|
|
3884
|
-
if (visitor.visit) {
|
|
3885
|
-
for (const node of nodes) {
|
|
3886
|
-
visitor.visit(node) || node.visit(visitor);
|
|
3887
|
-
}
|
|
3888
|
-
}
|
|
3889
|
-
else {
|
|
3890
|
-
for (const node of nodes) {
|
|
3891
|
-
const newNode = node.visit(visitor);
|
|
3892
|
-
if (newNode) {
|
|
3893
|
-
result.push(newNode);
|
|
3894
|
-
}
|
|
3895
|
-
}
|
|
3896
|
-
}
|
|
3897
|
-
return result;
|
|
3898
|
-
}
|
|
3899
|
-
|
|
3900
|
-
/**
|
|
3901
|
-
* @license
|
|
3902
|
-
* Copyright Google LLC All Rights Reserved.
|
|
3903
|
-
*
|
|
3904
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
3905
|
-
* found in the LICENSE file at https://angular.io/license
|
|
3906
|
-
*/
|
|
3907
|
-
class Message {
|
|
3908
|
-
/**
|
|
3909
|
-
* @param nodes message AST
|
|
3910
|
-
* @param placeholders maps placeholder names to static content and their source spans
|
|
3911
|
-
* @param placeholderToMessage maps placeholder names to messages (used for nested ICU messages)
|
|
3912
|
-
* @param meaning
|
|
3913
|
-
* @param description
|
|
3914
|
-
* @param customId
|
|
3915
|
-
*/
|
|
3916
|
-
constructor(nodes, placeholders, placeholderToMessage, meaning, description, customId) {
|
|
3917
|
-
this.nodes = nodes;
|
|
3918
|
-
this.placeholders = placeholders;
|
|
3919
|
-
this.placeholderToMessage = placeholderToMessage;
|
|
3920
|
-
this.meaning = meaning;
|
|
3921
|
-
this.description = description;
|
|
3922
|
-
this.customId = customId;
|
|
3923
|
-
this.id = this.customId;
|
|
3924
|
-
/** The ids to use if there are no custom id and if `i18nLegacyMessageIdFormat` is not empty */
|
|
3925
|
-
this.legacyIds = [];
|
|
3926
|
-
if (nodes.length) {
|
|
3927
|
-
this.sources = [{
|
|
3928
|
-
filePath: nodes[0].sourceSpan.start.file.url,
|
|
3929
|
-
startLine: nodes[0].sourceSpan.start.line + 1,
|
|
3930
|
-
startCol: nodes[0].sourceSpan.start.col + 1,
|
|
3931
|
-
endLine: nodes[nodes.length - 1].sourceSpan.end.line + 1,
|
|
3932
|
-
endCol: nodes[0].sourceSpan.start.col + 1
|
|
3933
|
-
}];
|
|
3934
|
-
}
|
|
3935
|
-
else {
|
|
3936
|
-
this.sources = [];
|
|
3937
|
-
}
|
|
3938
|
-
}
|
|
3939
|
-
}
|
|
3940
|
-
class Text$1 {
|
|
3941
|
-
constructor(value, sourceSpan) {
|
|
3942
|
-
this.value = value;
|
|
3943
|
-
this.sourceSpan = sourceSpan;
|
|
3944
|
-
}
|
|
3945
|
-
visit(visitor, context) {
|
|
3946
|
-
return visitor.visitText(this, context);
|
|
3947
|
-
}
|
|
3948
|
-
}
|
|
3949
|
-
// TODO(vicb): do we really need this node (vs an array) ?
|
|
3950
|
-
class Container {
|
|
3951
|
-
constructor(children, sourceSpan) {
|
|
3952
|
-
this.children = children;
|
|
3953
|
-
this.sourceSpan = sourceSpan;
|
|
3954
|
-
}
|
|
3955
|
-
visit(visitor, context) {
|
|
3956
|
-
return visitor.visitContainer(this, context);
|
|
3957
|
-
}
|
|
3958
|
-
}
|
|
3959
|
-
class Icu {
|
|
3960
|
-
constructor(expression, type, cases, sourceSpan) {
|
|
3961
|
-
this.expression = expression;
|
|
3962
|
-
this.type = type;
|
|
3963
|
-
this.cases = cases;
|
|
3964
|
-
this.sourceSpan = sourceSpan;
|
|
3965
|
-
}
|
|
3966
|
-
visit(visitor, context) {
|
|
3967
|
-
return visitor.visitIcu(this, context);
|
|
3968
|
-
}
|
|
3969
|
-
}
|
|
3970
|
-
class TagPlaceholder {
|
|
3971
|
-
constructor(tag, attrs, startName, closeName, children, isVoid,
|
|
3972
|
-
// TODO sourceSpan should cover all (we need a startSourceSpan and endSourceSpan)
|
|
3973
|
-
sourceSpan, startSourceSpan, endSourceSpan) {
|
|
3974
|
-
this.tag = tag;
|
|
3975
|
-
this.attrs = attrs;
|
|
3976
|
-
this.startName = startName;
|
|
3977
|
-
this.closeName = closeName;
|
|
3978
|
-
this.children = children;
|
|
3979
|
-
this.isVoid = isVoid;
|
|
3980
|
-
this.sourceSpan = sourceSpan;
|
|
3981
|
-
this.startSourceSpan = startSourceSpan;
|
|
3982
|
-
this.endSourceSpan = endSourceSpan;
|
|
3983
|
-
}
|
|
3984
|
-
visit(visitor, context) {
|
|
3985
|
-
return visitor.visitTagPlaceholder(this, context);
|
|
3986
|
-
}
|
|
3987
|
-
}
|
|
3988
|
-
class Placeholder {
|
|
3989
|
-
constructor(value, name, sourceSpan) {
|
|
3990
|
-
this.value = value;
|
|
3991
|
-
this.name = name;
|
|
3992
|
-
this.sourceSpan = sourceSpan;
|
|
3993
|
-
}
|
|
3994
|
-
visit(visitor, context) {
|
|
3995
|
-
return visitor.visitPlaceholder(this, context);
|
|
3996
|
-
}
|
|
3997
|
-
}
|
|
3998
|
-
class IcuPlaceholder {
|
|
3999
|
-
constructor(value, name, sourceSpan) {
|
|
4000
|
-
this.value = value;
|
|
4001
|
-
this.name = name;
|
|
4002
|
-
this.sourceSpan = sourceSpan;
|
|
4003
|
-
}
|
|
4004
|
-
visit(visitor, context) {
|
|
4005
|
-
return visitor.visitIcuPlaceholder(this, context);
|
|
4006
|
-
}
|
|
4007
|
-
}
|
|
4008
|
-
|
|
4009
|
-
/**
|
|
4010
|
-
* @license
|
|
4011
|
-
* Copyright Google LLC All Rights Reserved.
|
|
4012
|
-
*
|
|
4013
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
4014
|
-
* found in the LICENSE file at https://angular.io/license
|
|
4015
|
-
*/
|
|
4016
|
-
/**
|
|
4017
|
-
* Represents a big integer using a buffer of its individual digits, with the least significant
|
|
4018
|
-
* digit stored at the beginning of the array (little endian).
|
|
4019
|
-
*
|
|
4020
|
-
* For performance reasons, each instance is mutable. The addition operation can be done in-place
|
|
4021
|
-
* to reduce memory pressure of allocation for the digits array.
|
|
4022
|
-
*/
|
|
4023
|
-
class BigInteger {
|
|
4024
|
-
/**
|
|
4025
|
-
* Creates a big integer using its individual digits in little endian storage.
|
|
4026
|
-
*/
|
|
4027
|
-
constructor(digits) {
|
|
4028
|
-
this.digits = digits;
|
|
4029
|
-
}
|
|
4030
|
-
static zero() {
|
|
4031
|
-
return new BigInteger([0]);
|
|
4032
|
-
}
|
|
4033
|
-
static one() {
|
|
4034
|
-
return new BigInteger([1]);
|
|
4035
|
-
}
|
|
4036
|
-
/**
|
|
4037
|
-
* Creates a clone of this instance.
|
|
4038
|
-
*/
|
|
4039
|
-
clone() {
|
|
4040
|
-
return new BigInteger(this.digits.slice());
|
|
4041
|
-
}
|
|
4042
|
-
/**
|
|
4043
|
-
* Returns a new big integer with the sum of `this` and `other` as its value. This does not mutate
|
|
4044
|
-
* `this` but instead returns a new instance, unlike `addToSelf`.
|
|
4045
|
-
*/
|
|
4046
|
-
add(other) {
|
|
4047
|
-
const result = this.clone();
|
|
4048
|
-
result.addToSelf(other);
|
|
4049
|
-
return result;
|
|
4050
|
-
}
|
|
4051
|
-
/**
|
|
4052
|
-
* Adds `other` to the instance itself, thereby mutating its value.
|
|
4053
|
-
*/
|
|
4054
|
-
addToSelf(other) {
|
|
4055
|
-
const maxNrOfDigits = Math.max(this.digits.length, other.digits.length);
|
|
4056
|
-
let carry = 0;
|
|
4057
|
-
for (let i = 0; i < maxNrOfDigits; i++) {
|
|
4058
|
-
let digitSum = carry;
|
|
4059
|
-
if (i < this.digits.length) {
|
|
4060
|
-
digitSum += this.digits[i];
|
|
4061
|
-
}
|
|
4062
|
-
if (i < other.digits.length) {
|
|
4063
|
-
digitSum += other.digits[i];
|
|
4064
|
-
}
|
|
4065
|
-
if (digitSum >= 10) {
|
|
4066
|
-
this.digits[i] = digitSum - 10;
|
|
4067
|
-
carry = 1;
|
|
4068
|
-
}
|
|
4069
|
-
else {
|
|
4070
|
-
this.digits[i] = digitSum;
|
|
4071
|
-
carry = 0;
|
|
4072
|
-
}
|
|
4073
|
-
}
|
|
4074
|
-
// Apply a remaining carry if needed.
|
|
4075
|
-
if (carry > 0) {
|
|
4076
|
-
this.digits[maxNrOfDigits] = 1;
|
|
4077
|
-
}
|
|
4078
|
-
}
|
|
4079
|
-
/**
|
|
4080
|
-
* Builds the decimal string representation of the big integer. As this is stored in
|
|
4081
|
-
* little endian, the digits are concatenated in reverse order.
|
|
4082
|
-
*/
|
|
4083
|
-
toString() {
|
|
4084
|
-
let res = '';
|
|
4085
|
-
for (let i = this.digits.length - 1; i >= 0; i--) {
|
|
4086
|
-
res += this.digits[i];
|
|
4087
|
-
}
|
|
4088
|
-
return res;
|
|
4089
|
-
}
|
|
4090
|
-
}
|
|
4091
|
-
/**
|
|
4092
|
-
* Represents a big integer which is optimized for multiplication operations, as its power-of-twos
|
|
4093
|
-
* are memoized. See `multiplyBy()` for details on the multiplication algorithm.
|
|
4094
|
-
*/
|
|
4095
|
-
class BigIntForMultiplication {
|
|
4096
|
-
constructor(value) {
|
|
4097
|
-
this.powerOfTwos = [value];
|
|
4098
|
-
}
|
|
4099
|
-
/**
|
|
4100
|
-
* Returns the big integer itself.
|
|
4101
|
-
*/
|
|
4102
|
-
getValue() {
|
|
4103
|
-
return this.powerOfTwos[0];
|
|
4104
|
-
}
|
|
4105
|
-
/**
|
|
4106
|
-
* Computes the value for `num * b`, where `num` is a JS number and `b` is a big integer. The
|
|
4107
|
-
* value for `b` is represented by a storage model that is optimized for this computation.
|
|
4108
|
-
*
|
|
4109
|
-
* This operation is implemented in N(log2(num)) by continuous halving of the number, where the
|
|
4110
|
-
* least-significant bit (LSB) is tested in each iteration. If the bit is set, the bit's index is
|
|
4111
|
-
* used as exponent into the power-of-two multiplication of `b`.
|
|
4112
|
-
*
|
|
4113
|
-
* As an example, consider the multiplication num=42, b=1337. In binary 42 is 0b00101010 and the
|
|
4114
|
-
* algorithm unrolls into the following iterations:
|
|
4115
|
-
*
|
|
4116
|
-
* Iteration | num | LSB | b * 2^iter | Add? | product
|
|
4117
|
-
* -----------|------------|------|------------|------|--------
|
|
4118
|
-
* 0 | 0b00101010 | 0 | 1337 | No | 0
|
|
4119
|
-
* 1 | 0b00010101 | 1 | 2674 | Yes | 2674
|
|
4120
|
-
* 2 | 0b00001010 | 0 | 5348 | No | 2674
|
|
4121
|
-
* 3 | 0b00000101 | 1 | 10696 | Yes | 13370
|
|
4122
|
-
* 4 | 0b00000010 | 0 | 21392 | No | 13370
|
|
4123
|
-
* 5 | 0b00000001 | 1 | 42784 | Yes | 56154
|
|
4124
|
-
* 6 | 0b00000000 | 0 | 85568 | No | 56154
|
|
4125
|
-
*
|
|
4126
|
-
* The computed product of 56154 is indeed the correct result.
|
|
4127
|
-
*
|
|
4128
|
-
* The `BigIntForMultiplication` representation for a big integer provides memoized access to the
|
|
4129
|
-
* power-of-two values to reduce the workload in computing those values.
|
|
4130
|
-
*/
|
|
4131
|
-
multiplyBy(num) {
|
|
4132
|
-
const product = BigInteger.zero();
|
|
4133
|
-
this.multiplyByAndAddTo(num, product);
|
|
4134
|
-
return product;
|
|
4135
|
-
}
|
|
4136
|
-
/**
|
|
4137
|
-
* See `multiplyBy()` for details. This function allows for the computed product to be added
|
|
4138
|
-
* directly to the provided result big integer.
|
|
4139
|
-
*/
|
|
4140
|
-
multiplyByAndAddTo(num, result) {
|
|
4141
|
-
for (let exponent = 0; num !== 0; num = num >>> 1, exponent++) {
|
|
4142
|
-
if (num & 1) {
|
|
4143
|
-
const value = this.getMultipliedByPowerOfTwo(exponent);
|
|
4144
|
-
result.addToSelf(value);
|
|
4145
|
-
}
|
|
4146
|
-
}
|
|
4366
|
+
this.i18n = i18n;
|
|
4147
4367
|
}
|
|
4148
|
-
|
|
4149
|
-
|
|
4150
|
-
*/
|
|
4151
|
-
getMultipliedByPowerOfTwo(exponent) {
|
|
4152
|
-
// Compute the powers up until the requested exponent, where each value is computed from its
|
|
4153
|
-
// predecessor. This is simple as `this.number * 2^(exponent - 1)` only has to be doubled (i.e.
|
|
4154
|
-
// added to itself) to reach `this.number * 2^exponent`.
|
|
4155
|
-
for (let i = this.powerOfTwos.length; i <= exponent; i++) {
|
|
4156
|
-
const previousPower = this.powerOfTwos[i - 1];
|
|
4157
|
-
this.powerOfTwos[i] = previousPower.add(previousPower);
|
|
4158
|
-
}
|
|
4159
|
-
return this.powerOfTwos[exponent];
|
|
4368
|
+
visit(visitor) {
|
|
4369
|
+
return visitor.visitIcu(this);
|
|
4160
4370
|
}
|
|
4161
4371
|
}
|
|
4162
|
-
|
|
4163
|
-
|
|
4164
|
-
|
|
4165
|
-
|
|
4166
|
-
|
|
4167
|
-
|
|
4168
|
-
|
|
4169
|
-
constructor(base) {
|
|
4170
|
-
this.base = base;
|
|
4171
|
-
this.exponents = [new BigIntForMultiplication(BigInteger.one())];
|
|
4372
|
+
class RecursiveVisitor {
|
|
4373
|
+
visitElement(element) {
|
|
4374
|
+
visitAll$1(this, element.attributes);
|
|
4375
|
+
visitAll$1(this, element.inputs);
|
|
4376
|
+
visitAll$1(this, element.outputs);
|
|
4377
|
+
visitAll$1(this, element.children);
|
|
4378
|
+
visitAll$1(this, element.references);
|
|
4172
4379
|
}
|
|
4173
|
-
|
|
4174
|
-
|
|
4175
|
-
|
|
4176
|
-
|
|
4177
|
-
|
|
4178
|
-
|
|
4179
|
-
|
|
4180
|
-
|
|
4181
|
-
|
|
4182
|
-
|
|
4183
|
-
|
|
4380
|
+
visitTemplate(template) {
|
|
4381
|
+
visitAll$1(this, template.attributes);
|
|
4382
|
+
visitAll$1(this, template.inputs);
|
|
4383
|
+
visitAll$1(this, template.outputs);
|
|
4384
|
+
visitAll$1(this, template.children);
|
|
4385
|
+
visitAll$1(this, template.references);
|
|
4386
|
+
visitAll$1(this, template.variables);
|
|
4387
|
+
}
|
|
4388
|
+
visitContent(content) { }
|
|
4389
|
+
visitVariable(variable) { }
|
|
4390
|
+
visitReference(reference) { }
|
|
4391
|
+
visitTextAttribute(attribute) { }
|
|
4392
|
+
visitBoundAttribute(attribute) { }
|
|
4393
|
+
visitBoundEvent(attribute) { }
|
|
4394
|
+
visitText(text) { }
|
|
4395
|
+
visitBoundText(text) { }
|
|
4396
|
+
visitIcu(icu) { }
|
|
4397
|
+
}
|
|
4398
|
+
function visitAll$1(visitor, nodes) {
|
|
4399
|
+
const result = [];
|
|
4400
|
+
if (visitor.visit) {
|
|
4401
|
+
for (const node of nodes) {
|
|
4402
|
+
visitor.visit(node) || node.visit(visitor);
|
|
4403
|
+
}
|
|
4404
|
+
}
|
|
4405
|
+
else {
|
|
4406
|
+
for (const node of nodes) {
|
|
4407
|
+
const newNode = node.visit(visitor);
|
|
4408
|
+
if (newNode) {
|
|
4409
|
+
result.push(newNode);
|
|
4410
|
+
}
|
|
4184
4411
|
}
|
|
4185
|
-
return this.exponents[exponent];
|
|
4186
4412
|
}
|
|
4413
|
+
return result;
|
|
4187
4414
|
}
|
|
4188
4415
|
|
|
4189
4416
|
/**
|
|
@@ -4193,313 +4420,137 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'os', 'typescript', 'fs', '
|
|
|
4193
4420
|
* Use of this source code is governed by an MIT-style license that can be
|
|
4194
4421
|
* found in the LICENSE file at https://angular.io/license
|
|
4195
4422
|
*/
|
|
4196
|
-
|
|
4197
|
-
|
|
4198
|
-
|
|
4199
|
-
|
|
4200
|
-
|
|
4201
|
-
|
|
4202
|
-
|
|
4203
|
-
|
|
4204
|
-
|
|
4205
|
-
|
|
4206
|
-
|
|
4207
|
-
|
|
4208
|
-
|
|
4209
|
-
|
|
4210
|
-
|
|
4211
|
-
|
|
4212
|
-
|
|
4213
|
-
|
|
4214
|
-
|
|
4423
|
+
class Message {
|
|
4424
|
+
/**
|
|
4425
|
+
* @param nodes message AST
|
|
4426
|
+
* @param placeholders maps placeholder names to static content and their source spans
|
|
4427
|
+
* @param placeholderToMessage maps placeholder names to messages (used for nested ICU messages)
|
|
4428
|
+
* @param meaning
|
|
4429
|
+
* @param description
|
|
4430
|
+
* @param customId
|
|
4431
|
+
*/
|
|
4432
|
+
constructor(nodes, placeholders, placeholderToMessage, meaning, description, customId) {
|
|
4433
|
+
this.nodes = nodes;
|
|
4434
|
+
this.placeholders = placeholders;
|
|
4435
|
+
this.placeholderToMessage = placeholderToMessage;
|
|
4436
|
+
this.meaning = meaning;
|
|
4437
|
+
this.description = description;
|
|
4438
|
+
this.customId = customId;
|
|
4439
|
+
this.id = this.customId;
|
|
4440
|
+
/** The ids to use if there are no custom id and if `i18nLegacyMessageIdFormat` is not empty */
|
|
4441
|
+
this.legacyIds = [];
|
|
4442
|
+
this.messageString = serializeMessage(this.nodes);
|
|
4443
|
+
if (nodes.length) {
|
|
4444
|
+
this.sources = [{
|
|
4445
|
+
filePath: nodes[0].sourceSpan.start.file.url,
|
|
4446
|
+
startLine: nodes[0].sourceSpan.start.line + 1,
|
|
4447
|
+
startCol: nodes[0].sourceSpan.start.col + 1,
|
|
4448
|
+
endLine: nodes[nodes.length - 1].sourceSpan.end.line + 1,
|
|
4449
|
+
endCol: nodes[0].sourceSpan.start.col + 1
|
|
4450
|
+
}];
|
|
4451
|
+
}
|
|
4452
|
+
else {
|
|
4453
|
+
this.sources = [];
|
|
4454
|
+
}
|
|
4455
|
+
}
|
|
4215
4456
|
}
|
|
4216
|
-
|
|
4217
|
-
|
|
4218
|
-
|
|
4219
|
-
|
|
4220
|
-
*
|
|
4221
|
-
* @internal
|
|
4222
|
-
*/
|
|
4223
|
-
class _SerializerVisitor {
|
|
4224
|
-
visitText(text, context) {
|
|
4225
|
-
return text.value;
|
|
4457
|
+
class Text$1 {
|
|
4458
|
+
constructor(value, sourceSpan) {
|
|
4459
|
+
this.value = value;
|
|
4460
|
+
this.sourceSpan = sourceSpan;
|
|
4226
4461
|
}
|
|
4227
|
-
|
|
4228
|
-
return
|
|
4462
|
+
visit(visitor, context) {
|
|
4463
|
+
return visitor.visitText(this, context);
|
|
4229
4464
|
}
|
|
4230
|
-
|
|
4231
|
-
|
|
4232
|
-
|
|
4465
|
+
}
|
|
4466
|
+
// TODO(vicb): do we really need this node (vs an array) ?
|
|
4467
|
+
class Container {
|
|
4468
|
+
constructor(children, sourceSpan) {
|
|
4469
|
+
this.children = children;
|
|
4470
|
+
this.sourceSpan = sourceSpan;
|
|
4233
4471
|
}
|
|
4234
|
-
|
|
4235
|
-
return
|
|
4236
|
-
`<ph tag name="${ph.startName}"/>` :
|
|
4237
|
-
`<ph tag name="${ph.startName}">${ph.children.map(child => child.visit(this)).join(', ')}</ph name="${ph.closeName}">`;
|
|
4472
|
+
visit(visitor, context) {
|
|
4473
|
+
return visitor.visitContainer(this, context);
|
|
4238
4474
|
}
|
|
4239
|
-
|
|
4240
|
-
|
|
4475
|
+
}
|
|
4476
|
+
class Icu {
|
|
4477
|
+
constructor(expression, type, cases, sourceSpan) {
|
|
4478
|
+
this.expression = expression;
|
|
4479
|
+
this.type = type;
|
|
4480
|
+
this.cases = cases;
|
|
4481
|
+
this.sourceSpan = sourceSpan;
|
|
4241
4482
|
}
|
|
4242
|
-
|
|
4243
|
-
return
|
|
4483
|
+
visit(visitor, context) {
|
|
4484
|
+
return visitor.visitIcu(this, context);
|
|
4244
4485
|
}
|
|
4245
4486
|
}
|
|
4246
|
-
|
|
4247
|
-
|
|
4248
|
-
|
|
4249
|
-
|
|
4250
|
-
|
|
4251
|
-
|
|
4252
|
-
|
|
4253
|
-
|
|
4254
|
-
|
|
4255
|
-
|
|
4256
|
-
|
|
4257
|
-
|
|
4258
|
-
|
|
4259
|
-
let strCases = Object.keys(icu.cases).map((k) => `${k} {${icu.cases[k].visit(this)}}`);
|
|
4260
|
-
// Do not take the expression into account
|
|
4261
|
-
return `{${icu.type}, ${strCases.join(', ')}}`;
|
|
4487
|
+
class TagPlaceholder {
|
|
4488
|
+
constructor(tag, attrs, startName, closeName, children, isVoid,
|
|
4489
|
+
// TODO sourceSpan should cover all (we need a startSourceSpan and endSourceSpan)
|
|
4490
|
+
sourceSpan, startSourceSpan, endSourceSpan) {
|
|
4491
|
+
this.tag = tag;
|
|
4492
|
+
this.attrs = attrs;
|
|
4493
|
+
this.startName = startName;
|
|
4494
|
+
this.closeName = closeName;
|
|
4495
|
+
this.children = children;
|
|
4496
|
+
this.isVoid = isVoid;
|
|
4497
|
+
this.sourceSpan = sourceSpan;
|
|
4498
|
+
this.startSourceSpan = startSourceSpan;
|
|
4499
|
+
this.endSourceSpan = endSourceSpan;
|
|
4262
4500
|
}
|
|
4263
|
-
|
|
4264
|
-
|
|
4265
|
-
* Compute the SHA1 of the given string
|
|
4266
|
-
*
|
|
4267
|
-
* see https://csrc.nist.gov/publications/fips/fips180-4/fips-180-4.pdf
|
|
4268
|
-
*
|
|
4269
|
-
* WARNING: this function has not been designed not tested with security in mind.
|
|
4270
|
-
* DO NOT USE IT IN A SECURITY SENSITIVE CONTEXT.
|
|
4271
|
-
*/
|
|
4272
|
-
function sha1(str) {
|
|
4273
|
-
const utf8 = utf8Encode(str);
|
|
4274
|
-
const words32 = bytesToWords32(utf8, Endian.Big);
|
|
4275
|
-
const len = utf8.length * 8;
|
|
4276
|
-
const w = newArray(80);
|
|
4277
|
-
let a = 0x67452301, b = 0xefcdab89, c = 0x98badcfe, d = 0x10325476, e = 0xc3d2e1f0;
|
|
4278
|
-
words32[len >> 5] |= 0x80 << (24 - len % 32);
|
|
4279
|
-
words32[((len + 64 >> 9) << 4) + 15] = len;
|
|
4280
|
-
for (let i = 0; i < words32.length; i += 16) {
|
|
4281
|
-
const h0 = a, h1 = b, h2 = c, h3 = d, h4 = e;
|
|
4282
|
-
for (let j = 0; j < 80; j++) {
|
|
4283
|
-
if (j < 16) {
|
|
4284
|
-
w[j] = words32[i + j];
|
|
4285
|
-
}
|
|
4286
|
-
else {
|
|
4287
|
-
w[j] = rol32(w[j - 3] ^ w[j - 8] ^ w[j - 14] ^ w[j - 16], 1);
|
|
4288
|
-
}
|
|
4289
|
-
const fkVal = fk(j, b, c, d);
|
|
4290
|
-
const f = fkVal[0];
|
|
4291
|
-
const k = fkVal[1];
|
|
4292
|
-
const temp = [rol32(a, 5), f, e, k, w[j]].reduce(add32);
|
|
4293
|
-
e = d;
|
|
4294
|
-
d = c;
|
|
4295
|
-
c = rol32(b, 30);
|
|
4296
|
-
b = a;
|
|
4297
|
-
a = temp;
|
|
4298
|
-
}
|
|
4299
|
-
a = add32(a, h0);
|
|
4300
|
-
b = add32(b, h1);
|
|
4301
|
-
c = add32(c, h2);
|
|
4302
|
-
d = add32(d, h3);
|
|
4303
|
-
e = add32(e, h4);
|
|
4501
|
+
visit(visitor, context) {
|
|
4502
|
+
return visitor.visitTagPlaceholder(this, context);
|
|
4304
4503
|
}
|
|
4305
|
-
return bytesToHexString(words32ToByteString([a, b, c, d, e]));
|
|
4306
4504
|
}
|
|
4307
|
-
|
|
4308
|
-
|
|
4309
|
-
|
|
4505
|
+
class Placeholder {
|
|
4506
|
+
constructor(value, name, sourceSpan) {
|
|
4507
|
+
this.value = value;
|
|
4508
|
+
this.name = name;
|
|
4509
|
+
this.sourceSpan = sourceSpan;
|
|
4310
4510
|
}
|
|
4311
|
-
|
|
4312
|
-
return
|
|
4511
|
+
visit(visitor, context) {
|
|
4512
|
+
return visitor.visitPlaceholder(this, context);
|
|
4313
4513
|
}
|
|
4314
|
-
|
|
4315
|
-
|
|
4514
|
+
}
|
|
4515
|
+
class IcuPlaceholder {
|
|
4516
|
+
constructor(value, name, sourceSpan) {
|
|
4517
|
+
this.value = value;
|
|
4518
|
+
this.name = name;
|
|
4519
|
+
this.sourceSpan = sourceSpan;
|
|
4520
|
+
}
|
|
4521
|
+
visit(visitor, context) {
|
|
4522
|
+
return visitor.visitIcuPlaceholder(this, context);
|
|
4316
4523
|
}
|
|
4317
|
-
return [b ^ c ^ d, 0xca62c1d6];
|
|
4318
4524
|
}
|
|
4319
4525
|
/**
|
|
4320
|
-
*
|
|
4321
|
-
*
|
|
4322
|
-
* The output is 64 bit number encoded as a decimal string
|
|
4323
|
-
*
|
|
4324
|
-
* based on:
|
|
4325
|
-
* https://github.com/google/closure-compiler/blob/master/src/com/google/javascript/jscomp/GoogleJsMessageIdGenerator.java
|
|
4526
|
+
* Serialize the message to the Localize backtick string format that would appear in compiled code.
|
|
4326
4527
|
*/
|
|
4327
|
-
function
|
|
4328
|
-
const
|
|
4329
|
-
|
|
4330
|
-
|
|
4331
|
-
if (hi == 0 && (lo == 0 || lo == 1)) {
|
|
4332
|
-
hi = hi ^ 0x130f9bef;
|
|
4333
|
-
lo = lo ^ -0x6b5f56d8;
|
|
4334
|
-
}
|
|
4335
|
-
return [hi, lo];
|
|
4336
|
-
}
|
|
4337
|
-
function computeMsgId(msg, meaning = '') {
|
|
4338
|
-
let msgFingerprint = fingerprint(msg);
|
|
4339
|
-
if (meaning) {
|
|
4340
|
-
const meaningFingerprint = fingerprint(meaning);
|
|
4341
|
-
msgFingerprint = add64(rol64(msgFingerprint, 1), meaningFingerprint);
|
|
4342
|
-
}
|
|
4343
|
-
const hi = msgFingerprint[0];
|
|
4344
|
-
const lo = msgFingerprint[1];
|
|
4345
|
-
return wordsToDecimalString(hi & 0x7fffffff, lo);
|
|
4528
|
+
function serializeMessage(messageNodes) {
|
|
4529
|
+
const visitor = new LocalizeMessageStringVisitor();
|
|
4530
|
+
const str = messageNodes.map(n => n.visit(visitor)).join('');
|
|
4531
|
+
return str;
|
|
4346
4532
|
}
|
|
4347
|
-
|
|
4348
|
-
|
|
4349
|
-
|
|
4350
|
-
const len = bytes.length;
|
|
4351
|
-
for (i = 0; i + 12 <= len; i += 12) {
|
|
4352
|
-
a = add32(a, wordAt(bytes, i, Endian.Little));
|
|
4353
|
-
b = add32(b, wordAt(bytes, i + 4, Endian.Little));
|
|
4354
|
-
c = add32(c, wordAt(bytes, i + 8, Endian.Little));
|
|
4355
|
-
const res = mix(a, b, c);
|
|
4356
|
-
a = res[0], b = res[1], c = res[2];
|
|
4533
|
+
class LocalizeMessageStringVisitor {
|
|
4534
|
+
visitText(text) {
|
|
4535
|
+
return text.value;
|
|
4357
4536
|
}
|
|
4358
|
-
|
|
4359
|
-
|
|
4360
|
-
// the first byte of c is reserved for the length
|
|
4361
|
-
c = add32(c, len);
|
|
4362
|
-
c = add32(c, wordAt(bytes, i + 8, Endian.Little) << 8);
|
|
4363
|
-
return mix(a, b, c)[2];
|
|
4364
|
-
}
|
|
4365
|
-
// clang-format off
|
|
4366
|
-
function mix(a, b, c) {
|
|
4367
|
-
a = sub32(a, b);
|
|
4368
|
-
a = sub32(a, c);
|
|
4369
|
-
a ^= c >>> 13;
|
|
4370
|
-
b = sub32(b, c);
|
|
4371
|
-
b = sub32(b, a);
|
|
4372
|
-
b ^= a << 8;
|
|
4373
|
-
c = sub32(c, a);
|
|
4374
|
-
c = sub32(c, b);
|
|
4375
|
-
c ^= b >>> 13;
|
|
4376
|
-
a = sub32(a, b);
|
|
4377
|
-
a = sub32(a, c);
|
|
4378
|
-
a ^= c >>> 12;
|
|
4379
|
-
b = sub32(b, c);
|
|
4380
|
-
b = sub32(b, a);
|
|
4381
|
-
b ^= a << 16;
|
|
4382
|
-
c = sub32(c, a);
|
|
4383
|
-
c = sub32(c, b);
|
|
4384
|
-
c ^= b >>> 5;
|
|
4385
|
-
a = sub32(a, b);
|
|
4386
|
-
a = sub32(a, c);
|
|
4387
|
-
a ^= c >>> 3;
|
|
4388
|
-
b = sub32(b, c);
|
|
4389
|
-
b = sub32(b, a);
|
|
4390
|
-
b ^= a << 10;
|
|
4391
|
-
c = sub32(c, a);
|
|
4392
|
-
c = sub32(c, b);
|
|
4393
|
-
c ^= b >>> 15;
|
|
4394
|
-
return [a, b, c];
|
|
4395
|
-
}
|
|
4396
|
-
// clang-format on
|
|
4397
|
-
// Utils
|
|
4398
|
-
var Endian;
|
|
4399
|
-
(function (Endian) {
|
|
4400
|
-
Endian[Endian["Little"] = 0] = "Little";
|
|
4401
|
-
Endian[Endian["Big"] = 1] = "Big";
|
|
4402
|
-
})(Endian || (Endian = {}));
|
|
4403
|
-
function add32(a, b) {
|
|
4404
|
-
return add32to64(a, b)[1];
|
|
4405
|
-
}
|
|
4406
|
-
function add32to64(a, b) {
|
|
4407
|
-
const low = (a & 0xffff) + (b & 0xffff);
|
|
4408
|
-
const high = (a >>> 16) + (b >>> 16) + (low >>> 16);
|
|
4409
|
-
return [high >>> 16, (high << 16) | (low & 0xffff)];
|
|
4410
|
-
}
|
|
4411
|
-
function add64(a, b) {
|
|
4412
|
-
const ah = a[0], al = a[1];
|
|
4413
|
-
const bh = b[0], bl = b[1];
|
|
4414
|
-
const result = add32to64(al, bl);
|
|
4415
|
-
const carry = result[0];
|
|
4416
|
-
const l = result[1];
|
|
4417
|
-
const h = add32(add32(ah, bh), carry);
|
|
4418
|
-
return [h, l];
|
|
4419
|
-
}
|
|
4420
|
-
function sub32(a, b) {
|
|
4421
|
-
const low = (a & 0xffff) - (b & 0xffff);
|
|
4422
|
-
const high = (a >> 16) - (b >> 16) + (low >> 16);
|
|
4423
|
-
return (high << 16) | (low & 0xffff);
|
|
4424
|
-
}
|
|
4425
|
-
// Rotate a 32b number left `count` position
|
|
4426
|
-
function rol32(a, count) {
|
|
4427
|
-
return (a << count) | (a >>> (32 - count));
|
|
4428
|
-
}
|
|
4429
|
-
// Rotate a 64b number left `count` position
|
|
4430
|
-
function rol64(num, count) {
|
|
4431
|
-
const hi = num[0], lo = num[1];
|
|
4432
|
-
const h = (hi << count) | (lo >>> (32 - count));
|
|
4433
|
-
const l = (lo << count) | (hi >>> (32 - count));
|
|
4434
|
-
return [h, l];
|
|
4435
|
-
}
|
|
4436
|
-
function bytesToWords32(bytes, endian) {
|
|
4437
|
-
const size = (bytes.length + 3) >>> 2;
|
|
4438
|
-
const words32 = [];
|
|
4439
|
-
for (let i = 0; i < size; i++) {
|
|
4440
|
-
words32[i] = wordAt(bytes, i * 4, endian);
|
|
4537
|
+
visitContainer(container) {
|
|
4538
|
+
return container.children.map(child => child.visit(this)).join('');
|
|
4441
4539
|
}
|
|
4442
|
-
|
|
4443
|
-
|
|
4444
|
-
|
|
4445
|
-
return index >= bytes.length ? 0 : bytes[index];
|
|
4446
|
-
}
|
|
4447
|
-
function wordAt(bytes, index, endian) {
|
|
4448
|
-
let word = 0;
|
|
4449
|
-
if (endian === Endian.Big) {
|
|
4450
|
-
for (let i = 0; i < 4; i++) {
|
|
4451
|
-
word += byteAt(bytes, index + i) << (24 - 8 * i);
|
|
4452
|
-
}
|
|
4540
|
+
visitIcu(icu) {
|
|
4541
|
+
const strCases = Object.keys(icu.cases).map((k) => `${k} {${icu.cases[k].visit(this)}}`);
|
|
4542
|
+
return `{${icu.expressionPlaceholder}, ${icu.type}, ${strCases.join(' ')}}`;
|
|
4453
4543
|
}
|
|
4454
|
-
|
|
4455
|
-
|
|
4456
|
-
|
|
4457
|
-
}
|
|
4544
|
+
visitTagPlaceholder(ph) {
|
|
4545
|
+
const children = ph.children.map(child => child.visit(this)).join('');
|
|
4546
|
+
return `{$${ph.startName}}${children}{$${ph.closeName}}`;
|
|
4458
4547
|
}
|
|
4459
|
-
|
|
4460
|
-
|
|
4461
|
-
function words32ToByteString(words32) {
|
|
4462
|
-
return words32.reduce((bytes, word) => bytes.concat(word32ToByteString(word)), []);
|
|
4463
|
-
}
|
|
4464
|
-
function word32ToByteString(word) {
|
|
4465
|
-
let bytes = [];
|
|
4466
|
-
for (let i = 0; i < 4; i++) {
|
|
4467
|
-
bytes.push((word >>> 8 * (3 - i)) & 0xff);
|
|
4548
|
+
visitPlaceholder(ph) {
|
|
4549
|
+
return `{$${ph.name}}`;
|
|
4468
4550
|
}
|
|
4469
|
-
|
|
4470
|
-
|
|
4471
|
-
function bytesToHexString(bytes) {
|
|
4472
|
-
let hex = '';
|
|
4473
|
-
for (let i = 0; i < bytes.length; i++) {
|
|
4474
|
-
const b = byteAt(bytes, i);
|
|
4475
|
-
hex += (b >>> 4).toString(16) + (b & 0x0f).toString(16);
|
|
4551
|
+
visitIcuPlaceholder(ph) {
|
|
4552
|
+
return `{$${ph.name}}`;
|
|
4476
4553
|
}
|
|
4477
|
-
return hex.toLowerCase();
|
|
4478
|
-
}
|
|
4479
|
-
/**
|
|
4480
|
-
* Create a shared exponentiation pool for base-256 computations. This shared pool provides memoized
|
|
4481
|
-
* power-of-256 results with memoized power-of-two computations for efficient multiplication.
|
|
4482
|
-
*
|
|
4483
|
-
* For our purposes, this can be safely stored as a global without memory concerns. The reason is
|
|
4484
|
-
* that we encode two words, so only need the 0th (for the low word) and 4th (for the high word)
|
|
4485
|
-
* exponent.
|
|
4486
|
-
*/
|
|
4487
|
-
const base256 = new BigIntExponentiation(256);
|
|
4488
|
-
/**
|
|
4489
|
-
* Represents two 32-bit words as a single decimal number. This requires a big integer storage
|
|
4490
|
-
* model as JS numbers are not accurate enough to represent the 64-bit number.
|
|
4491
|
-
*
|
|
4492
|
-
* Based on https://www.danvk.org/hex2dec.html
|
|
4493
|
-
*/
|
|
4494
|
-
function wordsToDecimalString(hi, lo) {
|
|
4495
|
-
// Encode the four bytes in lo in the lower digits of the decimal number.
|
|
4496
|
-
// Note: the multiplication results in lo itself but represented by a big integer using its
|
|
4497
|
-
// decimal digits.
|
|
4498
|
-
const decimal = base256.toThePowerOf(0).multiplyBy(lo);
|
|
4499
|
-
// Encode the four bytes in hi above the four lo bytes. lo is a maximum of (2^8)^4, which is why
|
|
4500
|
-
// this multiplication factor is applied.
|
|
4501
|
-
base256.toThePowerOf(4).multiplyByAndAddTo(hi, decimal);
|
|
4502
|
-
return decimal.toString();
|
|
4503
4554
|
}
|
|
4504
4555
|
|
|
4505
4556
|
/**
|
|
@@ -16773,6 +16824,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'os', 'typescript', 'fs', '
|
|
|
16773
16824
|
return new ParseTreeResult(result, this._errors);
|
|
16774
16825
|
}
|
|
16775
16826
|
visitElement(element) {
|
|
16827
|
+
let message = undefined;
|
|
16776
16828
|
if (hasI18nAttrs(element)) {
|
|
16777
16829
|
this.hasI18nMeta = true;
|
|
16778
16830
|
const attrs = [];
|
|
@@ -16781,11 +16833,13 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'os', 'typescript', 'fs', '
|
|
|
16781
16833
|
if (attr.name === I18N_ATTR) {
|
|
16782
16834
|
// root 'i18n' node attribute
|
|
16783
16835
|
const i18n = element.i18n || attr.value;
|
|
16784
|
-
|
|
16785
|
-
|
|
16786
|
-
|
|
16787
|
-
|
|
16836
|
+
message = this._generateI18nMessage(element.children, i18n, setI18nRefs);
|
|
16837
|
+
if (message.nodes.length === 0) {
|
|
16838
|
+
// Ignore the message if it is empty.
|
|
16839
|
+
message = undefined;
|
|
16788
16840
|
}
|
|
16841
|
+
// Store the message on the element
|
|
16842
|
+
element.i18n = message;
|
|
16789
16843
|
}
|
|
16790
16844
|
else if (attr.name.startsWith(I18N_ATTR_PREFIX)) {
|
|
16791
16845
|
// 'i18n-*' attributes
|
|
@@ -16818,7 +16872,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'os', 'typescript', 'fs', '
|
|
|
16818
16872
|
element.attrs = attrs;
|
|
16819
16873
|
}
|
|
16820
16874
|
}
|
|
16821
|
-
visitAll(this, element.children,
|
|
16875
|
+
visitAll(this, element.children, message);
|
|
16822
16876
|
return element;
|
|
16823
16877
|
}
|
|
16824
16878
|
visitExpansion(expansion, currentMessage) {
|
|
@@ -16833,6 +16887,10 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'os', 'typescript', 'fs', '
|
|
|
16833
16887
|
message = this._generateI18nMessage([expansion], meta);
|
|
16834
16888
|
const icu = icuFromI18nMessage(message);
|
|
16835
16889
|
icu.name = name;
|
|
16890
|
+
if (currentMessage !== null) {
|
|
16891
|
+
// Also update the placeholderToMessage map with this new message
|
|
16892
|
+
currentMessage.placeholderToMessage[name] = message;
|
|
16893
|
+
}
|
|
16836
16894
|
}
|
|
16837
16895
|
else {
|
|
16838
16896
|
// ICU is a top level message, try to use metadata from container element if provided via
|
|
@@ -16869,8 +16927,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'os', 'typescript', 'fs', '
|
|
|
16869
16927
|
*/
|
|
16870
16928
|
_parseMetadata(meta) {
|
|
16871
16929
|
return typeof meta === 'string' ? parseI18nMeta(meta) :
|
|
16872
|
-
meta instanceof Message ? meta :
|
|
16873
|
-
{};
|
|
16930
|
+
meta instanceof Message ? meta : {};
|
|
16874
16931
|
}
|
|
16875
16932
|
/**
|
|
16876
16933
|
* Generate (or restore) message id if not specified already.
|
|
@@ -16895,9 +16952,9 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'os', 'typescript', 'fs', '
|
|
|
16895
16952
|
// `packages/compiler/src/render3/view/template.ts`).
|
|
16896
16953
|
// In that case we want to reuse the legacy message generated in the 1st pass (see
|
|
16897
16954
|
// `setI18nRefs()`).
|
|
16898
|
-
const previousMessage = meta instanceof Message ?
|
|
16899
|
-
meta
|
|
16900
|
-
|
|
16955
|
+
const previousMessage = meta instanceof Message ?
|
|
16956
|
+
meta :
|
|
16957
|
+
meta instanceof IcuPlaceholder ? meta.previousMessage : undefined;
|
|
16901
16958
|
message.legacyIds = previousMessage ? previousMessage.legacyIds : [];
|
|
16902
16959
|
}
|
|
16903
16960
|
}
|
|
@@ -16999,9 +17056,9 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'os', 'typescript', 'fs', '
|
|
|
16999
17056
|
return this.formatPh(ph.name);
|
|
17000
17057
|
}
|
|
17001
17058
|
}
|
|
17002
|
-
const serializerVisitor
|
|
17059
|
+
const serializerVisitor = new GetMsgSerializerVisitor();
|
|
17003
17060
|
function serializeI18nMessageForGetMsg(message) {
|
|
17004
|
-
return message.nodes.map(node => node.visit(serializerVisitor
|
|
17061
|
+
return message.nodes.map(node => node.visit(serializerVisitor, null)).join('');
|
|
17005
17062
|
}
|
|
17006
17063
|
|
|
17007
17064
|
function createLocalizeStatements(variable, message, params) {
|
|
@@ -17018,40 +17075,43 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'os', 'typescript', 'fs', '
|
|
|
17018
17075
|
* The result can be used for generating the `$localize` tagged template literals.
|
|
17019
17076
|
*/
|
|
17020
17077
|
class LocalizeSerializerVisitor {
|
|
17021
|
-
|
|
17022
|
-
|
|
17078
|
+
constructor(placeholderToMessage, pieces) {
|
|
17079
|
+
this.placeholderToMessage = placeholderToMessage;
|
|
17080
|
+
this.pieces = pieces;
|
|
17081
|
+
}
|
|
17082
|
+
visitText(text) {
|
|
17083
|
+
if (this.pieces[this.pieces.length - 1] instanceof LiteralPiece) {
|
|
17023
17084
|
// Two literal pieces in a row means that there was some comment node in-between.
|
|
17024
|
-
|
|
17085
|
+
this.pieces[this.pieces.length - 1].text += text.value;
|
|
17025
17086
|
}
|
|
17026
17087
|
else {
|
|
17027
17088
|
const sourceSpan = new ParseSourceSpan(text.sourceSpan.fullStart, text.sourceSpan.end, text.sourceSpan.fullStart, text.sourceSpan.details);
|
|
17028
|
-
|
|
17089
|
+
this.pieces.push(new LiteralPiece(text.value, sourceSpan));
|
|
17029
17090
|
}
|
|
17030
17091
|
}
|
|
17031
|
-
visitContainer(container
|
|
17032
|
-
container.children.forEach(child => child.visit(this
|
|
17092
|
+
visitContainer(container) {
|
|
17093
|
+
container.children.forEach(child => child.visit(this));
|
|
17033
17094
|
}
|
|
17034
|
-
visitIcu(icu
|
|
17035
|
-
|
|
17095
|
+
visitIcu(icu) {
|
|
17096
|
+
this.pieces.push(new LiteralPiece(serializeIcuNode(icu), icu.sourceSpan));
|
|
17036
17097
|
}
|
|
17037
|
-
visitTagPlaceholder(ph
|
|
17038
|
-
|
|
17098
|
+
visitTagPlaceholder(ph) {
|
|
17099
|
+
this.pieces.push(this.createPlaceholderPiece(ph.startName, ph.startSourceSpan ?? ph.sourceSpan));
|
|
17039
17100
|
if (!ph.isVoid) {
|
|
17040
|
-
ph.children.forEach(child => child.visit(this
|
|
17041
|
-
|
|
17101
|
+
ph.children.forEach(child => child.visit(this));
|
|
17102
|
+
this.pieces.push(this.createPlaceholderPiece(ph.closeName, ph.endSourceSpan ?? ph.sourceSpan));
|
|
17042
17103
|
}
|
|
17043
17104
|
}
|
|
17044
|
-
visitPlaceholder(ph
|
|
17045
|
-
|
|
17105
|
+
visitPlaceholder(ph) {
|
|
17106
|
+
this.pieces.push(this.createPlaceholderPiece(ph.name, ph.sourceSpan));
|
|
17046
17107
|
}
|
|
17047
|
-
visitIcuPlaceholder(ph
|
|
17048
|
-
|
|
17108
|
+
visitIcuPlaceholder(ph) {
|
|
17109
|
+
this.pieces.push(this.createPlaceholderPiece(ph.name, ph.sourceSpan, this.placeholderToMessage[ph.name]));
|
|
17049
17110
|
}
|
|
17050
|
-
createPlaceholderPiece(name, sourceSpan) {
|
|
17051
|
-
return new PlaceholderPiece(formatI18nPlaceholderName(name, /* useCamelCase */ false), sourceSpan);
|
|
17111
|
+
createPlaceholderPiece(name, sourceSpan, associatedMessage) {
|
|
17112
|
+
return new PlaceholderPiece(formatI18nPlaceholderName(name, /* useCamelCase */ false), sourceSpan, associatedMessage);
|
|
17052
17113
|
}
|
|
17053
17114
|
}
|
|
17054
|
-
const serializerVisitor = new LocalizeSerializerVisitor();
|
|
17055
17115
|
/**
|
|
17056
17116
|
* Serialize an i18n message into two arrays: messageParts and placeholders.
|
|
17057
17117
|
*
|
|
@@ -17062,7 +17122,8 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'os', 'typescript', 'fs', '
|
|
|
17062
17122
|
*/
|
|
17063
17123
|
function serializeI18nMessageForLocalize(message) {
|
|
17064
17124
|
const pieces = [];
|
|
17065
|
-
|
|
17125
|
+
const serializerVisitor = new LocalizeSerializerVisitor(message.placeholderToMessage, pieces);
|
|
17126
|
+
message.nodes.forEach(node => node.visit(serializerVisitor));
|
|
17066
17127
|
return processMessagePieces(pieces);
|
|
17067
17128
|
}
|
|
17068
17129
|
function getSourceSpan(message) {
|
|
@@ -20016,7 +20077,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'os', 'typescript', 'fs', '
|
|
|
20016
20077
|
* Use of this source code is governed by an MIT-style license that can be
|
|
20017
20078
|
* found in the LICENSE file at https://angular.io/license
|
|
20018
20079
|
*/
|
|
20019
|
-
new Version('13.0.3');
|
|
20080
|
+
new Version('13.1.0-next.3');
|
|
20020
20081
|
|
|
20021
20082
|
/**
|
|
20022
20083
|
* @license
|
|
@@ -20645,7 +20706,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'os', 'typescript', 'fs', '
|
|
|
20645
20706
|
function compileDeclareClassMetadata(metadata) {
|
|
20646
20707
|
const definitionMap = new DefinitionMap();
|
|
20647
20708
|
definitionMap.set('minVersion', literal$1(MINIMUM_PARTIAL_LINKER_VERSION$6));
|
|
20648
|
-
definitionMap.set('version', literal$1('13.0.3'));
|
|
20709
|
+
definitionMap.set('version', literal$1('13.1.0-next.3'));
|
|
20649
20710
|
definitionMap.set('ngImport', importExpr(Identifiers$1.core));
|
|
20650
20711
|
definitionMap.set('type', metadata.type);
|
|
20651
20712
|
definitionMap.set('decorators', metadata.decorators);
|
|
@@ -20762,7 +20823,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'os', 'typescript', 'fs', '
|
|
|
20762
20823
|
function createDirectiveDefinitionMap(meta) {
|
|
20763
20824
|
const definitionMap = new DefinitionMap();
|
|
20764
20825
|
definitionMap.set('minVersion', literal$1(MINIMUM_PARTIAL_LINKER_VERSION$5));
|
|
20765
|
-
definitionMap.set('version', literal$1('13.0.3'));
|
|
20826
|
+
definitionMap.set('version', literal$1('13.1.0-next.3'));
|
|
20766
20827
|
// e.g. `type: MyDirective`
|
|
20767
20828
|
definitionMap.set('type', meta.internalType);
|
|
20768
20829
|
// e.g. `selector: 'some-dir'`
|
|
@@ -20980,7 +21041,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'os', 'typescript', 'fs', '
|
|
|
20980
21041
|
function compileDeclareFactoryFunction(meta) {
|
|
20981
21042
|
const definitionMap = new DefinitionMap();
|
|
20982
21043
|
definitionMap.set('minVersion', literal$1(MINIMUM_PARTIAL_LINKER_VERSION$4));
|
|
20983
|
-
definitionMap.set('version', literal$1('13.0.3'));
|
|
21044
|
+
definitionMap.set('version', literal$1('13.1.0-next.3'));
|
|
20984
21045
|
definitionMap.set('ngImport', importExpr(Identifiers$1.core));
|
|
20985
21046
|
definitionMap.set('type', meta.internalType);
|
|
20986
21047
|
definitionMap.set('deps', compileDependencies(meta.deps));
|
|
@@ -21022,7 +21083,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'os', 'typescript', 'fs', '
|
|
|
21022
21083
|
function createInjectableDefinitionMap(meta) {
|
|
21023
21084
|
const definitionMap = new DefinitionMap();
|
|
21024
21085
|
definitionMap.set('minVersion', literal$1(MINIMUM_PARTIAL_LINKER_VERSION$3));
|
|
21025
|
-
definitionMap.set('version', literal$1('13.0.3'));
|
|
21086
|
+
definitionMap.set('version', literal$1('13.1.0-next.3'));
|
|
21026
21087
|
definitionMap.set('ngImport', importExpr(Identifiers$1.core));
|
|
21027
21088
|
definitionMap.set('type', meta.internalType);
|
|
21028
21089
|
// Only generate providedIn property if it has a non-null value
|
|
@@ -21080,7 +21141,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'os', 'typescript', 'fs', '
|
|
|
21080
21141
|
function createInjectorDefinitionMap(meta) {
|
|
21081
21142
|
const definitionMap = new DefinitionMap();
|
|
21082
21143
|
definitionMap.set('minVersion', literal$1(MINIMUM_PARTIAL_LINKER_VERSION$2));
|
|
21083
|
-
definitionMap.set('version', literal$1('13.0.3'));
|
|
21144
|
+
definitionMap.set('version', literal$1('13.1.0-next.3'));
|
|
21084
21145
|
definitionMap.set('ngImport', importExpr(Identifiers$1.core));
|
|
21085
21146
|
definitionMap.set('type', meta.internalType);
|
|
21086
21147
|
definitionMap.set('providers', meta.providers);
|
|
@@ -21117,7 +21178,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'os', 'typescript', 'fs', '
|
|
|
21117
21178
|
function createNgModuleDefinitionMap(meta) {
|
|
21118
21179
|
const definitionMap = new DefinitionMap();
|
|
21119
21180
|
definitionMap.set('minVersion', literal$1(MINIMUM_PARTIAL_LINKER_VERSION$1));
|
|
21120
|
-
definitionMap.set('version', literal$1('13.0.3'));
|
|
21181
|
+
definitionMap.set('version', literal$1('13.1.0-next.3'));
|
|
21121
21182
|
definitionMap.set('ngImport', importExpr(Identifiers$1.core));
|
|
21122
21183
|
definitionMap.set('type', meta.internalType);
|
|
21123
21184
|
// We only generate the keys in the metadata if the arrays contain values.
|
|
@@ -21175,7 +21236,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'os', 'typescript', 'fs', '
|
|
|
21175
21236
|
function createPipeDefinitionMap(meta) {
|
|
21176
21237
|
const definitionMap = new DefinitionMap();
|
|
21177
21238
|
definitionMap.set('minVersion', literal$1(MINIMUM_PARTIAL_LINKER_VERSION));
|
|
21178
|
-
definitionMap.set('version', literal$1('13.0.3'));
|
|
21239
|
+
definitionMap.set('version', literal$1('13.1.0-next.3'));
|
|
21179
21240
|
definitionMap.set('ngImport', importExpr(Identifiers$1.core));
|
|
21180
21241
|
// e.g. `type: MyPipe`
|
|
21181
21242
|
definitionMap.set('type', meta.internalType);
|
|
@@ -21207,18 +21268,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'os', 'typescript', 'fs', '
|
|
|
21207
21268
|
* Use of this source code is governed by an MIT-style license that can be
|
|
21208
21269
|
* found in the LICENSE file at https://angular.io/license
|
|
21209
21270
|
*/
|
|
21210
|
-
new Version('13.0.3');
|
|
21211
|
-
|
|
21212
|
-
/**
|
|
21213
|
-
* @license
|
|
21214
|
-
* Copyright Google LLC All Rights Reserved.
|
|
21215
|
-
*
|
|
21216
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
21217
|
-
* found in the LICENSE file at https://angular.io/license
|
|
21218
|
-
*/
|
|
21219
|
-
// In TypeScript 2.1 the spread element kind was renamed.
|
|
21220
|
-
ts__default["default"].SyntaxKind.SpreadElement || ts__default["default"].SyntaxKind.SpreadElementExpression;
|
|
21221
|
-
ts__default["default"].createNodeArray();
|
|
21271
|
+
new Version('13.1.0-next.3');
|
|
21222
21272
|
|
|
21223
21273
|
/**
|
|
21224
21274
|
* @license
|
|
@@ -21239,6 +21289,19 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'os', 'typescript', 'fs', '
|
|
|
21239
21289
|
EmitFlags[EmitFlags["All"] = 31] = "All";
|
|
21240
21290
|
})(EmitFlags || (EmitFlags = {}));
|
|
21241
21291
|
|
|
21292
|
+
/**
|
|
21293
|
+
* @license
|
|
21294
|
+
* Copyright Google LLC All Rights Reserved.
|
|
21295
|
+
*
|
|
21296
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
21297
|
+
* found in the LICENSE file at https://angular.io/license
|
|
21298
|
+
*/
|
|
21299
|
+
/**
|
|
21300
|
+
* The currently used version of TypeScript, which can be adjusted for testing purposes using
|
|
21301
|
+
* `setTypeScriptVersionForTesting` and `restoreTypeScriptVersionForTesting` below.
|
|
21302
|
+
*/
|
|
21303
|
+
ts__default["default"].version;
|
|
21304
|
+
|
|
21242
21305
|
/**
|
|
21243
21306
|
* @license
|
|
21244
21307
|
* Copyright Google LLC All Rights Reserved.
|
|
@@ -21535,6 +21598,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'os', 'typescript', 'fs', '
|
|
|
21535
21598
|
* found in the LICENSE file at https://angular.io/license
|
|
21536
21599
|
*/
|
|
21537
21600
|
const D_TS = /\.d\.ts$/i;
|
|
21601
|
+
const PARSED_TS_VERSION = parseFloat(ts__default["default"].versionMajorMinor);
|
|
21538
21602
|
function isSymbolWithValueDeclaration(symbol) {
|
|
21539
21603
|
// If there is a value declaration set, then the `declarations` property is never undefined. We
|
|
21540
21604
|
// still check for the property to exist as this matches with the type that `symbol` is narrowed
|
|
@@ -21648,6 +21712,19 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'os', 'typescript', 'fs', '
|
|
|
21648
21712
|
}
|
|
21649
21713
|
return redirectInfo.unredirected;
|
|
21650
21714
|
}
|
|
21715
|
+
/**
|
|
21716
|
+
* Backwards-compatible version of `ts.createExportSpecifier`
|
|
21717
|
+
* to handle a breaking change between 4.4 and 4.5.
|
|
21718
|
+
*/
|
|
21719
|
+
function createExportSpecifier(propertyName, name, isTypeOnly = false) {
|
|
21720
|
+
return PARSED_TS_VERSION > 4.4 ?
|
|
21721
|
+
// TODO(crisbeto): the function is cast to `any` here since g3 is still on TS 4.4.
|
|
21722
|
+
// Should be cleaned up when g3 has been updated.
|
|
21723
|
+
ts__default["default"].createExportSpecifier(isTypeOnly, propertyName, name) :
|
|
21724
|
+
// TODO(crisbeto): backwards-compatibility layer for TS 4.4.
|
|
21725
|
+
// Should be cleaned up when we drop support for it.
|
|
21726
|
+
ts__default["default"].createExportSpecifier(propertyName, name);
|
|
21727
|
+
}
|
|
21651
21728
|
|
|
21652
21729
|
/**
|
|
21653
21730
|
* @license
|
|
@@ -22979,8 +23056,15 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'os', 'typescript', 'fs', '
|
|
|
22979
23056
|
// import {Foo} from 'foo';
|
|
22980
23057
|
// or
|
|
22981
23058
|
// import {Foo as Bar} from 'foo';
|
|
23059
|
+
// TODO(crisbeto): the cast to `any` is here since g3 is still on TS 4.4.
|
|
23060
|
+
// Should be cleaned up when g3 has been updated.
|
|
23061
|
+
if (firstDecl.isTypeOnly) {
|
|
23062
|
+
// The import specifier can't be type-only (e.g. `import {type Foo} from '...')`.
|
|
23063
|
+
return typeOnlyImport(typeNode, firstDecl);
|
|
23064
|
+
}
|
|
22982
23065
|
if (firstDecl.parent.parent.isTypeOnly) {
|
|
22983
|
-
//
|
|
23066
|
+
// The import specifier can't be inside a type-only import clause
|
|
23067
|
+
// (e.g. `import type {Foo} from '...')`.
|
|
22984
23068
|
return typeOnlyImport(typeNode, firstDecl.parent.parent);
|
|
22985
23069
|
}
|
|
22986
23070
|
// Determine the name to import (`Foo`) from the import specifier, as the symbol names of
|
|
@@ -23048,10 +23132,10 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'os', 'typescript', 'fs', '
|
|
|
23048
23132
|
reason: { kind: 1 /* NO_VALUE_DECLARATION */, typeNode, decl },
|
|
23049
23133
|
};
|
|
23050
23134
|
}
|
|
23051
|
-
function typeOnlyImport(typeNode,
|
|
23135
|
+
function typeOnlyImport(typeNode, node) {
|
|
23052
23136
|
return {
|
|
23053
23137
|
kind: 2 /* UNAVAILABLE */,
|
|
23054
|
-
reason: { kind: 2 /* TYPE_ONLY_IMPORT */, typeNode,
|
|
23138
|
+
reason: { kind: 2 /* TYPE_ONLY_IMPORT */, typeNode, node },
|
|
23055
23139
|
};
|
|
23056
23140
|
}
|
|
23057
23141
|
function unknownReference(typeNode) {
|
|
@@ -26232,9 +26316,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'os', 'typescript', 'fs', '
|
|
|
26232
26316
|
const stmt = ts__default["default"].createExportDeclaration(
|
|
26233
26317
|
/* decorators */ undefined,
|
|
26234
26318
|
/* modifiers */ undefined,
|
|
26235
|
-
/* exportClause */ ts__default["default"].createNamedExports([
|
|
26236
|
-
/* propertyName */ symbolName,
|
|
26237
|
-
/* name */ aliasName)]),
|
|
26319
|
+
/* exportClause */ ts__default["default"].createNamedExports([createExportSpecifier(symbolName, aliasName)]),
|
|
26238
26320
|
/* moduleSpecifier */ ts__default["default"].createStringLiteral(moduleName));
|
|
26239
26321
|
statements.push(stmt);
|
|
26240
26322
|
});
|
|
@@ -28476,7 +28558,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'os', 'typescript', 'fs', '
|
|
|
28476
28558
|
'Consider changing the type-only import to a regular import, or use the @Inject decorator to specify an injection token.';
|
|
28477
28559
|
hints = [
|
|
28478
28560
|
makeRelatedInformation(reason.typeNode, 'This type is imported using a type-only import, which prevents it from being usable as an injection token.'),
|
|
28479
|
-
makeRelatedInformation(reason.
|
|
28561
|
+
makeRelatedInformation(reason.node, 'The type-only import occurs here.'),
|
|
28480
28562
|
];
|
|
28481
28563
|
break;
|
|
28482
28564
|
case 4 /* NAMESPACE */:
|
|
@@ -32071,7 +32153,7 @@ Either add the @Injectable() decorator to '${provider.node.name
|
|
|
32071
32153
|
continue;
|
|
32072
32154
|
}
|
|
32073
32155
|
if (ts__default["default"].isImportDeclaration(stmt) && stmt.importClause !== undefined &&
|
|
32074
|
-
stmt.importClause
|
|
32156
|
+
isTypeOnlyImportClause(stmt.importClause)) {
|
|
32075
32157
|
// Exclude type-only imports as they are always elided, so they don't contribute to
|
|
32076
32158
|
// cycles.
|
|
32077
32159
|
continue;
|
|
@@ -32094,6 +32176,20 @@ Either add the @Injectable() decorator to '${provider.node.name
|
|
|
32094
32176
|
function isLocalFile(sf) {
|
|
32095
32177
|
return !sf.isDeclarationFile;
|
|
32096
32178
|
}
|
|
32179
|
+
function isTypeOnlyImportClause(node) {
|
|
32180
|
+
// The clause itself is type-only (e.g. `import type {foo} from '...'`).
|
|
32181
|
+
if (node.isTypeOnly) {
|
|
32182
|
+
return true;
|
|
32183
|
+
}
|
|
32184
|
+
// All the specifiers in the cause are type-only (e.g. `import {type a, type b} from '...'`).
|
|
32185
|
+
if (node.namedBindings !== undefined && ts__default["default"].isNamedImports(node.namedBindings) &&
|
|
32186
|
+
// TODO(crisbeto): the cast to `any` is here since g3 is still on TS 4.4.
|
|
32187
|
+
// Should be cleaned up when g3 has been updated.
|
|
32188
|
+
node.namedBindings.elements.every(specifier => specifier.isTypeOnly)) {
|
|
32189
|
+
return true;
|
|
32190
|
+
}
|
|
32191
|
+
return false;
|
|
32192
|
+
}
|
|
32097
32193
|
/**
|
|
32098
32194
|
* A helper class to track which SourceFiles are being processed when searching for a path in
|
|
32099
32195
|
* `getPath()` above.
|
|
@@ -32414,7 +32510,9 @@ Either add the @Injectable() decorator to '${provider.node.name
|
|
|
32414
32510
|
// Update the import path to point to the correct file using the ImportRewriter.
|
|
32415
32511
|
const rewrittenModuleSpecifier = importRewriter.rewriteSpecifier('@angular/core', sourceFilePath);
|
|
32416
32512
|
if (rewrittenModuleSpecifier !== stmt.moduleSpecifier.text) {
|
|
32417
|
-
|
|
32513
|
+
// TODO(crisbeto): the cast to `any` is here since g3 is still on TS 4.4.
|
|
32514
|
+
// Should be cleaned up when g3 has been updated.
|
|
32515
|
+
transformedStatements.push(ts__default["default"].updateImportDeclaration(stmt, stmt.decorators, stmt.modifiers, stmt.importClause, ts__default["default"].createStringLiteral(rewrittenModuleSpecifier), undefined));
|
|
32418
32516
|
// Record the identifier by which this imported module goes, so references to its symbols
|
|
32419
32517
|
// can be discovered later.
|
|
32420
32518
|
if (stmt.importClause !== undefined && stmt.importClause.namedBindings !== undefined &&
|
|
@@ -33586,6 +33684,8 @@ Either add the @Injectable() decorator to '${provider.node.name
|
|
|
33586
33684
|
* marker and does not go to the filesystem for these requests, as they are known not to exist.
|
|
33587
33685
|
*/
|
|
33588
33686
|
function createLookupResolutionHost(adapter) {
|
|
33687
|
+
// TODO(crisbeto): the cast to `any` is here since g3 is still on TS 4.4.
|
|
33688
|
+
// Should be cleaned up when g3 has been updated.
|
|
33589
33689
|
return {
|
|
33590
33690
|
directoryExists(directoryName) {
|
|
33591
33691
|
if (directoryName.includes(RESOURCE_MARKER)) {
|
|
@@ -33613,6 +33713,9 @@ Either add the @Injectable() decorator to '${provider.node.name
|
|
|
33613
33713
|
getDirectories: adapter.getDirectories?.bind(adapter),
|
|
33614
33714
|
realpath: adapter.realpath?.bind(adapter),
|
|
33615
33715
|
trace: adapter.trace?.bind(adapter),
|
|
33716
|
+
useCaseSensitiveFileNames: typeof adapter.useCaseSensitiveFileNames === 'function' ?
|
|
33717
|
+
adapter.useCaseSensitiveFileNames.bind(adapter) :
|
|
33718
|
+
adapter.useCaseSensitiveFileNames
|
|
33616
33719
|
};
|
|
33617
33720
|
}
|
|
33618
33721
|
|
|
@@ -41051,19 +41154,6 @@ https://v9.angular.io/guide/template-typecheck#template-type-checking`,
|
|
|
41051
41154
|
return versions;
|
|
41052
41155
|
}
|
|
41053
41156
|
|
|
41054
|
-
/**
|
|
41055
|
-
* @license
|
|
41056
|
-
* Copyright Google LLC All Rights Reserved.
|
|
41057
|
-
*
|
|
41058
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
41059
|
-
* found in the LICENSE file at https://angular.io/license
|
|
41060
|
-
*/
|
|
41061
|
-
/**
|
|
41062
|
-
* The currently used version of TypeScript, which can be adjusted for testing purposes using
|
|
41063
|
-
* `setTypeScriptVersionForTesting` and `restoreTypeScriptVersionForTesting` below.
|
|
41064
|
-
*/
|
|
41065
|
-
ts__default["default"].version;
|
|
41066
|
-
|
|
41067
41157
|
/**
|
|
41068
41158
|
* @license
|
|
41069
41159
|
* Copyright Google LLC All Rights Reserved.
|
|
@@ -41799,7 +41889,7 @@ https://angular.io/guide/ivy for more information.
|
|
|
41799
41889
|
// same name instead. That way, we can provide go-to-definition for the pre-compiled files which
|
|
41800
41890
|
// would generally be the desired behavior.
|
|
41801
41891
|
if (url.endsWith('.css')) {
|
|
41802
|
-
const styleUrl =
|
|
41892
|
+
const styleUrl = p__namespace.resolve(fromFile, '..', url);
|
|
41803
41893
|
for (const ext of PRE_COMPILED_STYLE_EXTENSIONS) {
|
|
41804
41894
|
const precompiledFileUrl = styleUrl.replace(/\.css$/, ext);
|
|
41805
41895
|
if (this.fileExists(precompiledFileUrl)) {
|
|
@@ -41904,16 +41994,16 @@ https://angular.io/guide/ivy for more information.
|
|
|
41904
41994
|
return this.serverHost.getCurrentDirectory();
|
|
41905
41995
|
}
|
|
41906
41996
|
extname(path) {
|
|
41907
|
-
return
|
|
41997
|
+
return p__namespace.extname(path);
|
|
41908
41998
|
}
|
|
41909
41999
|
resolve(...paths) {
|
|
41910
|
-
return
|
|
42000
|
+
return p__namespace.resolve(...paths);
|
|
41911
42001
|
}
|
|
41912
42002
|
dirname(file) {
|
|
41913
|
-
return
|
|
42003
|
+
return p__namespace.dirname(file);
|
|
41914
42004
|
}
|
|
41915
42005
|
join(basePath, ...paths) {
|
|
41916
|
-
return
|
|
42006
|
+
return p__namespace.join(basePath, ...paths);
|
|
41917
42007
|
}
|
|
41918
42008
|
}
|
|
41919
42009
|
|
|
@@ -45028,6 +45118,7 @@ https://angular.io/guide/ivy for more information.
|
|
|
45028
45118
|
// regardless of its value in tsconfig.json.
|
|
45029
45119
|
if (config.forceStrictTemplates === true) {
|
|
45030
45120
|
options.strictTemplates = true;
|
|
45121
|
+
options._extendedTemplateDiagnostics = true;
|
|
45031
45122
|
}
|
|
45032
45123
|
return options;
|
|
45033
45124
|
}
|