@loaders.gl/excel 4.2.0-alpha.6 → 4.2.0-beta.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.
@@ -1,13 +1,36 @@
1
- import type { Loader, LoaderOptions } from '@loaders.gl/loader-utils';
1
+ import type { LoaderOptions } from '@loaders.gl/loader-utils';
2
2
  import type { ObjectRowTable } from '@loaders.gl/schema';
3
3
  export type ExcelLoaderOptions = LoaderOptions & {
4
+ /** Options for ExcelLoader */
4
5
  excel?: {
5
- shape: 'object-row-table';
6
+ /** Format of returned data */
7
+ shape?: 'object-row-table';
8
+ /** Specify which sheet to load, if omitted loads default sheet */
6
9
  sheet?: string;
10
+ /** Override the URL to the worker bundle (by default loads from unpkg.com) */
11
+ workerUrl?: string;
7
12
  };
8
13
  };
9
14
  /**
10
15
  * Worker Loader for Excel files
11
16
  */
12
- export declare const ExcelLoader: Loader<ObjectRowTable, never, ExcelLoaderOptions>;
17
+ export declare const ExcelLoader: {
18
+ readonly dataType: ObjectRowTable;
19
+ readonly batchType: never;
20
+ readonly name: "Excel";
21
+ readonly id: "excel";
22
+ readonly module: "excel";
23
+ readonly version: any;
24
+ readonly worker: true;
25
+ readonly extensions: ["xls", "xlsb", "xlsm", "xlsx"];
26
+ readonly mimeTypes: ["application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "application/vnd.ms-excel"];
27
+ readonly category: "table";
28
+ readonly binary: true;
29
+ readonly options: {
30
+ readonly excel: {
31
+ readonly shape: "object-row-table";
32
+ readonly sheet: undefined;
33
+ };
34
+ };
35
+ };
13
36
  //# sourceMappingURL=excel-loader.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"excel-loader.d.ts","sourceRoot":"","sources":["../src/excel-loader.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,MAAM,EAAE,aAAa,EAAC,MAAM,0BAA0B,CAAC;AACpE,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,oBAAoB,CAAC;AAMvD,MAAM,MAAM,kBAAkB,GAAG,aAAa,GAAG;IAC/C,KAAK,CAAC,EAAE;QACN,KAAK,EAA4B,kBAAkB,CAAC;QACpD,KAAK,CAAC,EAAE,MAAM,CAAC;KAChB,CAAC;CACH,CAAC;AASF;;GAEG;AACH,eAAO,MAAM,WAAW,EAAE,MAAM,CAAC,cAAc,EAAE,KAAK,EAAE,kBAAkB,CAczE,CAAC"}
1
+ {"version":3,"file":"excel-loader.d.ts","sourceRoot":"","sources":["../src/excel-loader.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAS,aAAa,EAAC,MAAM,0BAA0B,CAAC;AACpE,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,oBAAoB,CAAC;AAMvD,MAAM,MAAM,kBAAkB,GAAG,aAAa,GAAG;IAC/C,8BAA8B;IAC9B,KAAK,CAAC,EAAE;QACN,8BAA8B;QAC9B,KAAK,CAAC,EAA4B,kBAAkB,CAAC;QACrD,kEAAkE;QAClE,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,8EAA8E;QAC9E,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB,CAAC;CACH,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;CAqB8C,CAAC"}
@@ -3,17 +3,13 @@
3
3
  // Copyright (c) vis.gl contributors
4
4
  // __VERSION__ is injected by babel-plugin-version-inline
5
5
  // @ts-ignore TS2304: Cannot find name '__VERSION__'.
6
- const VERSION = typeof "4.2.0-alpha.5" !== 'undefined' ? "4.2.0-alpha.5" : 'latest';
7
- const DEFAULT_EXCEL_LOADER_OPTIONS = {
8
- excel: {
9
- shape: 'object-row-table',
10
- sheet: undefined // Load default Sheet
11
- }
12
- };
6
+ const VERSION = typeof "4.2.0-beta.1" !== 'undefined' ? "4.2.0-beta.1" : 'latest';
13
7
  /**
14
8
  * Worker Loader for Excel files
15
9
  */
16
10
  export const ExcelLoader = {
11
+ dataType: null,
12
+ batchType: null,
17
13
  name: 'Excel',
18
14
  id: 'excel',
19
15
  module: 'excel',
@@ -26,5 +22,10 @@ export const ExcelLoader = {
26
22
  ],
27
23
  category: 'table',
28
24
  binary: true,
29
- options: DEFAULT_EXCEL_LOADER_OPTIONS
25
+ options: {
26
+ excel: {
27
+ shape: 'object-row-table',
28
+ sheet: undefined // Load default Sheet
29
+ }
30
+ }
30
31
  };
@@ -200,15 +200,10 @@
200
200
  }
201
201
 
202
202
  // src/excel-loader.ts
203
- var VERSION = true ? "4.2.0-alpha.5" : "latest";
204
- var DEFAULT_EXCEL_LOADER_OPTIONS = {
205
- excel: {
206
- shape: "object-row-table",
207
- sheet: void 0
208
- // Load default Sheet
209
- }
210
- };
203
+ var VERSION = true ? "4.2.0-beta.1" : "latest";
211
204
  var ExcelLoader = {
205
+ dataType: null,
206
+ batchType: null,
212
207
  name: "Excel",
213
208
  id: "excel",
214
209
  module: "excel",
@@ -221,7 +216,13 @@
221
216
  ],
222
217
  category: "table",
223
218
  binary: true,
224
- options: DEFAULT_EXCEL_LOADER_OPTIONS
219
+ options: {
220
+ excel: {
221
+ shape: "object-row-table",
222
+ sheet: void 0
223
+ // Load default Sheet
224
+ }
225
+ }
225
226
  };
226
227
 
227
228
  // ../../node_modules/xlsx/xlsx.mjs
package/dist/index.cjs CHANGED
@@ -26,15 +26,10 @@ __export(dist_exports, {
26
26
  module.exports = __toCommonJS(dist_exports);
27
27
 
28
28
  // dist/excel-loader.js
29
- var VERSION = true ? "4.2.0-alpha.5" : "latest";
30
- var DEFAULT_EXCEL_LOADER_OPTIONS = {
31
- excel: {
32
- shape: "object-row-table",
33
- sheet: void 0
34
- // Load default Sheet
35
- }
36
- };
29
+ var VERSION = true ? "4.2.0-beta.1" : "latest";
37
30
  var ExcelLoader = {
31
+ dataType: null,
32
+ batchType: null,
38
33
  name: "Excel",
39
34
  id: "excel",
40
35
  module: "excel",
@@ -47,7 +42,13 @@ var ExcelLoader = {
47
42
  ],
48
43
  category: "table",
49
44
  binary: true,
50
- options: DEFAULT_EXCEL_LOADER_OPTIONS
45
+ options: {
46
+ excel: {
47
+ shape: "object-row-table",
48
+ sheet: void 0
49
+ // Load default Sheet
50
+ }
51
+ }
51
52
  };
52
53
 
53
54
  // dist/lib/parse-excel.js
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["index.js", "excel-loader.js", "lib/parse-excel.js"],
4
- "sourcesContent": ["// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { ExcelLoader as ExcelWorkerLoader } from \"./excel-loader.js\";\nimport { parseExcel } from \"./lib/parse-excel.js\";\nexport { ExcelWorkerLoader };\n/**\n * Loader for Excel files\n */\nexport const ExcelLoader = {\n ...ExcelWorkerLoader,\n async parse(arrayBuffer, options) {\n const data = parseExcel(arrayBuffer, options);\n return { shape: 'object-row-table', data };\n }\n};\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof \"4.2.0-alpha.5\" !== 'undefined' ? \"4.2.0-alpha.5\" : 'latest';\nconst DEFAULT_EXCEL_LOADER_OPTIONS = {\n excel: {\n shape: 'object-row-table',\n sheet: undefined // Load default Sheet\n }\n};\n/**\n * Worker Loader for Excel files\n */\nexport const ExcelLoader = {\n name: 'Excel',\n id: 'excel',\n module: 'excel',\n version: VERSION,\n worker: true,\n extensions: ['xls', 'xlsb', 'xlsm', 'xlsx'],\n mimeTypes: [\n 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',\n 'application/vnd.ms-excel'\n ],\n category: 'table',\n binary: true,\n options: DEFAULT_EXCEL_LOADER_OPTIONS\n};\n", "import { utils, read } from 'xlsx';\n// import {convertToArrayRow} from '@loaders.gl/schema';\n// local table names cache with dataUrl/tableNames array key/values\nconst dataTableNamesMap = {};\n/**\n * Gets local or remote Excel file data.\n * @param arrayBuffer Loaded data\n * @param options Data parse options.\n */\nexport function parseExcel(arrayBuffer, options) {\n const dataUrl = 'dummy';\n // const dataFileType: string = dataUrl.substr(dataUrl.lastIndexOf('.')); // file extension\n // create Excel 'workbook'\n const workbook = read(arrayBuffer, {\n type: 'array'\n // cellDates: true\n });\n // load data sheets\n let dataRows = [];\n dataTableNamesMap[dataUrl] = [];\n if (workbook.SheetNames.length > 0) {\n if (workbook.SheetNames.length > 1) {\n // cache sheet names\n dataTableNamesMap[dataUrl] = workbook.SheetNames;\n // eslint-ignore-next-line\n // console.debug(`getData(): file: sheetNames:`, workbook.SheetNames);\n }\n // determine spreadsheet to load\n let sheetName = workbook.SheetNames[0];\n if (options?.excel?.sheet && workbook.SheetNames.indexOf(options?.excel?.sheet) >= 0) {\n // reset to requested table name\n sheetName = options?.excel?.sheet;\n }\n // get worksheet data row objects array\n const worksheet = workbook.Sheets[sheetName];\n dataRows = utils.sheet_to_json(worksheet);\n // const headers = dataRows.length ? Object.keys(dataRows[0]) : [];\n // if (options?.excel?.type === 'array-row-table') {\n // dataRows = dataRows.map(row => convertToArrayRow(row, headers))\n // }\n }\n return dataRows;\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA,qBAAAA;AAAA,EAAA;AAAA;AAAA;;;ACKA,IAAM,UAAU,OAAyC,kBAAkB;AAC3E,IAAM,+BAA+B;AAAA,EACjC,OAAO;AAAA,IACH,OAAO;AAAA,IACP,OAAO;AAAA;AAAA,EACX;AACJ;AAIO,IAAM,cAAc;AAAA,EACvB,MAAM;AAAA,EACN,IAAI;AAAA,EACJ,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,QAAQ;AAAA,EACR,YAAY,CAAC,OAAO,QAAQ,QAAQ,MAAM;AAAA,EAC1C,WAAW;AAAA,IACP;AAAA,IACA;AAAA,EACJ;AAAA,EACA,UAAU;AAAA,EACV,QAAQ;AAAA,EACR,SAAS;AACb;;;AC7BA,kBAA4B;AAG5B,IAAM,oBAAoB,CAAC;AAMpB,SAAS,WAAW,aAAa,SAAS;AATjD;AAUI,QAAM,UAAU;AAGhB,QAAM,eAAW,kBAAK,aAAa;AAAA,IAC/B,MAAM;AAAA;AAAA,EAEV,CAAC;AAED,MAAI,WAAW,CAAC;AAChB,oBAAkB,OAAO,IAAI,CAAC;AAC9B,MAAI,SAAS,WAAW,SAAS,GAAG;AAChC,QAAI,SAAS,WAAW,SAAS,GAAG;AAEhC,wBAAkB,OAAO,IAAI,SAAS;AAAA,IAG1C;AAEA,QAAI,YAAY,SAAS,WAAW,CAAC;AACrC,UAAI,wCAAS,UAAT,mBAAgB,UAAS,SAAS,WAAW,SAAQ,wCAAS,UAAT,mBAAgB,KAAK,KAAK,GAAG;AAElF,mBAAY,wCAAS,UAAT,mBAAgB;AAAA,IAChC;AAEA,UAAM,YAAY,SAAS,OAAO,SAAS;AAC3C,eAAW,kBAAM,cAAc,SAAS;AAAA,EAK5C;AACA,SAAO;AACX;;;AFjCO,IAAMC,eAAc;AAAA,EACvB,GAAG;AAAA,EACH,MAAM,MAAM,aAAa,SAAS;AAC9B,UAAM,OAAO,WAAW,aAAa,OAAO;AAC5C,WAAO,EAAE,OAAO,oBAAoB,KAAK;AAAA,EAC7C;AACJ;",
4
+ "sourcesContent": ["// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { ExcelLoader as ExcelWorkerLoader } from \"./excel-loader.js\";\nimport { parseExcel } from \"./lib/parse-excel.js\";\nexport { ExcelWorkerLoader };\n/**\n * Loader for Excel files\n */\nexport const ExcelLoader = {\n ...ExcelWorkerLoader,\n async parse(arrayBuffer, options) {\n const data = parseExcel(arrayBuffer, options);\n return { shape: 'object-row-table', data };\n }\n};\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof \"4.2.0-beta.1\" !== 'undefined' ? \"4.2.0-beta.1\" : 'latest';\n/**\n * Worker Loader for Excel files\n */\nexport const ExcelLoader = {\n dataType: null,\n batchType: null,\n name: 'Excel',\n id: 'excel',\n module: 'excel',\n version: VERSION,\n worker: true,\n extensions: ['xls', 'xlsb', 'xlsm', 'xlsx'],\n mimeTypes: [\n 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',\n 'application/vnd.ms-excel'\n ],\n category: 'table',\n binary: true,\n options: {\n excel: {\n shape: 'object-row-table',\n sheet: undefined // Load default Sheet\n }\n }\n};\n", "import { utils, read } from 'xlsx';\n// import {convertToArrayRow} from '@loaders.gl/schema';\n// local table names cache with dataUrl/tableNames array key/values\nconst dataTableNamesMap = {};\n/**\n * Gets local or remote Excel file data.\n * @param arrayBuffer Loaded data\n * @param options Data parse options.\n */\nexport function parseExcel(arrayBuffer, options) {\n const dataUrl = 'dummy';\n // const dataFileType: string = dataUrl.substr(dataUrl.lastIndexOf('.')); // file extension\n // create Excel 'workbook'\n const workbook = read(arrayBuffer, {\n type: 'array'\n // cellDates: true\n });\n // load data sheets\n let dataRows = [];\n dataTableNamesMap[dataUrl] = [];\n if (workbook.SheetNames.length > 0) {\n if (workbook.SheetNames.length > 1) {\n // cache sheet names\n dataTableNamesMap[dataUrl] = workbook.SheetNames;\n // eslint-ignore-next-line\n // console.debug(`getData(): file: sheetNames:`, workbook.SheetNames);\n }\n // determine spreadsheet to load\n let sheetName = workbook.SheetNames[0];\n if (options?.excel?.sheet && workbook.SheetNames.indexOf(options?.excel?.sheet) >= 0) {\n // reset to requested table name\n sheetName = options?.excel?.sheet;\n }\n // get worksheet data row objects array\n const worksheet = workbook.Sheets[sheetName];\n dataRows = utils.sheet_to_json(worksheet);\n // const headers = dataRows.length ? Object.keys(dataRows[0]) : [];\n // if (options?.excel?.type === 'array-row-table') {\n // dataRows = dataRows.map(row => convertToArrayRow(row, headers))\n // }\n }\n return dataRows;\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA,qBAAAA;AAAA,EAAA;AAAA;AAAA;;;ACKA,IAAM,UAAU,OAAwC,iBAAiB;AAIlE,IAAM,cAAc;AAAA,EACvB,UAAU;AAAA,EACV,WAAW;AAAA,EACX,MAAM;AAAA,EACN,IAAI;AAAA,EACJ,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,QAAQ;AAAA,EACR,YAAY,CAAC,OAAO,QAAQ,QAAQ,MAAM;AAAA,EAC1C,WAAW;AAAA,IACP;AAAA,IACA;AAAA,EACJ;AAAA,EACA,UAAU;AAAA,EACV,QAAQ;AAAA,EACR,SAAS;AAAA,IACL,OAAO;AAAA,MACH,OAAO;AAAA,MACP,OAAO;AAAA;AAAA,IACX;AAAA,EACJ;AACJ;;;AC9BA,kBAA4B;AAG5B,IAAM,oBAAoB,CAAC;AAMpB,SAAS,WAAW,aAAa,SAAS;AATjD;AAUI,QAAM,UAAU;AAGhB,QAAM,eAAW,kBAAK,aAAa;AAAA,IAC/B,MAAM;AAAA;AAAA,EAEV,CAAC;AAED,MAAI,WAAW,CAAC;AAChB,oBAAkB,OAAO,IAAI,CAAC;AAC9B,MAAI,SAAS,WAAW,SAAS,GAAG;AAChC,QAAI,SAAS,WAAW,SAAS,GAAG;AAEhC,wBAAkB,OAAO,IAAI,SAAS;AAAA,IAG1C;AAEA,QAAI,YAAY,SAAS,WAAW,CAAC;AACrC,UAAI,wCAAS,UAAT,mBAAgB,UAAS,SAAS,WAAW,SAAQ,wCAAS,UAAT,mBAAgB,KAAK,KAAK,GAAG;AAElF,mBAAY,wCAAS,UAAT,mBAAgB;AAAA,IAChC;AAEA,UAAM,YAAY,SAAS,OAAO,SAAS;AAC3C,eAAW,kBAAM,cAAc,SAAS;AAAA,EAK5C;AACA,SAAO;AACX;;;AFjCO,IAAMC,eAAc;AAAA,EACvB,GAAG;AAAA,EACH,MAAM,MAAM,aAAa,SAAS;AAC9B,UAAM,OAAO,WAAW,aAAa,OAAO;AAC5C,WAAO,EAAE,OAAO,oBAAoB,KAAK;AAAA,EAC7C;AACJ;",
6
6
  "names": ["ExcelLoader", "ExcelLoader"]
7
7
  }
package/dist/index.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- import type { LoaderWithParser } from '@loaders.gl/loader-utils';
2
1
  import type { ObjectRowTable } from '@loaders.gl/schema';
3
2
  import type { ExcelLoaderOptions } from "./excel-loader.js";
4
3
  import { ExcelLoader as ExcelWorkerLoader } from "./excel-loader.js";
@@ -7,5 +6,24 @@ export { ExcelWorkerLoader };
7
6
  /**
8
7
  * Loader for Excel files
9
8
  */
10
- export declare const ExcelLoader: LoaderWithParser<ObjectRowTable, never, ExcelLoaderOptions>;
9
+ export declare const ExcelLoader: {
10
+ readonly parse: (arrayBuffer: ArrayBuffer, options?: ExcelLoaderOptions) => Promise<ObjectRowTable>;
11
+ readonly dataType: ObjectRowTable;
12
+ readonly batchType: never;
13
+ readonly name: "Excel";
14
+ readonly id: "excel";
15
+ readonly module: "excel";
16
+ readonly version: any;
17
+ readonly worker: true;
18
+ readonly extensions: ["xls", "xlsb", "xlsm", "xlsx"];
19
+ readonly mimeTypes: ["application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "application/vnd.ms-excel"];
20
+ readonly category: "table";
21
+ readonly binary: true;
22
+ readonly options: {
23
+ readonly excel: {
24
+ readonly shape: "object-row-table";
25
+ readonly sheet: undefined;
26
+ };
27
+ };
28
+ };
11
29
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,0BAA0B,CAAC;AAC/D,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,oBAAoB,CAAC;AACvD,OAAO,KAAK,EAAC,kBAAkB,EAAC,0BAAuB;AACvD,OAAO,EAAC,WAAW,IAAI,iBAAiB,EAAC,0BAAuB;AAKhE,YAAY,EAAC,kBAAkB,EAAC,CAAC;AACjC,OAAO,EAAC,iBAAiB,EAAC,CAAC;AAE3B;;GAEG;AACH,eAAO,MAAM,WAAW,EAAE,gBAAgB,CAAC,cAAc,EAAE,KAAK,EAAE,kBAAkB,CAMnF,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,oBAAoB,CAAC;AACvD,OAAO,KAAK,EAAC,kBAAkB,EAAC,0BAAuB;AACvD,OAAO,EAAC,WAAW,IAAI,iBAAiB,EAAC,0BAAuB;AAKhE,YAAY,EAAC,kBAAkB,EAAC,CAAC;AACjC,OAAO,EAAC,iBAAiB,EAAC,CAAC;AAE3B;;GAEG;AACH,eAAO,MAAM,WAAW;kCAEG,WAAW,YAAY,kBAAkB,KAAG,QAAQ,cAAc,CAAC;;;;;;;;;;;;;;;;;;CAId,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@loaders.gl/excel",
3
- "version": "4.2.0-alpha.6",
3
+ "version": "4.2.0-beta.2",
4
4
  "description": "Framework-independent loader for Excel files",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -44,12 +44,12 @@
44
44
  "build-worker": "esbuild src/workers/excel-worker.ts --bundle --outfile=dist/excel-worker.js --define:__VERSION__=\\\"$npm_package_version\\\""
45
45
  },
46
46
  "dependencies": {
47
- "@loaders.gl/loader-utils": "4.2.0-alpha.6",
48
- "@loaders.gl/schema": "4.2.0-alpha.6",
47
+ "@loaders.gl/loader-utils": "4.2.0-beta.2",
48
+ "@loaders.gl/schema": "4.2.0-beta.2",
49
49
  "xlsx": "^0.18.5"
50
50
  },
51
51
  "peerDependencies": {
52
52
  "@loaders.gl/core": "^4.0.0"
53
53
  },
54
- "gitHead": "37bd8ca71763529f18727ee4bf29dd176aa914ca"
54
+ "gitHead": "13c03663fec365a4d24c06377d50035cebd7ba9f"
55
55
  }
@@ -10,23 +10,23 @@ import type {ObjectRowTable} from '@loaders.gl/schema';
10
10
  const VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';
11
11
 
12
12
  export type ExcelLoaderOptions = LoaderOptions & {
13
+ /** Options for ExcelLoader */
13
14
  excel?: {
14
- shape: /* 'array-row-table' | */ 'object-row-table';
15
- sheet?: string; // Load default Sheet
15
+ /** Format of returned data */
16
+ shape?: /* 'array-row-table' | */ 'object-row-table';
17
+ /** Specify which sheet to load, if omitted loads default sheet */
18
+ sheet?: string;
19
+ /** Override the URL to the worker bundle (by default loads from unpkg.com) */
20
+ workerUrl?: string;
16
21
  };
17
22
  };
18
23
 
19
- const DEFAULT_EXCEL_LOADER_OPTIONS: ExcelLoaderOptions = {
20
- excel: {
21
- shape: 'object-row-table',
22
- sheet: undefined // Load default Sheet
23
- }
24
- };
25
-
26
24
  /**
27
25
  * Worker Loader for Excel files
28
26
  */
29
- export const ExcelLoader: Loader<ObjectRowTable, never, ExcelLoaderOptions> = {
27
+ export const ExcelLoader = {
28
+ dataType: null as unknown as ObjectRowTable,
29
+ batchType: null as never,
30
30
  name: 'Excel',
31
31
  id: 'excel',
32
32
  module: 'excel',
@@ -39,5 +39,10 @@ export const ExcelLoader: Loader<ObjectRowTable, never, ExcelLoaderOptions> = {
39
39
  ],
40
40
  category: 'table',
41
41
  binary: true,
42
- options: DEFAULT_EXCEL_LOADER_OPTIONS
43
- };
42
+ options: {
43
+ excel: {
44
+ shape: 'object-row-table',
45
+ sheet: undefined // Load default Sheet
46
+ }
47
+ }
48
+ } as const satisfies Loader<ObjectRowTable, never, ExcelLoaderOptions>;
package/src/index.ts CHANGED
@@ -16,10 +16,10 @@ export {ExcelWorkerLoader};
16
16
  /**
17
17
  * Loader for Excel files
18
18
  */
19
- export const ExcelLoader: LoaderWithParser<ObjectRowTable, never, ExcelLoaderOptions> = {
19
+ export const ExcelLoader = {
20
20
  ...ExcelWorkerLoader,
21
21
  async parse(arrayBuffer: ArrayBuffer, options?: ExcelLoaderOptions): Promise<ObjectRowTable> {
22
22
  const data = parseExcel(arrayBuffer, options);
23
23
  return {shape: 'object-row-table', data};
24
24
  }
25
- };
25
+ } as const satisfies LoaderWithParser<ObjectRowTable, never, ExcelLoaderOptions>;