diff --git a/README.md b/README.md index 7ee39b1..011b499 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,6 @@ port calculations to web apps; automate common spreadsheet tasks, and much more! [![Build Status](https://img.shields.io/github/workflow/status/sheetjs/sheetjs/Tests:%20node.js)](https://github.com/SheetJS/sheetjs/actions) [![Snyk Vulnerabilities](https://img.shields.io/snyk/vulnerabilities/github/SheetJS/sheetjs)](https://snyk.io/test/github/SheetJS/sheetjs) [![npm Downloads](https://img.shields.io/npm/dm/xlsx.svg)](https://npmjs.org/package/xlsx) -[![jsDelivr Downloads](https://data.jsdelivr.com/v1/package/npm/xlsx/badge)](https://www.jsdelivr.com/package/npm/xlsx) [![Analytics](https://ga-beacon.appspot.com/UA-36810333-1/SheetJS/sheetjs?pixel)](https://github.com/SheetJS/sheetjs) [**Browser Test and Support Matrix**](https://oss.sheetjs.com/sheetjs/tests/) @@ -134,7 +133,6 @@ can be directly added to a page with a `script` tag: | `unpkg` | | | `jsDelivr` | | | `CDNjs` | | -| `packd` | | For example, `unpkg` makes the latest version available at: @@ -195,14 +193,14 @@ set_cptable(cptable); **Deno** -The [`sheetjs`](https://deno.land/x/sheetjs) package is hosted by Deno: +`xlsx.mjs` can be imported in Deno. It is available from `unpkg`: ```ts -// @deno-types="https://deno.land/x/sheetjs/types/index.d.ts" -import * as XLSX from 'https://deno.land/x/sheetjs/xlsx.mjs' +// @deno-types="https://unpkg.com/xlsx/types/index.d.ts" +import * as XLSX from 'https://unpkg.com/xlsx/xlsx.mjs'; /* load the codepage support library for extended support with older formats */ -import * as cptable from 'https://deno.land/x/sheetjs/dist/cpexcel.full.mjs'; +import * as cptable from 'https://unpkg.com/xlsx/dist/cpexcel.full.mjs'; XLSX.set_cptable(cptable); ``` diff --git a/demos/deno/Makefile b/demos/deno/Makefile index 234b725..0120732 100644 --- a/demos/deno/Makefile +++ b/demos/deno/Makefile @@ -1,4 +1,4 @@ -TESTS= x mjs jspm +TESTS= x mjs UNSTABLE= node TEST_FILES=number_format_greek.xls diff --git a/demos/deno/README.md b/demos/deno/README.md index 9975998..1f22b5f 100644 --- a/demos/deno/README.md +++ b/demos/deno/README.md @@ -3,24 +3,28 @@ Deno is a runtime capable of running JS code including this library. There are a few different builds and recommended use cases as covered in this demo. -For user code, [the `sheetjs` module](https://deno.land/x/sheetjs) can be used. +Due to ongoing stability and sync issues with the Deno registry, scripts should +use [the `unpkg` CDN build](https://unpkg.com/xlsx/xlsx.mjs): + +```js +// @deno-types="https://unpkg.com/xlsx/types/index.d.ts" +import * as XLSX from 'https://unpkg.com/xlsx/xlsx.mjs'; + +/* load the codepage support library for extended support with older formats */ +import * as cptable from 'https://unpkg.com/xlsx/dist/cpexcel.full.mjs'; +XLSX.set_cptable(cptable); +``` + ## Reading and Writing Files In general, the command-line flag `--allow-read` must be passed to enable file reading. The flag `--allow-write` must be passed to enable file writing. -Starting in version 0.18.1, this library will check for the `Deno` global and -use `Deno.readFileSync` and `Deno.writeFileSync` behind the scenes. - -For older versions, the API functions must be called from user code. - _Reading a File_ ```ts -const filedata = Deno.readFileSync("test.xlsx"); -const workbook = XLSX.read(filedata, {type: "buffer"}); -/* DO SOMETHING WITH workbook HERE */ +const workbook = XLSX.readFile("test.xlsx"); ``` _Writing a File_ @@ -30,9 +34,7 @@ Older versions of the library did not properly detect features from Deno, so the not handle byte arrays, user code must generate a `Uint8Array` first: ```ts -const buf = XLSX.write(workbook, {type: "buffer", bookType: "xlsb"}); -const u8: Uint8Array = new Uint8Array(buf); -Deno.writeFileSync("test.xlsb", u8); +XLSX.writeFile(workbook, "test.xlsb"); ``` ## Demos @@ -60,8 +62,8 @@ accepts the `XLSX` module as an argument. - `x` imports the ESM build without the codepage library: ```ts -// @deno-types="https://deno.land/x/sheetjs/types/index.d.ts" -import * as XLSX from 'https://deno.land/x/sheetjs/xlsx.mjs'; +// @deno-types="https://unpkg.com/xlsx/types/index.d.ts" +import * as XLSX from 'https://unpkg.com/xlsx/xlsx.mjs'; ``` - `mjs` imports the ESM build and the associated codepage library: @@ -73,12 +75,6 @@ import * as cptable from '../../dist/cptable.full.mjs'; XLSX.set_cptable(cptable); ``` -- `jspm` imports the browser standalone script using JSPM: - -```ts -import * as XLSX from 'https://jspm.dev/npm:xlsx!cjs'; -``` - - `node` uses the node compatibility layer: ```ts diff --git a/demos/deno/jspm.ts b/demos/deno/jspm.ts deleted file mode 100644 index 4ecb6ca..0000000 --- a/demos/deno/jspm.ts +++ /dev/null @@ -1,4 +0,0 @@ -import * as XLSX from 'https://jspm.dev/npm:xlsx!cjs' - -import doit from './doit.ts'; -doit(XLSX, "jspm"); diff --git a/demos/deno/sheet2csv.ts b/demos/deno/sheet2csv.ts index 288aa19..c208326 100644 --- a/demos/deno/sheet2csv.ts +++ b/demos/deno/sheet2csv.ts @@ -1,7 +1,7 @@ /*! sheetjs (C) 2013-present SheetJS -- http://sheetjs.com */ -// @deno-types="https://deno.land/x/sheetjs/types/index.d.ts" -import * as XLSX from 'https://deno.land/x/sheetjs/xlsx.mjs'; -import * as cptable from 'https://deno.land/x/sheetjs/dist/cpexcel.full.mjs'; +// @deno-types="https://unpkg.com/xlsx/types/index.d.ts" +import * as XLSX from 'https://unpkg.com/xlsx/xlsx.mjs'; +import * as cptable from 'https://unpkg.com/xlsx/dist/cpexcel.full.mjs'; XLSX.set_cptable(cptable); const filename = Deno.args[0]; diff --git a/demos/deno/x.ts b/demos/deno/x.ts index 090021a..35d1c30 100644 --- a/demos/deno/x.ts +++ b/demos/deno/x.ts @@ -1,4 +1,5 @@ -import * as XLSX from 'https://deno.land/x/sheetjs/xlsx.mjs'; +// @deno-types="https://unpkg.com/xlsx/types/index.d.ts" +import * as XLSX from 'https://unpkg.com/xlsx/xlsx.mjs'; import doit from './doit.ts'; doit(XLSX, "x"); diff --git a/demos/server/drash.ts b/demos/server/drash.ts index 896bc21..3ff0e9e 100644 --- a/demos/server/drash.ts +++ b/demos/server/drash.ts @@ -1,7 +1,7 @@ /*! sheetjs (C) 2013-present SheetJS -- http://sheetjs.com */ -// @deno-types="https://deno.land/x/sheetjs/types/index.d.ts" -import { read, utils, set_cptable } from 'https://deno.land/x/sheetjs@v0.18.3/xlsx.mjs'; -import * as cptable from 'https://deno.land/x/sheetjs/dist/cpexcel.full.mjs'; +// @deno-types="https://unpkg.com/xlsx/types/index.d.ts" +import { read, utils, set_cptable } from 'https://unpkg.com/xlsx/xlsx.mjs'; +import * as cptable from 'https://unpkg.com/xlsx/dist/cpexcel.full.mjs'; set_cptable(cptable); import * as Drash from "https://deno.land/x/drash@v2.5.4/mod.ts"; diff --git a/docbits/00_intro.md b/docbits/00_intro.md index e9d1a34..f594d11 100644 --- a/docbits/00_intro.md +++ b/docbits/00_intro.md @@ -13,7 +13,6 @@ port calculations to web apps; automate common spreadsheet tasks, and much more! [![Build Status](https://img.shields.io/github/workflow/status/sheetjs/sheetjs/Tests:%20node.js)](https://github.com/SheetJS/sheetjs/actions) [![Snyk Vulnerabilities](https://img.shields.io/snyk/vulnerabilities/github/SheetJS/sheetjs)](https://snyk.io/test/github/SheetJS/sheetjs) [![npm Downloads](https://img.shields.io/npm/dm/xlsx.svg)](https://npmjs.org/package/xlsx) -[![jsDelivr Downloads](https://data.jsdelivr.com/v1/package/npm/xlsx/badge)](https://www.jsdelivr.com/package/npm/xlsx) [![Analytics](https://ga-beacon.appspot.com/UA-36810333-1/SheetJS/sheetjs?pixel)](https://github.com/SheetJS/sheetjs) [**Browser Test and Support Matrix**](https://oss.sheetjs.com/sheetjs/tests/) diff --git a/docbits/10_install.md b/docbits/10_install.md index b99f88b..6ae7918 100644 --- a/docbits/10_install.md +++ b/docbits/10_install.md @@ -19,7 +19,6 @@ can be directly added to a page with a `script` tag: | `unpkg` | | | `jsDelivr` | | | `CDNjs` | | -| `packd` | | For example, `unpkg` makes the latest version available at: @@ -80,14 +79,14 @@ set_cptable(cptable); **Deno** -The [`sheetjs`](https://deno.land/x/sheetjs) package is hosted by Deno: +`xlsx.mjs` can be imported in Deno. It is available from `unpkg`: ```ts -// @deno-types="https://deno.land/x/sheetjs/types/index.d.ts" -import * as XLSX from 'https://deno.land/x/sheetjs/xlsx.mjs' +// @deno-types="https://unpkg.com/xlsx/types/index.d.ts" +import * as XLSX from 'https://unpkg.com/xlsx/xlsx.mjs'; /* load the codepage support library for extended support with older formats */ -import * as cptable from 'https://deno.land/x/sheetjs/dist/cpexcel.full.mjs'; +import * as cptable from 'https://unpkg.com/xlsx/dist/cpexcel.full.mjs'; XLSX.set_cptable(cptable); ``` diff --git a/misc/docs/README.md b/misc/docs/README.md index 61b9dcb..c8ce25c 100644 --- a/misc/docs/README.md +++ b/misc/docs/README.md @@ -13,7 +13,6 @@ port calculations to web apps; automate common spreadsheet tasks, and much more! [![Build Status](https://img.shields.io/github/workflow/status/sheetjs/sheetjs/Tests:%20node.js)](https://github.com/SheetJS/sheetjs/actions) [![Snyk Vulnerabilities](https://img.shields.io/snyk/vulnerabilities/github/SheetJS/sheetjs)](https://snyk.io/test/github/SheetJS/sheetjs) [![npm Downloads](https://img.shields.io/npm/dm/xlsx.svg)](https://npmjs.org/package/xlsx) -[![jsDelivr Downloads](https://data.jsdelivr.com/v1/package/npm/xlsx/badge)](https://www.jsdelivr.com/package/npm/xlsx) [![Analytics](https://ga-beacon.appspot.com/UA-36810333-1/SheetJS/sheetjs?pixel)](https://github.com/SheetJS/sheetjs) [**Browser Test and Support Matrix**](https://oss.sheetjs.com/sheetjs/tests/) @@ -129,7 +128,6 @@ can be directly added to a page with a `script` tag: | `unpkg` | | | `jsDelivr` | | | `CDNjs` | | -| `packd` | | For example, `unpkg` makes the latest version available at: @@ -186,14 +184,14 @@ set_cptable(cptable); **Deno** -The [`sheetjs`](https://deno.land/x/sheetjs) package is hosted by Deno: +`xlsx.mjs` can be imported in Deno. It is available from `unpkg`: ```ts -// @deno-types="https://deno.land/x/sheetjs/types/index.d.ts" -import * as XLSX from 'https://deno.land/x/sheetjs/xlsx.mjs' +// @deno-types="https://unpkg.com/xlsx/types/index.d.ts" +import * as XLSX from 'https://unpkg.com/xlsx/xlsx.mjs'; /* load the codepage support library for extended support with older formats */ -import * as cptable from 'https://deno.land/x/sheetjs/dist/cpexcel.full.mjs'; +import * as cptable from 'https://unpkg.com/xlsx/dist/cpexcel.full.mjs'; XLSX.set_cptable(cptable); ```