npm and error messages

This commit is contained in:
2018-10-27 03:51:47 -05:00
parent 692ab70565
commit 025a403027
29601 changed files with 2759363 additions and 14 deletions

View File

@@ -0,0 +1,64 @@
'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-multi-assign */
var _ExtractedModule = require('./ExtractedModule');
var _ExtractedModule2 = _interopRequireDefault(_ExtractedModule);
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 ExtractTextPluginCompilation = function () {
function ExtractTextPluginCompilation() {
_classCallCheck(this, ExtractTextPluginCompilation);
this.modulesByIdentifier = {};
}
_createClass(ExtractTextPluginCompilation, [{
key: 'addModule',
value: function addModule(identifier, originalModule, source, additionalInformation, sourceMap, prevModules) {
var m = void 0;
if (!this.modulesByIdentifier[identifier]) {
m = this.modulesByIdentifier[identifier] = new _ExtractedModule2.default(identifier, originalModule, source, sourceMap, additionalInformation, prevModules);
} else {
m = this.modulesByIdentifier[identifier];
m.addPrevModules(prevModules);
if (originalModule.index2 < m.getOriginalModule().index2) {
m.setOriginalModule(originalModule);
}
}
return m;
}
}, {
key: 'addResultToChunk',
value: function addResultToChunk(identifier, result, originalModule, extractedChunk) {
var _this = this;
if (!Array.isArray(result)) {
result = [[identifier, result]];
}
var counterMap = {};
var prevModules = [];
result.forEach(function (item) {
var c = counterMap[item[0]];
var module = _this.addModule.call(_this, item[0] + (c || ''), originalModule, item[1], item[2], item[3], prevModules.slice());
extractedChunk.addModule(module);
module.addChunk(extractedChunk);
counterMap[item[0]] = (c || 0) + 1;
prevModules.push(module);
}, this);
}
}]);
return ExtractTextPluginCompilation;
}();
exports.default = ExtractTextPluginCompilation;

View File

@@ -0,0 +1,100 @@
'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 _webpackSources = require('webpack-sources');
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var ExtractedModule = function () {
function ExtractedModule(identifier, originalModule, source, sourceMap, addtitionalInformation, prevModules) {
_classCallCheck(this, ExtractedModule);
this._identifier = identifier;
this._originalModule = originalModule;
this._source = source;
this._sourceMap = sourceMap;
this._prevModules = prevModules;
this.addtitionalInformation = addtitionalInformation;
this.chunks = [];
}
_createClass(ExtractedModule, [{
key: 'getOrder',
value: function getOrder() {
// http://stackoverflow.com/a/14676665/1458162
return (/^@import url/.test(this._source) ? 0 : 1
);
}
}, {
key: 'addChunk',
value: function addChunk(chunk) {
var idx = this.chunks.indexOf(chunk);
if (idx < 0) {
this.chunks.push(chunk);
}
}
}, {
key: 'removeChunk',
value: function removeChunk(chunk) {
var idx = this.chunks.indexOf(chunk);
if (idx >= 0) {
this.chunks.splice(idx, 1);
chunk.removeModule(this);
return true;
}
return false;
}
}, {
key: 'rewriteChunkInReasons',
value: function rewriteChunkInReasons(oldChunk, newChunks) {} // eslint-disable-line
}, {
key: 'identifier',
value: function identifier() {
return this._identifier;
}
}, {
key: 'source',
value: function source() {
if (this._sourceMap) {
return new _webpackSources.SourceMapSource(this._source, null, this._sourceMap);
}
return new _webpackSources.RawSource(this._source);
}
}, {
key: 'getOriginalModule',
value: function getOriginalModule() {
return this._originalModule;
}
}, {
key: 'getPrevModules',
value: function getPrevModules() {
return this._prevModules;
}
}, {
key: 'addPrevModules',
value: function addPrevModules(prevModules) {
var _this = this;
prevModules.forEach(function (m) {
if (_this._prevModules.indexOf(m) < 0) {
_this._prevModules.push(m);
}
}, this);
}
}, {
key: 'setOriginalModule',
value: function setOriginalModule(originalModule) {
this._originalModule = originalModule;
}
}]);
return ExtractedModule;
}();
exports.default = ExtractedModule;

View File

@@ -0,0 +1,16 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
function OrderUndefinedError(module) {
Error.call(this);
Error.captureStackTrace(this, OrderUndefinedError);
this.name = 'OrderUndefinedError';
this.message = 'Order in extracted chunk undefined';
this.module = module;
}
exports.default = OrderUndefinedError;
OrderUndefinedError.prototype = Object.create(Error.prototype);

View File

@@ -0,0 +1,69 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.isInitialOrHasNoParents = isInitialOrHasNoParents;
exports.isInvalidOrder = isInvalidOrder;
exports.getOrder = getOrder;
exports.getLoaderObject = getLoaderObject;
exports.mergeOptions = mergeOptions;
exports.isString = isString;
exports.isFunction = isFunction;
exports.isType = isType;
function isInitialOrHasNoParents(chunk) {
return chunk.isInitial() || chunk.parents.length === 0;
}
function isInvalidOrder(a, b) {
var bBeforeA = a.getPrevModules().indexOf(b) >= 0;
var aBeforeB = b.getPrevModules().indexOf(a) >= 0;
return aBeforeB && bBeforeA;
}
function getOrder(a, b) {
var aOrder = a.getOrder();
var bOrder = b.getOrder();
if (aOrder < bOrder) return -1;
if (aOrder > bOrder) return 1;
var aIndex = a.getOriginalModule().index2;
var bIndex = b.getOriginalModule().index2;
if (aIndex < bIndex) return -1;
if (aIndex > bIndex) return 1;
var bBeforeA = a.getPrevModules().indexOf(b) >= 0;
var aBeforeB = b.getPrevModules().indexOf(a) >= 0;
if (aBeforeB && !bBeforeA) return -1;
if (!aBeforeB && bBeforeA) return 1;
var ai = a.identifier();
var bi = b.identifier();
if (ai < bi) return -1;
if (ai > bi) return 1;
return 0;
}
function getLoaderObject(loader) {
if (isString(loader)) {
return { loader };
}
return loader;
}
function mergeOptions(a, b) {
if (!b) return a;
Object.keys(b).forEach(function (key) {
a[key] = b[key];
});
return a;
}
function isString(a) {
return typeof a === 'string';
}
function isFunction(a) {
return typeof a === 'function';
}
function isType(type, obj) {
return Object.prototype.toString.call(obj) === `[object ${type}]`;
}