Skip to content

Commit

Permalink
version bump 0.11.1: dist cleanup
Browse files Browse the repository at this point in the history
- 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
  • Loading branch information
SheetJSDev committed Aug 5, 2017
1 parent 0f39f28 commit 9358214
Show file tree
Hide file tree
Showing 59 changed files with 1,264 additions and 762 deletions.
1 change: 1 addition & 0 deletions .fossaignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
bits/
demos/
dist/
docbits/
misc/
node_modules/
Expand Down
10 changes: 5 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -50,17 +50,17 @@ init: ## Initial setup for development
git submodule foreach make
mkdir -p tmp

DISTHDR=misc/suppress_export.js
.PHONY: dist
dist: dist-deps $(TARGET) bower.json ## Prepare JS files for distribution
<$(TARGET) sed "s/require('stream')/{}/g;s/require('.*')/null/g" > dist/$(TARGET)
<$(TARGET) sed "s/require('stream')/{}/g;s/require('....*')/undefined/g" > dist/$(TARGET)
cp LICENSE dist/
uglifyjs dist/$(TARGET) $(UGLIFYOPTS) -o dist/$(LIB).min.js --source-map dist/$(LIB).min.map --preamble "$$(head -n 1 bits/00_header.js)"
uglifyjs $(DISTHDR) dist/$(TARGET) $(UGLIFYOPTS) -o dist/$(LIB).min.js --source-map dist/$(LIB).min.map --preamble "$$(head -n 1 bits/00_header.js)"
misc/strip_sourcemap.sh dist/$(LIB).min.js
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)"
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)"
misc/strip_sourcemap.sh dist/$(LIB).core.min.js
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)"
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)"
misc/strip_sourcemap.sh dist/$(LIB).full.min.js
cat <(head -n 1 bits/00_header.js) $(REQS) $(ADDONS) $(TARGET) $(AUXTARGETS) > demos/requirejs/$(LIB).full.js

.PHONY: dist-deps
dist-deps: ## Copy dependencies for distribution
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.0';
XLSX.version = '0.11.1';
2 changes: 1 addition & 1 deletion bits/20_jsutils.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ var basedate = new Date(1899, 11, 30, 0, 0, 0); // 2209161600000
var dnthresh = basedate.getTime() + (new Date().getTimezoneOffset() - basedate.getTimezoneOffset()) * 60000;
function datenum(v/*:Date*/, date1904/*:?boolean*/)/*:number*/ {
var epoch = v.getTime();
if(date1904) epoch += 1462*24*60*60*1000;
if(date1904) epoch -= 1462*24*60*60*1000;
return (epoch - dnthresh) / (24 * 60 * 60 * 1000);
}
function numdate(v/*:number*/)/*:Date*/ {
Expand Down
2 changes: 1 addition & 1 deletion bits/21_ziputils.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ if(typeof JSZip !== 'undefined') jszip = JSZip;
if (typeof exports !== 'undefined') {
if (typeof module !== 'undefined' && module.exports) {
if(typeof jszip === 'undefined') jszip = require('./jszip.js');
_fs = require('fs');
try { _fs = require('fs'); } catch(e) { }
}
}

Expand Down
6 changes: 3 additions & 3 deletions bits/38_xlstypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ function parse_VtStringBase(blob, stringType, pad) {
return parse_lpstr(blob, stringType, pad);
}

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

/* [MS-OSHARED] 2.3.3.1.9 VtVecUnalignedLpstrValue */
function parse_VtVecUnalignedLpstrValue(blob) {
Expand Down Expand Up @@ -123,7 +123,7 @@ function parse_TypedPropertyValue(blob, type/*:number*/, _opts) {
case 0x40 /*VT_FILETIME*/: return parse_FILETIME(blob);
case 0x41 /*VT_BLOB*/: return parse_BLOB(blob);
case 0x47 /*VT_CF*/: return parse_ClipboardData(blob);
case 0x50 /*VT_STRING*/: return parse_VtString(blob, t, !opts.raw && 4).replace(chr0,'');
case 0x50 /*VT_STRING*/: return parse_VtString(blob, t, !opts.raw).replace(chr0,'');
case 0x51 /*VT_USTR*/: return parse_VtUnalignedString(blob, t/*, 4*/).replace(chr0,'');
case 0x100C /*VT_VECTOR|VT_VARIANT*/: return parse_VtVecHeadingPair(blob);
case 0x101E /*VT_LPSTR*/: return parse_VtVecUnalignedLpstr(blob);
Expand Down
2 changes: 1 addition & 1 deletion bits/44_offcrypto.js
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ function parse_FilePassHeader(blob, length/*:number*/, oo) {
return o;
}
function parse_FilePass(blob, length/*:number*/, opts) {
var o = { Type: opts.biff >= 8 ? blob.read_shift(2) : 0 }; /* wEncryptionType */
var o = ({ Type: opts.biff >= 8 ? blob.read_shift(2) : 0 }/*:any*/); /* wEncryptionType */
if(o.Type) parse_FilePassHeader(blob, length-2, o);
else parse_XORObfuscation(blob, length-2, opts, o);
return o;
Expand Down
24 changes: 24 additions & 0 deletions bits/45_rtf.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
var RTF = (function() {
function rtf_to_sheet(d/*:RawData*/, opts)/*:Worksheet*/ {
switch(opts.type) {
case 'base64': return rtf_to_sheet_str(Base64.decode(d), opts);
case 'binary': return rtf_to_sheet_str(d, opts);
case 'buffer': return rtf_to_sheet_str(d.toString('binary'), opts);
case 'array': return rtf_to_sheet_str(cc2str(d), opts);
}
throw new Error("Unrecognized type " + opts.type);
}

function rtf_to_sheet_str(str/*:string*/, opts)/*:Worksheet*/ {
throw new Error("Unsupported RTF");
}

function rtf_to_workbook(d/*:RawData*/, opts)/*:Workbook*/ { return sheet_to_workbook(rtf_to_sheet(d, opts), opts); }
function sheet_to_rtf() { throw new Error("Unsupported"); }

return {
to_workbook: rtf_to_workbook,
to_sheet: rtf_to_sheet,
from_sheet: sheet_to_rtf
};
})();
5 changes: 3 additions & 2 deletions bits/47_styxml.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,9 @@ function parse_fills(t, styles, themes, opts) {
case '<fills': case '<fills>': case '</fills>': break;

/* 18.8.20 fill CT_Fill */
case '<fill>': case '<fill': break;
case '</fill>': styles.Fills.push(fill); fill = {}; break;
case '<fill>': case '<fill': case '<fill/>':
fill = {}; styles.Fills.push(fill); break;
case '</fill>': break;

/* 18.8.24 gradientFill CT_GradientFill */
case '<gradientFill>': break;
Expand Down
2 changes: 2 additions & 0 deletions bits/48_stybin.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ var XLSBFillPTNames = [
];
var rev_XLSBFillPTNames/*:EvertNumType*/ = (evert(XLSBFillPTNames)/*:any*/);
/* TODO: gradient fill representation */
var parse_BrtFill = parsenoop;
function write_BrtFill(fill, o) {
if(!o) o = new_buf(4*3 + 8*7 + 16*1);
var fls/*:number*/ = rev_XLSBFillPTNames[fill.patternType];
Expand Down Expand Up @@ -164,6 +165,7 @@ function write_Blxf(data, o) {
return o;
}
/* [MS-XLSB] 2.4.299 BrtBorder TODO */
var parse_BrtBorder = parsenoop;
function write_BrtBorder(border, o) {
if(!o) o = new_buf(51);
o.write_shift(1, 0); /* diagonal */
Expand Down
10 changes: 9 additions & 1 deletion bits/62_fxls.js
Original file line number Diff line number Diff line change
Expand Up @@ -690,9 +690,17 @@ var PtgBinOp = {
PtgPower: "^",
PtgSub: "-"
};
function get_ixti(supbooks, ixti/*:number*/, opts)/*:string*/ {
function formula_quote_sheet_name(sname/*:string*/)/*:string*/ {
if(!sname) return "";
if(sname.indexOf(" ") > -1) return "'" + sname + "'";
return sname;
}
function get_ixti_raw(supbooks, ixti/*:number*/, opts)/*:string*/ {
return supbooks.SheetNames[ixti];
}
function get_ixti(supbooks, ixti/*:number*/, opts)/*:string*/ {
return formula_quote_sheet_name(get_ixti_raw(supbooks, ixti, opts));
}
function stringify_formula(formula/*Array<any>*/, range, cell/*:any*/, supbooks, opts) {
//console.log(formula);
var _range = /*range != null ? range :*/ {s:{c:0, r:0},e:{c:0, r:0}};
Expand Down
7 changes: 4 additions & 3 deletions bits/66_wscommon.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ function get_cell_style(styles, cell, opts) {
return len;
}

function safe_format(p, fmtid/*:number*/, fillid/*:number*/, opts, themes, styles) {
function safe_format(p, fmtid/*:number*/, fillid/*:?number*/, opts, themes, styles) {
if(p.t === 'z') return;
if(p.t === 'd' && typeof p.v === 'string') p.v = parseDate(p.v);
try {
Expand All @@ -84,7 +84,8 @@ function safe_format(p, fmtid/*:number*/, fillid/*:number*/, opts, themes, style
else if(p.t === 'd') p.w = SSF.format(fmtid,datenum(p.v),_ssfopts);
else p.w = SSF.format(fmtid,p.v,_ssfopts);
} catch(e) { if(opts.WTF) throw e; }
if(fillid) try {
if(!opts.cellStyles) return;
if(fillid != null) try {
p.s = styles.Fills[fillid];
if (p.s.fgColor && p.s.fgColor.theme && !p.s.fgColor.rgb) {
p.s.fgColor.rgb = rgb_tint(themes.themeElements.clrScheme[p.s.fgColor.theme].rgb, p.s.fgColor.tint || 0);
Expand All @@ -94,5 +95,5 @@ function safe_format(p, fmtid/*:number*/, fillid/*:number*/, opts, themes, style
p.s.bgColor.rgb = rgb_tint(themes.themeElements.clrScheme[p.s.bgColor.theme].rgb, p.s.bgColor.tint || 0);
if(opts.WTF) p.s.bgColor.raw_rgb = themes.themeElements.clrScheme[p.s.bgColor.theme].rgb;
}
} catch(e) { if(opts.WTF) throw e; }
} catch(e) { if(opts.WTF && styles.Fills) throw e; }
}
6 changes: 4 additions & 2 deletions bits/75_xlml.js
Original file line number Diff line number Diff line change
Expand Up @@ -817,12 +817,14 @@ function parse_xlml_xml(d, _opts)/*:Workbook*/ {
return out;
}

function parse_xlml(data/*:RawBytes*/, opts)/*:Workbook*/ {
function arr2str(data/*:any*/)/*:string*/ { return data.map(_chr).join(""); }

function parse_xlml(data/*:RawBytes|string*/, opts)/*:Workbook*/ {
fix_read_opts(opts=opts||{});
switch(opts.type||"base64") {
case "base64": return parse_xlml_xml(Base64.decode(data), opts);
case "binary": case "buffer": case "file": return parse_xlml_xml(data, opts);
case "array": return parse_xlml_xml(data.map(_chr).join(""), opts);
case "array": return parse_xlml_xml(arr2str(data), opts);
}
/*:: throw new Error("unsupported type " + opts.type); */
}
Expand Down
4 changes: 2 additions & 2 deletions bits/77_parsetab.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ var XLSBRecordEnum = {
/*::[*/0x002A/*::]*/: { n:"BrtIndexBlock", f:parsenoop },
/*::[*/0x002B/*::]*/: { n:"BrtFont", f:parse_BrtFont },
/*::[*/0x002C/*::]*/: { n:"BrtFmt", f:parse_BrtFmt },
/*::[*/0x002D/*::]*/: { n:"BrtFill", f:parsenoop },
/*::[*/0x002E/*::]*/: { n:"BrtBorder", f:parsenoop },
/*::[*/0x002D/*::]*/: { n:"BrtFill", f:parse_BrtFill },
/*::[*/0x002E/*::]*/: { n:"BrtBorder", f:parse_BrtBorder },
/*::[*/0x002F/*::]*/: { n:"BrtXF", f:parse_BrtXF },
/*::[*/0x0030/*::]*/: { n:"BrtStyle", f:parsenoop },
/*::[*/0x0031/*::]*/: { n:"BrtCellMeta", f:parsenoop },
Expand Down
6 changes: 3 additions & 3 deletions bits/79_html.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ var HTML_ = (function() {
var opts = _opts || {};
if(DENSE != null && opts.dense == null) opts.dense = DENSE;
var ws/*:Worksheet*/ = opts.dense ? ([]/*:any*/) : ({}/*:any*/);
var mtch = str.match(/<table/i);
var mtch/*:any*/ = str.match(/<table/i);
if(!mtch) throw new Error("Invalid HTML: could not find <table>");
var mtch2 = str.match(/<\/table/i);
var i = mtch.index, j = mtch2 && mtch2.index || str.length;
var mtch2/*:any*/ = str.match(/<\/table/i);
var i/*:number*/ = mtch.index, j/*:number*/ = mtch2 && mtch2.index || str.length;
var rows = str.slice(i, j).split(/(:?<tr[^>]*>)/i);
var R = -1, C = 0, RS = 0, CS = 0;
var range = {s:{r:10000000, c:10000000},e:{r:0,c:0}};
Expand Down
1 change: 1 addition & 0 deletions bits/82_sheeter.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ var write_csv_str = write_obj_str({from_sheet:sheet_to_csv});
var write_slk_str = write_obj_str(SYLK);
var write_dif_str = write_obj_str(DIF);
var write_prn_str = write_obj_str(PRN);
var write_rtf_str = write_obj_str(RTF);
var write_txt_str = write_obj_str({from_sheet:sheet_to_txt});
2 changes: 1 addition & 1 deletion bits/87_read.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ function readSync(data/*:RawData*/, opts/*:?ParseOpts*/)/*:Workbook*/ {
case 0xFF: if(n[1] == 0xFE){ return read_utf16(d, o); } break;
case 0x00: if(n[1] == 0x00 && n[2] >= 0x02 && n[3] == 0x00) return WK_.to_workbook(d, o); break;
case 0x03: case 0x83: case 0x8B: return DBF.to_workbook(d, o);
case 0x7B: if(n[1] == 0x5C && n[2] == 0x72 && n[3] == 0x74) throw new Error("Unsupported RTF"); break;
case 0x7B: if(n[1] == 0x5C && n[2] == 0x72 && n[3] == 0x74) return RTF.to_workbook(d, o); break;
case 0x0A: case 0x0D: case 0x20: return read_plaintext_raw(d, o);
}
if(n[2] <= 12 && n[3] <= 31) return DBF.to_workbook(d, o);
Expand Down
2 changes: 2 additions & 0 deletions bits/88_write.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ function writeSync(wb/*:Workbook*/, opts/*:?WriteOpts*/) {
case 'csv': return write_string_type(write_csv_str(wb, o), o);
case 'dif': return write_string_type(write_dif_str(wb, o), o);
case 'prn': return write_string_type(write_prn_str(wb, o), o);
case 'rtf': return write_string_type(write_rtf_str(wb, o), o);
case 'fods': return write_string_type(write_ods(wb, o), o);
case 'biff2': return write_binary_type(write_biff_buf(wb, o), o);
case 'xlsx':
Expand All @@ -95,6 +96,7 @@ function resolve_book_type(o/*?WriteFileOpts*/) {
case '.txt': o.bookType = 'txt'; break;
case '.dif': o.bookType = 'dif'; break;
case '.prn': o.bookType = 'prn'; break;
case '.rtf': o.bookType = 'rtf'; break;
case '.slk': o.bookType = 'sylk'; break;
case '.htm': o.bookType = 'html'; break;
}
Expand Down
8 changes: 4 additions & 4 deletions bits/90_utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,11 @@ function sheet_to_csv(sheet/*:Worksheet*/, opts/*:?Sheet2CSVOpts*/)/*:string*/ {
var endregex = new RegExp((FS=="|" ? "\\|" : FS)+"+$");
var row = "", cols = [];
o.dense = Array.isArray(sheet);
var colInfos = o.skipHidden ? sheet["!cols"] : undefined;
var rowInfos = o.skipHidden ? sheet["!rows"] : undefined;
for(var C = r.s.c; C <= r.e.c; ++C) if (!colInfos || !colInfos[C] || !colInfos[C].hidden) cols[C] = encode_col(C);
var colInfos = o.skipHidden && sheet["!cols"] || [];
var rowInfos = o.skipHidden && sheet["!rows"] || [];
for(var C = r.s.c; C <= r.e.c; ++C) if (!((colInfos[C]||{}).hidden)) cols[C] = encode_col(C);
for(var R = r.s.r; R <= r.e.r; ++R) {
if (rowInfos && rowInfos[R] && rowInfos[R].hidden) continue;
if ((rowInfos[R]||{}).hidden) continue;
row = make_csv_row(sheet, r, R, cols, fs, rs, FS, o);
if(row == null) { continue; }
if(o.strip) row = row.replace(endregex,"");
Expand Down
7 changes: 5 additions & 2 deletions bits/97_node.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,16 @@ if(has_buf && typeof require != 'undefined') (function() {
var endregex = new RegExp((FS=="|" ? "\\|" : FS)+"+$");
var row/*:?string*/ = "", cols = [];
o.dense = Array.isArray(sheet);
for(var C = r.s.c; C <= r.e.c; ++C) cols[C] = encode_col(C);
var colInfos = o.skipHidden && sheet["!cols"] || [];
var rowInfos = o.skipHidden && sheet["!rows"] || [];
for(var C = r.s.c; C <= r.e.c; ++C) if (!((colInfos[C]||{}).hidden)) cols[C] = encode_col(C);
var R = r.s.r;
stream._read = function() {
if(R > r.e.r) return stream.push(null);
while(R <= r.e.r) {
row = make_csv_row(sheet, r, R, cols, fs, rs, FS, o);
++R;
if ((rowInfos[R-1]||{}).hidden) continue;
row = make_csv_row(sheet, r, R-1, cols, fs, rs, FS, o);
if(row != null) {
if(o.strip) row = row.replace(endregex,"");
stream.push(row + RS);
Expand Down
1 change: 1 addition & 0 deletions demos/requirejs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ all: $(TOOL).js
$(TOOL).js:
if [ ! -e require.js ]; then curl -O http://requirejs.org/docs/release/2.3.3/comments/require.js; fi
if [ ! -e r.js ]; then curl -O http://requirejs.org/docs/release/2.3.3/r.js; fi
rm -f xlsx.full.min.js; ln -s ../../dist/xlsx.full.min.js
node r.js -o build.js
11 changes: 11 additions & 0 deletions demos/requirejs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# RequireJS

The minified dist files trip up the RequireJS mechanism. To bypass, the scripts
automatically expose an `XLSX` variable that can be used if the require callback
argument is `_XLSX` rather than `XLSX`:

```js
require(["xlsx.full.min"], function(_XLSX) { /* ... */ });
```

This demo uses the `r.js` optimizer to build a source file.
55 changes: 55 additions & 0 deletions demos/requirejs/requirejs.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<!DOCTYPE html>
<!-- xlsx.js (C) 2013-present SheetJS http://sheetjs.com -->
<!-- vim: set ts=2: -->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>JS-XLSX Live Demo</title>
<style>
#drop{
border:2px dashed #bbb;
-moz-border-radius:5px;
-webkit-border-radius:5px;
border-radius:5px;
padding:25px;
text-align:center;
font:20pt bold,"Vollkorn";color:#bbb
}
#b64data{
width:100%;
}
</style>
</head>
<body>
<b>JS-XLSX Live Demo</b><br />
Output Format:
<select name="format">
<option value="csv" selected> CSV</option>
<option value="json"> JSON</option>
<option value="form"> FORMULAE</option>
</select><br />

<div id="drop">Drop a spreadsheet file here to see sheet data</div>
<p><input type="file" name="xlfile" id="xlf" /> ... or click here to select a file</p>
<textarea id="b64data">... or paste a base64-encoding here</textarea>
<input type="button" id="dotext" value="Click here to process the base64 text" onclick="b64it();"/><br />
Advanced Demo Options: <br />
Use Web Workers: (when available) <input type="checkbox" name="useworker" checked><br />
Use Transferrables: (when available) <input type="checkbox" name="xferable" checked><br />
Use readAsBinaryString: (when available) <input type="checkbox" name="userabs" checked><br />
<pre id="out"></pre>
<br />
<script src="require.js"></script>
<script>
var XW = {
/* worker message */
msg: 'xlsx',
/* worker scripts */
rABS: './xlsxworker2.js',
norABS: './xlsxworker1.js',
noxfer: './xlsxworker.js'
};
</script>
<script src="requirejs-built.js"></script>
</body>
</html>
2 changes: 1 addition & 1 deletion demos/requirejs/requirejs.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require(["xlsx.full"], function(_XLSX) {
require(["xlsx.full.min"], function(_XLSX) {
var X = XLSX;

var rABS = typeof FileReader !== "undefined" && typeof FileReader.prototype !== "undefined" && typeof FileReader.prototype.readAsBinaryString !== "undefined";
Expand Down
1 change: 1 addition & 0 deletions demos/webpack/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
webpack.js
webpack.min.js
*.out.js
9 changes: 7 additions & 2 deletions demos/webpack/Makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
TOOL=webpack
WPOPTS=--display-modules --display-reasons --profile
.PHONY: all
all: $(TOOL).min.js
all: $(TOOL).min.js core.out.js full.out.js

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

.PHONY: $(TOOL).js
$(TOOL).js:
webpack main.js --output-filename $@ --display-modules --profile
webpack main.js --output-filename $@ $(WPOPTS)

.PHONY: core.out.js full.out.js
core.out.js full.out.js: %.out.js: %.js
webpack $< --output-filename $@ $(WPOPTS)
Loading

0 comments on commit 9358214

Please sign in to comment.