@loaders.gl/loader-utils 4.3.0-alpha.2 → 4.3.0-alpha.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 +112 -3
- package/dist/index.cjs.map +3 -3
- package/dist/index.d.ts +7 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/json-loader.js +1 -1
- package/dist/lib/file-provider/data-view-file.d.ts +2 -2
- package/dist/lib/file-provider/data-view-file.d.ts.map +1 -1
- package/dist/lib/file-provider/file-handle-file.d.ts +2 -2
- package/dist/lib/file-provider/file-handle-file.d.ts.map +1 -1
- package/dist/lib/file-provider/file-provider-interface.d.ts +45 -0
- package/dist/lib/file-provider/file-provider-interface.d.ts.map +1 -0
- package/dist/lib/file-provider/file-provider-interface.js +9 -0
- package/dist/lib/file-provider/file-provider.d.ts +28 -17
- package/dist/lib/file-provider/file-provider.d.ts.map +1 -1
- package/dist/lib/file-provider/file-provider.js +104 -7
- package/dist/lib/log-utils/log.js +1 -1
- package/dist/lib/sources/data-source.d.ts +1 -0
- package/dist/lib/sources/data-source.d.ts.map +1 -1
- package/dist/lib/sources/image-source.d.ts +11 -13
- package/dist/lib/sources/image-source.d.ts.map +1 -1
- package/dist/lib/sources/image-source.js +1 -3
- package/dist/lib/sources/image-tile-source.d.ts +4 -2
- package/dist/lib/sources/image-tile-source.d.ts.map +1 -1
- package/dist/lib/sources/tile-source-adapter.d.ts.map +1 -1
- package/dist/lib/sources/tile-source-adapter.js +1 -0
- package/dist/lib/sources/tile-source.d.ts +18 -14
- package/dist/lib/sources/tile-source.d.ts.map +1 -1
- package/dist/lib/sources/utils/utils.d.ts +1 -1
- package/dist/lib/sources/utils/utils.d.ts.map +1 -1
- package/dist/lib/sources/utils/utils.js +1 -1
- package/dist/lib/sources/vector-source.d.ts +61 -0
- package/dist/lib/sources/vector-source.d.ts.map +1 -0
- package/dist/lib/sources/vector-source.js +13 -0
- package/dist/lib/sources/vector-tile-source.d.ts +1 -1
- package/dist/lib/sources/vector-tile-source.d.ts.map +1 -1
- package/dist/source-types.d.ts +39 -0
- package/dist/source-types.d.ts.map +1 -0
- package/package.json +5 -4
- package/src/index.ts +8 -3
- package/src/lib/file-provider/data-view-file.ts +2 -2
- package/src/lib/file-provider/file-handle-file.ts +2 -2
- package/src/lib/file-provider/file-provider-interface.ts +56 -0
- package/src/lib/file-provider/file-provider.ts +95 -25
- package/src/lib/sources/data-source.ts +1 -0
- package/src/lib/sources/image-source.ts +19 -18
- package/src/lib/sources/image-tile-source.ts +8 -3
- package/src/lib/sources/tile-source-adapter.ts +1 -0
- package/src/lib/sources/tile-source.ts +26 -19
- package/src/lib/sources/utils/utils.ts +1 -1
- package/src/lib/sources/vector-source.ts +74 -0
- package/src/lib/sources/vector-tile-source.ts +4 -2
- package/src/source-types.ts +49 -0
- package/dist/service-types.d.ts +0 -10
- package/dist/service-types.d.ts.map +0 -1
- package/src/service-types.ts +0 -14
- /package/dist/{service-types.js → source-types.js} +0 -0
package/dist/index.cjs
CHANGED
|
@@ -29,12 +29,14 @@ __export(dist_exports, {
|
|
|
29
29
|
DataSource: () => DataSource,
|
|
30
30
|
DataViewFile: () => DataViewFile,
|
|
31
31
|
FileHandleFile: () => FileHandleFile,
|
|
32
|
+
FileProvider: () => FileProvider,
|
|
32
33
|
HttpFile: () => HttpFile,
|
|
33
34
|
ImageSource: () => ImageSource,
|
|
34
35
|
JSONLoader: () => JSONLoader,
|
|
35
36
|
NodeFile: () => NodeFileFacade,
|
|
36
37
|
NodeFilesystem: () => NodeFileSystemFacade,
|
|
37
38
|
RequestScheduler: () => RequestScheduler,
|
|
39
|
+
VectorSource: () => VectorSource,
|
|
38
40
|
_addAliases: () => addAliases,
|
|
39
41
|
assert: () => assert,
|
|
40
42
|
canEncodeWithWorker: () => canEncodeWithWorker,
|
|
@@ -138,7 +140,7 @@ var nodeVersion = matches && parseFloat(matches[1]) || 0;
|
|
|
138
140
|
|
|
139
141
|
// dist/lib/log-utils/log.js
|
|
140
142
|
var import_log = require("@probe.gl/log");
|
|
141
|
-
var VERSION = true ? "4.3.0-alpha.
|
|
143
|
+
var VERSION = true ? "4.3.0-alpha.2" : "latest";
|
|
142
144
|
var version = VERSION[0] >= "0" && VERSION[0] <= "9" ? `v${VERSION}` : "";
|
|
143
145
|
function createLog() {
|
|
144
146
|
const log2 = new import_log.Log({ id: "loaders.gl" });
|
|
@@ -717,7 +719,7 @@ function resolvePath(filename2) {
|
|
|
717
719
|
}
|
|
718
720
|
|
|
719
721
|
// dist/json-loader.js
|
|
720
|
-
var VERSION2 = true ? "4.3.0-alpha.
|
|
722
|
+
var VERSION2 = true ? "4.3.0-alpha.2" : "latest";
|
|
721
723
|
var JSONLoader = {
|
|
722
724
|
dataType: null,
|
|
723
725
|
batchType: null,
|
|
@@ -1128,11 +1130,112 @@ var NodeFileSystemFacade = class {
|
|
|
1128
1130
|
}
|
|
1129
1131
|
};
|
|
1130
1132
|
|
|
1131
|
-
// dist/lib/file-provider/file-provider.js
|
|
1133
|
+
// dist/lib/file-provider/file-provider-interface.js
|
|
1132
1134
|
var isFileProvider = (fileProvider) => {
|
|
1133
1135
|
return (fileProvider == null ? void 0 : fileProvider.getUint8) && (fileProvider == null ? void 0 : fileProvider.slice) && (fileProvider == null ? void 0 : fileProvider.length);
|
|
1134
1136
|
};
|
|
1135
1137
|
|
|
1138
|
+
// dist/lib/file-provider/file-provider.js
|
|
1139
|
+
var FileProvider = class {
|
|
1140
|
+
/** The File object from which data is provided */
|
|
1141
|
+
file;
|
|
1142
|
+
size;
|
|
1143
|
+
/** Create a new BrowserFile */
|
|
1144
|
+
constructor(file, size) {
|
|
1145
|
+
this.file = file;
|
|
1146
|
+
this.size = BigInt(size);
|
|
1147
|
+
}
|
|
1148
|
+
static async create(file) {
|
|
1149
|
+
var _a, _b;
|
|
1150
|
+
return new FileProvider(file, file.bigsize > 0n ? file.bigsize : file.size > 0n ? file.size : ((_b = await ((_a = file.stat) == null ? void 0 : _a.call(file))) == null ? void 0 : _b.bigsize) ?? 0n);
|
|
1151
|
+
}
|
|
1152
|
+
/**
|
|
1153
|
+
* Truncates the file descriptor.
|
|
1154
|
+
* @param length desired file lenght
|
|
1155
|
+
*/
|
|
1156
|
+
async truncate(length) {
|
|
1157
|
+
throw new Error("file loaded via range requests cannot be changed");
|
|
1158
|
+
}
|
|
1159
|
+
/**
|
|
1160
|
+
* Append data to a file.
|
|
1161
|
+
* @param buffer data to append
|
|
1162
|
+
*/
|
|
1163
|
+
async append(buffer) {
|
|
1164
|
+
throw new Error("file loaded via range requests cannot be changed");
|
|
1165
|
+
}
|
|
1166
|
+
/** Close file */
|
|
1167
|
+
async destroy() {
|
|
1168
|
+
throw new Error("file loaded via range requests cannot be changed");
|
|
1169
|
+
}
|
|
1170
|
+
/**
|
|
1171
|
+
* Gets an unsigned 8-bit integer at the specified byte offset from the start of the file.
|
|
1172
|
+
* @param offset The offset, in bytes, from the start of the file where to read the data.
|
|
1173
|
+
*/
|
|
1174
|
+
async getUint8(offset) {
|
|
1175
|
+
const arrayBuffer = await this.file.read(offset, 1);
|
|
1176
|
+
const val = new Uint8Array(arrayBuffer).at(0);
|
|
1177
|
+
if (val === void 0) {
|
|
1178
|
+
throw new Error("something went wrong");
|
|
1179
|
+
}
|
|
1180
|
+
return val;
|
|
1181
|
+
}
|
|
1182
|
+
/**
|
|
1183
|
+
* Gets an unsigned 16-bit integer at the specified byte offset from the start of the file.
|
|
1184
|
+
* @param offset The offset, in bytes, from the start of the file where to read the data.
|
|
1185
|
+
*/
|
|
1186
|
+
async getUint16(offset) {
|
|
1187
|
+
const arrayBuffer = await this.file.read(offset, 2);
|
|
1188
|
+
const val = new Uint16Array(arrayBuffer).at(0);
|
|
1189
|
+
if (val === void 0) {
|
|
1190
|
+
throw new Error("something went wrong");
|
|
1191
|
+
}
|
|
1192
|
+
return val;
|
|
1193
|
+
}
|
|
1194
|
+
/**
|
|
1195
|
+
* Gets an unsigned 32-bit integer at the specified byte offset from the start of the file.
|
|
1196
|
+
* @param offset The offset, in bytes, from the start of the file where to read the data.
|
|
1197
|
+
*/
|
|
1198
|
+
async getUint32(offset) {
|
|
1199
|
+
const arrayBuffer = await this.file.read(offset, 4);
|
|
1200
|
+
const val = new Uint32Array(arrayBuffer).at(0);
|
|
1201
|
+
if (val === void 0) {
|
|
1202
|
+
throw new Error("something went wrong");
|
|
1203
|
+
}
|
|
1204
|
+
return val;
|
|
1205
|
+
}
|
|
1206
|
+
/**
|
|
1207
|
+
* Gets an unsigned 32-bit integer at the specified byte offset from the start of the file.
|
|
1208
|
+
* @param offset The offset, in bytes, from the start of the file where to read the data.
|
|
1209
|
+
*/
|
|
1210
|
+
async getBigUint64(offset) {
|
|
1211
|
+
const arrayBuffer = await this.file.read(offset, 8);
|
|
1212
|
+
const val = new BigInt64Array(arrayBuffer).at(0);
|
|
1213
|
+
if (val === void 0) {
|
|
1214
|
+
throw new Error("something went wrong");
|
|
1215
|
+
}
|
|
1216
|
+
return val;
|
|
1217
|
+
}
|
|
1218
|
+
/**
|
|
1219
|
+
* returns an ArrayBuffer whose contents are a copy of this file bytes from startOffset, inclusive, up to endOffset, exclusive.
|
|
1220
|
+
* @param startOffset The offset, in byte, from the start of the file where to start reading the data.
|
|
1221
|
+
* @param endOffset The offset, in bytes, from the start of the file where to end reading the data.
|
|
1222
|
+
*/
|
|
1223
|
+
async slice(startOffset, endOffset) {
|
|
1224
|
+
const bigLength = BigInt(endOffset) - BigInt(startOffset);
|
|
1225
|
+
if (bigLength > Number.MAX_SAFE_INTEGER) {
|
|
1226
|
+
throw new Error("too big slice");
|
|
1227
|
+
}
|
|
1228
|
+
const length = Number(bigLength);
|
|
1229
|
+
return await this.file.read(startOffset, length);
|
|
1230
|
+
}
|
|
1231
|
+
/**
|
|
1232
|
+
* the length (in bytes) of the data.
|
|
1233
|
+
*/
|
|
1234
|
+
get length() {
|
|
1235
|
+
return this.size;
|
|
1236
|
+
}
|
|
1237
|
+
};
|
|
1238
|
+
|
|
1136
1239
|
// dist/lib/file-provider/file-handle-file.js
|
|
1137
1240
|
var FileHandleFile = class {
|
|
1138
1241
|
/** The FileHandle from which data is provided */
|
|
@@ -1335,4 +1438,10 @@ var ImageSource = class extends DataSource {
|
|
|
1335
1438
|
};
|
|
1336
1439
|
__publicField(ImageSource, "type", "template");
|
|
1337
1440
|
__publicField(ImageSource, "testURL", (url) => false);
|
|
1441
|
+
|
|
1442
|
+
// dist/lib/sources/vector-source.js
|
|
1443
|
+
var VectorSource = class extends DataSource {
|
|
1444
|
+
};
|
|
1445
|
+
__publicField(VectorSource, "type", "template");
|
|
1446
|
+
__publicField(VectorSource, "testURL", (url) => false);
|
|
1338
1447
|
//# sourceMappingURL=index.cjs.map
|