aboutsummaryrefslogtreecommitdiff
path: root/node_modules/copy-webpack-plugin/dist
diff options
context:
space:
mode:
authorruki <waruqi@gmail.com>2018-11-08 00:38:48 +0800
committerruki <waruqi@gmail.com>2018-11-07 21:53:09 +0800
commit26105034da4fcce7ac883c899d781f016559310d (patch)
treec459a5dc4e3aa0972d9919033ece511ce76dd129 /node_modules/copy-webpack-plugin/dist
parent2c77f00f1a7ecb6c8192f9c16d3b2001b254a107 (diff)
downloadxmake-docs-26105034da4fcce7ac883c899d781f016559310d.tar.gz
xmake-docs-26105034da4fcce7ac883c899d781f016559310d.zip
switch to vuepress
Diffstat (limited to 'node_modules/copy-webpack-plugin/dist')
-rw-r--r--node_modules/copy-webpack-plugin/dist/index.js240
-rw-r--r--node_modules/copy-webpack-plugin/dist/preProcessPattern.js139
-rw-r--r--node_modules/copy-webpack-plugin/dist/processPattern.js138
-rw-r--r--node_modules/copy-webpack-plugin/dist/utils/escape.js35
-rw-r--r--node_modules/copy-webpack-plugin/dist/utils/isObject.js9
-rw-r--r--node_modules/copy-webpack-plugin/dist/utils/promisify.js26
-rw-r--r--node_modules/copy-webpack-plugin/dist/utils/readFilePromise.js17
-rw-r--r--node_modules/copy-webpack-plugin/dist/utils/readPromise.js17
-rw-r--r--node_modules/copy-webpack-plugin/dist/utils/statPromise.js17
-rw-r--r--node_modules/copy-webpack-plugin/dist/writeFile.js153
10 files changed, 791 insertions, 0 deletions
diff --git a/node_modules/copy-webpack-plugin/dist/index.js b/node_modules/copy-webpack-plugin/dist/index.js
new file mode 100644
index 00000000..afaa29cd
--- /dev/null
+++ b/node_modules/copy-webpack-plugin/dist/index.js
@@ -0,0 +1,240 @@
+'use strict';
+
+var _path = require('path');
+
+var _path2 = _interopRequireDefault(_path);
+
+var _preProcessPattern = require('./preProcessPattern');
+
+var _preProcessPattern2 = _interopRequireDefault(_preProcessPattern);
+
+var _processPattern = require('./processPattern');
+
+var _processPattern2 = _interopRequireDefault(_processPattern);
+
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+function CopyWebpackPlugin() {
+ var patterns = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
+
+ if (!Array.isArray(patterns)) {
+ throw new Error('[copy-webpack-plugin] patterns must be an array');
+ }
+
+ // Defaults debug level to 'warning'
+ options.debug = options.debug || 'warning';
+
+ // Defaults debugging to info if only true is specified
+ if (options.debug === true) {
+ options.debug = 'info';
+ }
+
+ var debugLevels = ['warning', 'info', 'debug'];
+ var debugLevelIndex = debugLevels.indexOf(options.debug);
+ function log(msg, level) {
+ if (level === 0) {
+ msg = 'WARNING - ' + msg;
+ } else {
+ level = level || 1;
+ }
+ if (level <= debugLevelIndex) {
+ console.log('[copy-webpack-plugin] ' + msg); // eslint-disable-line no-console
+ }
+ }
+
+ function warning(msg) {
+ log(msg, 0);
+ }
+
+ function info(msg) {
+ log(msg, 1);
+ }
+
+ function debug(msg) {
+ log(msg, 2);
+ }
+
+ var apply = function apply(compiler) {
+ var fileDependencies = void 0;
+ var contextDependencies = void 0;
+ var written = {};
+
+ var context = void 0;
+
+ if (!options.context) {
+ context = compiler.options.context;
+ } else if (!_path2.default.isAbsolute(options.context)) {
+ context = _path2.default.join(compiler.options.context, options.context);
+ } else {
+ context = options.context;
+ }
+
+ var emit = function emit(compilation, cb) {
+ debug('starting emit');
+ var callback = function callback() {
+ debug('finishing emit');
+ cb();
+ };
+
+ fileDependencies = [];
+ contextDependencies = [];
+
+ var globalRef = {
+ info: info,
+ debug: debug,
+ warning: warning,
+ compilation: compilation,
+ written: written,
+ fileDependencies: fileDependencies,
+ contextDependencies: contextDependencies,
+ context: context,
+ inputFileSystem: compiler.inputFileSystem,
+ output: compiler.options.output.path,
+ ignore: options.ignore || [],
+ copyUnmodified: options.copyUnmodified,
+ concurrency: options.concurrency
+ };
+
+ if (globalRef.output === '/' && compiler.options.devServer && compiler.options.devServer.outputPath) {
+ globalRef.output = compiler.options.devServer.outputPath;
+ }
+
+ var tasks = [];
+
+ patterns.forEach(function (pattern) {
+ tasks.push(Promise.resolve().then(function () {
+ return (0, _preProcessPattern2.default)(globalRef, pattern);
+ })
+ // Every source (from) is assumed to exist here
+ .then(function (pattern) {
+ return (0, _processPattern2.default)(globalRef, pattern);
+ }));
+ });
+
+ Promise.all(tasks).catch(function (err) {
+ compilation.errors.push(err);
+ }).then(function () {
+ return callback();
+ });
+ };
+
+ var afterEmit = function afterEmit(compilation, cb) {
+ debug('starting after-emit');
+ var callback = function callback() {
+ debug('finishing after-emit');
+ cb();
+ };
+
+ var compilationFileDependencies = void 0;
+ var addFileDependency = void 0;
+ if (Array.isArray(compilation.fileDependencies)) {
+ compilationFileDependencies = new Set(compilation.fileDependencies);
+ addFileDependency = function addFileDependency(file) {
+ return compilation.fileDependencies.push(file);
+ };
+ } else {
+ compilationFileDependencies = compilation.fileDependencies;
+ addFileDependency = function addFileDependency(file) {
+ return compilation.fileDependencies.add(file);
+ };
+ }
+
+ var compilationContextDependencies = void 0;
+ var addContextDependency = void 0;
+ if (Array.isArray(compilation.contextDependencies)) {
+ compilationContextDependencies = new Set(compilation.contextDependencies);
+ addContextDependency = function addContextDependency(file) {
+ return compilation.contextDependencies.push(file);
+ };
+ } else {
+ compilationContextDependencies = compilation.contextDependencies;
+ addContextDependency = function addContextDependency(file) {
+ return compilation.contextDependencies.add(file);
+ };
+ }
+
+ // Add file dependencies if they're not already tracked
+ var _iteratorNormalCompletion = true;
+ var _didIteratorError = false;
+ var _iteratorError = undefined;
+
+ try {
+ for (var _iterator = fileDependencies[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
+ var file = _step.value;
+
+ if (compilationFileDependencies.has(file)) {
+ debug('not adding ' + file + ' to change tracking, because it\'s already tracked');
+ } else {
+ debug('adding ' + file + ' to change tracking');
+ addFileDependency(file);
+ }
+ }
+
+ // Add context dependencies if they're not already tracked
+ } catch (err) {
+ _didIteratorError = true;
+ _iteratorError = err;
+ } finally {
+ try {
+ if (!_iteratorNormalCompletion && _iterator.return) {
+ _iterator.return();
+ }
+ } finally {
+ if (_didIteratorError) {
+ throw _iteratorError;
+ }
+ }
+ }
+
+ var _iteratorNormalCompletion2 = true;
+ var _didIteratorError2 = false;
+ var _iteratorError2 = undefined;
+
+ try {
+ for (var _iterator2 = contextDependencies[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
+ var _context = _step2.value;
+
+ if (compilationContextDependencies.has(_context)) {
+ debug('not adding ' + _context + ' to change tracking, because it\'s already tracked');
+ } else {
+ debug('adding ' + _context + ' to change tracking');
+ addContextDependency(_context);
+ }
+ }
+ } catch (err) {
+ _didIteratorError2 = true;
+ _iteratorError2 = err;
+ } finally {
+ try {
+ if (!_iteratorNormalCompletion2 && _iterator2.return) {
+ _iterator2.return();
+ }
+ } finally {
+ if (_didIteratorError2) {
+ throw _iteratorError2;
+ }
+ }
+ }
+
+ callback();
+ };
+
+ if (compiler.hooks) {
+ var plugin = { name: 'CopyPlugin' };
+
+ compiler.hooks.emit.tapAsync(plugin, emit);
+ compiler.hooks.afterEmit.tapAsync(plugin, afterEmit);
+ } else {
+ compiler.plugin('emit', emit);
+ compiler.plugin('after-emit', afterEmit);
+ }
+ };
+
+ return {
+ apply: apply
+ };
+}
+
+CopyWebpackPlugin['default'] = CopyWebpackPlugin;
+module.exports = CopyWebpackPlugin; \ No newline at end of file
diff --git a/node_modules/copy-webpack-plugin/dist/preProcessPattern.js b/node_modules/copy-webpack-plugin/dist/preProcessPattern.js
new file mode 100644
index 00000000..fb381397
--- /dev/null
+++ b/node_modules/copy-webpack-plugin/dist/preProcessPattern.js
@@ -0,0 +1,139 @@
+'use strict';
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.default = preProcessPattern;
+
+var _path = require('path');
+
+var _path2 = _interopRequireDefault(_path);
+
+var _isGlob = require('is-glob');
+
+var _isGlob2 = _interopRequireDefault(_isGlob);
+
+var _escape = require('./utils/escape');
+
+var _escape2 = _interopRequireDefault(_escape);
+
+var _isObject = require('./utils/isObject');
+
+var _isObject2 = _interopRequireDefault(_isObject);
+
+var _promisify = require('./utils/promisify');
+
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+// https://www.debuggex.com/r/VH2yS2mvJOitiyr3
+var isTemplateLike = /(\[ext\])|(\[name\])|(\[path\])|(\[folder\])|(\[emoji(:\d+)?\])|(\[(\w+:)?hash(:\w+)?(:\d+)?\])|(\[\d+\])/;
+
+function preProcessPattern(globalRef, pattern) {
+ var info = globalRef.info,
+ debug = globalRef.debug,
+ warning = globalRef.warning,
+ context = globalRef.context,
+ inputFileSystem = globalRef.inputFileSystem,
+ fileDependencies = globalRef.fileDependencies,
+ contextDependencies = globalRef.contextDependencies,
+ compilation = globalRef.compilation;
+
+
+ pattern = typeof pattern === 'string' ? {
+ from: pattern
+ } : Object.assign({}, pattern);
+ pattern.to = pattern.to || '';
+ pattern.context = pattern.context || context;
+ if (!_path2.default.isAbsolute(pattern.context)) {
+ pattern.context = _path2.default.join(context, pattern.context);
+ }
+ pattern.ignore = globalRef.ignore.concat(pattern.ignore || []);
+
+ info('processing from: \'' + pattern.from + '\' to: \'' + pattern.to + '\'');
+
+ switch (true) {
+ case !!pattern.toType:
+ // if toType already exists
+ break;
+ case isTemplateLike.test(pattern.to):
+ pattern.toType = 'template';
+ break;
+ case _path2.default.extname(pattern.to) === '' || pattern.to.slice(-1) === '/':
+ pattern.toType = 'dir';
+ break;
+ default:
+ pattern.toType = 'file';
+ }
+
+ debug('determined \'' + pattern.to + '\' is a \'' + pattern.toType + '\'');
+
+ // If we know it's a glob, then bail early
+ if ((0, _isObject2.default)(pattern.from) && pattern.from.glob) {
+ pattern.fromType = 'glob';
+
+ var fromArgs = Object.assign({}, pattern.from);
+ delete fromArgs.glob;
+
+ pattern.fromArgs = fromArgs;
+ pattern.glob = (0, _escape2.default)(pattern.context, pattern.from.glob);
+ pattern.absoluteFrom = _path2.default.resolve(pattern.context, pattern.from.glob);
+ return Promise.resolve(pattern);
+ }
+
+ if (_path2.default.isAbsolute(pattern.from)) {
+ pattern.absoluteFrom = pattern.from;
+ } else {
+ pattern.absoluteFrom = _path2.default.resolve(pattern.context, pattern.from);
+ }
+
+ debug('determined \'' + pattern.from + '\' to be read from \'' + pattern.absoluteFrom + '\'');
+
+ var noStatsHandler = function noStatsHandler() {
+ // If from doesn't appear to be a glob, then log a warning
+ if ((0, _isGlob2.default)(pattern.from) || pattern.from.indexOf('*') !== -1) {
+ pattern.fromType = 'glob';
+ pattern.glob = (0, _escape2.default)(pattern.context, pattern.from);
+ } else {
+ var msg = 'unable to locate \'' + pattern.from + '\' at \'' + pattern.absoluteFrom + '\'';
+ var warningMsg = '[copy-webpack-plugin] ' + msg;
+ // only display the same message once
+ if (compilation.errors.indexOf(warningMsg) === -1) {
+ warning(msg);
+ compilation.errors.push(warningMsg);
+ }
+
+ pattern.fromType = 'nonexistent';
+ }
+ };
+
+ return (0, _promisify.stat)(inputFileSystem, pattern.absoluteFrom).catch(function () {
+ return noStatsHandler();
+ }).then(function (stat) {
+ if (!stat) {
+ noStatsHandler();
+ return pattern;
+ }
+
+ if (stat.isDirectory()) {
+ pattern.fromType = 'dir';
+ pattern.context = pattern.absoluteFrom;
+ contextDependencies.push(pattern.absoluteFrom);
+ pattern.glob = (0, _escape2.default)(pattern.absoluteFrom, '**/*');
+ pattern.absoluteFrom = _path2.default.join(pattern.absoluteFrom, '**/*');
+ pattern.fromArgs = {
+ dot: true
+ };
+ } else if (stat.isFile()) {
+ pattern.fromType = 'file';
+ pattern.context = _path2.default.dirname(pattern.absoluteFrom);
+ pattern.glob = (0, _escape2.default)(pattern.absoluteFrom);
+ pattern.fromArgs = {
+ dot: true
+ };
+ fileDependencies.push(pattern.absoluteFrom);
+ } else if (!pattern.fromType) {
+ info('Unrecognized file type for ' + pattern.from);
+ }
+ return pattern;
+ });
+} \ No newline at end of file
diff --git a/node_modules/copy-webpack-plugin/dist/processPattern.js b/node_modules/copy-webpack-plugin/dist/processPattern.js
new file mode 100644
index 00000000..c2ac6a94
--- /dev/null
+++ b/node_modules/copy-webpack-plugin/dist/processPattern.js
@@ -0,0 +1,138 @@
+'use strict';
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.default = processPattern;
+
+var _globby = require('globby');
+
+var _globby2 = _interopRequireDefault(_globby);
+
+var _pLimit = require('p-limit');
+
+var _pLimit2 = _interopRequireDefault(_pLimit);
+
+var _isGlob = require('is-glob');
+
+var _isGlob2 = _interopRequireDefault(_isGlob);
+
+var _path = require('path');
+
+var _path2 = _interopRequireDefault(_path);
+
+var _minimatch = require('minimatch');
+
+var _minimatch2 = _interopRequireDefault(_minimatch);
+
+var _writeFile = require('./writeFile');
+
+var _writeFile2 = _interopRequireDefault(_writeFile);
+
+var _isObject = require('./utils/isObject');
+
+var _isObject2 = _interopRequireDefault(_isObject);
+
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+function processPattern(globalRef, pattern) {
+ var info = globalRef.info,
+ debug = globalRef.debug,
+ output = globalRef.output,
+ concurrency = globalRef.concurrency,
+ contextDependencies = globalRef.contextDependencies;
+
+ var globArgs = Object.assign({
+ cwd: pattern.context
+ }, pattern.fromArgs || {});
+
+ if (pattern.fromType === 'nonexistent') {
+ return Promise.resolve();
+ }
+
+ var limit = (0, _pLimit2.default)(concurrency || 100);
+
+ info('begin globbing \'' + pattern.glob + '\' with a context of \'' + pattern.context + '\'');
+ return (0, _globby2.default)(pattern.glob, globArgs).then(function (paths) {
+ return Promise.all(paths.map(function (from) {
+ return limit(function () {
+ var file = {
+ force: pattern.force,
+ absoluteFrom: _path2.default.resolve(pattern.context, from)
+ };
+ file.relativeFrom = _path2.default.relative(pattern.context, file.absoluteFrom);
+
+ if (pattern.flatten) {
+ file.relativeFrom = _path2.default.basename(file.relativeFrom);
+ }
+
+ // This is so webpack is able to watch the directory and when
+ // a new file is added it triggeres a rebuild
+ var contextPath = _path2.default.dirname(_path2.default.resolve(from));
+ if (contextDependencies.indexOf(contextPath) === -1 && (0, _isGlob2.default)(pattern.glob)) {
+ contextDependencies.push(contextPath);
+ }
+
+ debug('found ' + from);
+
+ // Check the ignore list
+ var il = pattern.ignore.length;
+ while (il--) {
+ var ignoreGlob = pattern.ignore[il];
+
+ var globParams = {
+ dot: true,
+ matchBase: true
+ };
+
+ var glob = void 0;
+ if (typeof ignoreGlob === 'string') {
+ glob = ignoreGlob;
+ } else if ((0, _isObject2.default)(ignoreGlob)) {
+ glob = ignoreGlob.glob || '';
+ var ignoreGlobParams = Object.assign({}, ignoreGlob);
+ delete ignoreGlobParams.glob;
+
+ // Overwrite minimatch defaults
+ globParams = Object.assign(globParams, ignoreGlobParams);
+ } else {
+ glob = '';
+ }
+
+ debug('testing ' + glob + ' against ' + file.relativeFrom);
+ if ((0, _minimatch2.default)(file.relativeFrom, glob, globParams)) {
+ info('ignoring \'' + file.relativeFrom + '\', because it matches the ignore glob \'' + glob + '\'');
+ return Promise.resolve();
+ } else {
+ debug(glob + ' doesn\'t match ' + file.relativeFrom);
+ }
+ }
+
+ // Change the to path to be relative for webpack
+ if (pattern.toType === 'dir') {
+ file.webpackTo = _path2.default.join(pattern.to, file.relativeFrom);
+ } else if (pattern.toType === 'file') {
+ file.webpackTo = pattern.to || file.relativeFrom;
+ } else if (pattern.toType === 'template') {
+ file.webpackTo = pattern.to;
+ file.webpackToRegExp = pattern.test;
+ }
+
+ if (_path2.default.isAbsolute(file.webpackTo)) {
+ if (output === '/') {
+ throw '[copy-webpack-plugin] Using older versions of webpack-dev-server, devServer.outputPath must be defined to write to absolute paths';
+ }
+
+ file.webpackTo = _path2.default.relative(output, file.webpackTo);
+ }
+
+ // ensure forward slashes
+ file.webpackTo = file.webpackTo.replace(/\\/g, '/');
+
+ info('determined that \'' + from + '\' should write to \'' + file.webpackTo + '\'');
+
+ return (0, _writeFile2.default)(globalRef, pattern, file);
+ });
+ }));
+ });
+} \ No newline at end of file
diff --git a/node_modules/copy-webpack-plugin/dist/utils/escape.js b/node_modules/copy-webpack-plugin/dist/utils/escape.js
new file mode 100644
index 00000000..ac900b69
--- /dev/null
+++ b/node_modules/copy-webpack-plugin/dist/utils/escape.js
@@ -0,0 +1,35 @@
+'use strict';
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.default = escape;
+
+var _path = require('path');
+
+var _path2 = _interopRequireDefault(_path);
+
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+function escape(context, from) {
+ if (from && _path2.default.isAbsolute(from)) {
+ return from;
+ } else {
+ // Ensure context is escaped before globbing
+ // Handles special characters in paths
+ var absoluteContext = _path2.default.resolve(context).replace(/[\*|\?|\!|\(|\)|\[|\]|\{|\}]/g, function (substring) {
+ return '[' + substring + ']';
+ });
+
+ if (!from) {
+ return absoluteContext;
+ }
+
+ // Cannot use path.join/resolve as it "fixes" the path separators
+ if (absoluteContext.endsWith('/')) {
+ return '' + absoluteContext + from;
+ } else {
+ return absoluteContext + '/' + from;
+ }
+ }
+} \ No newline at end of file
diff --git a/node_modules/copy-webpack-plugin/dist/utils/isObject.js b/node_modules/copy-webpack-plugin/dist/utils/isObject.js
new file mode 100644
index 00000000..e033557d
--- /dev/null
+++ b/node_modules/copy-webpack-plugin/dist/utils/isObject.js
@@ -0,0 +1,9 @@
+'use strict';
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+
+exports.default = function (val) {
+ return Object.prototype.toString.call(val) === '[object Object]' ? true : false;
+}; \ No newline at end of file
diff --git a/node_modules/copy-webpack-plugin/dist/utils/promisify.js b/node_modules/copy-webpack-plugin/dist/utils/promisify.js
new file mode 100644
index 00000000..a49fc55b
--- /dev/null
+++ b/node_modules/copy-webpack-plugin/dist/utils/promisify.js
@@ -0,0 +1,26 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+var stat = exports.stat = function stat(inputFileSystem, path) {
+ return new Promise(function (resolve, reject) {
+ inputFileSystem.stat(path, function (err, stats) {
+ if (err) {
+ reject(err);
+ }
+ resolve(stats);
+ });
+ });
+};
+
+var readFile = exports.readFile = function readFile(inputFileSystem, path) {
+ return new Promise(function (resolve, reject) {
+ inputFileSystem.readFile(path, function (err, stats) {
+ if (err) {
+ reject(err);
+ }
+ resolve(stats);
+ });
+ });
+}; \ No newline at end of file
diff --git a/node_modules/copy-webpack-plugin/dist/utils/readFilePromise.js b/node_modules/copy-webpack-plugin/dist/utils/readFilePromise.js
new file mode 100644
index 00000000..cc266272
--- /dev/null
+++ b/node_modules/copy-webpack-plugin/dist/utils/readFilePromise.js
@@ -0,0 +1,17 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+
+exports.default = function (inputFileSystem, path) {
+ return new Promise(function (resolve, reject) {
+ inputFileSystem.readFile(path, function (err, stats) {
+ if (err) {
+ return reject(err);
+ }
+
+ return resolve(stats);
+ });
+ });
+}; \ No newline at end of file
diff --git a/node_modules/copy-webpack-plugin/dist/utils/readPromise.js b/node_modules/copy-webpack-plugin/dist/utils/readPromise.js
new file mode 100644
index 00000000..cc266272
--- /dev/null
+++ b/node_modules/copy-webpack-plugin/dist/utils/readPromise.js
@@ -0,0 +1,17 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+
+exports.default = function (inputFileSystem, path) {
+ return new Promise(function (resolve, reject) {
+ inputFileSystem.readFile(path, function (err, stats) {
+ if (err) {
+ return reject(err);
+ }
+
+ return resolve(stats);
+ });
+ });
+}; \ No newline at end of file
diff --git a/node_modules/copy-webpack-plugin/dist/utils/statPromise.js b/node_modules/copy-webpack-plugin/dist/utils/statPromise.js
new file mode 100644
index 00000000..4f421bfb
--- /dev/null
+++ b/node_modules/copy-webpack-plugin/dist/utils/statPromise.js
@@ -0,0 +1,17 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+
+exports.default = function (inputFileSystem, path) {
+ return new Promise(function (resolve, reject) {
+ inputFileSystem.stat(path, function (err, stats) {
+ if (err) {
+ return reject(err);
+ }
+
+ return resolve(stats);
+ });
+ });
+}; \ No newline at end of file
diff --git a/node_modules/copy-webpack-plugin/dist/writeFile.js b/node_modules/copy-webpack-plugin/dist/writeFile.js
new file mode 100644
index 00000000..fc3dc10a
--- /dev/null
+++ b/node_modules/copy-webpack-plugin/dist/writeFile.js
@@ -0,0 +1,153 @@
+'use strict';
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.default = writeFile;
+
+var _loaderUtils = require('loader-utils');
+
+var _loaderUtils2 = _interopRequireDefault(_loaderUtils);
+
+var _path = require('path');
+
+var _path2 = _interopRequireDefault(_path);
+
+var _cacache = require('cacache');
+
+var _cacache2 = _interopRequireDefault(_cacache);
+
+var _serializeJavascript = require('serialize-javascript');
+
+var _serializeJavascript2 = _interopRequireDefault(_serializeJavascript);
+
+var _package = require('../package.json');
+
+var _findCacheDir = require('find-cache-dir');
+
+var _findCacheDir2 = _interopRequireDefault(_findCacheDir);
+
+var _promisify = require('./utils/promisify');
+
+var _crypto = require('crypto');
+
+var _crypto2 = _interopRequireDefault(_crypto);
+
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+function writeFile(globalRef, pattern, file) {
+ var info = globalRef.info,
+ debug = globalRef.debug,
+ compilation = globalRef.compilation,
+ fileDependencies = globalRef.fileDependencies,
+ written = globalRef.written,
+ inputFileSystem = globalRef.inputFileSystem,
+ copyUnmodified = globalRef.copyUnmodified;
+
+
+ return (0, _promisify.stat)(inputFileSystem, file.absoluteFrom).then(function (stat) {
+ // We don't write empty directories
+ if (stat.isDirectory()) {
+ return;
+ }
+
+ // If this came from a glob, add it to the file watchlist
+ if (pattern.fromType === 'glob') {
+ fileDependencies.push(file.absoluteFrom);
+ }
+
+ info('reading ' + file.absoluteFrom + ' to write to assets');
+ return (0, _promisify.readFile)(inputFileSystem, file.absoluteFrom).then(function (content) {
+ if (pattern.transform) {
+ var transform = function transform(content, absoluteFrom) {
+ return pattern.transform(content, absoluteFrom);
+ };
+
+ if (pattern.cache) {
+ if (!globalRef.cacheDir) {
+ globalRef.cacheDir = (0, _findCacheDir2.default)({ name: 'copy-webpack-plugin' });
+ }
+
+ var cacheKey = pattern.cache.key ? pattern.cache.key : (0, _serializeJavascript2.default)({
+ name: _package.name,
+ version: _package.version,
+ pattern: pattern,
+ hash: _crypto2.default.createHash('md4').update(content).digest('hex')
+ });
+
+ return _cacache2.default.get(globalRef.cacheDir, cacheKey).then(function (result) {
+ return result.data;
+ }, function () {
+ return Promise.resolve().then(function () {
+ return transform(content, file.absoluteFrom);
+ }).then(function (content) {
+ return _cacache2.default.put(globalRef.cacheDir, cacheKey, content).then(function () {
+ return content;
+ });
+ });
+ });
+ }
+
+ content = transform(content, file.absoluteFrom);
+ }
+
+ return content;
+ }).then(function (content) {
+ if (pattern.toType === 'template') {
+ info('interpolating template \'' + file.webpackTo + '\' for \'' + file.relativeFrom + '\'');
+
+ // If it doesn't have an extension, remove it from the pattern
+ // ie. [name].[ext] or [name][ext] both become [name]
+ if (!_path2.default.extname(file.relativeFrom)) {
+ file.webpackTo = file.webpackTo.replace(/\.?\[ext\]/g, '');
+ }
+
+ file.webpackTo = _loaderUtils2.default.interpolateName({ resourcePath: file.absoluteFrom }, file.webpackTo, {
+ content: content,
+ regExp: file.webpackToRegExp,
+ context: pattern.context
+ });
+ }
+
+ return content;
+ }).then(function (content) {
+ if (pattern.transformPath) {
+ return Promise.resolve(pattern.transformPath(file.webpackTo, file.absoluteFrom)).then(function (newPath) {
+ file.webpackTo = newPath;
+ }).then(function () {
+ return content;
+ });
+ }
+
+ return content;
+ }).then(function (content) {
+ var hash = _loaderUtils2.default.getHashDigest(content);
+
+ if (!copyUnmodified && written[file.absoluteFrom] && written[file.absoluteFrom]['hash'] === hash && written[file.absoluteFrom]['webpackTo'] === file.webpackTo) {
+ info('skipping \'' + file.webpackTo + '\', because it hasn\'t changed');
+ return;
+ } else {
+ debug('added ' + hash + ' to written tracking for \'' + file.absoluteFrom + '\'');
+ written[file.absoluteFrom] = {
+ hash: hash,
+ webpackTo: file.webpackTo
+ };
+ }
+
+ if (compilation.assets[file.webpackTo] && !file.force) {
+ info('skipping \'' + file.webpackTo + '\', because it already exists');
+ return;
+ }
+
+ info('writing \'' + file.webpackTo + '\' to compilation assets from \'' + file.absoluteFrom + '\'');
+ compilation.assets[file.webpackTo] = {
+ size: function size() {
+ return stat.size;
+ },
+ source: function source() {
+ return content;
+ }
+ };
+ });
+ });
+} \ No newline at end of file