diff --git a/build/lib/i18n.js b/build/lib/i18n.js index a728537802e94dcac0a0b9bcb440bf57bebfa21f..31282b6c5bb853e04566339ac2e68b8c5f5d35c9 100644 --- a/build/lib/i18n.js +++ b/build/lib/i18n.js @@ -462,7 +462,7 @@ function processCoreBundleFormat(fileHeader, languages, json, emitter) { contents.push(index < modules.length - 1 ? '\t],' : '\t]'); }); contents.push('});'); - emitter.queue(new File({ path: bundle + '.nls.' + language.id + '.js', contents: new Buffer(contents.join('\n'), 'utf-8') })); + emitter.queue(new File({ path: bundle + '.nls.' + language.id + '.js', contents: Buffer.from(contents.join('\n'), 'utf-8') })); }); }); Object.keys(statistics).forEach(function (key) { @@ -559,7 +559,7 @@ function createXlfFilesForCoreBundle() { var filePath = xlf.project + "/" + resource.replace(/\//g, '_') + ".xlf"; var xlfFile = new File({ path: filePath, - contents: new Buffer(xlf.toString(), 'utf8') + contents: Buffer.from(xlf.toString(), 'utf8') }); this.queue(xlfFile); } @@ -636,7 +636,7 @@ function createXlfFilesForExtensions() { if (_xlf) { var xlfFile = new File({ path: path.join(extensionsProject, extensionName + '.xlf'), - contents: new Buffer(_xlf.toString(), 'utf8') + contents: Buffer.from(_xlf.toString(), 'utf8') }); folderStream.queue(xlfFile); } @@ -703,7 +703,7 @@ function createXlfFilesForIsl() { xlf.addFile(originalPath, keys, messages); // Emit only upon all ISL files combined into single XLF instance var newFilePath = path.join(projectName, resourceFile); - var xlfFile = new File({ path: newFilePath, contents: new Buffer(xlf.toString(), 'utf-8') }); + var xlfFile = new File({ path: newFilePath, contents: Buffer.from(xlf.toString(), 'utf-8') }); this.queue(xlfFile); }); } @@ -1049,7 +1049,7 @@ function createI18nFile(originalFilePath, messages) { var content = JSON.stringify(result, null, '\t').replace(/\r\n/g, '\n'); return new File({ path: path.join(originalFilePath + '.i18n.json'), - contents: new Buffer(content, 'utf8') + contents: Buffer.from(content, 'utf8') }); } var i18nPackVersion = "1.0.0"; @@ -1189,7 +1189,7 @@ function createIslFile(originalFilePath, messages, language, innoSetup) { var filePath = basename + "." + language.id + ".isl"; return new File({ path: filePath, - contents: iconv.encode(new Buffer(content.join('\r\n'), 'utf8'), innoSetup.codePage) + contents: iconv.encode(Buffer.from(content.join('\r\n'), 'utf8'), innoSetup.codePage) }); } function encodeEntities(value) { diff --git a/build/lib/nls.js b/build/lib/nls.js index 53dd90bef39327730e4716d61ad2580f1969028d..7f2730ec89150a4ae760d5106d80788c190f33e7 100644 --- a/build/lib/nls.js +++ b/build/lib/nls.js @@ -79,7 +79,7 @@ function isImportNode(node) { function fileFrom(file, contents, path) { if (path === void 0) { path = file.path; } return new File({ - contents: new Buffer(contents), + contents: Buffer.from(contents), base: file.base, cwd: file.cwd, path: path diff --git a/build/lib/optimize.js b/build/lib/optimize.js index 3b26b45bd856336352352be2c64468481b17b328..2693d9f519aae8ea384188f9a1ea9421b0a857b0 100644 --- a/build/lib/optimize.js +++ b/build/lib/optimize.js @@ -57,7 +57,7 @@ function loader(bundledFileHeader, bundleLoader) { this.emit('data', new VinylFile({ path: 'fake', base: '', - contents: new Buffer(bundledFileHeader) + contents: Buffer.from(bundledFileHeader) })); this.emit('data', data); } @@ -96,7 +96,7 @@ function toConcatStream(bundledFileHeader, sources, dest) { return new VinylFile({ path: source.path ? root + '/' + source.path.replace(/\\/g, '/') : 'fake', base: base, - contents: new Buffer(source.contents) + contents: Buffer.from(source.contents) }); }); return es.readArray(treatedSources) @@ -139,7 +139,7 @@ function optimizeTask(opts) { bundleInfoArray.push(new VinylFile({ path: 'bundleInfo.json', base: '.', - contents: new Buffer(JSON.stringify(result.bundleData, null, '\t')) + contents: Buffer.from(JSON.stringify(result.bundleData, null, '\t')) })); } es.readArray(bundleInfoArray).pipe(bundleInfoStream); diff --git a/build/lib/util.js b/build/lib/util.js index 679e049f5a5235bb7646fac2d5e93c857a71c325..245ee13ae82471a033cf7b35ae7e086d76c2760f 100644 --- a/build/lib/util.js +++ b/build/lib/util.js @@ -143,7 +143,7 @@ function loadSourcemaps() { cb(null, f); return; } - f.contents = new Buffer(contents.replace(/\/\/# sourceMappingURL=(.*)$/g, ''), 'utf8'); + f.contents = Buffer.from(contents.replace(/\/\/# sourceMappingURL=(.*)$/g, ''), 'utf8'); fs.readFile(path.join(path.dirname(f.path), lastMatch[1]), 'utf8', function (err, contents) { if (err) { return cb(err); @@ -160,7 +160,7 @@ function stripSourceMappingURL() { var output = input .pipe(es.mapSync(function (f) { var contents = f.contents.toString('utf8'); - f.contents = new Buffer(contents.replace(/\n\/\/# sourceMappingURL=(.*)$/gm, ''), 'utf8'); + f.contents = Buffer.from(contents.replace(/\n\/\/# sourceMappingURL=(.*)$/gm, ''), 'utf8'); return f; })); return es.duplex(input, output);