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

Some content is hidden

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

59 files changed

+1264
-762
lines changed

.fossaignore

+1
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

+5-5
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

+1-1
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

+1-1
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

+1-1
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

+3-3
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

+1-1
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

+24
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

+3-2
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

+2
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 */

bits/62_fxls.js

+9-1
Original file line numberDiff line numberDiff line change
@@ -690,9 +690,17 @@ var PtgBinOp = {
690690
PtgPower: "^",
691691
PtgSub: "-"
692692
};
693-
function get_ixti(supbooks, ixti/*:number*/, opts)/*:string*/ {
693+
function formula_quote_sheet_name(sname/*:string*/)/*:string*/ {
694+
if(!sname) return "";
695+
if(sname.indexOf(" ") > -1) return "'" + sname + "'";
696+
return sname;
697+
}
698+
function get_ixti_raw(supbooks, ixti/*:number*/, opts)/*:string*/ {
694699
return supbooks.SheetNames[ixti];
695700
}
701+
function get_ixti(supbooks, ixti/*:number*/, opts)/*:string*/ {
702+
return formula_quote_sheet_name(get_ixti_raw(supbooks, ixti, opts));
703+
}
696704
function stringify_formula(formula/*Array<any>*/, range, cell/*:any*/, supbooks, opts) {
697705
//console.log(formula);
698706
var _range = /*range != null ? range :*/ {s:{c:0, r:0},e:{c:0, r:0}};

bits/66_wscommon.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ function get_cell_style(styles, cell, opts) {
6060
return len;
6161
}
6262

63-
function safe_format(p, fmtid/*:number*/, fillid/*:number*/, opts, themes, styles) {
63+
function safe_format(p, fmtid/*:number*/, fillid/*:?number*/, opts, themes, styles) {
6464
if(p.t === 'z') return;
6565
if(p.t === 'd' && typeof p.v === 'string') p.v = parseDate(p.v);
6666
try {
@@ -84,7 +84,8 @@ function safe_format(p, fmtid/*:number*/, fillid/*:number*/, opts, themes, style
8484
else if(p.t === 'd') p.w = SSF.format(fmtid,datenum(p.v),_ssfopts);
8585
else p.w = SSF.format(fmtid,p.v,_ssfopts);
8686
} catch(e) { if(opts.WTF) throw e; }
87-
if(fillid) try {
87+
if(!opts.cellStyles) return;
88+
if(fillid != null) try {
8889
p.s = styles.Fills[fillid];
8990
if (p.s.fgColor && p.s.fgColor.theme && !p.s.fgColor.rgb) {
9091
p.s.fgColor.rgb = rgb_tint(themes.themeElements.clrScheme[p.s.fgColor.theme].rgb, p.s.fgColor.tint || 0);
@@ -94,5 +95,5 @@ function safe_format(p, fmtid/*:number*/, fillid/*:number*/, opts, themes, style
9495
p.s.bgColor.rgb = rgb_tint(themes.themeElements.clrScheme[p.s.bgColor.theme].rgb, p.s.bgColor.tint || 0);
9596
if(opts.WTF) p.s.bgColor.raw_rgb = themes.themeElements.clrScheme[p.s.bgColor.theme].rgb;
9697
}
97-
} catch(e) { if(opts.WTF) throw e; }
98+
} catch(e) { if(opts.WTF && styles.Fills) throw e; }
9899
}

bits/75_xlml.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -817,12 +817,14 @@ function parse_xlml_xml(d, _opts)/*:Workbook*/ {
817817
return out;
818818
}
819819

820-
function parse_xlml(data/*:RawBytes*/, opts)/*:Workbook*/ {
820+
function arr2str(data/*:any*/)/*:string*/ { return data.map(_chr).join(""); }
821+
822+
function parse_xlml(data/*:RawBytes|string*/, opts)/*:Workbook*/ {
821823
fix_read_opts(opts=opts||{});
822824
switch(opts.type||"base64") {
823825
case "base64": return parse_xlml_xml(Base64.decode(data), opts);
824826
case "binary": case "buffer": case "file": return parse_xlml_xml(data, opts);
825-
case "array": return parse_xlml_xml(data.map(_chr).join(""), opts);
827+
case "array": return parse_xlml_xml(arr2str(data), opts);
826828
}
827829
/*:: throw new Error("unsupported type " + opts.type); */
828830
}

bits/77_parsetab.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ var XLSBRecordEnum = {
3838
/*::[*/0x002A/*::]*/: { n:"BrtIndexBlock", f:parsenoop },
3939
/*::[*/0x002B/*::]*/: { n:"BrtFont", f:parse_BrtFont },
4040
/*::[*/0x002C/*::]*/: { n:"BrtFmt", f:parse_BrtFmt },
41-
/*::[*/0x002D/*::]*/: { n:"BrtFill", f:parsenoop },
42-
/*::[*/0x002E/*::]*/: { n:"BrtBorder", f:parsenoop },
41+
/*::[*/0x002D/*::]*/: { n:"BrtFill", f:parse_BrtFill },
42+
/*::[*/0x002E/*::]*/: { n:"BrtBorder", f:parse_BrtBorder },
4343
/*::[*/0x002F/*::]*/: { n:"BrtXF", f:parse_BrtXF },
4444
/*::[*/0x0030/*::]*/: { n:"BrtStyle", f:parsenoop },
4545
/*::[*/0x0031/*::]*/: { n:"BrtCellMeta", f:parsenoop },

bits/79_html.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ var HTML_ = (function() {
44
var opts = _opts || {};
55
if(DENSE != null && opts.dense == null) opts.dense = DENSE;
66
var ws/*:Worksheet*/ = opts.dense ? ([]/*:any*/) : ({}/*:any*/);
7-
var mtch = str.match(/<table/i);
7+
var mtch/*:any*/ = str.match(/<table/i);
88
if(!mtch) throw new Error("Invalid HTML: could not find <table>");
9-
var mtch2 = str.match(/<\/table/i);
10-
var i = mtch.index, j = mtch2 && mtch2.index || str.length;
9+
var mtch2/*:any*/ = str.match(/<\/table/i);
10+
var i/*:number*/ = mtch.index, j/*:number*/ = mtch2 && mtch2.index || str.length;
1111
var rows = str.slice(i, j).split(/(:?<tr[^>]*>)/i);
1212
var R = -1, C = 0, RS = 0, CS = 0;
1313
var range = {s:{r:10000000, c:10000000},e:{r:0,c:0}};

bits/82_sheeter.js

+1
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,5 @@ var write_csv_str = write_obj_str({from_sheet:sheet_to_csv});
1313
var write_slk_str = write_obj_str(SYLK);
1414
var write_dif_str = write_obj_str(DIF);
1515
var write_prn_str = write_obj_str(PRN);
16+
var write_rtf_str = write_obj_str(RTF);
1617
var write_txt_str = write_obj_str({from_sheet:sheet_to_txt});

bits/87_read.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ function readSync(data/*:RawData*/, opts/*:?ParseOpts*/)/*:Workbook*/ {
7878
case 0xFF: if(n[1] == 0xFE){ return read_utf16(d, o); } break;
7979
case 0x00: if(n[1] == 0x00 && n[2] >= 0x02 && n[3] == 0x00) return WK_.to_workbook(d, o); break;
8080
case 0x03: case 0x83: case 0x8B: return DBF.to_workbook(d, o);
81-
case 0x7B: if(n[1] == 0x5C && n[2] == 0x72 && n[3] == 0x74) throw new Error("Unsupported RTF"); break;
81+
case 0x7B: if(n[1] == 0x5C && n[2] == 0x72 && n[3] == 0x74) return RTF.to_workbook(d, o); break;
8282
case 0x0A: case 0x0D: case 0x20: return read_plaintext_raw(d, o);
8383
}
8484
if(n[2] <= 12 && n[3] <= 31) return DBF.to_workbook(d, o);

bits/88_write.js

+2
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ function writeSync(wb/*:Workbook*/, opts/*:?WriteOpts*/) {
6969
case 'csv': return write_string_type(write_csv_str(wb, o), o);
7070
case 'dif': return write_string_type(write_dif_str(wb, o), o);
7171
case 'prn': return write_string_type(write_prn_str(wb, o), o);
72+
case 'rtf': return write_string_type(write_rtf_str(wb, o), o);
7273
case 'fods': return write_string_type(write_ods(wb, o), o);
7374
case 'biff2': return write_binary_type(write_biff_buf(wb, o), o);
7475
case 'xlsx':
@@ -95,6 +96,7 @@ function resolve_book_type(o/*?WriteFileOpts*/) {
9596
case '.txt': o.bookType = 'txt'; break;
9697
case '.dif': o.bookType = 'dif'; break;
9798
case '.prn': o.bookType = 'prn'; break;
99+
case '.rtf': o.bookType = 'rtf'; break;
98100
case '.slk': o.bookType = 'sylk'; break;
99101
case '.htm': o.bookType = 'html'; break;
100102
}

bits/90_utils.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -112,11 +112,11 @@ function sheet_to_csv(sheet/*:Worksheet*/, opts/*:?Sheet2CSVOpts*/)/*:string*/ {
112112
var endregex = new RegExp((FS=="|" ? "\\|" : FS)+"+$");
113113
var row = "", cols = [];
114114
o.dense = Array.isArray(sheet);
115-
var colInfos = o.skipHidden ? sheet["!cols"] : undefined;
116-
var rowInfos = o.skipHidden ? sheet["!rows"] : undefined;
117-
for(var C = r.s.c; C <= r.e.c; ++C) if (!colInfos || !colInfos[C] || !colInfos[C].hidden) cols[C] = encode_col(C);
115+
var colInfos = o.skipHidden && sheet["!cols"] || [];
116+
var rowInfos = o.skipHidden && sheet["!rows"] || [];
117+
for(var C = r.s.c; C <= r.e.c; ++C) if (!((colInfos[C]||{}).hidden)) cols[C] = encode_col(C);
118118
for(var R = r.s.r; R <= r.e.r; ++R) {
119-
if (rowInfos && rowInfos[R] && rowInfos[R].hidden) continue;
119+
if ((rowInfos[R]||{}).hidden) continue;
120120
row = make_csv_row(sheet, r, R, cols, fs, rs, FS, o);
121121
if(row == null) { continue; }
122122
if(o.strip) row = row.replace(endregex,"");

bits/97_node.js

+5-2
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,16 @@ if(has_buf && typeof require != 'undefined') (function() {
1212
var endregex = new RegExp((FS=="|" ? "\\|" : FS)+"+$");
1313
var row/*:?string*/ = "", cols = [];
1414
o.dense = Array.isArray(sheet);
15-
for(var C = r.s.c; C <= r.e.c; ++C) cols[C] = encode_col(C);
15+
var colInfos = o.skipHidden && sheet["!cols"] || [];
16+
var rowInfos = o.skipHidden && sheet["!rows"] || [];
17+
for(var C = r.s.c; C <= r.e.c; ++C) if (!((colInfos[C]||{}).hidden)) cols[C] = encode_col(C);
1618
var R = r.s.r;
1719
stream._read = function() {
1820
if(R > r.e.r) return stream.push(null);
1921
while(R <= r.e.r) {
20-
row = make_csv_row(sheet, r, R, cols, fs, rs, FS, o);
2122
++R;
23+
if ((rowInfos[R-1]||{}).hidden) continue;
24+
row = make_csv_row(sheet, r, R-1, cols, fs, rs, FS, o);
2225
if(row != null) {
2326
if(o.strip) row = row.replace(endregex,"");
2427
stream.push(row + RS);

demos/requirejs/Makefile

+1
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,5 @@ all: $(TOOL).js
66
$(TOOL).js:
77
if [ ! -e require.js ]; then curl -O http://requirejs.org/docs/release/2.3.3/comments/require.js; fi
88
if [ ! -e r.js ]; then curl -O http://requirejs.org/docs/release/2.3.3/r.js; fi
9+
rm -f xlsx.full.min.js; ln -s ../../dist/xlsx.full.min.js
910
node r.js -o build.js

demos/requirejs/README.md

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# RequireJS
2+
3+
The minified dist files trip up the RequireJS mechanism. To bypass, the scripts
4+
automatically expose an `XLSX` variable that can be used if the require callback
5+
argument is `_XLSX` rather than `XLSX`:
6+
7+
```js
8+
require(["xlsx.full.min"], function(_XLSX) { /* ... */ });
9+
```
10+
11+
This demo uses the `r.js` optimizer to build a source file.

demos/requirejs/requirejs.html

+55
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
<!DOCTYPE html>
2+
<!-- xlsx.js (C) 2013-present SheetJS http://sheetjs.com -->
3+
<!-- vim: set ts=2: -->
4+
<html>
5+
<head>
6+
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
7+
<title>JS-XLSX Live Demo</title>
8+
<style>
9+
#drop{
10+
border:2px dashed #bbb;
11+
-moz-border-radius:5px;
12+
-webkit-border-radius:5px;
13+
border-radius:5px;
14+
padding:25px;
15+
text-align:center;
16+
font:20pt bold,"Vollkorn";color:#bbb
17+
}
18+
#b64data{
19+
width:100%;
20+
}
21+
</style>
22+
</head>
23+
<body>
24+
<b>JS-XLSX Live Demo</b><br />
25+
Output Format:
26+
<select name="format">
27+
<option value="csv" selected> CSV</option>
28+
<option value="json"> JSON</option>
29+
<option value="form"> FORMULAE</option>
30+
</select><br />
31+
32+
<div id="drop">Drop a spreadsheet file here to see sheet data</div>
33+
<p><input type="file" name="xlfile" id="xlf" /> ... or click here to select a file</p>
34+
<textarea id="b64data">... or paste a base64-encoding here</textarea>
35+
<input type="button" id="dotext" value="Click here to process the base64 text" onclick="b64it();"/><br />
36+
Advanced Demo Options: <br />
37+
Use Web Workers: (when available) <input type="checkbox" name="useworker" checked><br />
38+
Use Transferrables: (when available) <input type="checkbox" name="xferable" checked><br />
39+
Use readAsBinaryString: (when available) <input type="checkbox" name="userabs" checked><br />
40+
<pre id="out"></pre>
41+
<br />
42+
<script src="require.js"></script>
43+
<script>
44+
var XW = {
45+
/* worker message */
46+
msg: 'xlsx',
47+
/* worker scripts */
48+
rABS: './xlsxworker2.js',
49+
norABS: './xlsxworker1.js',
50+
noxfer: './xlsxworker.js'
51+
};
52+
</script>
53+
<script src="requirejs-built.js"></script>
54+
</body>
55+
</html>

demos/requirejs/requirejs.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
require(["xlsx.full"], function(_XLSX) {
1+
require(["xlsx.full.min"], function(_XLSX) {
22
var X = XLSX;
33

44
var rABS = typeof FileReader !== "undefined" && typeof FileReader.prototype !== "undefined" && typeof FileReader.prototype.readAsBinaryString !== "undefined";

demos/webpack/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
webpack.js
22
webpack.min.js
3+
*.out.js

demos/webpack/Makefile

+7-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
11
TOOL=webpack
2+
WPOPTS=--display-modules --display-reasons --profile
23
.PHONY: all
3-
all: $(TOOL).min.js
4+
all: $(TOOL).min.js core.out.js full.out.js
45

56
$(TOOL).min.js: $(TOOL).js
67
uglifyjs $< > $@
78

89
.PHONY: $(TOOL).js
910
$(TOOL).js:
10-
webpack main.js --output-filename $@ --display-modules --profile
11+
webpack main.js --output-filename $@ $(WPOPTS)
12+
13+
.PHONY: core.out.js full.out.js
14+
core.out.js full.out.js: %.out.js: %.js
15+
webpack $< --output-filename $@ $(WPOPTS)

0 commit comments

Comments
 (0)