Skip to content

Commit 9358214

Browse files
committed
version bump 0.11.1: dist cleanup
- dist scripts properly export library - XLS/XLSB formulae quote sheet names containing spaces - skipHidden ported to streaming CSV write - updated codepage to 1.11.0 - flow and TS updates - webpack demo example using dist scripts - requirejs demo
1 parent 0f39f28 commit 9358214

59 files changed

Lines changed: 1264 additions & 762 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.fossaignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
bits/
22
demos/
3+
dist/
34
docbits/
45
misc/
56
node_modules/

Makefile

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,17 +50,17 @@ init: ## Initial setup for development
5050
git submodule foreach make
5151
mkdir -p tmp
5252

53+
DISTHDR=misc/suppress_export.js
5354
.PHONY: dist
5455
dist: dist-deps $(TARGET) bower.json ## Prepare JS files for distribution
55-
<$(TARGET) sed "s/require('stream')/{}/g;s/require('.*')/null/g" > dist/$(TARGET)
56+
<$(TARGET) sed "s/require('stream')/{}/g;s/require('....*')/undefined/g" > dist/$(TARGET)
5657
cp LICENSE dist/
57-
uglifyjs dist/$(TARGET) $(UGLIFYOPTS) -o dist/$(LIB).min.js --source-map dist/$(LIB).min.map --preamble "$$(head -n 1 bits/00_header.js)"
58+
uglifyjs $(DISTHDR) dist/$(TARGET) $(UGLIFYOPTS) -o dist/$(LIB).min.js --source-map dist/$(LIB).min.map --preamble "$$(head -n 1 bits/00_header.js)"
5859
misc/strip_sourcemap.sh dist/$(LIB).min.js
59-
uglifyjs $(REQS) dist/$(TARGET) $(UGLIFYOPTS) -o dist/$(LIB).core.min.js --source-map dist/$(LIB).core.min.map --preamble "$$(head -n 1 bits/00_header.js)"
60+
uglifyjs $(DISTHDR) $(REQS) dist/$(TARGET) $(UGLIFYOPTS) -o dist/$(LIB).core.min.js --source-map dist/$(LIB).core.min.map --preamble "$$(head -n 1 bits/00_header.js)"
6061
misc/strip_sourcemap.sh dist/$(LIB).core.min.js
61-
uglifyjs $(REQS) $(ADDONS) dist/$(TARGET) $(AUXTARGETS) $(UGLIFYOPTS) -o dist/$(LIB).full.min.js --source-map dist/$(LIB).full.min.map --preamble "$$(head -n 1 bits/00_header.js)"
62+
uglifyjs $(DISTHDR) $(REQS) $(ADDONS) dist/$(TARGET) $(AUXTARGETS) $(UGLIFYOPTS) -o dist/$(LIB).full.min.js --source-map dist/$(LIB).full.min.map --preamble "$$(head -n 1 bits/00_header.js)"
6263
misc/strip_sourcemap.sh dist/$(LIB).full.min.js
63-
cat <(head -n 1 bits/00_header.js) $(REQS) $(ADDONS) $(TARGET) $(AUXTARGETS) > demos/requirejs/$(LIB).full.js
6464

6565
.PHONY: dist-deps
6666
dist-deps: ## Copy dependencies for distribution

bits/01_version.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
XLSX.version = '0.11.0';
1+
XLSX.version = '0.11.1';

bits/20_jsutils.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ var basedate = new Date(1899, 11, 30, 0, 0, 0); // 2209161600000
3333
var dnthresh = basedate.getTime() + (new Date().getTimezoneOffset() - basedate.getTimezoneOffset()) * 60000;
3434
function datenum(v/*:Date*/, date1904/*:?boolean*/)/*:number*/ {
3535
var epoch = v.getTime();
36-
if(date1904) epoch += 1462*24*60*60*1000;
36+
if(date1904) epoch -= 1462*24*60*60*1000;
3737
return (epoch - dnthresh) / (24 * 60 * 60 * 1000);
3838
}
3939
function numdate(v/*:number*/)/*:Date*/ {

bits/21_ziputils.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ if(typeof JSZip !== 'undefined') jszip = JSZip;
5858
if (typeof exports !== 'undefined') {
5959
if (typeof module !== 'undefined' && module.exports) {
6060
if(typeof jszip === 'undefined') jszip = require('./jszip.js');
61-
_fs = require('fs');
61+
try { _fs = require('fs'); } catch(e) { }
6262
}
6363
}
6464

bits/38_xlstypes.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ function parse_VtStringBase(blob, stringType, pad) {
2828
return parse_lpstr(blob, stringType, pad);
2929
}
3030

31-
function parse_VtString(blob, t/*:number*/, pad/*:number*/) { return parse_VtStringBase(blob, t, pad === false ? 0: 4); }
32-
function parse_VtUnalignedString(blob, t/*:number*/) { if(!t) throw new Error("dafuq?"); return parse_VtStringBase(blob, t, 0); }
31+
function parse_VtString(blob, t/*:number*/, pad/*:?boolean*/) { return parse_VtStringBase(blob, t, pad === false ? 0: 4); }
32+
function parse_VtUnalignedString(blob, t/*:number*/) { if(!t) throw new Error("VtUnalignedString must have positive length"); return parse_VtStringBase(blob, t, 0); }
3333

3434
/* [MS-OSHARED] 2.3.3.1.9 VtVecUnalignedLpstrValue */
3535
function parse_VtVecUnalignedLpstrValue(blob) {
@@ -123,7 +123,7 @@ function parse_TypedPropertyValue(blob, type/*:number*/, _opts) {
123123
case 0x40 /*VT_FILETIME*/: return parse_FILETIME(blob);
124124
case 0x41 /*VT_BLOB*/: return parse_BLOB(blob);
125125
case 0x47 /*VT_CF*/: return parse_ClipboardData(blob);
126-
case 0x50 /*VT_STRING*/: return parse_VtString(blob, t, !opts.raw && 4).replace(chr0,'');
126+
case 0x50 /*VT_STRING*/: return parse_VtString(blob, t, !opts.raw).replace(chr0,'');
127127
case 0x51 /*VT_USTR*/: return parse_VtUnalignedString(blob, t/*, 4*/).replace(chr0,'');
128128
case 0x100C /*VT_VECTOR|VT_VARIANT*/: return parse_VtVecHeadingPair(blob);
129129
case 0x101E /*VT_LPSTR*/: return parse_VtVecUnalignedLpstr(blob);

bits/44_offcrypto.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ function parse_FilePassHeader(blob, length/*:number*/, oo) {
294294
return o;
295295
}
296296
function parse_FilePass(blob, length/*:number*/, opts) {
297-
var o = { Type: opts.biff >= 8 ? blob.read_shift(2) : 0 }; /* wEncryptionType */
297+
var o = ({ Type: opts.biff >= 8 ? blob.read_shift(2) : 0 }/*:any*/); /* wEncryptionType */
298298
if(o.Type) parse_FilePassHeader(blob, length-2, o);
299299
else parse_XORObfuscation(blob, length-2, opts, o);
300300
return o;

bits/45_rtf.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
var RTF = (function() {
2+
function rtf_to_sheet(d/*:RawData*/, opts)/*:Worksheet*/ {
3+
switch(opts.type) {
4+
case 'base64': return rtf_to_sheet_str(Base64.decode(d), opts);
5+
case 'binary': return rtf_to_sheet_str(d, opts);
6+
case 'buffer': return rtf_to_sheet_str(d.toString('binary'), opts);
7+
case 'array': return rtf_to_sheet_str(cc2str(d), opts);
8+
}
9+
throw new Error("Unrecognized type " + opts.type);
10+
}
11+
12+
function rtf_to_sheet_str(str/*:string*/, opts)/*:Worksheet*/ {
13+
throw new Error("Unsupported RTF");
14+
}
15+
16+
function rtf_to_workbook(d/*:RawData*/, opts)/*:Workbook*/ { return sheet_to_workbook(rtf_to_sheet(d, opts), opts); }
17+
function sheet_to_rtf() { throw new Error("Unsupported"); }
18+
19+
return {
20+
to_workbook: rtf_to_workbook,
21+
to_sheet: rtf_to_sheet,
22+
from_sheet: sheet_to_rtf
23+
};
24+
})();

bits/47_styxml.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,9 @@ function parse_fills(t, styles, themes, opts) {
7575
case '<fills': case '<fills>': case '</fills>': break;
7676

7777
/* 18.8.20 fill CT_Fill */
78-
case '<fill>': case '<fill': break;
79-
case '</fill>': styles.Fills.push(fill); fill = {}; break;
78+
case '<fill>': case '<fill': case '<fill/>':
79+
fill = {}; styles.Fills.push(fill); break;
80+
case '</fill>': break;
8081

8182
/* 18.8.24 gradientFill CT_GradientFill */
8283
case '<gradientFill>': break;

bits/48_stybin.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ var XLSBFillPTNames = [
102102
];
103103
var rev_XLSBFillPTNames/*:EvertNumType*/ = (evert(XLSBFillPTNames)/*:any*/);
104104
/* TODO: gradient fill representation */
105+
var parse_BrtFill = parsenoop;
105106
function write_BrtFill(fill, o) {
106107
if(!o) o = new_buf(4*3 + 8*7 + 16*1);
107108
var fls/*:number*/ = rev_XLSBFillPTNames[fill.patternType];
@@ -164,6 +165,7 @@ function write_Blxf(data, o) {
164165
return o;
165166
}
166167
/* [MS-XLSB] 2.4.299 BrtBorder TODO */
168+
var parse_BrtBorder = parsenoop;
167169
function write_BrtBorder(border, o) {
168170
if(!o) o = new_buf(51);
169171
o.write_shift(1, 0); /* diagonal */

0 commit comments

Comments
 (0)