@loaders.gl/polyfills 3.1.0-beta.6 → 3.1.2
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/dist/bundle.js +5 -3994
- package/dist/dist.min.js +3994 -0
- package/dist/es5/bundle.js +1 -1
- package/dist/es5/bundle.js.map +1 -1
- package/dist/es5/index.js +11 -9
- package/dist/es5/index.js.map +1 -1
- package/dist/es5/lib/encoding.js +20 -14
- package/dist/es5/lib/encoding.js.map +1 -1
- package/dist/es5/node/buffer/to-array-buffer.node.js +1 -1
- package/dist/es5/node/buffer/to-array-buffer.node.js.map +1 -1
- package/dist/es5/node/fetch/fetch.node.js +103 -61
- package/dist/es5/node/fetch/fetch.node.js.map +1 -1
- package/dist/es5/node/fetch/headers.node.js +112 -73
- package/dist/es5/node/fetch/headers.node.js.map +1 -1
- package/dist/es5/node/fetch/response.node.js +182 -47
- package/dist/es5/node/fetch/response.node.js.map +1 -1
- package/dist/es5/node/fetch/utils/decode-data-uri.node.js +18 -12
- package/dist/es5/node/fetch/utils/decode-data-uri.node.js.map +1 -1
- package/dist/es5/node/fetch/utils/stream-utils.node.js +156 -50
- package/dist/es5/node/fetch/utils/stream-utils.node.js.map +1 -1
- package/dist/es5/node/file/blob-stream-controller.js +82 -37
- package/dist/es5/node/file/blob-stream-controller.js.map +1 -1
- package/dist/es5/node/file/blob-stream.js +67 -12
- package/dist/es5/node/file/blob-stream.js.map +1 -1
- package/dist/es5/node/file/blob.js +209 -100
- package/dist/es5/node/file/blob.js.map +1 -1
- package/dist/es5/node/file/file-reader.js +147 -40
- package/dist/es5/node/file/file-reader.js.map +1 -1
- package/dist/es5/node/file/file.js +41 -13
- package/dist/es5/node/file/file.js.map +1 -1
- package/dist/es5/node/file/readable-stream.js +26 -1
- package/dist/es5/node/file/readable-stream.js.map +1 -1
- package/dist/es5/node/images/encode-image.node.js +10 -8
- package/dist/es5/node/images/encode-image.node.js.map +1 -1
- package/dist/es5/node/images/parse-image.node.js +44 -17
- package/dist/es5/node/images/parse-image.node.js.map +1 -1
- package/dist/es5/promise/all-settled.js +7 -7
- package/dist/es5/promise/all-settled.js.map +1 -1
- package/dist/es5/utils/globals.js +8 -3
- package/dist/es5/utils/globals.js.map +1 -1
- package/dist/esm/node/fetch/utils/decode-data-uri.node.js +1 -3
- package/dist/esm/node/fetch/utils/decode-data-uri.node.js.map +1 -1
- package/dist/esm/node/fetch/utils/stream-utils.node.js +21 -12
- package/dist/esm/node/fetch/utils/stream-utils.node.js.map +1 -1
- package/dist/node/fetch/utils/decode-data-uri.node.d.ts +4 -4
- package/dist/node/fetch/utils/decode-data-uri.node.d.ts.map +1 -1
- package/dist/node/fetch/utils/decode-data-uri.node.js +4 -2
- package/dist/node/fetch/utils/stream-utils.node.d.ts +8 -2
- package/dist/node/fetch/utils/stream-utils.node.d.ts.map +1 -1
- package/dist/node/fetch/utils/stream-utils.node.js +31 -13
- package/package.json +3 -3
- package/src/node/fetch/utils/decode-data-uri.node.ts +7 -6
- package/src/node/fetch/utils/stream-utils.node.ts +38 -15
package/dist/es5/bundle.js
CHANGED
package/dist/es5/bundle.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/bundle.ts"],"names":["moduleExports","require","globalThis","loaders","module","exports","Object","assign"],"mappings":";;AACA,
|
|
1
|
+
{"version":3,"sources":["../../src/bundle.ts"],"names":["moduleExports","require","globalThis","loaders","module","exports","Object","assign"],"mappings":";;AACA,IAAMA,aAAa,GAAGC,OAAO,CAAC,SAAD,CAA7B;;AACAC,UAAU,CAACC,OAAX,GAAqBD,UAAU,CAACC,OAAX,IAAsB,EAA3C;AACAC,MAAM,CAACC,OAAP,GAAiBC,MAAM,CAACC,MAAP,CAAcL,UAAU,CAACC,OAAzB,EAAkCH,aAAlC,CAAjB","sourcesContent":["// @ts-nocheck\nconst moduleExports = require('./index');\nglobalThis.loaders = globalThis.loaders || {};\nmodule.exports = Object.assign(globalThis.loaders, moduleExports);\n"],"file":"bundle.js"}
|
package/dist/es5/index.js
CHANGED
|
@@ -2,36 +2,38 @@
|
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
4
|
|
|
5
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
|
+
|
|
5
7
|
Object.defineProperty(exports, "__esModule", {
|
|
6
8
|
value: true
|
|
7
9
|
});
|
|
8
10
|
Object.defineProperty(exports, "ReadableStreamPolyfill", {
|
|
9
11
|
enumerable: true,
|
|
10
|
-
get: function () {
|
|
12
|
+
get: function get() {
|
|
11
13
|
return _readableStream.ReadableStreamPolyfill;
|
|
12
14
|
}
|
|
13
15
|
});
|
|
14
16
|
Object.defineProperty(exports, "BlobPolyfill", {
|
|
15
17
|
enumerable: true,
|
|
16
|
-
get: function () {
|
|
18
|
+
get: function get() {
|
|
17
19
|
return _blob.BlobPolyfill;
|
|
18
20
|
}
|
|
19
21
|
});
|
|
20
22
|
Object.defineProperty(exports, "FileReaderPolyfill", {
|
|
21
23
|
enumerable: true,
|
|
22
|
-
get: function () {
|
|
24
|
+
get: function get() {
|
|
23
25
|
return _fileReader.FileReaderPolyfill;
|
|
24
26
|
}
|
|
25
27
|
});
|
|
26
28
|
Object.defineProperty(exports, "FilePolyfill", {
|
|
27
29
|
enumerable: true,
|
|
28
|
-
get: function () {
|
|
30
|
+
get: function get() {
|
|
29
31
|
return _file.FilePolyfill;
|
|
30
32
|
}
|
|
31
33
|
});
|
|
32
34
|
Object.defineProperty(exports, "installFilePolyfills", {
|
|
33
35
|
enumerable: true,
|
|
34
|
-
get: function () {
|
|
36
|
+
get: function get() {
|
|
35
37
|
return _installFilePolyfills.installFilePolyfills;
|
|
36
38
|
}
|
|
37
39
|
});
|
|
@@ -66,17 +68,17 @@ var _file = require("./node/file/file");
|
|
|
66
68
|
|
|
67
69
|
var _installFilePolyfills = require("./node/file/install-file-polyfills");
|
|
68
70
|
|
|
69
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
71
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
70
72
|
|
|
71
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null ||
|
|
73
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
72
74
|
|
|
73
|
-
|
|
75
|
+
var installTextEncoder = !_globals.isBrowser || !('TextEncoder' in _globals.global);
|
|
74
76
|
|
|
75
77
|
if (installTextEncoder) {
|
|
76
78
|
_globals.global['TextEncoder'] = _encoding.TextEncoder;
|
|
77
79
|
}
|
|
78
80
|
|
|
79
|
-
|
|
81
|
+
var installTextDecoder = !_globals.isBrowser || !('TextDecoder' in _globals.global);
|
|
80
82
|
|
|
81
83
|
if (installTextDecoder) {
|
|
82
84
|
_globals.global['TextDecoder'] = _encoding.TextDecoder;
|
package/dist/es5/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/index.ts"],"names":["installTextEncoder","isBrowser","global","TextEncoder","installTextDecoder","TextDecoder","base64","atob","btoa","HeadersNode","ResponseNode","fetchNode","DOMParser","encodeImageNode","parseImageNode","Promise","allSettled"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../src/index.ts"],"names":["installTextEncoder","isBrowser","global","TextEncoder","installTextDecoder","TextDecoder","base64","atob","btoa","HeadersNode","ResponseNode","fetchNode","DOMParser","encodeImageNode","parseImageNode","Promise","allSettled"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA;;AACA;;AAEA;;AACA;;AAGA;;AAEA;;AACA;;AACA;;AAEA;;AACA;;AAEA;;AACA;;AACA;;AACA;;AACA;;;;;;AAMA,IAAMA,kBAAkB,GAAG,CAACC,kBAAD,IAAc,EAAE,iBAAiBC,eAAnB,CAAzC;;AACA,IAAIF,kBAAJ,EAAwB;AACtBE,kBAAO,aAAP,IAAwBC,qBAAxB;AACD;;AAED,IAAMC,kBAAkB,GAAG,CAACH,kBAAD,IAAc,EAAE,iBAAiBC,eAAnB,CAAzC;;AACA,IAAIE,kBAAJ,EAAwB;AACtBF,kBAAO,aAAP,IAAwBG,qBAAxB;AACD;;AAMD,IAAI,CAACJ,kBAAD,IAAc,EAAE,UAAUC,eAAZ,CAAd,IAAqCI,MAAM,CAACC,IAAhD,EAAsD;AACpDL,kBAAO,MAAP,IAAiBI,MAAM,CAACC,IAAxB;AACD;;AACD,IAAI,CAACN,kBAAD,IAAc,EAAE,UAAUC,eAAZ,CAAd,IAAqCI,MAAM,CAACE,IAAhD,EAAsD;AACpDN,kBAAO,MAAP,IAAiBI,MAAM,CAACE,IAAxB;AACD;;AAMD,IAAI,CAACP,kBAAD,IAAc,EAAE,aAAaC,eAAf,CAAd,IAAwCO,gBAA5C,EAAyD;AACvDP,kBAAO,SAAP,IAAoBO,gBAApB;AACD;;AAED,IAAI,CAACR,kBAAD,IAAc,EAAE,cAAcC,eAAhB,CAAd,IAAyCQ,iBAA7C,EAA2D;AACzDR,kBAAO,UAAP,IAAqBQ,iBAArB;AACD;;AAED,IAAI,CAACT,kBAAD,IAAc,EAAE,WAAWC,eAAb,CAAd,IAAsCS,cAA1C,EAAqD;AACnDT,kBAAO,OAAP,IAAkBS,cAAlB;AACD;;AAMD,IAAI,CAACV,kBAAD,IAAc,EAAE,eAAeC,eAAjB,CAAd,IAA0CU,iBAA9C,EAAyD;AACvDV,kBAAO,WAAP,IAAsBU,iBAAtB;AACD;;AAMD,IAAI,CAACX,kBAAD,IAAc,EAAE,sBAAsBC,eAAxB,CAAd,IAAiDW,4BAArD,EAAsE;AACpEX,kBAAO,kBAAP,IAA6BW,4BAA7B;AACD;;AAED,IAAI,CAACZ,kBAAD,IAAc,EAAE,qBAAqBC,eAAvB,CAAd,IAAgDY,0BAApD,EAAoE;AAClEZ,kBAAO,iBAAP,IAA4BY,0BAA5B;AACD;;AAED,IAAI,EAAE,gBAAgBC,OAAlB,CAAJ,EAAgC;AAE9BA,EAAAA,OAAO,CAACC,UAAR,GAAqBA,sBAArB;AACD","sourcesContent":["/* eslint-disable dot-notation */\nimport {DOMParser} from '@xmldom/xmldom';\nimport {isBrowser, global} from './utils/globals';\n\nimport {TextDecoder, TextEncoder} from './lib/encoding';\nimport {allSettled} from './promise/all-settled';\n\n// Node specific\nimport * as base64 from './node/buffer/btoa.node';\n\nimport HeadersNode from './node/fetch/headers.node';\nimport ResponseNode from './node/fetch/response.node';\nimport fetchNode from './node/fetch/fetch.node';\n\nimport {encodeImageNode} from './node/images/encode-image.node';\nimport {parseImageNode} from './node/images/parse-image.node';\n\nexport {ReadableStreamPolyfill} from './node/file/readable-stream';\nexport {BlobPolyfill} from './node/file/blob';\nexport {FileReaderPolyfill} from './node/file/file-reader';\nexport {FilePolyfill} from './node/file/file';\nexport {installFilePolyfills} from './node/file/install-file-polyfills';\n\n// POLYFILLS: TextEncoder, TextDecoder\n// - Recent Node versions have these classes but virtually no encodings unless special build.\n// - Browser: Edge, IE11 do not have these\n\nconst installTextEncoder = !isBrowser || !('TextEncoder' in global);\nif (installTextEncoder) {\n global['TextEncoder'] = TextEncoder;\n}\n\nconst installTextDecoder = !isBrowser || !('TextDecoder' in global);\nif (installTextDecoder) {\n global['TextDecoder'] = TextDecoder;\n}\n\n// POLYFILLS: btoa, atob\n// - Node: Yes\n// - Browser: No\n\nif (!isBrowser && !('atob' in global) && base64.atob) {\n global['atob'] = base64.atob;\n}\nif (!isBrowser && !('btoa' in global) && base64.btoa) {\n global['btoa'] = base64.btoa;\n}\n\n// POLYFILL: fetch\n// - Node: Yes\n// - Browser: No. For This polyfill is node only, IE11 etc, install external polyfill\n\nif (!isBrowser && !('Headers' in global) && HeadersNode) {\n global['Headers'] = HeadersNode;\n}\n\nif (!isBrowser && !('Response' in global) && ResponseNode) {\n global['Response'] = ResponseNode;\n}\n\nif (!isBrowser && !('fetch' in global) && fetchNode) {\n global['fetch'] = fetchNode;\n}\n\n// POLYFILL: DOMParser\n// - Node: Yes\n// - Browser: No\n\nif (!isBrowser && !('DOMParser' in global) && DOMParser) {\n global['DOMParser'] = DOMParser;\n}\n\n// NODE IMAGE FUNCTIONS:\n// These are not official polyfills but used by the @loaders.gl/images module if installed\n// TODO - is there an appropriate Image API we could polyfill using an adapter?\n\nif (!isBrowser && !('_encodeImageNode' in global) && encodeImageNode) {\n global['_encodeImageNode'] = encodeImageNode;\n}\n\nif (!isBrowser && !('_parseImageNode' in global) && parseImageNode) {\n global['_parseImageNode'] = parseImageNode;\n}\n\nif (!('allSettled' in Promise)) {\n // @ts-ignore\n Promise.allSettled = allSettled;\n}\n"],"file":"index.js"}
|
package/dist/es5/lib/encoding.js
CHANGED
|
@@ -8,6 +8,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
8
8
|
exports.TextEncoder = TextEncoder;
|
|
9
9
|
exports.TextDecoder = TextDecoder;
|
|
10
10
|
|
|
11
|
+
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
12
|
+
|
|
11
13
|
var _encodingIndexes = _interopRequireDefault(require("./encoding-indexes"));
|
|
12
14
|
|
|
13
15
|
global['encoding-indexes'] = _encodingIndexes.default || {};
|
|
@@ -94,27 +96,31 @@ function Stream(tokens) {
|
|
|
94
96
|
}
|
|
95
97
|
|
|
96
98
|
Stream.prototype = {
|
|
97
|
-
endOfStream: function () {
|
|
99
|
+
endOfStream: function endOfStream() {
|
|
98
100
|
return !this.tokens.length;
|
|
99
101
|
},
|
|
100
|
-
read: function () {
|
|
102
|
+
read: function read() {
|
|
101
103
|
if (!this.tokens.length) return end_of_stream;
|
|
102
104
|
return this.tokens.pop();
|
|
103
105
|
},
|
|
104
|
-
prepend: function (token) {
|
|
106
|
+
prepend: function prepend(token) {
|
|
105
107
|
if (Array.isArray(token)) {
|
|
106
108
|
var tokens = token;
|
|
107
109
|
|
|
108
|
-
while (tokens.length)
|
|
110
|
+
while (tokens.length) {
|
|
111
|
+
this.tokens.push(tokens.pop());
|
|
112
|
+
}
|
|
109
113
|
} else {
|
|
110
114
|
this.tokens.push(token);
|
|
111
115
|
}
|
|
112
116
|
},
|
|
113
|
-
push: function (token) {
|
|
117
|
+
push: function push(token) {
|
|
114
118
|
if (Array.isArray(token)) {
|
|
115
119
|
var tokens = token;
|
|
116
120
|
|
|
117
|
-
while (tokens.length)
|
|
121
|
+
while (tokens.length) {
|
|
122
|
+
this.tokens.unshift(tokens.shift());
|
|
123
|
+
}
|
|
118
124
|
} else {
|
|
119
125
|
this.tokens.unshift(token);
|
|
120
126
|
}
|
|
@@ -134,13 +140,13 @@ function encoderError(code_point) {
|
|
|
134
140
|
function Decoder() {}
|
|
135
141
|
|
|
136
142
|
Decoder.prototype = {
|
|
137
|
-
handler: function (stream, bite) {}
|
|
143
|
+
handler: function handler(stream, bite) {}
|
|
138
144
|
};
|
|
139
145
|
|
|
140
146
|
function Encoder() {}
|
|
141
147
|
|
|
142
148
|
Encoder.prototype = {
|
|
143
|
-
handler: function (stream, code_point) {}
|
|
149
|
+
handler: function handler(stream, code_point) {}
|
|
144
150
|
};
|
|
145
151
|
|
|
146
152
|
function getEncoding(label) {
|
|
@@ -426,17 +432,17 @@ function TextDecoder(label, options) {
|
|
|
426
432
|
|
|
427
433
|
if (Object.defineProperty) {
|
|
428
434
|
Object.defineProperty(TextDecoder.prototype, 'encoding', {
|
|
429
|
-
get: function () {
|
|
435
|
+
get: function get() {
|
|
430
436
|
return this._encoding.name.toLowerCase();
|
|
431
437
|
}
|
|
432
438
|
});
|
|
433
439
|
Object.defineProperty(TextDecoder.prototype, 'fatal', {
|
|
434
|
-
get: function () {
|
|
440
|
+
get: function get() {
|
|
435
441
|
return this._error_mode === 'fatal';
|
|
436
442
|
}
|
|
437
443
|
});
|
|
438
444
|
Object.defineProperty(TextDecoder.prototype, 'ignoreBOM', {
|
|
439
|
-
get: function () {
|
|
445
|
+
get: function get() {
|
|
440
446
|
return this._ignoreBOM;
|
|
441
447
|
}
|
|
442
448
|
});
|
|
@@ -445,9 +451,9 @@ if (Object.defineProperty) {
|
|
|
445
451
|
TextDecoder.prototype.decode = function decode(input, options) {
|
|
446
452
|
var bytes;
|
|
447
453
|
|
|
448
|
-
if (
|
|
454
|
+
if ((0, _typeof2.default)(input) === 'object' && input instanceof ArrayBuffer) {
|
|
449
455
|
bytes = new Uint8Array(input);
|
|
450
|
-
} else if (
|
|
456
|
+
} else if ((0, _typeof2.default)(input) === 'object' && 'buffer' in input && input.buffer instanceof ArrayBuffer) {
|
|
451
457
|
bytes = new Uint8Array(input.buffer, input.byteOffset, input.byteLength);
|
|
452
458
|
} else {
|
|
453
459
|
bytes = new Uint8Array(0);
|
|
@@ -538,7 +544,7 @@ function TextEncoder(label, options) {
|
|
|
538
544
|
|
|
539
545
|
if (Object.defineProperty) {
|
|
540
546
|
Object.defineProperty(TextEncoder.prototype, 'encoding', {
|
|
541
|
-
get: function () {
|
|
547
|
+
get: function get() {
|
|
542
548
|
return this._encoding.name.toLowerCase();
|
|
543
549
|
}
|
|
544
550
|
});
|