mirror of
https://github.com/S2-/minifyfromhtml.git
synced 2025-08-03 12:20:04 +02:00
update packages to latest version
This commit is contained in:
51
node_modules/iconv-lite/lib/index.js
generated
vendored
51
node_modules/iconv-lite/lib/index.js
generated
vendored
@@ -1,7 +1,5 @@
|
||||
"use strict";
|
||||
|
||||
// Some environments don't have global Buffer (e.g. React Native).
|
||||
// Solution would be installing npm modules "buffer" and "stream" explicitly.
|
||||
var Buffer = require("safer-buffer").Buffer;
|
||||
|
||||
var bomHandling = require("./bom-handling"),
|
||||
@@ -133,21 +131,50 @@ iconv.getDecoder = function getDecoder(encoding, options) {
|
||||
return decoder;
|
||||
}
|
||||
|
||||
// Streaming API
|
||||
// NOTE: Streaming API naturally depends on 'stream' module from Node.js. Unfortunately in browser environments this module can add
|
||||
// up to 100Kb to the output bundle. To avoid unnecessary code bloat, we don't enable Streaming API in browser by default.
|
||||
// If you would like to enable it explicitly, please add the following code to your app:
|
||||
// > iconv.enableStreamingAPI(require('stream'));
|
||||
iconv.enableStreamingAPI = function enableStreamingAPI(stream_module) {
|
||||
if (iconv.supportsStreams)
|
||||
return;
|
||||
|
||||
// Load extensions in Node. All of them are omitted in Browserify build via 'browser' field in package.json.
|
||||
var nodeVer = typeof process !== 'undefined' && process.versions && process.versions.node;
|
||||
if (nodeVer) {
|
||||
// Dependency-inject stream module to create IconvLite stream classes.
|
||||
var streams = require("./streams")(stream_module);
|
||||
|
||||
// Load streaming support in Node v0.10+
|
||||
var nodeVerArr = nodeVer.split(".").map(Number);
|
||||
if (nodeVerArr[0] > 0 || nodeVerArr[1] >= 10) {
|
||||
require("./streams")(iconv);
|
||||
// Not public API yet, but expose the stream classes.
|
||||
iconv.IconvLiteEncoderStream = streams.IconvLiteEncoderStream;
|
||||
iconv.IconvLiteDecoderStream = streams.IconvLiteDecoderStream;
|
||||
|
||||
// Streaming API.
|
||||
iconv.encodeStream = function encodeStream(encoding, options) {
|
||||
return new iconv.IconvLiteEncoderStream(iconv.getEncoder(encoding, options), options);
|
||||
}
|
||||
|
||||
// Load Node primitive extensions.
|
||||
require("./extend-node")(iconv);
|
||||
iconv.decodeStream = function decodeStream(encoding, options) {
|
||||
return new iconv.IconvLiteDecoderStream(iconv.getDecoder(encoding, options), options);
|
||||
}
|
||||
|
||||
iconv.supportsStreams = true;
|
||||
}
|
||||
|
||||
// Enable Streaming API automatically if 'stream' module is available and non-empty (the majority of environments).
|
||||
var stream_module;
|
||||
try {
|
||||
stream_module = require("stream");
|
||||
} catch (e) {}
|
||||
|
||||
if (stream_module && stream_module.Transform) {
|
||||
iconv.enableStreamingAPI(stream_module);
|
||||
|
||||
} else {
|
||||
// In rare cases where 'stream' module is not available by default, throw a helpful exception.
|
||||
iconv.encodeStream = iconv.decodeStream = function() {
|
||||
throw new Error("iconv-lite Streaming API is not enabled. Use iconv.enableStreamingAPI(require('stream')); to enable it.");
|
||||
};
|
||||
}
|
||||
|
||||
if ("Ā" != "\u0100") {
|
||||
console.error("iconv-lite warning: javascript files use encoding different from utf-8. See https://github.com/ashtuchkin/iconv-lite/wiki/Javascript-source-file-encodings for more info.");
|
||||
console.error("iconv-lite warning: js files use non-utf8 encoding. See https://github.com/ashtuchkin/iconv-lite/wiki/Javascript-source-file-encodings for more info.");
|
||||
}
|
||||
|
Reference in New Issue
Block a user