@loaders.gl/loader-utils 4.3.1 → 4.4.0-alpha.1
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/format-types.d.ts +24 -0
- package/dist/format-types.d.ts.map +1 -0
- package/dist/format-types.js +4 -0
- package/dist/index.cjs +41 -25
- package/dist/index.cjs.map +3 -3
- package/dist/index.d.ts +10 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -3
- package/dist/json-loader.js +1 -1
- package/dist/lib/files/blob-file.d.ts +1 -1
- package/dist/lib/files/blob-file.d.ts.map +1 -1
- package/dist/lib/files/blob-file.js +3 -1
- package/dist/lib/files/http-file.d.ts +1 -1
- package/dist/lib/files/http-file.d.ts.map +1 -1
- package/dist/lib/files/http-file.js +1 -1
- package/dist/lib/files/node-file-facade.d.ts +1 -1
- package/dist/lib/files/node-file-facade.d.ts.map +1 -1
- package/dist/lib/files/node-file-facade.js +1 -1
- package/dist/lib/log-utils/log.js +1 -1
- package/dist/lib/option-utils/merge-options.d.ts +12 -0
- package/dist/lib/option-utils/merge-options.d.ts.map +1 -0
- package/dist/lib/option-utils/{merge-loader-options.js → merge-options.js} +4 -1
- package/dist/lib/sources/data-source.d.ts +25 -13
- package/dist/lib/sources/data-source.d.ts.map +1 -1
- package/dist/lib/sources/data-source.js +30 -8
- package/dist/lib/sources/image-source.d.ts +1 -4
- package/dist/lib/sources/image-source.d.ts.map +1 -1
- package/dist/lib/sources/image-source.js +2 -2
- package/dist/lib/sources/image-tile-source.d.ts +2 -1
- package/dist/lib/sources/image-tile-source.d.ts.map +1 -1
- package/dist/lib/sources/tile-source-adapter.d.ts +3 -3
- package/dist/lib/sources/tile-source-adapter.d.ts.map +1 -1
- package/dist/lib/sources/tile-source-adapter.js +0 -1
- package/dist/lib/sources/tile-source.d.ts +3 -5
- package/dist/lib/sources/tile-source.d.ts.map +1 -1
- package/dist/lib/sources/vector-source.d.ts +2 -4
- package/dist/lib/sources/vector-source.d.ts.map +1 -1
- package/dist/lib/sources/vector-source.js +1 -2
- package/dist/lib/sources/vector-tile-source.d.ts +2 -2
- package/dist/lib/sources/vector-tile-source.d.ts.map +1 -1
- package/dist/loader-types.d.ts +9 -8
- package/dist/loader-types.d.ts.map +1 -1
- package/dist/source-types.d.ts +20 -8
- package/dist/source-types.d.ts.map +1 -1
- package/dist/source-types.js +1 -0
- package/dist/writer-types.d.ts +8 -8
- package/dist/writer-types.d.ts.map +1 -1
- package/package.json +4 -7
- package/src/format-types.ts +27 -0
- package/src/index.ts +15 -8
- package/src/lib/files/blob-file.ts +4 -2
- package/src/lib/files/http-file.ts +1 -1
- package/src/lib/files/node-file-facade.ts +1 -1
- package/src/lib/option-utils/{merge-loader-options.ts → merge-options.ts} +10 -6
- package/src/lib/sources/data-source.ts +51 -17
- package/src/lib/sources/image-source.ts +2 -7
- package/src/lib/sources/image-tile-source.ts +2 -4
- package/src/lib/sources/tile-source-adapter.ts +4 -4
- package/src/lib/sources/tile-source.ts +3 -9
- package/src/lib/sources/vector-source.ts +2 -6
- package/src/lib/sources/vector-tile-source.ts +2 -5
- package/src/loader-types.ts +12 -15
- package/src/source-types.ts +35 -10
- package/src/writer-types.ts +10 -12
- package/dist/lib/option-utils/merge-loader-options.d.ts +0 -9
- package/dist/lib/option-utils/merge-loader-options.d.ts.map +0 -1
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* An object that describes a format
|
|
3
|
+
*/
|
|
4
|
+
export type Format = {
|
|
5
|
+
/** Human readable name */
|
|
6
|
+
name: string;
|
|
7
|
+
/** Unique lower-case id string for this format. Used for e.g. LoaderOptions */
|
|
8
|
+
id: string;
|
|
9
|
+
/** loaders.gl module that contains the implementation of this format */
|
|
10
|
+
module: string;
|
|
11
|
+
/** Which category does this loader belong to */
|
|
12
|
+
category?: string;
|
|
13
|
+
/** File extensions that are potential matches with this loader. */
|
|
14
|
+
extensions: string[];
|
|
15
|
+
/** MIMETypes that indicate a match with this loader. @note Some MIMETypes are generic and supported by many loaders */
|
|
16
|
+
mimeTypes: string[];
|
|
17
|
+
/** Is this a binary format */
|
|
18
|
+
binary?: boolean;
|
|
19
|
+
/** Is this a text format */
|
|
20
|
+
text?: boolean;
|
|
21
|
+
/** Test some initial bytes of content to see if this loader might be a match */
|
|
22
|
+
tests?: (((ArrayBuffer: ArrayBuffer) => boolean) | ArrayBuffer | string)[];
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=format-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"format-types.d.ts","sourceRoot":"","sources":["../src/format-types.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,MAAM,MAAM,MAAM,GAAG;IACnB,0BAA0B;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,+EAA+E;IAC/E,EAAE,EAAE,MAAM,CAAC;IACX,wEAAwE;IACxE,MAAM,EAAE,MAAM,CAAC;IACf,gDAAgD;IAChD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,mEAAmE;IACnE,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,uHAAuH;IACvH,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,8BAA8B;IAC9B,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,4BAA4B;IAC5B,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,gFAAgF;IAChF,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE,WAAW,KAAK,OAAO,CAAC,GAAG,WAAW,GAAG,MAAM,CAAC,EAAE,CAAC;CAC5E,CAAC"}
|
package/dist/index.cjs
CHANGED
|
@@ -36,7 +36,6 @@ __export(dist_exports, {
|
|
|
36
36
|
NodeFile: () => NodeFileFacade,
|
|
37
37
|
NodeFilesystem: () => NodeFileSystemFacade,
|
|
38
38
|
RequestScheduler: () => RequestScheduler,
|
|
39
|
-
VectorSource: () => VectorSource,
|
|
40
39
|
_addAliases: () => addAliases,
|
|
41
40
|
assert: () => assert,
|
|
42
41
|
canEncodeWithWorker: () => canEncodeWithWorker,
|
|
@@ -61,6 +60,7 @@ __export(dist_exports, {
|
|
|
61
60
|
getJSModuleOrNull: () => getJSModuleOrNull,
|
|
62
61
|
getMagicString: () => getMagicString,
|
|
63
62
|
getPathPrefix: () => getPathPrefix,
|
|
63
|
+
getRequiredOptions: () => getRequiredOptions,
|
|
64
64
|
global: () => global_,
|
|
65
65
|
isBrowser: () => isBrowser,
|
|
66
66
|
isBuffer: () => isBuffer,
|
|
@@ -71,7 +71,7 @@ __export(dist_exports, {
|
|
|
71
71
|
makeNumberedLineIterator: () => makeNumberedLineIterator,
|
|
72
72
|
makeTextDecoderIterator: () => makeTextDecoderIterator,
|
|
73
73
|
makeTextEncoderIterator: () => makeTextEncoderIterator,
|
|
74
|
-
|
|
74
|
+
mergeOptions: () => mergeOptions,
|
|
75
75
|
nodeVersion: () => nodeVersion,
|
|
76
76
|
padStringToByteAlignment: () => padStringToByteAlignment,
|
|
77
77
|
padToNBytes: () => padToNBytes,
|
|
@@ -140,7 +140,7 @@ var nodeVersion = matches && parseFloat(matches[1]) || 0;
|
|
|
140
140
|
|
|
141
141
|
// dist/lib/log-utils/log.js
|
|
142
142
|
var import_log = require("@probe.gl/log");
|
|
143
|
-
var VERSION = true ? "4.
|
|
143
|
+
var VERSION = true ? "4.4.0-alpha.0" : "latest";
|
|
144
144
|
var version = VERSION[0] >= "0" && VERSION[0] <= "9" ? `v${VERSION}` : "";
|
|
145
145
|
function createLog() {
|
|
146
146
|
const log2 = new import_log.Log({ id: "loaders.gl" });
|
|
@@ -153,8 +153,11 @@ function createLog() {
|
|
|
153
153
|
}
|
|
154
154
|
var log = createLog();
|
|
155
155
|
|
|
156
|
-
// dist/lib/option-utils/merge-
|
|
157
|
-
function
|
|
156
|
+
// dist/lib/option-utils/merge-options.js
|
|
157
|
+
function getRequiredOptions(options) {
|
|
158
|
+
return options;
|
|
159
|
+
}
|
|
160
|
+
function mergeOptions(baseOptions, newOptions) {
|
|
158
161
|
return mergeOptionsRecursively(baseOptions || {}, newOptions);
|
|
159
162
|
}
|
|
160
163
|
function mergeOptionsRecursively(baseOptions, newOptions, level = 0) {
|
|
@@ -718,7 +721,7 @@ function resolvePath(filename2) {
|
|
|
718
721
|
}
|
|
719
722
|
|
|
720
723
|
// dist/json-loader.js
|
|
721
|
-
var VERSION2 = true ? "4.
|
|
724
|
+
var VERSION2 = true ? "4.4.0-alpha.0" : "latest";
|
|
722
725
|
var JSONLoader = {
|
|
723
726
|
dataType: null,
|
|
724
727
|
batchType: null,
|
|
@@ -958,7 +961,7 @@ var BlobFile = class {
|
|
|
958
961
|
};
|
|
959
962
|
}
|
|
960
963
|
async read(start, length) {
|
|
961
|
-
const arrayBuffer = await this.handle.slice(start, start + length).arrayBuffer();
|
|
964
|
+
const arrayBuffer = await this.handle.slice(Number(start), Number(start) + Number(length)).arrayBuffer();
|
|
962
965
|
return arrayBuffer;
|
|
963
966
|
}
|
|
964
967
|
};
|
|
@@ -987,7 +990,7 @@ var HttpFile = class {
|
|
|
987
990
|
isDirectory: false
|
|
988
991
|
};
|
|
989
992
|
}
|
|
990
|
-
async read(offset, length) {
|
|
993
|
+
async read(offset = 0, length = 0) {
|
|
991
994
|
const response = await this.fetchRange(offset, length);
|
|
992
995
|
const arrayBuffer = await response.arrayBuffer();
|
|
993
996
|
return arrayBuffer;
|
|
@@ -1065,7 +1068,7 @@ var NodeFileFacade = class {
|
|
|
1065
1068
|
throw new Error("Can't instantiate NodeFile. Make sure to import @loaders.gl/polyfills first.");
|
|
1066
1069
|
}
|
|
1067
1070
|
/** Read data */
|
|
1068
|
-
async read(start,
|
|
1071
|
+
async read(start, length) {
|
|
1069
1072
|
throw NOT_IMPLEMENTED;
|
|
1070
1073
|
}
|
|
1071
1074
|
/** Write to file. The number of bytes written will be returned */
|
|
@@ -1397,20 +1400,30 @@ var DataViewFile = class {
|
|
|
1397
1400
|
};
|
|
1398
1401
|
|
|
1399
1402
|
// dist/lib/sources/data-source.js
|
|
1400
|
-
var
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
+
var _DataSource = class {
|
|
1404
|
+
optionsType;
|
|
1405
|
+
options;
|
|
1406
|
+
data;
|
|
1407
|
+
url;
|
|
1403
1408
|
/** The actual load options, if calling a loaders.gl loader */
|
|
1404
1409
|
loadOptions;
|
|
1410
|
+
/** A resolved fetch function extracted from loadOptions prop */
|
|
1411
|
+
fetch;
|
|
1405
1412
|
_needsRefresh = true;
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1413
|
+
constructor(data, options, defaultOptions) {
|
|
1414
|
+
var _a;
|
|
1415
|
+
if (defaultOptions) {
|
|
1416
|
+
this.options = mergeOptions({ ...defaultOptions, core: _DataSource.defaultOptions }, options);
|
|
1417
|
+
} else {
|
|
1418
|
+
this.options = { ...options };
|
|
1419
|
+
}
|
|
1420
|
+
this.data = data;
|
|
1421
|
+
this.url = typeof data === "string" ? resolvePath(data) : "";
|
|
1422
|
+
this.loadOptions = { ...(_a = this.options.core) == null ? void 0 : _a.loadOptions };
|
|
1410
1423
|
this.fetch = getFetchFunction(this.loadOptions);
|
|
1411
1424
|
}
|
|
1412
|
-
setProps(
|
|
1413
|
-
this.
|
|
1425
|
+
setProps(options) {
|
|
1426
|
+
this.options = Object.assign(this.options, options);
|
|
1414
1427
|
this.setNeedsRefresh();
|
|
1415
1428
|
}
|
|
1416
1429
|
/** Mark this data source as needing a refresh (redraw) */
|
|
@@ -1429,6 +1442,15 @@ var DataSource = class {
|
|
|
1429
1442
|
return needsRefresh;
|
|
1430
1443
|
}
|
|
1431
1444
|
};
|
|
1445
|
+
var DataSource = _DataSource;
|
|
1446
|
+
__publicField(DataSource, "defaultOptions", {
|
|
1447
|
+
core: {
|
|
1448
|
+
type: "auto",
|
|
1449
|
+
attributions: [],
|
|
1450
|
+
loadOptions: {},
|
|
1451
|
+
loaders: []
|
|
1452
|
+
}
|
|
1453
|
+
});
|
|
1432
1454
|
function getFetchFunction(options) {
|
|
1433
1455
|
const fetchFunction = options == null ? void 0 : options.fetch;
|
|
1434
1456
|
if (fetchFunction && typeof fetchFunction === "function") {
|
|
@@ -1442,14 +1464,8 @@ function getFetchFunction(options) {
|
|
|
1442
1464
|
}
|
|
1443
1465
|
|
|
1444
1466
|
// dist/lib/sources/image-source.js
|
|
1445
|
-
var ImageSource = class
|
|
1467
|
+
var ImageSource = class {
|
|
1446
1468
|
};
|
|
1447
1469
|
__publicField(ImageSource, "type", "template");
|
|
1448
1470
|
__publicField(ImageSource, "testURL", (url) => false);
|
|
1449
|
-
|
|
1450
|
-
// dist/lib/sources/vector-source.js
|
|
1451
|
-
var VectorSource = class extends DataSource {
|
|
1452
|
-
};
|
|
1453
|
-
__publicField(VectorSource, "type", "template");
|
|
1454
|
-
__publicField(VectorSource, "testURL", (url) => false);
|
|
1455
1471
|
//# sourceMappingURL=index.cjs.map
|