@loaders.gl/excel 4.3.2 → 4.4.0-alpha.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.
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Excel files
3
+ */
4
+ export declare const ExcelFormat: {
5
+ readonly name: "Excel";
6
+ readonly id: "excel";
7
+ readonly module: "excel";
8
+ readonly extensions: ["xls", "xlsb", "xlsm", "xlsx"];
9
+ readonly mimeTypes: ["application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "application/vnd.ms-excel"];
10
+ readonly category: "table";
11
+ readonly binary: true;
12
+ };
13
+ //# sourceMappingURL=excel-format.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"excel-format.d.ts","sourceRoot":"","sources":["../src/excel-format.ts"],"names":[],"mappings":"AAMA;;GAEG;AACH,eAAO,MAAM,WAAW;;;;;;;;CAWG,CAAC"}
@@ -0,0 +1,18 @@
1
+ // loaders.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (c) vis.gl contributors
4
+ /**
5
+ * Excel files
6
+ */
7
+ export const ExcelFormat = {
8
+ name: 'Excel',
9
+ id: 'excel',
10
+ module: 'excel',
11
+ extensions: ['xls', 'xlsb', 'xlsm', 'xlsx'],
12
+ mimeTypes: [
13
+ 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
14
+ 'application/vnd.ms-excel'
15
+ ],
16
+ category: 'table',
17
+ binary: true
18
+ };
@@ -14,23 +14,46 @@ export type ExcelLoaderOptions = LoaderOptions & {
14
14
  /**
15
15
  * Worker Loader for Excel files
16
16
  */
17
- export declare const ExcelLoader: {
17
+ export declare const ExcelWorkerLoader: {
18
18
  readonly dataType: ObjectRowTable;
19
19
  readonly batchType: never;
20
+ readonly version: any;
21
+ readonly worker: true;
22
+ readonly options: {
23
+ readonly excel: {
24
+ readonly shape: "object-row-table";
25
+ readonly sheet: undefined;
26
+ };
27
+ };
20
28
  readonly name: "Excel";
21
29
  readonly id: "excel";
22
30
  readonly module: "excel";
23
- readonly version: any;
24
- readonly worker: true;
25
31
  readonly extensions: ["xls", "xlsb", "xlsm", "xlsx"];
26
32
  readonly mimeTypes: ["application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "application/vnd.ms-excel"];
27
33
  readonly category: "table";
28
34
  readonly binary: true;
35
+ };
36
+ /**
37
+ * Loader for Excel files
38
+ */
39
+ export declare const ExcelLoader: {
40
+ readonly parse: (arrayBuffer: ArrayBuffer, options?: ExcelLoaderOptions) => Promise<ObjectRowTable>;
41
+ readonly dataType: ObjectRowTable;
42
+ readonly batchType: never;
43
+ readonly version: any;
44
+ readonly worker: true;
29
45
  readonly options: {
30
46
  readonly excel: {
31
47
  readonly shape: "object-row-table";
32
48
  readonly sheet: undefined;
33
49
  };
34
50
  };
51
+ readonly name: "Excel";
52
+ readonly id: "excel";
53
+ readonly module: "excel";
54
+ readonly extensions: ["xls", "xlsb", "xlsm", "xlsx"];
55
+ readonly mimeTypes: ["application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "application/vnd.ms-excel"];
56
+ readonly category: "table";
57
+ readonly binary: true;
35
58
  };
36
59
  //# 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,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;uBACO,cAAc;wBACxB,KAAK;;;;;;;;;;;;;;;;CAmB4C,CAAC"}
1
+ {"version":3,"file":"excel-loader.d.ts","sourceRoot":"","sources":["../src/excel-loader.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAA2B,aAAa,EAAC,MAAM,0BAA0B,CAAC;AACtF,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,oBAAoB,CAAC;AAQvD,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,iBAAiB;uBAEC,cAAc;wBACxB,KAAK;;;;;;;;;;;;;;;;CAS4C,CAAC;AAEvE;;GAEG;AACH,eAAO,MAAM,WAAW;kCAEG,WAAW,YAAY,kBAAkB,KAAG,OAAO,CAAC,cAAc,CAAC;uBAjB/D,cAAc;wBACxB,KAAK;;;;;;;;;;;;;;;;CAoBsD,CAAC"}
@@ -1,27 +1,20 @@
1
1
  // loaders.gl
2
2
  // SPDX-License-Identifier: MIT
3
3
  // Copyright (c) vis.gl contributors
4
+ import { parseExcel } from "./lib/parse-excel.js";
5
+ import { ExcelFormat } from "./excel-format.js";
4
6
  // __VERSION__ is injected by babel-plugin-version-inline
5
7
  // @ts-ignore TS2304: Cannot find name '__VERSION__'.
6
- const VERSION = typeof "4.3.1" !== 'undefined' ? "4.3.1" : 'latest';
8
+ const VERSION = typeof "4.4.0-alpha.1" !== 'undefined' ? "4.4.0-alpha.1" : 'latest';
7
9
  /**
8
10
  * Worker Loader for Excel files
9
11
  */
10
- export const ExcelLoader = {
12
+ export const ExcelWorkerLoader = {
13
+ ...ExcelFormat,
11
14
  dataType: null,
12
15
  batchType: null,
13
- name: 'Excel',
14
- id: 'excel',
15
- module: 'excel',
16
16
  version: VERSION,
17
17
  worker: true,
18
- extensions: ['xls', 'xlsb', 'xlsm', 'xlsx'],
19
- mimeTypes: [
20
- 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
21
- 'application/vnd.ms-excel'
22
- ],
23
- category: 'table',
24
- binary: true,
25
18
  options: {
26
19
  excel: {
27
20
  shape: 'object-row-table',
@@ -29,3 +22,13 @@ export const ExcelLoader = {
29
22
  }
30
23
  }
31
24
  };
25
+ /**
26
+ * Loader for Excel files
27
+ */
28
+ export const ExcelLoader = {
29
+ ...ExcelWorkerLoader,
30
+ async parse(arrayBuffer, options) {
31
+ const data = parseExcel(arrayBuffer, options);
32
+ return { shape: 'object-row-table', data };
33
+ }
34
+ };
@@ -199,30 +199,18 @@
199
199
  return await parser(data, { ...options }, context, loader);
200
200
  }
201
201
 
202
- // src/excel-loader.ts
203
- var VERSION = true ? "4.3.1" : "latest";
204
- var ExcelLoader = {
205
- dataType: null,
206
- batchType: null,
202
+ // src/excel-format.ts
203
+ var ExcelFormat = {
207
204
  name: "Excel",
208
205
  id: "excel",
209
206
  module: "excel",
210
- version: VERSION,
211
- worker: true,
212
207
  extensions: ["xls", "xlsb", "xlsm", "xlsx"],
213
208
  mimeTypes: [
214
209
  "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
215
210
  "application/vnd.ms-excel"
216
211
  ],
217
212
  category: "table",
218
- binary: true,
219
- options: {
220
- excel: {
221
- shape: "object-row-table",
222
- sheet: void 0
223
- // Load default Sheet
224
- }
225
- }
213
+ binary: true
226
214
  };
227
215
 
228
216
  // ../../node_modules/xlsx/xlsx.mjs
@@ -28404,9 +28392,24 @@
28404
28392
  return dataRows;
28405
28393
  }
28406
28394
 
28407
- // src/index.ts
28408
- var ExcelLoader2 = {
28409
- ...ExcelLoader,
28395
+ // src/excel-loader.ts
28396
+ var VERSION = true ? "4.4.0-alpha.1" : "latest";
28397
+ var ExcelWorkerLoader = {
28398
+ ...ExcelFormat,
28399
+ dataType: null,
28400
+ batchType: null,
28401
+ version: VERSION,
28402
+ worker: true,
28403
+ options: {
28404
+ excel: {
28405
+ shape: "object-row-table",
28406
+ sheet: void 0
28407
+ // Load default Sheet
28408
+ }
28409
+ }
28410
+ };
28411
+ var ExcelLoader = {
28412
+ ...ExcelWorkerLoader,
28410
28413
  async parse(arrayBuffer, options) {
28411
28414
  const data = parseExcel(arrayBuffer, options);
28412
28415
  return { shape: "object-row-table", data };
@@ -28414,7 +28417,7 @@
28414
28417
  };
28415
28418
 
28416
28419
  // src/workers/excel-worker.ts
28417
- createLoaderWorker(ExcelLoader2);
28420
+ createLoaderWorker(ExcelLoader);
28418
28421
  })();
28419
28422
  /*! Bundled license information:
28420
28423
 
package/dist/index.cjs CHANGED
@@ -20,35 +20,24 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
20
20
  // dist/index.js
21
21
  var dist_exports = {};
22
22
  __export(dist_exports, {
23
- ExcelLoader: () => ExcelLoader2,
24
- ExcelWorkerLoader: () => ExcelLoader
23
+ ExcelFormat: () => ExcelFormat,
24
+ ExcelLoader: () => ExcelLoader,
25
+ ExcelWorkerLoader: () => ExcelWorkerLoader
25
26
  });
26
27
  module.exports = __toCommonJS(dist_exports);
27
28
 
28
- // dist/excel-loader.js
29
- var VERSION = true ? "4.3.1" : "latest";
30
- var ExcelLoader = {
31
- dataType: null,
32
- batchType: null,
29
+ // dist/excel-format.js
30
+ var ExcelFormat = {
33
31
  name: "Excel",
34
32
  id: "excel",
35
33
  module: "excel",
36
- version: VERSION,
37
- worker: true,
38
34
  extensions: ["xls", "xlsb", "xlsm", "xlsx"],
39
35
  mimeTypes: [
40
36
  "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
41
37
  "application/vnd.ms-excel"
42
38
  ],
43
39
  category: "table",
44
- binary: true,
45
- options: {
46
- excel: {
47
- shape: "object-row-table",
48
- sheet: void 0
49
- // Load default Sheet
50
- }
51
- }
40
+ binary: true
52
41
  };
53
42
 
54
43
  // dist/lib/parse-excel.js
@@ -77,9 +66,24 @@ function parseExcel(arrayBuffer, options) {
77
66
  return dataRows;
78
67
  }
79
68
 
80
- // dist/index.js
81
- var ExcelLoader2 = {
82
- ...ExcelLoader,
69
+ // dist/excel-loader.js
70
+ var VERSION = true ? "4.4.0-alpha.1" : "latest";
71
+ var ExcelWorkerLoader = {
72
+ ...ExcelFormat,
73
+ dataType: null,
74
+ batchType: null,
75
+ version: VERSION,
76
+ worker: true,
77
+ options: {
78
+ excel: {
79
+ shape: "object-row-table",
80
+ sheet: void 0
81
+ // Load default Sheet
82
+ }
83
+ }
84
+ };
85
+ var ExcelLoader = {
86
+ ...ExcelWorkerLoader,
83
87
  async parse(arrayBuffer, options) {
84
88
  const data = parseExcel(arrayBuffer, options);
85
89
  return { shape: "object-row-table", data };
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 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.3.1\" !== 'undefined' ? \"4.3.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,OAAiC,UAAU;AAIpD,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
- "names": ["ExcelLoader", "ExcelLoader"]
3
+ "sources": ["index.js", "excel-format.js", "lib/parse-excel.js", "excel-loader.js"],
4
+ "sourcesContent": ["// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n// Excel Loader\nexport { ExcelFormat } from \"./excel-format.js\";\nexport { ExcelLoader, ExcelWorkerLoader } from \"./excel-loader.js\";\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n/**\n * Excel files\n */\nexport const ExcelFormat = {\n name: 'Excel',\n id: 'excel',\n module: 'excel',\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};\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { 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", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { parseExcel } from \"./lib/parse-excel.js\";\nimport { ExcelFormat } from \"./excel-format.js\";\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof \"4.4.0-alpha.1\" !== 'undefined' ? \"4.4.0-alpha.1\" : 'latest';\n/**\n * Worker Loader for Excel files\n */\nexport const ExcelWorkerLoader = {\n ...ExcelFormat,\n dataType: null,\n batchType: null,\n version: VERSION,\n worker: true,\n options: {\n excel: {\n shape: 'object-row-table',\n sheet: undefined // Load default Sheet\n }\n }\n};\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"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACMO,IAAM,cAAc;AAAA,EACvB,MAAM;AAAA,EACN,IAAI;AAAA,EACJ,QAAQ;AAAA,EACR,YAAY,CAAC,OAAO,QAAQ,QAAQ,MAAM;AAAA,EAC1C,WAAW;AAAA,IACP;AAAA,IACA;AAAA,EACJ;AAAA,EACA,UAAU;AAAA,EACV,QAAQ;AACZ;;;ACdA,kBAA4B;AAG5B,IAAM,oBAAoB,CAAC;AAMpB,SAAS,WAAW,aAAa,SAAS;AAZjD;AAaI,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;;;ACtCA,IAAM,UAAU,OAAyC,kBAAkB;AAIpE,IAAM,oBAAoB;AAAA,EAC7B,GAAG;AAAA,EACH,UAAU;AAAA,EACV,WAAW;AAAA,EACX,SAAS;AAAA,EACT,QAAQ;AAAA,EACR,SAAS;AAAA,IACL,OAAO;AAAA,MACH,OAAO;AAAA,MACP,OAAO;AAAA;AAAA,IACX;AAAA,EACJ;AACJ;AAIO,IAAM,cAAc;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
+ "names": []
7
7
  }
package/dist/index.d.ts CHANGED
@@ -1,29 +1,4 @@
1
- import type { ObjectRowTable } from '@loaders.gl/schema';
2
- import type { ExcelLoaderOptions } from "./excel-loader.js";
3
- import { ExcelLoader as ExcelWorkerLoader } from "./excel-loader.js";
4
- export type { ExcelLoaderOptions };
5
- export { ExcelWorkerLoader };
6
- /**
7
- * Loader for Excel files
8
- */
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
- };
1
+ export { ExcelFormat } from "./excel-format.js";
2
+ export type { ExcelLoaderOptions } from "./excel-loader.js";
3
+ export { ExcelLoader, ExcelWorkerLoader } from "./excel-loader.js";
29
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
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,OAAO,CAAC,cAAc,CAAC;;;;;;;;;;;;;;;;;;CAId,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAMA,OAAO,EAAC,WAAW,EAAC,0BAAuB;AAC3C,YAAY,EAAC,kBAAkB,EAAC,0BAAuB;AACvD,OAAO,EAAC,WAAW,EAAE,iBAAiB,EAAC,0BAAuB"}
package/dist/index.js CHANGED
@@ -1,16 +1,6 @@
1
1
  // loaders.gl
2
2
  // SPDX-License-Identifier: MIT
3
3
  // Copyright (c) vis.gl contributors
4
- import { ExcelLoader as ExcelWorkerLoader } from "./excel-loader.js";
5
- import { parseExcel } from "./lib/parse-excel.js";
6
- export { ExcelWorkerLoader };
7
- /**
8
- * Loader for Excel files
9
- */
10
- export const ExcelLoader = {
11
- ...ExcelWorkerLoader,
12
- async parse(arrayBuffer, options) {
13
- const data = parseExcel(arrayBuffer, options);
14
- return { shape: 'object-row-table', data };
15
- }
16
- };
4
+ // Excel Loader
5
+ export { ExcelFormat } from "./excel-format.js";
6
+ export { ExcelLoader, ExcelWorkerLoader } from "./excel-loader.js";
@@ -1 +1 @@
1
- {"version":3,"file":"parse-excel.d.ts","sourceRoot":"","sources":["../../src/lib/parse-excel.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,kBAAkB,EAAC,2BAAwB;AAOxD;;;;GAIG;AACH,wBAAgB,UAAU,CACxB,WAAW,EAAE,WAAW,EACxB,OAAO,CAAC,EAAE,kBAAkB,GAC3B;IAAC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CAAC,EAAE,CAuC5B"}
1
+ {"version":3,"file":"parse-excel.d.ts","sourceRoot":"","sources":["../../src/lib/parse-excel.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,kBAAkB,EAAC,2BAAwB;AAOxD;;;;GAIG;AACH,wBAAgB,UAAU,CACxB,WAAW,EAAE,WAAW,EACxB,OAAO,CAAC,EAAE,kBAAkB,GAC3B;IAAC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CAAC,EAAE,CAuC5B"}
@@ -1,3 +1,6 @@
1
+ // loaders.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (c) vis.gl contributors
1
4
  import { utils, read } from 'xlsx';
2
5
  // import {convertToArrayRow} from '@loaders.gl/schema';
3
6
  // local table names cache with dataUrl/tableNames array key/values
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@loaders.gl/excel",
3
- "version": "4.3.2",
3
+ "version": "4.4.0-alpha.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.3.2",
48
- "@loaders.gl/schema": "4.3.2",
47
+ "@loaders.gl/loader-utils": "4.4.0-alpha.2",
48
+ "@loaders.gl/schema": "4.4.0-alpha.2",
49
49
  "xlsx": "^0.18.5"
50
50
  },
51
51
  "peerDependencies": {
52
- "@loaders.gl/core": "^4.3.0"
52
+ "@loaders.gl/core": "4.4.0-alpha.1"
53
53
  },
54
- "gitHead": "b4203b8703f64a38d6f79a3113bc7bb51d45c93a"
54
+ "gitHead": "3d9fed050eabdc0812ddf2f4d5fb9914a34ee0c2"
55
55
  }
@@ -0,0 +1,21 @@
1
+ // loaders.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (c) vis.gl contributors
4
+
5
+ import type {Format} from '@loaders.gl/loader-utils';
6
+
7
+ /**
8
+ * Excel files
9
+ */
10
+ export const ExcelFormat = {
11
+ name: 'Excel',
12
+ id: 'excel',
13
+ module: 'excel',
14
+ extensions: ['xls', 'xlsb', 'xlsm', 'xlsx'],
15
+ mimeTypes: [
16
+ 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
17
+ 'application/vnd.ms-excel'
18
+ ],
19
+ category: 'table',
20
+ binary: true
21
+ } as const satisfies Format;
@@ -2,8 +2,10 @@
2
2
  // SPDX-License-Identifier: MIT
3
3
  // Copyright (c) vis.gl contributors
4
4
 
5
- import type {Loader, LoaderOptions} from '@loaders.gl/loader-utils';
5
+ import type {Loader, LoaderWithParser, LoaderOptions} from '@loaders.gl/loader-utils';
6
6
  import type {ObjectRowTable} from '@loaders.gl/schema';
7
+ import {parseExcel} from './lib/parse-excel';
8
+ import {ExcelFormat} from './excel-format';
7
9
 
8
10
  // __VERSION__ is injected by babel-plugin-version-inline
9
11
  // @ts-ignore TS2304: Cannot find name '__VERSION__'.
@@ -24,21 +26,12 @@ export type ExcelLoaderOptions = LoaderOptions & {
24
26
  /**
25
27
  * Worker Loader for Excel files
26
28
  */
27
- export const ExcelLoader = {
29
+ export const ExcelWorkerLoader = {
30
+ ...ExcelFormat,
28
31
  dataType: null as unknown as ObjectRowTable,
29
32
  batchType: null as never,
30
- name: 'Excel',
31
- id: 'excel',
32
- module: 'excel',
33
33
  version: VERSION,
34
34
  worker: true,
35
- extensions: ['xls', 'xlsb', 'xlsm', 'xlsx'],
36
- mimeTypes: [
37
- 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
38
- 'application/vnd.ms-excel'
39
- ],
40
- category: 'table',
41
- binary: true,
42
35
  options: {
43
36
  excel: {
44
37
  shape: 'object-row-table',
@@ -46,3 +39,14 @@ export const ExcelLoader = {
46
39
  }
47
40
  }
48
41
  } as const satisfies Loader<ObjectRowTable, never, ExcelLoaderOptions>;
42
+
43
+ /**
44
+ * Loader for Excel files
45
+ */
46
+ export const ExcelLoader = {
47
+ ...ExcelWorkerLoader,
48
+ async parse(arrayBuffer: ArrayBuffer, options?: ExcelLoaderOptions): Promise<ObjectRowTable> {
49
+ const data = parseExcel(arrayBuffer, options);
50
+ return {shape: 'object-row-table', data};
51
+ }
52
+ } as const satisfies LoaderWithParser<ObjectRowTable, never, ExcelLoaderOptions>;
package/src/index.ts CHANGED
@@ -2,24 +2,8 @@
2
2
  // SPDX-License-Identifier: MIT
3
3
  // Copyright (c) vis.gl contributors
4
4
 
5
- import type {LoaderWithParser} from '@loaders.gl/loader-utils';
6
- import type {ObjectRowTable} from '@loaders.gl/schema';
7
- import type {ExcelLoaderOptions} from './excel-loader';
8
- import {ExcelLoader as ExcelWorkerLoader} from './excel-loader';
9
- import {parseExcel} from './lib/parse-excel';
10
-
11
5
  // Excel Loader
12
6
 
13
- export type {ExcelLoaderOptions};
14
- export {ExcelWorkerLoader};
15
-
16
- /**
17
- * Loader for Excel files
18
- */
19
- export const ExcelLoader = {
20
- ...ExcelWorkerLoader,
21
- async parse(arrayBuffer: ArrayBuffer, options?: ExcelLoaderOptions): Promise<ObjectRowTable> {
22
- const data = parseExcel(arrayBuffer, options);
23
- return {shape: 'object-row-table', data};
24
- }
25
- } as const satisfies LoaderWithParser<ObjectRowTable, never, ExcelLoaderOptions>;
7
+ export {ExcelFormat} from './excel-format';
8
+ export type {ExcelLoaderOptions} from './excel-loader';
9
+ export {ExcelLoader, ExcelWorkerLoader} from './excel-loader';
@@ -1,3 +1,7 @@
1
+ // loaders.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (c) vis.gl contributors
4
+
1
5
  import type {ExcelLoaderOptions} from '../excel-loader';
2
6
  import {utils, read} from 'xlsx';
3
7
  // import {convertToArrayRow} from '@loaders.gl/schema';