@angular/compiler 17.0.0-next.3 → 17.0.0-next.4

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.
@@ -11,5 +11,5 @@
11
11
  * Entry point for all public APIs of the compiler package.
12
12
  */
13
13
  import { Version } from './util';
14
- export const VERSION = new Version('17.0.0-next.3');
14
+ export const VERSION = new Version('17.0.0-next.4');
15
15
  //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidmVyc2lvbi5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uL3BhY2thZ2VzL2NvbXBpbGVyL3NyYy92ZXJzaW9uLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOzs7Ozs7R0FNRztBQUVIOzs7O0dBSUc7QUFFSCxPQUFPLEVBQUMsT0FBTyxFQUFDLE1BQU0sUUFBUSxDQUFDO0FBRS9CLE1BQU0sQ0FBQyxNQUFNLE9BQU8sR0FBRyxJQUFJLE9BQU8sQ0FBQyxtQkFBbUIsQ0FBQyxDQUFDIiwic291cmNlc0NvbnRlbnQiOlsiLyoqXG4gKiBAbGljZW5zZVxuICogQ29weXJpZ2h0IEdvb2dsZSBMTEMgQWxsIFJpZ2h0cyBSZXNlcnZlZC5cbiAqXG4gKiBVc2Ugb2YgdGhpcyBzb3VyY2UgY29kZSBpcyBnb3Zlcm5lZCBieSBhbiBNSVQtc3R5bGUgbGljZW5zZSB0aGF0IGNhbiBiZVxuICogZm91bmQgaW4gdGhlIExJQ0VOU0UgZmlsZSBhdCBodHRwczovL2FuZ3VsYXIuaW8vbGljZW5zZVxuICovXG5cbi8qKlxuICogQG1vZHVsZVxuICogQGRlc2NyaXB0aW9uXG4gKiBFbnRyeSBwb2ludCBmb3IgYWxsIHB1YmxpYyBBUElzIG9mIHRoZSBjb21waWxlciBwYWNrYWdlLlxuICovXG5cbmltcG9ydCB7VmVyc2lvbn0gZnJvbSAnLi91dGlsJztcblxuZXhwb3J0IGNvbnN0IFZFUlNJT04gPSBuZXcgVmVyc2lvbignMC4wLjAtUExBQ0VIT0xERVInKTtcbiJdfQ==
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v17.0.0-next.3
2
+ * @license Angular v17.0.0-next.4
3
3
  * (c) 2010-2022 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -480,179 +480,6 @@ var core = /*#__PURE__*/Object.freeze({
480
480
  parseSelectorToR3Selector: parseSelectorToR3Selector
481
481
  });
482
482
 
483
- /**
484
- * Represents a big integer using a buffer of its individual digits, with the least significant
485
- * digit stored at the beginning of the array (little endian).
486
- *
487
- * For performance reasons, each instance is mutable. The addition operation can be done in-place
488
- * to reduce memory pressure of allocation for the digits array.
489
- */
490
- class BigInteger {
491
- static zero() {
492
- return new BigInteger([0]);
493
- }
494
- static one() {
495
- return new BigInteger([1]);
496
- }
497
- /**
498
- * Creates a big integer using its individual digits in little endian storage.
499
- */
500
- constructor(digits) {
501
- this.digits = digits;
502
- }
503
- /**
504
- * Creates a clone of this instance.
505
- */
506
- clone() {
507
- return new BigInteger(this.digits.slice());
508
- }
509
- /**
510
- * Returns a new big integer with the sum of `this` and `other` as its value. This does not mutate
511
- * `this` but instead returns a new instance, unlike `addToSelf`.
512
- */
513
- add(other) {
514
- const result = this.clone();
515
- result.addToSelf(other);
516
- return result;
517
- }
518
- /**
519
- * Adds `other` to the instance itself, thereby mutating its value.
520
- */
521
- addToSelf(other) {
522
- const maxNrOfDigits = Math.max(this.digits.length, other.digits.length);
523
- let carry = 0;
524
- for (let i = 0; i < maxNrOfDigits; i++) {
525
- let digitSum = carry;
526
- if (i < this.digits.length) {
527
- digitSum += this.digits[i];
528
- }
529
- if (i < other.digits.length) {
530
- digitSum += other.digits[i];
531
- }
532
- if (digitSum >= 10) {
533
- this.digits[i] = digitSum - 10;
534
- carry = 1;
535
- }
536
- else {
537
- this.digits[i] = digitSum;
538
- carry = 0;
539
- }
540
- }
541
- // Apply a remaining carry if needed.
542
- if (carry > 0) {
543
- this.digits[maxNrOfDigits] = 1;
544
- }
545
- }
546
- /**
547
- * Builds the decimal string representation of the big integer. As this is stored in
548
- * little endian, the digits are concatenated in reverse order.
549
- */
550
- toString() {
551
- let res = '';
552
- for (let i = this.digits.length - 1; i >= 0; i--) {
553
- res += this.digits[i];
554
- }
555
- return res;
556
- }
557
- }
558
- /**
559
- * Represents a big integer which is optimized for multiplication operations, as its power-of-twos
560
- * are memoized. See `multiplyBy()` for details on the multiplication algorithm.
561
- */
562
- class BigIntForMultiplication {
563
- constructor(value) {
564
- this.powerOfTwos = [value];
565
- }
566
- /**
567
- * Returns the big integer itself.
568
- */
569
- getValue() {
570
- return this.powerOfTwos[0];
571
- }
572
- /**
573
- * Computes the value for `num * b`, where `num` is a JS number and `b` is a big integer. The
574
- * value for `b` is represented by a storage model that is optimized for this computation.
575
- *
576
- * This operation is implemented in N(log2(num)) by continuous halving of the number, where the
577
- * least-significant bit (LSB) is tested in each iteration. If the bit is set, the bit's index is
578
- * used as exponent into the power-of-two multiplication of `b`.
579
- *
580
- * As an example, consider the multiplication num=42, b=1337. In binary 42 is 0b00101010 and the
581
- * algorithm unrolls into the following iterations:
582
- *
583
- * Iteration | num | LSB | b * 2^iter | Add? | product
584
- * -----------|------------|------|------------|------|--------
585
- * 0 | 0b00101010 | 0 | 1337 | No | 0
586
- * 1 | 0b00010101 | 1 | 2674 | Yes | 2674
587
- * 2 | 0b00001010 | 0 | 5348 | No | 2674
588
- * 3 | 0b00000101 | 1 | 10696 | Yes | 13370
589
- * 4 | 0b00000010 | 0 | 21392 | No | 13370
590
- * 5 | 0b00000001 | 1 | 42784 | Yes | 56154
591
- * 6 | 0b00000000 | 0 | 85568 | No | 56154
592
- *
593
- * The computed product of 56154 is indeed the correct result.
594
- *
595
- * The `BigIntForMultiplication` representation for a big integer provides memoized access to the
596
- * power-of-two values to reduce the workload in computing those values.
597
- */
598
- multiplyBy(num) {
599
- const product = BigInteger.zero();
600
- this.multiplyByAndAddTo(num, product);
601
- return product;
602
- }
603
- /**
604
- * See `multiplyBy()` for details. This function allows for the computed product to be added
605
- * directly to the provided result big integer.
606
- */
607
- multiplyByAndAddTo(num, result) {
608
- for (let exponent = 0; num !== 0; num = num >>> 1, exponent++) {
609
- if (num & 1) {
610
- const value = this.getMultipliedByPowerOfTwo(exponent);
611
- result.addToSelf(value);
612
- }
613
- }
614
- }
615
- /**
616
- * Computes and memoizes the big integer value for `this.number * 2^exponent`.
617
- */
618
- getMultipliedByPowerOfTwo(exponent) {
619
- // Compute the powers up until the requested exponent, where each value is computed from its
620
- // predecessor. This is simple as `this.number * 2^(exponent - 1)` only has to be doubled (i.e.
621
- // added to itself) to reach `this.number * 2^exponent`.
622
- for (let i = this.powerOfTwos.length; i <= exponent; i++) {
623
- const previousPower = this.powerOfTwos[i - 1];
624
- this.powerOfTwos[i] = previousPower.add(previousPower);
625
- }
626
- return this.powerOfTwos[exponent];
627
- }
628
- }
629
- /**
630
- * Represents an exponentiation operation for the provided base, of which exponents are computed and
631
- * memoized. The results are represented by a `BigIntForMultiplication` which is tailored for
632
- * multiplication operations by memoizing the power-of-twos. This effectively results in a matrix
633
- * representation that is lazily computed upon request.
634
- */
635
- class BigIntExponentiation {
636
- constructor(base) {
637
- this.base = base;
638
- this.exponents = [new BigIntForMultiplication(BigInteger.one())];
639
- }
640
- /**
641
- * Compute the value for `this.base^exponent`, resulting in a big integer that is optimized for
642
- * further multiplication operations.
643
- */
644
- toThePowerOf(exponent) {
645
- // Compute the results up until the requested exponent, where every value is computed from its
646
- // predecessor. This is because `this.base^(exponent - 1)` only has to be multiplied by `base`
647
- // to reach `this.base^exponent`.
648
- for (let i = this.exponents.length; i <= exponent; i++) {
649
- const value = this.exponents[i - 1].multiplyBy(this.base);
650
- this.exponents[i] = new BigIntForMultiplication(value);
651
- }
652
- return this.exponents[exponent];
653
- }
654
- }
655
-
656
483
  /**
657
484
  * A lazily created TextEncoder instance for converting strings into UTF-8 bytes
658
485
  */
@@ -815,17 +642,18 @@ function fingerprint(str) {
815
642
  hi = hi ^ 0x130f9bef;
816
643
  lo = lo ^ -0x6b5f56d8;
817
644
  }
818
- return [hi, lo];
645
+ return (BigInt.asUintN(32, BigInt(hi)) << BigInt(32)) | BigInt.asUintN(32, BigInt(lo));
819
646
  }
820
647
  function computeMsgId(msg, meaning = '') {
821
648
  let msgFingerprint = fingerprint(msg);
822
649
  if (meaning) {
823
- const meaningFingerprint = fingerprint(meaning);
824
- msgFingerprint = add64(rol64(msgFingerprint, 1), meaningFingerprint);
650
+ // Rotate the 64-bit message fingerprint one bit to the left and then add the meaning
651
+ // fingerprint.
652
+ msgFingerprint = BigInt.asUintN(64, msgFingerprint << BigInt(1)) |
653
+ ((msgFingerprint >> BigInt(63)) & BigInt(1));
654
+ msgFingerprint += fingerprint(meaning);
825
655
  }
826
- const hi = msgFingerprint[0];
827
- const lo = msgFingerprint[1];
828
- return wordsToDecimalString(hi & 0x7fffffff, lo);
656
+ return BigInt.asUintN(63, msgFingerprint).toString();
829
657
  }
830
658
  function hash32(view, length, c) {
831
659
  let a = 0x9e3779b9, b = 0x9e3779b9;
@@ -931,26 +759,10 @@ function add32to64(a, b) {
931
759
  const high = (a >>> 16) + (b >>> 16) + (low >>> 16);
932
760
  return [high >>> 16, (high << 16) | (low & 0xffff)];
933
761
  }
934
- function add64(a, b) {
935
- const ah = a[0], al = a[1];
936
- const bh = b[0], bl = b[1];
937
- const result = add32to64(al, bl);
938
- const carry = result[0];
939
- const l = result[1];
940
- const h = add32(add32(ah, bh), carry);
941
- return [h, l];
942
- }
943
762
  // Rotate a 32b number left `count` position
944
763
  function rol32(a, count) {
945
764
  return (a << count) | (a >>> (32 - count));
946
765
  }
947
- // Rotate a 64b number left `count` position
948
- function rol64(num, count) {
949
- const hi = num[0], lo = num[1];
950
- const h = (hi << count) | (lo >>> (32 - count));
951
- const l = (lo << count) | (hi >>> (32 - count));
952
- return [h, l];
953
- }
954
766
  function bytesToWords32(bytes, endian) {
955
767
  const size = (bytes.length + 3) >>> 2;
956
768
  const words32 = [];
@@ -976,31 +788,6 @@ function wordAt(bytes, index, endian) {
976
788
  }
977
789
  return word;
978
790
  }
979
- /**
980
- * Create a shared exponentiation pool for base-256 computations. This shared pool provides memoized
981
- * power-of-256 results with memoized power-of-two computations for efficient multiplication.
982
- *
983
- * For our purposes, this can be safely stored as a global without memory concerns. The reason is
984
- * that we encode two words, so only need the 0th (for the low word) and 4th (for the high word)
985
- * exponent.
986
- */
987
- const base256 = new BigIntExponentiation(256);
988
- /**
989
- * Represents two 32-bit words as a single decimal number. This requires a big integer storage
990
- * model as JS numbers are not accurate enough to represent the 64-bit number.
991
- *
992
- * Based on https://www.danvk.org/hex2dec.html
993
- */
994
- function wordsToDecimalString(hi, lo) {
995
- // Encode the four bytes in lo in the lower digits of the decimal number.
996
- // Note: the multiplication results in lo itself but represented by a big integer using its
997
- // decimal digits.
998
- const decimal = base256.toThePowerOf(0).multiplyBy(lo);
999
- // Encode the four bytes in hi above the four lo bytes. lo is a maximum of (2^8)^4, which is why
1000
- // this multiplication factor is applied.
1001
- base256.toThePowerOf(4).multiplyByAndAddTo(hi, decimal);
1002
- return decimal.toString();
1003
- }
1004
791
 
1005
792
  //// Types
1006
793
  var TypeModifier;
@@ -5803,13 +5590,13 @@ let policy;
5803
5590
  */
5804
5591
  function getPolicy() {
5805
5592
  if (policy === undefined) {
5593
+ const trustedTypes = _global['trustedTypes'];
5806
5594
  policy = null;
5807
- if (_global.trustedTypes) {
5595
+ if (trustedTypes) {
5808
5596
  try {
5809
- policy =
5810
- _global.trustedTypes.createPolicy('angular#unsafe-jit', {
5811
- createScript: (s) => s,
5812
- });
5597
+ policy = trustedTypes.createPolicy('angular#unsafe-jit', {
5598
+ createScript: (s) => s,
5599
+ });
5813
5600
  }
5814
5601
  catch {
5815
5602
  // trustedTypes.createPolicy throws if called with a name that is
@@ -5839,7 +5626,7 @@ function trustedScriptFromString(script) {
5839
5626
  * vulnerabilities.
5840
5627
  */
5841
5628
  function newTrustedFunctionForJIT(...args) {
5842
- if (!_global.trustedTypes) {
5629
+ if (!_global['trustedTypes']) {
5843
5630
  // In environments that don't support Trusted Types, fall back to the most
5844
5631
  // straightforward implementation:
5845
5632
  return new Function(...args);
@@ -10964,6 +10751,7 @@ function phaseAlignPipeVariadicVarOffset(job) {
10964
10751
  expr.varOffset = expr.args.varOffset;
10965
10752
  // Put the PureFunction vars following the PipeBindingVariadic vars.
10966
10753
  expr.args.varOffset = expr.varOffset + varsUsedByIrExpression(expr);
10754
+ return undefined;
10967
10755
  });
10968
10756
  }
10969
10757
  }
@@ -18057,7 +17845,7 @@ class _TreeBuilder {
18057
17845
  // This is unlikely to happen, but we have an assertion just in case.
18058
17846
  if (parent instanceof BlockGroup) {
18059
17847
  this.errors.push(TreeError.create(null, startSpan, 'Text cannot be placed directly inside of a block group.'));
18060
- return null;
17848
+ return;
18061
17849
  }
18062
17850
  if (parent != null && parent.children.length === 0 &&
18063
17851
  this.getTagDefinition(parent.name).ignoreFirstLf) {
@@ -19310,6 +19098,7 @@ function mergeNextContextsInOps(ops) {
19310
19098
  tryToMerge = false;
19311
19099
  break;
19312
19100
  }
19101
+ return;
19313
19102
  });
19314
19103
  }
19315
19104
  }
@@ -26967,11 +26756,11 @@ function createHostBindingsFunction(hostBindingsMetadata, typeSourceSpan, bindin
26967
26756
  // actually already handle these special attributes internally. Therefore, we just drop them
26968
26757
  // into the attributes map.
26969
26758
  if (hostBindingsMetadata.specialAttributes.styleAttr) {
26970
- hostBindingsMetadata.attributes.style =
26759
+ hostBindingsMetadata.attributes['style'] =
26971
26760
  literal(hostBindingsMetadata.specialAttributes.styleAttr);
26972
26761
  }
26973
26762
  if (hostBindingsMetadata.specialAttributes.classAttr) {
26974
- hostBindingsMetadata.attributes.class =
26763
+ hostBindingsMetadata.attributes['class'] =
26975
26764
  literal(hostBindingsMetadata.specialAttributes.classAttr);
26976
26765
  }
26977
26766
  const hostJob = ingestHostBinding({
@@ -27946,7 +27735,7 @@ function publishFacade(global) {
27946
27735
  * @description
27947
27736
  * Entry point for all public APIs of the compiler package.
27948
27737
  */
27949
- const VERSION = new Version('17.0.0-next.3');
27738
+ const VERSION = new Version('17.0.0-next.4');
27950
27739
 
27951
27740
  class CompilerConfig {
27952
27741
  constructor({ defaultEncapsulation = ViewEncapsulation.Emulated, useJit = true, missingTranslation = null, preserveWhitespaces, strictInjectionParameters } = {}) {
@@ -30104,7 +29893,7 @@ const MINIMUM_PARTIAL_LINKER_VERSION$6 = '12.0.0';
30104
29893
  function compileDeclareClassMetadata(metadata) {
30105
29894
  const definitionMap = new DefinitionMap();
30106
29895
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$6));
30107
- definitionMap.set('version', literal('17.0.0-next.3'));
29896
+ definitionMap.set('version', literal('17.0.0-next.4'));
30108
29897
  definitionMap.set('ngImport', importExpr(Identifiers.core));
30109
29898
  definitionMap.set('type', metadata.type);
30110
29899
  definitionMap.set('decorators', metadata.decorators);
@@ -30212,7 +30001,7 @@ function createDirectiveDefinitionMap(meta) {
30212
30001
  // in 16.1 is actually used.
30213
30002
  const minVersion = hasTransformFunctions ? MINIMUM_PARTIAL_LINKER_VERSION$5 : '14.0.0';
30214
30003
  definitionMap.set('minVersion', literal(minVersion));
30215
- definitionMap.set('version', literal('17.0.0-next.3'));
30004
+ definitionMap.set('version', literal('17.0.0-next.4'));
30216
30005
  // e.g. `type: MyDirective`
30217
30006
  definitionMap.set('type', meta.type.value);
30218
30007
  if (meta.isStandalone) {
@@ -30443,7 +30232,7 @@ const MINIMUM_PARTIAL_LINKER_VERSION$4 = '12.0.0';
30443
30232
  function compileDeclareFactoryFunction(meta) {
30444
30233
  const definitionMap = new DefinitionMap();
30445
30234
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$4));
30446
- definitionMap.set('version', literal('17.0.0-next.3'));
30235
+ definitionMap.set('version', literal('17.0.0-next.4'));
30447
30236
  definitionMap.set('ngImport', importExpr(Identifiers.core));
30448
30237
  definitionMap.set('type', meta.type.value);
30449
30238
  definitionMap.set('deps', compileDependencies(meta.deps));
@@ -30478,7 +30267,7 @@ function compileDeclareInjectableFromMetadata(meta) {
30478
30267
  function createInjectableDefinitionMap(meta) {
30479
30268
  const definitionMap = new DefinitionMap();
30480
30269
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$3));
30481
- definitionMap.set('version', literal('17.0.0-next.3'));
30270
+ definitionMap.set('version', literal('17.0.0-next.4'));
30482
30271
  definitionMap.set('ngImport', importExpr(Identifiers.core));
30483
30272
  definitionMap.set('type', meta.type.value);
30484
30273
  // Only generate providedIn property if it has a non-null value
@@ -30529,7 +30318,7 @@ function compileDeclareInjectorFromMetadata(meta) {
30529
30318
  function createInjectorDefinitionMap(meta) {
30530
30319
  const definitionMap = new DefinitionMap();
30531
30320
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$2));
30532
- definitionMap.set('version', literal('17.0.0-next.3'));
30321
+ definitionMap.set('version', literal('17.0.0-next.4'));
30533
30322
  definitionMap.set('ngImport', importExpr(Identifiers.core));
30534
30323
  definitionMap.set('type', meta.type.value);
30535
30324
  definitionMap.set('providers', meta.providers);
@@ -30562,7 +30351,7 @@ function createNgModuleDefinitionMap(meta) {
30562
30351
  throw new Error('Invalid path! Local compilation mode should not get into the partial compilation path');
30563
30352
  }
30564
30353
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$1));
30565
- definitionMap.set('version', literal('17.0.0-next.3'));
30354
+ definitionMap.set('version', literal('17.0.0-next.4'));
30566
30355
  definitionMap.set('ngImport', importExpr(Identifiers.core));
30567
30356
  definitionMap.set('type', meta.type.value);
30568
30357
  // We only generate the keys in the metadata if the arrays contain values.
@@ -30613,7 +30402,7 @@ function compileDeclarePipeFromMetadata(meta) {
30613
30402
  function createPipeDefinitionMap(meta) {
30614
30403
  const definitionMap = new DefinitionMap();
30615
30404
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION));
30616
- definitionMap.set('version', literal('17.0.0-next.3'));
30405
+ definitionMap.set('version', literal('17.0.0-next.4'));
30617
30406
  definitionMap.set('ngImport', importExpr(Identifiers.core));
30618
30407
  // e.g. `type: MyPipe`
30619
30408
  definitionMap.set('type', meta.type.value);