From 363723fc84f7b8477592e0105aeb331ec9a017af Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Mon, 14 Aug 2017 05:01:11 +0200 Subject: node_modules --- node_modules/webpack-sources/lib/ConcatSource.js | 104 ++++++++++++----------- 1 file changed, 53 insertions(+), 51 deletions(-) (limited to 'node_modules/webpack-sources/lib/ConcatSource.js') diff --git a/node_modules/webpack-sources/lib/ConcatSource.js b/node_modules/webpack-sources/lib/ConcatSource.js index 434aa3e5c..8dc712d9c 100644 --- a/node_modules/webpack-sources/lib/ConcatSource.js +++ b/node_modules/webpack-sources/lib/ConcatSource.js @@ -2,62 +2,64 @@ MIT License http://www.opensource.org/licenses/mit-license.php Author Tobias Koppers @sokra */ -var SourceNode = require("source-map").SourceNode; -var SourceListMap = require("source-list-map").SourceListMap; -var Source = require("./Source"); +"use strict"; -function ConcatSource() { - Source.call(this); - this.children = Array.prototype.slice.call(arguments); -} -module.exports = ConcatSource; +const SourceNode = require("source-map").SourceNode; +const SourceListMap = require("source-list-map").SourceListMap; +const Source = require("./Source"); + +class ConcatSource extends Source { + constructor() { + super(); + this.children = Array.prototype.slice.call(arguments); + } + + add(item) { + this.children.push(item); + } -ConcatSource.prototype = Object.create(Source.prototype); -ConcatSource.prototype.constructor = ConcatSource; + source() { + return this.children.map(function(item) { + return typeof item === "string" ? item : item.source(); + }).join(""); + } -ConcatSource.prototype.add = function(item) { - this.children.push(item); -}; + size() { + return this.children.map(function(item) { + return typeof item === "string" ? item.length : item.size(); + }).reduce(function(sum, s) { + return sum + s; + }, 0); + } -ConcatSource.prototype.source = function() { - return this.children.map(function(item) { - return typeof item === "string" ? item : item.source(); - }).join(""); -}; + node(options) { + const node = new SourceNode(null, null, null, this.children.map(function(item) { + return typeof item === "string" ? item : item.node(options); + })); + return node; + } -ConcatSource.prototype.size = function() { - return this.children.map(function(item) { - return typeof item === "string" ? item.length : item.size(); - }).reduce(function(sum, s) { - return sum + s; - }, 0); -}; + listMap(options) { + const map = new SourceListMap(); + this.children.forEach(function(item) { + if(typeof item === "string") + map.add(item); + else + map.add(item.listMap(options)); + }); + return map; + } + + updateHash(hash) { + this.children.forEach(function(item) { + if(typeof item === "string") + hash.update(item); + else + item.updateHash(hash); + }); + } +} require("./SourceAndMapMixin")(ConcatSource.prototype); -ConcatSource.prototype.node = function(options) { - var node = new SourceNode(null, null, null, this.children.map(function(item) { - return typeof item === "string" ? item : item.node(options); - })); - return node; -}; - -ConcatSource.prototype.listMap = function(options) { - var map = new SourceListMap(); - this.children.forEach(function(item) { - if(typeof item === "string") - map.add(item); - else - map.add(item.listMap(options)); - }); - return map; -}; - -ConcatSource.prototype.updateHash = function(hash) { - this.children.forEach(function(item) { - if(typeof item === "string") - hash.update(item); - else - item.updateHash(hash); - }); -}; +module.exports = ConcatSource; -- cgit v1.2.3