@mapples/cli 0.0.7 ā 0.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +795 -317
- package/dist/index.js.map +1 -1
- package/package-list.json +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -24,6 +24,7 @@ var require$$0$6 = require('os');
|
|
|
24
24
|
var require$$3$2 = require('http');
|
|
25
25
|
var require$$4$1 = require('https');
|
|
26
26
|
var require$$0$7 = require('url');
|
|
27
|
+
var http2 = require('http2');
|
|
27
28
|
var require$$4$2 = require('assert');
|
|
28
29
|
var zlib = require('zlib');
|
|
29
30
|
var events = require('events');
|
|
@@ -23103,21 +23104,21 @@ var Observable = {};
|
|
|
23103
23104
|
|
|
23104
23105
|
var Subscriber = {};
|
|
23105
23106
|
|
|
23106
|
-
var isFunction$
|
|
23107
|
+
var isFunction$2 = {};
|
|
23107
23108
|
|
|
23108
23109
|
var hasRequiredIsFunction;
|
|
23109
23110
|
|
|
23110
23111
|
function requireIsFunction () {
|
|
23111
|
-
if (hasRequiredIsFunction) return isFunction$
|
|
23112
|
+
if (hasRequiredIsFunction) return isFunction$2;
|
|
23112
23113
|
hasRequiredIsFunction = 1;
|
|
23113
|
-
Object.defineProperty(isFunction$
|
|
23114
|
-
isFunction$
|
|
23114
|
+
Object.defineProperty(isFunction$2, "__esModule", { value: true });
|
|
23115
|
+
isFunction$2.isFunction = void 0;
|
|
23115
23116
|
function isFunction(value) {
|
|
23116
23117
|
return typeof value === 'function';
|
|
23117
23118
|
}
|
|
23118
|
-
isFunction$
|
|
23119
|
+
isFunction$2.isFunction = isFunction;
|
|
23119
23120
|
|
|
23120
|
-
return isFunction$
|
|
23121
|
+
return isFunction$2;
|
|
23121
23122
|
}
|
|
23122
23123
|
|
|
23123
23124
|
var Subscription = {};
|
|
@@ -52872,6 +52873,15 @@ const isExpoAvailable = () => {
|
|
|
52872
52873
|
return false;
|
|
52873
52874
|
}
|
|
52874
52875
|
};
|
|
52876
|
+
const isSDKVersionSupported = (installedSDKVersion, requiredSDKVersions) => {
|
|
52877
|
+
if (!installedSDKVersion) {
|
|
52878
|
+
return false;
|
|
52879
|
+
}
|
|
52880
|
+
const requiredVersions = Array.isArray(requiredSDKVersions)
|
|
52881
|
+
? requiredSDKVersions
|
|
52882
|
+
: [requiredSDKVersions];
|
|
52883
|
+
return requiredVersions.some((requiredVersion) => installedSDKVersion.includes(requiredVersion));
|
|
52884
|
+
};
|
|
52875
52885
|
const installExpoPackage = (packageName) => {
|
|
52876
52886
|
try {
|
|
52877
52887
|
console.log(chalk.blue(`Installing ${packageName} with expo install...`));
|
|
@@ -52944,15 +52954,19 @@ const syncPackages = async (autoApprove = false) => {
|
|
|
52944
52954
|
if (packageList.expo) {
|
|
52945
52955
|
console.log(chalk.blue('\nš± Checking Expo packages...'));
|
|
52946
52956
|
const installedSDKVersion = getInstalledExpoSDKVersion();
|
|
52947
|
-
const
|
|
52957
|
+
const requiredSDKVersions = packageList.expo.sdk;
|
|
52958
|
+
const requiredVersionsArray = Array.isArray(requiredSDKVersions)
|
|
52959
|
+
? requiredSDKVersions
|
|
52960
|
+
: [requiredSDKVersions];
|
|
52961
|
+
const requiredVersionsDisplay = requiredVersionsArray.join(', ');
|
|
52948
52962
|
if (!installedSDKVersion) {
|
|
52949
52963
|
expoIssues.push(`Expo is not installed or not available`);
|
|
52950
52964
|
}
|
|
52951
|
-
else if (!installedSDKVersion
|
|
52952
|
-
expoIssues.push(`Expo SDK version mismatch: installed ${installedSDKVersion}, required ${
|
|
52965
|
+
else if (!isSDKVersionSupported(installedSDKVersion, requiredSDKVersions)) {
|
|
52966
|
+
expoIssues.push(`Expo SDK version mismatch: installed ${installedSDKVersion}, required ${requiredVersionsDisplay}`);
|
|
52953
52967
|
}
|
|
52954
52968
|
else {
|
|
52955
|
-
console.log(chalk.green(`ā Expo SDK version ${installedSDKVersion} matches required ${
|
|
52969
|
+
console.log(chalk.green(`ā Expo SDK version ${installedSDKVersion} matches required version(s): ${requiredVersionsDisplay}`));
|
|
52956
52970
|
}
|
|
52957
52971
|
if (isExpoAvailable()) {
|
|
52958
52972
|
for (const packageName of packageList.expo.dependencies) {
|
|
@@ -53065,12 +53079,16 @@ const showPackageInfo = () => {
|
|
|
53065
53079
|
if (packageList.expo) {
|
|
53066
53080
|
console.log(chalk.blue('\nš± Expo packages:'));
|
|
53067
53081
|
const installedSDKVersion = getInstalledExpoSDKVersion();
|
|
53068
|
-
const
|
|
53082
|
+
const requiredSDKVersions = packageList.expo.sdk;
|
|
53083
|
+
const requiredVersionsArray = Array.isArray(requiredSDKVersions)
|
|
53084
|
+
? requiredSDKVersions
|
|
53085
|
+
: [requiredSDKVersions];
|
|
53086
|
+
const requiredVersionsDisplay = requiredVersionsArray.join(', ');
|
|
53069
53087
|
if (!installedSDKVersion) {
|
|
53070
|
-
console.log(chalk.red(` ⢠Expo SDK: not installed (required: ${
|
|
53088
|
+
console.log(chalk.red(` ⢠Expo SDK: not installed (required: ${requiredVersionsDisplay})`));
|
|
53071
53089
|
}
|
|
53072
|
-
else if (!installedSDKVersion
|
|
53073
|
-
console.log(chalk.yellow(` ⢠Expo SDK: ${installedSDKVersion} (required: ${
|
|
53090
|
+
else if (!isSDKVersionSupported(installedSDKVersion, requiredSDKVersions)) {
|
|
53091
|
+
console.log(chalk.yellow(` ⢠Expo SDK: ${installedSDKVersion} (required: ${requiredVersionsDisplay})`));
|
|
53074
53092
|
}
|
|
53075
53093
|
else {
|
|
53076
53094
|
console.log(chalk.green(` ⢠Expo SDK: ${installedSDKVersion} ā`));
|
|
@@ -55105,6 +55123,13 @@ function requireCliTable3 () {
|
|
|
55105
55123
|
var cliTable3Exports = requireCliTable3();
|
|
55106
55124
|
var Table = /*@__PURE__*/getDefaultExportFromCjs(cliTable3Exports);
|
|
55107
55125
|
|
|
55126
|
+
/**
|
|
55127
|
+
* Create a bound version of a function with a specified `this` context
|
|
55128
|
+
*
|
|
55129
|
+
* @param {Function} fn - The function to bind
|
|
55130
|
+
* @param {*} thisArg - The value to be passed as the `this` parameter
|
|
55131
|
+
* @returns {Function} A new function that will call the original function with the specified `this` context
|
|
55132
|
+
*/
|
|
55108
55133
|
function bind(fn, thisArg) {
|
|
55109
55134
|
return function wrap() {
|
|
55110
55135
|
return fn.apply(thisArg, arguments);
|
|
@@ -55156,7 +55181,7 @@ const isUndefined = typeOfTest('undefined');
|
|
|
55156
55181
|
*/
|
|
55157
55182
|
function isBuffer(val) {
|
|
55158
55183
|
return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor)
|
|
55159
|
-
&& isFunction(val.constructor.isBuffer) && val.constructor.isBuffer(val);
|
|
55184
|
+
&& isFunction$1(val.constructor.isBuffer) && val.constructor.isBuffer(val);
|
|
55160
55185
|
}
|
|
55161
55186
|
|
|
55162
55187
|
/**
|
|
@@ -55201,7 +55226,7 @@ const isString = typeOfTest('string');
|
|
|
55201
55226
|
* @param {*} val The value to test
|
|
55202
55227
|
* @returns {boolean} True if value is a Function, otherwise false
|
|
55203
55228
|
*/
|
|
55204
|
-
const isFunction = typeOfTest('function');
|
|
55229
|
+
const isFunction$1 = typeOfTest('function');
|
|
55205
55230
|
|
|
55206
55231
|
/**
|
|
55207
55232
|
* Determine if a value is a Number
|
|
@@ -55257,7 +55282,7 @@ const isEmptyObject = (val) => {
|
|
|
55257
55282
|
if (!isObject(val) || isBuffer(val)) {
|
|
55258
55283
|
return false;
|
|
55259
55284
|
}
|
|
55260
|
-
|
|
55285
|
+
|
|
55261
55286
|
try {
|
|
55262
55287
|
return Object.keys(val).length === 0 && Object.getPrototypeOf(val) === Object.prototype;
|
|
55263
55288
|
} catch (e) {
|
|
@@ -55309,7 +55334,7 @@ const isFileList = kindOfTest('FileList');
|
|
|
55309
55334
|
*
|
|
55310
55335
|
* @returns {boolean} True if value is a Stream, otherwise false
|
|
55311
55336
|
*/
|
|
55312
|
-
const isStream = (val) => isObject(val) && isFunction(val.pipe);
|
|
55337
|
+
const isStream = (val) => isObject(val) && isFunction$1(val.pipe);
|
|
55313
55338
|
|
|
55314
55339
|
/**
|
|
55315
55340
|
* Determine if a value is a FormData
|
|
@@ -55322,10 +55347,10 @@ const isFormData = (thing) => {
|
|
|
55322
55347
|
let kind;
|
|
55323
55348
|
return thing && (
|
|
55324
55349
|
(typeof FormData === 'function' && thing instanceof FormData) || (
|
|
55325
|
-
isFunction(thing.append) && (
|
|
55350
|
+
isFunction$1(thing.append) && (
|
|
55326
55351
|
(kind = kindOf(thing)) === 'formdata' ||
|
|
55327
55352
|
// detect form-data instance
|
|
55328
|
-
(kind === 'object' && isFunction(thing.toString) && thing.toString() === '[object FormData]')
|
|
55353
|
+
(kind === 'object' && isFunction$1(thing.toString) && thing.toString() === '[object FormData]')
|
|
55329
55354
|
)
|
|
55330
55355
|
)
|
|
55331
55356
|
)
|
|
@@ -55450,7 +55475,7 @@ const isContextDefined = (context) => !isUndefined(context) && context !== _glob
|
|
|
55450
55475
|
* @returns {Object} Result of all merge properties
|
|
55451
55476
|
*/
|
|
55452
55477
|
function merge(/* obj1, obj2, obj3, ... */) {
|
|
55453
|
-
const {caseless} = isContextDefined(this) && this || {};
|
|
55478
|
+
const {caseless, skipUndefined} = isContextDefined(this) && this || {};
|
|
55454
55479
|
const result = {};
|
|
55455
55480
|
const assignValue = (val, key) => {
|
|
55456
55481
|
const targetKey = caseless && findKey(result, key) || key;
|
|
@@ -55460,7 +55485,7 @@ function merge(/* obj1, obj2, obj3, ... */) {
|
|
|
55460
55485
|
result[targetKey] = merge({}, val);
|
|
55461
55486
|
} else if (isArray(val)) {
|
|
55462
55487
|
result[targetKey] = val.slice();
|
|
55463
|
-
} else {
|
|
55488
|
+
} else if (!skipUndefined || !isUndefined(val)) {
|
|
55464
55489
|
result[targetKey] = val;
|
|
55465
55490
|
}
|
|
55466
55491
|
};
|
|
@@ -55483,7 +55508,7 @@ function merge(/* obj1, obj2, obj3, ... */) {
|
|
|
55483
55508
|
*/
|
|
55484
55509
|
const extend = (a, b, thisArg, {allOwnKeys}= {}) => {
|
|
55485
55510
|
forEach(b, (val, key) => {
|
|
55486
|
-
if (thisArg && isFunction(val)) {
|
|
55511
|
+
if (thisArg && isFunction$1(val)) {
|
|
55487
55512
|
a[key] = bind(val, thisArg);
|
|
55488
55513
|
} else {
|
|
55489
55514
|
a[key] = val;
|
|
@@ -55699,13 +55724,13 @@ const reduceDescriptors = (obj, reducer) => {
|
|
|
55699
55724
|
const freezeMethods = (obj) => {
|
|
55700
55725
|
reduceDescriptors(obj, (descriptor, name) => {
|
|
55701
55726
|
// skip restricted props in strict mode
|
|
55702
|
-
if (isFunction(obj) && ['arguments', 'caller', 'callee'].indexOf(name) !== -1) {
|
|
55727
|
+
if (isFunction$1(obj) && ['arguments', 'caller', 'callee'].indexOf(name) !== -1) {
|
|
55703
55728
|
return false;
|
|
55704
55729
|
}
|
|
55705
55730
|
|
|
55706
55731
|
const value = obj[name];
|
|
55707
55732
|
|
|
55708
|
-
if (!isFunction(value)) return;
|
|
55733
|
+
if (!isFunction$1(value)) return;
|
|
55709
55734
|
|
|
55710
55735
|
descriptor.enumerable = false;
|
|
55711
55736
|
|
|
@@ -55742,6 +55767,8 @@ const toFiniteNumber = (value, defaultValue) => {
|
|
|
55742
55767
|
return value != null && Number.isFinite(value = +value) ? value : defaultValue;
|
|
55743
55768
|
};
|
|
55744
55769
|
|
|
55770
|
+
|
|
55771
|
+
|
|
55745
55772
|
/**
|
|
55746
55773
|
* If the thing is a FormData object, return true, otherwise return false.
|
|
55747
55774
|
*
|
|
@@ -55750,7 +55777,7 @@ const toFiniteNumber = (value, defaultValue) => {
|
|
|
55750
55777
|
* @returns {boolean}
|
|
55751
55778
|
*/
|
|
55752
55779
|
function isSpecCompliantForm(thing) {
|
|
55753
|
-
return !!(thing && isFunction(thing.append) && thing[toStringTag] === 'FormData' && thing[iterator]);
|
|
55780
|
+
return !!(thing && isFunction$1(thing.append) && thing[toStringTag] === 'FormData' && thing[iterator]);
|
|
55754
55781
|
}
|
|
55755
55782
|
|
|
55756
55783
|
const toJSONObject = (obj) => {
|
|
@@ -55792,7 +55819,7 @@ const toJSONObject = (obj) => {
|
|
|
55792
55819
|
const isAsyncFn = kindOfTest('AsyncFunction');
|
|
55793
55820
|
|
|
55794
55821
|
const isThenable = (thing) =>
|
|
55795
|
-
thing && (isObject(thing) || isFunction(thing)) && isFunction(thing.then) && isFunction(thing.catch);
|
|
55822
|
+
thing && (isObject(thing) || isFunction$1(thing)) && isFunction$1(thing.then) && isFunction$1(thing.catch);
|
|
55796
55823
|
|
|
55797
55824
|
// original code
|
|
55798
55825
|
// https://github.com/DigitalBrainJS/AxiosPromise/blob/16deab13710ec09779922131f3fa5954320f83ab/lib/utils.js#L11-L34
|
|
@@ -55816,7 +55843,7 @@ const _setImmediate = ((setImmediateSupported, postMessageSupported) => {
|
|
|
55816
55843
|
})(`axios@${Math.random()}`, []) : (cb) => setTimeout(cb);
|
|
55817
55844
|
})(
|
|
55818
55845
|
typeof setImmediate === 'function',
|
|
55819
|
-
isFunction(_global.postMessage)
|
|
55846
|
+
isFunction$1(_global.postMessage)
|
|
55820
55847
|
);
|
|
55821
55848
|
|
|
55822
55849
|
const asap = typeof queueMicrotask !== 'undefined' ?
|
|
@@ -55825,7 +55852,7 @@ const asap = typeof queueMicrotask !== 'undefined' ?
|
|
|
55825
55852
|
// *********************
|
|
55826
55853
|
|
|
55827
55854
|
|
|
55828
|
-
const isIterable = (thing) => thing != null && isFunction(thing[iterator]);
|
|
55855
|
+
const isIterable = (thing) => thing != null && isFunction$1(thing[iterator]);
|
|
55829
55856
|
|
|
55830
55857
|
|
|
55831
55858
|
var utils$1 = {
|
|
@@ -55849,7 +55876,7 @@ var utils$1 = {
|
|
|
55849
55876
|
isFile,
|
|
55850
55877
|
isBlob,
|
|
55851
55878
|
isRegExp,
|
|
55852
|
-
isFunction,
|
|
55879
|
+
isFunction: isFunction$1,
|
|
55853
55880
|
isStream,
|
|
55854
55881
|
isURLSearchParams,
|
|
55855
55882
|
isTypedArray,
|
|
@@ -55975,11 +56002,18 @@ AxiosError$1.from = (error, code, config, request, response, customProps) => {
|
|
|
55975
56002
|
return prop !== 'isAxiosError';
|
|
55976
56003
|
});
|
|
55977
56004
|
|
|
55978
|
-
|
|
56005
|
+
const msg = error && error.message ? error.message : 'Error';
|
|
55979
56006
|
|
|
55980
|
-
|
|
56007
|
+
// Prefer explicit code; otherwise copy the low-level error's code (e.g. ECONNREFUSED)
|
|
56008
|
+
const errCode = code == null && error ? error.code : code;
|
|
56009
|
+
AxiosError$1.call(axiosError, msg, errCode, config, request, response);
|
|
55981
56010
|
|
|
55982
|
-
|
|
56011
|
+
// Chain the original error on the standard field; non-enumerable to avoid JSON noise
|
|
56012
|
+
if (error && axiosError.cause == null) {
|
|
56013
|
+
Object.defineProperty(axiosError, 'cause', { value: error, configurable: true });
|
|
56014
|
+
}
|
|
56015
|
+
|
|
56016
|
+
axiosError.name = (error && error.name) || 'Error';
|
|
55983
56017
|
|
|
55984
56018
|
customProps && Object.assign(axiosError, customProps);
|
|
55985
56019
|
|
|
@@ -69583,9 +69617,7 @@ function encode(val) {
|
|
|
69583
69617
|
replace(/%3A/gi, ':').
|
|
69584
69618
|
replace(/%24/g, '$').
|
|
69585
69619
|
replace(/%2C/gi, ',').
|
|
69586
|
-
replace(/%20/g, '+')
|
|
69587
|
-
replace(/%5B/gi, '[').
|
|
69588
|
-
replace(/%5D/gi, ']');
|
|
69620
|
+
replace(/%20/g, '+');
|
|
69589
69621
|
}
|
|
69590
69622
|
|
|
69591
69623
|
/**
|
|
@@ -69663,7 +69695,7 @@ class InterceptorManager {
|
|
|
69663
69695
|
*
|
|
69664
69696
|
* @param {Number} id The ID that was returned by `use`
|
|
69665
69697
|
*
|
|
69666
|
-
* @returns {
|
|
69698
|
+
* @returns {void}
|
|
69667
69699
|
*/
|
|
69668
69700
|
eject(id) {
|
|
69669
69701
|
if (this.handlers[id]) {
|
|
@@ -70009,7 +70041,7 @@ const defaults = {
|
|
|
70009
70041
|
const strictJSONParsing = !silentJSONParsing && JSONRequested;
|
|
70010
70042
|
|
|
70011
70043
|
try {
|
|
70012
|
-
return JSON.parse(data);
|
|
70044
|
+
return JSON.parse(data, this.parseReviver);
|
|
70013
70045
|
} catch (e) {
|
|
70014
70046
|
if (strictJSONParsing) {
|
|
70015
70047
|
if (e.name === 'SyntaxError') {
|
|
@@ -72584,7 +72616,7 @@ function requireFollowRedirects () {
|
|
|
72584
72616
|
var followRedirectsExports = requireFollowRedirects();
|
|
72585
72617
|
var followRedirects = /*@__PURE__*/getDefaultExportFromCjs(followRedirectsExports);
|
|
72586
72618
|
|
|
72587
|
-
const VERSION$1 = "1.
|
|
72619
|
+
const VERSION$1 = "1.13.2";
|
|
72588
72620
|
|
|
72589
72621
|
function parseProtocol(url) {
|
|
72590
72622
|
const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
|
|
@@ -73067,6 +73099,80 @@ const progressEventDecorator = (total, throttled) => {
|
|
|
73067
73099
|
|
|
73068
73100
|
const asyncDecorator = (fn) => (...args) => utils$1.asap(() => fn(...args));
|
|
73069
73101
|
|
|
73102
|
+
/**
|
|
73103
|
+
* Estimate decoded byte length of a data:// URL *without* allocating large buffers.
|
|
73104
|
+
* - For base64: compute exact decoded size using length and padding;
|
|
73105
|
+
* handle %XX at the character-count level (no string allocation).
|
|
73106
|
+
* - For non-base64: use UTF-8 byteLength of the encoded body as a safe upper bound.
|
|
73107
|
+
*
|
|
73108
|
+
* @param {string} url
|
|
73109
|
+
* @returns {number}
|
|
73110
|
+
*/
|
|
73111
|
+
function estimateDataURLDecodedBytes(url) {
|
|
73112
|
+
if (!url || typeof url !== 'string') return 0;
|
|
73113
|
+
if (!url.startsWith('data:')) return 0;
|
|
73114
|
+
|
|
73115
|
+
const comma = url.indexOf(',');
|
|
73116
|
+
if (comma < 0) return 0;
|
|
73117
|
+
|
|
73118
|
+
const meta = url.slice(5, comma);
|
|
73119
|
+
const body = url.slice(comma + 1);
|
|
73120
|
+
const isBase64 = /;base64/i.test(meta);
|
|
73121
|
+
|
|
73122
|
+
if (isBase64) {
|
|
73123
|
+
let effectiveLen = body.length;
|
|
73124
|
+
const len = body.length; // cache length
|
|
73125
|
+
|
|
73126
|
+
for (let i = 0; i < len; i++) {
|
|
73127
|
+
if (body.charCodeAt(i) === 37 /* '%' */ && i + 2 < len) {
|
|
73128
|
+
const a = body.charCodeAt(i + 1);
|
|
73129
|
+
const b = body.charCodeAt(i + 2);
|
|
73130
|
+
const isHex =
|
|
73131
|
+
((a >= 48 && a <= 57) || (a >= 65 && a <= 70) || (a >= 97 && a <= 102)) &&
|
|
73132
|
+
((b >= 48 && b <= 57) || (b >= 65 && b <= 70) || (b >= 97 && b <= 102));
|
|
73133
|
+
|
|
73134
|
+
if (isHex) {
|
|
73135
|
+
effectiveLen -= 2;
|
|
73136
|
+
i += 2;
|
|
73137
|
+
}
|
|
73138
|
+
}
|
|
73139
|
+
}
|
|
73140
|
+
|
|
73141
|
+
let pad = 0;
|
|
73142
|
+
let idx = len - 1;
|
|
73143
|
+
|
|
73144
|
+
const tailIsPct3D = (j) =>
|
|
73145
|
+
j >= 2 &&
|
|
73146
|
+
body.charCodeAt(j - 2) === 37 && // '%'
|
|
73147
|
+
body.charCodeAt(j - 1) === 51 && // '3'
|
|
73148
|
+
(body.charCodeAt(j) === 68 || body.charCodeAt(j) === 100); // 'D' or 'd'
|
|
73149
|
+
|
|
73150
|
+
if (idx >= 0) {
|
|
73151
|
+
if (body.charCodeAt(idx) === 61 /* '=' */) {
|
|
73152
|
+
pad++;
|
|
73153
|
+
idx--;
|
|
73154
|
+
} else if (tailIsPct3D(idx)) {
|
|
73155
|
+
pad++;
|
|
73156
|
+
idx -= 3;
|
|
73157
|
+
}
|
|
73158
|
+
}
|
|
73159
|
+
|
|
73160
|
+
if (pad === 1 && idx >= 0) {
|
|
73161
|
+
if (body.charCodeAt(idx) === 61 /* '=' */) {
|
|
73162
|
+
pad++;
|
|
73163
|
+
} else if (tailIsPct3D(idx)) {
|
|
73164
|
+
pad++;
|
|
73165
|
+
}
|
|
73166
|
+
}
|
|
73167
|
+
|
|
73168
|
+
const groups = Math.floor(effectiveLen / 4);
|
|
73169
|
+
const bytes = groups * 3 - (pad || 0);
|
|
73170
|
+
return bytes > 0 ? bytes : 0;
|
|
73171
|
+
}
|
|
73172
|
+
|
|
73173
|
+
return Buffer.byteLength(body, 'utf8');
|
|
73174
|
+
}
|
|
73175
|
+
|
|
73070
73176
|
const zlibOptions = {
|
|
73071
73177
|
flush: zlib.constants.Z_SYNC_FLUSH,
|
|
73072
73178
|
finishFlush: zlib.constants.Z_SYNC_FLUSH
|
|
@@ -73087,6 +73193,7 @@ const supportedProtocols = platform.protocols.map(protocol => {
|
|
|
73087
73193
|
return protocol + ':';
|
|
73088
73194
|
});
|
|
73089
73195
|
|
|
73196
|
+
|
|
73090
73197
|
const flushOnFinish = (stream, [throttled, flush]) => {
|
|
73091
73198
|
stream
|
|
73092
73199
|
.on('end', flush)
|
|
@@ -73095,6 +73202,102 @@ const flushOnFinish = (stream, [throttled, flush]) => {
|
|
|
73095
73202
|
return throttled;
|
|
73096
73203
|
};
|
|
73097
73204
|
|
|
73205
|
+
class Http2Sessions {
|
|
73206
|
+
constructor() {
|
|
73207
|
+
this.sessions = Object.create(null);
|
|
73208
|
+
}
|
|
73209
|
+
|
|
73210
|
+
getSession(authority, options) {
|
|
73211
|
+
options = Object.assign({
|
|
73212
|
+
sessionTimeout: 1000
|
|
73213
|
+
}, options);
|
|
73214
|
+
|
|
73215
|
+
let authoritySessions = this.sessions[authority];
|
|
73216
|
+
|
|
73217
|
+
if (authoritySessions) {
|
|
73218
|
+
let len = authoritySessions.length;
|
|
73219
|
+
|
|
73220
|
+
for (let i = 0; i < len; i++) {
|
|
73221
|
+
const [sessionHandle, sessionOptions] = authoritySessions[i];
|
|
73222
|
+
if (!sessionHandle.destroyed && !sessionHandle.closed && require$$0$4.isDeepStrictEqual(sessionOptions, options)) {
|
|
73223
|
+
return sessionHandle;
|
|
73224
|
+
}
|
|
73225
|
+
}
|
|
73226
|
+
}
|
|
73227
|
+
|
|
73228
|
+
const session = http2.connect(authority, options);
|
|
73229
|
+
|
|
73230
|
+
let removed;
|
|
73231
|
+
|
|
73232
|
+
const removeSession = () => {
|
|
73233
|
+
if (removed) {
|
|
73234
|
+
return;
|
|
73235
|
+
}
|
|
73236
|
+
|
|
73237
|
+
removed = true;
|
|
73238
|
+
|
|
73239
|
+
let entries = authoritySessions, len = entries.length, i = len;
|
|
73240
|
+
|
|
73241
|
+
while (i--) {
|
|
73242
|
+
if (entries[i][0] === session) {
|
|
73243
|
+
if (len === 1) {
|
|
73244
|
+
delete this.sessions[authority];
|
|
73245
|
+
} else {
|
|
73246
|
+
entries.splice(i, 1);
|
|
73247
|
+
}
|
|
73248
|
+
return;
|
|
73249
|
+
}
|
|
73250
|
+
}
|
|
73251
|
+
};
|
|
73252
|
+
|
|
73253
|
+
const originalRequestFn = session.request;
|
|
73254
|
+
|
|
73255
|
+
const {sessionTimeout} = options;
|
|
73256
|
+
|
|
73257
|
+
if(sessionTimeout != null) {
|
|
73258
|
+
|
|
73259
|
+
let timer;
|
|
73260
|
+
let streamsCount = 0;
|
|
73261
|
+
|
|
73262
|
+
session.request = function () {
|
|
73263
|
+
const stream = originalRequestFn.apply(this, arguments);
|
|
73264
|
+
|
|
73265
|
+
streamsCount++;
|
|
73266
|
+
|
|
73267
|
+
if (timer) {
|
|
73268
|
+
clearTimeout(timer);
|
|
73269
|
+
timer = null;
|
|
73270
|
+
}
|
|
73271
|
+
|
|
73272
|
+
stream.once('close', () => {
|
|
73273
|
+
if (!--streamsCount) {
|
|
73274
|
+
timer = setTimeout(() => {
|
|
73275
|
+
timer = null;
|
|
73276
|
+
removeSession();
|
|
73277
|
+
}, sessionTimeout);
|
|
73278
|
+
}
|
|
73279
|
+
});
|
|
73280
|
+
|
|
73281
|
+
return stream;
|
|
73282
|
+
};
|
|
73283
|
+
}
|
|
73284
|
+
|
|
73285
|
+
session.once('close', removeSession);
|
|
73286
|
+
|
|
73287
|
+
let entry = [
|
|
73288
|
+
session,
|
|
73289
|
+
options
|
|
73290
|
+
];
|
|
73291
|
+
|
|
73292
|
+
authoritySessions ? authoritySessions.push(entry) : authoritySessions = this.sessions[authority] = [entry];
|
|
73293
|
+
|
|
73294
|
+
return session;
|
|
73295
|
+
}
|
|
73296
|
+
}
|
|
73297
|
+
|
|
73298
|
+
const http2Sessions = new Http2Sessions();
|
|
73299
|
+
|
|
73300
|
+
|
|
73098
73301
|
/**
|
|
73099
73302
|
* If the proxy or config beforeRedirects functions are defined, call them with the options
|
|
73100
73303
|
* object.
|
|
@@ -73206,16 +73409,75 @@ const resolveFamily = ({address, family}) => {
|
|
|
73206
73409
|
|
|
73207
73410
|
const buildAddressEntry = (address, family) => resolveFamily(utils$1.isObject(address) ? address : {address, family});
|
|
73208
73411
|
|
|
73412
|
+
const http2Transport = {
|
|
73413
|
+
request(options, cb) {
|
|
73414
|
+
const authority = options.protocol + '//' + options.hostname + ':' + (options.port || 80);
|
|
73415
|
+
|
|
73416
|
+
const {http2Options, headers} = options;
|
|
73417
|
+
|
|
73418
|
+
const session = http2Sessions.getSession(authority, http2Options);
|
|
73419
|
+
|
|
73420
|
+
const {
|
|
73421
|
+
HTTP2_HEADER_SCHEME,
|
|
73422
|
+
HTTP2_HEADER_METHOD,
|
|
73423
|
+
HTTP2_HEADER_PATH,
|
|
73424
|
+
HTTP2_HEADER_STATUS
|
|
73425
|
+
} = http2.constants;
|
|
73426
|
+
|
|
73427
|
+
const http2Headers = {
|
|
73428
|
+
[HTTP2_HEADER_SCHEME]: options.protocol.replace(':', ''),
|
|
73429
|
+
[HTTP2_HEADER_METHOD]: options.method,
|
|
73430
|
+
[HTTP2_HEADER_PATH]: options.path,
|
|
73431
|
+
};
|
|
73432
|
+
|
|
73433
|
+
utils$1.forEach(headers, (header, name) => {
|
|
73434
|
+
name.charAt(0) !== ':' && (http2Headers[name] = header);
|
|
73435
|
+
});
|
|
73436
|
+
|
|
73437
|
+
const req = session.request(http2Headers);
|
|
73438
|
+
|
|
73439
|
+
req.once('response', (responseHeaders) => {
|
|
73440
|
+
const response = req; //duplex
|
|
73441
|
+
|
|
73442
|
+
responseHeaders = Object.assign({}, responseHeaders);
|
|
73443
|
+
|
|
73444
|
+
const status = responseHeaders[HTTP2_HEADER_STATUS];
|
|
73445
|
+
|
|
73446
|
+
delete responseHeaders[HTTP2_HEADER_STATUS];
|
|
73447
|
+
|
|
73448
|
+
response.headers = responseHeaders;
|
|
73449
|
+
|
|
73450
|
+
response.statusCode = +status;
|
|
73451
|
+
|
|
73452
|
+
cb(response);
|
|
73453
|
+
});
|
|
73454
|
+
|
|
73455
|
+
return req;
|
|
73456
|
+
}
|
|
73457
|
+
};
|
|
73458
|
+
|
|
73209
73459
|
/*eslint consistent-return:0*/
|
|
73210
73460
|
var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
|
|
73211
73461
|
return wrapAsync(async function dispatchHttpRequest(resolve, reject, onDone) {
|
|
73212
|
-
let {data, lookup, family} = config;
|
|
73462
|
+
let {data, lookup, family, httpVersion = 1, http2Options} = config;
|
|
73213
73463
|
const {responseType, responseEncoding} = config;
|
|
73214
73464
|
const method = config.method.toUpperCase();
|
|
73215
73465
|
let isDone;
|
|
73216
73466
|
let rejected = false;
|
|
73217
73467
|
let req;
|
|
73218
73468
|
|
|
73469
|
+
httpVersion = +httpVersion;
|
|
73470
|
+
|
|
73471
|
+
if (Number.isNaN(httpVersion)) {
|
|
73472
|
+
throw TypeError(`Invalid protocol version: '${config.httpVersion}' is not a number`);
|
|
73473
|
+
}
|
|
73474
|
+
|
|
73475
|
+
if (httpVersion !== 1 && httpVersion !== 2) {
|
|
73476
|
+
throw TypeError(`Unsupported protocol version '${httpVersion}'`);
|
|
73477
|
+
}
|
|
73478
|
+
|
|
73479
|
+
const isHttp2 = httpVersion === 2;
|
|
73480
|
+
|
|
73219
73481
|
if (lookup) {
|
|
73220
73482
|
const _lookup = callbackify(lookup, (value) => utils$1.isArray(value) ? value : [value]);
|
|
73221
73483
|
// hotfix to support opt.all option which is required for node 20.x
|
|
@@ -73232,8 +73494,17 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
|
|
|
73232
73494
|
};
|
|
73233
73495
|
}
|
|
73234
73496
|
|
|
73235
|
-
|
|
73236
|
-
|
|
73497
|
+
const abortEmitter = new events.EventEmitter();
|
|
73498
|
+
|
|
73499
|
+
function abort(reason) {
|
|
73500
|
+
try {
|
|
73501
|
+
abortEmitter.emit('abort', !reason || reason.type ? new CanceledError$1(null, config, req) : reason);
|
|
73502
|
+
} catch(err) {
|
|
73503
|
+
console.warn('emit error', err);
|
|
73504
|
+
}
|
|
73505
|
+
}
|
|
73506
|
+
|
|
73507
|
+
abortEmitter.once('abort', reject);
|
|
73237
73508
|
|
|
73238
73509
|
const onFinished = () => {
|
|
73239
73510
|
if (config.cancelToken) {
|
|
@@ -73244,29 +73515,40 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
|
|
|
73244
73515
|
config.signal.removeEventListener('abort', abort);
|
|
73245
73516
|
}
|
|
73246
73517
|
|
|
73247
|
-
|
|
73518
|
+
abortEmitter.removeAllListeners();
|
|
73248
73519
|
};
|
|
73249
73520
|
|
|
73250
|
-
|
|
73521
|
+
if (config.cancelToken || config.signal) {
|
|
73522
|
+
config.cancelToken && config.cancelToken.subscribe(abort);
|
|
73523
|
+
if (config.signal) {
|
|
73524
|
+
config.signal.aborted ? abort() : config.signal.addEventListener('abort', abort);
|
|
73525
|
+
}
|
|
73526
|
+
}
|
|
73527
|
+
|
|
73528
|
+
onDone((response, isRejected) => {
|
|
73251
73529
|
isDone = true;
|
|
73530
|
+
|
|
73252
73531
|
if (isRejected) {
|
|
73253
73532
|
rejected = true;
|
|
73254
73533
|
onFinished();
|
|
73534
|
+
return;
|
|
73535
|
+
}
|
|
73536
|
+
|
|
73537
|
+
const {data} = response;
|
|
73538
|
+
|
|
73539
|
+
if (data instanceof stream.Readable || data instanceof stream.Duplex) {
|
|
73540
|
+
const offListeners = stream.finished(data, () => {
|
|
73541
|
+
offListeners();
|
|
73542
|
+
onFinished();
|
|
73543
|
+
});
|
|
73544
|
+
} else {
|
|
73545
|
+
onFinished();
|
|
73255
73546
|
}
|
|
73256
73547
|
});
|
|
73257
73548
|
|
|
73258
|
-
function abort(reason) {
|
|
73259
|
-
emitter.emit('abort', !reason || reason.type ? new CanceledError$1(null, config, req) : reason);
|
|
73260
|
-
}
|
|
73261
73549
|
|
|
73262
|
-
emitter.once('abort', reject);
|
|
73263
73550
|
|
|
73264
|
-
|
|
73265
|
-
config.cancelToken && config.cancelToken.subscribe(abort);
|
|
73266
|
-
if (config.signal) {
|
|
73267
|
-
config.signal.aborted ? abort() : config.signal.addEventListener('abort', abort);
|
|
73268
|
-
}
|
|
73269
|
-
}
|
|
73551
|
+
|
|
73270
73552
|
|
|
73271
73553
|
// Parse url
|
|
73272
73554
|
const fullPath = buildFullPath(config.baseURL, config.url, config.allowAbsoluteUrls);
|
|
@@ -73274,6 +73556,21 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
|
|
|
73274
73556
|
const protocol = parsed.protocol || supportedProtocols[0];
|
|
73275
73557
|
|
|
73276
73558
|
if (protocol === 'data:') {
|
|
73559
|
+
// Apply the same semantics as HTTP: only enforce if a finite, non-negative cap is set.
|
|
73560
|
+
if (config.maxContentLength > -1) {
|
|
73561
|
+
// Use the exact string passed to fromDataURI (config.url); fall back to fullPath if needed.
|
|
73562
|
+
const dataUrl = String(config.url || fullPath || '');
|
|
73563
|
+
const estimated = estimateDataURLDecodedBytes(dataUrl);
|
|
73564
|
+
|
|
73565
|
+
if (estimated > config.maxContentLength) {
|
|
73566
|
+
return reject(new AxiosError$1(
|
|
73567
|
+
'maxContentLength size of ' + config.maxContentLength + ' exceeded',
|
|
73568
|
+
AxiosError$1.ERR_BAD_RESPONSE,
|
|
73569
|
+
config
|
|
73570
|
+
));
|
|
73571
|
+
}
|
|
73572
|
+
}
|
|
73573
|
+
|
|
73277
73574
|
let convertedData;
|
|
73278
73575
|
|
|
73279
73576
|
if (method !== 'GET') {
|
|
@@ -73457,7 +73754,8 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
|
|
|
73457
73754
|
protocol,
|
|
73458
73755
|
family,
|
|
73459
73756
|
beforeRedirect: dispatchBeforeRedirect,
|
|
73460
|
-
beforeRedirects: {}
|
|
73757
|
+
beforeRedirects: {},
|
|
73758
|
+
http2Options
|
|
73461
73759
|
};
|
|
73462
73760
|
|
|
73463
73761
|
// cacheable-lookup integration hotfix
|
|
@@ -73474,18 +73772,23 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
|
|
|
73474
73772
|
let transport;
|
|
73475
73773
|
const isHttpsRequest = isHttps.test(options.protocol);
|
|
73476
73774
|
options.agent = isHttpsRequest ? config.httpsAgent : config.httpAgent;
|
|
73477
|
-
|
|
73478
|
-
|
|
73479
|
-
|
|
73480
|
-
transport = isHttpsRequest ? require$$4$1 : require$$3$2;
|
|
73775
|
+
|
|
73776
|
+
if (isHttp2) {
|
|
73777
|
+
transport = http2Transport;
|
|
73481
73778
|
} else {
|
|
73482
|
-
if (config.
|
|
73483
|
-
|
|
73484
|
-
}
|
|
73485
|
-
|
|
73486
|
-
|
|
73779
|
+
if (config.transport) {
|
|
73780
|
+
transport = config.transport;
|
|
73781
|
+
} else if (config.maxRedirects === 0) {
|
|
73782
|
+
transport = isHttpsRequest ? require$$4$1 : require$$3$2;
|
|
73783
|
+
} else {
|
|
73784
|
+
if (config.maxRedirects) {
|
|
73785
|
+
options.maxRedirects = config.maxRedirects;
|
|
73786
|
+
}
|
|
73787
|
+
if (config.beforeRedirect) {
|
|
73788
|
+
options.beforeRedirects.config = config.beforeRedirect;
|
|
73789
|
+
}
|
|
73790
|
+
transport = isHttpsRequest ? httpsFollow : httpFollow;
|
|
73487
73791
|
}
|
|
73488
|
-
transport = isHttpsRequest ? httpsFollow : httpFollow;
|
|
73489
73792
|
}
|
|
73490
73793
|
|
|
73491
73794
|
if (config.maxBodyLength > -1) {
|
|
@@ -73505,7 +73808,7 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
|
|
|
73505
73808
|
|
|
73506
73809
|
const streams = [res];
|
|
73507
73810
|
|
|
73508
|
-
const responseLength =
|
|
73811
|
+
const responseLength = utils$1.toFiniteNumber(res.headers['content-length']);
|
|
73509
73812
|
|
|
73510
73813
|
if (onDownloadProgress || maxDownloadRate) {
|
|
73511
73814
|
const transformStream = new AxiosTransformStream({
|
|
@@ -73568,10 +73871,7 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
|
|
|
73568
73871
|
|
|
73569
73872
|
responseStream = streams.length > 1 ? stream.pipeline(streams, utils$1.noop) : streams[0];
|
|
73570
73873
|
|
|
73571
|
-
|
|
73572
|
-
offListeners();
|
|
73573
|
-
onFinished();
|
|
73574
|
-
});
|
|
73874
|
+
|
|
73575
73875
|
|
|
73576
73876
|
const response = {
|
|
73577
73877
|
status: res.statusCode,
|
|
@@ -73597,7 +73897,7 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
|
|
|
73597
73897
|
// stream.destroy() emit aborted event before calling reject() on Node.js v16
|
|
73598
73898
|
rejected = true;
|
|
73599
73899
|
responseStream.destroy();
|
|
73600
|
-
|
|
73900
|
+
abort(new AxiosError$1('maxContentLength size of ' + config.maxContentLength + ' exceeded',
|
|
73601
73901
|
AxiosError$1.ERR_BAD_RESPONSE, config, lastRequest));
|
|
73602
73902
|
}
|
|
73603
73903
|
});
|
|
@@ -73639,7 +73939,7 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
|
|
|
73639
73939
|
});
|
|
73640
73940
|
}
|
|
73641
73941
|
|
|
73642
|
-
|
|
73942
|
+
abortEmitter.once('abort', err => {
|
|
73643
73943
|
if (!responseStream.destroyed) {
|
|
73644
73944
|
responseStream.emit('error', err);
|
|
73645
73945
|
responseStream.destroy();
|
|
@@ -73647,9 +73947,12 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
|
|
|
73647
73947
|
});
|
|
73648
73948
|
});
|
|
73649
73949
|
|
|
73650
|
-
|
|
73651
|
-
|
|
73652
|
-
|
|
73950
|
+
abortEmitter.once('abort', err => {
|
|
73951
|
+
if (req.close) {
|
|
73952
|
+
req.close();
|
|
73953
|
+
} else {
|
|
73954
|
+
req.destroy(err);
|
|
73955
|
+
}
|
|
73653
73956
|
});
|
|
73654
73957
|
|
|
73655
73958
|
// Handle errors
|
|
@@ -73671,7 +73974,7 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
|
|
|
73671
73974
|
const timeout = parseInt(config.timeout, 10);
|
|
73672
73975
|
|
|
73673
73976
|
if (Number.isNaN(timeout)) {
|
|
73674
|
-
|
|
73977
|
+
abort(new AxiosError$1(
|
|
73675
73978
|
'error trying to parse `config.timeout` to int',
|
|
73676
73979
|
AxiosError$1.ERR_BAD_OPTION_VALUE,
|
|
73677
73980
|
config,
|
|
@@ -73693,14 +73996,16 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
|
|
|
73693
73996
|
if (config.timeoutErrorMessage) {
|
|
73694
73997
|
timeoutErrorMessage = config.timeoutErrorMessage;
|
|
73695
73998
|
}
|
|
73696
|
-
|
|
73999
|
+
abort(new AxiosError$1(
|
|
73697
74000
|
timeoutErrorMessage,
|
|
73698
74001
|
transitional.clarifyTimeoutError ? AxiosError$1.ETIMEDOUT : AxiosError$1.ECONNABORTED,
|
|
73699
74002
|
config,
|
|
73700
74003
|
req
|
|
73701
74004
|
));
|
|
73702
|
-
abort();
|
|
73703
74005
|
});
|
|
74006
|
+
} else {
|
|
74007
|
+
// explicitly reset the socket timeout value for a possible `keep-alive` request
|
|
74008
|
+
req.setTimeout(0);
|
|
73704
74009
|
}
|
|
73705
74010
|
|
|
73706
74011
|
|
|
@@ -73726,7 +74031,8 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
|
|
|
73726
74031
|
|
|
73727
74032
|
data.pipe(req);
|
|
73728
74033
|
} else {
|
|
73729
|
-
req.
|
|
74034
|
+
data && req.write(data);
|
|
74035
|
+
req.end();
|
|
73730
74036
|
}
|
|
73731
74037
|
});
|
|
73732
74038
|
};
|
|
@@ -73748,27 +74054,38 @@ var cookies = platform.hasStandardBrowserEnv ?
|
|
|
73748
74054
|
|
|
73749
74055
|
// Standard browser envs support document.cookie
|
|
73750
74056
|
{
|
|
73751
|
-
write(name, value, expires, path, domain, secure) {
|
|
73752
|
-
|
|
73753
|
-
|
|
73754
|
-
utils$1.isNumber(expires) && cookie.push('expires=' + new Date(expires).toGMTString());
|
|
74057
|
+
write(name, value, expires, path, domain, secure, sameSite) {
|
|
74058
|
+
if (typeof document === 'undefined') return;
|
|
73755
74059
|
|
|
73756
|
-
|
|
74060
|
+
const cookie = [`${name}=${encodeURIComponent(value)}`];
|
|
73757
74061
|
|
|
73758
|
-
utils$1.
|
|
73759
|
-
|
|
73760
|
-
|
|
74062
|
+
if (utils$1.isNumber(expires)) {
|
|
74063
|
+
cookie.push(`expires=${new Date(expires).toUTCString()}`);
|
|
74064
|
+
}
|
|
74065
|
+
if (utils$1.isString(path)) {
|
|
74066
|
+
cookie.push(`path=${path}`);
|
|
74067
|
+
}
|
|
74068
|
+
if (utils$1.isString(domain)) {
|
|
74069
|
+
cookie.push(`domain=${domain}`);
|
|
74070
|
+
}
|
|
74071
|
+
if (secure === true) {
|
|
74072
|
+
cookie.push('secure');
|
|
74073
|
+
}
|
|
74074
|
+
if (utils$1.isString(sameSite)) {
|
|
74075
|
+
cookie.push(`SameSite=${sameSite}`);
|
|
74076
|
+
}
|
|
73761
74077
|
|
|
73762
74078
|
document.cookie = cookie.join('; ');
|
|
73763
74079
|
},
|
|
73764
74080
|
|
|
73765
74081
|
read(name) {
|
|
73766
|
-
|
|
73767
|
-
|
|
74082
|
+
if (typeof document === 'undefined') return null;
|
|
74083
|
+
const match = document.cookie.match(new RegExp('(?:^|; )' + name + '=([^;]*)'));
|
|
74084
|
+
return match ? decodeURIComponent(match[1]) : null;
|
|
73768
74085
|
},
|
|
73769
74086
|
|
|
73770
74087
|
remove(name) {
|
|
73771
|
-
this.write(name, '', Date.now() - 86400000);
|
|
74088
|
+
this.write(name, '', Date.now() - 86400000, '/');
|
|
73772
74089
|
}
|
|
73773
74090
|
}
|
|
73774
74091
|
|
|
@@ -73811,11 +74128,11 @@ function mergeConfig$1(config1, config2) {
|
|
|
73811
74128
|
}
|
|
73812
74129
|
|
|
73813
74130
|
// eslint-disable-next-line consistent-return
|
|
73814
|
-
function mergeDeepProperties(a, b, prop
|
|
74131
|
+
function mergeDeepProperties(a, b, prop, caseless) {
|
|
73815
74132
|
if (!utils$1.isUndefined(b)) {
|
|
73816
|
-
return getMergedValue(a, b, prop
|
|
74133
|
+
return getMergedValue(a, b, prop, caseless);
|
|
73817
74134
|
} else if (!utils$1.isUndefined(a)) {
|
|
73818
|
-
return getMergedValue(undefined, a, prop
|
|
74135
|
+
return getMergedValue(undefined, a, prop, caseless);
|
|
73819
74136
|
}
|
|
73820
74137
|
}
|
|
73821
74138
|
|
|
@@ -73873,7 +74190,7 @@ function mergeConfig$1(config1, config2) {
|
|
|
73873
74190
|
socketPath: defaultToConfig2,
|
|
73874
74191
|
responseEncoding: defaultToConfig2,
|
|
73875
74192
|
validateStatus: mergeDirectKeys,
|
|
73876
|
-
headers: (a, b
|
|
74193
|
+
headers: (a, b, prop) => mergeDeepProperties(headersToObject(a), headersToObject(b), prop, true)
|
|
73877
74194
|
};
|
|
73878
74195
|
|
|
73879
74196
|
utils$1.forEach(Object.keys({...config1, ...config2}), function computeConfigValue(prop) {
|
|
@@ -73888,7 +74205,7 @@ function mergeConfig$1(config1, config2) {
|
|
|
73888
74205
|
var resolveConfig = (config) => {
|
|
73889
74206
|
const newConfig = mergeConfig$1({}, config);
|
|
73890
74207
|
|
|
73891
|
-
let {data, withXSRFToken, xsrfHeaderName, xsrfCookieName, headers, auth} = newConfig;
|
|
74208
|
+
let { data, withXSRFToken, xsrfHeaderName, xsrfCookieName, headers, auth } = newConfig;
|
|
73892
74209
|
|
|
73893
74210
|
newConfig.headers = headers = AxiosHeaders$1.from(headers);
|
|
73894
74211
|
|
|
@@ -73901,17 +74218,21 @@ var resolveConfig = (config) => {
|
|
|
73901
74218
|
);
|
|
73902
74219
|
}
|
|
73903
74220
|
|
|
73904
|
-
let contentType;
|
|
73905
|
-
|
|
73906
74221
|
if (utils$1.isFormData(data)) {
|
|
73907
74222
|
if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv) {
|
|
73908
|
-
headers.setContentType(undefined); //
|
|
73909
|
-
} else if ((
|
|
73910
|
-
//
|
|
73911
|
-
const
|
|
73912
|
-
headers
|
|
74223
|
+
headers.setContentType(undefined); // browser handles it
|
|
74224
|
+
} else if (utils$1.isFunction(data.getHeaders)) {
|
|
74225
|
+
// Node.js FormData (like form-data package)
|
|
74226
|
+
const formHeaders = data.getHeaders();
|
|
74227
|
+
// Only set safe headers to avoid overwriting security headers
|
|
74228
|
+
const allowedHeaders = ['content-type', 'content-length'];
|
|
74229
|
+
Object.entries(formHeaders).forEach(([key, val]) => {
|
|
74230
|
+
if (allowedHeaders.includes(key.toLowerCase())) {
|
|
74231
|
+
headers.set(key, val);
|
|
74232
|
+
}
|
|
74233
|
+
});
|
|
73913
74234
|
}
|
|
73914
|
-
}
|
|
74235
|
+
}
|
|
73915
74236
|
|
|
73916
74237
|
// Add xsrf header
|
|
73917
74238
|
// This is only done if running in a standard browser environment.
|
|
@@ -74028,15 +74349,18 @@ var xhrAdapter = isXHRAdapterSupported && function (config) {
|
|
|
74028
74349
|
};
|
|
74029
74350
|
|
|
74030
74351
|
// Handle low level network errors
|
|
74031
|
-
|
|
74032
|
-
|
|
74033
|
-
|
|
74034
|
-
|
|
74035
|
-
|
|
74036
|
-
|
|
74037
|
-
|
|
74352
|
+
request.onerror = function handleError(event) {
|
|
74353
|
+
// Browsers deliver a ProgressEvent in XHR onerror
|
|
74354
|
+
// (message may be empty; when present, surface it)
|
|
74355
|
+
// See https://developer.mozilla.org/docs/Web/API/XMLHttpRequest/error_event
|
|
74356
|
+
const msg = event && event.message ? event.message : 'Network Error';
|
|
74357
|
+
const err = new AxiosError$1(msg, AxiosError$1.ERR_NETWORK, config, request);
|
|
74358
|
+
// attach the underlying event for consumers who want details
|
|
74359
|
+
err.event = event || null;
|
|
74360
|
+
reject(err);
|
|
74361
|
+
request = null;
|
|
74038
74362
|
};
|
|
74039
|
-
|
|
74363
|
+
|
|
74040
74364
|
// Handle timeout
|
|
74041
74365
|
request.ontimeout = function handleTimeout() {
|
|
74042
74366
|
let timeoutErrorMessage = _config.timeout ? 'timeout of ' + _config.timeout + 'ms exceeded' : 'timeout exceeded';
|
|
@@ -74250,14 +74574,18 @@ const trackStream = (stream, chunkSize, onProgress, onFinish) => {
|
|
|
74250
74574
|
})
|
|
74251
74575
|
};
|
|
74252
74576
|
|
|
74253
|
-
const
|
|
74254
|
-
|
|
74577
|
+
const DEFAULT_CHUNK_SIZE = 64 * 1024;
|
|
74578
|
+
|
|
74579
|
+
const {isFunction} = utils$1;
|
|
74580
|
+
|
|
74581
|
+
const globalFetchAPI = (({Request, Response}) => ({
|
|
74582
|
+
Request, Response
|
|
74583
|
+
}))(utils$1.global);
|
|
74584
|
+
|
|
74585
|
+
const {
|
|
74586
|
+
ReadableStream: ReadableStream$1, TextEncoder: TextEncoder$1
|
|
74587
|
+
} = utils$1.global;
|
|
74255
74588
|
|
|
74256
|
-
// used only inside the fetch adapter
|
|
74257
|
-
const encodeText = isFetchSupported && (typeof TextEncoder === 'function' ?
|
|
74258
|
-
((encoder) => (str) => encoder.encode(str))(new TextEncoder()) :
|
|
74259
|
-
async (str) => new Uint8Array(await new Response(str).arrayBuffer())
|
|
74260
|
-
);
|
|
74261
74589
|
|
|
74262
74590
|
const test = (fn, ...args) => {
|
|
74263
74591
|
try {
|
|
@@ -74267,278 +74595,380 @@ const test = (fn, ...args) => {
|
|
|
74267
74595
|
}
|
|
74268
74596
|
};
|
|
74269
74597
|
|
|
74270
|
-
const
|
|
74271
|
-
|
|
74598
|
+
const factory = (env) => {
|
|
74599
|
+
env = utils$1.merge.call({
|
|
74600
|
+
skipUndefined: true
|
|
74601
|
+
}, globalFetchAPI, env);
|
|
74272
74602
|
|
|
74273
|
-
const
|
|
74274
|
-
|
|
74275
|
-
|
|
74276
|
-
|
|
74277
|
-
duplexAccessed = true;
|
|
74278
|
-
return 'half';
|
|
74279
|
-
},
|
|
74280
|
-
}).headers.has('Content-Type');
|
|
74603
|
+
const {fetch: envFetch, Request, Response} = env;
|
|
74604
|
+
const isFetchSupported = envFetch ? isFunction(envFetch) : typeof fetch === 'function';
|
|
74605
|
+
const isRequestSupported = isFunction(Request);
|
|
74606
|
+
const isResponseSupported = isFunction(Response);
|
|
74281
74607
|
|
|
74282
|
-
|
|
74283
|
-
|
|
74608
|
+
if (!isFetchSupported) {
|
|
74609
|
+
return false;
|
|
74610
|
+
}
|
|
74284
74611
|
|
|
74285
|
-
const
|
|
74612
|
+
const isReadableStreamSupported = isFetchSupported && isFunction(ReadableStream$1);
|
|
74286
74613
|
|
|
74287
|
-
const
|
|
74288
|
-
|
|
74614
|
+
const encodeText = isFetchSupported && (typeof TextEncoder$1 === 'function' ?
|
|
74615
|
+
((encoder) => (str) => encoder.encode(str))(new TextEncoder$1()) :
|
|
74616
|
+
async (str) => new Uint8Array(await new Request(str).arrayBuffer())
|
|
74617
|
+
);
|
|
74289
74618
|
|
|
74619
|
+
const supportsRequestStream = isRequestSupported && isReadableStreamSupported && test(() => {
|
|
74620
|
+
let duplexAccessed = false;
|
|
74290
74621
|
|
|
74291
|
-
const
|
|
74292
|
-
|
|
74293
|
-
|
|
74622
|
+
const hasContentType = new Request(platform.origin, {
|
|
74623
|
+
body: new ReadableStream$1(),
|
|
74624
|
+
method: 'POST',
|
|
74625
|
+
get duplex() {
|
|
74626
|
+
duplexAccessed = true;
|
|
74627
|
+
return 'half';
|
|
74628
|
+
},
|
|
74629
|
+
}).headers.has('Content-Type');
|
|
74294
74630
|
|
|
74295
|
-
|
|
74296
|
-
['text', 'arrayBuffer', 'blob', 'formData', 'stream'].forEach(type => {
|
|
74297
|
-
!resolvers[type] && (resolvers[type] = utils$1.isFunction(res[type]) ? (res) => res[type]() :
|
|
74298
|
-
(_, config) => {
|
|
74299
|
-
throw new AxiosError$1(`Response type '${type}' is not supported`, AxiosError$1.ERR_NOT_SUPPORT, config);
|
|
74300
|
-
});
|
|
74631
|
+
return duplexAccessed && !hasContentType;
|
|
74301
74632
|
});
|
|
74302
|
-
})(new Response));
|
|
74303
74633
|
|
|
74304
|
-
const
|
|
74305
|
-
|
|
74306
|
-
return 0;
|
|
74307
|
-
}
|
|
74634
|
+
const supportsResponseStream = isResponseSupported && isReadableStreamSupported &&
|
|
74635
|
+
test(() => utils$1.isReadableStream(new Response('').body));
|
|
74308
74636
|
|
|
74309
|
-
|
|
74310
|
-
|
|
74311
|
-
}
|
|
74637
|
+
const resolvers = {
|
|
74638
|
+
stream: supportsResponseStream && ((res) => res.body)
|
|
74639
|
+
};
|
|
74312
74640
|
|
|
74313
|
-
|
|
74314
|
-
|
|
74315
|
-
|
|
74316
|
-
|
|
74641
|
+
isFetchSupported && ((() => {
|
|
74642
|
+
['text', 'arrayBuffer', 'blob', 'formData', 'stream'].forEach(type => {
|
|
74643
|
+
!resolvers[type] && (resolvers[type] = (res, config) => {
|
|
74644
|
+
let method = res && res[type];
|
|
74645
|
+
|
|
74646
|
+
if (method) {
|
|
74647
|
+
return method.call(res);
|
|
74648
|
+
}
|
|
74649
|
+
|
|
74650
|
+
throw new AxiosError$1(`Response type '${type}' is not supported`, AxiosError$1.ERR_NOT_SUPPORT, config);
|
|
74651
|
+
});
|
|
74317
74652
|
});
|
|
74318
|
-
|
|
74319
|
-
}
|
|
74653
|
+
})());
|
|
74320
74654
|
|
|
74321
|
-
|
|
74322
|
-
|
|
74323
|
-
|
|
74655
|
+
const getBodyLength = async (body) => {
|
|
74656
|
+
if (body == null) {
|
|
74657
|
+
return 0;
|
|
74658
|
+
}
|
|
74324
74659
|
|
|
74325
|
-
|
|
74326
|
-
|
|
74327
|
-
|
|
74660
|
+
if (utils$1.isBlob(body)) {
|
|
74661
|
+
return body.size;
|
|
74662
|
+
}
|
|
74328
74663
|
|
|
74329
|
-
|
|
74330
|
-
|
|
74331
|
-
|
|
74332
|
-
|
|
74664
|
+
if (utils$1.isSpecCompliantForm(body)) {
|
|
74665
|
+
const _request = new Request(platform.origin, {
|
|
74666
|
+
method: 'POST',
|
|
74667
|
+
body,
|
|
74668
|
+
});
|
|
74669
|
+
return (await _request.arrayBuffer()).byteLength;
|
|
74670
|
+
}
|
|
74333
74671
|
|
|
74334
|
-
|
|
74335
|
-
|
|
74672
|
+
if (utils$1.isArrayBufferView(body) || utils$1.isArrayBuffer(body)) {
|
|
74673
|
+
return body.byteLength;
|
|
74674
|
+
}
|
|
74336
74675
|
|
|
74337
|
-
|
|
74338
|
-
|
|
74676
|
+
if (utils$1.isURLSearchParams(body)) {
|
|
74677
|
+
body = body + '';
|
|
74678
|
+
}
|
|
74339
74679
|
|
|
74340
|
-
|
|
74341
|
-
|
|
74342
|
-
|
|
74343
|
-
|
|
74344
|
-
|
|
74345
|
-
|
|
74346
|
-
|
|
74347
|
-
|
|
74348
|
-
|
|
74349
|
-
|
|
74350
|
-
|
|
74351
|
-
|
|
74352
|
-
|
|
74353
|
-
|
|
74354
|
-
|
|
74355
|
-
|
|
74356
|
-
|
|
74357
|
-
|
|
74358
|
-
|
|
74359
|
-
|
|
74360
|
-
|
|
74361
|
-
|
|
74362
|
-
|
|
74680
|
+
if (utils$1.isString(body)) {
|
|
74681
|
+
return (await encodeText(body)).byteLength;
|
|
74682
|
+
}
|
|
74683
|
+
};
|
|
74684
|
+
|
|
74685
|
+
const resolveBodyLength = async (headers, body) => {
|
|
74686
|
+
const length = utils$1.toFiniteNumber(headers.getContentLength());
|
|
74687
|
+
|
|
74688
|
+
return length == null ? getBodyLength(body) : length;
|
|
74689
|
+
};
|
|
74690
|
+
|
|
74691
|
+
return async (config) => {
|
|
74692
|
+
let {
|
|
74693
|
+
url,
|
|
74694
|
+
method,
|
|
74695
|
+
data,
|
|
74696
|
+
signal,
|
|
74697
|
+
cancelToken,
|
|
74698
|
+
timeout,
|
|
74699
|
+
onDownloadProgress,
|
|
74700
|
+
onUploadProgress,
|
|
74701
|
+
responseType,
|
|
74702
|
+
headers,
|
|
74703
|
+
withCredentials = 'same-origin',
|
|
74704
|
+
fetchOptions
|
|
74705
|
+
} = resolveConfig(config);
|
|
74706
|
+
|
|
74707
|
+
let _fetch = envFetch || fetch;
|
|
74708
|
+
|
|
74709
|
+
responseType = responseType ? (responseType + '').toLowerCase() : 'text';
|
|
74710
|
+
|
|
74711
|
+
let composedSignal = composeSignals([signal, cancelToken && cancelToken.toAbortSignal()], timeout);
|
|
74712
|
+
|
|
74713
|
+
let request = null;
|
|
74714
|
+
|
|
74715
|
+
const unsubscribe = composedSignal && composedSignal.unsubscribe && (() => {
|
|
74363
74716
|
composedSignal.unsubscribe();
|
|
74364
|
-
|
|
74717
|
+
});
|
|
74365
74718
|
|
|
74366
|
-
|
|
74719
|
+
let requestContentLength;
|
|
74367
74720
|
|
|
74368
|
-
|
|
74369
|
-
|
|
74370
|
-
|
|
74371
|
-
|
|
74372
|
-
|
|
74373
|
-
|
|
74374
|
-
|
|
74375
|
-
|
|
74376
|
-
|
|
74377
|
-
|
|
74721
|
+
try {
|
|
74722
|
+
if (
|
|
74723
|
+
onUploadProgress && supportsRequestStream && method !== 'get' && method !== 'head' &&
|
|
74724
|
+
(requestContentLength = await resolveBodyLength(headers, data)) !== 0
|
|
74725
|
+
) {
|
|
74726
|
+
let _request = new Request(url, {
|
|
74727
|
+
method: 'POST',
|
|
74728
|
+
body: data,
|
|
74729
|
+
duplex: "half"
|
|
74730
|
+
});
|
|
74378
74731
|
|
|
74379
|
-
|
|
74732
|
+
let contentTypeHeader;
|
|
74380
74733
|
|
|
74381
|
-
|
|
74382
|
-
|
|
74383
|
-
|
|
74734
|
+
if (utils$1.isFormData(data) && (contentTypeHeader = _request.headers.get('content-type'))) {
|
|
74735
|
+
headers.setContentType(contentTypeHeader);
|
|
74736
|
+
}
|
|
74384
74737
|
|
|
74385
|
-
|
|
74386
|
-
|
|
74387
|
-
|
|
74388
|
-
|
|
74389
|
-
|
|
74738
|
+
if (_request.body) {
|
|
74739
|
+
const [onProgress, flush] = progressEventDecorator(
|
|
74740
|
+
requestContentLength,
|
|
74741
|
+
progressEventReducer(asyncDecorator(onUploadProgress))
|
|
74742
|
+
);
|
|
74390
74743
|
|
|
74391
|
-
|
|
74744
|
+
data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, onProgress, flush);
|
|
74745
|
+
}
|
|
74392
74746
|
}
|
|
74393
|
-
}
|
|
74394
74747
|
|
|
74395
|
-
|
|
74396
|
-
|
|
74397
|
-
|
|
74748
|
+
if (!utils$1.isString(withCredentials)) {
|
|
74749
|
+
withCredentials = withCredentials ? 'include' : 'omit';
|
|
74750
|
+
}
|
|
74398
74751
|
|
|
74399
|
-
|
|
74400
|
-
|
|
74401
|
-
|
|
74402
|
-
request = new Request(url, {
|
|
74403
|
-
...fetchOptions,
|
|
74404
|
-
signal: composedSignal,
|
|
74405
|
-
method: method.toUpperCase(),
|
|
74406
|
-
headers: headers.normalize().toJSON(),
|
|
74407
|
-
body: data,
|
|
74408
|
-
duplex: "half",
|
|
74409
|
-
credentials: isCredentialsSupported ? withCredentials : undefined
|
|
74410
|
-
});
|
|
74752
|
+
// Cloudflare Workers throws when credentials are defined
|
|
74753
|
+
// see https://github.com/cloudflare/workerd/issues/902
|
|
74754
|
+
const isCredentialsSupported = isRequestSupported && "credentials" in Request.prototype;
|
|
74411
74755
|
|
|
74412
|
-
|
|
74756
|
+
const resolvedOptions = {
|
|
74757
|
+
...fetchOptions,
|
|
74758
|
+
signal: composedSignal,
|
|
74759
|
+
method: method.toUpperCase(),
|
|
74760
|
+
headers: headers.normalize().toJSON(),
|
|
74761
|
+
body: data,
|
|
74762
|
+
duplex: "half",
|
|
74763
|
+
credentials: isCredentialsSupported ? withCredentials : undefined
|
|
74764
|
+
};
|
|
74413
74765
|
|
|
74414
|
-
|
|
74766
|
+
request = isRequestSupported && new Request(url, resolvedOptions);
|
|
74415
74767
|
|
|
74416
|
-
|
|
74417
|
-
const options = {};
|
|
74768
|
+
let response = await (isRequestSupported ? _fetch(request, fetchOptions) : _fetch(url, resolvedOptions));
|
|
74418
74769
|
|
|
74419
|
-
|
|
74420
|
-
options[prop] = response[prop];
|
|
74421
|
-
});
|
|
74770
|
+
const isStreamResponse = supportsResponseStream && (responseType === 'stream' || responseType === 'response');
|
|
74422
74771
|
|
|
74423
|
-
|
|
74772
|
+
if (supportsResponseStream && (onDownloadProgress || (isStreamResponse && unsubscribe))) {
|
|
74773
|
+
const options = {};
|
|
74424
74774
|
|
|
74425
|
-
|
|
74426
|
-
|
|
74427
|
-
|
|
74428
|
-
) || [];
|
|
74775
|
+
['status', 'statusText', 'headers'].forEach(prop => {
|
|
74776
|
+
options[prop] = response[prop];
|
|
74777
|
+
});
|
|
74429
74778
|
|
|
74430
|
-
|
|
74431
|
-
trackStream(response.body, DEFAULT_CHUNK_SIZE, onProgress, () => {
|
|
74432
|
-
flush && flush();
|
|
74433
|
-
unsubscribe && unsubscribe();
|
|
74434
|
-
}),
|
|
74435
|
-
options
|
|
74436
|
-
);
|
|
74437
|
-
}
|
|
74779
|
+
const responseContentLength = utils$1.toFiniteNumber(response.headers.get('content-length'));
|
|
74438
74780
|
|
|
74439
|
-
|
|
74781
|
+
const [onProgress, flush] = onDownloadProgress && progressEventDecorator(
|
|
74782
|
+
responseContentLength,
|
|
74783
|
+
progressEventReducer(asyncDecorator(onDownloadProgress), true)
|
|
74784
|
+
) || [];
|
|
74440
74785
|
|
|
74441
|
-
|
|
74786
|
+
response = new Response(
|
|
74787
|
+
trackStream(response.body, DEFAULT_CHUNK_SIZE, onProgress, () => {
|
|
74788
|
+
flush && flush();
|
|
74789
|
+
unsubscribe && unsubscribe();
|
|
74790
|
+
}),
|
|
74791
|
+
options
|
|
74792
|
+
);
|
|
74793
|
+
}
|
|
74442
74794
|
|
|
74443
|
-
|
|
74795
|
+
responseType = responseType || 'text';
|
|
74444
74796
|
|
|
74445
|
-
|
|
74446
|
-
settle(resolve, reject, {
|
|
74447
|
-
data: responseData,
|
|
74448
|
-
headers: AxiosHeaders$1.from(response.headers),
|
|
74449
|
-
status: response.status,
|
|
74450
|
-
statusText: response.statusText,
|
|
74451
|
-
config,
|
|
74452
|
-
request
|
|
74453
|
-
});
|
|
74454
|
-
})
|
|
74455
|
-
} catch (err) {
|
|
74456
|
-
unsubscribe && unsubscribe();
|
|
74797
|
+
let responseData = await resolvers[utils$1.findKey(resolvers, responseType) || 'text'](response, config);
|
|
74457
74798
|
|
|
74458
|
-
|
|
74459
|
-
|
|
74460
|
-
|
|
74461
|
-
{
|
|
74462
|
-
|
|
74463
|
-
|
|
74464
|
-
|
|
74799
|
+
!isStreamResponse && unsubscribe && unsubscribe();
|
|
74800
|
+
|
|
74801
|
+
return await new Promise((resolve, reject) => {
|
|
74802
|
+
settle(resolve, reject, {
|
|
74803
|
+
data: responseData,
|
|
74804
|
+
headers: AxiosHeaders$1.from(response.headers),
|
|
74805
|
+
status: response.status,
|
|
74806
|
+
statusText: response.statusText,
|
|
74807
|
+
config,
|
|
74808
|
+
request
|
|
74809
|
+
});
|
|
74810
|
+
})
|
|
74811
|
+
} catch (err) {
|
|
74812
|
+
unsubscribe && unsubscribe();
|
|
74813
|
+
|
|
74814
|
+
if (err && err.name === 'TypeError' && /Load failed|fetch/i.test(err.message)) {
|
|
74815
|
+
throw Object.assign(
|
|
74816
|
+
new AxiosError$1('Network Error', AxiosError$1.ERR_NETWORK, config, request),
|
|
74817
|
+
{
|
|
74818
|
+
cause: err.cause || err
|
|
74819
|
+
}
|
|
74820
|
+
)
|
|
74821
|
+
}
|
|
74822
|
+
|
|
74823
|
+
throw AxiosError$1.from(err, err && err.code, config, request);
|
|
74465
74824
|
}
|
|
74825
|
+
}
|
|
74826
|
+
};
|
|
74827
|
+
|
|
74828
|
+
const seedCache = new Map();
|
|
74829
|
+
|
|
74830
|
+
const getFetch = (config) => {
|
|
74831
|
+
let env = (config && config.env) || {};
|
|
74832
|
+
const {fetch, Request, Response} = env;
|
|
74833
|
+
const seeds = [
|
|
74834
|
+
Request, Response, fetch
|
|
74835
|
+
];
|
|
74466
74836
|
|
|
74467
|
-
|
|
74837
|
+
let len = seeds.length, i = len,
|
|
74838
|
+
seed, target, map = seedCache;
|
|
74839
|
+
|
|
74840
|
+
while (i--) {
|
|
74841
|
+
seed = seeds[i];
|
|
74842
|
+
target = map.get(seed);
|
|
74843
|
+
|
|
74844
|
+
target === undefined && map.set(seed, target = (i ? new Map() : factory(env)));
|
|
74845
|
+
|
|
74846
|
+
map = target;
|
|
74468
74847
|
}
|
|
74469
|
-
});
|
|
74470
74848
|
|
|
74849
|
+
return target;
|
|
74850
|
+
};
|
|
74851
|
+
|
|
74852
|
+
getFetch();
|
|
74853
|
+
|
|
74854
|
+
/**
|
|
74855
|
+
* Known adapters mapping.
|
|
74856
|
+
* Provides environment-specific adapters for Axios:
|
|
74857
|
+
* - `http` for Node.js
|
|
74858
|
+
* - `xhr` for browsers
|
|
74859
|
+
* - `fetch` for fetch API-based requests
|
|
74860
|
+
*
|
|
74861
|
+
* @type {Object<string, Function|Object>}
|
|
74862
|
+
*/
|
|
74471
74863
|
const knownAdapters = {
|
|
74472
74864
|
http: httpAdapter,
|
|
74473
74865
|
xhr: xhrAdapter,
|
|
74474
|
-
fetch:
|
|
74866
|
+
fetch: {
|
|
74867
|
+
get: getFetch,
|
|
74868
|
+
}
|
|
74475
74869
|
};
|
|
74476
74870
|
|
|
74871
|
+
// Assign adapter names for easier debugging and identification
|
|
74477
74872
|
utils$1.forEach(knownAdapters, (fn, value) => {
|
|
74478
74873
|
if (fn) {
|
|
74479
74874
|
try {
|
|
74480
|
-
Object.defineProperty(fn, 'name', {value});
|
|
74875
|
+
Object.defineProperty(fn, 'name', { value });
|
|
74481
74876
|
} catch (e) {
|
|
74482
74877
|
// eslint-disable-next-line no-empty
|
|
74483
74878
|
}
|
|
74484
|
-
Object.defineProperty(fn, 'adapterName', {value});
|
|
74879
|
+
Object.defineProperty(fn, 'adapterName', { value });
|
|
74485
74880
|
}
|
|
74486
74881
|
});
|
|
74487
74882
|
|
|
74883
|
+
/**
|
|
74884
|
+
* Render a rejection reason string for unknown or unsupported adapters
|
|
74885
|
+
*
|
|
74886
|
+
* @param {string} reason
|
|
74887
|
+
* @returns {string}
|
|
74888
|
+
*/
|
|
74488
74889
|
const renderReason = (reason) => `- ${reason}`;
|
|
74489
74890
|
|
|
74891
|
+
/**
|
|
74892
|
+
* Check if the adapter is resolved (function, null, or false)
|
|
74893
|
+
*
|
|
74894
|
+
* @param {Function|null|false} adapter
|
|
74895
|
+
* @returns {boolean}
|
|
74896
|
+
*/
|
|
74490
74897
|
const isResolvedHandle = (adapter) => utils$1.isFunction(adapter) || adapter === null || adapter === false;
|
|
74491
74898
|
|
|
74492
|
-
|
|
74493
|
-
|
|
74494
|
-
|
|
74495
|
-
|
|
74496
|
-
|
|
74497
|
-
|
|
74498
|
-
|
|
74899
|
+
/**
|
|
74900
|
+
* Get the first suitable adapter from the provided list.
|
|
74901
|
+
* Tries each adapter in order until a supported one is found.
|
|
74902
|
+
* Throws an AxiosError if no adapter is suitable.
|
|
74903
|
+
*
|
|
74904
|
+
* @param {Array<string|Function>|string|Function} adapters - Adapter(s) by name or function.
|
|
74905
|
+
* @param {Object} config - Axios request configuration
|
|
74906
|
+
* @throws {AxiosError} If no suitable adapter is available
|
|
74907
|
+
* @returns {Function} The resolved adapter function
|
|
74908
|
+
*/
|
|
74909
|
+
function getAdapter$1(adapters, config) {
|
|
74910
|
+
adapters = utils$1.isArray(adapters) ? adapters : [adapters];
|
|
74499
74911
|
|
|
74500
|
-
|
|
74912
|
+
const { length } = adapters;
|
|
74913
|
+
let nameOrAdapter;
|
|
74914
|
+
let adapter;
|
|
74501
74915
|
|
|
74502
|
-
|
|
74503
|
-
nameOrAdapter = adapters[i];
|
|
74504
|
-
let id;
|
|
74916
|
+
const rejectedReasons = {};
|
|
74505
74917
|
|
|
74506
|
-
|
|
74918
|
+
for (let i = 0; i < length; i++) {
|
|
74919
|
+
nameOrAdapter = adapters[i];
|
|
74920
|
+
let id;
|
|
74507
74921
|
|
|
74508
|
-
|
|
74509
|
-
adapter = knownAdapters[(id = String(nameOrAdapter)).toLowerCase()];
|
|
74922
|
+
adapter = nameOrAdapter;
|
|
74510
74923
|
|
|
74511
|
-
|
|
74512
|
-
|
|
74513
|
-
}
|
|
74514
|
-
}
|
|
74924
|
+
if (!isResolvedHandle(nameOrAdapter)) {
|
|
74925
|
+
adapter = knownAdapters[(id = String(nameOrAdapter)).toLowerCase()];
|
|
74515
74926
|
|
|
74516
|
-
if (adapter) {
|
|
74517
|
-
|
|
74927
|
+
if (adapter === undefined) {
|
|
74928
|
+
throw new AxiosError$1(`Unknown adapter '${id}'`);
|
|
74518
74929
|
}
|
|
74930
|
+
}
|
|
74519
74931
|
|
|
74520
|
-
|
|
74932
|
+
if (adapter && (utils$1.isFunction(adapter) || (adapter = adapter.get(config)))) {
|
|
74933
|
+
break;
|
|
74521
74934
|
}
|
|
74522
74935
|
|
|
74523
|
-
|
|
74936
|
+
rejectedReasons[id || '#' + i] = adapter;
|
|
74937
|
+
}
|
|
74524
74938
|
|
|
74525
|
-
|
|
74526
|
-
|
|
74527
|
-
|
|
74528
|
-
)
|
|
74939
|
+
if (!adapter) {
|
|
74940
|
+
const reasons = Object.entries(rejectedReasons)
|
|
74941
|
+
.map(([id, state]) => `adapter ${id} ` +
|
|
74942
|
+
(state === false ? 'is not supported by the environment' : 'is not available in the build')
|
|
74943
|
+
);
|
|
74529
74944
|
|
|
74530
|
-
|
|
74531
|
-
|
|
74532
|
-
|
|
74945
|
+
let s = length ?
|
|
74946
|
+
(reasons.length > 1 ? 'since :\n' + reasons.map(renderReason).join('\n') : ' ' + renderReason(reasons[0])) :
|
|
74947
|
+
'as no adapter specified';
|
|
74533
74948
|
|
|
74534
|
-
|
|
74535
|
-
|
|
74536
|
-
|
|
74537
|
-
|
|
74538
|
-
|
|
74949
|
+
throw new AxiosError$1(
|
|
74950
|
+
`There is no suitable adapter to dispatch the request ` + s,
|
|
74951
|
+
'ERR_NOT_SUPPORT'
|
|
74952
|
+
);
|
|
74953
|
+
}
|
|
74539
74954
|
|
|
74540
|
-
|
|
74541
|
-
|
|
74955
|
+
return adapter;
|
|
74956
|
+
}
|
|
74957
|
+
|
|
74958
|
+
/**
|
|
74959
|
+
* Exports Axios adapters and utility to resolve an adapter
|
|
74960
|
+
*/
|
|
74961
|
+
var adapters = {
|
|
74962
|
+
/**
|
|
74963
|
+
* Resolve an adapter from a list of adapter names or functions.
|
|
74964
|
+
* @type {Function}
|
|
74965
|
+
*/
|
|
74966
|
+
getAdapter: getAdapter$1,
|
|
74967
|
+
|
|
74968
|
+
/**
|
|
74969
|
+
* Exposes all known adapters
|
|
74970
|
+
* @type {Object<string, Function|Object>}
|
|
74971
|
+
*/
|
|
74542
74972
|
adapters: knownAdapters
|
|
74543
74973
|
};
|
|
74544
74974
|
|
|
@@ -74581,7 +75011,7 @@ function dispatchRequest(config) {
|
|
|
74581
75011
|
config.headers.setContentType('application/x-www-form-urlencoded', false);
|
|
74582
75012
|
}
|
|
74583
75013
|
|
|
74584
|
-
const adapter = adapters.getAdapter(config.adapter || defaults.adapter);
|
|
75014
|
+
const adapter = adapters.getAdapter(config.adapter || defaults.adapter, config);
|
|
74585
75015
|
|
|
74586
75016
|
return adapter(config).then(function onAdapterResolution(response) {
|
|
74587
75017
|
throwIfCancellationRequested(config);
|
|
@@ -74869,8 +75299,6 @@ let Axios$1 = class Axios {
|
|
|
74869
75299
|
|
|
74870
75300
|
let newConfig = config;
|
|
74871
75301
|
|
|
74872
|
-
i = 0;
|
|
74873
|
-
|
|
74874
75302
|
while (i < len) {
|
|
74875
75303
|
const onFulfilled = requestInterceptorChain[i++];
|
|
74876
75304
|
const onRejected = requestInterceptorChain[i++];
|
|
@@ -75170,6 +75598,12 @@ const HttpStatusCode$1 = {
|
|
|
75170
75598
|
LoopDetected: 508,
|
|
75171
75599
|
NotExtended: 510,
|
|
75172
75600
|
NetworkAuthenticationRequired: 511,
|
|
75601
|
+
WebServerIsDown: 521,
|
|
75602
|
+
ConnectionTimedOut: 522,
|
|
75603
|
+
OriginIsUnreachable: 523,
|
|
75604
|
+
TimeoutOccurred: 524,
|
|
75605
|
+
SslHandshakeFailed: 525,
|
|
75606
|
+
InvalidSslCertificate: 526,
|
|
75173
75607
|
};
|
|
75174
75608
|
|
|
75175
75609
|
Object.entries(HttpStatusCode$1).forEach(([key, value]) => {
|
|
@@ -75711,6 +76145,47 @@ const getExistingMetaFiles = (config) => {
|
|
|
75711
76145
|
}
|
|
75712
76146
|
return existingFiles;
|
|
75713
76147
|
};
|
|
76148
|
+
const generateAssetMap = (config) => {
|
|
76149
|
+
const metaAssetsDir = path.join(process.cwd(), config.sourceDir, config.dirs.assets, '_meta_assets');
|
|
76150
|
+
if (!fs.existsSync(metaAssetsDir)) {
|
|
76151
|
+
return;
|
|
76152
|
+
}
|
|
76153
|
+
const assetMap = {};
|
|
76154
|
+
const items = fs.readdirSync(metaAssetsDir);
|
|
76155
|
+
for (const item of items) {
|
|
76156
|
+
if (item.startsWith('_meta_') && item.endsWith('.json')) {
|
|
76157
|
+
const metaFilePath = path.join(metaAssetsDir, item);
|
|
76158
|
+
try {
|
|
76159
|
+
const metaContent = fs.readFileSync(metaFilePath, 'utf-8');
|
|
76160
|
+
const metaData = JSON.parse(metaContent);
|
|
76161
|
+
// Create the ref string in format: "ref(assetType:uuid:name.ext)"
|
|
76162
|
+
const refString = `ref(${metaData.type}:${metaData.uuid}:${metaData.file_name})`;
|
|
76163
|
+
// Create the require path relative to the assets directory
|
|
76164
|
+
const assetPath = `./${metaData.type}/${metaData.file_name}`;
|
|
76165
|
+
assetMap[refString] = `require("${assetPath}")`;
|
|
76166
|
+
}
|
|
76167
|
+
catch (error) {
|
|
76168
|
+
console.error(`Error reading meta file ${item}:`, error);
|
|
76169
|
+
}
|
|
76170
|
+
}
|
|
76171
|
+
}
|
|
76172
|
+
// Generate the asset map file content
|
|
76173
|
+
const assetMapContent = `// Auto-generated asset map
|
|
76174
|
+
// Do not edit this file manually
|
|
76175
|
+
|
|
76176
|
+
const assetMap = {
|
|
76177
|
+
${Object.entries(assetMap)
|
|
76178
|
+
.map(([ref, requirePath]) => ` "${ref}": ${requirePath}`)
|
|
76179
|
+
.join(',\n')}
|
|
76180
|
+
};
|
|
76181
|
+
|
|
76182
|
+
export default assetMap;
|
|
76183
|
+
`;
|
|
76184
|
+
// Write the asset map to the assets directory
|
|
76185
|
+
const assetMapPath = path.join(process.cwd(), config.sourceDir, config.dirs.assets, 'assetMap.ts');
|
|
76186
|
+
fs.writeFileSync(assetMapPath, assetMapContent);
|
|
76187
|
+
console.log(chalk.green(`ā Generated asset map: ${path.relative(process.cwd(), assetMapPath)}`));
|
|
76188
|
+
};
|
|
75714
76189
|
const syncAssets = async (configPath) => {
|
|
75715
76190
|
try {
|
|
75716
76191
|
const config = readConfig(configPath);
|
|
@@ -75789,6 +76264,9 @@ const syncAssets = async (configPath) => {
|
|
|
75789
76264
|
}
|
|
75790
76265
|
}
|
|
75791
76266
|
}
|
|
76267
|
+
// Generate asset map after all assets are processed
|
|
76268
|
+
console.log('\nGenerating asset map...');
|
|
76269
|
+
generateAssetMap(config);
|
|
75792
76270
|
console.log(chalk.green('\nAssets synchronized successfully.'));
|
|
75793
76271
|
}
|
|
75794
76272
|
catch (error) {
|