@loaders.gl/core 4.0.0-alpha.18 → 4.0.0-alpha.20
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/dist.min.js +6 -5
- package/dist/es5/lib/init.js +1 -1
- package/dist/es5/lib/loader-utils/get-fetch-function.js +5 -5
- package/dist/es5/lib/loader-utils/get-fetch-function.js.map +1 -1
- package/dist/es5/lib/loader-utils/option-defaults.js +1 -0
- package/dist/es5/lib/loader-utils/option-defaults.js.map +1 -1
- package/dist/es5/null-loader.js +1 -1
- package/dist/esm/lib/init.js +1 -1
- package/dist/esm/lib/loader-utils/get-fetch-function.js +5 -5
- package/dist/esm/lib/loader-utils/get-fetch-function.js.map +1 -1
- package/dist/esm/lib/loader-utils/option-defaults.js +1 -0
- package/dist/esm/lib/loader-utils/option-defaults.js.map +1 -1
- package/dist/esm/null-loader.js +1 -1
- package/dist/lib/loader-utils/get-fetch-function.js +5 -5
- package/dist/lib/loader-utils/option-defaults.d.ts.map +1 -1
- package/dist/lib/loader-utils/option-defaults.js +1 -0
- package/dist/null-worker-node.js +1 -1
- package/dist/null-worker.js +1 -1
- package/package.json +4 -4
- package/src/lib/loader-utils/get-fetch-function.ts +5 -5
- package/src/lib/loader-utils/option-defaults.ts +1 -0
package/dist/dist.min.js
CHANGED
|
@@ -2506,6 +2506,7 @@
|
|
|
2506
2506
|
mimeType: void 0,
|
|
2507
2507
|
nothrow: false,
|
|
2508
2508
|
log: new ConsoleLog(),
|
|
2509
|
+
useLocalLibraries: false,
|
|
2509
2510
|
CDN: "https://unpkg.com/@loaders.gl",
|
|
2510
2511
|
worker: true,
|
|
2511
2512
|
maxConcurrency: 3,
|
|
@@ -3151,12 +3152,12 @@
|
|
|
3151
3152
|
// src/lib/loader-utils/get-fetch-function.ts
|
|
3152
3153
|
function getFetchFunction(options, context) {
|
|
3153
3154
|
const globalOptions = getGlobalLoaderOptions();
|
|
3154
|
-
const
|
|
3155
|
-
if (typeof
|
|
3156
|
-
return
|
|
3155
|
+
const loaderOptions = options || globalOptions;
|
|
3156
|
+
if (typeof loaderOptions.fetch === "function") {
|
|
3157
|
+
return loaderOptions.fetch;
|
|
3157
3158
|
}
|
|
3158
|
-
if (isObject(
|
|
3159
|
-
return (url) => fetchFile(url,
|
|
3159
|
+
if (isObject(loaderOptions.fetch)) {
|
|
3160
|
+
return (url) => fetchFile(url, loaderOptions.fetch);
|
|
3160
3161
|
}
|
|
3161
3162
|
if (context?.fetch) {
|
|
3162
3163
|
return context?.fetch;
|
package/dist/es5/lib/init.js
CHANGED
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _log = require("./utils/log");
|
|
8
|
-
var version = typeof "4.0.0-alpha.
|
|
8
|
+
var version = typeof "4.0.0-alpha.20" !== 'undefined' ? "4.0.0-alpha.20" : '';
|
|
9
9
|
if (!globalThis.loaders) {
|
|
10
10
|
_log.log.log(1, "loaders.gl ".concat(version))();
|
|
11
11
|
globalThis.loaders = Object.assign(globalThis.loaders || {}, {
|
|
@@ -9,13 +9,13 @@ var _fetchFile = require("../fetch/fetch-file");
|
|
|
9
9
|
var _optionUtils = require("./option-utils");
|
|
10
10
|
function getFetchFunction(options, context) {
|
|
11
11
|
var globalOptions = (0, _optionUtils.getGlobalLoaderOptions)();
|
|
12
|
-
var
|
|
13
|
-
if (typeof
|
|
14
|
-
return
|
|
12
|
+
var loaderOptions = options || globalOptions;
|
|
13
|
+
if (typeof loaderOptions.fetch === 'function') {
|
|
14
|
+
return loaderOptions.fetch;
|
|
15
15
|
}
|
|
16
|
-
if ((0, _isType.isObject)(
|
|
16
|
+
if ((0, _isType.isObject)(loaderOptions.fetch)) {
|
|
17
17
|
return function (url) {
|
|
18
|
-
return (0, _fetchFile.fetchFile)(url,
|
|
18
|
+
return (0, _fetchFile.fetchFile)(url, loaderOptions.fetch);
|
|
19
19
|
};
|
|
20
20
|
}
|
|
21
21
|
if (context !== null && context !== void 0 && context.fetch) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-fetch-function.js","names":["_isType","require","_fetchFile","_optionUtils","getFetchFunction","options","context","globalOptions","getGlobalLoaderOptions","
|
|
1
|
+
{"version":3,"file":"get-fetch-function.js","names":["_isType","require","_fetchFile","_optionUtils","getFetchFunction","options","context","globalOptions","getGlobalLoaderOptions","loaderOptions","fetch","isObject","url","fetchFile"],"sources":["../../../../src/lib/loader-utils/get-fetch-function.ts"],"sourcesContent":["// loaders.gl, MIT license\n\nimport type {LoaderContext, LoaderOptions} from '@loaders.gl/loader-utils';\nimport {isObject} from '../../javascript-utils/is-type';\nimport {fetchFile} from '../fetch/fetch-file';\nimport {getGlobalLoaderOptions} from './option-utils';\n\n/**\n * Gets the current fetch function from options and context\n * @param options\n * @param context\n */\nexport function getFetchFunction(\n options?: LoaderOptions,\n context?: Omit<LoaderContext, 'fetch'> & Partial<Pick<LoaderContext, 'fetch'>>\n) {\n const globalOptions = getGlobalLoaderOptions();\n\n const loaderOptions = options || globalOptions;\n\n // options.fetch can be a function\n if (typeof loaderOptions.fetch === 'function') {\n return loaderOptions.fetch;\n }\n\n // options.fetch can be an options object\n if (isObject(loaderOptions.fetch)) {\n return (url) => fetchFile(url, loaderOptions.fetch as RequestInit);\n }\n\n // else refer to context (from parent loader) if available\n if (context?.fetch) {\n return context?.fetch;\n }\n\n // else return the default fetch function\n return fetchFile;\n}\n"],"mappings":";;;;;;AAGA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,UAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AAOO,SAASG,gBAAgBA,CAC9BC,OAAuB,EACvBC,OAA8E,EAC9E;EACA,IAAMC,aAAa,GAAG,IAAAC,mCAAsB,EAAC,CAAC;EAE9C,IAAMC,aAAa,GAAGJ,OAAO,IAAIE,aAAa;EAG9C,IAAI,OAAOE,aAAa,CAACC,KAAK,KAAK,UAAU,EAAE;IAC7C,OAAOD,aAAa,CAACC,KAAK;EAC5B;EAGA,IAAI,IAAAC,gBAAQ,EAACF,aAAa,CAACC,KAAK,CAAC,EAAE;IACjC,OAAO,UAACE,GAAG;MAAA,OAAK,IAAAC,oBAAS,EAACD,GAAG,EAAEH,aAAa,CAACC,KAAoB,CAAC;IAAA;EACpE;EAGA,IAAIJ,OAAO,aAAPA,OAAO,eAAPA,OAAO,CAAEI,KAAK,EAAE;IAClB,OAAOJ,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEI,KAAK;EACvB;EAGA,OAAOG,oBAAS;AAClB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"option-defaults.js","names":["_loaderUtils","require","_loggers","DEFAULT_LOADER_OPTIONS","fetch","mimeType","undefined","nothrow","log","ConsoleLog","CDN","worker","maxConcurrency","maxMobileConcurrency","reuseWorkers","isBrowser","_nodeWorkers","_workerType","limit","_limitMB","batchSize","batchDebounceMs","metadata","transforms","exports","REMOVED_LOADER_OPTIONS","throws","dataType","uri","method","headers","body","mode","credentials","cache","redirect","referrer","referrerPolicy","integrity","keepalive","signal"],"sources":["../../../../src/lib/loader-utils/option-defaults.ts"],"sourcesContent":["import type {LoaderOptions} from '@loaders.gl/loader-utils';\nimport {isBrowser} from '@loaders.gl/loader-utils';\nimport {ConsoleLog} from './loggers';\n\nexport const DEFAULT_LOADER_OPTIONS: LoaderOptions = {\n // baseUri\n fetch: null,\n mimeType: undefined,\n nothrow: false,\n log: new ConsoleLog(), // A probe.gl compatible (`log.log()()` syntax) that just logs to console\n\n CDN: 'https://unpkg.com/@loaders.gl',\n worker: true, // By default, use worker if provided by loader.\n maxConcurrency: 3, // How many worker instances should be created for each loader.\n maxMobileConcurrency: 1, // How many worker instances should be created for each loader on mobile devices.\n reuseWorkers: isBrowser, // By default reuse workers in browser (Node.js refuses to terminate if browsers are running)\n _nodeWorkers: false, // By default do not support node workers\n _workerType: '', // 'test' to use locally generated workers\n\n limit: 0,\n _limitMB: 0,\n batchSize: 'auto',\n batchDebounceMs: 0,\n metadata: false, // TODO - currently only implemented for parseInBatches, adds initial metadata batch,\n transforms: []\n};\n\nexport const REMOVED_LOADER_OPTIONS = {\n throws: 'nothrow',\n dataType: '(no longer used)',\n uri: 'baseUri',\n // Warn if fetch options are used on top-level\n method: 'fetch.method',\n headers: 'fetch.headers',\n body: 'fetch.body',\n mode: 'fetch.mode',\n credentials: 'fetch.credentials',\n cache: 'fetch.cache',\n redirect: 'fetch.redirect',\n referrer: 'fetch.referrer',\n referrerPolicy: 'fetch.referrerPolicy',\n integrity: 'fetch.integrity',\n keepalive: 'fetch.keepalive',\n signal: 'fetch.signal'\n};\n"],"mappings":";;;;;;AACA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AAEO,IAAME,sBAAqC,GAAG;EAEnDC,KAAK,EAAE,IAAI;EACXC,QAAQ,EAAEC,SAAS;EACnBC,OAAO,EAAE,KAAK;EACdC,GAAG,EAAE,IAAIC,mBAAU,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"option-defaults.js","names":["_loaderUtils","require","_loggers","DEFAULT_LOADER_OPTIONS","fetch","mimeType","undefined","nothrow","log","ConsoleLog","useLocalLibraries","CDN","worker","maxConcurrency","maxMobileConcurrency","reuseWorkers","isBrowser","_nodeWorkers","_workerType","limit","_limitMB","batchSize","batchDebounceMs","metadata","transforms","exports","REMOVED_LOADER_OPTIONS","throws","dataType","uri","method","headers","body","mode","credentials","cache","redirect","referrer","referrerPolicy","integrity","keepalive","signal"],"sources":["../../../../src/lib/loader-utils/option-defaults.ts"],"sourcesContent":["import type {LoaderOptions} from '@loaders.gl/loader-utils';\nimport {isBrowser} from '@loaders.gl/loader-utils';\nimport {ConsoleLog} from './loggers';\n\nexport const DEFAULT_LOADER_OPTIONS: LoaderOptions = {\n // baseUri\n fetch: null,\n mimeType: undefined,\n nothrow: false,\n log: new ConsoleLog(), // A probe.gl compatible (`log.log()()` syntax) that just logs to console\n useLocalLibraries: false,\n\n CDN: 'https://unpkg.com/@loaders.gl',\n worker: true, // By default, use worker if provided by loader.\n maxConcurrency: 3, // How many worker instances should be created for each loader.\n maxMobileConcurrency: 1, // How many worker instances should be created for each loader on mobile devices.\n reuseWorkers: isBrowser, // By default reuse workers in browser (Node.js refuses to terminate if browsers are running)\n _nodeWorkers: false, // By default do not support node workers\n _workerType: '', // 'test' to use locally generated workers\n\n limit: 0,\n _limitMB: 0,\n batchSize: 'auto',\n batchDebounceMs: 0,\n metadata: false, // TODO - currently only implemented for parseInBatches, adds initial metadata batch,\n transforms: []\n};\n\nexport const REMOVED_LOADER_OPTIONS = {\n throws: 'nothrow',\n dataType: '(no longer used)',\n uri: 'baseUri',\n // Warn if fetch options are used on top-level\n method: 'fetch.method',\n headers: 'fetch.headers',\n body: 'fetch.body',\n mode: 'fetch.mode',\n credentials: 'fetch.credentials',\n cache: 'fetch.cache',\n redirect: 'fetch.redirect',\n referrer: 'fetch.referrer',\n referrerPolicy: 'fetch.referrerPolicy',\n integrity: 'fetch.integrity',\n keepalive: 'fetch.keepalive',\n signal: 'fetch.signal'\n};\n"],"mappings":";;;;;;AACA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AAEO,IAAME,sBAAqC,GAAG;EAEnDC,KAAK,EAAE,IAAI;EACXC,QAAQ,EAAEC,SAAS;EACnBC,OAAO,EAAE,KAAK;EACdC,GAAG,EAAE,IAAIC,mBAAU,CAAC,CAAC;EACrBC,iBAAiB,EAAE,KAAK;EAExBC,GAAG,EAAE,+BAA+B;EACpCC,MAAM,EAAE,IAAI;EACZC,cAAc,EAAE,CAAC;EACjBC,oBAAoB,EAAE,CAAC;EACvBC,YAAY,EAAEC,sBAAS;EACvBC,YAAY,EAAE,KAAK;EACnBC,WAAW,EAAE,EAAE;EAEfC,KAAK,EAAE,CAAC;EACRC,QAAQ,EAAE,CAAC;EACXC,SAAS,EAAE,MAAM;EACjBC,eAAe,EAAE,CAAC;EAClBC,QAAQ,EAAE,KAAK;EACfC,UAAU,EAAE;AACd,CAAC;AAACC,OAAA,CAAAtB,sBAAA,GAAAA,sBAAA;AAEK,IAAMuB,sBAAsB,GAAG;EACpCC,MAAM,EAAE,SAAS;EACjBC,QAAQ,EAAE,kBAAkB;EAC5BC,GAAG,EAAE,SAAS;EAEdC,MAAM,EAAE,cAAc;EACtBC,OAAO,EAAE,eAAe;EACxBC,IAAI,EAAE,YAAY;EAClBC,IAAI,EAAE,YAAY;EAClBC,WAAW,EAAE,mBAAmB;EAChCC,KAAK,EAAE,aAAa;EACpBC,QAAQ,EAAE,gBAAgB;EAC1BC,QAAQ,EAAE,gBAAgB;EAC1BC,cAAc,EAAE,sBAAsB;EACtCC,SAAS,EAAE,iBAAiB;EAC5BC,SAAS,EAAE,iBAAiB;EAC5BC,MAAM,EAAE;AACV,CAAC;AAAChB,OAAA,CAAAC,sBAAA,GAAAA,sBAAA"}
|
package/dist/es5/null-loader.js
CHANGED
|
@@ -11,7 +11,7 @@ var _awaitAsyncGenerator2 = _interopRequireDefault(require("@babel/runtime/helpe
|
|
|
11
11
|
var _wrapAsyncGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/wrapAsyncGenerator"));
|
|
12
12
|
function _asyncIterator(iterable) { var method, async, sync, retry = 2; for ("undefined" != typeof Symbol && (async = Symbol.asyncIterator, sync = Symbol.iterator); retry--;) { if (async && null != (method = iterable[async])) return method.call(iterable); if (sync && null != (method = iterable[sync])) return new AsyncFromSyncIterator(method.call(iterable)); async = "@@asyncIterator", sync = "@@iterator"; } throw new TypeError("Object is not async iterable"); }
|
|
13
13
|
function AsyncFromSyncIterator(s) { function AsyncFromSyncIteratorContinuation(r) { if (Object(r) !== r) return Promise.reject(new TypeError(r + " is not an object.")); var done = r.done; return Promise.resolve(r.value).then(function (value) { return { value: value, done: done }; }); } return AsyncFromSyncIterator = function AsyncFromSyncIterator(s) { this.s = s, this.n = s.next; }, AsyncFromSyncIterator.prototype = { s: null, n: null, next: function next() { return AsyncFromSyncIteratorContinuation(this.n.apply(this.s, arguments)); }, return: function _return(value) { var ret = this.s.return; return void 0 === ret ? Promise.resolve({ value: value, done: !0 }) : AsyncFromSyncIteratorContinuation(ret.apply(this.s, arguments)); }, throw: function _throw(value) { var thr = this.s.return; return void 0 === thr ? Promise.reject(value) : AsyncFromSyncIteratorContinuation(thr.apply(this.s, arguments)); } }, new AsyncFromSyncIterator(s); }
|
|
14
|
-
var VERSION = typeof "4.0.0-alpha.
|
|
14
|
+
var VERSION = typeof "4.0.0-alpha.20" !== 'undefined' ? "4.0.0-alpha.20" : 'latest';
|
|
15
15
|
var NullWorkerLoader = {
|
|
16
16
|
name: 'Null loader',
|
|
17
17
|
id: 'null',
|
package/dist/esm/lib/init.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { log } from './utils/log';
|
|
2
|
-
const version = typeof "4.0.0-alpha.
|
|
2
|
+
const version = typeof "4.0.0-alpha.20" !== 'undefined' ? "4.0.0-alpha.20" : '';
|
|
3
3
|
if (!globalThis.loaders) {
|
|
4
4
|
log.log(1, "loaders.gl ".concat(version))();
|
|
5
5
|
globalThis.loaders = Object.assign(globalThis.loaders || {}, {
|
|
@@ -3,12 +3,12 @@ import { fetchFile } from '../fetch/fetch-file';
|
|
|
3
3
|
import { getGlobalLoaderOptions } from './option-utils';
|
|
4
4
|
export function getFetchFunction(options, context) {
|
|
5
5
|
const globalOptions = getGlobalLoaderOptions();
|
|
6
|
-
const
|
|
7
|
-
if (typeof
|
|
8
|
-
return
|
|
6
|
+
const loaderOptions = options || globalOptions;
|
|
7
|
+
if (typeof loaderOptions.fetch === 'function') {
|
|
8
|
+
return loaderOptions.fetch;
|
|
9
9
|
}
|
|
10
|
-
if (isObject(
|
|
11
|
-
return url => fetchFile(url,
|
|
10
|
+
if (isObject(loaderOptions.fetch)) {
|
|
11
|
+
return url => fetchFile(url, loaderOptions.fetch);
|
|
12
12
|
}
|
|
13
13
|
if (context !== null && context !== void 0 && context.fetch) {
|
|
14
14
|
return context === null || context === void 0 ? void 0 : context.fetch;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-fetch-function.js","names":["isObject","fetchFile","getGlobalLoaderOptions","getFetchFunction","options","context","globalOptions","
|
|
1
|
+
{"version":3,"file":"get-fetch-function.js","names":["isObject","fetchFile","getGlobalLoaderOptions","getFetchFunction","options","context","globalOptions","loaderOptions","fetch","url"],"sources":["../../../../src/lib/loader-utils/get-fetch-function.ts"],"sourcesContent":["// loaders.gl, MIT license\n\nimport type {LoaderContext, LoaderOptions} from '@loaders.gl/loader-utils';\nimport {isObject} from '../../javascript-utils/is-type';\nimport {fetchFile} from '../fetch/fetch-file';\nimport {getGlobalLoaderOptions} from './option-utils';\n\n/**\n * Gets the current fetch function from options and context\n * @param options\n * @param context\n */\nexport function getFetchFunction(\n options?: LoaderOptions,\n context?: Omit<LoaderContext, 'fetch'> & Partial<Pick<LoaderContext, 'fetch'>>\n) {\n const globalOptions = getGlobalLoaderOptions();\n\n const loaderOptions = options || globalOptions;\n\n // options.fetch can be a function\n if (typeof loaderOptions.fetch === 'function') {\n return loaderOptions.fetch;\n }\n\n // options.fetch can be an options object\n if (isObject(loaderOptions.fetch)) {\n return (url) => fetchFile(url, loaderOptions.fetch as RequestInit);\n }\n\n // else refer to context (from parent loader) if available\n if (context?.fetch) {\n return context?.fetch;\n }\n\n // else return the default fetch function\n return fetchFile;\n}\n"],"mappings":"AAGA,SAAQA,QAAQ,QAAO,gCAAgC;AACvD,SAAQC,SAAS,QAAO,qBAAqB;AAC7C,SAAQC,sBAAsB,QAAO,gBAAgB;AAOrD,OAAO,SAASC,gBAAgBA,CAC9BC,OAAuB,EACvBC,OAA8E,EAC9E;EACA,MAAMC,aAAa,GAAGJ,sBAAsB,CAAC,CAAC;EAE9C,MAAMK,aAAa,GAAGH,OAAO,IAAIE,aAAa;EAG9C,IAAI,OAAOC,aAAa,CAACC,KAAK,KAAK,UAAU,EAAE;IAC7C,OAAOD,aAAa,CAACC,KAAK;EAC5B;EAGA,IAAIR,QAAQ,CAACO,aAAa,CAACC,KAAK,CAAC,EAAE;IACjC,OAAQC,GAAG,IAAKR,SAAS,CAACQ,GAAG,EAAEF,aAAa,CAACC,KAAoB,CAAC;EACpE;EAGA,IAAIH,OAAO,aAAPA,OAAO,eAAPA,OAAO,CAAEG,KAAK,EAAE;IAClB,OAAOH,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEG,KAAK;EACvB;EAGA,OAAOP,SAAS;AAClB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"option-defaults.js","names":["isBrowser","ConsoleLog","DEFAULT_LOADER_OPTIONS","fetch","mimeType","undefined","nothrow","log","CDN","worker","maxConcurrency","maxMobileConcurrency","reuseWorkers","_nodeWorkers","_workerType","limit","_limitMB","batchSize","batchDebounceMs","metadata","transforms","REMOVED_LOADER_OPTIONS","throws","dataType","uri","method","headers","body","mode","credentials","cache","redirect","referrer","referrerPolicy","integrity","keepalive","signal"],"sources":["../../../../src/lib/loader-utils/option-defaults.ts"],"sourcesContent":["import type {LoaderOptions} from '@loaders.gl/loader-utils';\nimport {isBrowser} from '@loaders.gl/loader-utils';\nimport {ConsoleLog} from './loggers';\n\nexport const DEFAULT_LOADER_OPTIONS: LoaderOptions = {\n // baseUri\n fetch: null,\n mimeType: undefined,\n nothrow: false,\n log: new ConsoleLog(), // A probe.gl compatible (`log.log()()` syntax) that just logs to console\n\n CDN: 'https://unpkg.com/@loaders.gl',\n worker: true, // By default, use worker if provided by loader.\n maxConcurrency: 3, // How many worker instances should be created for each loader.\n maxMobileConcurrency: 1, // How many worker instances should be created for each loader on mobile devices.\n reuseWorkers: isBrowser, // By default reuse workers in browser (Node.js refuses to terminate if browsers are running)\n _nodeWorkers: false, // By default do not support node workers\n _workerType: '', // 'test' to use locally generated workers\n\n limit: 0,\n _limitMB: 0,\n batchSize: 'auto',\n batchDebounceMs: 0,\n metadata: false, // TODO - currently only implemented for parseInBatches, adds initial metadata batch,\n transforms: []\n};\n\nexport const REMOVED_LOADER_OPTIONS = {\n throws: 'nothrow',\n dataType: '(no longer used)',\n uri: 'baseUri',\n // Warn if fetch options are used on top-level\n method: 'fetch.method',\n headers: 'fetch.headers',\n body: 'fetch.body',\n mode: 'fetch.mode',\n credentials: 'fetch.credentials',\n cache: 'fetch.cache',\n redirect: 'fetch.redirect',\n referrer: 'fetch.referrer',\n referrerPolicy: 'fetch.referrerPolicy',\n integrity: 'fetch.integrity',\n keepalive: 'fetch.keepalive',\n signal: 'fetch.signal'\n};\n"],"mappings":"AACA,SAAQA,SAAS,QAAO,0BAA0B;AAClD,SAAQC,UAAU,QAAO,WAAW;AAEpC,OAAO,MAAMC,sBAAqC,GAAG;EAEnDC,KAAK,EAAE,IAAI;EACXC,QAAQ,EAAEC,SAAS;EACnBC,OAAO,EAAE,KAAK;EACdC,GAAG,EAAE,IAAIN,UAAU,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"option-defaults.js","names":["isBrowser","ConsoleLog","DEFAULT_LOADER_OPTIONS","fetch","mimeType","undefined","nothrow","log","useLocalLibraries","CDN","worker","maxConcurrency","maxMobileConcurrency","reuseWorkers","_nodeWorkers","_workerType","limit","_limitMB","batchSize","batchDebounceMs","metadata","transforms","REMOVED_LOADER_OPTIONS","throws","dataType","uri","method","headers","body","mode","credentials","cache","redirect","referrer","referrerPolicy","integrity","keepalive","signal"],"sources":["../../../../src/lib/loader-utils/option-defaults.ts"],"sourcesContent":["import type {LoaderOptions} from '@loaders.gl/loader-utils';\nimport {isBrowser} from '@loaders.gl/loader-utils';\nimport {ConsoleLog} from './loggers';\n\nexport const DEFAULT_LOADER_OPTIONS: LoaderOptions = {\n // baseUri\n fetch: null,\n mimeType: undefined,\n nothrow: false,\n log: new ConsoleLog(), // A probe.gl compatible (`log.log()()` syntax) that just logs to console\n useLocalLibraries: false,\n\n CDN: 'https://unpkg.com/@loaders.gl',\n worker: true, // By default, use worker if provided by loader.\n maxConcurrency: 3, // How many worker instances should be created for each loader.\n maxMobileConcurrency: 1, // How many worker instances should be created for each loader on mobile devices.\n reuseWorkers: isBrowser, // By default reuse workers in browser (Node.js refuses to terminate if browsers are running)\n _nodeWorkers: false, // By default do not support node workers\n _workerType: '', // 'test' to use locally generated workers\n\n limit: 0,\n _limitMB: 0,\n batchSize: 'auto',\n batchDebounceMs: 0,\n metadata: false, // TODO - currently only implemented for parseInBatches, adds initial metadata batch,\n transforms: []\n};\n\nexport const REMOVED_LOADER_OPTIONS = {\n throws: 'nothrow',\n dataType: '(no longer used)',\n uri: 'baseUri',\n // Warn if fetch options are used on top-level\n method: 'fetch.method',\n headers: 'fetch.headers',\n body: 'fetch.body',\n mode: 'fetch.mode',\n credentials: 'fetch.credentials',\n cache: 'fetch.cache',\n redirect: 'fetch.redirect',\n referrer: 'fetch.referrer',\n referrerPolicy: 'fetch.referrerPolicy',\n integrity: 'fetch.integrity',\n keepalive: 'fetch.keepalive',\n signal: 'fetch.signal'\n};\n"],"mappings":"AACA,SAAQA,SAAS,QAAO,0BAA0B;AAClD,SAAQC,UAAU,QAAO,WAAW;AAEpC,OAAO,MAAMC,sBAAqC,GAAG;EAEnDC,KAAK,EAAE,IAAI;EACXC,QAAQ,EAAEC,SAAS;EACnBC,OAAO,EAAE,KAAK;EACdC,GAAG,EAAE,IAAIN,UAAU,CAAC,CAAC;EACrBO,iBAAiB,EAAE,KAAK;EAExBC,GAAG,EAAE,+BAA+B;EACpCC,MAAM,EAAE,IAAI;EACZC,cAAc,EAAE,CAAC;EACjBC,oBAAoB,EAAE,CAAC;EACvBC,YAAY,EAAEb,SAAS;EACvBc,YAAY,EAAE,KAAK;EACnBC,WAAW,EAAE,EAAE;EAEfC,KAAK,EAAE,CAAC;EACRC,QAAQ,EAAE,CAAC;EACXC,SAAS,EAAE,MAAM;EACjBC,eAAe,EAAE,CAAC;EAClBC,QAAQ,EAAE,KAAK;EACfC,UAAU,EAAE;AACd,CAAC;AAED,OAAO,MAAMC,sBAAsB,GAAG;EACpCC,MAAM,EAAE,SAAS;EACjBC,QAAQ,EAAE,kBAAkB;EAC5BC,GAAG,EAAE,SAAS;EAEdC,MAAM,EAAE,cAAc;EACtBC,OAAO,EAAE,eAAe;EACxBC,IAAI,EAAE,YAAY;EAClBC,IAAI,EAAE,YAAY;EAClBC,WAAW,EAAE,mBAAmB;EAChCC,KAAK,EAAE,aAAa;EACpBC,QAAQ,EAAE,gBAAgB;EAC1BC,QAAQ,EAAE,gBAAgB;EAC1BC,cAAc,EAAE,sBAAsB;EACtCC,SAAS,EAAE,iBAAiB;EAC5BC,SAAS,EAAE,iBAAiB;EAC5BC,MAAM,EAAE;AACV,CAAC"}
|
package/dist/esm/null-loader.js
CHANGED
|
@@ -12,14 +12,14 @@ const option_utils_1 = require("./option-utils");
|
|
|
12
12
|
*/
|
|
13
13
|
function getFetchFunction(options, context) {
|
|
14
14
|
const globalOptions = (0, option_utils_1.getGlobalLoaderOptions)();
|
|
15
|
-
const
|
|
15
|
+
const loaderOptions = options || globalOptions;
|
|
16
16
|
// options.fetch can be a function
|
|
17
|
-
if (typeof
|
|
18
|
-
return
|
|
17
|
+
if (typeof loaderOptions.fetch === 'function') {
|
|
18
|
+
return loaderOptions.fetch;
|
|
19
19
|
}
|
|
20
20
|
// options.fetch can be an options object
|
|
21
|
-
if ((0, is_type_1.isObject)(
|
|
22
|
-
return (url) => (0, fetch_file_1.fetchFile)(url,
|
|
21
|
+
if ((0, is_type_1.isObject)(loaderOptions.fetch)) {
|
|
22
|
+
return (url) => (0, fetch_file_1.fetchFile)(url, loaderOptions.fetch);
|
|
23
23
|
}
|
|
24
24
|
// else refer to context (from parent loader) if available
|
|
25
25
|
if (context?.fetch) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"option-defaults.d.ts","sourceRoot":"","sources":["../../../src/lib/loader-utils/option-defaults.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,0BAA0B,CAAC;AAI5D,eAAO,MAAM,sBAAsB,EAAE,
|
|
1
|
+
{"version":3,"file":"option-defaults.d.ts","sourceRoot":"","sources":["../../../src/lib/loader-utils/option-defaults.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,0BAA0B,CAAC;AAI5D,eAAO,MAAM,sBAAsB,EAAE,aAsBpC,CAAC;AAEF,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;CAiBlC,CAAC"}
|
package/dist/null-worker-node.js
CHANGED
|
@@ -201,7 +201,7 @@ async function parseData({ loader, arrayBuffer, options, context }) {
|
|
|
201
201
|
}
|
|
202
202
|
|
|
203
203
|
// src/null-loader.ts
|
|
204
|
-
var VERSION = true ? "4.0.0-alpha.
|
|
204
|
+
var VERSION = true ? "4.0.0-alpha.20" : "latest";
|
|
205
205
|
function parseSync(arrayBuffer, options, context) {
|
|
206
206
|
if (!options.null.echoParameters)
|
|
207
207
|
return null;
|
package/dist/null-worker.js
CHANGED
|
@@ -184,7 +184,7 @@
|
|
|
184
184
|
}
|
|
185
185
|
|
|
186
186
|
// src/null-loader.ts
|
|
187
|
-
var VERSION = true ? "4.0.0-alpha.
|
|
187
|
+
var VERSION = true ? "4.0.0-alpha.20" : "latest";
|
|
188
188
|
function parseSync(arrayBuffer, options, context) {
|
|
189
189
|
if (!options.null.echoParameters)
|
|
190
190
|
return null;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@loaders.gl/core",
|
|
3
|
-
"version": "4.0.0-alpha.
|
|
3
|
+
"version": "4.0.0-alpha.20",
|
|
4
4
|
"description": "The core API for working with loaders.gl loaders and writers",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"publishConfig": {
|
|
@@ -47,9 +47,9 @@
|
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
49
|
"@babel/runtime": "^7.3.1",
|
|
50
|
-
"@loaders.gl/loader-utils": "4.0.0-alpha.
|
|
51
|
-
"@loaders.gl/worker-utils": "4.0.0-alpha.
|
|
50
|
+
"@loaders.gl/loader-utils": "4.0.0-alpha.20",
|
|
51
|
+
"@loaders.gl/worker-utils": "4.0.0-alpha.20",
|
|
52
52
|
"@probe.gl/log": "^4.0.2"
|
|
53
53
|
},
|
|
54
|
-
"gitHead": "
|
|
54
|
+
"gitHead": "ac122e83102657c38207d59c631a5ce4e7aa46bd"
|
|
55
55
|
}
|
|
@@ -16,16 +16,16 @@ export function getFetchFunction(
|
|
|
16
16
|
) {
|
|
17
17
|
const globalOptions = getGlobalLoaderOptions();
|
|
18
18
|
|
|
19
|
-
const
|
|
19
|
+
const loaderOptions = options || globalOptions;
|
|
20
20
|
|
|
21
21
|
// options.fetch can be a function
|
|
22
|
-
if (typeof
|
|
23
|
-
return
|
|
22
|
+
if (typeof loaderOptions.fetch === 'function') {
|
|
23
|
+
return loaderOptions.fetch;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
// options.fetch can be an options object
|
|
27
|
-
if (isObject(
|
|
28
|
-
return (url) => fetchFile(url,
|
|
27
|
+
if (isObject(loaderOptions.fetch)) {
|
|
28
|
+
return (url) => fetchFile(url, loaderOptions.fetch as RequestInit);
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
// else refer to context (from parent loader) if available
|
|
@@ -8,6 +8,7 @@ export const DEFAULT_LOADER_OPTIONS: LoaderOptions = {
|
|
|
8
8
|
mimeType: undefined,
|
|
9
9
|
nothrow: false,
|
|
10
10
|
log: new ConsoleLog(), // A probe.gl compatible (`log.log()()` syntax) that just logs to console
|
|
11
|
+
useLocalLibraries: false,
|
|
11
12
|
|
|
12
13
|
CDN: 'https://unpkg.com/@loaders.gl',
|
|
13
14
|
worker: true, // By default, use worker if provided by loader.
|