mirror of
https://github.com/S2-/minifyfromhtml.git
synced 2025-08-03 04:10:04 +02:00
update node modules
This commit is contained in:
4
node_modules/iconv-lite/lib/extend-node.js
generated
vendored
4
node_modules/iconv-lite/lib/extend-node.js
generated
vendored
@@ -1,5 +1,6 @@
|
||||
"use strict";
|
||||
var Buffer = require("buffer").Buffer;
|
||||
// Note: not polyfilled with safer-buffer on a purpose, as overrides Buffer
|
||||
|
||||
// == Extend Node primitives to use iconv-lite =================================
|
||||
|
||||
@@ -8,7 +9,8 @@ module.exports = function (iconv) {
|
||||
|
||||
// Node authors rewrote Buffer internals to make it compatible with
|
||||
// Uint8Array and we cannot patch key functions since then.
|
||||
iconv.supportsNodeEncodingsExtension = !(new Buffer(0) instanceof Uint8Array);
|
||||
// Note: this does use older Buffer API on a purpose
|
||||
iconv.supportsNodeEncodingsExtension = !(Buffer.from || new Buffer(0) instanceof Uint8Array);
|
||||
|
||||
iconv.extendNodeEncodings = function extendNodeEncodings() {
|
||||
if (original) return;
|
||||
|
4
node_modules/iconv-lite/lib/index.d.ts
generated
vendored
4
node_modules/iconv-lite/lib/index.d.ts
generated
vendored
@@ -6,9 +6,9 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
declare module 'iconv-lite' {
|
||||
export function decode(buffer: NodeBuffer, encoding: string, options?: Options): string;
|
||||
export function decode(buffer: Buffer, encoding: string, options?: Options): string;
|
||||
|
||||
export function encode(content: string, encoding: string, options?: Options): NodeBuffer;
|
||||
export function encode(content: string, encoding: string, options?: Options): Buffer;
|
||||
|
||||
export function encodingExists(encoding: string): boolean;
|
||||
|
||||
|
11
node_modules/iconv-lite/lib/index.js
generated
vendored
11
node_modules/iconv-lite/lib/index.js
generated
vendored
@@ -2,7 +2,7 @@
|
||||
|
||||
// Some environments don't have global Buffer (e.g. React Native).
|
||||
// Solution would be installing npm modules "buffer" and "stream" explicitly.
|
||||
var Buffer = require("buffer").Buffer;
|
||||
var Buffer = require("safer-buffer").Buffer;
|
||||
|
||||
var bomHandling = require("./bom-handling"),
|
||||
iconv = module.exports;
|
||||
@@ -34,7 +34,7 @@ iconv.decode = function decode(buf, encoding, options) {
|
||||
iconv.skipDecodeWarning = true;
|
||||
}
|
||||
|
||||
buf = new Buffer("" + (buf || ""), "binary"); // Ensure buffer.
|
||||
buf = Buffer.from("" + (buf || ""), "binary"); // Ensure buffer.
|
||||
}
|
||||
|
||||
var decoder = iconv.getDecoder(encoding, options);
|
||||
@@ -65,7 +65,7 @@ iconv.getCodec = function getCodec(encoding) {
|
||||
iconv.encodings = require("../encodings"); // Lazy load all encoding definitions.
|
||||
|
||||
// Canonicalize encoding name: strip all non-alphanumeric chars and appended year.
|
||||
var enc = (''+encoding).toLowerCase().replace(/[^0-9a-z]|:\d{4}$/g, "");
|
||||
var enc = iconv._canonicalizeEncoding(encoding);
|
||||
|
||||
// Traverse iconv.encodings to find actual codec.
|
||||
var codecOptions = {};
|
||||
@@ -108,6 +108,11 @@ iconv.getCodec = function getCodec(encoding) {
|
||||
}
|
||||
}
|
||||
|
||||
iconv._canonicalizeEncoding = function(encoding) {
|
||||
// Canonicalize encoding name: strip all non-alphanumeric chars and appended year.
|
||||
return (''+encoding).toLowerCase().replace(/:\d{4}$|[^0-9a-z]/g, "");
|
||||
}
|
||||
|
||||
iconv.getEncoder = function getEncoder(encoding, options) {
|
||||
var codec = iconv.getCodec(encoding),
|
||||
encoder = new codec.encoder(options, codec);
|
||||
|
Reference in New Issue
Block a user