jscrewit 2.32.0 → 2.33.0

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/lib/jscrewit.js CHANGED
@@ -1,4 +1,4 @@
1
- // JScrewIt 2.32.0 – https://jscrew.it
1
+ // JScrewIt 2.33.0 – https://jscrew.it
2
2
 
3
3
  (function () {
4
4
  'use strict';
@@ -394,10 +394,12 @@
394
394
  _Object_defineProperty(target, name_1, descriptor);
395
395
  }
396
396
  }
397
- function createFeatureClass(featureInfos) {
397
+ function createFeatureClass(featureInfos, formatEngineDescription) {
398
398
  var ALL = createMap();
399
399
  var DESCRIPTION_MAP = createMap();
400
400
  var ELEMENTARY = [];
401
+ var ENGINE = [];
402
+ var FAMILIES = createMap();
401
403
  var FEATURE_PROTOTYPE = Feature.prototype;
402
404
  var INCOMPATIBLE_MASK_LIST = [];
403
405
  var PRISTINE_ELEMENTARY;
@@ -487,14 +489,9 @@
487
489
  featureObj = null;
488
490
  return featureObj;
489
491
  }
490
- function createFeature(name, mask, check, engine, attributes, elementary) {
492
+ function createFeature(name, mask, check, attributes, elementary) {
491
493
  _Object_freeze(attributes);
492
- var descriptors = {
493
- attributes: { value: attributes },
494
- check: { value: check },
495
- engine: { value: engine },
496
- name: { value: name },
497
- };
494
+ var descriptors = { attributes: { value: attributes }, check: { value: check }, name: { value: name } };
498
495
  if (elementary)
499
496
  descriptors.elementary = { value: true };
500
497
  var featureObj = _Object_create(FEATURE_PROTOTYPE, descriptors);
@@ -546,14 +543,9 @@
546
543
  if (this.check)
547
544
  parts.push('(check)');
548
545
  {
549
- var container = {};
550
- var _c = this, attributes = _c.attributes, engine = _c.engine;
551
- if (engine !== undefined)
552
- container.engine = engine;
553
- if (attributes !== undefined)
554
- container.attributes = __assign({}, attributes);
555
- if (_Object_keys(container).length) {
556
- var str_1 = utilInspect(container, opts);
546
+ var attributes = this.attributes;
547
+ if (typeof attributes === 'object') {
548
+ var str_1 = utilInspect(__assign({}, attributes), opts);
557
549
  parts.push(str_1);
558
550
  }
559
551
  }
@@ -652,6 +644,9 @@
652
644
  assignNoEnum(FEATURE_PROTOTYPE, protoSource);
653
645
  }
654
646
  (function () {
647
+ var compareFeatureNames = function (feature1, feature2) {
648
+ return feature1.name < feature2.name ? -1 : 1;
649
+ };
655
650
  function completeExclusions() {
656
651
  var incompatibleMaskSet = new MaskSet();
657
652
  for (var _i = 0, featureNames_1 = featureNames; _i < featureNames_1.length; _i++) {
@@ -695,6 +690,7 @@
695
690
  if (inherits != null)
696
691
  completeFeature(inherits);
697
692
  var wrappedCheck = void 0;
693
+ var compatibilities = void 0;
698
694
  var check = info_1.check;
699
695
  if (check !== undefined) {
700
696
  mask = maskNext(unionMask);
@@ -736,7 +732,37 @@
736
732
  mask = maskUnion(mask, includeMask);
737
733
  }
738
734
  }
739
- var engine = getInfoStringField('engine');
735
+ if ('versions' in info_1) {
736
+ var families = info_1.families;
737
+ var versions_1 = info_1.versions;
738
+ if (inherits != null)
739
+ families !== null && families !== void 0 ? families : (families = familiesMap[inherits]);
740
+ familiesMap[name] = families;
741
+ var tag_1 = getInfoStringField('compatibilityTag');
742
+ var shortTag_1 = getInfoStringField('compatibilityShortTag');
743
+ compatibilities =
744
+ families.map(function (family, index) {
745
+ var _a;
746
+ family = esToString(family);
747
+ var versionInfo = versions_1[index];
748
+ var version;
749
+ if (_Array_isArray(versionInfo)) {
750
+ var length_1 = versionInfo.length;
751
+ var from = esToString(versionInfo[0]);
752
+ var to = length_1 < 2 ? undefined : esToString(versionInfo[length_1 - 1]);
753
+ var dense = versionInfo.length === 2;
754
+ version = _Object_freeze({ from: from, to: to, dense: dense });
755
+ }
756
+ else
757
+ version = esToString(versionInfo);
758
+ var compatibility = _Object_freeze({ family: family, featureName: name, version: version, tag: tag_1, shortTag: shortTag_1 });
759
+ var familyCompatibilities = (_a = FAMILIES[family]) !== null && _a !== void 0 ? _a : (FAMILIES[family] = []);
760
+ familyCompatibilities.push(compatibility);
761
+ return compatibility;
762
+ });
763
+ if (description == null)
764
+ description = formatEngineDescription === null || formatEngineDescription === void 0 ? void 0 : formatEngineDescription(compatibilities);
765
+ }
740
766
  var attributes = createMap();
741
767
  if (inherits != null) {
742
768
  var inheritedAttributes = ALL[inherits].attributes;
@@ -760,10 +786,11 @@
760
786
  }
761
787
  }
762
788
  var elementary = wrappedCheck !== null && wrappedCheck !== void 0 ? wrappedCheck : info_1.excludes;
763
- featureObj =
764
- createFeature(name, mask, wrappedCheck, engine, attributes, elementary);
789
+ featureObj = createFeature(name, mask, wrappedCheck, attributes, elementary);
765
790
  if (elementary)
766
791
  ELEMENTARY.push(featureObj);
792
+ if (compatibilities)
793
+ ENGINE.push(featureObj);
767
794
  }
768
795
  ALL[name] = featureObj;
769
796
  DESCRIPTION_MAP[name] = description;
@@ -774,6 +801,8 @@
774
801
  var constructorSource = {
775
802
  ALL: ALL,
776
803
  ELEMENTARY: ELEMENTARY,
804
+ ENGINE: ENGINE,
805
+ FAMILIES: FAMILIES,
777
806
  _fromMask: _fromMask,
778
807
  _getMask: _getMask,
779
808
  areCompatible: areCompatible,
@@ -791,13 +820,19 @@
791
820
  }
792
821
  var featureNames = _Object_keys(featureInfos);
793
822
  var includeSetMap = createMap();
823
+ var familiesMap = createMap();
794
824
  var unionMask = maskNew();
795
825
  featureNames.forEach(completeFeature);
796
826
  completeExclusions();
797
827
  PRISTINE_ELEMENTARY = ELEMENTARY.slice();
798
- ELEMENTARY.sort(function (feature1, feature2) { return feature1.name < feature2.name ? -1 : 1; });
828
+ ELEMENTARY.sort(compareFeatureNames);
799
829
  _Object_freeze(ELEMENTARY);
830
+ ENGINE.sort(compareFeatureNames);
831
+ _Object_freeze(ENGINE);
800
832
  _Object_freeze(ALL);
833
+ _Object_freeze(FAMILIES);
834
+ for (var family in FAMILIES)
835
+ _Object_freeze(FAMILIES[family]);
801
836
  })();
802
837
  return Feature;
803
838
  }
@@ -875,6 +910,12 @@
875
910
  return available;
876
911
  }
877
912
 
913
+ function describeEngine(engine)
914
+ {
915
+ var description = 'Features available in ' + engine + '.';
916
+ return description;
917
+ }
918
+
878
919
  function isExcludingAttribute(restrictionCache, restrictionName, featureObjs)
879
920
  {
880
921
  var returnValue = restrictionCache[restrictionName];
@@ -1710,7 +1751,8 @@
1710
1751
  },
1711
1752
  ANDRO_4_0:
1712
1753
  {
1713
- engine: 'Android Browser 4.0',
1754
+ families: ['Android Browser'],
1755
+ versions: ['4.0'],
1714
1756
  includes:
1715
1757
  [
1716
1758
  'ATOB',
@@ -1730,14 +1772,14 @@
1730
1772
  },
1731
1773
  ANDRO_4_1:
1732
1774
  {
1733
- engine: 'Android Browser 4.1 to 4.3',
1734
1775
  inherits: 'ANDRO_4_0',
1776
+ versions: [['4.1',, '4.3']],
1735
1777
  includes: { GENERIC_ARRAY_TO_STRING: true, OBJECT_UNDEFINED: true },
1736
1778
  },
1737
1779
  ANDRO_4_4:
1738
1780
  {
1739
- engine: 'Android Browser 4.4',
1740
1781
  inherits: 'ANDRO_4_1',
1782
+ versions: ['4.4'],
1741
1783
  includes:
1742
1784
  {
1743
1785
  BARPROP: true,
@@ -1753,17 +1795,18 @@
1753
1795
  },
1754
1796
  CHROME_PREV:
1755
1797
  {
1756
- engine: 'the previous to current versions of Chrome and Edge',
1798
+ description: describeEngine('the previous to current versions of Chrome and Edge'),
1757
1799
  aliasFor: 'CHROME_92',
1758
1800
  },
1759
1801
  CHROME:
1760
1802
  {
1761
- engine: 'the current stable versions of Chrome, Edge and Opera',
1803
+ description: describeEngine('the current stable versions of Chrome, Edge and Opera'),
1762
1804
  aliasFor: 'CHROME_92',
1763
1805
  },
1764
1806
  CHROME_92:
1765
1807
  {
1766
- engine: 'Chrome 92, Edge 92 and Opera 78 or later',
1808
+ families: ['Chrome', 'Edge', 'Opera'],
1809
+ versions: [['92'], ['92'], ['78']],
1767
1810
  includes:
1768
1811
  [
1769
1812
  'ARROW',
@@ -1799,12 +1842,13 @@
1799
1842
  },
1800
1843
  FF_ESR:
1801
1844
  {
1802
- engine: 'the current version of Firefox ESR',
1845
+ description: describeEngine('the current version of Firefox ESR'),
1803
1846
  aliasFor: 'FF_78',
1804
1847
  },
1805
1848
  FF_78:
1806
1849
  {
1807
- engine: 'Firefox 78 to 82',
1850
+ families: ['Firefox'],
1851
+ versions: [['78',, '82']],
1808
1852
  includes:
1809
1853
  [
1810
1854
  'ARROW',
@@ -1838,31 +1882,32 @@
1838
1882
  attributes:
1839
1883
  { 'char-increment-restriction': null, 'unstable': null, 'web-worker-restriction': null },
1840
1884
  },
1841
- FF_PREV:
1842
- {
1843
- engine: 'the previous to current version of Firefox',
1844
- aliasFor: 'FF_83',
1845
- },
1846
1885
  FF_83:
1847
1886
  {
1848
- engine: 'Firefox 83 to 89',
1849
1887
  inherits: 'FF_78',
1888
+ versions: [['83',, '89']],
1850
1889
  includes: { INTL: true, PLAIN_INTL: false },
1851
1890
  },
1891
+ FF_PREV:
1892
+ {
1893
+ description: describeEngine('the previous to current version of Firefox'),
1894
+ aliasFor: 'FF_90',
1895
+ },
1852
1896
  FF:
1853
1897
  {
1854
- engine: 'the current stable version of Firefox',
1898
+ description: describeEngine('the current stable version of Firefox'),
1855
1899
  aliasFor: 'FF_90',
1856
1900
  },
1857
1901
  FF_90:
1858
1902
  {
1859
- engine: 'Firefox 90 or later',
1860
1903
  inherits: 'FF_83',
1904
+ versions: [['90']],
1861
1905
  includes: { AT: true },
1862
1906
  },
1863
1907
  IE_9:
1864
1908
  {
1865
- engine: 'Internet Explorer 9',
1909
+ families: ['Internet Explorer'],
1910
+ versions: ['9'],
1866
1911
  includes:
1867
1912
  [
1868
1913
  'CAPITAL_HTML',
@@ -1883,15 +1928,15 @@
1883
1928
  },
1884
1929
  IE_10:
1885
1930
  {
1886
- engine: 'Internet Explorer 10',
1887
1931
  inherits: 'IE_9',
1932
+ versions: ['10'],
1888
1933
  includes: { ATOB: true, CONSOLE: true, OBJECT_UNDEFINED: true, UNDEFINED: false },
1889
1934
  attributes: { 'char-increment-restriction': null, 'web-worker-restriction': null },
1890
1935
  },
1891
1936
  IE_11:
1892
1937
  {
1893
- engine: 'Internet Explorer 11',
1894
1938
  inherits: 'IE_10',
1939
+ versions: ['11'],
1895
1940
  includes:
1896
1941
  {
1897
1942
  DOCUMENT: false,
@@ -1904,13 +1949,16 @@
1904
1949
  },
1905
1950
  IE_11_WIN_10:
1906
1951
  {
1907
- engine: 'Internet Explorer 11 on Windows 10',
1908
1952
  inherits: 'IE_11',
1953
+ versions: ['11'],
1954
+ compatibilityTag: 'on Windows 10',
1955
+ compatibilityShortTag: 'W10',
1909
1956
  includes: { LOCALE_INFINITY: true, LOCALE_NUMERALS: false, LOCALE_NUMERALS_EXT: true },
1910
1957
  },
1911
1958
  NODE_0_10:
1912
1959
  {
1913
- engine: 'Node.js 0.10',
1960
+ families: ['Node.js'],
1961
+ versions: ['0.10'],
1914
1962
  includes:
1915
1963
  [
1916
1964
  'ESC_HTML_ALL',
@@ -1925,8 +1973,8 @@
1925
1973
  },
1926
1974
  NODE_0_12:
1927
1975
  {
1928
- engine: 'Node.js 0.12',
1929
1976
  inherits: 'NODE_0_10',
1977
+ versions: ['0.12'],
1930
1978
  includes:
1931
1979
  {
1932
1980
  ESC_HTML_ALL: false,
@@ -1938,61 +1986,62 @@
1938
1986
  },
1939
1987
  NODE_4:
1940
1988
  {
1941
- engine: 'Node.js 4',
1942
1989
  inherits: 'NODE_0_12',
1990
+ versions: ['4'],
1943
1991
  includes: { ARROW: true, ESC_REGEXP_SLASH: true, FILL: true, FROM_CODE_POINT: true },
1944
1992
  },
1945
1993
  NODE_5:
1946
1994
  {
1947
- engine: 'Node.js 5 to 9',
1948
1995
  inherits: 'NODE_4',
1996
+ versions: [['5',, '9']],
1949
1997
  attributes: { 'char-increment-restriction': null },
1950
1998
  },
1951
1999
  NODE_10:
1952
2000
  {
1953
- engine: 'Node.js 10',
1954
2001
  inherits: 'NODE_5',
2002
+ versions: ['10'],
1955
2003
  includes: { FUNCTION_19_LF: true, FUNCTION_22_LF: false },
1956
2004
  },
1957
2005
  NODE_11:
1958
2006
  {
1959
- engine: 'Node.js 11',
1960
2007
  inherits: 'NODE_10',
2008
+ versions: ['11'],
1961
2009
  includes: { FLAT: true },
1962
2010
  },
1963
2011
  NODE_12:
1964
2012
  {
1965
- engine: 'Node.js 12',
1966
2013
  inherits: 'NODE_11',
2014
+ versions: ['12'],
1967
2015
  includes: { ESC_REGEXP_LF: true, REGEXP_STRING_ITERATOR: true },
1968
2016
  },
1969
2017
  NODE_13:
1970
2018
  {
1971
- engine: 'Node.js 13 and Node.js 14',
1972
2019
  inherits: 'NODE_12',
2020
+ versions: [['13', '14']],
1973
2021
  includes: { LOCALE_NUMERALS_EXT: true, SHORT_LOCALES: true },
1974
2022
  },
1975
2023
  NODE_15:
1976
2024
  {
1977
- engine: 'Node.js 15',
1978
2025
  inherits: 'NODE_13',
2026
+ versions: ['15'],
1979
2027
  includes: { INTL: true, PLAIN_INTL: false },
1980
2028
  },
1981
2029
  NODE_16_0:
1982
2030
  {
1983
- engine: 'Node.js 16.0 to 16.5',
1984
2031
  inherits: 'NODE_15',
2032
+ versions: [['16.0',, '16.5']],
1985
2033
  includes: { ATOB: true },
1986
2034
  },
1987
2035
  NODE_16_6:
1988
2036
  {
1989
- engine: 'Node.js 16.6 or later',
1990
2037
  inherits: 'NODE_16_0',
2038
+ versions: [['16.6']],
1991
2039
  includes: { AT: true },
1992
2040
  },
1993
2041
  SAFARI_7_0:
1994
2042
  {
1995
- engine: 'Safari 7.0',
2043
+ families: ['Safari'],
2044
+ versions: ['7.0'],
1996
2045
  includes:
1997
2046
  [
1998
2047
  'ATOB',
@@ -2027,16 +2076,15 @@
2027
2076
  },
2028
2077
  SAFARI_7_1:
2029
2078
  {
2030
- engine: 'Safari 7.1 and Safari 8',
2031
2079
  inherits: 'SAFARI_7_0',
2080
+ versions: [['7.1', '8']],
2032
2081
  includes: { ARRAY_ITERATOR: true, FILL: true },
2033
2082
  attributes: { 'no-console-in-web-worker': undefined, 'safari-bug-21820506': null },
2034
2083
  },
2035
- SAFARI_8: { aliasFor: 'SAFARI_7_1' },
2036
2084
  SAFARI_9:
2037
2085
  {
2038
- engine: 'Safari 9',
2039
2086
  inherits: 'SAFARI_7_1',
2087
+ versions: ['9'],
2040
2088
  includes:
2041
2089
  {
2042
2090
  ARRAY_ITERATOR: false,
@@ -2047,8 +2095,8 @@
2047
2095
  },
2048
2096
  SAFARI_10:
2049
2097
  {
2050
- engine: 'Safari 10 and Safari 11',
2051
2098
  inherits: 'SAFARI_9',
2099
+ versions: [['10', '11']],
2052
2100
  includes:
2053
2101
  {
2054
2102
  ARROW: true,
@@ -2065,36 +2113,70 @@
2065
2113
  },
2066
2114
  SAFARI_12:
2067
2115
  {
2068
- engine: 'Safari 12',
2069
2116
  inherits: 'SAFARI_10',
2117
+ versions: ['12'],
2070
2118
  includes: { FLAT: true },
2071
2119
  },
2072
2120
  SAFARI_13:
2073
2121
  {
2074
- engine: 'Safari 13 and Safari 14.0.0',
2075
2122
  inherits: 'SAFARI_12',
2123
+ versions: [['13', '14.0.0']],
2076
2124
  includes: { REGEXP_STRING_ITERATOR: true },
2077
2125
  },
2078
2126
  SAFARI_14_0_1:
2079
2127
  {
2080
- engine: 'Safari 14.0.1 to 14.0.3',
2081
2128
  inherits: 'SAFARI_13',
2129
+ versions: [['14.0.1',, '14.0.3']],
2082
2130
  includes: { INTL: true, PLAIN_INTL: false },
2083
2131
  },
2084
2132
  SAFARI:
2085
2133
  {
2086
- engine: 'the current stable version of Safari',
2134
+ description: describeEngine('the current stable version of Safari'),
2087
2135
  aliasFor: 'SAFARI_14_1',
2088
2136
  },
2089
2137
  SAFARI_14_1:
2090
2138
  {
2091
- engine: 'Safari 14.1 or later',
2092
2139
  inherits: 'SAFARI_14_0_1',
2140
+ versions: [['14.1']],
2093
2141
  includes: { CONSOLE: false },
2094
2142
  },
2095
2143
  };
2096
2144
  (function ()
2097
2145
  {
2146
+ function formatEngineDescription(compatibilities)
2147
+ {
2148
+ var appendix = '';
2149
+ var parts =
2150
+ compatibilities.map
2151
+ (
2152
+ function (compatibility)
2153
+ {
2154
+ var family = compatibility.family;
2155
+ var version = compatibility.version;
2156
+ var part = family;
2157
+ if (typeof version === 'string')
2158
+ part += ' ' + version;
2159
+ else
2160
+ {
2161
+ part += ' ' + version.from;
2162
+ var to = version.to;
2163
+ if (to != null)
2164
+ part += (version.dense ? ' and ' + family + ' ' : ' to ') + to;
2165
+ else
2166
+ appendix = ' or later';
2167
+ }
2168
+ var tag = compatibility.tag;
2169
+ if (tag != null)
2170
+ part += ' ' + tag;
2171
+ return part;
2172
+ }
2173
+ );
2174
+ var lastPart = parts.pop();
2175
+ var engine = (parts.length ? parts.join(', ') + ' and ' + lastPart : lastPart) + appendix;
2176
+ var description = describeEngine(engine);
2177
+ return description;
2178
+ }
2179
+
2098
2180
  var autoIncludes =
2099
2181
  _Object_keys$1(featureInfos).filter
2100
2182
  (
@@ -2108,23 +2190,10 @@
2108
2190
  );
2109
2191
  featureInfos.AUTO =
2110
2192
  {
2111
- engine: 'the current environment',
2193
+ description: describeEngine('the current environment'),
2112
2194
  includes: autoIncludes,
2113
2195
  };
2114
- _Object_keys$1(featureInfos).forEach
2115
- (
2116
- function (featureName)
2117
- {
2118
- var featureInfo = featureInfos[featureName];
2119
- var engine = featureInfo.engine;
2120
- if (engine != null)
2121
- {
2122
- var description = 'Features available in ' + engine + '.';
2123
- featureInfo.description = description;
2124
- }
2125
- }
2126
- );
2127
- Feature = createFeatureClass(featureInfos);
2196
+ Feature = createFeatureClass(featureInfos, formatEngineDescription);
2128
2197
  ELEMENTARY = Feature.ELEMENTARY;
2129
2198
  featureInfos = null;
2130
2199
  assignNoEnum$1(Feature.prototype, { restrict: restrict });