mirror of
https://github.com/tenrok/axios.git
synced 2026-05-15 11:59:42 +03:00
Fixed missed minified builds; (#4805)
* Fixed missed minified builds; Refactored utils.js; Refactored `utils.isStandardBrowserEnv()` as a `platform/browser` property; Added builds size log; * Replaced `rollup-plugin-filesize` with `rollup-plugin-bundle-size`; Co-authored-by: Jay <jasonsaayman@gmail.com>
This commit is contained in:
+2
-2
@@ -58,7 +58,7 @@ export default function xhrAdapter(config) {
|
||||
}
|
||||
}
|
||||
|
||||
if (utils.isFormData(requestData) && utils.isStandardBrowserEnv()) {
|
||||
if (utils.isFormData(requestData) && platform.isStandardBrowserEnv) {
|
||||
requestHeaders.setContentType(false); // Let the browser set it
|
||||
}
|
||||
|
||||
@@ -174,7 +174,7 @@ export default function xhrAdapter(config) {
|
||||
// Add xsrf header
|
||||
// This is only done if running in a standard browser environment.
|
||||
// Specifically not if we're in a web worker, or react-native.
|
||||
if (utils.isStandardBrowserEnv()) {
|
||||
if (platform.isStandardBrowserEnv) {
|
||||
// Add xsrf header
|
||||
const xsrfValue = (config.withCredentials || isURLSameOrigin(fullPath))
|
||||
&& config.xsrfCookieName && cookies.read(config.xsrfCookieName);
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
'use strict';
|
||||
|
||||
import utils from './../utils.js';
|
||||
import platform from '../platform/index.js';
|
||||
|
||||
export default utils.isStandardBrowserEnv() ?
|
||||
export default platform.isStandardBrowserEnv ?
|
||||
|
||||
// Standard browser envs support document.cookie
|
||||
(function standardBrowserEnv() {
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
'use strict';
|
||||
|
||||
import utils from './../utils.js';
|
||||
import platform from '../platform/index.js';
|
||||
|
||||
export default utils.isStandardBrowserEnv() ?
|
||||
export default platform.isStandardBrowserEnv ?
|
||||
|
||||
// Standard browser envs have full support of the APIs needed to test
|
||||
// whether the request URL is of the same origin as current location.
|
||||
|
||||
@@ -1,6 +1,36 @@
|
||||
import URLSearchParams from './classes/URLSearchParams.js'
|
||||
import FormData from './classes/FormData.js'
|
||||
|
||||
/**
|
||||
* Determine if we're running in a standard browser environment
|
||||
*
|
||||
* This allows axios to run in a web worker, and react-native.
|
||||
* Both environments support XMLHttpRequest, but not fully standard globals.
|
||||
*
|
||||
* web workers:
|
||||
* typeof window -> undefined
|
||||
* typeof document -> undefined
|
||||
*
|
||||
* react-native:
|
||||
* navigator.product -> 'ReactNative'
|
||||
* nativescript
|
||||
* navigator.product -> 'NativeScript' or 'NS'
|
||||
*
|
||||
* @returns {boolean}
|
||||
*/
|
||||
const isStandardBrowserEnv = (() => {
|
||||
let product;
|
||||
if (typeof navigator !== 'undefined' && (
|
||||
(product = navigator.product) === 'ReactNative' ||
|
||||
product === 'NativeScript' ||
|
||||
product === 'NS')
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return typeof window !== 'undefined' && typeof document !== 'undefined';
|
||||
})();
|
||||
|
||||
export default {
|
||||
isBrowser: true,
|
||||
classes: {
|
||||
@@ -8,5 +38,6 @@ export default {
|
||||
FormData,
|
||||
Blob
|
||||
},
|
||||
isStandardBrowserEnv,
|
||||
protocols: ['http', 'https', 'file', 'blob', 'url', 'data']
|
||||
};
|
||||
|
||||
+36
-89
@@ -4,29 +4,20 @@ import bind from './helpers/bind.js';
|
||||
|
||||
// utils is a library of generic helper functions non-specific to axios
|
||||
|
||||
const toString = Object.prototype.toString;
|
||||
const {toString} = Object.prototype;
|
||||
const {getPrototypeOf} = Object;
|
||||
|
||||
// eslint-disable-next-line func-names
|
||||
const kindOf = (cache => {
|
||||
// eslint-disable-next-line func-names
|
||||
return thing => {
|
||||
const kindOf = (cache => thing => {
|
||||
const str = toString.call(thing);
|
||||
return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase());
|
||||
};
|
||||
})(Object.create(null));
|
||||
|
||||
function kindOfTest(type) {
|
||||
const kindOfTest = (type) => {
|
||||
type = type.toLowerCase();
|
||||
return function isKindOf(thing) {
|
||||
return kindOf(thing) === type;
|
||||
};
|
||||
return (thing) => kindOf(thing) === type
|
||||
}
|
||||
|
||||
function typeOfTest(type) {
|
||||
return thing => {
|
||||
return typeof thing === type;
|
||||
};
|
||||
}
|
||||
const typeOfTest = type => thing => typeof thing === type;
|
||||
|
||||
/**
|
||||
* Determine if a value is an Array
|
||||
@@ -35,9 +26,7 @@ function typeOfTest(type) {
|
||||
*
|
||||
* @returns {boolean} True if value is an Array, otherwise false
|
||||
*/
|
||||
function isArray(val) {
|
||||
return Array.isArray(val);
|
||||
}
|
||||
const {isArray} = Array;
|
||||
|
||||
/**
|
||||
* Determine if a value is undefined
|
||||
@@ -57,7 +46,7 @@ const isUndefined = typeOfTest('undefined');
|
||||
*/
|
||||
function isBuffer(val) {
|
||||
return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor)
|
||||
&& typeof val.constructor.isBuffer === 'function' && val.constructor.isBuffer(val);
|
||||
&& isFunction(val.constructor.isBuffer) && val.constructor.isBuffer(val);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -120,9 +109,7 @@ const isNumber = typeOfTest('number');
|
||||
*
|
||||
* @returns {boolean} True if value is an Object, otherwise false
|
||||
*/
|
||||
function isObject(thing) {
|
||||
return thing !== null && typeof thing === 'object';
|
||||
}
|
||||
const isObject = (thing) => thing !== null && typeof thing === 'object';
|
||||
|
||||
/**
|
||||
* Determine if a value is a Boolean
|
||||
@@ -130,9 +117,7 @@ function isObject(thing) {
|
||||
* @param {*} thing The value to test
|
||||
* @returns {boolean} True if value is a Boolean, otherwise false
|
||||
*/
|
||||
const isBoolean = thing => {
|
||||
return thing === true || thing === false;
|
||||
};
|
||||
const isBoolean = thing => thing === true || thing === false;
|
||||
|
||||
/**
|
||||
* Determine if a value is a plain Object
|
||||
@@ -141,12 +126,12 @@ const isBoolean = thing => {
|
||||
*
|
||||
* @returns {boolean} True if value is a plain Object, otherwise false
|
||||
*/
|
||||
function isPlainObject(val) {
|
||||
const isPlainObject = (val) => {
|
||||
if (kindOf(val) !== 'object') {
|
||||
return false;
|
||||
}
|
||||
|
||||
const prototype = Object.getPrototypeOf(val);
|
||||
const prototype = getPrototypeOf(val);
|
||||
return prototype === null || prototype === Object.prototype;
|
||||
}
|
||||
|
||||
@@ -193,9 +178,7 @@ const isFileList = kindOfTest('FileList');
|
||||
*
|
||||
* @returns {boolean} True if value is a Stream, otherwise false
|
||||
*/
|
||||
function isStream(val) {
|
||||
return isObject(val) && isFunction(val.pipe);
|
||||
}
|
||||
const isStream = (val) => isObject(val) && isFunction(val.pipe);
|
||||
|
||||
/**
|
||||
* Determine if a value is a FormData
|
||||
@@ -204,7 +187,7 @@ function isStream(val) {
|
||||
*
|
||||
* @returns {boolean} True if value is an FormData, otherwise false
|
||||
*/
|
||||
function isFormData(thing) {
|
||||
const isFormData = (thing) => {
|
||||
const pattern = '[object FormData]';
|
||||
return thing && (
|
||||
(typeof FormData === 'function' && thing instanceof FormData) ||
|
||||
@@ -229,39 +212,8 @@ const isURLSearchParams = kindOfTest('URLSearchParams');
|
||||
*
|
||||
* @returns {String} The String freed of excess whitespace
|
||||
*/
|
||||
function trim(str) {
|
||||
return str.trim ? str.trim() : str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, '');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if we're running in a standard browser environment
|
||||
*
|
||||
* This allows axios to run in a web worker, and react-native.
|
||||
* Both environments support XMLHttpRequest, but not fully standard globals.
|
||||
*
|
||||
* web workers:
|
||||
* typeof window -> undefined
|
||||
* typeof document -> undefined
|
||||
*
|
||||
* react-native:
|
||||
* navigator.product -> 'ReactNative'
|
||||
* nativescript
|
||||
* navigator.product -> 'NativeScript' or 'NS'
|
||||
*
|
||||
* @returns {boolean}
|
||||
*/
|
||||
function isStandardBrowserEnv() {
|
||||
let product;
|
||||
if (typeof navigator !== 'undefined' && (
|
||||
(product = navigator.product) === 'ReactNative' ||
|
||||
product === 'NativeScript' ||
|
||||
product === 'NS')
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return typeof window !== 'undefined' && typeof document !== 'undefined';
|
||||
}
|
||||
const trim = (str) => str.trim ?
|
||||
str.trim() : str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, '');
|
||||
|
||||
/**
|
||||
* Iterate over an Array or an Object invoking a function for each item.
|
||||
@@ -331,7 +283,7 @@ function forEach(obj, fn, {allOwnKeys = false} = {}) {
|
||||
*/
|
||||
function merge(/* obj1, obj2, obj3, ... */) {
|
||||
const result = {};
|
||||
function assignValue(val, key) {
|
||||
const assignValue = (val, key) => {
|
||||
if (isPlainObject(result[key]) && isPlainObject(val)) {
|
||||
result[key] = merge(result[key], val);
|
||||
} else if (isPlainObject(val)) {
|
||||
@@ -359,9 +311,9 @@ function merge(/* obj1, obj2, obj3, ... */) {
|
||||
* @param {Boolean} [allOwnKeys]
|
||||
* @returns {Object} The resulting value of object a
|
||||
*/
|
||||
function extend(a, b, thisArg, {allOwnKeys}= {}) {
|
||||
forEach(b, function assignValue(val, key) {
|
||||
if (thisArg && typeof val === 'function') {
|
||||
const extend = (a, b, thisArg, {allOwnKeys}= {}) => {
|
||||
forEach(b, (val, key) => {
|
||||
if (thisArg && isFunction(val)) {
|
||||
a[key] = bind(val, thisArg);
|
||||
} else {
|
||||
a[key] = val;
|
||||
@@ -377,7 +329,7 @@ function extend(a, b, thisArg, {allOwnKeys}= {}) {
|
||||
*
|
||||
* @returns {string} content value without BOM
|
||||
*/
|
||||
function stripBOM(content) {
|
||||
const stripBOM = (content) => {
|
||||
if (content.charCodeAt(0) === 0xFEFF) {
|
||||
content = content.slice(1);
|
||||
}
|
||||
@@ -393,7 +345,7 @@ function stripBOM(content) {
|
||||
*
|
||||
* @returns {void}
|
||||
*/
|
||||
function inherits(constructor, superConstructor, props, descriptors) {
|
||||
const inherits = (constructor, superConstructor, props, descriptors) => {
|
||||
constructor.prototype = Object.create(superConstructor.prototype, descriptors);
|
||||
constructor.prototype.constructor = constructor;
|
||||
Object.defineProperty(constructor, 'super', {
|
||||
@@ -411,7 +363,7 @@ function inherits(constructor, superConstructor, props, descriptors) {
|
||||
*
|
||||
* @returns {Object}
|
||||
*/
|
||||
function toFlatObject(sourceObj, destObj, filter, propFilter) {
|
||||
const toFlatObject = (sourceObj, destObj, filter, propFilter) => {
|
||||
let props;
|
||||
let i;
|
||||
let prop;
|
||||
@@ -431,7 +383,7 @@ function toFlatObject(sourceObj, destObj, filter, propFilter) {
|
||||
merged[prop] = true;
|
||||
}
|
||||
}
|
||||
sourceObj = filter !== false && Object.getPrototypeOf(sourceObj);
|
||||
sourceObj = filter !== false && getPrototypeOf(sourceObj);
|
||||
} while (sourceObj && (!filter || filter(sourceObj, destObj)) && sourceObj !== Object.prototype);
|
||||
|
||||
return destObj;
|
||||
@@ -446,7 +398,7 @@ function toFlatObject(sourceObj, destObj, filter, propFilter) {
|
||||
*
|
||||
* @returns {boolean}
|
||||
*/
|
||||
function endsWith(str, searchString, position) {
|
||||
const endsWith = (str, searchString, position) => {
|
||||
str = String(str);
|
||||
if (position === undefined || position > str.length) {
|
||||
position = str.length;
|
||||
@@ -464,7 +416,7 @@ function endsWith(str, searchString, position) {
|
||||
*
|
||||
* @returns {?Array}
|
||||
*/
|
||||
function toArray(thing) {
|
||||
const toArray = (thing) => {
|
||||
if (!thing) return null;
|
||||
if (isArray(thing)) return thing;
|
||||
let i = thing.length;
|
||||
@@ -490,7 +442,7 @@ const isTypedArray = (TypedArray => {
|
||||
return thing => {
|
||||
return TypedArray && thing instanceof TypedArray;
|
||||
};
|
||||
})(typeof Uint8Array !== 'undefined' && Object.getPrototypeOf(Uint8Array));
|
||||
})(typeof Uint8Array !== 'undefined' && getPrototypeOf(Uint8Array));
|
||||
|
||||
/**
|
||||
* For each entry in the object, call the function with the key and value.
|
||||
@@ -500,7 +452,7 @@ const isTypedArray = (TypedArray => {
|
||||
*
|
||||
* @returns {void}
|
||||
*/
|
||||
function forEachEntry(obj, fn) {
|
||||
const forEachEntry = (obj, fn) => {
|
||||
const generator = obj && obj[Symbol.iterator];
|
||||
|
||||
const iterator = generator.call(obj);
|
||||
@@ -521,7 +473,7 @@ function forEachEntry(obj, fn) {
|
||||
*
|
||||
* @returns {Array<boolean>}
|
||||
*/
|
||||
function matchAll(regExp, str) {
|
||||
const matchAll = (regExp, str) => {
|
||||
let matches;
|
||||
const arr = [];
|
||||
|
||||
@@ -544,11 +496,7 @@ const toCamelCase = str => {
|
||||
};
|
||||
|
||||
/* Creating a function that will check if an object has a property. */
|
||||
const hasOwnProperty = (function resolver(_hasOwnProperty) {
|
||||
return (obj, prop) => {
|
||||
return _hasOwnProperty.call(obj, prop);
|
||||
};
|
||||
})(Object.prototype.hasOwnProperty);
|
||||
const hasOwnProperty = (({hasOwnProperty}) => (obj, prop) => hasOwnProperty.call(obj, prop))(Object.prototype);
|
||||
|
||||
/**
|
||||
* Determine if a value is a RegExp object
|
||||
@@ -559,7 +507,7 @@ const hasOwnProperty = (function resolver(_hasOwnProperty) {
|
||||
*/
|
||||
const isRegExp = kindOfTest('RegExp');
|
||||
|
||||
function reduceDescriptors(obj, reducer) {
|
||||
const reduceDescriptors = (obj, reducer) => {
|
||||
const descriptors = Object.getOwnPropertyDescriptors(obj);
|
||||
const reducedDescriptors = {};
|
||||
|
||||
@@ -577,7 +525,7 @@ function reduceDescriptors(obj, reducer) {
|
||||
* @param {Object} obj
|
||||
*/
|
||||
|
||||
function freezeMethods(obj) {
|
||||
const freezeMethods = (obj) => {
|
||||
reduceDescriptors(obj, (descriptor, name) => {
|
||||
const value = obj[name];
|
||||
|
||||
@@ -598,10 +546,10 @@ function freezeMethods(obj) {
|
||||
});
|
||||
}
|
||||
|
||||
function toObjectSet(arrayOrString, delimiter) {
|
||||
const toObjectSet = (arrayOrString, delimiter) => {
|
||||
const obj = {};
|
||||
|
||||
function define(arr) {
|
||||
const define = (arr) => {
|
||||
arr.forEach(value => {
|
||||
obj[value] = true;
|
||||
});
|
||||
@@ -612,9 +560,9 @@ function toObjectSet(arrayOrString, delimiter) {
|
||||
return obj;
|
||||
}
|
||||
|
||||
function noop() {}
|
||||
const noop = () => {}
|
||||
|
||||
function toFiniteNumber(value, defaultValue) {
|
||||
const toFiniteNumber = (value, defaultValue) => {
|
||||
value = +value;
|
||||
return Number.isFinite(value) ? value : defaultValue;
|
||||
}
|
||||
@@ -640,7 +588,6 @@ export default {
|
||||
isURLSearchParams,
|
||||
isTypedArray,
|
||||
isFileList,
|
||||
isStandardBrowserEnv,
|
||||
forEach,
|
||||
merge,
|
||||
extend,
|
||||
|
||||
Generated
+176
@@ -50,6 +50,7 @@
|
||||
"multer": "^1.4.4",
|
||||
"rollup": "^2.67.0",
|
||||
"rollup-plugin-auto-external": "^2.0.0",
|
||||
"rollup-plugin-bundle-size": "^1.0.3",
|
||||
"rollup-plugin-terser": "^7.0.2",
|
||||
"sinon": "^4.5.0",
|
||||
"stream-throttle": "^0.1.3",
|
||||
@@ -6281,6 +6282,12 @@
|
||||
"universalify": "^0.1.0"
|
||||
}
|
||||
},
|
||||
"node_modules/duplexer": {
|
||||
"version": "0.1.1",
|
||||
"resolved": "https://registry.npmjs.org/duplexer/-/duplexer-0.1.1.tgz",
|
||||
"integrity": "sha512-sxNZ+ljy+RA1maXoUReeqBBpBC6RLKmg5ewzV+x+mSETmWNoKdZN6vcQjpFROemza23hGFskJtFNoUWUaQ+R4Q==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/duplexer3": {
|
||||
"version": "0.1.4",
|
||||
"resolved": "https://registry.npmjs.org/duplexer3/-/duplexer3-0.1.4.tgz",
|
||||
@@ -6424,6 +6431,31 @@
|
||||
"node": ">= 0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/encoding": {
|
||||
"version": "0.1.13",
|
||||
"resolved": "https://registry.npmjs.org/encoding/-/encoding-0.1.13.tgz",
|
||||
"integrity": "sha512-ETBauow1T35Y/WZMkio9jiM0Z5xjHHmJ4XmjZOq1l/dXz3lr2sRn87nJy20RupqSh1F2m3HHPSp8ShIPQJrJ3A==",
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"iconv-lite": "^0.6.2"
|
||||
}
|
||||
},
|
||||
"node_modules/encoding/node_modules/iconv-lite": {
|
||||
"version": "0.6.3",
|
||||
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz",
|
||||
"integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==",
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"safer-buffer": ">= 2.1.2 < 3.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/end-of-stream": {
|
||||
"version": "1.4.4",
|
||||
"resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz",
|
||||
@@ -7549,6 +7581,19 @@
|
||||
"dev": true,
|
||||
"peer": true
|
||||
},
|
||||
"node_modules/figures": {
|
||||
"version": "1.7.0",
|
||||
"resolved": "https://registry.npmjs.org/figures/-/figures-1.7.0.tgz",
|
||||
"integrity": "sha512-UxKlfCRuCBxSXU4C6t9scbDyWZ4VlaFFdojKtzJuSkuOBQ5CNFum+zZXFwHjo+CxBC1t6zlYPgHIgFjL8ggoEQ==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"escape-string-regexp": "^1.0.5",
|
||||
"object-assign": "^4.1.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/file-entry-cache": {
|
||||
"version": "6.0.1",
|
||||
"resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.1.tgz",
|
||||
@@ -11038,6 +11083,33 @@
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/maxmin": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/maxmin/-/maxmin-2.1.0.tgz",
|
||||
"integrity": "sha512-NWlApBjW9az9qRPaeg7CX4sQBWwytqz32bIEo1PW9pRW+kBP9KLRfJO3UC+TV31EcQZEUq7eMzikC7zt3zPJcw==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"chalk": "^1.0.0",
|
||||
"figures": "^1.0.1",
|
||||
"gzip-size": "^3.0.0",
|
||||
"pretty-bytes": "^3.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.12"
|
||||
}
|
||||
},
|
||||
"node_modules/maxmin/node_modules/gzip-size": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/gzip-size/-/gzip-size-3.0.0.tgz",
|
||||
"integrity": "sha512-6s8trQiK+OMzSaCSVXX+iqIcLV9tC+E73jrJrJTyS4h/AJhlxHvzFKqM1YLDJWRGgHX8uLkBeXkA0njNj39L4w==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"duplexer": "^0.1.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.12.0"
|
||||
}
|
||||
},
|
||||
"node_modules/md5.js": {
|
||||
"version": "1.3.5",
|
||||
"resolved": "https://registry.npmjs.org/md5.js/-/md5.js-1.3.5.tgz",
|
||||
@@ -13150,6 +13222,18 @@
|
||||
"node": ">=4"
|
||||
}
|
||||
},
|
||||
"node_modules/pretty-bytes": {
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/pretty-bytes/-/pretty-bytes-3.0.1.tgz",
|
||||
"integrity": "sha512-eb7ZAeUTgfh294cElcu51w+OTRp/6ItW758LjwJSK72LDevcuJn0P4eD71PLMDGPwwatXmAmYHTkzvpKlJE3ow==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"number-is-nan": "^1.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/pretty-hrtime": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/pretty-hrtime/-/pretty-hrtime-1.0.3.tgz",
|
||||
@@ -14146,6 +14230,16 @@
|
||||
"node": ">=4"
|
||||
}
|
||||
},
|
||||
"node_modules/rollup-plugin-bundle-size": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/rollup-plugin-bundle-size/-/rollup-plugin-bundle-size-1.0.3.tgz",
|
||||
"integrity": "sha512-aWj0Pvzq90fqbI5vN1IvUrlf4utOqy+AERYxwWjegH1G8PzheMnrRIgQ5tkwKVtQMDP0bHZEACW/zLDF+XgfXQ==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"chalk": "^1.1.3",
|
||||
"maxmin": "^2.1.0"
|
||||
}
|
||||
},
|
||||
"node_modules/rollup-plugin-terser": {
|
||||
"version": "7.0.2",
|
||||
"resolved": "https://registry.npmjs.org/rollup-plugin-terser/-/rollup-plugin-terser-7.0.2.tgz",
|
||||
@@ -23012,6 +23106,12 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"duplexer": {
|
||||
"version": "0.1.1",
|
||||
"resolved": "https://registry.npmjs.org/duplexer/-/duplexer-0.1.1.tgz",
|
||||
"integrity": "sha512-sxNZ+ljy+RA1maXoUReeqBBpBC6RLKmg5ewzV+x+mSETmWNoKdZN6vcQjpFROemza23hGFskJtFNoUWUaQ+R4Q==",
|
||||
"dev": true
|
||||
},
|
||||
"duplexer3": {
|
||||
"version": "0.1.4",
|
||||
"resolved": "https://registry.npmjs.org/duplexer3/-/duplexer3-0.1.4.tgz",
|
||||
@@ -23153,6 +23253,30 @@
|
||||
"integrity": "sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k=",
|
||||
"dev": true
|
||||
},
|
||||
"encoding": {
|
||||
"version": "0.1.13",
|
||||
"resolved": "https://registry.npmjs.org/encoding/-/encoding-0.1.13.tgz",
|
||||
"integrity": "sha512-ETBauow1T35Y/WZMkio9jiM0Z5xjHHmJ4XmjZOq1l/dXz3lr2sRn87nJy20RupqSh1F2m3HHPSp8ShIPQJrJ3A==",
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"peer": true,
|
||||
"requires": {
|
||||
"iconv-lite": "^0.6.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"iconv-lite": {
|
||||
"version": "0.6.3",
|
||||
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz",
|
||||
"integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==",
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"peer": true,
|
||||
"requires": {
|
||||
"safer-buffer": ">= 2.1.2 < 3.0.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"end-of-stream": {
|
||||
"version": "1.4.4",
|
||||
"resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz",
|
||||
@@ -24073,6 +24197,16 @@
|
||||
"dev": true,
|
||||
"peer": true
|
||||
},
|
||||
"figures": {
|
||||
"version": "1.7.0",
|
||||
"resolved": "https://registry.npmjs.org/figures/-/figures-1.7.0.tgz",
|
||||
"integrity": "sha512-UxKlfCRuCBxSXU4C6t9scbDyWZ4VlaFFdojKtzJuSkuOBQ5CNFum+zZXFwHjo+CxBC1t6zlYPgHIgFjL8ggoEQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"escape-string-regexp": "^1.0.5",
|
||||
"object-assign": "^4.1.0"
|
||||
}
|
||||
},
|
||||
"file-entry-cache": {
|
||||
"version": "6.0.1",
|
||||
"resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.1.tgz",
|
||||
@@ -26890,6 +27024,29 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"maxmin": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/maxmin/-/maxmin-2.1.0.tgz",
|
||||
"integrity": "sha512-NWlApBjW9az9qRPaeg7CX4sQBWwytqz32bIEo1PW9pRW+kBP9KLRfJO3UC+TV31EcQZEUq7eMzikC7zt3zPJcw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"chalk": "^1.0.0",
|
||||
"figures": "^1.0.1",
|
||||
"gzip-size": "^3.0.0",
|
||||
"pretty-bytes": "^3.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"gzip-size": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/gzip-size/-/gzip-size-3.0.0.tgz",
|
||||
"integrity": "sha512-6s8trQiK+OMzSaCSVXX+iqIcLV9tC+E73jrJrJTyS4h/AJhlxHvzFKqM1YLDJWRGgHX8uLkBeXkA0njNj39L4w==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"duplexer": "^0.1.1"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"md5.js": {
|
||||
"version": "1.3.5",
|
||||
"resolved": "https://registry.npmjs.org/md5.js/-/md5.js-1.3.5.tgz",
|
||||
@@ -28634,6 +28791,15 @@
|
||||
"integrity": "sha1-6SQ0v6XqjBn0HN/UAddBo8gZ2Jc=",
|
||||
"dev": true
|
||||
},
|
||||
"pretty-bytes": {
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/pretty-bytes/-/pretty-bytes-3.0.1.tgz",
|
||||
"integrity": "sha512-eb7ZAeUTgfh294cElcu51w+OTRp/6ItW758LjwJSK72LDevcuJn0P4eD71PLMDGPwwatXmAmYHTkzvpKlJE3ow==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"number-is-nan": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"pretty-hrtime": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/pretty-hrtime/-/pretty-hrtime-1.0.3.tgz",
|
||||
@@ -29446,6 +29612,16 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"rollup-plugin-bundle-size": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/rollup-plugin-bundle-size/-/rollup-plugin-bundle-size-1.0.3.tgz",
|
||||
"integrity": "sha512-aWj0Pvzq90fqbI5vN1IvUrlf4utOqy+AERYxwWjegH1G8PzheMnrRIgQ5tkwKVtQMDP0bHZEACW/zLDF+XgfXQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"chalk": "^1.1.3",
|
||||
"maxmin": "^2.1.0"
|
||||
}
|
||||
},
|
||||
"rollup-plugin-terser": {
|
||||
"version": "7.0.2",
|
||||
"resolved": "https://registry.npmjs.org/rollup-plugin-terser/-/rollup-plugin-terser-7.0.2.tgz",
|
||||
|
||||
+2
-1
@@ -88,6 +88,7 @@
|
||||
"multer": "^1.4.4",
|
||||
"rollup": "^2.67.0",
|
||||
"rollup-plugin-auto-external": "^2.0.0",
|
||||
"rollup-plugin-bundle-size": "^1.0.3",
|
||||
"rollup-plugin-terser": "^7.0.2",
|
||||
"sinon": "^4.5.0",
|
||||
"stream-throttle": "^0.1.3",
|
||||
@@ -129,4 +130,4 @@
|
||||
"Ben Carp (https://github.com/carpben)",
|
||||
"Daniel Lopretto (https://github.com/timemachine3030)"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
+3
-1
@@ -4,6 +4,7 @@ import {terser} from "rollup-plugin-terser";
|
||||
import json from '@rollup/plugin-json';
|
||||
import { babel } from '@rollup/plugin-babel';
|
||||
import autoExternal from 'rollup-plugin-auto-external';
|
||||
import bundleSize from 'rollup-plugin-bundle-size'
|
||||
|
||||
const lib = require("./package.json");
|
||||
const outputFileName = 'axios';
|
||||
@@ -24,6 +25,7 @@ const buildConfig = ({es5, browser = true, minifiedVersion = true, ...config}) =
|
||||
resolve({browser}),
|
||||
commonjs(),
|
||||
minified && terser(),
|
||||
minified && bundleSize(),
|
||||
...(es5 ? [babel({
|
||||
babelHelpers: 'bundled',
|
||||
presets: ['@babel/preset-env']
|
||||
@@ -37,7 +39,7 @@ const buildConfig = ({es5, browser = true, minifiedVersion = true, ...config}) =
|
||||
];
|
||||
|
||||
if (minifiedVersion) {
|
||||
build({minified: true})
|
||||
configs.push(build({minified: true}))
|
||||
}
|
||||
|
||||
return configs;
|
||||
|
||||
Reference in New Issue
Block a user