@loaders.gl/loader-utils 4.0.0-beta.1 → 4.0.0-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +1252 -0
- package/dist/index.d.ts +7 -10
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +34 -0
- package/dist/index.js.map +1 -0
- package/dist/{esm/json-loader.js → json-loader.js} +1 -1
- package/dist/json-loader.js.map +1 -0
- package/dist/lib/binary-utils/array-buffer-utils.js.map +1 -0
- package/dist/{esm/lib → lib}/binary-utils/dataview-copy-utils.js +1 -1
- package/dist/lib/binary-utils/dataview-copy-utils.js.map +1 -0
- package/dist/lib/binary-utils/get-first-characters.js.map +1 -0
- package/dist/{esm/lib → lib}/binary-utils/memory-conversion-utils.js +1 -1
- package/dist/lib/binary-utils/memory-conversion-utils.js.map +1 -0
- package/dist/{esm/lib → lib}/binary-utils/memory-copy-utils.js +1 -1
- package/dist/lib/binary-utils/memory-copy-utils.js.map +1 -0
- package/dist/lib/env-utils/assert.js.map +1 -0
- package/dist/lib/env-utils/globals.js.map +1 -0
- package/dist/lib/file-provider/data-view-file.d.ts +4 -1
- package/dist/lib/file-provider/data-view-file.d.ts.map +1 -1
- package/dist/{esm/lib → lib}/file-provider/data-view-file.js +1 -2
- package/dist/lib/file-provider/data-view-file.js.map +1 -0
- package/dist/lib/file-provider/file-handle-file.d.ts +12 -19
- package/dist/lib/file-provider/file-handle-file.d.ts.map +1 -1
- package/dist/lib/file-provider/file-handle-file.js +56 -0
- package/dist/lib/file-provider/file-handle-file.js.map +1 -0
- package/dist/lib/file-provider/file-provider.d.ts +1 -0
- package/dist/lib/file-provider/file-provider.d.ts.map +1 -1
- package/dist/lib/file-provider/file-provider.js.map +1 -0
- package/dist/lib/files/blob-file.d.ts +16 -0
- package/dist/lib/files/blob-file.d.ts.map +1 -0
- package/dist/lib/files/blob-file.js +25 -0
- package/dist/lib/files/blob-file.js.map +1 -0
- package/dist/lib/files/file.d.ts +33 -0
- package/dist/lib/files/file.d.ts.map +1 -0
- package/dist/lib/files/file.js +2 -0
- package/dist/lib/files/file.js.map +1 -0
- package/dist/lib/files/http-file.d.ts +21 -0
- package/dist/lib/files/http-file.d.ts.map +1 -0
- package/dist/lib/files/http-file.js +79 -0
- package/dist/lib/files/http-file.js.map +1 -0
- package/dist/lib/files/node-file-facade.d.ts +18 -0
- package/dist/lib/files/node-file-facade.d.ts.map +1 -0
- package/dist/lib/files/node-file-facade.js +29 -0
- package/dist/lib/files/node-file-facade.js.map +1 -0
- package/dist/lib/files/sources.d.ts +1 -0
- package/dist/lib/files/sources.d.ts.map +1 -0
- package/dist/lib/files/sources.js +2 -0
- package/dist/lib/files/sources.js.map +1 -0
- package/dist/lib/filesystems/filesystem.d.ts +18 -65
- package/dist/lib/filesystems/filesystem.d.ts.map +1 -1
- package/dist/lib/filesystems/filesystem.js.map +1 -0
- package/dist/lib/filesystems/node-filesystem-facade.d.ts +23 -0
- package/dist/lib/filesystems/node-filesystem-facade.d.ts.map +1 -0
- package/dist/lib/filesystems/node-filesystem-facade.js +37 -0
- package/dist/lib/filesystems/node-filesystem-facade.js.map +1 -0
- package/dist/{esm/lib → lib}/iterators/async-iteration.js +1 -1
- package/dist/lib/iterators/async-iteration.js.map +1 -0
- package/dist/lib/iterators/text-iterators.js.map +1 -0
- package/dist/lib/node/buffer.browser.d.ts +1 -1
- package/dist/lib/node/buffer.browser.d.ts.map +1 -1
- package/dist/lib/node/buffer.browser.js.map +1 -0
- package/dist/lib/node/buffer.d.ts +1 -1
- package/dist/lib/node/buffer.d.ts.map +1 -1
- package/dist/lib/node/buffer.js.map +1 -0
- package/dist/lib/node/fs.browser.js.map +1 -0
- package/dist/lib/node/promisify.js.map +1 -0
- package/dist/lib/node/stream.browser.js.map +1 -0
- package/dist/lib/node/stream.js.map +1 -0
- package/dist/lib/option-utils/merge-loader-options.js.map +1 -0
- package/dist/lib/parser-utils/parse-json.js +9 -0
- package/dist/lib/parser-utils/parse-json.js.map +1 -0
- package/dist/{esm/lib → lib}/path-utils/file-aliases.js +1 -1
- package/dist/lib/path-utils/file-aliases.js.map +1 -0
- package/dist/lib/path-utils/get-cwd.js.map +1 -0
- package/dist/{esm/lib → lib}/path-utils/path.js +6 -6
- package/dist/lib/path-utils/path.js.map +1 -0
- package/dist/{esm/lib → lib}/request-utils/request-scheduler.js +6 -7
- package/dist/lib/request-utils/request-scheduler.js.map +1 -0
- package/dist/{esm/lib → lib}/sources/data-source.js +4 -5
- package/dist/lib/sources/data-source.js.map +1 -0
- package/dist/lib/sources/image-source.js +5 -0
- package/dist/lib/sources/image-source.js.map +1 -0
- package/dist/lib/sources/image-tile-source.js.map +1 -0
- package/dist/lib/sources/tile-source.js.map +1 -0
- package/dist/lib/sources/utils/image-type.js.map +1 -0
- package/dist/lib/sources/utils/utils.js.map +1 -0
- package/dist/lib/sources/vector-tile-source.js.map +1 -0
- package/dist/{esm/lib → lib}/worker-loader-utils/create-loader-worker.js +1 -1
- package/dist/lib/worker-loader-utils/create-loader-worker.js.map +1 -0
- package/dist/{esm/lib → lib}/worker-loader-utils/encode-with-worker.js +1 -1
- package/dist/lib/worker-loader-utils/encode-with-worker.js.map +1 -0
- package/dist/{esm/lib → lib}/worker-loader-utils/parse-with-worker.js +1 -1
- package/dist/lib/worker-loader-utils/parse-with-worker.js.map +1 -0
- package/dist/loader-types.js.map +1 -0
- package/dist/service-types.js.map +1 -0
- package/dist/types.d.ts +2 -2
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -0
- package/dist/workers/json-worker.js +4 -0
- package/dist/workers/json-worker.js.map +1 -0
- package/dist/writer-types.js.map +1 -0
- package/package.json +13 -5
- package/src/index.ts +10 -15
- package/src/lib/file-provider/data-view-file.ts +4 -2
- package/src/lib/file-provider/file-handle-file.ts +28 -44
- package/src/lib/file-provider/file-provider.ts +1 -0
- package/src/lib/files/blob-file.ts +32 -0
- package/src/lib/files/file.ts +37 -0
- package/src/lib/files/http-file.ts +120 -0
- package/src/lib/files/node-file-facade.ts +39 -0
- package/src/lib/files/sources.ts +150 -0
- package/src/lib/filesystems/filesystem.ts +19 -68
- package/src/lib/filesystems/node-filesystem-facade.ts +63 -0
- package/src/lib/node/buffer.browser.ts +1 -1
- package/src/lib/node/buffer.ts +1 -1
- package/src/types.ts +0 -4
- package/dist/es5/index.js +0 -389
- package/dist/es5/index.js.map +0 -1
- package/dist/es5/json-loader.js +0 -44
- package/dist/es5/json-loader.js.map +0 -1
- package/dist/es5/lib/binary-utils/array-buffer-utils.js +0 -80
- package/dist/es5/lib/binary-utils/array-buffer-utils.js.map +0 -1
- package/dist/es5/lib/binary-utils/dataview-copy-utils.js +0 -58
- package/dist/es5/lib/binary-utils/dataview-copy-utils.js.map +0 -1
- package/dist/es5/lib/binary-utils/get-first-characters.js +0 -31
- package/dist/es5/lib/binary-utils/get-first-characters.js.map +0 -1
- package/dist/es5/lib/binary-utils/memory-conversion-utils.js +0 -44
- package/dist/es5/lib/binary-utils/memory-conversion-utils.js.map +0 -1
- package/dist/es5/lib/binary-utils/memory-copy-utils.js +0 -34
- package/dist/es5/lib/binary-utils/memory-copy-utils.js.map +0 -1
- package/dist/es5/lib/env-utils/assert.js +0 -12
- package/dist/es5/lib/env-utils/assert.js.map +0 -1
- package/dist/es5/lib/env-utils/globals.js +0 -30
- package/dist/es5/lib/env-utils/globals.js.map +0 -1
- package/dist/es5/lib/file-provider/data-view-file.js +0 -146
- package/dist/es5/lib/file-provider/data-view-file.js.map +0 -1
- package/dist/es5/lib/file-provider/file-handle-file.js +0 -236
- package/dist/es5/lib/file-provider/file-handle-file.js.map +0 -1
- package/dist/es5/lib/file-provider/file-handle.js +0 -98
- package/dist/es5/lib/file-provider/file-handle.js.map +0 -1
- package/dist/es5/lib/file-provider/file-provider.js +0 -11
- package/dist/es5/lib/file-provider/file-provider.js.map +0 -1
- package/dist/es5/lib/filesystems/filesystem.js +0 -2
- package/dist/es5/lib/filesystems/filesystem.js.map +0 -1
- package/dist/es5/lib/filesystems/node-filesystem.browser.js +0 -172
- package/dist/es5/lib/filesystems/node-filesystem.browser.js.map +0 -1
- package/dist/es5/lib/filesystems/node-filesystem.js +0 -210
- package/dist/es5/lib/filesystems/node-filesystem.js.map +0 -1
- package/dist/es5/lib/filesystems/readable-file.js +0 -91
- package/dist/es5/lib/filesystems/readable-file.js.map +0 -1
- package/dist/es5/lib/filesystems/writable-file.js +0 -82
- package/dist/es5/lib/filesystems/writable-file.js.map +0 -1
- package/dist/es5/lib/iterators/async-iteration.js +0 -190
- package/dist/es5/lib/iterators/async-iteration.js.map +0 -1
- package/dist/es5/lib/iterators/text-iterators.js +0 -305
- package/dist/es5/lib/iterators/text-iterators.js.map +0 -1
- package/dist/es5/lib/node/buffer.browser.js +0 -14
- package/dist/es5/lib/node/buffer.browser.js.map +0 -1
- package/dist/es5/lib/node/buffer.js +0 -27
- package/dist/es5/lib/node/buffer.js.map +0 -1
- package/dist/es5/lib/node/fs.browser.js +0 -9
- package/dist/es5/lib/node/fs.browser.js.map +0 -1
- package/dist/es5/lib/node/fs.js +0 -82
- package/dist/es5/lib/node/fs.js.map +0 -1
- package/dist/es5/lib/node/promisify.js +0 -36
- package/dist/es5/lib/node/promisify.js.map +0 -1
- package/dist/es5/lib/node/stream.browser.js +0 -9
- package/dist/es5/lib/node/stream.browser.js.map +0 -1
- package/dist/es5/lib/node/stream.js +0 -15
- package/dist/es5/lib/node/stream.js.map +0 -1
- package/dist/es5/lib/option-utils/merge-loader-options.js +0 -30
- package/dist/es5/lib/option-utils/merge-loader-options.js.map +0 -1
- package/dist/es5/lib/parser-utils/parse-json.js +0 -15
- package/dist/es5/lib/parser-utils/parse-json.js.map +0 -1
- package/dist/es5/lib/path-utils/file-aliases.js +0 -33
- package/dist/es5/lib/path-utils/file-aliases.js.map +0 -1
- package/dist/es5/lib/path-utils/get-cwd.js +0 -15
- package/dist/es5/lib/path-utils/get-cwd.js.map +0 -1
- package/dist/es5/lib/path-utils/path.js +0 -136
- package/dist/es5/lib/path-utils/path.js.map +0 -1
- package/dist/es5/lib/request-utils/request-scheduler.js +0 -150
- package/dist/es5/lib/request-utils/request-scheduler.js.map +0 -1
- package/dist/es5/lib/sources/data-source.js +0 -67
- package/dist/es5/lib/sources/data-source.js.map +0 -1
- package/dist/es5/lib/sources/image-source.js +0 -31
- package/dist/es5/lib/sources/image-source.js.map +0 -1
- package/dist/es5/lib/sources/image-tile-source.js +0 -2
- package/dist/es5/lib/sources/image-tile-source.js.map +0 -1
- package/dist/es5/lib/sources/tile-source.js +0 -2
- package/dist/es5/lib/sources/tile-source.js.map +0 -1
- package/dist/es5/lib/sources/utils/image-type.js +0 -2
- package/dist/es5/lib/sources/utils/image-type.js.map +0 -1
- package/dist/es5/lib/sources/utils/utils.js +0 -36
- package/dist/es5/lib/sources/utils/utils.js.map +0 -1
- package/dist/es5/lib/sources/vector-tile-source.js +0 -2
- package/dist/es5/lib/sources/vector-tile-source.js.map +0 -1
- package/dist/es5/lib/worker-loader-utils/create-loader-worker.js +0 -142
- package/dist/es5/lib/worker-loader-utils/create-loader-worker.js.map +0 -1
- package/dist/es5/lib/worker-loader-utils/encode-with-worker.js +0 -18
- package/dist/es5/lib/worker-loader-utils/encode-with-worker.js.map +0 -1
- package/dist/es5/lib/worker-loader-utils/parse-with-worker.js +0 -115
- package/dist/es5/lib/worker-loader-utils/parse-with-worker.js.map +0 -1
- package/dist/es5/loader-types.js +0 -58
- package/dist/es5/loader-types.js.map +0 -1
- package/dist/es5/service-types.js +0 -2
- package/dist/es5/service-types.js.map +0 -1
- package/dist/es5/types.js +0 -2
- package/dist/es5/types.js.map +0 -1
- package/dist/es5/workers/json-worker.js +0 -6
- package/dist/es5/workers/json-worker.js.map +0 -1
- package/dist/es5/writer-types.js +0 -2
- package/dist/es5/writer-types.js.map +0 -1
- package/dist/esm/index.js +0 -36
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/json-loader.js.map +0 -1
- package/dist/esm/lib/binary-utils/array-buffer-utils.js.map +0 -1
- package/dist/esm/lib/binary-utils/dataview-copy-utils.js.map +0 -1
- package/dist/esm/lib/binary-utils/get-first-characters.js.map +0 -1
- package/dist/esm/lib/binary-utils/memory-conversion-utils.js.map +0 -1
- package/dist/esm/lib/binary-utils/memory-copy-utils.js.map +0 -1
- package/dist/esm/lib/env-utils/assert.js.map +0 -1
- package/dist/esm/lib/env-utils/globals.js.map +0 -1
- package/dist/esm/lib/file-provider/data-view-file.js.map +0 -1
- package/dist/esm/lib/file-provider/file-handle-file.js +0 -59
- package/dist/esm/lib/file-provider/file-handle-file.js.map +0 -1
- package/dist/esm/lib/file-provider/file-handle.js +0 -33
- package/dist/esm/lib/file-provider/file-handle.js.map +0 -1
- package/dist/esm/lib/file-provider/file-provider.js.map +0 -1
- package/dist/esm/lib/filesystems/filesystem.js.map +0 -1
- package/dist/esm/lib/filesystems/node-filesystem.browser.js +0 -42
- package/dist/esm/lib/filesystems/node-filesystem.browser.js.map +0 -1
- package/dist/esm/lib/filesystems/node-filesystem.js +0 -53
- package/dist/esm/lib/filesystems/node-filesystem.js.map +0 -1
- package/dist/esm/lib/filesystems/readable-file.js +0 -20
- package/dist/esm/lib/filesystems/readable-file.js.map +0 -1
- package/dist/esm/lib/filesystems/writable-file.js +0 -20
- package/dist/esm/lib/filesystems/writable-file.js.map +0 -1
- package/dist/esm/lib/iterators/async-iteration.js.map +0 -1
- package/dist/esm/lib/iterators/text-iterators.js.map +0 -1
- package/dist/esm/lib/node/buffer.browser.js.map +0 -1
- package/dist/esm/lib/node/buffer.js.map +0 -1
- package/dist/esm/lib/node/fs.browser.js.map +0 -1
- package/dist/esm/lib/node/fs.js +0 -29
- package/dist/esm/lib/node/fs.js.map +0 -1
- package/dist/esm/lib/node/promisify.js.map +0 -1
- package/dist/esm/lib/node/stream.browser.js.map +0 -1
- package/dist/esm/lib/node/stream.js.map +0 -1
- package/dist/esm/lib/option-utils/merge-loader-options.js.map +0 -1
- package/dist/esm/lib/parser-utils/parse-json.js +0 -9
- package/dist/esm/lib/parser-utils/parse-json.js.map +0 -1
- package/dist/esm/lib/path-utils/file-aliases.js.map +0 -1
- package/dist/esm/lib/path-utils/get-cwd.js.map +0 -1
- package/dist/esm/lib/path-utils/path.js.map +0 -1
- package/dist/esm/lib/request-utils/request-scheduler.js.map +0 -1
- package/dist/esm/lib/sources/data-source.js.map +0 -1
- package/dist/esm/lib/sources/image-source.js +0 -6
- package/dist/esm/lib/sources/image-source.js.map +0 -1
- package/dist/esm/lib/sources/image-tile-source.js.map +0 -1
- package/dist/esm/lib/sources/tile-source.js.map +0 -1
- package/dist/esm/lib/sources/utils/image-type.js.map +0 -1
- package/dist/esm/lib/sources/utils/utils.js.map +0 -1
- package/dist/esm/lib/sources/vector-tile-source.js.map +0 -1
- package/dist/esm/lib/worker-loader-utils/create-loader-worker.js.map +0 -1
- package/dist/esm/lib/worker-loader-utils/encode-with-worker.js.map +0 -1
- package/dist/esm/lib/worker-loader-utils/parse-with-worker.js.map +0 -1
- package/dist/esm/loader-types.js.map +0 -1
- package/dist/esm/service-types.js.map +0 -1
- package/dist/esm/types.js.map +0 -1
- package/dist/esm/workers/json-worker.js +0 -4
- package/dist/esm/workers/json-worker.js.map +0 -1
- package/dist/esm/writer-types.js.map +0 -1
- package/dist/lib/file-provider/file-handle.d.ts +0 -40
- package/dist/lib/file-provider/file-handle.d.ts.map +0 -1
- package/dist/lib/filesystems/node-filesystem.browser.d.ts +0 -39
- package/dist/lib/filesystems/node-filesystem.browser.d.ts.map +0 -1
- package/dist/lib/filesystems/node-filesystem.d.ts +0 -39
- package/dist/lib/filesystems/node-filesystem.d.ts.map +0 -1
- package/dist/lib/filesystems/readable-file.d.ts +0 -10
- package/dist/lib/filesystems/readable-file.d.ts.map +0 -1
- package/dist/lib/filesystems/writable-file.d.ts +0 -18
- package/dist/lib/filesystems/writable-file.d.ts.map +0 -1
- package/dist/lib/node/fs.d.ts +0 -30
- package/dist/lib/node/fs.d.ts.map +0 -1
- package/src/lib/file-provider/file-handle.ts +0 -79
- package/src/lib/filesystems/node-filesystem.browser.ts +0 -61
- package/src/lib/filesystems/node-filesystem.ts +0 -79
- package/src/lib/filesystems/readable-file.ts +0 -30
- package/src/lib/filesystems/writable-file.ts +0 -44
- package/src/lib/node/fs.ts +0 -49
- /package/dist/{esm/lib → lib}/binary-utils/array-buffer-utils.js +0 -0
- /package/dist/{esm/lib → lib}/binary-utils/get-first-characters.js +0 -0
- /package/dist/{esm/lib → lib}/env-utils/assert.js +0 -0
- /package/dist/{esm/lib → lib}/env-utils/globals.js +0 -0
- /package/dist/{esm/lib → lib}/file-provider/file-provider.js +0 -0
- /package/dist/{esm/lib → lib}/filesystems/filesystem.js +0 -0
- /package/dist/{esm/lib → lib}/iterators/text-iterators.js +0 -0
- /package/dist/{esm/lib → lib}/node/buffer.browser.js +0 -0
- /package/dist/{esm/lib → lib}/node/buffer.js +0 -0
- /package/dist/{esm/lib → lib}/node/fs.browser.js +0 -0
- /package/dist/{esm/lib → lib}/node/promisify.js +0 -0
- /package/dist/{esm/lib → lib}/node/stream.browser.js +0 -0
- /package/dist/{esm/lib → lib}/node/stream.js +0 -0
- /package/dist/{esm/lib → lib}/option-utils/merge-loader-options.js +0 -0
- /package/dist/{esm/lib → lib}/path-utils/get-cwd.js +0 -0
- /package/dist/{esm/lib → lib}/sources/image-tile-source.js +0 -0
- /package/dist/{esm/lib → lib}/sources/tile-source.js +0 -0
- /package/dist/{esm/lib → lib}/sources/utils/image-type.js +0 -0
- /package/dist/{esm/lib → lib}/sources/utils/utils.js +0 -0
- /package/dist/{esm/lib → lib}/sources/vector-tile-source.js +0 -0
- /package/dist/{esm/loader-types.js → loader-types.js} +0 -0
- /package/dist/{esm/service-types.js → service-types.js} +0 -0
- /package/dist/{esm/types.js → types.js} +0 -0
- /package/dist/{esm/writer-types.js → writer-types.js} +0 -0
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.addAliases = addAliases;
|
|
7
|
-
exports.getPathPrefix = getPathPrefix;
|
|
8
|
-
exports.resolvePath = resolvePath;
|
|
9
|
-
exports.setPathPrefix = setPathPrefix;
|
|
10
|
-
var pathPrefix = '';
|
|
11
|
-
var fileAliases = {};
|
|
12
|
-
function setPathPrefix(prefix) {
|
|
13
|
-
pathPrefix = prefix;
|
|
14
|
-
}
|
|
15
|
-
function getPathPrefix() {
|
|
16
|
-
return pathPrefix;
|
|
17
|
-
}
|
|
18
|
-
function addAliases(aliases) {
|
|
19
|
-
Object.assign(fileAliases, aliases);
|
|
20
|
-
}
|
|
21
|
-
function resolvePath(filename) {
|
|
22
|
-
for (var alias in fileAliases) {
|
|
23
|
-
if (filename.startsWith(alias)) {
|
|
24
|
-
var replacement = fileAliases[alias];
|
|
25
|
-
filename = filename.replace(alias, replacement);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
if (!filename.startsWith('http://') && !filename.startsWith('https://')) {
|
|
29
|
-
filename = "".concat(pathPrefix).concat(filename);
|
|
30
|
-
}
|
|
31
|
-
return filename;
|
|
32
|
-
}
|
|
33
|
-
//# sourceMappingURL=file-aliases.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"file-aliases.js","names":["pathPrefix","fileAliases","setPathPrefix","prefix","getPathPrefix","addAliases","aliases","Object","assign","resolvePath","filename","alias","startsWith","replacement","replace","concat"],"sources":["../../../../src/lib/path-utils/file-aliases.ts"],"sourcesContent":["// Simple file alias mechanisms for tests.\n\nlet pathPrefix = '';\nconst fileAliases: {[aliasPath: string]: string} = {};\n\n/*\n * Set a relative path prefix\n */\nexport function setPathPrefix(prefix: string): void {\n pathPrefix = prefix;\n}\n\n/*\n * Get the relative path prefix\n */\nexport function getPathPrefix(): string {\n return pathPrefix;\n}\n\n/**\n *\n * @param aliases\n *\n * Note: addAliases are an experimental export, they are only for testing of loaders.gl loaders\n * not intended as a generic aliasing mechanism\n */\nexport function addAliases(aliases: {[aliasPath: string]: string}): void {\n Object.assign(fileAliases, aliases);\n}\n\n/**\n * Resolves aliases and adds path-prefix to paths\n */\nexport function resolvePath(filename: string): string {\n for (const alias in fileAliases) {\n if (filename.startsWith(alias)) {\n const replacement = fileAliases[alias];\n filename = filename.replace(alias, replacement);\n }\n }\n if (!filename.startsWith('http://') && !filename.startsWith('https://')) {\n filename = `${pathPrefix}${filename}`;\n }\n return filename;\n}\n"],"mappings":";;;;;;;;;AAEA,IAAIA,UAAU,GAAG,EAAE;AACnB,IAAMC,WAA0C,GAAG,CAAC,CAAC;AAK9C,SAASC,aAAaA,CAACC,MAAc,EAAQ;EAClDH,UAAU,GAAGG,MAAM;AACrB;AAKO,SAASC,aAAaA,CAAA,EAAW;EACtC,OAAOJ,UAAU;AACnB;AASO,SAASK,UAAUA,CAACC,OAAsC,EAAQ;EACvEC,MAAM,CAACC,MAAM,CAACP,WAAW,EAAEK,OAAO,CAAC;AACrC;AAKO,SAASG,WAAWA,CAACC,QAAgB,EAAU;EACpD,KAAK,IAAMC,KAAK,IAAIV,WAAW,EAAE;IAC/B,IAAIS,QAAQ,CAACE,UAAU,CAACD,KAAK,CAAC,EAAE;MAC9B,IAAME,WAAW,GAAGZ,WAAW,CAACU,KAAK,CAAC;MACtCD,QAAQ,GAAGA,QAAQ,CAACI,OAAO,CAACH,KAAK,EAAEE,WAAW,CAAC;IACjD;EACF;EACA,IAAI,CAACH,QAAQ,CAACE,UAAU,CAAC,SAAS,CAAC,IAAI,CAACF,QAAQ,CAACE,UAAU,CAAC,UAAU,CAAC,EAAE;IACvEF,QAAQ,MAAAK,MAAA,CAAMf,UAAU,EAAAe,MAAA,CAAGL,QAAQ,CAAE;EACvC;EACA,OAAOA,QAAQ;AACjB"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.getCWD = getCWD;
|
|
7
|
-
function getCWD() {
|
|
8
|
-
var _window$location;
|
|
9
|
-
if (typeof process !== 'undefined' && typeof process.cwd !== 'undefined') {
|
|
10
|
-
return process.cwd();
|
|
11
|
-
}
|
|
12
|
-
var pathname = (_window$location = window.location) === null || _window$location === void 0 ? void 0 : _window$location.pathname;
|
|
13
|
-
return (pathname === null || pathname === void 0 ? void 0 : pathname.slice(0, pathname.lastIndexOf('/') + 1)) || '';
|
|
14
|
-
}
|
|
15
|
-
//# sourceMappingURL=get-cwd.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"get-cwd.js","names":["getCWD","_window$location","process","cwd","pathname","window","location","slice","lastIndexOf"],"sources":["../../../../src/lib/path-utils/get-cwd.ts"],"sourcesContent":["// loaders.gl MIT license\n\nexport function getCWD() {\n if (typeof process !== 'undefined' && typeof process.cwd !== 'undefined') {\n return process.cwd();\n }\n const pathname = window.location?.pathname;\n return pathname?.slice(0, pathname.lastIndexOf('/') + 1) || '';\n}\n"],"mappings":";;;;;;AAEO,SAASA,MAAMA,CAAA,EAAG;EAAA,IAAAC,gBAAA;EACvB,IAAI,OAAOC,OAAO,KAAK,WAAW,IAAI,OAAOA,OAAO,CAACC,GAAG,KAAK,WAAW,EAAE;IACxE,OAAOD,OAAO,CAACC,GAAG,CAAC,CAAC;EACtB;EACA,IAAMC,QAAQ,IAAAH,gBAAA,GAAGI,MAAM,CAACC,QAAQ,cAAAL,gBAAA,uBAAfA,gBAAA,CAAiBG,QAAQ;EAC1C,OAAO,CAAAA,QAAQ,aAARA,QAAQ,uBAARA,QAAQ,CAAEG,KAAK,CAAC,CAAC,EAAEH,QAAQ,CAACI,WAAW,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,KAAI,EAAE;AAChE"}
|
|
@@ -1,136 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.dirname = dirname;
|
|
7
|
-
exports.filename = filename;
|
|
8
|
-
exports.join = join;
|
|
9
|
-
exports.resolve = resolve;
|
|
10
|
-
var _getCwd = require("./get-cwd");
|
|
11
|
-
function filename(url) {
|
|
12
|
-
var slashIndex = url ? url.lastIndexOf('/') : -1;
|
|
13
|
-
return slashIndex >= 0 ? url.substr(slashIndex + 1) : '';
|
|
14
|
-
}
|
|
15
|
-
function dirname(url) {
|
|
16
|
-
var slashIndex = url ? url.lastIndexOf('/') : -1;
|
|
17
|
-
return slashIndex >= 0 ? url.substr(0, slashIndex) : '';
|
|
18
|
-
}
|
|
19
|
-
function join() {
|
|
20
|
-
for (var _len = arguments.length, parts = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
21
|
-
parts[_key] = arguments[_key];
|
|
22
|
-
}
|
|
23
|
-
var separator = '/';
|
|
24
|
-
parts = parts.map(function (part, index) {
|
|
25
|
-
if (index) {
|
|
26
|
-
part = part.replace(new RegExp("^".concat(separator)), '');
|
|
27
|
-
}
|
|
28
|
-
if (index !== parts.length - 1) {
|
|
29
|
-
part = part.replace(new RegExp("".concat(separator, "$")), '');
|
|
30
|
-
}
|
|
31
|
-
return part;
|
|
32
|
-
});
|
|
33
|
-
return parts.join(separator);
|
|
34
|
-
}
|
|
35
|
-
function resolve() {
|
|
36
|
-
var paths = [];
|
|
37
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
38
|
-
paths[_i] = _i < 0 || arguments.length <= _i ? undefined : arguments[_i];
|
|
39
|
-
}
|
|
40
|
-
var resolvedPath = '';
|
|
41
|
-
var resolvedAbsolute = false;
|
|
42
|
-
var cwd;
|
|
43
|
-
for (var i = paths.length - 1; i >= -1 && !resolvedAbsolute; i--) {
|
|
44
|
-
var path = void 0;
|
|
45
|
-
if (i >= 0) {
|
|
46
|
-
path = paths[i];
|
|
47
|
-
} else {
|
|
48
|
-
if (cwd === undefined) {
|
|
49
|
-
cwd = (0, _getCwd.getCWD)();
|
|
50
|
-
}
|
|
51
|
-
path = cwd;
|
|
52
|
-
}
|
|
53
|
-
if (path.length === 0) {
|
|
54
|
-
continue;
|
|
55
|
-
}
|
|
56
|
-
resolvedPath = "".concat(path, "/").concat(resolvedPath);
|
|
57
|
-
resolvedAbsolute = path.charCodeAt(0) === SLASH;
|
|
58
|
-
}
|
|
59
|
-
resolvedPath = normalizeStringPosix(resolvedPath, !resolvedAbsolute);
|
|
60
|
-
if (resolvedAbsolute) {
|
|
61
|
-
return "/".concat(resolvedPath);
|
|
62
|
-
} else if (resolvedPath.length > 0) {
|
|
63
|
-
return resolvedPath;
|
|
64
|
-
}
|
|
65
|
-
return '.';
|
|
66
|
-
}
|
|
67
|
-
var SLASH = 47;
|
|
68
|
-
var DOT = 46;
|
|
69
|
-
function normalizeStringPosix(path, allowAboveRoot) {
|
|
70
|
-
var res = '';
|
|
71
|
-
var lastSlash = -1;
|
|
72
|
-
var dots = 0;
|
|
73
|
-
var code;
|
|
74
|
-
var isAboveRoot = false;
|
|
75
|
-
for (var i = 0; i <= path.length; ++i) {
|
|
76
|
-
if (i < path.length) {
|
|
77
|
-
code = path.charCodeAt(i);
|
|
78
|
-
} else if (code === SLASH) {
|
|
79
|
-
break;
|
|
80
|
-
} else {
|
|
81
|
-
code = SLASH;
|
|
82
|
-
}
|
|
83
|
-
if (code === SLASH) {
|
|
84
|
-
if (lastSlash === i - 1 || dots === 1) {} else if (lastSlash !== i - 1 && dots === 2) {
|
|
85
|
-
if (res.length < 2 || !isAboveRoot || res.charCodeAt(res.length - 1) !== DOT || res.charCodeAt(res.length - 2) !== DOT) {
|
|
86
|
-
if (res.length > 2) {
|
|
87
|
-
var start = res.length - 1;
|
|
88
|
-
var j = start;
|
|
89
|
-
for (; j >= 0; --j) {
|
|
90
|
-
if (res.charCodeAt(j) === SLASH) {
|
|
91
|
-
break;
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
if (j !== start) {
|
|
95
|
-
res = j === -1 ? '' : res.slice(0, j);
|
|
96
|
-
lastSlash = i;
|
|
97
|
-
dots = 0;
|
|
98
|
-
isAboveRoot = false;
|
|
99
|
-
continue;
|
|
100
|
-
}
|
|
101
|
-
} else if (res.length === 2 || res.length === 1) {
|
|
102
|
-
res = '';
|
|
103
|
-
lastSlash = i;
|
|
104
|
-
dots = 0;
|
|
105
|
-
isAboveRoot = false;
|
|
106
|
-
continue;
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
if (allowAboveRoot) {
|
|
110
|
-
if (res.length > 0) {
|
|
111
|
-
res += '/..';
|
|
112
|
-
} else {
|
|
113
|
-
res = '..';
|
|
114
|
-
}
|
|
115
|
-
isAboveRoot = true;
|
|
116
|
-
}
|
|
117
|
-
} else {
|
|
118
|
-
var slice = path.slice(lastSlash + 1, i);
|
|
119
|
-
if (res.length > 0) {
|
|
120
|
-
res += "/".concat(slice);
|
|
121
|
-
} else {
|
|
122
|
-
res = slice;
|
|
123
|
-
}
|
|
124
|
-
isAboveRoot = false;
|
|
125
|
-
}
|
|
126
|
-
lastSlash = i;
|
|
127
|
-
dots = 0;
|
|
128
|
-
} else if (code === DOT && dots !== -1) {
|
|
129
|
-
++dots;
|
|
130
|
-
} else {
|
|
131
|
-
dots = -1;
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
return res;
|
|
135
|
-
}
|
|
136
|
-
//# sourceMappingURL=path.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"path.js","names":["_getCwd","require","filename","url","slashIndex","lastIndexOf","substr","dirname","join","_len","arguments","length","parts","Array","_key","separator","map","part","index","replace","RegExp","concat","resolve","paths","_i","undefined","resolvedPath","resolvedAbsolute","cwd","i","path","getCWD","charCodeAt","SLASH","normalizeStringPosix","DOT","allowAboveRoot","res","lastSlash","dots","code","isAboveRoot","start","j","slice"],"sources":["../../../../src/lib/path-utils/path.ts"],"sourcesContent":["// Beginning of a minimal implementation of the Node.js path API, that doesn't pull in big polyfills.\n\nimport {getCWD} from './get-cwd';\n\n/**\n * Replacement for Node.js path.filename\n * @param url\n */\nexport function filename(url: string): string {\n const slashIndex = url ? url.lastIndexOf('/') : -1;\n return slashIndex >= 0 ? url.substr(slashIndex + 1) : '';\n}\n\n/**\n * Replacement for Node.js path.dirname\n * @param url\n */\nexport function dirname(url: string): string {\n const slashIndex = url ? url.lastIndexOf('/') : -1;\n return slashIndex >= 0 ? url.substr(0, slashIndex) : '';\n}\n\n/**\n * Replacement for Node.js path.join\n * @param parts\n */\nexport function join(...parts: string[]): string {\n const separator = '/';\n parts = parts.map((part, index) => {\n if (index) {\n part = part.replace(new RegExp(`^${separator}`), '');\n }\n if (index !== parts.length - 1) {\n part = part.replace(new RegExp(`${separator}$`), '');\n }\n return part;\n });\n return parts.join(separator);\n}\n\n/* eslint-disable no-continue */\n\n/**\n * https://nodejs.org/api/path.html#path_path_resolve_paths\n * @param paths A sequence of paths or path segments.\n * @return resolved path\n * Forked from BTOdell/path-resolve under MIT license\n * @see https://github.com/BTOdell/path-resolve/blob/master/LICENSE\n */\nexport function resolve(...components: string[]): string {\n const paths: string[] = [];\n for (let _i = 0; _i < components.length; _i++) {\n paths[_i] = components[_i];\n }\n let resolvedPath = '';\n let resolvedAbsolute = false;\n let cwd: string | undefined;\n for (let i = paths.length - 1; i >= -1 && !resolvedAbsolute; i--) {\n let path: string | undefined;\n if (i >= 0) {\n path = paths[i];\n } else {\n if (cwd === undefined) {\n cwd = getCWD();\n }\n path = cwd;\n }\n // Skip empty entries\n if (path.length === 0) {\n continue;\n }\n resolvedPath = `${path}/${resolvedPath}`;\n resolvedAbsolute = path.charCodeAt(0) === SLASH;\n }\n // At this point the path should be resolved to a full absolute path, but\n // handle relative paths to be safe (might happen when process.cwd() fails)\n // Normalize the path (removes leading slash)\n resolvedPath = normalizeStringPosix(resolvedPath, !resolvedAbsolute);\n if (resolvedAbsolute) {\n return `/${resolvedPath}`;\n } else if (resolvedPath.length > 0) {\n return resolvedPath;\n }\n return '.';\n}\n\nconst SLASH = 47;\nconst DOT = 46;\n\n/**\n * Resolves . and .. elements in a path with directory names\n * Forked from BTOdell/path-resolve under MIT license\n * @see https://github.com/BTOdell/path-resolve/blob/master/LICENSE\n */\n/* eslint-disable max-depth */\n// eslint-disable-next-line complexity, max-statements\nfunction normalizeStringPosix(path: string, allowAboveRoot: boolean): string {\n let res = '';\n let lastSlash = -1;\n let dots = 0;\n let code: number | undefined;\n let isAboveRoot = false;\n\n for (let i = 0; i <= path.length; ++i) {\n if (i < path.length) {\n code = path.charCodeAt(i);\n } else if (code === SLASH) {\n break;\n } else {\n code = SLASH;\n }\n if (code === SLASH) {\n if (lastSlash === i - 1 || dots === 1) {\n // NOOP\n } else if (lastSlash !== i - 1 && dots === 2) {\n if (\n res.length < 2 ||\n !isAboveRoot ||\n res.charCodeAt(res.length - 1) !== DOT ||\n res.charCodeAt(res.length - 2) !== DOT\n ) {\n if (res.length > 2) {\n const start = res.length - 1;\n let j = start;\n for (; j >= 0; --j) {\n if (res.charCodeAt(j) === SLASH) {\n break;\n }\n }\n if (j !== start) {\n res = j === -1 ? '' : res.slice(0, j);\n lastSlash = i;\n dots = 0;\n isAboveRoot = false;\n continue;\n }\n } else if (res.length === 2 || res.length === 1) {\n res = '';\n lastSlash = i;\n dots = 0;\n isAboveRoot = false;\n continue;\n }\n }\n if (allowAboveRoot) {\n if (res.length > 0) {\n res += '/..';\n } else {\n res = '..';\n }\n isAboveRoot = true;\n }\n } else {\n const slice = path.slice(lastSlash + 1, i);\n if (res.length > 0) {\n res += `/${slice}`;\n } else {\n res = slice;\n }\n isAboveRoot = false;\n }\n lastSlash = i;\n dots = 0;\n } else if (code === DOT && dots !== -1) {\n ++dots;\n } else {\n dots = -1;\n }\n }\n return res;\n}\n"],"mappings":";;;;;;;;;AAEA,IAAAA,OAAA,GAAAC,OAAA;AAMO,SAASC,QAAQA,CAACC,GAAW,EAAU;EAC5C,IAAMC,UAAU,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3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.default = void 0;
|
|
8
|
-
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
9
|
-
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
10
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
|
-
var _stats = require("@probe.gl/stats");
|
|
12
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
13
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
14
|
-
var STAT_QUEUED_REQUESTS = 'Queued Requests';
|
|
15
|
-
var STAT_ACTIVE_REQUESTS = 'Active Requests';
|
|
16
|
-
var STAT_CANCELLED_REQUESTS = 'Cancelled Requests';
|
|
17
|
-
var STAT_QUEUED_REQUESTS_EVER = 'Queued Requests Ever';
|
|
18
|
-
var STAT_ACTIVE_REQUESTS_EVER = 'Active Requests Ever';
|
|
19
|
-
var DEFAULT_PROPS = {
|
|
20
|
-
id: 'request-scheduler',
|
|
21
|
-
throttleRequests: true,
|
|
22
|
-
maxRequests: 6
|
|
23
|
-
};
|
|
24
|
-
var RequestScheduler = function () {
|
|
25
|
-
function RequestScheduler() {
|
|
26
|
-
var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
27
|
-
(0, _classCallCheck2.default)(this, RequestScheduler);
|
|
28
|
-
(0, _defineProperty2.default)(this, "props", void 0);
|
|
29
|
-
(0, _defineProperty2.default)(this, "stats", void 0);
|
|
30
|
-
(0, _defineProperty2.default)(this, "activeRequestCount", 0);
|
|
31
|
-
(0, _defineProperty2.default)(this, "requestQueue", []);
|
|
32
|
-
(0, _defineProperty2.default)(this, "requestMap", new Map());
|
|
33
|
-
(0, _defineProperty2.default)(this, "deferredUpdate", null);
|
|
34
|
-
this.props = _objectSpread(_objectSpread({}, DEFAULT_PROPS), props);
|
|
35
|
-
this.stats = new _stats.Stats({
|
|
36
|
-
id: this.props.id
|
|
37
|
-
});
|
|
38
|
-
this.stats.get(STAT_QUEUED_REQUESTS);
|
|
39
|
-
this.stats.get(STAT_ACTIVE_REQUESTS);
|
|
40
|
-
this.stats.get(STAT_CANCELLED_REQUESTS);
|
|
41
|
-
this.stats.get(STAT_QUEUED_REQUESTS_EVER);
|
|
42
|
-
this.stats.get(STAT_ACTIVE_REQUESTS_EVER);
|
|
43
|
-
}
|
|
44
|
-
(0, _createClass2.default)(RequestScheduler, [{
|
|
45
|
-
key: "scheduleRequest",
|
|
46
|
-
value: function scheduleRequest(handle) {
|
|
47
|
-
var getPriority = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : function () {
|
|
48
|
-
return 0;
|
|
49
|
-
};
|
|
50
|
-
if (!this.props.throttleRequests) {
|
|
51
|
-
return Promise.resolve({
|
|
52
|
-
done: function done() {}
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
if (this.requestMap.has(handle)) {
|
|
56
|
-
return this.requestMap.get(handle);
|
|
57
|
-
}
|
|
58
|
-
var request = {
|
|
59
|
-
handle: handle,
|
|
60
|
-
priority: 0,
|
|
61
|
-
getPriority: getPriority
|
|
62
|
-
};
|
|
63
|
-
var promise = new Promise(function (resolve) {
|
|
64
|
-
request.resolve = resolve;
|
|
65
|
-
return request;
|
|
66
|
-
});
|
|
67
|
-
this.requestQueue.push(request);
|
|
68
|
-
this.requestMap.set(handle, promise);
|
|
69
|
-
this._issueNewRequests();
|
|
70
|
-
return promise;
|
|
71
|
-
}
|
|
72
|
-
}, {
|
|
73
|
-
key: "_issueRequest",
|
|
74
|
-
value: function _issueRequest(request) {
|
|
75
|
-
var _this = this;
|
|
76
|
-
var handle = request.handle,
|
|
77
|
-
resolve = request.resolve;
|
|
78
|
-
var isDone = false;
|
|
79
|
-
var done = function done() {
|
|
80
|
-
if (!isDone) {
|
|
81
|
-
isDone = true;
|
|
82
|
-
_this.requestMap.delete(handle);
|
|
83
|
-
_this.activeRequestCount--;
|
|
84
|
-
_this._issueNewRequests();
|
|
85
|
-
}
|
|
86
|
-
};
|
|
87
|
-
this.activeRequestCount++;
|
|
88
|
-
return resolve ? resolve({
|
|
89
|
-
done: done
|
|
90
|
-
}) : Promise.resolve({
|
|
91
|
-
done: done
|
|
92
|
-
});
|
|
93
|
-
}
|
|
94
|
-
}, {
|
|
95
|
-
key: "_issueNewRequests",
|
|
96
|
-
value: function _issueNewRequests() {
|
|
97
|
-
var _this2 = this;
|
|
98
|
-
if (!this.deferredUpdate) {
|
|
99
|
-
this.deferredUpdate = setTimeout(function () {
|
|
100
|
-
return _this2._issueNewRequestsAsync();
|
|
101
|
-
}, 0);
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
}, {
|
|
105
|
-
key: "_issueNewRequestsAsync",
|
|
106
|
-
value: function _issueNewRequestsAsync() {
|
|
107
|
-
this.deferredUpdate = null;
|
|
108
|
-
var freeSlots = Math.max(this.props.maxRequests - this.activeRequestCount, 0);
|
|
109
|
-
if (freeSlots === 0) {
|
|
110
|
-
return;
|
|
111
|
-
}
|
|
112
|
-
this._updateAllRequests();
|
|
113
|
-
for (var i = 0; i < freeSlots; ++i) {
|
|
114
|
-
var request = this.requestQueue.shift();
|
|
115
|
-
if (request) {
|
|
116
|
-
this._issueRequest(request);
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
}, {
|
|
121
|
-
key: "_updateAllRequests",
|
|
122
|
-
value: function _updateAllRequests() {
|
|
123
|
-
var requestQueue = this.requestQueue;
|
|
124
|
-
for (var i = 0; i < requestQueue.length; ++i) {
|
|
125
|
-
var request = requestQueue[i];
|
|
126
|
-
if (!this._updateRequest(request)) {
|
|
127
|
-
requestQueue.splice(i, 1);
|
|
128
|
-
this.requestMap.delete(request.handle);
|
|
129
|
-
i--;
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
requestQueue.sort(function (a, b) {
|
|
133
|
-
return a.priority - b.priority;
|
|
134
|
-
});
|
|
135
|
-
}
|
|
136
|
-
}, {
|
|
137
|
-
key: "_updateRequest",
|
|
138
|
-
value: function _updateRequest(request) {
|
|
139
|
-
request.priority = request.getPriority(request.handle);
|
|
140
|
-
if (request.priority < 0) {
|
|
141
|
-
request.resolve(null);
|
|
142
|
-
return false;
|
|
143
|
-
}
|
|
144
|
-
return true;
|
|
145
|
-
}
|
|
146
|
-
}]);
|
|
147
|
-
return RequestScheduler;
|
|
148
|
-
}();
|
|
149
|
-
exports.default = RequestScheduler;
|
|
150
|
-
//# sourceMappingURL=request-scheduler.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"request-scheduler.js","names":["_stats","require","ownKeys","object","enumerableOnly","keys","Object","getOwnPropertySymbols","symbols","filter","sym","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","target","i","arguments","length","source","forEach","key","_defineProperty2","default","getOwnPropertyDescriptors","defineProperties","defineProperty","STAT_QUEUED_REQUESTS","STAT_ACTIVE_REQUESTS","STAT_CANCELLED_REQUESTS","STAT_QUEUED_REQUESTS_EVER","STAT_ACTIVE_REQUESTS_EVER","DEFAULT_PROPS","id","throttleRequests","maxRequests","RequestScheduler","props","undefined","_classCallCheck2","Map","stats","Stats","get","_createClass2","value","scheduleRequest","handle","getPriority","Promise","resolve","done","requestMap","has","request","priority","promise","requestQueue","set","_issueNewRequests","_issueRequest","_this","isDone","delete","activeRequestCount","_this2","deferredUpdate","setTimeout","_issueNewRequestsAsync","freeSlots","Math","max","_updateAllRequests","shift","_updateRequest","splice","sort","a","b","exports"],"sources":["../../../../src/lib/request-utils/request-scheduler.ts"],"sourcesContent":["import {Stats} from '@probe.gl/stats';\n\ntype Handle = any;\ntype DoneFunction = () => any;\ntype GetPriorityFunction = () => number;\ntype RequestResult = {\n done: DoneFunction;\n} | null;\n\n/** RequestScheduler Options */\nexport type RequestSchedulerProps = {\n id?: string;\n throttleRequests?: boolean;\n maxRequests?: number;\n};\n\nconst STAT_QUEUED_REQUESTS = 'Queued Requests';\nconst STAT_ACTIVE_REQUESTS = 'Active Requests';\nconst STAT_CANCELLED_REQUESTS = 'Cancelled Requests';\nconst STAT_QUEUED_REQUESTS_EVER = 'Queued Requests Ever';\nconst STAT_ACTIVE_REQUESTS_EVER = 'Active Requests Ever';\n\nconst DEFAULT_PROPS: Required<RequestSchedulerProps> = {\n id: 'request-scheduler',\n // Specifies if the request scheduler should throttle incoming requests, mainly for comparative testing\n throttleRequests: true,\n // The maximum number of simultaneous active requests. Un-throttled requests do not observe this limit.\n maxRequests: 6\n};\n\n/** Tracks one request */\ntype Request = {\n handle: Handle;\n priority: number;\n getPriority: GetPriorityFunction;\n resolve?: (value: any) => any;\n};\n\n/**\n * Used to issue a request, without having them \"deeply queued\" by the browser.\n * @todo - Track requests globally, across multiple servers\n */\nexport default class RequestScheduler {\n readonly props: Required<RequestSchedulerProps>;\n readonly stats: Stats;\n activeRequestCount: number = 0;\n\n /** Tracks the number of active requests and prioritizes/cancels queued requests. */\n private requestQueue: Request[] = [];\n private requestMap: Map<Handle, Promise<RequestResult>> = new Map();\n private deferredUpdate: any = null;\n\n constructor(props: RequestSchedulerProps = {}) {\n this.props = {...DEFAULT_PROPS, ...props};\n\n // Returns the statistics used by the request scheduler.\n this.stats = new Stats({id: this.props.id});\n this.stats.get(STAT_QUEUED_REQUESTS);\n this.stats.get(STAT_ACTIVE_REQUESTS);\n this.stats.get(STAT_CANCELLED_REQUESTS);\n this.stats.get(STAT_QUEUED_REQUESTS_EVER);\n this.stats.get(STAT_ACTIVE_REQUESTS_EVER);\n }\n\n /**\n * Called by an application that wants to issue a request, without having it deeply queued by the browser\n *\n * When the returned promise resolved, it is OK for the application to issue a request.\n * The promise resolves to an object that contains a `done` method.\n * When the application's request has completed (or failed), the application must call the `done` function\n *\n * @param handle\n * @param getPriority will be called when request \"slots\" open up,\n * allowing the caller to update priority or cancel the request\n * Highest priority executes first, priority < 0 cancels the request\n * @returns a promise\n * - resolves to a object (with a `done` field) when the request can be issued without queueing,\n * - resolves to `null` if the request has been cancelled (by the callback return < 0).\n * In this case the application should not issue the request\n */\n scheduleRequest(\n handle: Handle,\n getPriority: GetPriorityFunction = () => 0\n ): Promise<RequestResult> {\n // Allows throttling to be disabled\n if (!this.props.throttleRequests) {\n return Promise.resolve({done: () => {}});\n }\n\n // dedupe\n if (this.requestMap.has(handle)) {\n return this.requestMap.get(handle) as Promise<any>;\n }\n\n const request: Request = {handle, priority: 0, getPriority};\n const promise = new Promise<RequestResult>((resolve) => {\n // @ts-ignore\n request.resolve = resolve;\n return request;\n });\n\n this.requestQueue.push(request);\n this.requestMap.set(handle, promise);\n this._issueNewRequests();\n return promise;\n }\n\n // PRIVATE\n\n _issueRequest(request: Request): Promise<any> {\n const {handle, resolve} = request;\n let isDone = false;\n\n const done = () => {\n // can only be called once\n if (!isDone) {\n isDone = true;\n\n // Stop tracking a request - it has completed, failed, cancelled etc\n this.requestMap.delete(handle);\n this.activeRequestCount--;\n // A slot just freed up, see if any queued requests are waiting\n this._issueNewRequests();\n }\n };\n\n // Track this request\n this.activeRequestCount++;\n\n return resolve ? resolve({done}) : Promise.resolve({done});\n }\n\n /** We check requests asynchronously, to prevent multiple updates */\n _issueNewRequests(): void {\n if (!this.deferredUpdate) {\n this.deferredUpdate = setTimeout(() => this._issueNewRequestsAsync(), 0);\n }\n }\n\n /** Refresh all requests */\n _issueNewRequestsAsync() {\n // TODO - shouldn't we clear the timeout?\n this.deferredUpdate = null;\n\n const freeSlots = Math.max(this.props.maxRequests - this.activeRequestCount, 0);\n\n if (freeSlots === 0) {\n return;\n }\n\n this._updateAllRequests();\n\n // Resolve pending promises for the top-priority requests\n for (let i = 0; i < freeSlots; ++i) {\n const request = this.requestQueue.shift();\n if (request) {\n this._issueRequest(request); // eslint-disable-line @typescript-eslint/no-floating-promises\n }\n }\n\n // Uncomment to debug\n // console.log(`${freeSlots} free slots, ${this.requestQueue.length} queued requests`);\n }\n\n /** Ensure all requests have updated priorities, and that no longer valid requests are cancelled */\n _updateAllRequests() {\n const requestQueue = this.requestQueue;\n for (let i = 0; i < requestQueue.length; ++i) {\n const request = requestQueue[i];\n if (!this._updateRequest(request)) {\n // Remove the element and make sure to adjust the counter to account for shortened array\n requestQueue.splice(i, 1);\n this.requestMap.delete(request.handle);\n i--;\n }\n }\n\n // Sort the remaining requests based on priority\n requestQueue.sort((a, b) => a.priority - b.priority);\n }\n\n /** Update a single request by calling the callback */\n _updateRequest(request) {\n request.priority = request.getPriority(request.handle); // eslint-disable-line callback-return\n\n // by returning a negative priority, the callback cancels the request\n if (request.priority < 0) {\n request.resolve(null);\n return false;\n }\n return true;\n }\n}\n"],"mappings":";;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAAsC,SAAAC,QAAAC,MAAA,EAAAC,cAAA,QAAAC,IAAA,GAAAC,MAAA,CAAAD,IAAA,CAAAF,MAAA,OAAAG,MAAA,CAAAC,qBAAA,QAAAC,OAAA,GAAAF,MAAA,CAAAC,qBAAA,CAAAJ,MAAA,GAAAC,cAAA,KAAAI,OAAA,GAAAA,OAAA,CAAAC,MAAA,WAAAC,GAAA,WAAAJ,MAAA,CAAAK,wBAAA,CAAAR,MAAA,EAAAO,GAAA,EAAAE,UAAA,OA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ACmB,IAAI,CAAC,UAACC,CAAC,EAAEC,CAAC;QAAA,OAAKD,CAAC,CAACtB,QAAQ,GAAGuB,CAAC,CAACvB,QAAQ;MAAA,EAAC;IACtD;EAAC;IAAAlC,GAAA;IAAAwB,KAAA,EAGD,SAAA6B,eAAepB,OAAO,EAAE;MACtBA,OAAO,CAACC,QAAQ,GAAGD,OAAO,CAACN,WAAW,CAACM,OAAO,CAACP,MAAM,CAAC;MAGtD,IAAIO,OAAO,CAACC,QAAQ,GAAG,CAAC,EAAE;QACxBD,OAAO,CAACJ,OAAO,CAAC,IAAI,CAAC;QACrB,OAAO,KAAK;MACd;MACA,OAAO,IAAI;IACb;EAAC;EAAA,OAAAd,gBAAA;AAAA;AAAA2C,OAAA,CAAAxD,OAAA,GAAAa,gBAAA"}
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.DataSource = void 0;
|
|
8
|
-
exports.getFetchFunction = getFetchFunction;
|
|
9
|
-
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
10
|
-
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
11
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
12
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
13
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
14
|
-
var DataSource = function () {
|
|
15
|
-
function DataSource(props) {
|
|
16
|
-
(0, _classCallCheck2.default)(this, DataSource);
|
|
17
|
-
(0, _defineProperty2.default)(this, "fetch", void 0);
|
|
18
|
-
(0, _defineProperty2.default)(this, "loadOptions", void 0);
|
|
19
|
-
(0, _defineProperty2.default)(this, "_needsRefresh", true);
|
|
20
|
-
(0, _defineProperty2.default)(this, "props", void 0);
|
|
21
|
-
this.props = _objectSpread({}, props);
|
|
22
|
-
this.loadOptions = _objectSpread({}, props.loadOptions);
|
|
23
|
-
this.fetch = getFetchFunction(this.loadOptions);
|
|
24
|
-
}
|
|
25
|
-
(0, _createClass2.default)(DataSource, [{
|
|
26
|
-
key: "setProps",
|
|
27
|
-
value: function setProps(props) {
|
|
28
|
-
this.props = Object.assign(this.props, props);
|
|
29
|
-
this.setNeedsRefresh();
|
|
30
|
-
}
|
|
31
|
-
}, {
|
|
32
|
-
key: "setNeedsRefresh",
|
|
33
|
-
value: function setNeedsRefresh() {
|
|
34
|
-
this._needsRefresh = true;
|
|
35
|
-
}
|
|
36
|
-
}, {
|
|
37
|
-
key: "getNeedsRefresh",
|
|
38
|
-
value: function getNeedsRefresh() {
|
|
39
|
-
var clear = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
|
40
|
-
var needsRefresh = this._needsRefresh;
|
|
41
|
-
if (clear) {
|
|
42
|
-
this._needsRefresh = false;
|
|
43
|
-
}
|
|
44
|
-
return needsRefresh;
|
|
45
|
-
}
|
|
46
|
-
}]);
|
|
47
|
-
return DataSource;
|
|
48
|
-
}();
|
|
49
|
-
exports.DataSource = DataSource;
|
|
50
|
-
function getFetchFunction(options) {
|
|
51
|
-
var fetchFunction = options === null || options === void 0 ? void 0 : options.fetch;
|
|
52
|
-
if (fetchFunction && typeof fetchFunction === 'function') {
|
|
53
|
-
return function (url, fetchOptions) {
|
|
54
|
-
return fetchFunction(url, fetchOptions);
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
var fetchOptions = options === null || options === void 0 ? void 0 : options.fetch;
|
|
58
|
-
if (fetchOptions && typeof fetchOptions !== 'function') {
|
|
59
|
-
return function (url) {
|
|
60
|
-
return fetch(url, fetchOptions);
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
|
-
return function (url) {
|
|
64
|
-
return fetch(url);
|
|
65
|
-
};
|
|
66
|
-
}
|
|
67
|
-
//# sourceMappingURL=data-source.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"data-source.js","names":["DataSource","props","_classCallCheck2","default","_defineProperty2","_objectSpread","loadOptions","fetch","getFetchFunction","_createClass2","key","value","setProps","Object","assign","setNeedsRefresh","_needsRefresh","getNeedsRefresh","clear","arguments","length","undefined","needsRefresh","exports","options","fetchFunction","url","fetchOptions"],"sources":["../../../../src/lib/sources/data-source.ts"],"sourcesContent":["// loaders.gl, MIT license\n\nimport type {LoaderOptions} from '@loaders.gl/loader-utils';\n\n/** Common properties for all data sources */\nexport type DataSourceProps = {\n /** LoaderOptions provide an option to override `fetch`. Will also be passed to any sub loaders */\n loadOptions?: LoaderOptions;\n};\n\n/** base class of all data sources */\nexport abstract class DataSource<PropsT extends DataSourceProps = DataSourceProps> {\n /** A resolved fetch function extracted from loadOptions prop */\n fetch: (url: string, options?: RequestInit) => Promise<Response>;\n /** The actual load options, if calling a loaders.gl loader */\n loadOptions: LoaderOptions;\n _needsRefresh: boolean = true;\n\n props: PropsT;\n\n constructor(props: PropsT) {\n this.props = {...props};\n this.loadOptions = {...props.loadOptions};\n this.fetch = getFetchFunction(this.loadOptions);\n }\n\n setProps(props: PropsT) {\n this.props = Object.assign(this.props, props);\n // TODO - add a shallow compare to avoid setting refresh if no change?\n this.setNeedsRefresh();\n }\n\n /** Mark this data source as needing a refresh (redraw) */\n setNeedsRefresh(): void {\n this._needsRefresh = true;\n }\n\n /**\n * Does this data source need refreshing?\n * @note The specifics of the refresh mechanism depends on type of data source\n */\n getNeedsRefresh(clear: boolean = true) {\n const needsRefresh = this._needsRefresh;\n if (clear) {\n this._needsRefresh = false;\n }\n return needsRefresh;\n }\n}\n\n/**\n * Gets the current fetch function from options\n * @todo - move to loader-utils module\n * @todo - use in core module counterpart\n * @param options\n * @param context\n */\nexport function getFetchFunction(options?: LoaderOptions) {\n const fetchFunction = options?.fetch;\n\n // options.fetch can be a function\n if (fetchFunction && typeof fetchFunction === 'function') {\n return (url: string, fetchOptions?: RequestInit) => fetchFunction(url, fetchOptions);\n }\n\n // options.fetch can be an options object, use global fetch with those options\n const fetchOptions = options?.fetch;\n if (fetchOptions && typeof fetchOptions !== 'function') {\n return (url) => fetch(url, fetchOptions);\n }\n\n // else return the global fetch function\n return (url) => fetch(url);\n}\n"],"mappings":";;;;;;;;;;;;;IAWsBA,UAAU;EAS9B,SAAAA,WAAYC,KAAa,EAAE;IAAA,IAAAC,gBAAA,CAAAC,OAAA,QAAAH,UAAA;IAAA,IAAAI,gBAAA,CAAAD,OAAA;IAAA,IAAAC,gBAAA,CAAAD,OAAA;IAAA,IAAAC,gBAAA,CAAAD,OAAA,yBAJF,IAAI;IAAA,IAAAC,gBAAA,CAAAD,OAAA;IAK3B,IAAI,CAACF,KAAK,GAAAI,aAAA,KAAOJ,KAAK,CAAC;IACvB,IAAI,CAACK,WAAW,GAAAD,aAAA,KAAOJ,KAAK,CAACK,WAAW,CAAC;IACzC,IAAI,CAACC,KAAK,GAAGC,gBAAgB,CAAC,IAAI,CAACF,WAAW,CAAC;EACjD;EAAC,IAAAG,aAAA,CAAAN,OAAA,EAAAH,UAAA;IAAAU,GAAA;IAAAC,KAAA,EAED,SAAAC,SAASX,KAAa,EAAE;MACtB,IAAI,CAACA,KAAK,GAAGY,MAAM,CAACC,MAAM,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/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.ImageSource = void 0;
|
|
8
|
-
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
9
|
-
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
10
|
-
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
11
|
-
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
12
|
-
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
13
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
14
|
-
var _dataSource = require("./data-source");
|
|
15
|
-
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
|
|
16
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
17
|
-
var ImageSource = function (_DataSource) {
|
|
18
|
-
(0, _inherits2.default)(ImageSource, _DataSource);
|
|
19
|
-
var _super = _createSuper(ImageSource);
|
|
20
|
-
function ImageSource() {
|
|
21
|
-
(0, _classCallCheck2.default)(this, ImageSource);
|
|
22
|
-
return _super.apply(this, arguments);
|
|
23
|
-
}
|
|
24
|
-
return (0, _createClass2.default)(ImageSource);
|
|
25
|
-
}(_dataSource.DataSource);
|
|
26
|
-
exports.ImageSource = ImageSource;
|
|
27
|
-
(0, _defineProperty2.default)(ImageSource, "type", 'template');
|
|
28
|
-
(0, _defineProperty2.default)(ImageSource, "testURL", function (url) {
|
|
29
|
-
return false;
|
|
30
|
-
});
|
|
31
|
-
//# sourceMappingURL=image-source.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"image-source.js","names":["_dataSource","require","_createSuper","Derived","hasNativeReflectConstruct","_isNativeReflectConstruct","_createSuperInternal","Super","_getPrototypeOf2","default","result","NewTarget","constructor","Reflect","construct","arguments","apply","_possibleConstructorReturn2","sham","Proxy","Boolean","prototype","valueOf","call","e","ImageSource","_DataSource","_inherits2","_super","_classCallCheck2","_createClass2","DataSource","exports","_defineProperty2","url"],"sources":["../../../../src/lib/sources/image-source.ts"],"sourcesContent":["// loaders.gl, MIT license\n\nimport type {DataSourceProps} from './data-source';\nimport {DataSource} from './data-source';\nimport {ImageType} from './utils/image-type';\n\n/**\n * Normalized capabilities of an Image service\n * @example\n * The WMSService will normalize the response to the WMS `GetCapabilities`\n * data structure extracted from WMS XML response into an ImageSourceMetadata.\n */\nexport type ImageSourceMetadata = {\n name: string;\n title?: string;\n abstract?: string;\n keywords: string[];\n layers: ImageSourceLayer[];\n};\n\n/** Description of one data layer in the image source */\nexport type ImageSourceLayer = {\n /** Name of this layer */\n name?: string;\n /** Human readable title of this layer */\n title?: string;\n /** Coordinate systems supported by this layer */\n crs?: string[];\n /** layer limits in unspecified CRS:84-like lng/lat, for quick access w/o CRS calculations. */\n geographicBoundingBox?: [min: [x: number, y: number], max: [x: number, y: number]];\n /** Sub layers of this layer */\n layers?: ImageSourceLayer[];\n\n /** @deprecated from v3.4: non-vis.gl style bounding box. Use `.geographicBoundingBox` instead */\n boundingBox?: [number, number, number, number];\n};\n\n/** Generic parameters for requesting an image from an image source */\nexport type GetImageParameters = {\n /** Layers to render */\n layers: string | string[];\n /** Styling */\n styles?: unknown;\n /** bounding box of the requested map image */\n bbox: [number, number, number, number];\n /** pixel width of returned image */\n width: number;\n /** pixels */\n height: number;\n /** crs for the image (not the bounding box) */\n crs?: string;\n /** requested format for the return image */\n format?: 'image/png';\n};\n\n// Attempt to break down GetImageParameters\nexport type ImageFilters = {\n /** Layers to render */\n layers: string | string[];\n /** Styling */\n styles?: unknown;\n};\n\nexport type ImageRegion = {\n /** bounding box of the requested map image */\n bbox: [number, number, number, number];\n};\n\nexport type ImageFormat = {\n /** pixel width of returned image */\n width: number;\n /** pixels */\n height: number;\n /** crs for the image (not the bounding box) */\n crs?: string;\n /** requested format for the return image */\n format?: 'image/png';\n};\n\nexport type ImageSourceProps = DataSourceProps;\n\n/**\n * MapImageSource - data sources that allow data to be queried by (geospatial) extents\n * @note\n * - If geospatial, bounding box is expected to be in web mercator coordinates\n */\nexport abstract class ImageSource<\n PropsT extends ImageSourceProps = ImageSourceProps\n> extends DataSource<PropsT> {\n static type: string = 'template';\n static testURL = (url: string): boolean => false;\n\n abstract getMetadata(): Promise<ImageSourceMetadata>;\n abstract getImage(parameters: GetImageParameters): Promise<ImageType>;\n}\n"],"mappings":";;;;;;;;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AAAyC,SAAAC,aAAAC,OAAA,QAAAC,yBAAA,GAAAC,yBAAA,oBAAAC,qBAAA,QAAAC,KAAA,OAAAC,gBAAA,CAAAC,OAAA,EAAAN,OAAA,GAAAO,MAAA,MAAAN,yBAAA,QAAAO,SAAA,OAAAH,gBAAA,CAAAC,OAAA,QAAAG,WAAA,EAAAF,MAAA,GAAAG,OAAA,CAAAC,SAAA,CAAAP,KAAA,EAAAQ,SAAA,EAAAJ,SAAA,YAAAD,MAAA,GAAAH,KAAA,CAAAS,KAAA,OAAAD,SAAA,gBAAAE,2BAAA,CAAAR,OAAA,QAAAC,MAAA;AAAA,SAAAL,0BAAA,eAAAQ,OAAA,qBAAAA,OAAA,CAAAC,SAAA,oBAAAD,OAAA,CAAAC,SAAA,CAAAI,IAAA,2BAAAC,KAAA,oCAAAC,OAAA,CAAAC,SAAA,CAAAC,OAAA,CAAAC,IAAA,CAAAV,OAAA,CAAAC,SAAA,CAAAM,OAAA,8CAAAI,CAAA;AAAA,IAmFnBC,WAAW,aAAAC,WAAA;EAAA,IAAAC,UAAA,CAAAlB,OAAA,EAAAgB,WAAA,EAAAC,WAAA;EAAA,IAAAE,MAAA,GAAA1B,YAAA,CAAAuB,WAAA;EAAA,SAAAA,YAAA;IAAA,IAAAI,gBAAA,CAAApB,OAAA,QAAAgB,WAAA;IAAA,OAAAG,MAAA,CAAAZ,KAAA,OAAAD,SAAA;EAAA;EAAA,WAAAe,aAAA,CAAArB,OAAA,EAAAgB,WAAA;AAAA,EAEvBM,sBAAU;AAAAC,OAAA,CAAAP,WAAA,GAAAA,WAAA;AAAA,IAAAQ,gBAAA,CAAAxB,OAAA,EAFEgB,WAAW,UAGT,UAAU;AAAA,IAAAQ,gBAAA,CAAAxB,OAAA,EAHZgB,WAAW,aAId,UAACS,GAAW;EAAA,OAAc,KAAK;AAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"image-tile-source.js","names":[],"sources":["../../../../src/lib/sources/image-tile-source.ts"],"sourcesContent":["// loaders.gl, MIT license\n\nimport type {ImageType} from './utils/image-type';\nimport type {TileSource, TileSourceMetadata} from './tile-source';\nimport type {GetTileParameters} from './tile-source';\n\n/**\n * MapTileSource - data sources that allow data to be queried by (geospatial) tile\n * @note If geospatial, bounding box is expected to be in web mercator coordinates\n */\nexport interface ImageTileSource<MetadataT extends TileSourceMetadata = TileSourceMetadata>\n extends TileSource<MetadataT> {\n getImageTile(parameters: GetTileParameters): Promise<ImageType | null>;\n}\n"],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tile-source.js","names":[],"sources":["../../../../src/lib/sources/tile-source.ts"],"sourcesContent":["// loaders.gl, MIT license\n\n/**\n * Normalized capabilities of an Image service\n * Sources are expected to normalize the response to capabilities\n * @example\n * A WMS service would normalize the response to the WMS `GetCapabilities` data structure extracted from WMS XML response\n * into an TileSourceMetadata.\n */\nexport type TileSourceMetadata = {\n format?: string;\n formatHeader?: unknown;\n\n /** Name of the tileset (extracted from JSON metadata if available) */\n name?: string;\n title?: string;\n abstract?: string;\n keywords?: string[];\n /** Attribution string (extracted from JSON metadata if available) */\n attributions?: string[];\n\n /** Minimal zoom level of tiles in this tileset */\n minZoom?: number;\n /** Maximal zoom level of tiles in this tileset */\n maxZoom?: number;\n /** Bounding box of tiles in this tileset `[[w, s], [e, n]]` */\n boundingBox?: [min: [x: number, y: number], max: [x: number, y: number]];\n\n /** Layer information */\n layer?: {\n name: string;\n title?: string;\n srs?: string[];\n boundingBox?: [number, number, number, number];\n layers: TileSourceLayer[];\n };\n};\n\n/**\n * Description of one data layer in the image source\n */\nexport type TileSourceLayer = {\n name: string;\n title?: string;\n srs?: string[];\n boundingBox?: [number, number, number, number];\n layers: TileSourceLayer[];\n};\n\n/**\n * Generic parameters for requesting an image from an image source\n */\nexport type GetTileParameters = {\n /** Layers to render */\n layers: string | string[];\n /** Styling */\n styles?: unknown;\n /** bounding box of the requested map image */\n zoom: number;\n /** tile x coordinate */\n x: number;\n /** tile y coordinate */\n y: number;\n /** srs for the image (not the bounding box) */\n srs?: string;\n /** requested format for the return image */\n format?: 'image/png';\n};\n\nexport type TileLoadParameters = {\n index: {x: number; y: number; z: number};\n id: string;\n bbox: TileBoundingBox;\n zoom?: number;\n url?: string | null;\n signal?: AbortSignal;\n userData?: Record<string, any>;\n};\n\n/** deck.gl compatible bounding box */\nexport type TileBoundingBox = NonGeoBoundingBox | GeoBoundingBox;\nexport type GeoBoundingBox = {west: number; north: number; east: number; south: number};\nexport type NonGeoBoundingBox = {left: number; top: number; right: number; bottom: number};\n\n/**\n * Props for a TileSource\n */\nexport type TileSourceProps = {};\n\n/**\n * MapTileSource - data sources that allow data to be queried by (geospatial) extents\n * @note\n * - If geospatial, bounding box is expected to be in web mercator coordinates\n */\nexport interface TileSource<MetadataT extends TileSourceMetadata> {\n getMetadata(): Promise<MetadataT>;\n /** Flat parameters */\n getTile(parameters: GetTileParameters): Promise<unknown>;\n /** deck.gl style parameters */\n getTileData(parameters: TileLoadParameters): Promise<unknown | null>;\n}\n"],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"image-type.js","names":[],"sources":["../../../../../src/lib/sources/utils/image-type.ts"],"sourcesContent":["/** Supported Image Types @note duplicates definition in images/schema to avoid circular deps */\nexport type ImageType = ImageBitmap | ImageDataType | HTMLImageElement;\n\n/** data images @note duplicates definition in images/schema to avoid circular deps */\nexport type ImageDataType = {\n data: Uint8Array;\n width: number;\n height: number;\n compressed?: boolean;\n};\n"],"mappings":""}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.getFetchFunction = getFetchFunction;
|
|
8
|
-
exports.mergeImageServiceProps = mergeImageServiceProps;
|
|
9
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
11
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
12
|
-
function getFetchFunction(options) {
|
|
13
|
-
var fetchFunction = options === null || options === void 0 ? void 0 : options.fetch;
|
|
14
|
-
if (fetchFunction && typeof fetchFunction === 'function') {
|
|
15
|
-
return function (url, fetchOptions) {
|
|
16
|
-
return fetchFunction(url, fetchOptions);
|
|
17
|
-
};
|
|
18
|
-
}
|
|
19
|
-
var fetchOptions = options === null || options === void 0 ? void 0 : options.fetch;
|
|
20
|
-
if (fetchOptions && typeof fetchOptions !== 'function') {
|
|
21
|
-
return function (url) {
|
|
22
|
-
return fetch(url, fetchOptions);
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
return function (url) {
|
|
26
|
-
return fetch(url);
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
function mergeImageServiceProps(props) {
|
|
30
|
-
return _objectSpread(_objectSpread({}, props), {}, {
|
|
31
|
-
loadOptions: _objectSpread(_objectSpread({}, props.loadOptions), {}, {
|
|
32
|
-
fetch: getFetchFunction(props.loadOptions)
|
|
33
|
-
})
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
//# sourceMappingURL=utils.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","names":["getFetchFunction","options","fetchFunction","fetch","url","fetchOptions","mergeImageServiceProps","props","_objectSpread","loadOptions"],"sources":["../../../../../src/lib/sources/utils/utils.ts"],"sourcesContent":["// loaders.gl, MIT license\n\nimport type {LoaderOptions} from '@loaders.gl/loader-utils';\n\n/**\n * Gets the current fetch function from options\n * @todo - move to loader-utils module\n * @todo - use in core module counterpart\n * @param options\n * @param context\n */\nexport function getFetchFunction(options?: LoaderOptions) {\n const fetchFunction = options?.fetch;\n\n // options.fetch can be a function\n if (fetchFunction && typeof fetchFunction === 'function') {\n return (url: string, fetchOptions?: RequestInit) => fetchFunction(url, fetchOptions);\n }\n\n // options.fetch can be an options object, use global fetch with those options\n const fetchOptions = options?.fetch;\n if (fetchOptions && typeof fetchOptions !== 'function') {\n return (url) => fetch(url, fetchOptions);\n }\n\n // else return the global fetch function\n return (url) => fetch(url);\n}\n\nexport function mergeImageServiceProps<Props extends {loadOptions?: any}>(\n props: Props\n): Required<Props> {\n // @ts-expect-error\n return {\n // Default fetch\n ...props,\n loadOptions: {\n ...props.loadOptions,\n fetch: getFetchFunction(props.loadOptions)\n }\n };\n}\n"],"mappings":";;;;;;;;;;;AAWO,SAASA,gBAAgBA,CAACC,OAAuB,EAAE;EACxD,IAAMC,aAAa,GAAGD,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEE,KAAK;EAGpC,IAAID,aAAa,IAAI,OAAOA,aAAa,KAAK,UAAU,EAAE;IACxD,OAAO,UAACE,GAAW,EAAEC,YAA0B;MAAA,OAAKH,aAAa,CAACE,GAAG,EAAEC,YAAY,CAAC;IAAA;EACtF;EAGA,IAAMA,YAAY,GAAGJ,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEE,KAAK;EACnC,IAAIE,YAAY,IAAI,OAAOA,YAAY,KAAK,UAAU,EAAE;IACtD,OAAO,UAACD,GAAG;MAAA,OAAKD,KAAK,CAACC,GAAG,EAAEC,YAAY,CAAC;IAAA;EAC1C;EAGA,OAAO,UAACD,GAAG;IAAA,OAAKD,KAAK,CAACC,GAAG,CAAC;EAAA;AAC5B;AAEO,SAASE,sBAAsBA,CACpCC,KAAY,EACK;EAEjB,OAAAC,aAAA,CAAAA,aAAA,KAEKD,KAAK;IACRE,WAAW,EAAAD,aAAA,CAAAA,aAAA,KACND,KAAK,CAACE,WAAW;MACpBN,KAAK,EAAEH,gBAAgB,CAACO,KAAK,CAACE,WAAW;IAAC;EAC3C;AAEL"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"vector-tile-source.js","names":[],"sources":["../../../../src/lib/sources/vector-tile-source.ts"],"sourcesContent":["// loaders.gl, MIT license\n\nimport {TileSource, TileSourceMetadata} from './tile-source';\nimport {GetTileParameters} from './tile-source';\n\n/**\n * MapTileSource - data sources that allow data to be queried by (geospatial) tile\n * @note If geospatial, bounding box is expected to be in web mercator coordinates\n */\nexport interface VectorTileSource<MetadataT extends TileSourceMetadata = TileSourceMetadata>\n extends TileSource<MetadataT> {\n getVectorTile(parameters: GetTileParameters): Promise<unknown | null>;\n}\n"],"mappings":""}
|