Skip to content

Commit

Permalink
version bump 0.11.8: CFB 1.0.0
Browse files Browse the repository at this point in the history
- travis node 9 test
- demo refresh
  • Loading branch information
SheetJSDev committed Nov 5, 2017
1 parent 1ab1306 commit 3f6f8e9
Show file tree
Hide file tree
Showing 29 changed files with 217 additions and 128 deletions.
1 change: 1 addition & 0 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ tmp
*.exe
*.img
.gitignore
.gitattributes
.fossaignore
.spelling
.eslintrc
Expand Down
9 changes: 6 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
language: node_js
node_js:
- "9"
- "8"
- "7"
- "6"
Expand All @@ -9,16 +10,18 @@ matrix:
env: TZ="America/New_York" FMTS=misc
- node_js: "8"
env: TZ="America/Los_Angeles"
- node_js: "6"
env: TZ="Europe/London" FMTS=misc
- node_js: "8"
env: TZ="Europe/London" FMTS=misc
- node_js: "6"
env: TZ="Europe/Berlin"
- node_js: "6"
env: TZ="Asia/Kolkata" FMTS=misc
- node_js: "7"
- node_js: "9"
env: TZ="Asia/Shanghai"
- node_js: "8"
env: TZ="Asia/Seoul" FMTS=misc
- node_js: "7"
env: TZ="America/Cancun" FMTS=misc

- node_js: "5"
env: TZ="America/Anchorage" FMTS=misc
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ The [`demos` directory](demos/) includes sample projects for:

**Frameworks and APIs**
- [`angular 1.x`](demos/angular/)
- [`angular 2.x / 4.x`](demos/angular2/)
- [`angular 2.x / 4.x / 5.x`](demos/angular2/)
- [`meteor`](demos/meteor/)
- [`react and react-native`](demos/react/)
- [`vue 2.x and weex`](demos/vue/)
Expand Down
2 changes: 1 addition & 1 deletion bits/01_version.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
XLSX.version = '0.11.7';
XLSX.version = '0.11.8';
32 changes: 22 additions & 10 deletions bits/18_cfb.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ type CFBFiles = {[n:string]:CFBEntry};
/* [MS-CFB] v20130118 */
var CFB = (function _CFB(){
var exports/*:CFBModule*/ = /*::(*/{}/*:: :any)*/;
exports.version = '0.13.2';
exports.version = '1.0.0';
/* [MS-CFB] 2.6.4 */
function namecmp(l/*:string*/, r/*:string*/)/*:number*/ {
var L = l.split("/"), R = r.split("/");
Expand Down Expand Up @@ -141,16 +141,15 @@ sector_list.fat_addrs = fat_addrs;
sector_list.ssz = ssz;

/* [MS-CFB] 2.6.1 Compound File Directory Entry */
var files/*:CFBFiles*/ = {}, Paths/*:Array<string>*/ = [], FileIndex/*:CFBFileIndex*/ = [], FullPaths/*:Array<string>*/ = [], FullPathDir = {};
read_directory(dir_start, sector_list, sectors, Paths, nmfs, files, FileIndex);
var files/*:CFBFiles*/ = {}, Paths/*:Array<string>*/ = [], FileIndex/*:CFBFileIndex*/ = [], FullPaths/*:Array<string>*/ = [];
read_directory(dir_start, sector_list, sectors, Paths, nmfs, files, FileIndex, minifat_start);

build_full_paths(FileIndex, FullPathDir, FullPaths, Paths);
build_full_paths(FileIndex, FullPaths, Paths);
Paths.shift();

var o = {
FileIndex: FileIndex,
FullPaths: FullPaths,
FullPathDir: FullPathDir
FullPaths: FullPaths
};

// $FlowIgnore
Expand Down Expand Up @@ -202,7 +201,7 @@ function sectorify(file/*:RawBytes*/, ssz/*:number*/)/*:Array<RawBytes>*/ {
}

/* [MS-CFB] 2.6.4 Red-Black Tree */
function build_full_paths(FI/*:CFBFileIndex*/, FPD/*:CFBFullPathDir*/, FP/*:Array<string>*/, Paths/*:Array<string>*/)/*:void*/ {
function build_full_paths(FI/*:CFBFileIndex*/, FP/*:Array<string>*/, Paths/*:Array<string>*/)/*:void*/ {
var i = 0, L = 0, R = 0, C = 0, j = 0, pl = Paths.length;
var dad/*:Array<number>*/ = [], q/*:Array<number>*/ = [];

Expand Down Expand Up @@ -238,10 +237,23 @@ function build_full_paths(FI/*:CFBFileIndex*/, FPD/*:CFBFullPathDir*/, FP/*:Arra
FP[0] += "/";
for(i=1; i < pl; ++i) {
if(FI[i].type !== 2 /* stream */) FP[i] += "/";
FPD[FP[i]] = FI[i];
}
}

function get_mfat_entry(entry/*:CFBEntry*/, payload/*:RawBytes*/, mini/*:?RawBytes*/)/*:CFBlob*/ {
var start = entry.start, size = entry.size;
//return (payload.slice(start*MSSZ, start*MSSZ + size)/*:any*/);
var o = [];
var idx = start;
while(mini && size > 0 && idx >= 0) {
o.push(payload.slice(idx * MSSZ, idx * MSSZ + MSSZ));
size -= MSSZ;
idx = __readInt32LE(mini, idx * 4);
}
if(o.length === 0) return (new_buf(0)/*:any*/);
return (bconcat(o).slice(0, entry.size)/*:any*/);
}

/** Chase down the rest of the DIFAT chain to build a comprehensive list
DIFAT chains by storing the next sector number as the last 32 bits */
function sleuth_fat(idx/*:number*/, cnt/*:number*/, sectors/*:Array<RawBytes>*/, ssz/*:number*/, fat_addrs)/*:void*/ {
Expand Down Expand Up @@ -303,7 +315,7 @@ function make_sector_list(sectors/*:Array<RawBytes>*/, dir_start/*:number*/, fat
}

/* [MS-CFB] 2.6.1 Compound File Directory Entry */
function read_directory(dir_start/*:number*/, sector_list/*:SectorList*/, sectors/*:Array<RawBytes>*/, Paths/*:Array<string>*/, nmfs, files, FileIndex) {
function read_directory(dir_start/*:number*/, sector_list/*:SectorList*/, sectors/*:Array<RawBytes>*/, Paths/*:Array<string>*/, nmfs, files, FileIndex, mini) {
var minifat_store = 0, pl = (Paths.length?2:0);
var sector = sector_list[dir_start].data;
var i = 0, namelen = 0, name;
Expand Down Expand Up @@ -345,7 +357,7 @@ function read_directory(dir_start/*:number*/, sector_list/*:SectorList*/, sector
} else {
o.storage = 'minifat';
if(minifat_store !== ENDOFCHAIN && o.start !== ENDOFCHAIN && sector_list[minifat_store]) {
o.content = (sector_list[minifat_store].data.slice(o.start*MSSZ,o.start*MSSZ+o.size)/*:any*/);
o.content = get_mfat_entry(o, sector_list[minifat_store].data, (sector_list[mini]||{}).data);
prep_blob(o.content, 0);
}
}
Expand Down
2 changes: 1 addition & 1 deletion demos/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ can be installed with Bash on Windows or with `cygwin`.

**Frameworks and APIs**
- [`angular 1.x`](angular/)
- [`angular 2.x / 4.x`](angular2/)
- [`angular 2.x / 4.x / 5.x`](angular2/)
- [`meteor`](meteor/)
- [`react and react-native`](react/)
- [`vue 2.x and weex`](vue/)
Expand Down
7 changes: 7 additions & 0 deletions demos/angular2/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,10 @@ angular:
if [ ! -e node_modules/xlsx ]; then cd node_modules; ln -s ../../../ xlsx; cd -; fi
ng build

# Test Angular5 build
cp package.json-angular5 package.json
npm install
if [ ! -e node_modules ]; then mkdir node_modules; fi
if [ ! -e node_modules/xlsx ]; then cd node_modules; ln -s ../../../ xlsx; cd -; fi
ng build

17 changes: 5 additions & 12 deletions demos/angular2/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,27 +67,20 @@ saveAs(new Blob([s2ab(wbout)]), 'SheetJS.xlsx');

## Switching between Angular versions

Modules that work with Angular 2 largely work as-is with Angular 4. Switching
Modules that work with Angular 2 largely work as-is with Angular 4+. Switching
between versions is mostly a matter of installing the correct version of the
core and associated modules. This demo includes a `package.json` for Angular 2
and another `package.json` for Angular 4.
core and associated modules. This demo includes `package.json-angular#` files
for Angular 2, Angular 4, and Angular 5

Switching to Angular 2 is as simple as:
To test a particular Angular version, overwrite `package.json`:

```bash
# switch to Angular 2
$ cp package.json-angular2 package.json
$ npm install
$ ng serve
```

Switching to Angular 4 is as simple as:

```bash
$ cp package.json-angular4 package.json
$ npm install
$ ng serve
```

## XLSX Symbolic Link

In this tree, `node_modules/xlsx` is a link pointing back to the root. This
Expand Down
40 changes: 22 additions & 18 deletions demos/angular2/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "angular2",
"name": "angular5",
"version": "0.0.0",
"license": "MIT",
"scripts": {
Expand All @@ -9,27 +9,31 @@
},
"private": true,
"dependencies": {
"@angular/animations": "^4.0.0",
"@angular/common": "^4.0.0",
"@angular/compiler": "^4.0.0",
"@angular/core": "^4.0.0",
"@angular/forms": "^4.0.0",
"@angular/http": "^4.0.0",
"@angular/platform-browser": "^4.0.0",
"@angular/platform-browser-dynamic": "^4.0.0",
"@angular/router": "^4.0.0",
"@angular/animations": "^5.0.0",
"@angular/common": "^5.0.0",
"@angular/compiler": "^5.0.0",

"@angular/core": "^5.0.0",
"@angular/forms": "^5.0.0",
"@angular/http": "^5.0.0",
"@angular/platform-browser": "^5.0.0",
"@angular/platform-browser-dynamic": "^5.0.0",

"@angular/router": "^5.0.0",
"core-js": "^2.4.1",
"rxjs": "^5.1.0",
"zone.js": "^0.8.4",

"rxjs": "^5.5.2",

"zone.js": "^0.8.14",
"file-saver": "^1.3.3"
},
"devDependencies": {
"@angular/cli": "1.1.2",
"@angular/compiler-cli": "^4.0.0",
"@angular/language-service": "^4.0.0",
"@angular/cli": "1.5.0",
"@angular/compiler-cli": "^5.0.0",
"@angular/language-service": "^5.0.0",
"@types/node": "~6.0.60",
"ts-node": "~3.0.4",
"tslint": "~5.3.2",
"typescript": "~2.3.3"
"ts-node": "~3.2.0",
"tslint": "~5.7.0",
"typescript": "~2.4.2"
}
}
2 changes: 1 addition & 1 deletion demos/angular2/package.json-angular4
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "angular2",
"name": "angular4",
"version": "0.0.0",
"license": "MIT",
"scripts": {
Expand Down
39 changes: 39 additions & 0 deletions demos/angular2/package.json-angular5
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"name": "angular5",
"version": "0.0.0",
"license": "MIT",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build"
},
"private": true,
"dependencies": {
"@angular/animations": "^5.0.0",
"@angular/common": "^5.0.0",
"@angular/compiler": "^5.0.0",

"@angular/core": "^5.0.0",
"@angular/forms": "^5.0.0",
"@angular/http": "^5.0.0",
"@angular/platform-browser": "^5.0.0",
"@angular/platform-browser-dynamic": "^5.0.0",

"@angular/router": "^5.0.0",
"core-js": "^2.4.1",

"rxjs": "^5.5.2",

"zone.js": "^0.8.14",
"file-saver": "^1.3.3"
},
"devDependencies": {
"@angular/cli": "1.5.0",
"@angular/compiler-cli": "^5.0.0",
"@angular/language-service": "^5.0.0",
"@types/node": "~6.0.60",
"ts-node": "~3.2.0",
"tslint": "~5.7.0",
"typescript": "~2.4.2"
}
}
2 changes: 1 addition & 1 deletion demos/react/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ into web pages with script tags:
The library can also be imported directly from JSX code with:

```js
import * as XLSX from 'xlsx';
import XLSX from 'xlsx';
```

This demo shows a simple JSX component transpiled in the browser using the babel
Expand Down
2 changes: 1 addition & 1 deletion demos/react/nexthdr.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
/* xlsx.js (C) 2013-present SheetJS -- http://sheetjs.com */
import * as XLSX from 'xlsx';
import XLSX from 'xlsx';
import { saveAs } from 'file-saver';
2 changes: 1 addition & 1 deletion demos/react/react-native.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* xlsx.js (C) 2013-present SheetJS -- http://sheetjs.com */
import * as XLSX from 'xlsx';
import XLSX from 'xlsx';

import React, { Component } from 'react';
import { AppRegistry, StyleSheet, Text, View, Button, Alert, Image } from 'react-native';
Expand Down
6 changes: 3 additions & 3 deletions dist/xlsx.core.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/xlsx.core.min.map

Large diffs are not rendered by default.

26 changes: 13 additions & 13 deletions dist/xlsx.full.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/xlsx.full.min.map

Large diffs are not rendered by default.

Loading

0 comments on commit 3f6f8e9

Please sign in to comment.