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ourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/gulp-byo-jslint@1.1.1/index.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","/*!\r\n   gulp-byo-jslint\r\n   Copyright 2016 Ben Quarmby\r\n\r\n   Licensed under the Apache License, Version 2.0 (the \"License\");\r\n   you may not use this file except in compliance with the License.\r\n   You may obtain a copy of the License at\r\n\r\n     http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n   Unless required by applicable law or agreed to in writing, software\r\n   distributed under the License is distributed on an \"AS IS\" BASIS,\r\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n   See the License for the specific language governing permissions and\r\n   limitations under the License.\r\n!*/\r\n\r\n'use strict';\r\n\r\nvar eventStream = require('event-stream');\r\nvar gulpUtil = require('gulp-util');\r\nvar colors = require('colors/safe');\r\nvar vm = require('vm');\r\nvar fs = require('fs');\r\n\r\nvar pluginName = 'gulp-byo-jslint';\r\nvar context = {};\r\n\r\nfunction logWarning(warning) {\r\n    var message = [\r\n        '    ',\r\n        warning.line + 1,\r\n        ':',\r\n        warning.column + 1,\r\n        ': ',\r\n        warning.message\r\n    ];\r\n\r\n    gulpUtil.log(colors.red(message.join('')));\r\n}\r\n\r\n/**\r\n * Runs JSLint over each item in the stream.\r\n * @param {Object} spec The specification.\r\n * @param {String} spec.jslint The file path to jslint.js.\r\n * @param {Object} [spec.options] The options to pass to JSLint.\r\n * @param {Array} [spec.globals] The list of known global variables to pass to JSLint.\r\n * @param {Boolean} [spec.noFail] True to log all warnings without failing.\r\n */\r\nfunction lintStream(spec) {\r\n    if (!spec || !spec.jslint) {\r\n        throw new gulpUtil.PluginError(pluginName, 'The file path to jslint is required.');\r\n    }\r\n\r\n    var errors = 0;\r\n\r\n    function lint(source, callback) {\r\n        var contents = source.contents.toString('utf8');\r\n        var result = context.jslint(contents, spec.options, spec.globals);\r\n\r\n        if (result.ok) {\r\n            gulpUtil.log(colors.green(source.path));\r\n        } else {\r\n            gulpUtil.log(colors.red(source.path));\r\n\r\n            errors += result.warnings.length;\r\n\r\n            result.warnings.forEach(logWarning);\r\n        }\r\n\r\n        callback(null, source);\r\n    }\r\n\r\n    function map(source, callback) {\r\n        if (context.jslint) {\r\n            lint(source, callback);\r\n\r\n            return;\r\n        }\r\n\r\n        fs.readFile(spec.jslint, 'utf8', function (err, jslint) {\r\n            if (err) {\r\n                throw new gulpUtil.PluginError(pluginName, err);\r\n            }\r\n\r\n            vm.runInNewContext(jslint, context);\r\n\r\n            lint(source, callback);\r\n        });\r\n    }\r\n\r\n    function onEnd() {\r\n        if (errors && !spec.noFail) {\r\n            var message = errors === 1\r\n                ? 'JSLint found one error.'\r\n                : 'JSLint found ' + errors + ' errors.';\r\n\r\n            throw new gulpUtil.PluginError(pluginName, message);\r\n        }\r\n    }\r\n\r\n    return eventStream\r\n        .map(map)\r\n        .on('end', onEnd);\r\n}\r\n\r\nmodule.exports = lintStream;\r\n"]}