Framework updates

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
root
2026-03-04 23:20:19 +00:00
parent a89daf3d43
commit 3ed8517b2a
891 changed files with 11126 additions and 9600 deletions

View File

@@ -2,7 +2,7 @@ import utils from '../utils.js';
import httpAdapter from './http.js';
import xhrAdapter from './xhr.js';
import * as fetchAdapter from './fetch.js';
import AxiosError from "../core/AxiosError.js";
import AxiosError from '../core/AxiosError.js';
/**
* Known adapters mapping.
@@ -10,7 +10,7 @@ import AxiosError from "../core/AxiosError.js";
* - `http` for Node.js
* - `xhr` for browsers
* - `fetch` for fetch API-based requests
*
*
* @type {Object<string, Function|Object>}
*/
const knownAdapters = {
@@ -18,7 +18,7 @@ const knownAdapters = {
xhr: xhrAdapter,
fetch: {
get: fetchAdapter.getFetch,
}
},
};
// Assign adapter names for easier debugging and identification
@@ -35,7 +35,7 @@ utils.forEach(knownAdapters, (fn, value) => {
/**
* Render a rejection reason string for unknown or unsupported adapters
*
*
* @param {string} reason
* @returns {string}
*/
@@ -43,17 +43,18 @@ const renderReason = (reason) => `- ${reason}`;
/**
* Check if the adapter is resolved (function, null, or false)
*
*
* @param {Function|null|false} adapter
* @returns {boolean}
*/
const isResolvedHandle = (adapter) => utils.isFunction(adapter) || adapter === null || adapter === false;
const isResolvedHandle = (adapter) =>
utils.isFunction(adapter) || adapter === null || adapter === false;
/**
* Get the first suitable adapter from the provided list.
* Tries each adapter in order until a supported one is found.
* Throws an AxiosError if no adapter is suitable.
*
*
* @param {Array<string|Function>|string|Function} adapters - Adapter(s) by name or function.
* @param {Object} config - Axios request configuration
* @throws {AxiosError} If no suitable adapter is available
@@ -90,14 +91,17 @@ function getAdapter(adapters, config) {
}
if (!adapter) {
const reasons = Object.entries(rejectedReasons)
.map(([id, state]) => `adapter ${id} ` +
const reasons = Object.entries(rejectedReasons).map(
([id, state]) =>
`adapter ${id} ` +
(state === false ? 'is not supported by the environment' : 'is not available in the build')
);
);
let s = length ?
(reasons.length > 1 ? 'since :\n' + reasons.map(renderReason).join('\n') : ' ' + renderReason(reasons[0])) :
'as no adapter specified';
let s = length
? reasons.length > 1
? 'since :\n' + reasons.map(renderReason).join('\n')
: ' ' + renderReason(reasons[0])
: 'as no adapter specified';
throw new AxiosError(
`There is no suitable adapter to dispatch the request ` + s,
@@ -122,5 +126,5 @@ export default {
* Exposes all known adapters
* @type {Object<string, Function|Object>}
*/
adapters: knownAdapters
adapters: knownAdapters,
};