@loaders.gl/excel 4.0.1 → 4.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/excel-worker.js +32 -24
- package/package.json +4 -4
package/dist/excel-worker.js
CHANGED
|
@@ -36780,61 +36780,69 @@
|
|
|
36780
36780
|
}
|
|
36781
36781
|
|
|
36782
36782
|
// ../worker-utils/src/lib/worker-farm/worker-body.ts
|
|
36783
|
-
function getParentPort() {
|
|
36783
|
+
async function getParentPort() {
|
|
36784
36784
|
let parentPort;
|
|
36785
36785
|
try {
|
|
36786
36786
|
eval("globalThis.parentPort = require('worker_threads').parentPort");
|
|
36787
36787
|
parentPort = globalThis.parentPort;
|
|
36788
36788
|
} catch {
|
|
36789
|
+
try {
|
|
36790
|
+
eval("globalThis.workerThreadsPromise = import('worker_threads')");
|
|
36791
|
+
const workerThreads = await globalThis.workerThreadsPromise;
|
|
36792
|
+
parentPort = workerThreads.parentPort;
|
|
36793
|
+
} catch (error) {
|
|
36794
|
+
console.error(error.message);
|
|
36795
|
+
}
|
|
36789
36796
|
}
|
|
36790
36797
|
return parentPort;
|
|
36791
36798
|
}
|
|
36792
36799
|
var onMessageWrapperMap = /* @__PURE__ */ new Map();
|
|
36793
36800
|
var WorkerBody = class {
|
|
36794
36801
|
/** Check that we are actually in a worker thread */
|
|
36795
|
-
static inWorkerThread() {
|
|
36796
|
-
return typeof self !== "undefined" || Boolean(getParentPort());
|
|
36802
|
+
static async inWorkerThread() {
|
|
36803
|
+
return typeof self !== "undefined" || Boolean(await getParentPort());
|
|
36797
36804
|
}
|
|
36798
36805
|
/*
|
|
36799
36806
|
* (type: WorkerMessageType, payload: WorkerMessagePayload) => any
|
|
36800
36807
|
*/
|
|
36801
36808
|
static set onmessage(onMessage) {
|
|
36802
|
-
function handleMessage(message) {
|
|
36803
|
-
const
|
|
36804
|
-
const { type, payload } =
|
|
36809
|
+
async function handleMessage(message) {
|
|
36810
|
+
const parentPort2 = await getParentPort();
|
|
36811
|
+
const { type, payload } = parentPort2 ? message : message.data;
|
|
36805
36812
|
onMessage(type, payload);
|
|
36806
36813
|
}
|
|
36807
|
-
|
|
36808
|
-
|
|
36809
|
-
|
|
36810
|
-
|
|
36811
|
-
|
|
36812
|
-
|
|
36813
|
-
|
|
36814
|
+
getParentPort().then((parentPort2) => {
|
|
36815
|
+
if (parentPort2) {
|
|
36816
|
+
parentPort2.on("message", handleMessage);
|
|
36817
|
+
parentPort2.on("exit", () => console.debug("Node worker closing"));
|
|
36818
|
+
} else {
|
|
36819
|
+
globalThis.onmessage = handleMessage;
|
|
36820
|
+
}
|
|
36821
|
+
});
|
|
36814
36822
|
}
|
|
36815
|
-
static addEventListener(onMessage) {
|
|
36823
|
+
static async addEventListener(onMessage) {
|
|
36816
36824
|
let onMessageWrapper = onMessageWrapperMap.get(onMessage);
|
|
36817
36825
|
if (!onMessageWrapper) {
|
|
36818
|
-
onMessageWrapper = (message) => {
|
|
36826
|
+
onMessageWrapper = async (message) => {
|
|
36819
36827
|
if (!isKnownMessage(message)) {
|
|
36820
36828
|
return;
|
|
36821
36829
|
}
|
|
36822
|
-
const parentPort3 = getParentPort();
|
|
36830
|
+
const parentPort3 = await getParentPort();
|
|
36823
36831
|
const { type, payload } = parentPort3 ? message : message.data;
|
|
36824
36832
|
onMessage(type, payload);
|
|
36825
36833
|
};
|
|
36826
36834
|
}
|
|
36827
|
-
const parentPort2 = getParentPort();
|
|
36835
|
+
const parentPort2 = await getParentPort();
|
|
36828
36836
|
if (parentPort2) {
|
|
36829
36837
|
console.error("not implemented");
|
|
36830
36838
|
} else {
|
|
36831
36839
|
globalThis.addEventListener("message", onMessageWrapper);
|
|
36832
36840
|
}
|
|
36833
36841
|
}
|
|
36834
|
-
static removeEventListener(onMessage) {
|
|
36842
|
+
static async removeEventListener(onMessage) {
|
|
36835
36843
|
const onMessageWrapper = onMessageWrapperMap.get(onMessage);
|
|
36836
36844
|
onMessageWrapperMap.delete(onMessage);
|
|
36837
|
-
const parentPort2 = getParentPort();
|
|
36845
|
+
const parentPort2 = await getParentPort();
|
|
36838
36846
|
if (parentPort2) {
|
|
36839
36847
|
console.error("not implemented");
|
|
36840
36848
|
} else {
|
|
@@ -36846,10 +36854,10 @@
|
|
|
36846
36854
|
* @param type
|
|
36847
36855
|
* @param payload
|
|
36848
36856
|
*/
|
|
36849
|
-
static postMessage(type, payload) {
|
|
36857
|
+
static async postMessage(type, payload) {
|
|
36850
36858
|
const data = { source: "loaders.gl", type, payload };
|
|
36851
36859
|
const transferList = getTransferList(payload);
|
|
36852
|
-
const parentPort2 = getParentPort();
|
|
36860
|
+
const parentPort2 = await getParentPort();
|
|
36853
36861
|
if (parentPort2) {
|
|
36854
36862
|
parentPort2.postMessage(data, transferList);
|
|
36855
36863
|
} else {
|
|
@@ -36864,8 +36872,8 @@
|
|
|
36864
36872
|
|
|
36865
36873
|
// ../loader-utils/src/lib/worker-loader-utils/create-loader-worker.ts
|
|
36866
36874
|
var requestId = 0;
|
|
36867
|
-
function createLoaderWorker(loader) {
|
|
36868
|
-
if (!WorkerBody.inWorkerThread()) {
|
|
36875
|
+
async function createLoaderWorker(loader) {
|
|
36876
|
+
if (!await WorkerBody.inWorkerThread()) {
|
|
36869
36877
|
return;
|
|
36870
36878
|
}
|
|
36871
36879
|
WorkerBody.onmessage = async (type, payload) => {
|
|
@@ -36944,7 +36952,7 @@
|
|
|
36944
36952
|
}
|
|
36945
36953
|
|
|
36946
36954
|
// src/excel-loader.ts
|
|
36947
|
-
var VERSION = true ? "4.0.
|
|
36955
|
+
var VERSION = true ? "4.0.2" : "latest";
|
|
36948
36956
|
var DEFAULT_EXCEL_LOADER_OPTIONS = {
|
|
36949
36957
|
excel: {
|
|
36950
36958
|
shape: "object-row-table",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@loaders.gl/excel",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.2",
|
|
4
4
|
"description": "Framework-independent loader for Excel files",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -43,9 +43,9 @@
|
|
|
43
43
|
"build-worker": "esbuild src/workers/excel-worker.ts --bundle --outfile=dist/excel-worker.js --define:__VERSION__=\\\"$npm_package_version\\\""
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@loaders.gl/loader-utils": "4.0.
|
|
47
|
-
"@loaders.gl/schema": "4.0.
|
|
46
|
+
"@loaders.gl/loader-utils": "4.0.2",
|
|
47
|
+
"@loaders.gl/schema": "4.0.2",
|
|
48
48
|
"xlsx": "^0.17.0"
|
|
49
49
|
},
|
|
50
|
-
"gitHead": "
|
|
50
|
+
"gitHead": "471058d109d5652f28c32c1f296fd632f9a5c806"
|
|
51
51
|
}
|