@loaders.gl/polyfills 4.0.0-alpha.4 → 4.0.0-alpha.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (208) hide show
  1. package/dist/bundle.d.ts +2 -0
  2. package/dist/bundle.d.ts.map +1 -0
  3. package/dist/bundle.js +2 -2
  4. package/dist/dist.min.js +4207 -0
  5. package/dist/es5/bundle.js +6 -0
  6. package/dist/es5/bundle.js.map +1 -0
  7. package/dist/es5/index.js +103 -0
  8. package/dist/es5/index.js.map +1 -0
  9. package/dist/es5/lib/encoding-indexes.js +37 -0
  10. package/dist/es5/lib/encoding-indexes.js.map +1 -0
  11. package/dist/es5/lib/encoding.js +1214 -0
  12. package/dist/es5/lib/encoding.js.map +1 -0
  13. package/{src/libs/encoding-indexes.js → dist/es5/libs/encoding-indexes-asian.js} +2 -40
  14. package/dist/es5/node/buffer/btoa.node.js +14 -0
  15. package/dist/es5/node/buffer/btoa.node.js.map +1 -0
  16. package/dist/es5/node/buffer/to-array-buffer.node.js +14 -0
  17. package/dist/es5/node/buffer/to-array-buffer.node.js.map +1 -0
  18. package/dist/es5/node/fetch/fetch-file.node.js +83 -0
  19. package/dist/es5/node/fetch/fetch-file.node.js.map +1 -0
  20. package/dist/es5/node/fetch/fetch.node.js +194 -0
  21. package/dist/es5/node/fetch/fetch.node.js.map +1 -0
  22. package/dist/es5/node/fetch/headers.node.js +151 -0
  23. package/dist/es5/node/fetch/headers.node.js.map +1 -0
  24. package/dist/es5/node/fetch/response.node.js +182 -0
  25. package/dist/es5/node/fetch/response.node.js.map +1 -0
  26. package/dist/es5/node/fetch/utils/decode-data-uri.node.js +58 -0
  27. package/dist/es5/node/fetch/utils/decode-data-uri.node.js.map +1 -0
  28. package/dist/es5/node/fetch/utils/stream-utils.node.js +92 -0
  29. package/dist/es5/node/fetch/utils/stream-utils.node.js.map +1 -0
  30. package/dist/es5/node/file/blob-stream-controller.js +90 -0
  31. package/dist/es5/node/file/blob-stream-controller.js.map +1 -0
  32. package/dist/es5/node/file/blob-stream.js +64 -0
  33. package/dist/es5/node/file/blob-stream.js.map +1 -0
  34. package/dist/es5/node/file/blob.js +212 -0
  35. package/dist/es5/node/file/blob.js.map +1 -0
  36. package/dist/es5/node/file/file-reader.js +153 -0
  37. package/dist/es5/node/file/file-reader.js.map +1 -0
  38. package/dist/es5/node/file/file.js +44 -0
  39. package/dist/es5/node/file/file.js.map +1 -0
  40. package/dist/es5/node/file/install-file-polyfills.js +25 -0
  41. package/dist/es5/node/file/install-file-polyfills.js.map +1 -0
  42. package/dist/es5/node/file/readable-stream.js +27 -0
  43. package/dist/es5/node/file/readable-stream.js.map +1 -0
  44. package/dist/es5/node/images/encode-image.node.js +30 -0
  45. package/dist/es5/node/images/encode-image.node.js.map +1 -0
  46. package/dist/es5/node/images/parse-image.node.js +64 -0
  47. package/dist/es5/node/images/parse-image.node.js.map +1 -0
  48. package/dist/es5/promise/all-settled.js +28 -0
  49. package/dist/es5/promise/all-settled.js.map +1 -0
  50. package/dist/es5/utils/assert.js +12 -0
  51. package/dist/es5/utils/assert.js.map +1 -0
  52. package/dist/es5/utils/globals.js +18 -0
  53. package/dist/es5/utils/globals.js.map +1 -0
  54. package/dist/esm/bundle.js +4 -0
  55. package/dist/esm/bundle.js.map +1 -0
  56. package/dist/esm/index.js +54 -0
  57. package/dist/esm/index.js.map +1 -0
  58. package/dist/esm/lib/encoding-indexes.js +30 -0
  59. package/dist/esm/lib/encoding-indexes.js.map +1 -0
  60. package/dist/esm/lib/encoding.js +1206 -0
  61. package/dist/esm/lib/encoding.js.map +1 -0
  62. package/dist/{libs/encoding-indexes.js → esm/libs/encoding-indexes-asian.js} +2 -40
  63. package/dist/esm/node/buffer/btoa.node.js +7 -0
  64. package/dist/esm/node/buffer/btoa.node.js.map +1 -0
  65. package/dist/esm/node/buffer/to-array-buffer.node.js +8 -0
  66. package/dist/esm/node/buffer/to-array-buffer.node.js.map +1 -0
  67. package/dist/esm/node/fetch/fetch-file.node.js +50 -0
  68. package/dist/esm/node/fetch/fetch-file.node.js.map +1 -0
  69. package/dist/esm/node/fetch/fetch.node.js +126 -0
  70. package/dist/esm/node/fetch/fetch.node.js.map +1 -0
  71. package/dist/esm/node/fetch/headers.node.js +102 -0
  72. package/dist/esm/node/fetch/headers.node.js.map +1 -0
  73. package/dist/esm/node/fetch/response.node.js +67 -0
  74. package/dist/esm/node/fetch/response.node.js.map +1 -0
  75. package/dist/esm/node/fetch/utils/decode-data-uri.node.js +45 -0
  76. package/dist/esm/node/fetch/utils/decode-data-uri.node.js.map +1 -0
  77. package/dist/esm/node/fetch/utils/stream-utils.node.js +43 -0
  78. package/dist/esm/node/fetch/utils/stream-utils.node.js.map +1 -0
  79. package/dist/esm/node/file/blob-stream-controller.js +44 -0
  80. package/dist/esm/node/file/blob-stream-controller.js.map +1 -0
  81. package/dist/esm/node/file/blob-stream.js +20 -0
  82. package/dist/esm/node/file/blob-stream.js.map +1 -0
  83. package/dist/esm/node/file/blob.js +120 -0
  84. package/dist/esm/node/file/blob.js.map +1 -0
  85. package/dist/esm/node/file/file-reader.js +60 -0
  86. package/dist/esm/node/file/file-reader.js.map +1 -0
  87. package/dist/esm/node/file/file.js +19 -0
  88. package/dist/esm/node/file/file.js.map +1 -0
  89. package/dist/esm/node/file/install-file-polyfills.js +19 -0
  90. package/dist/esm/node/file/install-file-polyfills.js.map +1 -0
  91. package/dist/esm/node/file/readable-stream.js +4 -0
  92. package/dist/esm/node/file/readable-stream.js.map +1 -0
  93. package/dist/esm/node/images/encode-image.node.js +20 -0
  94. package/dist/esm/node/images/encode-image.node.js.map +1 -0
  95. package/dist/esm/node/images/parse-image.node.js +29 -0
  96. package/dist/esm/node/images/parse-image.node.js.map +1 -0
  97. package/dist/esm/promise/all-settled.js +19 -0
  98. package/dist/esm/promise/all-settled.js.map +1 -0
  99. package/dist/esm/utils/assert.js +6 -0
  100. package/dist/esm/utils/assert.js.map +1 -0
  101. package/dist/esm/utils/globals.js +9 -0
  102. package/dist/esm/utils/globals.js.map +1 -0
  103. package/dist/index.d.ts +8 -0
  104. package/dist/index.d.ts.map +1 -0
  105. package/dist/index.js +90 -49
  106. package/dist/lib/encoding-indexes.d.ts +31 -0
  107. package/dist/lib/encoding-indexes.d.ts.map +1 -0
  108. package/dist/lib/encoding-indexes.js +35 -0
  109. package/dist/lib/encoding.d.ts +15 -0
  110. package/dist/lib/encoding.d.ts.map +1 -0
  111. package/dist/lib/encoding.js +2779 -0
  112. package/dist/libs/encoding-indexes-asian.d.ts +10 -0
  113. package/dist/libs/encoding-indexes-asian.d.ts.map +1 -0
  114. package/dist/libs/encoding-indexes-asian.js +14 -0
  115. package/dist/node/buffer/btoa.node.d.ts +3 -0
  116. package/dist/node/buffer/btoa.node.d.ts.map +1 -0
  117. package/dist/node/buffer/btoa.node.js +12 -5
  118. package/dist/node/buffer/to-array-buffer.node.d.ts +2 -0
  119. package/dist/node/buffer/to-array-buffer.node.d.ts.map +1 -0
  120. package/dist/node/buffer/to-array-buffer.node.js +11 -8
  121. package/dist/node/fetch/fetch-file.node.d.ts +4 -0
  122. package/dist/node/fetch/fetch-file.node.d.ts.map +1 -0
  123. package/dist/node/fetch/fetch-file.node.js +51 -0
  124. package/dist/node/fetch/fetch.node.d.ts +12 -0
  125. package/dist/node/fetch/fetch.node.d.ts.map +1 -0
  126. package/dist/node/fetch/fetch.node.js +128 -111
  127. package/dist/node/fetch/headers.node.d.ts +34 -0
  128. package/dist/node/fetch/headers.node.d.ts.map +1 -0
  129. package/dist/node/fetch/headers.node.js +95 -114
  130. package/dist/node/fetch/response.node.d.ts +22 -0
  131. package/dist/node/fetch/response.node.d.ts.map +1 -0
  132. package/dist/node/fetch/response.node.js +72 -84
  133. package/dist/node/fetch/utils/decode-data-uri.node.d.ts +16 -0
  134. package/dist/node/fetch/utils/decode-data-uri.node.d.ts.map +1 -0
  135. package/dist/node/fetch/utils/decode-data-uri.node.js +63 -55
  136. package/dist/node/fetch/utils/stream-utils.node.d.ts +17 -0
  137. package/dist/node/fetch/utils/stream-utils.node.d.ts.map +1 -0
  138. package/dist/node/fetch/utils/stream-utils.node.js +69 -85
  139. package/dist/node/file/blob-stream-controller.d.ts +29 -0
  140. package/dist/node/file/blob-stream-controller.d.ts.map +1 -0
  141. package/dist/node/file/blob-stream-controller.js +59 -52
  142. package/dist/node/file/blob-stream.d.ts +25 -0
  143. package/dist/node/file/blob-stream.d.ts.map +1 -0
  144. package/dist/node/file/blob-stream.js +36 -25
  145. package/dist/node/file/blob.d.ts +58 -0
  146. package/dist/node/file/blob.d.ts.map +1 -0
  147. package/dist/node/file/blob.js +151 -131
  148. package/dist/node/file/file-reader.d.ts +24 -0
  149. package/dist/node/file/file-reader.d.ts.map +1 -0
  150. package/dist/node/file/file-reader.js +28 -77
  151. package/dist/node/file/file.d.ts +25 -0
  152. package/dist/node/file/file.d.ts.map +1 -0
  153. package/dist/node/file/file.js +36 -25
  154. package/dist/node/file/install-file-polyfills.d.ts +2 -0
  155. package/dist/node/file/install-file-polyfills.d.ts.map +1 -0
  156. package/dist/node/file/install-file-polyfills.js +26 -21
  157. package/dist/node/file/readable-stream.d.ts +4 -0
  158. package/dist/node/file/readable-stream.d.ts.map +1 -0
  159. package/dist/node/file/readable-stream.js +10 -3
  160. package/dist/node/images/encode-image.node.d.ts +20 -0
  161. package/dist/node/images/encode-image.node.d.ts.map +1 -0
  162. package/dist/node/images/encode-image.node.js +38 -17
  163. package/dist/node/images/parse-image.node.d.ts +13 -0
  164. package/dist/node/images/parse-image.node.d.ts.map +1 -0
  165. package/dist/node/images/parse-image.node.js +40 -19
  166. package/dist/promise/all-settled.d.ts +10 -0
  167. package/dist/promise/all-settled.d.ts.map +1 -0
  168. package/dist/promise/all-settled.js +22 -17
  169. package/dist/utils/assert.d.ts +2 -0
  170. package/dist/utils/assert.d.ts.map +1 -0
  171. package/dist/utils/assert.js +8 -5
  172. package/dist/utils/globals.d.ts +4 -0
  173. package/dist/utils/globals.d.ts.map +1 -0
  174. package/dist/utils/globals.js +34 -7
  175. package/package.json +9 -8
  176. package/src/index.ts +9 -6
  177. package/src/lib/encoding-indexes.ts +34 -0
  178. package/src/{libs/encoding.js → lib/encoding.ts} +78 -78
  179. package/src/libs/encoding-indexes-asian.js +13 -0
  180. package/src/node/fetch/fetch-file.node.ts +51 -0
  181. package/src/node/fetch/fetch.node.ts +64 -30
  182. package/src/node/fetch/headers.node.ts +1 -1
  183. package/src/node/fetch/response.node.ts +4 -2
  184. package/src/node/fetch/utils/decode-data-uri.node.ts +7 -6
  185. package/src/node/fetch/utils/stream-utils.node.ts +39 -64
  186. package/src/node/images/parse-image.node.ts +35 -20
  187. package/dist/bundle.js.map +0 -1
  188. package/dist/index.js.map +0 -1
  189. package/dist/libs/encoding.js +0 -3084
  190. package/dist/node/buffer/btoa.node.js.map +0 -1
  191. package/dist/node/buffer/to-array-buffer.node.js.map +0 -1
  192. package/dist/node/fetch/fetch.node.js.map +0 -1
  193. package/dist/node/fetch/headers.node.js.map +0 -1
  194. package/dist/node/fetch/response.node.js.map +0 -1
  195. package/dist/node/fetch/utils/decode-data-uri.node.js.map +0 -1
  196. package/dist/node/fetch/utils/stream-utils.node.js.map +0 -1
  197. package/dist/node/file/blob-stream-controller.js.map +0 -1
  198. package/dist/node/file/blob-stream.js.map +0 -1
  199. package/dist/node/file/blob.js.map +0 -1
  200. package/dist/node/file/file-reader.js.map +0 -1
  201. package/dist/node/file/file.js.map +0 -1
  202. package/dist/node/file/install-file-polyfills.js.map +0 -1
  203. package/dist/node/file/readable-stream.js.map +0 -1
  204. package/dist/node/images/encode-image.node.js.map +0 -1
  205. package/dist/node/images/parse-image.node.js.map +0 -1
  206. package/dist/promise/all-settled.js.map +0 -1
  207. package/dist/utils/assert.js.map +0 -1
  208. package/dist/utils/globals.js.map +0 -1
package/src/index.ts CHANGED
@@ -1,25 +1,27 @@
1
1
  /* eslint-disable dot-notation */
2
- import {DOMParser} from 'xmldom';
2
+ import {DOMParser} from '@xmldom/xmldom';
3
3
  import {isBrowser, global} from './utils/globals';
4
4
 
5
- import {TextDecoder, TextEncoder} from './libs/encoding';
5
+ import {TextDecoder, TextEncoder} from './lib/encoding';
6
6
  import {allSettled} from './promise/all-settled';
7
7
 
8
8
  // Node specific
9
9
  import * as base64 from './node/buffer/btoa.node';
10
10
 
11
- import HeadersNode from './node/fetch/headers.node';
12
- import ResponseNode from './node/fetch/response.node';
13
- import fetchNode from './node/fetch/fetch.node';
11
+ import {Headers as HeadersNode} from './node/fetch/headers.node';
12
+ import {Response as ResponseNode} from './node/fetch/response.node';
13
+ import {fetchNode as fetchNode} from './node/fetch/fetch.node';
14
14
 
15
15
  import {encodeImageNode} from './node/images/encode-image.node';
16
- import {parseImageNode} from './node/images/parse-image.node';
16
+ import {parseImageNode, NODE_FORMAT_SUPPORT} from './node/images/parse-image.node';
17
17
 
18
18
  export {ReadableStreamPolyfill} from './node/file/readable-stream';
19
19
  export {BlobPolyfill} from './node/file/blob';
20
20
  export {FileReaderPolyfill} from './node/file/file-reader';
21
21
  export {FilePolyfill} from './node/file/file';
22
22
  export {installFilePolyfills} from './node/file/install-file-polyfills';
23
+ export {fetchNode as _fetchNode} from './node/fetch/fetch.node';
24
+ export {fetchFileNode as _fetchFileNode} from './node/fetch/fetch-file.node';
23
25
 
24
26
  // POLYFILLS: TextEncoder, TextDecoder
25
27
  // - Recent Node versions have these classes but virtually no encodings unless special build.
@@ -80,6 +82,7 @@ if (!isBrowser && !('_encodeImageNode' in global) && encodeImageNode) {
80
82
 
81
83
  if (!isBrowser && !('_parseImageNode' in global) && parseImageNode) {
82
84
  global['_parseImageNode'] = parseImageNode;
85
+ global['_imageFormatsNode'] = NODE_FORMAT_SUPPORT;
83
86
  }
84
87
 
85
88
  if (!('allSettled' in Promise)) {
@@ -0,0 +1,34 @@
1
+ /* eslint-disable */
2
+ // Copied from https://github.com/inexorabletash/text-encoding/blob/b4e5bc26e26e51f56e3daa9f13138c79f49d3c34/lib/encoding-indexes.js
3
+ // License: Public domain https://github.com/inexorabletash/text-encoding/blob/b4e5bc26e26e51f56e3daa9f13138c79f49d3c34/LICENSE.md
4
+
5
+ // prettier-ignore
6
+ export default {
7
+ "ibm866":[1040,1041,1042,1043,1044,1045,1046,1047,1048,1049,1050,1051,1052,1053,1054,1055,1056,1057,1058,1059,1060,1061,1062,1063,1064,1065,1066,1067,1068,1069,1070,1071,1072,1073,1074,1075,1076,1077,1078,1079,1080,1081,1082,1083,1084,1085,1086,1087,9617,9618,9619,9474,9508,9569,9570,9558,9557,9571,9553,9559,9565,9564,9563,9488,9492,9524,9516,9500,9472,9532,9566,9567,9562,9556,9577,9574,9568,9552,9580,9575,9576,9572,9573,9561,9560,9554,9555,9579,9578,9496,9484,9608,9604,9612,9616,9600,1088,1089,1090,1091,1092,1093,1094,1095,1096,1097,1098,1099,1100,1101,1102,1103,1025,1105,1028,1108,1031,1111,1038,1118,176,8729,183,8730,8470,164,9632,160],
8
+ "iso-8859-2":[128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,260,728,321,164,317,346,167,168,352,350,356,377,173,381,379,176,261,731,322,180,318,347,711,184,353,351,357,378,733,382,380,340,193,194,258,196,313,262,199,268,201,280,203,282,205,206,270,272,323,327,211,212,336,214,215,344,366,218,368,220,221,354,223,341,225,226,259,228,314,263,231,269,233,281,235,283,237,238,271,273,324,328,243,244,337,246,247,345,367,250,369,252,253,355,729],
9
+ "iso-8859-3":[128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,294,728,163,164,null,292,167,168,304,350,286,308,173,null,379,176,295,178,179,180,181,293,183,184,305,351,287,309,189,null,380,192,193,194,null,196,266,264,199,200,201,202,203,204,205,206,207,null,209,210,211,212,288,214,215,284,217,218,219,220,364,348,223,224,225,226,null,228,267,265,231,232,233,234,235,236,237,238,239,null,241,242,243,244,289,246,247,285,249,250,251,252,365,349,729],
10
+ "iso-8859-4":[128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,260,312,342,164,296,315,167,168,352,274,290,358,173,381,175,176,261,731,343,180,297,316,711,184,353,275,291,359,330,382,331,256,193,194,195,196,197,198,302,268,201,280,203,278,205,206,298,272,325,332,310,212,213,214,215,216,370,218,219,220,360,362,223,257,225,226,227,228,229,230,303,269,233,281,235,279,237,238,299,273,326,333,311,244,245,246,247,248,371,250,251,252,361,363,729],
11
+ "iso-8859-5":[128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,1025,1026,1027,1028,1029,1030,1031,1032,1033,1034,1035,1036,173,1038,1039,1040,1041,1042,1043,1044,1045,1046,1047,1048,1049,1050,1051,1052,1053,1054,1055,1056,1057,1058,1059,1060,1061,1062,1063,1064,1065,1066,1067,1068,1069,1070,1071,1072,1073,1074,1075,1076,1077,1078,1079,1080,1081,1082,1083,1084,1085,1086,1087,1088,1089,1090,1091,1092,1093,1094,1095,1096,1097,1098,1099,1100,1101,1102,1103,8470,1105,1106,1107,1108,1109,1110,1111,1112,1113,1114,1115,1116,167,1118,1119],
12
+ "iso-8859-6":[128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,null,null,null,164,null,null,null,null,null,null,null,1548,173,null,null,null,null,null,null,null,null,null,null,null,null,null,1563,null,null,null,1567,null,1569,1570,1571,1572,1573,1574,1575,1576,1577,1578,1579,1580,1581,1582,1583,1584,1585,1586,1587,1588,1589,1590,1591,1592,1593,1594,null,null,null,null,null,1600,1601,1602,1603,1604,1605,1606,1607,1608,1609,1610,1611,1612,1613,1614,1615,1616,1617,1618,null,null,null,null,null,null,null,null,null,null,null,null,null],
13
+ "iso-8859-7":[128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,8216,8217,163,8364,8367,166,167,168,169,890,171,172,173,null,8213,176,177,178,179,900,901,902,183,904,905,906,187,908,189,910,911,912,913,914,915,916,917,918,919,920,921,922,923,924,925,926,927,928,929,null,931,932,933,934,935,936,937,938,939,940,941,942,943,944,945,946,947,948,949,950,951,952,953,954,955,956,957,958,959,960,961,962,963,964,965,966,967,968,969,970,971,972,973,974,null],
14
+ "iso-8859-8":[128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,null,162,163,164,165,166,167,168,169,215,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,247,187,188,189,190,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,8215,1488,1489,1490,1491,1492,1493,1494,1495,1496,1497,1498,1499,1500,1501,1502,1503,1504,1505,1506,1507,1508,1509,1510,1511,1512,1513,1514,null,null,8206,8207,null],
15
+ "iso-8859-10":[128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,260,274,290,298,296,310,167,315,272,352,358,381,173,362,330,176,261,275,291,299,297,311,183,316,273,353,359,382,8213,363,331,256,193,194,195,196,197,198,302,268,201,280,203,278,205,206,207,208,325,332,211,212,213,214,360,216,370,218,219,220,221,222,223,257,225,226,227,228,229,230,303,269,233,281,235,279,237,238,239,240,326,333,243,244,245,246,361,248,371,250,251,252,253,254,312],
16
+ "iso-8859-13":[128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,8221,162,163,164,8222,166,167,216,169,342,171,172,173,174,198,176,177,178,179,8220,181,182,183,248,185,343,187,188,189,190,230,260,302,256,262,196,197,280,274,268,201,377,278,290,310,298,315,352,323,325,211,332,213,214,215,370,321,346,362,220,379,381,223,261,303,257,263,228,229,281,275,269,233,378,279,291,311,299,316,353,324,326,243,333,245,246,247,371,322,347,363,252,380,382,8217],
17
+ "iso-8859-14":[128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,7682,7683,163,266,267,7690,167,7808,169,7810,7691,7922,173,174,376,7710,7711,288,289,7744,7745,182,7766,7809,7767,7811,7776,7923,7812,7813,7777,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,372,209,210,211,212,213,214,7786,216,217,218,219,220,221,374,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,373,241,242,243,244,245,246,7787,248,249,250,251,252,253,375,255],
18
+ "iso-8859-15":[128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,8364,165,352,167,353,169,170,171,172,173,174,175,176,177,178,179,381,181,182,183,382,185,186,187,338,339,376,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255],
19
+ "iso-8859-16":[128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,260,261,321,8364,8222,352,167,353,169,536,171,377,173,378,379,176,177,268,322,381,8221,182,183,382,269,537,187,338,339,376,380,192,193,194,258,196,262,198,199,200,201,202,203,204,205,206,207,272,323,210,211,212,336,214,346,368,217,218,219,220,280,538,223,224,225,226,259,228,263,230,231,232,233,234,235,236,237,238,239,273,324,242,243,244,337,246,347,369,249,250,251,252,281,539,255],
20
+ "koi8-r":[9472,9474,9484,9488,9492,9496,9500,9508,9516,9524,9532,9600,9604,9608,9612,9616,9617,9618,9619,8992,9632,8729,8730,8776,8804,8805,160,8993,176,178,183,247,9552,9553,9554,1105,9555,9556,9557,9558,9559,9560,9561,9562,9563,9564,9565,9566,9567,9568,9569,1025,9570,9571,9572,9573,9574,9575,9576,9577,9578,9579,9580,169,1102,1072,1073,1094,1076,1077,1092,1075,1093,1080,1081,1082,1083,1084,1085,1086,1087,1103,1088,1089,1090,1091,1078,1074,1100,1099,1079,1096,1101,1097,1095,1098,1070,1040,1041,1062,1044,1045,1060,1043,1061,1048,1049,1050,1051,1052,1053,1054,1055,1071,1056,1057,1058,1059,1046,1042,1068,1067,1047,1064,1069,1065,1063,1066],
21
+ "koi8-u":[9472,9474,9484,9488,9492,9496,9500,9508,9516,9524,9532,9600,9604,9608,9612,9616,9617,9618,9619,8992,9632,8729,8730,8776,8804,8805,160,8993,176,178,183,247,9552,9553,9554,1105,1108,9556,1110,1111,9559,9560,9561,9562,9563,1169,1118,9566,9567,9568,9569,1025,1028,9571,1030,1031,9574,9575,9576,9577,9578,1168,1038,169,1102,1072,1073,1094,1076,1077,1092,1075,1093,1080,1081,1082,1083,1084,1085,1086,1087,1103,1088,1089,1090,1091,1078,1074,1100,1099,1079,1096,1101,1097,1095,1098,1070,1040,1041,1062,1044,1045,1060,1043,1061,1048,1049,1050,1051,1052,1053,1054,1055,1071,1056,1057,1058,1059,1046,1042,1068,1067,1047,1064,1069,1065,1063,1066],
22
+ "macintosh":[196,197,199,201,209,214,220,225,224,226,228,227,229,231,233,232,234,235,237,236,238,239,241,243,242,244,246,245,250,249,251,252,8224,176,162,163,167,8226,182,223,174,169,8482,180,168,8800,198,216,8734,177,8804,8805,165,181,8706,8721,8719,960,8747,170,186,937,230,248,191,161,172,8730,402,8776,8710,171,187,8230,160,192,195,213,338,339,8211,8212,8220,8221,8216,8217,247,9674,255,376,8260,8364,8249,8250,64257,64258,8225,183,8218,8222,8240,194,202,193,203,200,205,206,207,204,211,212,63743,210,218,219,217,305,710,732,175,728,729,730,184,733,731,711],
23
+ "windows-874":[8364,129,130,131,132,8230,134,135,136,137,138,139,140,141,142,143,144,8216,8217,8220,8221,8226,8211,8212,152,153,154,155,156,157,158,159,160,3585,3586,3587,3588,3589,3590,3591,3592,3593,3594,3595,3596,3597,3598,3599,3600,3601,3602,3603,3604,3605,3606,3607,3608,3609,3610,3611,3612,3613,3614,3615,3616,3617,3618,3619,3620,3621,3622,3623,3624,3625,3626,3627,3628,3629,3630,3631,3632,3633,3634,3635,3636,3637,3638,3639,3640,3641,3642,null,null,null,null,3647,3648,3649,3650,3651,3652,3653,3654,3655,3656,3657,3658,3659,3660,3661,3662,3663,3664,3665,3666,3667,3668,3669,3670,3671,3672,3673,3674,3675,null,null,null,null],
24
+ "windows-1250":[8364,129,8218,131,8222,8230,8224,8225,136,8240,352,8249,346,356,381,377,144,8216,8217,8220,8221,8226,8211,8212,152,8482,353,8250,347,357,382,378,160,711,728,321,164,260,166,167,168,169,350,171,172,173,174,379,176,177,731,322,180,181,182,183,184,261,351,187,317,733,318,380,340,193,194,258,196,313,262,199,268,201,280,203,282,205,206,270,272,323,327,211,212,336,214,215,344,366,218,368,220,221,354,223,341,225,226,259,228,314,263,231,269,233,281,235,283,237,238,271,273,324,328,243,244,337,246,247,345,367,250,369,252,253,355,729],
25
+ "windows-1251":[1026,1027,8218,1107,8222,8230,8224,8225,8364,8240,1033,8249,1034,1036,1035,1039,1106,8216,8217,8220,8221,8226,8211,8212,152,8482,1113,8250,1114,1116,1115,1119,160,1038,1118,1032,164,1168,166,167,1025,169,1028,171,172,173,174,1031,176,177,1030,1110,1169,181,182,183,1105,8470,1108,187,1112,1029,1109,1111,1040,1041,1042,1043,1044,1045,1046,1047,1048,1049,1050,1051,1052,1053,1054,1055,1056,1057,1058,1059,1060,1061,1062,1063,1064,1065,1066,1067,1068,1069,1070,1071,1072,1073,1074,1075,1076,1077,1078,1079,1080,1081,1082,1083,1084,1085,1086,1087,1088,1089,1090,1091,1092,1093,1094,1095,1096,1097,1098,1099,1100,1101,1102,1103],
26
+ "windows-1252":[8364,129,8218,402,8222,8230,8224,8225,710,8240,352,8249,338,141,381,143,144,8216,8217,8220,8221,8226,8211,8212,732,8482,353,8250,339,157,382,376,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255],
27
+ "windows-1253":[8364,129,8218,402,8222,8230,8224,8225,136,8240,138,8249,140,141,142,143,144,8216,8217,8220,8221,8226,8211,8212,152,8482,154,8250,156,157,158,159,160,901,902,163,164,165,166,167,168,169,null,171,172,173,174,8213,176,177,178,179,900,181,182,183,904,905,906,187,908,189,910,911,912,913,914,915,916,917,918,919,920,921,922,923,924,925,926,927,928,929,null,931,932,933,934,935,936,937,938,939,940,941,942,943,944,945,946,947,948,949,950,951,952,953,954,955,956,957,958,959,960,961,962,963,964,965,966,967,968,969,970,971,972,973,974,null],
28
+ "windows-1254":[8364,129,8218,402,8222,8230,8224,8225,710,8240,352,8249,338,141,142,143,144,8216,8217,8220,8221,8226,8211,8212,732,8482,353,8250,339,157,158,376,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,286,209,210,211,212,213,214,215,216,217,218,219,220,304,350,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,287,241,242,243,244,245,246,247,248,249,250,251,252,305,351,255],
29
+ "windows-1255":[8364,129,8218,402,8222,8230,8224,8225,710,8240,138,8249,140,141,142,143,144,8216,8217,8220,8221,8226,8211,8212,732,8482,154,8250,156,157,158,159,160,161,162,163,8362,165,166,167,168,169,215,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,247,187,188,189,190,191,1456,1457,1458,1459,1460,1461,1462,1463,1464,1465,1466,1467,1468,1469,1470,1471,1472,1473,1474,1475,1520,1521,1522,1523,1524,null,null,null,null,null,null,null,1488,1489,1490,1491,1492,1493,1494,1495,1496,1497,1498,1499,1500,1501,1502,1503,1504,1505,1506,1507,1508,1509,1510,1511,1512,1513,1514,null,null,8206,8207,null],
30
+ "windows-1256":[8364,1662,8218,402,8222,8230,8224,8225,710,8240,1657,8249,338,1670,1688,1672,1711,8216,8217,8220,8221,8226,8211,8212,1705,8482,1681,8250,339,8204,8205,1722,160,1548,162,163,164,165,166,167,168,169,1726,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,1563,187,188,189,190,1567,1729,1569,1570,1571,1572,1573,1574,1575,1576,1577,1578,1579,1580,1581,1582,1583,1584,1585,1586,1587,1588,1589,1590,215,1591,1592,1593,1594,1600,1601,1602,1603,224,1604,226,1605,1606,1607,1608,231,232,233,234,235,1609,1610,238,239,1611,1612,1613,1614,244,1615,1616,247,1617,249,1618,251,252,8206,8207,1746],
31
+ "windows-1257":[8364,129,8218,131,8222,8230,8224,8225,136,8240,138,8249,140,168,711,184,144,8216,8217,8220,8221,8226,8211,8212,152,8482,154,8250,156,175,731,159,160,null,162,163,164,null,166,167,216,169,342,171,172,173,174,198,176,177,178,179,180,181,182,183,248,185,343,187,188,189,190,230,260,302,256,262,196,197,280,274,268,201,377,278,290,310,298,315,352,323,325,211,332,213,214,215,370,321,346,362,220,379,381,223,261,303,257,263,228,229,281,275,269,233,378,279,291,311,299,316,353,324,326,243,333,245,246,247,371,322,347,363,252,380,382,729],
32
+ "windows-1258":[8364,129,8218,402,8222,8230,8224,8225,710,8240,138,8249,338,141,142,143,144,8216,8217,8220,8221,8226,8211,8212,732,8482,154,8250,339,157,158,376,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,258,196,197,198,199,200,201,202,203,768,205,206,207,272,209,777,211,212,416,214,215,216,217,218,219,220,431,771,223,224,225,226,259,228,229,230,231,232,233,234,235,769,237,238,239,273,241,803,243,244,417,246,247,248,249,250,251,252,432,8363,255],
33
+ "x-mac-cyrillic":[1040,1041,1042,1043,1044,1045,1046,1047,1048,1049,1050,1051,1052,1053,1054,1055,1056,1057,1058,1059,1060,1061,1062,1063,1064,1065,1066,1067,1068,1069,1070,1071,8224,176,1168,163,167,8226,182,1030,174,169,8482,1026,1106,8800,1027,1107,8734,177,8804,8805,1110,181,1169,1032,1028,1108,1031,1111,1033,1113,1034,1114,1112,1029,172,8730,402,8776,8710,171,187,8230,160,1035,1115,1036,1116,1109,8211,8212,8220,8221,8216,8217,247,8222,1038,1118,1039,1119,8470,1025,1105,1103,1072,1073,1074,1075,1076,1077,1078,1079,1080,1081,1082,1083,1084,1085,1086,1087,1088,1089,1090,1091,1092,1093,1094,1095,1096,1097,1098,1099,1100,1101,1102,8364]
34
+ };
@@ -1,14 +1,14 @@
1
- /* eslint-disable */
2
1
  // @ts-nocheck
2
+ /* eslint-disable */
3
3
 
4
4
  // Copied from https://github.com/inexorabletash/text-encoding/blob/b4e5bc26e26e51f56e3daa9f13138c79f49d3c34/lib/encoding.js
5
- //
6
5
  // This is free and unencumbered software released into the public domain.
7
6
  // See LICENSE.md for more information.
8
7
 
9
- // FORK: indices add half a megabyte to bundle. Ignore, since we only want the built-in UTF8...
10
- const indexes = require('./encoding-indexes.js')
11
- global['encoding-indexes'] = (indexes && indexes['encoding-indexes']) || {};
8
+ import indexes from './encoding-indexes';
9
+ // Note: Aaian character indices add half a megabyte to bundle. Ignore, since we really only want the built-in UTF8...
10
+ // import indexes from './encoding-indexes-asian.js';
11
+ global['encoding-indexes'] = indexes || {};
12
12
 
13
13
  //
14
14
  // Utilities
@@ -193,7 +193,7 @@ Stream.prototype = {
193
193
  /**
194
194
  * @return {boolean} True if end-of-stream has been hit.
195
195
  */
196
- endOfStream: function() {
196
+ endOfStream: function () {
197
197
  return !this.tokens.length;
198
198
  },
199
199
 
@@ -205,7 +205,7 @@ Stream.prototype = {
205
205
  * @return {number} Get the next token from the stream, or
206
206
  * end_of_stream.
207
207
  */
208
- read: function() {
208
+ read: function () {
209
209
  if (!this.tokens.length) return end_of_stream;
210
210
  return this.tokens.pop();
211
211
  },
@@ -218,9 +218,9 @@ Stream.prototype = {
218
218
  * @param {(number|!Array.<number>)} token The token(s) to prepend to the
219
219
  * stream.
220
220
  */
221
- prepend: function(token) {
221
+ prepend: function (token) {
222
222
  if (Array.isArray(token)) {
223
- var tokens = /**@type {!Array.<number>}*/ (token);
223
+ var tokens = /**@type {!Array.<number>}*/ token;
224
224
  while (tokens.length) this.tokens.push(tokens.pop());
225
225
  } else {
226
226
  this.tokens.push(token);
@@ -235,9 +235,9 @@ Stream.prototype = {
235
235
  * @param {(number|!Array.<number>)} token The tokens(s) to push to the
236
236
  * stream.
237
237
  */
238
- push: function(token) {
238
+ push: function (token) {
239
239
  if (Array.isArray(token)) {
240
- var tokens = /**@type {!Array.<number>}*/ (token);
240
+ var tokens = /**@type {!Array.<number>}*/ token;
241
241
  while (tokens.length) this.tokens.unshift(tokens.shift());
242
242
  } else {
243
243
  this.tokens.unshift(token);
@@ -282,7 +282,7 @@ Decoder.prototype = {
282
282
  * decoded, or null if not enough data exists in the input
283
283
  * stream to decode a complete code point, or |finished|.
284
284
  */
285
- handler: function(stream, bite) {}
285
+ handler: function (stream, bite) {}
286
286
  };
287
287
 
288
288
  /** @interface */
@@ -293,7 +293,7 @@ Encoder.prototype = {
293
293
  * @param {number} code_point Next code point read from the stream.
294
294
  * @return {(number|!Array.<number>)} Byte(s) to emit, or |finished|.
295
295
  */
296
- handler: function(stream, code_point) {}
296
+ handler: function (stream, code_point) {}
297
297
  };
298
298
 
299
299
  // 5.2 Names and labels
@@ -307,9 +307,7 @@ Encoder.prototype = {
307
307
  */
308
308
  function getEncoding(label) {
309
309
  // 1. Remove any leading and trailing ASCII whitespace from label.
310
- label = String(label)
311
- .trim()
312
- .toLowerCase();
310
+ label = String(label).trim().toLowerCase();
313
311
 
314
312
  // 2. If label is an ASCII case-insensitive match for any of the
315
313
  // labels listed in the table below, return the corresponding
@@ -677,9 +675,9 @@ var encodings = [
677
675
  // Label to encoding registry.
678
676
  /** @type {Object.<string,{name:string,labels:Array.<string>}>} */
679
677
  var label_to_encoding = {};
680
- encodings.forEach(function(category) {
681
- category.encodings.forEach(function(encoding) {
682
- encoding.labels.forEach(function(label) {
678
+ encodings.forEach(function (category) {
679
+ category.encodings.forEach(function (encoding) {
680
+ encoding.labels.forEach(function (label) {
683
681
  label_to_encoding[label] = encoding;
684
682
  });
685
683
  });
@@ -807,7 +805,7 @@ function indexShiftJISPointerFor(code_point) {
807
805
  // pointer is in the range 8272 to 8835, inclusive.
808
806
  shift_jis_index =
809
807
  shift_jis_index ||
810
- index('jis0208').map(function(code_point, pointer) {
808
+ index('jis0208').map(function (code_point, pointer) {
811
809
  return inRange(pointer, 8272, 8835) ? null : code_point;
812
810
  });
813
811
  var index_ = shift_jis_index;
@@ -827,7 +825,7 @@ function indexBig5PointerFor(code_point) {
827
825
  // 1. Let index be index Big5 excluding all entries whose pointer
828
826
  big5_index_no_hkscs =
829
827
  big5_index_no_hkscs ||
830
- index('big5').map(function(code_point, pointer) {
828
+ index('big5').map(function (code_point, pointer) {
831
829
  return pointer < (0xa1 - 0x81) * 157 ? null : code_point;
832
830
  });
833
831
  var index_ = big5_index_no_hkscs;
@@ -930,7 +928,7 @@ if (Object.defineProperty) {
930
928
  // The encoding attribute's getter must return encoding's name.
931
929
  Object.defineProperty(TextDecoder.prototype, 'encoding', {
932
930
  /** @this {TextDecoder} */
933
- get: function() {
931
+ get: function () {
934
932
  return this._encoding.name.toLowerCase();
935
933
  }
936
934
  });
@@ -939,7 +937,7 @@ if (Object.defineProperty) {
939
937
  // is fatal, and false otherwise.
940
938
  Object.defineProperty(TextDecoder.prototype, 'fatal', {
941
939
  /** @this {TextDecoder} */
942
- get: function() {
940
+ get: function () {
943
941
  return this._error_mode === 'fatal';
944
942
  }
945
943
  });
@@ -948,7 +946,7 @@ if (Object.defineProperty) {
948
946
  // BOM flag is set, and false otherwise.
949
947
  Object.defineProperty(TextDecoder.prototype, 'ignoreBOM', {
950
948
  /** @this {TextDecoder} */
951
- get: function() {
949
+ get: function () {
952
950
  return this._ignoreBOM;
953
951
  }
954
952
  });
@@ -1019,7 +1017,7 @@ TextDecoder.prototype.decode = function decode(input, options) {
1019
1017
  if (result === finished) break;
1020
1018
 
1021
1019
  if (result !== null) {
1022
- if (Array.isArray(result)) output.push.apply(output, /**@type {!Array.<number>}*/ (result));
1020
+ if (Array.isArray(result)) output.push.apply(output, /**@type {!Array.<number>}*/ result);
1023
1021
  else output.push(result);
1024
1022
  }
1025
1023
 
@@ -1034,7 +1032,7 @@ TextDecoder.prototype.decode = function decode(input, options) {
1034
1032
  result = this._decoder.handler(input_stream, input_stream.read());
1035
1033
  if (result === finished) break;
1036
1034
  if (result === null) continue;
1037
- if (Array.isArray(result)) output.push.apply(output, /**@type {!Array.<number>}*/ (result));
1035
+ if (Array.isArray(result)) output.push.apply(output, /**@type {!Array.<number>}*/ result);
1038
1036
  else output.push(result);
1039
1037
  } while (!input_stream.endOfStream());
1040
1038
  this._decoder = null;
@@ -1139,7 +1137,7 @@ if (Object.defineProperty) {
1139
1137
  // The encoding attribute's getter must return encoding's name.
1140
1138
  Object.defineProperty(TextEncoder.prototype, 'encoding', {
1141
1139
  /** @this {TextEncoder} */
1142
- get: function() {
1140
+ get: function () {
1143
1141
  return this._encoding.name.toLowerCase();
1144
1142
  }
1145
1143
  });
@@ -1180,7 +1178,7 @@ TextEncoder.prototype.encode = function encode(opt_string, options) {
1180
1178
  // input, output.
1181
1179
  result = this._encoder.handler(input, token);
1182
1180
  if (result === finished) break;
1183
- if (Array.isArray(result)) output.push.apply(output, /**@type {!Array.<number>}*/ (result));
1181
+ if (Array.isArray(result)) output.push.apply(output, /**@type {!Array.<number>}*/ result);
1184
1182
  else output.push(result);
1185
1183
  }
1186
1184
  // TODO: Align with spec algorithm.
@@ -1188,7 +1186,7 @@ TextEncoder.prototype.encode = function encode(opt_string, options) {
1188
1186
  while (true) {
1189
1187
  result = this._encoder.handler(input, input.read());
1190
1188
  if (result === finished) break;
1191
- if (Array.isArray(result)) output.push.apply(output, /**@type {!Array.<number>}*/ (result));
1189
+ if (Array.isArray(result)) output.push.apply(output, /**@type {!Array.<number>}*/ result);
1192
1190
  else output.push(result);
1193
1191
  }
1194
1192
  this._encoder = null;
@@ -1231,7 +1229,7 @@ function UTF8Decoder(options) {
1231
1229
  * decoded, or null if not enough data exists in the input
1232
1230
  * stream to decode a complete code point.
1233
1231
  */
1234
- this.handler = function(stream, bite) {
1232
+ this.handler = function (stream, bite) {
1235
1233
  // 1. If byte is end-of-stream and utf-8 bytes needed is not 0,
1236
1234
  // set utf-8 bytes needed to 0 and return error.
1237
1235
  if (bite === end_of_stream && utf8_bytes_needed !== 0) {
@@ -1351,7 +1349,7 @@ function UTF8Encoder(options) {
1351
1349
  * @param {number} code_point Next code point read from the stream.
1352
1350
  * @return {(number|!Array.<number>)} Byte(s) to emit.
1353
1351
  */
1354
- this.handler = function(stream, code_point) {
1352
+ this.handler = function (stream, code_point) {
1355
1353
  // 1. If code point is end-of-stream, return finished.
1356
1354
  if (code_point === end_of_stream) return finished;
1357
1355
 
@@ -1402,11 +1400,11 @@ function UTF8Encoder(options) {
1402
1400
  }
1403
1401
 
1404
1402
  /** @param {{fatal: boolean}} options */
1405
- encoders['UTF-8'] = function(options) {
1403
+ encoders['UTF-8'] = function (options) {
1406
1404
  return new UTF8Encoder(options);
1407
1405
  };
1408
1406
  /** @param {{fatal: boolean}} options */
1409
- decoders['UTF-8'] = function(options) {
1407
+ decoders['UTF-8'] = function (options) {
1410
1408
  return new UTF8Decoder(options);
1411
1409
  };
1412
1410
 
@@ -1430,7 +1428,7 @@ function SingleByteDecoder(index, options) {
1430
1428
  * decoded, or null if not enough data exists in the input
1431
1429
  * stream to decode a complete code point.
1432
1430
  */
1433
- this.handler = function(stream, bite) {
1431
+ this.handler = function (stream, bite) {
1434
1432
  // 1. If byte is end-of-stream, return finished.
1435
1433
  if (bite === end_of_stream) return finished;
1436
1434
 
@@ -1464,7 +1462,7 @@ function SingleByteEncoder(index, options) {
1464
1462
  * @param {number} code_point Next code point read from the stream.
1465
1463
  * @return {(number|!Array.<number>)} Byte(s) to emit.
1466
1464
  */
1467
- this.handler = function(stream, code_point) {
1465
+ this.handler = function (stream, code_point) {
1468
1466
  // 1. If code point is end-of-stream, return finished.
1469
1467
  if (code_point === end_of_stream) return finished;
1470
1468
 
@@ -1484,19 +1482,19 @@ function SingleByteEncoder(index, options) {
1484
1482
  };
1485
1483
  }
1486
1484
 
1487
- (function() {
1485
+ (function () {
1488
1486
  if (!('encoding-indexes' in global)) return;
1489
- encodings.forEach(function(category) {
1487
+ encodings.forEach(function (category) {
1490
1488
  if (category.heading !== 'Legacy single-byte encodings') return;
1491
- category.encodings.forEach(function(encoding) {
1489
+ category.encodings.forEach(function (encoding) {
1492
1490
  var name = encoding.name;
1493
1491
  var idx = index(name.toLowerCase());
1494
1492
  /** @param {{fatal: boolean}} options */
1495
- decoders[name] = function(options) {
1493
+ decoders[name] = function (options) {
1496
1494
  return new SingleByteDecoder(idx, options);
1497
1495
  };
1498
1496
  /** @param {{fatal: boolean}} options */
1499
- encoders[name] = function(options) {
1497
+ encoders[name] = function (options) {
1500
1498
  return new SingleByteEncoder(idx, options);
1501
1499
  };
1502
1500
  });
@@ -1512,14 +1510,14 @@ function SingleByteEncoder(index, options) {
1512
1510
  // 11.1.1 gbk decoder
1513
1511
  // gbk's decoder is gb18030's decoder.
1514
1512
  /** @param {{fatal: boolean}} options */
1515
- decoders['GBK'] = function(options) {
1513
+ decoders['GBK'] = function (options) {
1516
1514
  return new GB18030Decoder(options);
1517
1515
  };
1518
1516
 
1519
1517
  // 11.1.2 gbk encoder
1520
1518
  // gbk's encoder is gb18030's encoder with its gbk flag set.
1521
1519
  /** @param {{fatal: boolean}} options */
1522
- encoders['GBK'] = function(options) {
1520
+ encoders['GBK'] = function (options) {
1523
1521
  return new GB18030Encoder(options, true);
1524
1522
  };
1525
1523
 
@@ -1545,7 +1543,7 @@ function GB18030Decoder(options) {
1545
1543
  * decoded, or null if not enough data exists in the input
1546
1544
  * stream to decode a complete code point.
1547
1545
  */
1548
- this.handler = function(stream, bite) {
1546
+ this.handler = function (stream, bite) {
1549
1547
  // 1. If byte is end-of-stream and gb18030 first, gb18030
1550
1548
  // second, and gb18030 third are 0x00, return finished.
1551
1549
  if (
@@ -1698,7 +1696,7 @@ function GB18030Encoder(options, gbk_flag) {
1698
1696
  * @param {number} code_point Next code point read from the stream.
1699
1697
  * @return {(number|!Array.<number>)} Byte(s) to emit.
1700
1698
  */
1701
- this.handler = function(stream, code_point) {
1699
+ this.handler = function (stream, code_point) {
1702
1700
  // 1. If code point is end-of-stream, return finished.
1703
1701
  if (code_point === end_of_stream) return finished;
1704
1702
 
@@ -1764,11 +1762,11 @@ function GB18030Encoder(options, gbk_flag) {
1764
1762
  }
1765
1763
 
1766
1764
  /** @param {{fatal: boolean}} options */
1767
- encoders['gb18030'] = function(options) {
1765
+ encoders['gb18030'] = function (options) {
1768
1766
  return new GB18030Encoder(options);
1769
1767
  };
1770
1768
  /** @param {{fatal: boolean}} options */
1771
- decoders['gb18030'] = function(options) {
1769
+ decoders['gb18030'] = function (options) {
1772
1770
  return new GB18030Decoder(options);
1773
1771
  };
1774
1772
 
@@ -1796,7 +1794,7 @@ function Big5Decoder(options) {
1796
1794
  * decoded, or null if not enough data exists in the input
1797
1795
  * stream to decode a complete code point.
1798
1796
  */
1799
- this.handler = function(stream, bite) {
1797
+ this.handler = function (stream, bite) {
1800
1798
  // 1. If byte is end-of-stream and Big5 lead is not 0x00, set
1801
1799
  // Big5 lead to 0x00 and return error.
1802
1800
  if (bite === end_of_stream && Big5_lead !== 0x00) {
@@ -1890,7 +1888,7 @@ function Big5Encoder(options) {
1890
1888
  * @param {number} code_point Next code point read from the stream.
1891
1889
  * @return {(number|!Array.<number>)} Byte(s) to emit.
1892
1890
  */
1893
- this.handler = function(stream, code_point) {
1891
+ this.handler = function (stream, code_point) {
1894
1892
  // 1. If code point is end-of-stream, return finished.
1895
1893
  if (code_point === end_of_stream) return finished;
1896
1894
 
@@ -1923,11 +1921,11 @@ function Big5Encoder(options) {
1923
1921
  }
1924
1922
 
1925
1923
  /** @param {{fatal: boolean}} options */
1926
- encoders['Big5'] = function(options) {
1924
+ encoders['Big5'] = function (options) {
1927
1925
  return new Big5Encoder(options);
1928
1926
  };
1929
1927
  /** @param {{fatal: boolean}} options */
1930
- decoders['Big5'] = function(options) {
1928
+ decoders['Big5'] = function (options) {
1931
1929
  return new Big5Decoder(options);
1932
1930
  };
1933
1931
 
@@ -1958,7 +1956,7 @@ function EUCJPDecoder(options) {
1958
1956
  * decoded, or null if not enough data exists in the input
1959
1957
  * stream to decode a complete code point.
1960
1958
  */
1961
- this.handler = function(stream, bite) {
1959
+ this.handler = function (stream, bite) {
1962
1960
  // 1. If byte is end-of-stream and euc-jp lead is not 0x00, set
1963
1961
  // euc-jp lead to 0x00, and return error.
1964
1962
  if (bite === end_of_stream && eucjp_lead !== 0x00) {
@@ -2050,7 +2048,7 @@ function EUCJPEncoder(options) {
2050
2048
  * @param {number} code_point Next code point read from the stream.
2051
2049
  * @return {(number|!Array.<number>)} Byte(s) to emit.
2052
2050
  */
2053
- this.handler = function(stream, code_point) {
2051
+ this.handler = function (stream, code_point) {
2054
2052
  // 1. If code point is end-of-stream, return finished.
2055
2053
  if (code_point === end_of_stream) return finished;
2056
2054
 
@@ -2091,11 +2089,11 @@ function EUCJPEncoder(options) {
2091
2089
  }
2092
2090
 
2093
2091
  /** @param {{fatal: boolean}} options */
2094
- encoders['EUC-JP'] = function(options) {
2092
+ encoders['EUC-JP'] = function (options) {
2095
2093
  return new EUCJPEncoder(options);
2096
2094
  };
2097
2095
  /** @param {{fatal: boolean}} options */
2098
- decoders['EUC-JP'] = function(options) {
2096
+ decoders['EUC-JP'] = function (options) {
2099
2097
  return new EUCJPDecoder(options);
2100
2098
  };
2101
2099
 
@@ -2134,7 +2132,7 @@ function ISO2022JPDecoder(options) {
2134
2132
  * decoded, or null if not enough data exists in the input
2135
2133
  * stream to decode a complete code point.
2136
2134
  */
2137
- this.handler = function(stream, bite) {
2135
+ this.handler = function (stream, bite) {
2138
2136
  // switching on iso-2022-jp decoder state:
2139
2137
  switch (iso2022jp_decoder_state) {
2140
2138
  default:
@@ -2433,7 +2431,7 @@ function ISO2022JPEncoder(options) {
2433
2431
  * @param {number} code_point Next code point read from the stream.
2434
2432
  * @return {(number|!Array.<number>)} Byte(s) to emit.
2435
2433
  */
2436
- this.handler = function(stream, code_point) {
2434
+ this.handler = function (stream, code_point) {
2437
2435
  // 1. If code point is end-of-stream and iso-2022-jp encoder
2438
2436
  // state is not ASCII, prepend code point to stream, set
2439
2437
  // iso-2022-jp encoder state to ASCII, and return three bytes
@@ -2467,7 +2465,8 @@ function ISO2022JPEncoder(options) {
2467
2465
  if (
2468
2466
  iso2022jp_state === states.Roman &&
2469
2467
  ((isASCIICodePoint(code_point) && code_point !== 0x005c && code_point !== 0x007e) ||
2470
- (code_point == 0x00a5 || code_point == 0x203e))
2468
+ code_point == 0x00a5 ||
2469
+ code_point == 0x203e)
2471
2470
  ) {
2472
2471
  // 1. If code point is an ASCII code point, return a byte
2473
2472
  // whose value is code point.
@@ -2531,11 +2530,11 @@ function ISO2022JPEncoder(options) {
2531
2530
  }
2532
2531
 
2533
2532
  /** @param {{fatal: boolean}} options */
2534
- encoders['ISO-2022-JP'] = function(options) {
2533
+ encoders['ISO-2022-JP'] = function (options) {
2535
2534
  return new ISO2022JPEncoder(options);
2536
2535
  };
2537
2536
  /** @param {{fatal: boolean}} options */
2538
- decoders['ISO-2022-JP'] = function(options) {
2537
+ decoders['ISO-2022-JP'] = function (options) {
2539
2538
  return new ISO2022JPDecoder(options);
2540
2539
  };
2541
2540
 
@@ -2559,7 +2558,7 @@ function ShiftJISDecoder(options) {
2559
2558
  * decoded, or null if not enough data exists in the input
2560
2559
  * stream to decode a complete code point.
2561
2560
  */
2562
- this.handler = function(stream, bite) {
2561
+ this.handler = function (stream, bite) {
2563
2562
  // 1. If byte is end-of-stream and Shift_JIS lead is not 0x00,
2564
2563
  // set Shift_JIS lead to 0x00 and return error.
2565
2564
  if (bite === end_of_stream && Shift_JIS_lead !== 0x00) {
@@ -2646,7 +2645,7 @@ function ShiftJISEncoder(options) {
2646
2645
  * @param {number} code_point Next code point read from the stream.
2647
2646
  * @return {(number|!Array.<number>)} Byte(s) to emit.
2648
2647
  */
2649
- this.handler = function(stream, code_point) {
2648
+ this.handler = function (stream, code_point) {
2650
2649
  // 1. If code point is end-of-stream, return finished.
2651
2650
  if (code_point === end_of_stream) return finished;
2652
2651
 
@@ -2694,11 +2693,11 @@ function ShiftJISEncoder(options) {
2694
2693
  }
2695
2694
 
2696
2695
  /** @param {{fatal: boolean}} options */
2697
- encoders['Shift_JIS'] = function(options) {
2696
+ encoders['Shift_JIS'] = function (options) {
2698
2697
  return new ShiftJISEncoder(options);
2699
2698
  };
2700
2699
  /** @param {{fatal: boolean}} options */
2701
- decoders['Shift_JIS'] = function(options) {
2700
+ decoders['Shift_JIS'] = function (options) {
2702
2701
  return new ShiftJISDecoder(options);
2703
2702
  };
2704
2703
 
@@ -2726,7 +2725,7 @@ function EUCKRDecoder(options) {
2726
2725
  * decoded, or null if not enough data exists in the input
2727
2726
  * stream to decode a complete code point.
2728
2727
  */
2729
- this.handler = function(stream, bite) {
2728
+ this.handler = function (stream, bite) {
2730
2729
  // 1. If byte is end-of-stream and euc-kr lead is not 0x00, set
2731
2730
  // euc-kr lead to 0x00 and return error.
2732
2731
  if (bite === end_of_stream && euckr_lead !== 0) {
@@ -2794,7 +2793,7 @@ function EUCKREncoder(options) {
2794
2793
  * @param {number} code_point Next code point read from the stream.
2795
2794
  * @return {(number|!Array.<number>)} Byte(s) to emit.
2796
2795
  */
2797
- this.handler = function(stream, code_point) {
2796
+ this.handler = function (stream, code_point) {
2798
2797
  // 1. If code point is end-of-stream, return finished.
2799
2798
  if (code_point === end_of_stream) return finished;
2800
2799
 
@@ -2821,11 +2820,11 @@ function EUCKREncoder(options) {
2821
2820
  }
2822
2821
 
2823
2822
  /** @param {{fatal: boolean}} options */
2824
- encoders['EUC-KR'] = function(options) {
2823
+ encoders['EUC-KR'] = function (options) {
2825
2824
  return new EUCKREncoder(options);
2826
2825
  };
2827
2826
  /** @param {{fatal: boolean}} options */
2828
- decoders['EUC-KR'] = function(options) {
2827
+ decoders['EUC-KR'] = function (options) {
2829
2828
  return new EUCKRDecoder(options);
2830
2829
  };
2831
2830
 
@@ -2876,7 +2875,7 @@ function UTF16Decoder(utf16_be, options) {
2876
2875
  * decoded, or null if not enough data exists in the input
2877
2876
  * stream to decode a complete code point.
2878
2877
  */
2879
- this.handler = function(stream, bite) {
2878
+ this.handler = function (stream, bite) {
2880
2879
  // 1. If byte is end-of-stream and either utf-16 lead byte or
2881
2880
  // utf-16 lead surrogate is not null, set utf-16 lead byte and
2882
2881
  // utf-16 lead surrogate to null, and return error.
@@ -2962,7 +2961,7 @@ function UTF16Encoder(utf16_be, options) {
2962
2961
  * @param {number} code_point Next code point read from the stream.
2963
2962
  * @return {(number|!Array.<number>)} Byte(s) to emit.
2964
2963
  */
2965
- this.handler = function(stream, code_point) {
2964
+ this.handler = function (stream, code_point) {
2966
2965
  // 1. If code point is end-of-stream, return finished.
2967
2966
  if (code_point === end_of_stream) return finished;
2968
2967
 
@@ -2987,24 +2986,24 @@ function UTF16Encoder(utf16_be, options) {
2987
2986
  // 15.3 utf-16be
2988
2987
  // 15.3.1 utf-16be decoder
2989
2988
  /** @param {{fatal: boolean}} options */
2990
- encoders['UTF-16BE'] = function(options) {
2989
+ encoders['UTF-16BE'] = function (options) {
2991
2990
  return new UTF16Encoder(true, options);
2992
2991
  };
2993
2992
  // 15.3.2 utf-16be encoder
2994
2993
  /** @param {{fatal: boolean}} options */
2995
- decoders['UTF-16BE'] = function(options) {
2994
+ decoders['UTF-16BE'] = function (options) {
2996
2995
  return new UTF16Decoder(true, options);
2997
2996
  };
2998
2997
 
2999
2998
  // 15.4 utf-16le
3000
2999
  // 15.4.1 utf-16le decoder
3001
3000
  /** @param {{fatal: boolean}} options */
3002
- encoders['UTF-16LE'] = function(options) {
3001
+ encoders['UTF-16LE'] = function (options) {
3003
3002
  return new UTF16Encoder(false, options);
3004
3003
  };
3005
3004
  // 15.4.2 utf-16le encoder
3006
3005
  /** @param {{fatal: boolean}} options */
3007
- decoders['UTF-16LE'] = function(options) {
3006
+ decoders['UTF-16LE'] = function (options) {
3008
3007
  return new UTF16Decoder(false, options);
3009
3008
  };
3010
3009
 
@@ -3025,7 +3024,7 @@ function XUserDefinedDecoder(options) {
3025
3024
  * decoded, or null if not enough data exists in the input
3026
3025
  * stream to decode a complete code point.
3027
3026
  */
3028
- this.handler = function(stream, bite) {
3027
+ this.handler = function (stream, bite) {
3029
3028
  // 1. If byte is end-of-stream, return finished.
3030
3029
  if (bite === end_of_stream) return finished;
3031
3030
 
@@ -3051,7 +3050,7 @@ function XUserDefinedEncoder(options) {
3051
3050
  * @param {number} code_point Next code point read from the stream.
3052
3051
  * @return {(number|!Array.<number>)} Byte(s) to emit.
3053
3052
  */
3054
- this.handler = function(stream, code_point) {
3053
+ this.handler = function (stream, code_point) {
3055
3054
  // 1.If code point is end-of-stream, return finished.
3056
3055
  if (code_point === end_of_stream) return finished;
3057
3056
 
@@ -3069,11 +3068,11 @@ function XUserDefinedEncoder(options) {
3069
3068
  }
3070
3069
 
3071
3070
  /** @param {{fatal: boolean}} options */
3072
- encoders['x-user-defined'] = function(options) {
3071
+ encoders['x-user-defined'] = function (options) {
3073
3072
  return new XUserDefinedEncoder(options);
3074
3073
  };
3075
3074
  /** @param {{fatal: boolean}} options */
3076
- decoders['x-user-defined'] = function(options) {
3075
+ decoders['x-user-defined'] = function (options) {
3077
3076
  return new XUserDefinedDecoder(options);
3078
3077
  };
3079
3078
 
@@ -3081,4 +3080,5 @@ decoders['x-user-defined'] = function(options) {
3081
3080
  // if (!global['TextEncoder']) global['TextEncoder'] = TextEncoder;
3082
3081
  // if (!global['TextDecoder']) global['TextDecoder'] = TextDecoder;
3083
3082
  // babel.config.js skip transpiling files in `libs/`
3084
- module.exports = {TextEncoder, TextDecoder};
3083
+ // module.exports = {TextEncoder, TextDecoder};
3084
+ export {TextEncoder, TextDecoder};