-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add SINGLE_FILE option to embed all subresources into emitted JS (#5296)
As discussed in #5279, subresource paths are converted into base64 data URIs.
- Loading branch information
Showing
12 changed files
with
508 additions
and
187 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// All functions here should be maybeExported from jsifier.js | ||
|
||
/** @type {function(string, boolean=, number=)} */ | ||
function intArrayFromString(stringy, dontAddNull, length) { | ||
var len = length > 0 ? length : lengthBytesUTF8(stringy)+1; | ||
var u8array = new Array(len); | ||
var numBytesWritten = stringToUTF8Array(stringy, u8array, 0, u8array.length); | ||
if (dontAddNull) u8array.length = numBytesWritten; | ||
return u8array; | ||
} | ||
|
||
// Temporarily duplicating function pending Python preprocessor support | ||
var ASSERTIONS; | ||
var intArrayToString = ASSERTIONS ? | ||
function (array) { | ||
var ret = []; | ||
for (var i = 0; i < array.length; i++) { | ||
var chr = array[i]; | ||
if (chr > 0xFF) { | ||
assert(false, 'Character code ' + chr + ' (' + String.fromCharCode(chr) + ') at offset ' + i + ' not in 0x00-0xFF.'); | ||
chr &= 0xFF; | ||
} | ||
ret.push(String.fromCharCode(chr)); | ||
} | ||
return ret.join(''); | ||
} : | ||
function (array) { | ||
var ret = []; | ||
for (var i = 0; i < array.length; i++) { | ||
var chr = array[i]; | ||
if (chr > 0xFF) { | ||
chr &= 0xFF; | ||
} | ||
ret.push(String.fromCharCode(chr)); | ||
} | ||
return ret.join(''); | ||
} | ||
; |
Oops, something went wrong.