First commit
This commit is contained in:
3
hGameTest/node_modules/uglifyjs-webpack-plugin/dist/cjs.js
generated
vendored
Normal file
3
hGameTest/node_modules/uglifyjs-webpack-plugin/dist/cjs.js
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = require('./index').default;
|
||||
384
hGameTest/node_modules/uglifyjs-webpack-plugin/dist/index.js
generated
vendored
Normal file
384
hGameTest/node_modules/uglifyjs-webpack-plugin/dist/index.js
generated
vendored
Normal file
@@ -0,0 +1,384 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); /* eslint-disable
|
||||
no-param-reassign
|
||||
*/
|
||||
|
||||
|
||||
var _crypto = require('crypto');
|
||||
|
||||
var _crypto2 = _interopRequireDefault(_crypto);
|
||||
|
||||
var _path = require('path');
|
||||
|
||||
var _path2 = _interopRequireDefault(_path);
|
||||
|
||||
var _sourceMap = require('source-map');
|
||||
|
||||
var _webpackSources = require('webpack-sources');
|
||||
|
||||
var _RequestShortener = require('webpack/lib/RequestShortener');
|
||||
|
||||
var _RequestShortener2 = _interopRequireDefault(_RequestShortener);
|
||||
|
||||
var _ModuleFilenameHelpers = require('webpack/lib/ModuleFilenameHelpers');
|
||||
|
||||
var _ModuleFilenameHelpers2 = _interopRequireDefault(_ModuleFilenameHelpers);
|
||||
|
||||
var _schemaUtils = require('schema-utils');
|
||||
|
||||
var _schemaUtils2 = _interopRequireDefault(_schemaUtils);
|
||||
|
||||
var _options = require('./options.json');
|
||||
|
||||
var _options2 = _interopRequireDefault(_options);
|
||||
|
||||
var _Runner = require('./uglify/Runner');
|
||||
|
||||
var _Runner2 = _interopRequireDefault(_Runner);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
var warningRegex = /\[.+:([0-9]+),([0-9]+)\]/;
|
||||
|
||||
var UglifyJsPlugin = function () {
|
||||
function UglifyJsPlugin() {
|
||||
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
||||
|
||||
_classCallCheck(this, UglifyJsPlugin);
|
||||
|
||||
(0, _schemaUtils2.default)(_options2.default, options, 'UglifyJs Plugin');
|
||||
|
||||
var minify = options.minify,
|
||||
_options$uglifyOption = options.uglifyOptions,
|
||||
uglifyOptions = _options$uglifyOption === undefined ? {} : _options$uglifyOption,
|
||||
_options$test = options.test,
|
||||
test = _options$test === undefined ? /\.js(\?.*)?$/i : _options$test,
|
||||
_options$warningsFilt = options.warningsFilter,
|
||||
warningsFilter = _options$warningsFilt === undefined ? function () {
|
||||
return true;
|
||||
} : _options$warningsFilt,
|
||||
_options$extractComme = options.extractComments,
|
||||
extractComments = _options$extractComme === undefined ? false : _options$extractComme,
|
||||
_options$sourceMap = options.sourceMap,
|
||||
sourceMap = _options$sourceMap === undefined ? false : _options$sourceMap,
|
||||
_options$cache = options.cache,
|
||||
cache = _options$cache === undefined ? false : _options$cache,
|
||||
_options$cacheKeys = options.cacheKeys,
|
||||
cacheKeys = _options$cacheKeys === undefined ? function (defaultCacheKeys) {
|
||||
return defaultCacheKeys;
|
||||
} : _options$cacheKeys,
|
||||
_options$parallel = options.parallel,
|
||||
parallel = _options$parallel === undefined ? false : _options$parallel,
|
||||
include = options.include,
|
||||
exclude = options.exclude;
|
||||
|
||||
|
||||
this.options = {
|
||||
test,
|
||||
warningsFilter,
|
||||
extractComments,
|
||||
sourceMap,
|
||||
cache,
|
||||
cacheKeys,
|
||||
parallel,
|
||||
include,
|
||||
exclude,
|
||||
minify,
|
||||
uglifyOptions: Object.assign({
|
||||
compress: {
|
||||
inline: 1
|
||||
},
|
||||
output: {
|
||||
comments: extractComments ? false : /^\**!|@preserve|@license|@cc_on/
|
||||
}
|
||||
}, uglifyOptions)
|
||||
};
|
||||
}
|
||||
|
||||
_createClass(UglifyJsPlugin, [{
|
||||
key: 'apply',
|
||||
value: function apply(compiler) {
|
||||
var _this = this;
|
||||
|
||||
var buildModuleFn = function buildModuleFn(moduleArg) {
|
||||
// to get detailed location info about errors
|
||||
moduleArg.useSourceMap = true;
|
||||
};
|
||||
|
||||
var optimizeFn = function optimizeFn(compilation, chunks, callback) {
|
||||
var runner = new _Runner2.default({
|
||||
cache: _this.options.cache,
|
||||
parallel: _this.options.parallel
|
||||
});
|
||||
|
||||
var uglifiedAssets = new WeakSet();
|
||||
var tasks = [];
|
||||
|
||||
chunks.reduce(function (acc, chunk) {
|
||||
return acc.concat(chunk.files || []);
|
||||
}, []).concat(compilation.additionalChunkAssets || []).filter(_ModuleFilenameHelpers2.default.matchObject.bind(null, _this.options)).forEach(function (file) {
|
||||
var inputSourceMap = void 0;
|
||||
|
||||
var asset = compilation.assets[file];
|
||||
|
||||
if (uglifiedAssets.has(asset)) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
var input = void 0;
|
||||
|
||||
if (_this.options.sourceMap && asset.sourceAndMap) {
|
||||
var _asset$sourceAndMap = asset.sourceAndMap(),
|
||||
source = _asset$sourceAndMap.source,
|
||||
map = _asset$sourceAndMap.map;
|
||||
|
||||
input = source;
|
||||
|
||||
if (UglifyJsPlugin.isSourceMap(map)) {
|
||||
inputSourceMap = map;
|
||||
} else {
|
||||
inputSourceMap = map;
|
||||
|
||||
compilation.warnings.push(new Error(`${file} contains invalid source map`));
|
||||
}
|
||||
} else {
|
||||
input = asset.source();
|
||||
inputSourceMap = null;
|
||||
}
|
||||
|
||||
// Handling comment extraction
|
||||
var commentsFile = false;
|
||||
|
||||
if (_this.options.extractComments) {
|
||||
commentsFile = _this.options.extractComments.filename || `${file}.LICENSE`;
|
||||
|
||||
if (typeof commentsFile === 'function') {
|
||||
commentsFile = commentsFile(file);
|
||||
}
|
||||
}
|
||||
|
||||
var task = {
|
||||
file,
|
||||
input,
|
||||
inputSourceMap,
|
||||
commentsFile,
|
||||
extractComments: _this.options.extractComments,
|
||||
uglifyOptions: _this.options.uglifyOptions,
|
||||
minify: _this.options.minify
|
||||
};
|
||||
|
||||
if (_this.options.cache) {
|
||||
var defaultCacheKeys = {
|
||||
// eslint-disable-next-line global-require
|
||||
'uglify-es': require('uglify-es/package.json').version,
|
||||
// eslint-disable-next-line global-require
|
||||
'uglifyjs-webpack-plugin': require('../package.json').version,
|
||||
'uglifyjs-webpack-plugin-options': _this.options,
|
||||
path: compiler.outputPath ? `${compiler.outputPath}/${file}` : file,
|
||||
hash: _crypto2.default.createHash('md4').update(input).digest('hex')
|
||||
};
|
||||
|
||||
task.cacheKeys = _this.options.cacheKeys(defaultCacheKeys, file);
|
||||
}
|
||||
|
||||
tasks.push(task);
|
||||
} catch (error) {
|
||||
compilation.errors.push(UglifyJsPlugin.buildError(error, file, UglifyJsPlugin.buildSourceMap(inputSourceMap), new _RequestShortener2.default(compiler.context)));
|
||||
}
|
||||
});
|
||||
|
||||
runner.runTasks(tasks, function (tasksError, results) {
|
||||
if (tasksError) {
|
||||
compilation.errors.push(tasksError);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
results.forEach(function (data, index) {
|
||||
var _tasks$index = tasks[index],
|
||||
file = _tasks$index.file,
|
||||
input = _tasks$index.input,
|
||||
inputSourceMap = _tasks$index.inputSourceMap,
|
||||
commentsFile = _tasks$index.commentsFile;
|
||||
var error = data.error,
|
||||
map = data.map,
|
||||
code = data.code,
|
||||
warnings = data.warnings,
|
||||
extractedComments = data.extractedComments;
|
||||
|
||||
|
||||
var sourceMap = null;
|
||||
|
||||
if (error || warnings && warnings.length > 0) {
|
||||
sourceMap = UglifyJsPlugin.buildSourceMap(inputSourceMap);
|
||||
}
|
||||
|
||||
// Handling results
|
||||
// Error case: add errors, and go to next file
|
||||
if (error) {
|
||||
compilation.errors.push(UglifyJsPlugin.buildError(error, file, sourceMap, new _RequestShortener2.default(compiler.context)));
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
var outputSource = void 0;
|
||||
|
||||
if (map) {
|
||||
outputSource = new _webpackSources.SourceMapSource(code, file, JSON.parse(map), input, inputSourceMap);
|
||||
} else {
|
||||
outputSource = new _webpackSources.RawSource(code);
|
||||
}
|
||||
|
||||
// Write extracted comments to commentsFile
|
||||
if (commentsFile && extractedComments.length > 0) {
|
||||
// Add a banner to the original file
|
||||
if (_this.options.extractComments.banner !== false) {
|
||||
var banner = _this.options.extractComments.banner || `For license information please see ${_path2.default.posix.basename(commentsFile)}`;
|
||||
|
||||
if (typeof banner === 'function') {
|
||||
banner = banner(commentsFile);
|
||||
}
|
||||
|
||||
if (banner) {
|
||||
outputSource = new _webpackSources.ConcatSource(`/*! ${banner} */\n`, outputSource);
|
||||
}
|
||||
}
|
||||
|
||||
var commentsSource = new _webpackSources.RawSource(`${extractedComments.join('\n\n')}\n`);
|
||||
|
||||
if (commentsFile in compilation.assets) {
|
||||
// commentsFile already exists, append new comments...
|
||||
if (compilation.assets[commentsFile] instanceof _webpackSources.ConcatSource) {
|
||||
compilation.assets[commentsFile].add('\n');
|
||||
compilation.assets[commentsFile].add(commentsSource);
|
||||
} else {
|
||||
compilation.assets[commentsFile] = new _webpackSources.ConcatSource(compilation.assets[commentsFile], '\n', commentsSource);
|
||||
}
|
||||
} else {
|
||||
compilation.assets[commentsFile] = commentsSource;
|
||||
}
|
||||
}
|
||||
|
||||
// Updating assets
|
||||
uglifiedAssets.add(compilation.assets[file] = outputSource);
|
||||
|
||||
// Handling warnings
|
||||
if (warnings && warnings.length > 0) {
|
||||
warnings.forEach(function (warning) {
|
||||
var builtWarning = UglifyJsPlugin.buildWarning(warning, file, sourceMap, _this.options.warningsFilter, new _RequestShortener2.default(compiler.context));
|
||||
|
||||
if (builtWarning) {
|
||||
compilation.warnings.push(builtWarning);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
runner.exit();
|
||||
|
||||
callback();
|
||||
});
|
||||
};
|
||||
|
||||
/* istanbul ignore if */
|
||||
if (compiler.hooks) {
|
||||
var plugin = { name: 'UglifyJSPlugin' };
|
||||
|
||||
compiler.hooks.compilation.tap(plugin, function (compilation) {
|
||||
if (_this.options.sourceMap) {
|
||||
compilation.hooks.buildModule.tap(plugin, buildModuleFn);
|
||||
}
|
||||
|
||||
compilation.hooks.optimizeChunkAssets.tapAsync(plugin, optimizeFn.bind(_this, compilation));
|
||||
});
|
||||
} else {
|
||||
compiler.plugin('compilation', function (compilation) {
|
||||
if (_this.options.sourceMap) {
|
||||
compilation.plugin('build-module', buildModuleFn);
|
||||
}
|
||||
|
||||
compilation.plugin('optimize-chunk-assets', optimizeFn.bind(_this, compilation));
|
||||
});
|
||||
}
|
||||
}
|
||||
}], [{
|
||||
key: 'isSourceMap',
|
||||
value: function isSourceMap(input) {
|
||||
// All required options for `new SourceMapConsumer(...options)`
|
||||
// https://github.com/mozilla/source-map#new-sourcemapconsumerrawsourcemap
|
||||
return Boolean(input && input.version && input.sources && Array.isArray(input.sources) && typeof input.mappings === 'string');
|
||||
}
|
||||
}, {
|
||||
key: 'buildSourceMap',
|
||||
value: function buildSourceMap(inputSourceMap) {
|
||||
if (!inputSourceMap || !UglifyJsPlugin.isSourceMap(inputSourceMap)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return new _sourceMap.SourceMapConsumer(inputSourceMap);
|
||||
}
|
||||
}, {
|
||||
key: 'buildError',
|
||||
value: function buildError(err, file, sourceMap, requestShortener) {
|
||||
// Handling error which should have line, col, filename and message
|
||||
if (err.line) {
|
||||
var original = sourceMap && sourceMap.originalPositionFor({
|
||||
line: err.line,
|
||||
column: err.col
|
||||
});
|
||||
|
||||
if (original && original.source && requestShortener) {
|
||||
return new Error(`${file} from UglifyJs\n${err.message} [${requestShortener.shorten(original.source)}:${original.line},${original.column}][${file}:${err.line},${err.col}]`);
|
||||
}
|
||||
|
||||
return new Error(`${file} from UglifyJs\n${err.message} [${file}:${err.line},${err.col}]`);
|
||||
} else if (err.stack) {
|
||||
return new Error(`${file} from UglifyJs\n${err.stack}`);
|
||||
}
|
||||
|
||||
return new Error(`${file} from UglifyJs\n${err.message}`);
|
||||
}
|
||||
}, {
|
||||
key: 'buildWarning',
|
||||
value: function buildWarning(warning, file, sourceMap, warningsFilter, requestShortener) {
|
||||
if (!file || !sourceMap) {
|
||||
return `UglifyJs Plugin: ${warning}`;
|
||||
}
|
||||
|
||||
var warningMessage = warning;
|
||||
|
||||
var match = warningRegex.exec(warning);
|
||||
|
||||
if (match) {
|
||||
var line = +match[1];
|
||||
var column = +match[2];
|
||||
var original = sourceMap.originalPositionFor({
|
||||
line,
|
||||
column
|
||||
});
|
||||
|
||||
if (warningsFilter && !warningsFilter(original.source)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (original && original.source && original.source !== file && requestShortener) {
|
||||
warningMessage = `${warningMessage.replace(warningRegex, '')}[${requestShortener.shorten(original.source)}:${original.line},${original.column}]`;
|
||||
}
|
||||
}
|
||||
|
||||
return `UglifyJs Plugin: ${warningMessage} in ${file}`;
|
||||
}
|
||||
}]);
|
||||
|
||||
return UglifyJsPlugin;
|
||||
}();
|
||||
|
||||
exports.default = UglifyJsPlugin;
|
||||
74
hGameTest/node_modules/uglifyjs-webpack-plugin/dist/options.json
generated
vendored
Normal file
74
hGameTest/node_modules/uglifyjs-webpack-plugin/dist/options.json
generated
vendored
Normal file
@@ -0,0 +1,74 @@
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"test": {},
|
||||
"include": {},
|
||||
"exclude": {},
|
||||
"cache": {
|
||||
"oneOf": [
|
||||
{ "type": "boolean" },
|
||||
{ "type": "string" }
|
||||
]
|
||||
},
|
||||
"cacheKeys": {
|
||||
"instanceof": "Function"
|
||||
},
|
||||
"parallel": {
|
||||
"oneOf": [
|
||||
{ "type": "boolean" },
|
||||
{ "type": "integer" }
|
||||
]
|
||||
},
|
||||
"sourceMap": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"minify": {
|
||||
"instanceof": "Function"
|
||||
},
|
||||
"uglifyOptions": {
|
||||
"additionalProperties": true,
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"ecma": {
|
||||
"type": "integer",
|
||||
"minimum": 5,
|
||||
"maximum": 8
|
||||
},
|
||||
"warnings": {
|
||||
"type": ["boolean", "string"],
|
||||
"enum": [true, false, "verbose"]
|
||||
},
|
||||
"ie8": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"parse": {
|
||||
"type": "object"
|
||||
},
|
||||
"compress": {
|
||||
"type": ["boolean", "object"]
|
||||
},
|
||||
"mangle": {
|
||||
"type": ["boolean", "object"],
|
||||
"properties": {
|
||||
"properties": {
|
||||
"type": ["boolean", "object"]
|
||||
}
|
||||
}
|
||||
},
|
||||
"output": {
|
||||
"type": ["object", "null"]
|
||||
},
|
||||
"toplevel": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"nameCache": {
|
||||
"type": ["object", "null"]
|
||||
}
|
||||
}
|
||||
},
|
||||
"extractComments": {},
|
||||
"warningsFilter": {}
|
||||
},
|
||||
"additionalProperties": false
|
||||
}
|
||||
|
||||
136
hGameTest/node_modules/uglifyjs-webpack-plugin/dist/uglify/Runner.js
generated
vendored
Normal file
136
hGameTest/node_modules/uglifyjs-webpack-plugin/dist/uglify/Runner.js
generated
vendored
Normal file
@@ -0,0 +1,136 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
||||
|
||||
var _os = require('os');
|
||||
|
||||
var _os2 = _interopRequireDefault(_os);
|
||||
|
||||
var _cacache = require('cacache');
|
||||
|
||||
var _cacache2 = _interopRequireDefault(_cacache);
|
||||
|
||||
var _findCacheDir = require('find-cache-dir');
|
||||
|
||||
var _findCacheDir2 = _interopRequireDefault(_findCacheDir);
|
||||
|
||||
var _workerFarm = require('worker-farm');
|
||||
|
||||
var _workerFarm2 = _interopRequireDefault(_workerFarm);
|
||||
|
||||
var _serializeJavascript = require('serialize-javascript');
|
||||
|
||||
var _serializeJavascript2 = _interopRequireDefault(_serializeJavascript);
|
||||
|
||||
var _minify = require('./minify');
|
||||
|
||||
var _minify2 = _interopRequireDefault(_minify);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
var workerFile = require.resolve('./worker');
|
||||
|
||||
try {
|
||||
// run test
|
||||
workerFile = require.resolve('../../dist/uglify/worker');
|
||||
} catch (e) {} // eslint-disable-line no-empty
|
||||
|
||||
var Runner = function () {
|
||||
function Runner() {
|
||||
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
||||
|
||||
_classCallCheck(this, Runner);
|
||||
|
||||
var cache = options.cache,
|
||||
parallel = options.parallel;
|
||||
|
||||
this.cacheDir = cache === true ? (0, _findCacheDir2.default)({ name: 'uglifyjs-webpack-plugin' }) : cache;
|
||||
// In some cases cpus() returns undefined
|
||||
// https://github.com/nodejs/node/issues/19022
|
||||
var cpus = _os2.default.cpus() || { length: 1 };
|
||||
this.maxConcurrentWorkers = parallel === true ? cpus.length - 1 : Math.min(Number(parallel) || 0, cpus.length - 1);
|
||||
}
|
||||
|
||||
_createClass(Runner, [{
|
||||
key: 'runTasks',
|
||||
value: function runTasks(tasks, callback) {
|
||||
var _this = this;
|
||||
|
||||
/* istanbul ignore if */
|
||||
if (!tasks.length) {
|
||||
callback(null, []);
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.maxConcurrentWorkers > 1) {
|
||||
var workerOptions = process.platform === 'win32' ? { maxConcurrentWorkers: this.maxConcurrentWorkers, maxConcurrentCallsPerWorker: 1 } : { maxConcurrentWorkers: this.maxConcurrentWorkers };
|
||||
this.workers = (0, _workerFarm2.default)(workerOptions, workerFile);
|
||||
this.boundWorkers = function (options, cb) {
|
||||
return _this.workers((0, _serializeJavascript2.default)(options), cb);
|
||||
};
|
||||
} else {
|
||||
this.boundWorkers = function (options, cb) {
|
||||
try {
|
||||
cb(null, (0, _minify2.default)(options));
|
||||
} catch (error) {
|
||||
cb(error);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
var toRun = tasks.length;
|
||||
var results = [];
|
||||
var step = function step(index, data) {
|
||||
toRun -= 1;
|
||||
results[index] = data;
|
||||
|
||||
if (!toRun) {
|
||||
callback(null, results);
|
||||
}
|
||||
};
|
||||
|
||||
tasks.forEach(function (task, index) {
|
||||
var enqueue = function enqueue() {
|
||||
_this.boundWorkers(task, function (error, data) {
|
||||
var result = error ? { error } : data;
|
||||
var done = function done() {
|
||||
return step(index, result);
|
||||
};
|
||||
|
||||
if (_this.cacheDir && !result.error) {
|
||||
_cacache2.default.put(_this.cacheDir, (0, _serializeJavascript2.default)(task.cacheKeys), JSON.stringify(data)).then(done, done);
|
||||
} else {
|
||||
done();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
if (_this.cacheDir) {
|
||||
_cacache2.default.get(_this.cacheDir, (0, _serializeJavascript2.default)(task.cacheKeys)).then(function (_ref) {
|
||||
var data = _ref.data;
|
||||
return step(index, JSON.parse(data));
|
||||
}, enqueue);
|
||||
} else {
|
||||
enqueue();
|
||||
}
|
||||
});
|
||||
}
|
||||
}, {
|
||||
key: 'exit',
|
||||
value: function exit() {
|
||||
if (this.workers) {
|
||||
_workerFarm2.default.end(this.workers);
|
||||
}
|
||||
}
|
||||
}]);
|
||||
|
||||
return Runner;
|
||||
}();
|
||||
|
||||
exports.default = Runner;
|
||||
179
hGameTest/node_modules/uglifyjs-webpack-plugin/dist/uglify/minify.js
generated
vendored
Normal file
179
hGameTest/node_modules/uglifyjs-webpack-plugin/dist/uglify/minify.js
generated
vendored
Normal file
@@ -0,0 +1,179 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
var _uglifyEs = require('uglify-es');
|
||||
|
||||
var _uglifyEs2 = _interopRequireDefault(_uglifyEs);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
var buildUglifyOptions = function buildUglifyOptions() {
|
||||
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
||||
ecma = _ref.ecma,
|
||||
warnings = _ref.warnings,
|
||||
_ref$parse = _ref.parse,
|
||||
parse = _ref$parse === undefined ? {} : _ref$parse,
|
||||
_ref$compress = _ref.compress,
|
||||
compress = _ref$compress === undefined ? {} : _ref$compress,
|
||||
mangle = _ref.mangle,
|
||||
output = _ref.output,
|
||||
toplevel = _ref.toplevel,
|
||||
nameCache = _ref.nameCache,
|
||||
ie8 = _ref.ie8,
|
||||
keep_classnames = _ref.keep_classnames,
|
||||
keep_fnames = _ref.keep_fnames,
|
||||
safari10 = _ref.safari10;
|
||||
|
||||
return {
|
||||
ecma,
|
||||
warnings,
|
||||
parse: Object.assign({}, parse),
|
||||
compress: typeof compress === 'boolean' ? compress : Object.assign({}, compress),
|
||||
// eslint-disable-next-line no-nested-ternary
|
||||
mangle: mangle == null ? true : typeof mangle === 'boolean' ? mangle : Object.assign({}, mangle),
|
||||
output: Object.assign({
|
||||
shebang: true,
|
||||
comments: false,
|
||||
beautify: false,
|
||||
semicolons: true
|
||||
}, output),
|
||||
// Ignoring sourceMap from options
|
||||
sourceMap: null,
|
||||
toplevel,
|
||||
nameCache,
|
||||
ie8,
|
||||
keep_classnames,
|
||||
keep_fnames,
|
||||
safari10
|
||||
};
|
||||
}; /* eslint-disable
|
||||
arrow-body-style
|
||||
*/
|
||||
|
||||
|
||||
var buildComments = function buildComments(options, uglifyOptions, extractedComments) {
|
||||
var condition = {};
|
||||
var commentsOpts = uglifyOptions.output.comments;
|
||||
|
||||
// /^\**!|@preserve|@license|@cc_on/
|
||||
if (typeof options.extractComments === 'boolean') {
|
||||
condition.preserve = commentsOpts;
|
||||
condition.extract = /^\**!|@preserve|@license|@cc_on/;
|
||||
} else if (typeof options.extractComments === 'string' || options.extractComments instanceof RegExp) {
|
||||
// extractComments specifies the extract condition and commentsOpts specifies the preserve condition
|
||||
condition.preserve = commentsOpts;
|
||||
condition.extract = options.extractComments;
|
||||
} else if (typeof options.extractComments === 'function') {
|
||||
condition.preserve = false;
|
||||
condition.extract = options.extractComments;
|
||||
} else if (Object.prototype.hasOwnProperty.call(options.extractComments, 'condition')) {
|
||||
// Extract condition is given in extractComments.condition
|
||||
condition.preserve = commentsOpts;
|
||||
condition.extract = options.extractComments.condition;
|
||||
} else {
|
||||
// No extract condition is given. Extract comments that match commentsOpts instead of preserving them
|
||||
condition.preserve = false;
|
||||
condition.extract = commentsOpts;
|
||||
}
|
||||
|
||||
// Ensure that both conditions are functions
|
||||
['preserve', 'extract'].forEach(function (key) {
|
||||
var regexStr = void 0;
|
||||
var regex = void 0;
|
||||
|
||||
switch (typeof condition[key]) {
|
||||
case 'boolean':
|
||||
condition[key] = condition[key] ? function () {
|
||||
return true;
|
||||
} : function () {
|
||||
return false;
|
||||
};
|
||||
|
||||
break;
|
||||
case 'function':
|
||||
break;
|
||||
case 'string':
|
||||
if (condition[key] === 'all') {
|
||||
condition[key] = function () {
|
||||
return true;
|
||||
};
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
if (condition[key] === 'some') {
|
||||
condition[key] = function (astNode, comment) {
|
||||
return comment.type === 'comment2' && /@preserve|@license|@cc_on/i.test(comment.value);
|
||||
};
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
regexStr = condition[key];
|
||||
|
||||
condition[key] = function (astNode, comment) {
|
||||
return new RegExp(regexStr).test(comment.value);
|
||||
};
|
||||
|
||||
break;
|
||||
default:
|
||||
regex = condition[key];
|
||||
|
||||
condition[key] = function (astNode, comment) {
|
||||
return regex.test(comment.value);
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
// Redefine the comments function to extract and preserve
|
||||
// comments according to the two conditions
|
||||
return function (astNode, comment) {
|
||||
if (condition.extract(astNode, comment)) {
|
||||
extractedComments.push(comment.type === 'comment2' ? `/*${comment.value}*/` : `//${comment.value}`);
|
||||
}
|
||||
|
||||
return condition.preserve(astNode, comment);
|
||||
};
|
||||
};
|
||||
|
||||
var minify = function minify(options) {
|
||||
var file = options.file,
|
||||
input = options.input,
|
||||
inputSourceMap = options.inputSourceMap,
|
||||
extractComments = options.extractComments,
|
||||
minifyFn = options.minify;
|
||||
|
||||
|
||||
if (minifyFn) {
|
||||
return minifyFn({ [file]: input }, inputSourceMap);
|
||||
}
|
||||
|
||||
// Copy uglify options
|
||||
var uglifyOptions = buildUglifyOptions(options.uglifyOptions);
|
||||
|
||||
// Add source map data
|
||||
if (inputSourceMap) {
|
||||
uglifyOptions.sourceMap = {
|
||||
content: inputSourceMap
|
||||
};
|
||||
}
|
||||
|
||||
var extractedComments = [];
|
||||
|
||||
if (extractComments) {
|
||||
uglifyOptions.output.comments = buildComments(options, uglifyOptions, extractedComments);
|
||||
}
|
||||
|
||||
var _uglify$minify = _uglifyEs2.default.minify({ [file]: input }, uglifyOptions),
|
||||
error = _uglify$minify.error,
|
||||
map = _uglify$minify.map,
|
||||
code = _uglify$minify.code,
|
||||
warnings = _uglify$minify.warnings;
|
||||
|
||||
return { error, map, code, warnings, extractedComments };
|
||||
};
|
||||
|
||||
exports.default = minify;
|
||||
20
hGameTest/node_modules/uglifyjs-webpack-plugin/dist/uglify/worker.js
generated
vendored
Normal file
20
hGameTest/node_modules/uglifyjs-webpack-plugin/dist/uglify/worker.js
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
'use strict';
|
||||
|
||||
var _minify = require('./minify');
|
||||
|
||||
var _minify2 = _interopRequireDefault(_minify);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
module.exports = function (options, callback) {
|
||||
try {
|
||||
// 'use strict' => this === undefined (Clean Scope)
|
||||
// Safer for possible security issues, albeit not critical at all here
|
||||
// eslint-disable-next-line no-new-func, no-param-reassign
|
||||
options = new Function('exports', 'require', 'module', '__filename', '__dirname', `'use strict'\nreturn ${options}`)(exports, require, module, __filename, __dirname);
|
||||
|
||||
callback(null, (0, _minify2.default)(options));
|
||||
} catch (errors) {
|
||||
callback(errors);
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user