This commit is contained in:
SheetJS 2023-06-05 16:12:53 -04:00
parent 19dfa57120
commit 7fbd794137
18 changed files with 225 additions and 54 deletions

@ -334,7 +334,7 @@ const concat_RS = (stream) => new Promise((res, rej) => {
3) Edit `SheetJSIMAP.js` and replace the highlighted lines:
- `user: "**",` the value should be the sender email address
- `user: "**",` the value should be the account address
- `pass: "**"` the value should be the app password from earlier
4) Download <https://sheetjs.com/pres.numbers>. Using a different account, send
@ -456,8 +456,7 @@ function SheetJSPreviewPSTSheets() {
<b>Attachments</b>
<ul>{files.map((f,j) => (
<li key={j}><a onClick={()=>view(j)}>{f.filename} (click to view)</a></li>
))}
</ul>
))}</ul>
<b>Table View</b><br/>
<div dangerouslySetInnerHTML={{__html}}></div>
</> );

@ -90,7 +90,7 @@ npx react-native init SheetJSRNFetch --version="0.72.0-rc.1"
<CodeBlock language="bash">{`\
cd SheetJSRNFetch
curl -LO https://oss.sheetjs.com/assets/img/logo.png
curl -LO https://docs.sheetjs.com/logo.png
npm i -S https://cdn.sheetjs.com/xlsx-${current}/xlsx-${current}.tgz
npm i -S react-native-table-component@1.2.0 @types/react-native-table-component`}
</CodeBlock>
@ -466,7 +466,7 @@ npx react-native init SheetJSRN --version="0.72.0-rc.1"
<CodeBlock language="bash">{`\
cd SheetJSRN
curl -LO https://oss.sheetjs.com/assets/img/logo.png
curl -LO https://docs.sheetjs.com/logo.png
npm i -S https://cdn.sheetjs.com/xlsx-${current}/xlsx-${current}.tgz
npm i -S react-native-table-component@1.2.0 react-native-document-picker@8.2.0`}
</CodeBlock>

@ -43,6 +43,7 @@ This demo was tested in the following deployments:
| Architecture | Version | Node Target | Date |
|:-------------|:--------|:------------|:-----------|
| `darwin-x64` | `5.8.1` | `18.5.0` | 2023-05-08 |
| `darwin-arm` | `5.8.1` | `18.5.0` | 2023-06-05 |
| `win32-x64` | `5.8.1` | `18.5.0` | 2023-05-08 |
| `linux-x64` | `5.8.1` | `18.5.0` | 2023-05-08 |
@ -51,6 +52,7 @@ This demo was tested in the following deployments:
| Architecture | Version | Node Target | Date |
|:-------------|:-------------|:------------|:-----------|
| `darwin-x64` | `4.0.0-rc.2` | `14.15.3` | 2023-05-08 |
| `darwin-arm` | `4.0.0-rc.2` | `18.16.0` | 2023-06-05 |
| `win32-x64` | `4.0.0-rc.2` | `14.15.3` | 2023-05-08 |
| `linux-x64` | `4.0.0-rc.2` | `14.15.3` | 2023-05-08 |
@ -59,6 +61,7 @@ This demo was tested in the following deployments:
| Architecture | Version | Node Target | Date |
|:-------------|:--------|:------------|:-----------|
| `darwin-x64` | `2.0.1` | `20.1.0` | 2023-05-08 |
| `darwin-arm` | `2.0.1` | `20.2.0` | 2023-06-05 |
| `linux-x64` | `2.0.1` | `20.1.0` | 2023-05-08 |
</details>
@ -108,6 +111,17 @@ npx nexe -t 14.15.3 xlsx-cli.js
This generates `xlsx-cli` or `xlsx-cli.exe` depending on platform.
:::caution
When the demo was tested on `darwin-arm`, the `mac-arm64` pre-built package was
missing. The package must be built from source:
```bash
npx nexe xlsx-cli.js --build --python=$(which python3) --make="-j8"
```
:::
</TabItem>
<TabItem value="pkg" label="pkg">
@ -132,7 +146,7 @@ npx boxednode@2.0.1 -s xlsx-cli.js -t xlsx-cli
</Tabs>
4) Run the generated program, passing `pres.numbers` as the argument. For
example, on an Intel Mac, `nexe` generates `xlsx-cli` so the command is:
example, `nexe` generates `xlsx-cli` in macOS so the command is:
```bash
./xlsx-cli pres.numbers
@ -150,6 +164,7 @@ This demo was last tested in the following deployments:
| Architecture | V8 Version | Date |
|:-------------|:-------------|:-----------|
| `darwin-x64` | `11.4.183.2` | 2023-05-22 |
| `darwin-mac` | `11.4.183.2` | 2023-05-22 |
| `linux-x64` | `11.4.183.2` | 2023-05-23 |
| `win32-x64` | `11.4.183.2` | 2023-05-23 |
@ -237,6 +252,7 @@ This demo was last tested in the following deployments:
| Architecture | Version | Date |
|:-------------|:---------|:-----------|
| `darwin-x64` | `1.33.2` | 2023-05-08 |
| `darwin-arm` | `1.34.1` | 2023-06-05 |
| `win32-x64` | `1.33.2` | 2023-05-08 |
| `linux-x64` | `1.33.2` | 2023-05-08 |

@ -334,7 +334,7 @@ function SheetJSFetchCSVStreamWorker() {
const [__html, setHTML] = React.useState("");
const [state, setState] = React.useState("");
const [cnt, setCnt] = React.useState(0);
const [url, setUrl] = React.useState("https://oss.sheetjs.com/test_files/large_strings.xlsx");
const [url, setUrl] = React.useState("https://docs.sheetjs.com/test_files/large_strings.xlsx");
\n\
return ( <>
<b>URL: </b><input type="text" value={url} onChange={(e) => setUrl(e.target.value)} size="80"/>

@ -578,7 +578,7 @@ function SheetJSFetchCSVStreamFile() {
const [__html, setHTML] = React.useState("");
const [cnt, setCnt] = React.useState(0);
const [hz, setHz] = React.useState(0);
const [url, setUrl] = React.useState("https://oss.sheetjs.com/test_files/large_strings.xlsx");
const [url, setUrl] = React.useState("https://docs.sheetjs.com/test_files/large_strings.xlsx");
const ref = React.useRef(null);
\n\
return ( <>

@ -118,6 +118,7 @@ This demo was tested in the following deployments:
| Architecture | Version | Date |
|:-------------|:--------|:-----------|
| `darwin-x64` | `2.7.0` | 2023-02-12 |
| `darwin-arm` | `2.7.0` | 2023-06-05 |
| `linux-x64` | `2.7.0` | 2023-06-02 |
:::

@ -5,6 +5,8 @@ pagination_next: solutions/input
---
import current from '/version.js';
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
import CodeBlock from '@theme/CodeBlock';
V8 is an embeddable JS engine written in C++. It powers Chromium and Chrome,
@ -110,6 +112,7 @@ This demo was tested in the following deployments:
| V8 Version | Platform | OS Version | Compiler | Date |
|:--------------|:-------------|:-------------|:---------------|:-----------|
| `11.3.244.11` | `darwin-x64` | macOS 13.2 | `clang 14.0.3` | 2023-05-20 |
| `11.3.244.11` | `darwin-arm` | macOS 13.0 | `clang 14.0.3` | 2023-06-05 |
| `11.3.244.11` | `linux-x64` | HoloOS 3.4.6 | `gcc 12.2.0` | 2023-05-20 |
:::
@ -132,11 +135,28 @@ The build process is long and will test your patience.
### Preparation
1) Download and install `depot_tools`:
0) Prepare `/usr/local/lib`:
```bash
mkdir -p /usr/local/lib
cd /usr/local/lib
```
:::caution
If this step throws a permission error, run:
```bash
sudo mkdir -p /usr/local/lib
sudo chmod 777 /usr/local/lib
```
:::
1) Download and install `depot_tools`:
```bash
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
```
@ -178,13 +198,30 @@ git checkout refs/tags/11.3.244.11 -b sample -t
6) Build the static library.
<Tabs groupId="triple">
<TabItem value="darwin-x64" label="Intel Mac">
```bash
tools/dev/v8gen.py x64.release.sample
ninja -C out.gn/x64.release.sample v8_monolith
```
</TabItem>
<TabItem value="darwin-arm" label="Apple Silicon">
```bash
tools/dev/v8gen.py arm64.release.sample
ninja -C out.gn/arm64.release.sample v8_monolith
```
</TabItem>
</Tabs>
7) Ensure the sample `hello-world` compiles and runs:
<Tabs groupId="triple">
<TabItem value="darwin-x64" label="Intel Mac">
```bash
g++ -I. -Iinclude samples/hello-world.cc -o hello_world -fno-rtti -lv8_monolith \
-lv8_libbase -lv8_libplatform -ldl -Lout.gn/x64.release.sample/obj/ -pthread \
@ -192,6 +229,20 @@ g++ -I. -Iinclude samples/hello-world.cc -o hello_world -fno-rtti -lv8_monolith
./hello_world
```
</TabItem>
<TabItem value="darwin-arm" label="Apple Silicon">
```bash
g++ -I. -Iinclude samples/hello-world.cc -o hello_world -fno-rtti -lv8_monolith \
-lv8_libbase -lv8_libplatform -ldl -Lout.gn/arm64.release.sample/obj/ -pthread \
-std=c++17 -DV8_COMPRESS_POINTERS=1 -DV8_ENABLE_SANDBOX
./hello_world
```
</TabItem>
</Tabs>
### Prepare Project
8) Make a new project folder:
@ -210,11 +261,25 @@ cp ~/dev/v8/v8/samples/hello-world.cc .
10) Create symbolic links to the `include` headers and `obj` library folders:
<Tabs groupId="triple">
<TabItem value="darwin-x64" label="Intel Mac">
```bash
ln -s ~/dev/v8/v8/include
ln -s ~/dev/v8/v8/out.gn/x64.release.sample/obj
```
</TabItem>
<TabItem value="darwin-arm" label="Apple Silicon">
```bash
ln -s ~/dev/v8/v8/include
ln -s ~/dev/v8/v8/out.gn/arm64.release.sample/obj
```
</TabItem>
</Tabs>
11) Build and run the `hello-world` example from this folder:
```bash
@ -295,6 +360,7 @@ This demo was last tested in the following deployments:
| Architecture | V8 Crate | Date |
|:-------------|:---------|:-----------|
| `darwin-x64` | `0.71.2` | 2023-05-22 |
| `darwin-arm` | `0.73.0` | 2023-06-05 |
| `linux-x64` | `0.71.2` | 2023-05-23 |
| `win32-x64` | `0.71.2` | 2023-05-23 |

@ -129,12 +129,12 @@ try? out.write(to: out_path, atomically: false, encoding: String.Encoding.isoLat
:::note
This demo was tested on 2023 February 12. `swift --version` printed:
This demo was tested in the following environments:
```
swift-driver version: 1.62.15 Apple Swift version 5.7.2
Target: x86_64-apple-macosx12.0
```
| Architecture | Swift | Date |
|:-------------|:--------|:-----------|
| `darwin-x64` | `5.7.2` | 2023-02-12 |
| `darwin-arm` | `5.8.1` | 2023-06-05 |
:::

@ -90,7 +90,12 @@ _ = ioutil.WriteFile("sheetjs.xlsx", buf, 0644)
:::note
This demo was tested on 2023 February 14.
This demo was tested in the following deployments:
| Architecture | Git Commit | Go version | Date |
|:-------------|:-----------|:-----------|:-----------|
| `darwin-x64` | `28ee0ee` | `1.19.3` | 2023-06-05 |
| `darwin-arm` | `28ee0ee` | `1.20.4` | 2023-06-05 |
:::

@ -121,6 +121,7 @@ This demo was tested in the following deployments:
| Architecture | Git Commit | Date |
|:-------------|:-----------|:-----------|
| `darwin-x64` | `2788d71` | 2023-02-12 |
| `darwin-arm` | `2788d71` | 2023-06-05 |
| `linux-x64` | `2788d71` | 2023-06-02 |
:::

@ -156,48 +156,53 @@ while the "CLI Test" demonstrates other concepts using the `hermes` CLI tool.
:::note
This demo was last tested on 2023 May 30 against Hermes commit `869312f` on
a Intel Mac. `llvm-g++ -v` printed:
This demo was tested in the following deployments:
```
Apple clang version 14.0.0 (clang-1400.0.29.202)
Target: x86_64-apple-darwin21.6.0
```
| Architecture | Git Commit | Date |
|:-------------|:-----------|:-----------|
| `darwin-x64` | `869312f` | 2023-05-30 |
| `darwin-arm` | `869312f` | 2023-06-05 |
:::
0) Make a project directory:
0) Install build dependencies:
```bash
brew install icu4c cmake ninja
```
1) Make a project directory:
```bash
mkdir sheetjs-hermes
cd sheetjs-hermes
```
1) Download the [`Makefile`](pathname:///hermes/Makefile):
2) Download the [`Makefile`](pathname:///hermes/Makefile):
```bash
curl -LO https://docs.sheetjs.com/hermes/Makefile
```
2) Download [`sheetjs-hermes.cpp`](pathname:///hermes/sheetjs-hermes.cpp):
3) Download [`sheetjs-hermes.cpp`](pathname:///hermes/sheetjs-hermes.cpp):
```bash
curl -LO https://docs.sheetjs.com/hermes/sheetjs-hermes.cpp
```
3) Build the library (this is the `init` target):
4) Build the library (this is the `init` target):
```bash
make init
```
4) Build the application:
5) Build the application:
```bash
make sheetjs-hermes
```
5) Download the standalone script and test file:
6) Download the standalone script and test file:
<ul>
<li><a href={`https://cdn.sheetjs.com/xlsx-${current}/package/dist/xlsx.full.min.js`}>xlsx.full.min.js</a></li>
@ -209,7 +214,7 @@ curl -LO https://cdn.sheetjs.com/xlsx-${current}/package/dist/xlsx.full.min.js
curl -LO https://sheetjs.com/pres.numbers`}
</CodeBlock>
6) Run the application:
7) Run the application:
```bash
./sheetjs-hermes pres.numbers

@ -5,6 +5,8 @@ pagination_next: solutions/input
---
import current from '/version.js';
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
import CodeBlock from '@theme/CodeBlock';
ChakraCore is an embeddable JS engine written in C++.
@ -114,37 +116,89 @@ while the "CLI Test" demonstrates other concepts using the `ch` CLI tool.
:::note
This demo was last tested on 2023 April 09 against ChakraCore commit `c3ead3f`
on a Intel Mac. `gcc -v` printed:
This demo was tested in the following deployments:
```
Apple clang version 14.0.0 (clang-1400.0.29.202)
Target: x86_64-apple-darwin21.6.0
```
| Architecture | Git Commit | Date |
|:-------------|:-----------|:-----------|
| `darwin-x64` | `c3ead3f` | 2023-04-09 |
| `darwin-arm` | `c3ead3f` | 2023-06-05 |
:::
0) Build ChakraCore:
0) Install `icu` and `cmake` dependencies. On macOS:
```bash
brew install icu4c cmake
```
1) Download ChakraCore:
```bash
git clone https://github.com/Microsoft/ChakraCore
cd ChakraCore
git checkout c3ead3f
cd ..
```
2) Build ChakraCore:
<Tabs groupId="triple">
<TabItem value="darwin-x64" label="Intel Mac">
```bash
cd ChakraCore
./build.sh --static --icu=/usr/local/opt/icu4c/include --test-build -j=8
cd ..
```
1) Download the source file and `Makefile`:
</TabItem>
<TabItem value="darwin-arm" label="Apple Silicon">
:::info
When the demo was last tested, ChakraCore JIT was not supported.
:::
```bash
cd ChakraCore
./build.sh --static --icu=/usr/local/opt/icu4c/include --test-build -j=8 --no-jit
cd ..
```
</TabItem>
</Tabs>
:::caution
When this demo was last tested on macOS, the build failed with the message:
```
!!! couldn't find ICU ...
```
This was fixed with a local symlink to the `icu4c` folder before the build step:
```bash
cd ChakraCore
mkdir -p usr/local/opt
ln -s /opt/homebrew/opt/icu4c usr/local/opt/icu4c
cd ..
```
:::
3) Download the source file and `Makefile`:
- [`sheetjs.ch.cpp`](pathname:///chakra/sheetjs.ch.cpp)
- [`Makefile`](pathname:///chakra/Makefile)
```bash
curl -LO https://docs.sheetjs.com/chakra/sheetjs.ch.c
curl -LO https://docs.sheetjs.com/chakra/sheetjs.ch.cpp
curl -LO https://docs.sheetjs.com/chakra/Makefile
```
2) Build the sample application:
4) Build the sample application:
```bash
make
@ -152,7 +206,26 @@ make
This program tries to parse the file specified by the first argument
4) Download the standalone script, shim script, and test file:
:::caution
When this demo was last tested on macOS, the build failed with the message:
```
clang: error: no such file or directory: '/usr/local/opt/icu4c/lib/libicudata.a'
```
This was fixed by creating a symbolic link:
```bash
cd /usr/local
sudo mkdir -p opt
cd opt
sudo ln -s /opt/homebrew/opt/icu4c
```
:::
5) Download the standalone script, shim script, and test file:
<ul>
<li><a href={`https://cdn.sheetjs.com/xlsx-${current}/package/dist/xlsx.full.min.js`}>xlsx.full.min.js</a></li>
@ -166,7 +239,7 @@ curl -LO https://cdn.sheetjs.com/xlsx-${current}/package/dist/shim.min.js
curl -LO https://sheetjs.com/pres.numbers`}
</CodeBlock>
5) Run the test program:
6) Run the test program:
```
./sheetjs.ch pres.numbers

@ -42,7 +42,7 @@ use boa_engine::{Context, Source, JsError};
/* simple wrapper to evaluate code snippets */
fn eval_code(c: &mut Context, code: &str) -> Result<String, JsError> {
let src = Source::from_bytes(code);
match c.eval_script(src) {
match c.eval(src) {
Ok(res) => { return Ok(res.to_string(c).unwrap().to_std_string_escaped()); }
Err(e) => { return Err(e); }
};
@ -61,7 +61,7 @@ use boa_engine::{Context, Source, JsError};
/* simple wrapper to evaluate an entire script file */
fn eval_file(c: &mut Context, path: &str) -> Result<String, JsError> {
let src = Source::from_filepath(Path::new(path)).unwrap();
match c.eval_script(src) {
match c.eval(src) {
Ok(res) => { return Ok(res.to_string(c).unwrap().to_std_string_escaped()); }
Err(e) => { return Err(e); }
};
@ -111,7 +111,12 @@ various SheetJS API functions.
:::note
This demo was tested on 2023 May 22
This demo was tested in the following deployments:
| Architecture | Date |
|:-------------|:-----------|
| `darwin-x64` | 2023-06-05 |
| `darwin-arm` | 2023-06-05 |
:::

@ -397,7 +397,7 @@ For modern websites targeting Chrome 42+, `fetch` is recommended:
// XLSX is a global from the standalone script
(async() => {
const url = "https://oss.sheetjs.com/test_files/formula_stress_test.xlsx";
const url = "https://sheetjs.com/pres.xlsx";
const data = await (await fetch(url)).arrayBuffer();
/* data is an ArrayBuffer */
const workbook = XLSX.read(data);
@ -409,7 +409,7 @@ For modern websites targeting Chrome 42+, `fetch` is recommended:
For broader support, the `XMLHttpRequest` approach is recommended:
```js
var url = "https://oss.sheetjs.com/test_files/formula_stress_test.xlsx";
var url = "https://sheetjs.com/pres.xlsx";
/* set up async GET request */
var req = new XMLHttpRequest();
@ -437,7 +437,7 @@ NodeJS releases starting from version 18.0 have native support for fetch:
```js
const XLSX = require("xlsx");
const url = "https://oss.sheetjs.com/test_files/formula_stress_test.xlsx";
const url = "https://sheetjs.com/pres.xlsx";
const data = await (await fetch(url)).arrayBuffer();
/* data is an ArrayBuffer */
const workbook = XLSX.read(data);
@ -451,7 +451,7 @@ For broader compatibility, third-party modules are recommended.
var XLSX = require("xlsx");
var request = require("request");
var url = "https://oss.sheetjs.com/test_files/formula_stress_test.xlsx";
var url = "https://sheetjs.com/pres.xlsx";
request({url: url, encoding: null}, function(err, resp, body) {
var workbook = XLSX.read(body);
@ -465,7 +465,7 @@ request({url: url, encoding: null}, function(err, resp, body) {
const XLSX = require("xlsx");
const axios = require("axios");
const url = "https://oss.sheetjs.com/test_files/formula_stress_test.xlsx";
const url = "https://sheetjs.com/pres.xlsx";
(async() => {
const res = await axios.get(url, {responseType: "arraybuffer"});
/* res.data is a Buffer */
@ -486,7 +486,7 @@ import * as XLSX from 'xlsx';
import * as cptable from 'xlsx/dist/cpexcel.full.mjs';
XLSX.set_cptable(cptable);
const url = "https://oss.sheetjs.com/test_files/formula_stress_test.xlsx";
const url = "https://sheetjs.com/pres.xlsx";
// highlight-next-line
const data = await (await fetch(url)).arrayBuffer();
/* data is an ArrayBuffer */
@ -505,7 +505,7 @@ import * as XLSX from 'https://cdn.sheetjs.com/xlsx-${current}/package/xlsx.mjs'
import * as cptable from 'https://cdn.sheetjs.com/xlsx-${current}/package/dist/cpexcel.full.mjs';
XLSX.set_cptable(cptable);
\n\
const url = "https://oss.sheetjs.com/test_files/formula_stress_test.xlsx";
const url = "https://sheetjs.com/pres.xlsx";
// highlight-next-line
const data = await (await fetch(url)).arrayBuffer();
/* data is an ArrayBuffer */
@ -531,7 +531,7 @@ resources. Responses should be manually concatenated using `Buffer.concat`:
const XLSX = require("xlsx");
const { net } = require("electron");
const url = "https://oss.sheetjs.com/test_files/formula_stress_test.xlsx";
const url = "https://sheetjs.com/pres.xlsx";
const req = net.request(url);
req.on("response", (res) => {
const bufs = []; // this array will collect all of the buffers

@ -619,7 +619,7 @@ import { read, utils } from "xlsx";
import 'react-data-grid/lib/styles.css';
const url = "https://oss.sheetjs.com/test_files/RkNumber.xls";
const url = "https://sheetjs.com/pres.xlsx";
export default function App() {
const [columns, setColumns] = useState([]);

@ -9,7 +9,7 @@ use boa_engine::property::Attribute;
fn eval_file(c: &mut Context, path: &str) -> Result<String, JsError> {
let src = Source::from_filepath(Path::new(path)).unwrap();
match c.eval_script(src) {
match c.eval(src) {
Ok(res) => { return Ok(res.to_string(c).unwrap().to_std_string_escaped()); }
Err(e) => { return Err(e); }
};
@ -17,7 +17,7 @@ fn eval_file(c: &mut Context, path: &str) -> Result<String, JsError> {
fn eval_code(c: &mut Context, code: &str) -> Result<String, JsError> {
let src = Source::from_bytes(code);
match c.eval_script(src) {
match c.eval(src) {
Ok(res) => { return Ok(res.to_string(c).unwrap().to_std_string_escaped()); }
Err(e) => { return Err(e); }
};

BIN
docz/static/logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.