sistema creado v0.5.0
This commit is contained in:
17
api/node_modules/iconv-lite/lib/index.d.ts
generated
vendored
17
api/node_modules/iconv-lite/lib/index.d.ts
generated
vendored
@@ -6,22 +6,15 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
declare module 'iconv-lite' {
|
||||
// Basic API
|
||||
export function decode(buffer: Buffer, encoding: string, options?: Options): string;
|
||||
|
||||
export function encode(content: string, encoding: string, options?: Options): Buffer;
|
||||
|
||||
export function encodingExists(encoding: string): boolean;
|
||||
|
||||
// Stream API
|
||||
export function decodeStream(encoding: string, options?: Options): NodeJS.ReadWriteStream;
|
||||
|
||||
export function encodeStream(encoding: string, options?: Options): NodeJS.ReadWriteStream;
|
||||
|
||||
// Low-level stream APIs
|
||||
export function getEncoder(encoding: string, options?: Options): EncoderStream;
|
||||
|
||||
export function getDecoder(encoding: string, options?: Options): DecoderStream;
|
||||
}
|
||||
|
||||
export interface Options {
|
||||
@@ -29,13 +22,3 @@ export interface Options {
|
||||
addBOM?: boolean;
|
||||
defaultEncoding?: string;
|
||||
}
|
||||
|
||||
export interface EncoderStream {
|
||||
write(str: string): Buffer;
|
||||
end(): Buffer | undefined;
|
||||
}
|
||||
|
||||
export interface DecoderStream {
|
||||
write(buf: Buffer): string;
|
||||
end(): string | undefined;
|
||||
}
|
||||
|
||||
51
api/node_modules/iconv-lite/lib/index.js
generated
vendored
51
api/node_modules/iconv-lite/lib/index.js
generated
vendored
@@ -1,5 +1,7 @@
|
||||
"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"),
|
||||
@@ -131,50 +133,21 @@ 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;
|
||||
|
||||
// Dependency-inject stream module to create IconvLite stream classes.
|
||||
var streams = require("./streams")(stream_module);
|
||||
// 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) {
|
||||
|
||||
// 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 streaming support in Node v0.10+
|
||||
var nodeVerArr = nodeVer.split(".").map(Number);
|
||||
if (nodeVerArr[0] > 0 || nodeVerArr[1] >= 10) {
|
||||
require("./streams")(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.");
|
||||
};
|
||||
// Load Node primitive extensions.
|
||||
require("./extend-node")(iconv);
|
||||
}
|
||||
|
||||
if ("Ā" != "\u0100") {
|
||||
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.");
|
||||
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.");
|
||||
}
|
||||
|
||||
208
api/node_modules/iconv-lite/lib/streams.js
generated
vendored
208
api/node_modules/iconv-lite/lib/streams.js
generated
vendored
@@ -1,109 +1,121 @@
|
||||
"use strict";
|
||||
|
||||
var Buffer = require("safer-buffer").Buffer;
|
||||
var Buffer = require("buffer").Buffer,
|
||||
Transform = require("stream").Transform;
|
||||
|
||||
// NOTE: Due to 'stream' module being pretty large (~100Kb, significant in browser environments),
|
||||
// we opt to dependency-inject it instead of creating a hard dependency.
|
||||
module.exports = function(stream_module) {
|
||||
var Transform = stream_module.Transform;
|
||||
|
||||
// == Encoder stream =======================================================
|
||||
|
||||
function IconvLiteEncoderStream(conv, options) {
|
||||
this.conv = conv;
|
||||
options = options || {};
|
||||
options.decodeStrings = false; // We accept only strings, so we don't need to decode them.
|
||||
Transform.call(this, options);
|
||||
// == Exports ==================================================================
|
||||
module.exports = function(iconv) {
|
||||
|
||||
// Additional Public API.
|
||||
iconv.encodeStream = function encodeStream(encoding, options) {
|
||||
return new IconvLiteEncoderStream(iconv.getEncoder(encoding, options), options);
|
||||
}
|
||||
|
||||
IconvLiteEncoderStream.prototype = Object.create(Transform.prototype, {
|
||||
constructor: { value: IconvLiteEncoderStream }
|
||||
});
|
||||
|
||||
IconvLiteEncoderStream.prototype._transform = function(chunk, encoding, done) {
|
||||
if (typeof chunk != 'string')
|
||||
return done(new Error("Iconv encoding stream needs strings as its input."));
|
||||
try {
|
||||
var res = this.conv.write(chunk);
|
||||
if (res && res.length) this.push(res);
|
||||
done();
|
||||
}
|
||||
catch (e) {
|
||||
done(e);
|
||||
}
|
||||
iconv.decodeStream = function decodeStream(encoding, options) {
|
||||
return new IconvLiteDecoderStream(iconv.getDecoder(encoding, options), options);
|
||||
}
|
||||
|
||||
IconvLiteEncoderStream.prototype._flush = function(done) {
|
||||
try {
|
||||
var res = this.conv.end();
|
||||
if (res && res.length) this.push(res);
|
||||
done();
|
||||
}
|
||||
catch (e) {
|
||||
done(e);
|
||||
}
|
||||
}
|
||||
|
||||
IconvLiteEncoderStream.prototype.collect = function(cb) {
|
||||
var chunks = [];
|
||||
this.on('error', cb);
|
||||
this.on('data', function(chunk) { chunks.push(chunk); });
|
||||
this.on('end', function() {
|
||||
cb(null, Buffer.concat(chunks));
|
||||
});
|
||||
return this;
|
||||
}
|
||||
iconv.supportsStreams = true;
|
||||
|
||||
|
||||
// == Decoder stream =======================================================
|
||||
|
||||
function IconvLiteDecoderStream(conv, options) {
|
||||
this.conv = conv;
|
||||
options = options || {};
|
||||
options.encoding = this.encoding = 'utf8'; // We output strings.
|
||||
Transform.call(this, options);
|
||||
}
|
||||
|
||||
IconvLiteDecoderStream.prototype = Object.create(Transform.prototype, {
|
||||
constructor: { value: IconvLiteDecoderStream }
|
||||
});
|
||||
|
||||
IconvLiteDecoderStream.prototype._transform = function(chunk, encoding, done) {
|
||||
if (!Buffer.isBuffer(chunk) && !(chunk instanceof Uint8Array))
|
||||
return done(new Error("Iconv decoding stream needs buffers as its input."));
|
||||
try {
|
||||
var res = this.conv.write(chunk);
|
||||
if (res && res.length) this.push(res, this.encoding);
|
||||
done();
|
||||
}
|
||||
catch (e) {
|
||||
done(e);
|
||||
}
|
||||
}
|
||||
|
||||
IconvLiteDecoderStream.prototype._flush = function(done) {
|
||||
try {
|
||||
var res = this.conv.end();
|
||||
if (res && res.length) this.push(res, this.encoding);
|
||||
done();
|
||||
}
|
||||
catch (e) {
|
||||
done(e);
|
||||
}
|
||||
}
|
||||
|
||||
IconvLiteDecoderStream.prototype.collect = function(cb) {
|
||||
var res = '';
|
||||
this.on('error', cb);
|
||||
this.on('data', function(chunk) { res += chunk; });
|
||||
this.on('end', function() {
|
||||
cb(null, res);
|
||||
});
|
||||
return this;
|
||||
}
|
||||
|
||||
return {
|
||||
IconvLiteEncoderStream: IconvLiteEncoderStream,
|
||||
IconvLiteDecoderStream: IconvLiteDecoderStream,
|
||||
};
|
||||
// Not published yet.
|
||||
iconv.IconvLiteEncoderStream = IconvLiteEncoderStream;
|
||||
iconv.IconvLiteDecoderStream = IconvLiteDecoderStream;
|
||||
iconv._collect = IconvLiteDecoderStream.prototype.collect;
|
||||
};
|
||||
|
||||
|
||||
// == Encoder stream =======================================================
|
||||
function IconvLiteEncoderStream(conv, options) {
|
||||
this.conv = conv;
|
||||
options = options || {};
|
||||
options.decodeStrings = false; // We accept only strings, so we don't need to decode them.
|
||||
Transform.call(this, options);
|
||||
}
|
||||
|
||||
IconvLiteEncoderStream.prototype = Object.create(Transform.prototype, {
|
||||
constructor: { value: IconvLiteEncoderStream }
|
||||
});
|
||||
|
||||
IconvLiteEncoderStream.prototype._transform = function(chunk, encoding, done) {
|
||||
if (typeof chunk != 'string')
|
||||
return done(new Error("Iconv encoding stream needs strings as its input."));
|
||||
try {
|
||||
var res = this.conv.write(chunk);
|
||||
if (res && res.length) this.push(res);
|
||||
done();
|
||||
}
|
||||
catch (e) {
|
||||
done(e);
|
||||
}
|
||||
}
|
||||
|
||||
IconvLiteEncoderStream.prototype._flush = function(done) {
|
||||
try {
|
||||
var res = this.conv.end();
|
||||
if (res && res.length) this.push(res);
|
||||
done();
|
||||
}
|
||||
catch (e) {
|
||||
done(e);
|
||||
}
|
||||
}
|
||||
|
||||
IconvLiteEncoderStream.prototype.collect = function(cb) {
|
||||
var chunks = [];
|
||||
this.on('error', cb);
|
||||
this.on('data', function(chunk) { chunks.push(chunk); });
|
||||
this.on('end', function() {
|
||||
cb(null, Buffer.concat(chunks));
|
||||
});
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
// == Decoder stream =======================================================
|
||||
function IconvLiteDecoderStream(conv, options) {
|
||||
this.conv = conv;
|
||||
options = options || {};
|
||||
options.encoding = this.encoding = 'utf8'; // We output strings.
|
||||
Transform.call(this, options);
|
||||
}
|
||||
|
||||
IconvLiteDecoderStream.prototype = Object.create(Transform.prototype, {
|
||||
constructor: { value: IconvLiteDecoderStream }
|
||||
});
|
||||
|
||||
IconvLiteDecoderStream.prototype._transform = function(chunk, encoding, done) {
|
||||
if (!Buffer.isBuffer(chunk))
|
||||
return done(new Error("Iconv decoding stream needs buffers as its input."));
|
||||
try {
|
||||
var res = this.conv.write(chunk);
|
||||
if (res && res.length) this.push(res, this.encoding);
|
||||
done();
|
||||
}
|
||||
catch (e) {
|
||||
done(e);
|
||||
}
|
||||
}
|
||||
|
||||
IconvLiteDecoderStream.prototype._flush = function(done) {
|
||||
try {
|
||||
var res = this.conv.end();
|
||||
if (res && res.length) this.push(res, this.encoding);
|
||||
done();
|
||||
}
|
||||
catch (e) {
|
||||
done(e);
|
||||
}
|
||||
}
|
||||
|
||||
IconvLiteDecoderStream.prototype.collect = function(cb) {
|
||||
var res = '';
|
||||
this.on('error', cb);
|
||||
this.on('data', function(chunk) { res += chunk; });
|
||||
this.on('end', function() {
|
||||
cb(null, res);
|
||||
});
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user