Repository: 3846masa/axios-cookiejar-support Branch: main Commit: 473750b9c90d Files: 34 Total size: 46.9 KB Directory structure: gitextract_n0d5mnjd/ ├── .github/ │ ├── FUNDING.yml │ ├── ISSUE_TEMPLATE/ │ │ └── bug_report.md │ ├── renovate.json │ └── workflows/ │ ├── default.yml │ └── stale.yml ├── .gitignore ├── .node-version ├── .npmrc ├── .prettierignore ├── .release-it.yaml ├── CHANGELOG.md ├── LICENSE ├── MIGRATION.md ├── README.md ├── babel.config.mjs ├── eslint.config.mjs ├── examples/ │ ├── basic.cjs │ ├── basic.mjs │ └── wrap_static_axios.mjs ├── noop.js ├── package.json ├── patches/ │ └── @semantic-release__git@10.0.1.patch ├── prettier.config.mjs ├── src/ │ ├── __tests__/ │ │ ├── basic.spec.ts │ │ ├── create_instance.spec.ts │ │ ├── default_config.spec.ts │ │ ├── helpers.ts │ │ ├── without_cookiejar.spec.ts │ │ └── wrap_instance.spec.ts │ ├── index.ts │ └── types.d.ts ├── tsconfig.build.json ├── tsconfig.json └── vitest.config.ts ================================================ FILE CONTENTS ================================================ ================================================ FILE: .github/FUNDING.yml ================================================ github: 3846masa ================================================ FILE: .github/ISSUE_TEMPLATE/bug_report.md ================================================ --- name: Bug report about: Create a report to help us improve title: '' labels: bug assignees: 3846masa --- ## Describe the bug A clear and concise description of what the bug is. ## To Reproduce Steps to reproduce the behavior: 1. Go to '...' 2. Click on '....' 3. Scroll down to '....' 4. See error ## Expected behavior A clear and concise description of what you expected to happen. ## Code that reproduces the bug Sharing code that reproduces the bug in RunKit, Glitch, etc. If the code is not shared, we will not be able to investigate and may close the issue. ## Environments - OS: [e.g. macOS] - Node.js version: [e.g. 12.0.0] - axios version: [e.g. 0.21.0] - tough-cookie version: [e.g. 4.0.0] ================================================ FILE: .github/renovate.json ================================================ { "$schema": "https://docs.renovatebot.com/renovate-schema.json", "extends": ["github>3846masa/configs//renovate/default#fde6015cc9703c2aee5630993ba80e43ce7120ba"] } ================================================ FILE: .github/workflows/default.yml ================================================ on: push: branches: - main pull_request: {} jobs: lint: name: Lint runs-on: ubuntu-latest steps: - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - uses: pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320 # v5.0.0 with: package_json_file: package.json - uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0 with: node-version-file: .node-version cache: pnpm - run: pnpm install - run: pnpm lint test: name: Test runs-on: ${{ matrix.os }} strategy: matrix: node: ["20", "22", "24"] os: ["ubuntu-latest", "macos-latest", "windows-latest"] steps: - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - uses: pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320 # v5.0.0 with: package_json_file: package.json - uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0 with: node-version: ${{ matrix.node }} cache: pnpm - run: pnpm install - run: pnpm test passed: name: All CI passed runs-on: ubuntu-latest needs: - lint - test if: always() steps: - uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 env: RESULT_JSON: ${{ toJSON(needs) }} with: script: | const result = JSON.parse(process.env.RESULT_JSON); const passed = Object.values(result).every(({ result }) => result === 'success'); if (!passed) process.exit(1); release: name: Release if: github.ref == 'refs/heads/main' needs: - passed runs-on: ubuntu-latest concurrency: group: release cancel-in-progress: false permissions: contents: read id-token: write steps: - uses: actions/create-github-app-token@1b10c78c7865c340bc4f6099eb2f838309f1e8c3 # v3.1.1 id: app-token with: app-id: Iv23liuADjK7bhvAlWZw private-key: ${{ secrets.RELEASE_BOT_PRIVATE_KEY }} - name: Checkout uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: token: ${{ steps.app-token.outputs.token }} fetch-depth: 0 - name: Configure Git run: | git config user.name 'github-actions[bot]' git config user.email '41898282+github-actions[bot]@users.noreply.github.com' - name: Setup pnpm uses: pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320 # v5.0.0 with: package_json_file: "package.json" - name: Setup Node.js uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0 with: node-version: 'lts/*' registry-url: 'https://registry.npmjs.org' cache: "pnpm" - run: pnpm install - run: pnpm build - name: Release env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} RELEASE_GITHUB_TOKEN: ${{ steps.app-token.outputs.token }} run: | pnpm run release # Release under the scoped package name jq '.name |= "@3846masa/axios-cookiejar-support"' package.json > /tmp/package.json && mv /tmp/package.json package.json pnpm run release --no-increment --no-git --no-github.release ================================================ FILE: .github/workflows/stale.yml ================================================ name: Close inactive issues on: schedule: - cron: '0 11 * * *' jobs: close-issues: name: Close inactive issues runs-on: ubuntu-latest permissions: issues: write pull-requests: write steps: - uses: actions/stale@b5d41d4e1d5dceea10e7104786b73624c18a190f # v10.2.0 with: days-before-stale: 30 days-before-close: 7 stale-issue-label: 'stale' stale-issue-message: 'This issue is stale because it has been open for 30 days with no activity.' close-issue-message: 'This issue was closed because it has been inactive for 7 days since being marked as stale.' stale-pr-message: 'This PR is stale because it has been open for 30 days with no activity.' close-pr-message: 'This PR was closed because it has been inactive for 7 days since being marked as stale.' exempt-pr-labels: 'dependencies' repo-token: ${{ secrets.GITHUB_TOKEN }} ================================================ FILE: .gitignore ================================================ # Created by https://www.toptal.com/developers/gitignore/api/node,windows,macos,linux,visualstudiocode # Edit at https://www.toptal.com/developers/gitignore?templates=node,windows,macos,linux,visualstudiocode ### Linux ### *~ # temporary files which can be created if a process still has a handle open of a deleted file .fuse_hidden* # KDE directory preferences .directory # Linux trash folder which might appear on any partition or disk .Trash-* # .nfs files are created when an open file is removed but is still being accessed .nfs* ### macOS ### # General .DS_Store .AppleDouble .LSOverride # Icon must end with two \r Icon # Thumbnails ._* # Files that might appear in the root of a volume .DocumentRevisions-V100 .fseventsd .Spotlight-V100 .TemporaryItems .Trashes .VolumeIcon.icns .com.apple.timemachine.donotpresent # Directories potentially created on remote AFP share .AppleDB .AppleDesktop Network Trash Folder Temporary Items .apdisk ### Node ### # Logs logs *.log npm-debug.log* yarn-debug.log* yarn-error.log* lerna-debug.log* .pnpm-debug.log* # Diagnostic reports (https://nodejs.org/api/report.html) report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json # Runtime data pids *.pid *.seed *.pid.lock # Directory for instrumented libs generated by jscoverage/JSCover lib-cov # Coverage directory used by tools like istanbul coverage *.lcov # nyc test coverage .nyc_output # Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) .grunt # Bower dependency directory (https://bower.io/) bower_components # node-waf configuration .lock-wscript # Compiled binary addons (https://nodejs.org/api/addons.html) build/Release # Dependency directories node_modules/ jspm_packages/ # Snowpack dependency directory (https://snowpack.dev/) web_modules/ # TypeScript cache *.tsbuildinfo # Optional npm cache directory .npm # Optional eslint cache .eslintcache # Microbundle cache .rpt2_cache/ .rts2_cache_cjs/ .rts2_cache_es/ .rts2_cache_umd/ # Optional REPL history .node_repl_history # Output of 'npm pack' *.tgz # Yarn Integrity file .yarn-integrity # dotenv environment variables file .env .env.test .env.production # parcel-bundler cache (https://parceljs.org/) .cache .parcel-cache # Next.js build output .next out # Nuxt.js build / generate output .nuxt dist # Gatsby files .cache/ # Comment in the public line in if your project uses Gatsby and not Next.js # https://nextjs.org/blog/next-9-1#public-directory-support # public # vuepress build output .vuepress/dist # Serverless directories .serverless/ # FuseBox cache .fusebox/ # DynamoDB Local files .dynamodb/ # TernJS port file .tern-port # Stores VSCode versions used for testing VSCode extensions .vscode-test # yarn v2 .yarn/cache .yarn/unplugged .yarn/build-state.yml .yarn/install-state.gz .pnp.* ### VisualStudioCode ### .vscode/* !.vscode/settings.json !.vscode/tasks.json !.vscode/launch.json !.vscode/extensions.json *.code-workspace # Local History for Visual Studio Code .history/ ### VisualStudioCode Patch ### # Ignore all local history of files .history .ionide ### Windows ### # Windows thumbnail cache files Thumbs.db Thumbs.db:encryptable ehthumbs.db ehthumbs_vista.db # Dump file *.stackdump # Folder config file [Dd]esktop.ini # Recycle Bin used on file shares $RECYCLE.BIN/ # Windows Installer files *.cab *.msi *.msix *.msm *.msp # Windows shortcuts *.lnk # End of https://www.toptal.com/developers/gitignore/api/node,windows,macos,linux,visualstudiocode ================================================ FILE: .node-version ================================================ 20.20.2 ================================================ FILE: .npmrc ================================================ save-prefix='' enable-pre-post-scripts=true shell-emulator=true engine-strict=true public-hoist-pattern[]=*eslint* public-hoist-pattern[]=*prettier* public-hoist-pattern[]=@tsconfig/* ================================================ FILE: .prettierignore ================================================ dist/ CHANGELOG.md *.yml *.yaml ================================================ FILE: .release-it.yaml ================================================ git: commitMessage: 'chore: release v${version} [skip ci]' pushArgs: ['--follow-tags', '--force'] github: release: true releaseName: 'Release v${version}' tokenRef: RELEASE_GITHUB_TOKEN npm: skipChecks: true plugins: '@release-it/conventional-changelog': infile: CHANGELOG.md preset: name: conventionalcommits bumpStrict: true ================================================ FILE: CHANGELOG.md ================================================ ## [6.0.5](https://github.com/3846masa/axios-cookiejar-support/compare/v6.0.4...v6.0.5) (2025-11-19) ### Bug Fixes * **npm:** update dependency http-cookie-agent to ^7.0.3 ([#1547](https://github.com/3846masa/axios-cookiejar-support/issues/1547)) ([d20fd55](https://github.com/3846masa/axios-cookiejar-support/commit/d20fd55bb5622509f80f3e4d5e63dce62b8c8ad0)) ## [6.0.4](https://github.com/3846masa/axios-cookiejar-support/compare/v6.0.3...v6.0.4) (2025-07-17) ### Bug Fixes * **npm:** update dependency http-cookie-agent to ^7.0.2 ([#1432](https://github.com/3846masa/axios-cookiejar-support/issues/1432)) ([6f3cfb3](https://github.com/3846masa/axios-cookiejar-support/commit/6f3cfb3b8c02307630b1f2a0b937f6adee8d92ff)) ## [6.0.3](https://github.com/3846masa/axios-cookiejar-support/compare/v6.0.2...v6.0.3) (2025-06-29) ### Bug Fixes * reorder "exports" field in package.json to place "default" key last ([#1398](https://github.com/3846masa/axios-cookiejar-support/issues/1398)) ([1f18baf](https://github.com/3846masa/axios-cookiejar-support/commit/1f18baf5424a93d56943bdbc50eec5a0c968771e)) ## [6.0.2](https://github.com/3846masa/axios-cookiejar-support/compare/v6.0.1...v6.0.2) (2025-04-26) ### Bug Fixes * improve module resolution compatibility with bundlers ([#1350](https://github.com/3846masa/axios-cookiejar-support/issues/1350)) ([4619c4d](https://github.com/3846masa/axios-cookiejar-support/commit/4619c4d812e4721a90d96bd0ff6faf374b6f3ecc)) ## [6.0.1](https://github.com/3846masa/axios-cookiejar-support/compare/v6.0.0...v6.0.1) (2025-04-23) ### Bug Fixes * restore main / types fields for npm ts badge ([#1348](https://github.com/3846masa/axios-cookiejar-support/issues/1348)) ([0970328](https://github.com/3846masa/axios-cookiejar-support/commit/097032888a2dd1a2e0bc687c615edb09c6af2209)) # [6.0.0](https://github.com/3846masa/axios-cookiejar-support/compare/v5.0.5...v6.0.0) (2025-04-14) ### Bug Fixes * **npm:** update dependency http-cookie-agent to v7 ([#1342](https://github.com/3846masa/axios-cookiejar-support/issues/1342)) ([8f51516](https://github.com/3846masa/axios-cookiejar-support/commit/8f51516630260c6e443057bf7a79ca0ee1b3570f)) ### chore * drop support for Node.js v18 ([#1341](https://github.com/3846masa/axios-cookiejar-support/issues/1341)) ([7cd7817](https://github.com/3846masa/axios-cookiejar-support/commit/7cd78175922242135c7c9265abb1f93c5a4f79c4)) ### Features * provides ESM only ([#1340](https://github.com/3846masa/axios-cookiejar-support/issues/1340)) ([5ffb726](https://github.com/3846masa/axios-cookiejar-support/commit/5ffb7261a9312598a63012c3cc035e89963433d8)) ### BREAKING CHANGES * Drop support for Node.js v18. See MIGRATION.md * CommonJS is no longer provided. See MIGRATION.md ## [5.0.5](https://github.com/3846masa/axios-cookiejar-support/compare/v5.0.4...v5.0.5) (2024-12-16) ### Bug Fixes * **npm:** update dependency http-cookie-agent to ^6.0.8 ([#1211](https://github.com/3846masa/axios-cookiejar-support/issues/1211)) ([047a8b4](https://github.com/3846masa/axios-cookiejar-support/commit/047a8b48506f6d67006087d7207ea1478d2ffcd5)) ## [5.0.4](https://github.com/3846masa/axios-cookiejar-support/compare/v5.0.3...v5.0.4) (2024-12-14) ### Bug Fixes * **npm:** update dependency http-cookie-agent to ^6.0.7 ([#1209](https://github.com/3846masa/axios-cookiejar-support/issues/1209)) ([a6b8e5b](https://github.com/3846masa/axios-cookiejar-support/commit/a6b8e5b35ba7bbca02a9d3d9bcb26a085e94deb4)) ## [5.0.3](https://github.com/3846masa/axios-cookiejar-support/compare/v5.0.2...v5.0.3) (2024-09-26) ### Bug Fixes * **npm:** update dependency http-cookie-agent to ^6.0.6 ([#1119](https://github.com/3846masa/axios-cookiejar-support/issues/1119)) ([dec5f97](https://github.com/3846masa/axios-cookiejar-support/commit/dec5f97278f154aa529b016384b579d3fa570960)) ## [5.0.2](https://github.com/3846masa/axios-cookiejar-support/compare/v5.0.1...v5.0.2) (2024-05-05) ### Bug Fixes * **npm:** update dependency http-cookie-agent to ^6.0.5 ([#996](https://github.com/3846masa/axios-cookiejar-support/issues/996)) ([5a16f9f](https://github.com/3846masa/axios-cookiejar-support/commit/5a16f9fb99a0536319d74bfba681a16945a135f4)) ## [5.0.1](https://github.com/3846masa/axios-cookiejar-support/compare/v5.0.0...v5.0.1) (2024-04-07) ### Bug Fixes * **npm:** update dependency http-cookie-agent to ^6.0.3 ([#968](https://github.com/3846masa/axios-cookiejar-support/issues/968)) ([4f0c06f](https://github.com/3846masa/axios-cookiejar-support/commit/4f0c06ff6dbcb82b7769a0abaf53853174a9666f)) # [5.0.0](https://github.com/3846masa/axios-cookiejar-support/compare/v4.0.7...v5.0.0) (2024-01-14) ### Features * drop Node.js v14 and v16 ([#880](https://github.com/3846masa/axios-cookiejar-support/issues/880)) ([c7e5e0b](https://github.com/3846masa/axios-cookiejar-support/commit/c7e5e0b6572e9859c291906f079f654dd5a37c97)) ### BREAKING CHANGES * drop Node.js v14 and v16 ## [4.0.7](https://github.com/3846masa/axios-cookiejar-support/compare/v4.0.6...v4.0.7) (2023-06-22) ### Bug Fixes * **npm:** update dependency http-cookie-agent to ^5.0.4 ([#764](https://github.com/3846masa/axios-cookiejar-support/issues/764)) ([c63b7bd](https://github.com/3846masa/axios-cookiejar-support/commit/c63b7bd7f237c1f3fb4c13a84fae9a09f56c8951)) ## [4.0.6](https://github.com/3846masa/axios-cookiejar-support/compare/v4.0.5...v4.0.6) (2023-01-01) ### Bug Fixes * **npm:** update dependency http-cookie-agent to v5 ([#655](https://github.com/3846masa/axios-cookiejar-support/issues/655)) ([42cc5ee](https://github.com/3846masa/axios-cookiejar-support/commit/42cc5ee9085be81257cd6c74c88caf0a5b35b6af)) ## [4.0.5](https://github.com/3846masa/axios-cookiejar-support/compare/v4.0.4...v4.0.5) (2022-12-28) ### Bug Fixes * **docs:** add funding link to README ([#653](https://github.com/3846masa/axios-cookiejar-support/issues/653)) ([d3a21b6](https://github.com/3846masa/axios-cookiejar-support/commit/d3a21b6f78dc13f89030300bd1837d98fdd847dd)) ## [4.0.4](https://github.com/3846masa/axios-cookiejar-support/compare/v4.0.3...v4.0.4) (2022-12-26) ### Bug Fixes * allow to reuse config (e.g. axios-retry) ([#650](https://github.com/3846masa/axios-cookiejar-support/issues/650)) ([86a759c](https://github.com/3846masa/axios-cookiejar-support/commit/86a759ca0ade2c39cda4e1c79eab2b8e1510d9f1)) ## [4.0.3](https://github.com/3846masa/axios-cookiejar-support/compare/v4.0.2...v4.0.3) (2022-07-26) ### Bug Fixes * **npm:** update dependency http-cookie-agent to ^4.0.2 ([#541](https://github.com/3846masa/axios-cookiejar-support/issues/541)) ([6246253](https://github.com/3846masa/axios-cookiejar-support/commit/6246253bbf89de29a6158a4c77e22209e06a5779)) ## [4.0.2](https://github.com/3846masa/axios-cookiejar-support/compare/v4.0.1...v4.0.2) (2022-05-24) ### Bug Fixes * **npm:** update dependency http-cookie-agent to ^4.0.1 ([#494](https://github.com/3846masa/axios-cookiejar-support/issues/494)) ([1c75dcf](https://github.com/3846masa/axios-cookiejar-support/commit/1c75dcfe8d5fcdb5f8c9891e3310a842e223b4e0)) ## [4.0.1](https://github.com/3846masa/axios-cookiejar-support/compare/v4.0.0...v4.0.1) (2022-05-08) ### Bug Fixes * **npm:** update dependency http-cookie-agent to ^4.0.0 ([#485](https://github.com/3846masa/axios-cookiejar-support/issues/485)) ([7b85d03](https://github.com/3846masa/axios-cookiejar-support/commit/7b85d03ce3134915fb3a08077a6bf3973ea67ef1)) # [4.0.0](https://github.com/3846masa/axios-cookiejar-support/compare/v3.0.0...v4.0.0) (2022-05-07) ### Features * **npm:** update dependency http-cookie-agent to ^3.0.0 ([#482](https://github.com/3846masa/axios-cookiejar-support/issues/482)) ([1dac53a](https://github.com/3846masa/axios-cookiejar-support/commit/1dac53a0c26e51c8d4327b3ee30304fc29ba1cf3)) ### BREAKING CHANGES * **npm:** an asynchronous Cookie store (e.g. `redis-cookie-store`) is no longer supported. # [3.0.0](https://github.com/3846masa/axios-cookiejar-support/compare/v2.0.5...v3.0.0) (2022-05-03) ### Features * drop Node.js v12 support ([#472](https://github.com/3846masa/axios-cookiejar-support/issues/472)) ([3ed3b37](https://github.com/3846masa/axios-cookiejar-support/commit/3ed3b3739fda356f2aa07c72c7b48c88b773e84f)) ### BREAKING CHANGES * drop Node.js v12 support, please use v14 or above ## [2.0.5](https://github.com/3846masa/axios-cookiejar-support/compare/v2.0.4...v2.0.5) (2022-05-02) ## [2.0.4](https://github.com/3846masa/axios-cookiejar-support/compare/v2.0.3...v2.0.4) (2022-02-27) ### Bug Fixes * **deps:** update actions/setup-node action to v3 ([#450](https://github.com/3846masa/axios-cookiejar-support/issues/450)) ([0b6fca2](https://github.com/3846masa/axios-cookiejar-support/commit/0b6fca2c3d89c271616d66495a18e75813f6c1f7)) ## [2.0.3](https://github.com/3846masa/axios-cookiejar-support/compare/v2.0.2...v2.0.3) (2021-10-14) ### Bug Fixes * fix supported node version ([#423](https://github.com/3846masa/axios-cookiejar-support/issues/423)) ([8fbbb45](https://github.com/3846masa/axios-cookiejar-support/commit/8fbbb45d0b0977d7d911b9cc5378eb2e7f0d8f6e)), closes [/github.com/3846masa/axios-cookiejar-support/issues/420#issuecomment-943350949](https://github.com//github.com/3846masa/axios-cookiejar-support/issues/420/issues/issuecomment-943350949) ## [2.0.2](https://github.com/3846masa/axios-cookiejar-support/compare/v2.0.1...v2.0.2) (2021-09-24) ### Bug Fixes * change axios semver in peer dependencies ([#411](https://github.com/3846masa/axios-cookiejar-support/issues/411)) ([f58c4b4](https://github.com/3846masa/axios-cookiejar-support/commit/f58c4b46bd08e989bf894e9f62c198824c7330c9)) ## [2.0.1](https://github.com/3846masa/axios-cookiejar-support/compare/v2.0.0...v2.0.1) (2021-09-24) ### Bug Fixes * send cookies even when target is same host but different port ([#408](https://github.com/3846masa/axios-cookiejar-support/issues/408)) ([b52126c](https://github.com/3846masa/axios-cookiejar-support/commit/b52126c765a507f8a1382e3571c32104561787d7)) # [2.0.0](https://github.com/3846masa/axios-cookiejar-support/compare/v1.9.9...v2.0.0) (2021-09-17) ### Features * refactoring ([59a4bd8](https://github.com/3846masa/axios-cookiejar-support/commit/59a4bd865f94b239fd7b8977d41148a54710bc5a)) ### BREAKING CHANGES * see MIGRATION.md ================================================ FILE: LICENSE ================================================ The MIT License (MIT) Copyright © 2021 3846masa Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================ FILE: MIGRATION.md ================================================ # MIGRATION GUIDES ## Migration guide from v5.x.x to v6.0.0 - [Update requirements.](#update-requirements) - [CommonJS is no longer provided.](#commonjs-is-no-longer-provided) ### Update requirements. - Node.js v20.0.0 or above ### CommonJS is no longer provided. If using Node.js >= v20.19.0 or >= v22.12.0, axios-cookiejar-support can be loaded from a CommonJS file. ## Migration guide from v3.x.x to v4.0.0 - [An asynchronous Cookie store is no longer supported.](#an-asynchronous-cookie-store-is-no-longer-supported) ### An asynchronous Cookie store is no longer supported. An asynchronous Cookie store (e.g. `redis-cookie-store`) is no longer supported. (If you create a CookieJar without options, this change has no effect.) `http-cookie-agent` allows to use an asynchronous Cookie store. ```js import axios from 'axios'; import { CookieJar } from 'tough-cookie'; import redis from 'redis'; import RedisCookieStore from 'redis-cookie-store'; import { HttpCookieAgent, HttpsCookieAgent } from 'http-cookie-agent/node:http'; const redisClient = redis.createClient(); const store = new RedisCookieStore(redisClient); const jar = new CookieJar(store); const client = axios.create({ httpAgent: new HttpCookieAgent({ cookies: { async_UNSTABLE: true, jar } }), httpsAgent: new HttpsCookieAgent({ cookies: { async_UNSTABLE: true, jar } }), }); await client.get('https://example.com'); ``` ## Migration guide from v2.x.x to v3.0.0 - [Update requirements.](#update-requirements-1) ### Update requirements. - Node.js v14.18.0 / v16.0.0 or above ## Migration guide from v1.0.x to v2.0.0 - [Update requirements.](#update-requirements-2) - [The wrapper function are exported as "named exports".](#the-wrapper-function-are-exported-as-named-exports) - [No longer refers to `config.withCredentials`.](#no-longer-refers-to-configwithcredentials) - [`config.httpAgent` / `config.httpsAgent` cannot use with `axios-cookiejar-support`.](#confighttpagent--confighttpsagent-cannot-use-with-axios-cookiejar-support) - [`config.jar` no longer accepts boolean.](#configjar-no-longer-accepts-boolean) - [Invalid cookies will always be ignored.](#invalid-cookies-will-always-be-ignored) ### Update requirements. - Node.js v12.19.0 / v14.5.0 or above - `axios@0.20.0` or above - `tough-cookie@4.0.0` or above ### The wrapper function are exported as "named exports". ```diff // CommonJS - const axiosCookieJarSupport = require('axios-cookiejar-support'); + const { wrapper: axiosCookieJarSupport } = require('axios-cookiejar-support'); ``` ```diff // ES Module - import axiosCookieJarSupport from 'axios-cookiejar-support'; + import { wrapper as axiosCookieJarSupport } from 'axios-cookiejar-support'; ``` ### No longer refers to `config.withCredentials`. ```diff // Remove config.withCredentials axios.get('https://example.com', { jar: new CookieJar(), - withCredentials: true, }); ``` If you want to prevent sending cookies, unset `config.jar` directly. ```diff // Remove config.jar for preventing to send cookie axios.get('https://example.com', { - jar: new CookieJar(), - withCredentials: false, }); ``` ### `config.httpAgent` / `config.httpsAgent` cannot use with `axios-cookiejar-support`. `http-cookie-agent` allows to use another Agent with CookieJar. ```js import axios from 'axios'; import { CookieJar } from 'tough-cookie'; import { createCookieAgent } from 'http-cookie-agent'; import httpProxyAgent from 'http-proxy-agent'; import httpsProxyAgent from 'https-proxy-agent'; const HttpProxyCookieAgent = createCookieAgent(httpProxyAgent.HttpProxyAgent); const HttpsProxyCookieAgent = createCookieAgent(httpsProxyAgent.HttpsProxyAgent); const jar = new CookieJar(); const client = axios.create({ httpAgent: new HttpProxyCookieAgent({ jar, hostname: '127.0.0.1', port: 8080 }), httpsAgent: new HttpsProxyCookieAgent({ jar, hostname: '127.0.0.1', port: 8080 }), }); await client.get('https://example.com'); ``` ### `config.jar` no longer accepts boolean. ```diff // Cannot use boolean as config.jar since v2.x + const cookieJar = new CookieJar(); axios.get('https://example.com', { - jar: true, + jar: cookieJar, }); ``` ### Invalid cookies will always be ignored. Up to v1.x, `axios-cookie-jar` throws an error by default when a client receives invalid cookies. However, since v2.0, `axios-cookie-jar` will always ignore invalid cookies. ```diff const cookieJar = new CookieJar(); axios.get('https://example.com', { jar: cookieJar, - ignoreCookieErrors: true, }); ``` ================================================ FILE: README.md ================================================ # axios-cookiejar-support ![axios-cookiejar-support](./docs/assets/ogp.jpg) [![github sponsors](https://flat.badgen.net/badge/GitHub%20Sponsors/Support%20me%20%E2%9D%A4/ff69b4?icon=github)](https://github.com/sponsors/3846masa) [![npm](https://flat.badgen.net/npm/v/axios-cookiejar-support)](https://www.npmjs.com/package/axios-cookiejar-support) [![license](https://flat.badgen.net/badge/license/MIT/blue)](LICENSE) [![standard-readme compliant](https://flat.badgen.net/badge/readme%20style/standard/green)](https://github.com/RichardLitt/standard-readme) Add `tough-cookie` support to axios. ## Table of Contents - [Install](#install) - [Usage](#usage) - [Extended Request Config](#extended-request-config) - [Contributing](#contributing) - [License](#license) ## Install ``` npm install axios tough-cookie axios-cookiejar-support ``` ## Usage ```js import axios from 'axios'; import { wrapper } from 'axios-cookiejar-support'; import { CookieJar } from 'tough-cookie'; const jar = new CookieJar(); const client = wrapper(axios.create({ jar })); await client.get('https://example.com'); ``` See [examples](./examples) for more details. ### Extended Request Config ```ts import type { CookieJar } from 'tough-cookie'; declare module 'axios' { interface AxiosRequestConfig { jar?: CookieJar; } } ``` See also https://github.com/axios/axios#request-config . ## FAQ - Q. Why can't I assign the httpAgent / httpsAgent? - A. axios-cookiejar-support uses httpAgent / httpsAgent to read and write cookies. If other Agents are assigned, cookies cannot be read/written. - Q. I want to use it with another Agent (e.g., http-proxy-agent). - A. Consider using http-cookie-agent. axios-cookiejar-support also uses http-cookie-agent. Read http-cookie-agent's README for more details. ## Contributing PRs accepted. ## License [MIT (c) 3846masa](./LICENSE) ================================================ FILE: babel.config.mjs ================================================ const config = { plugins: ['@babel/plugin-proposal-explicit-resource-management'], presets: [ [ '@babel/preset-env', { modules: false, targets: { node: 18 }, }, ], ['@babel/preset-typescript'], ], }; export default config; ================================================ FILE: eslint.config.mjs ================================================ import { configs as sharedConfigs } from '@3846masa/configs/eslint'; /** @type {import('eslint').Linter.Config[]} */ export default [ { ignores: ['dist/**', 'examples/**'], }, ...sharedConfigs, { files: ['examples/**/*'], rules: { 'import/order': [ 'error', { pathGroups: [ { group: 'external', pattern: 'axios-cookiejar-support', }, ], }, ], }, }, ]; ================================================ FILE: examples/basic.cjs ================================================ /* eslint-disable @typescript-eslint/no-require-imports */ 'use strict'; const { default: axios } = require('axios'); const { CookieJar } = require('tough-cookie'); const { wrapper } = require('axios-cookiejar-support'); const jar = new CookieJar(); const client = wrapper(axios.create({ jar })); void client.get('https://httpbin.org/cookies/set/session/userid').then(({ config }) => { console.log(config.jar?.toJSON()); }); ================================================ FILE: examples/basic.mjs ================================================ import axios from 'axios'; import { wrapper } from 'axios-cookiejar-support'; import { CookieJar } from 'tough-cookie'; async function main() { const jar = new CookieJar(); const client = wrapper(axios.create({ jar })); const { config } = await client.get('https://httpbin.org/cookies/set/session/userid'); console.log(config.jar?.toJSON()); } void main(); ================================================ FILE: examples/wrap_static_axios.mjs ================================================ import axios from 'axios'; import { wrapper } from 'axios-cookiejar-support'; import { CookieJar } from 'tough-cookie'; async function main() { wrapper(axios); const jar = new CookieJar(); const { config } = await axios.get('https://httpbin.org/cookies/set/session/userid', { jar, }); console.log(config.jar?.toJSON()); } void main(); ================================================ FILE: noop.js ================================================ /** * @template T * @param {T} axios * @returns {T} */ export function wrapper(axios) { return axios; } ================================================ FILE: package.json ================================================ { "name": "axios-cookiejar-support", "version": "6.0.5", "description": "Add tough-cookie support to axios.", "keywords": [ "axios", "cookie", "cookiejar", "cookies", "tough-cookie" ], "homepage": "https://github.com/3846masa/axios-cookiejar-support#readme", "bugs": { "url": "https://github.com/3846masa/axios-cookiejar-support/issues" }, "repository": { "type": "git", "url": "git+https://github.com/3846masa/axios-cookiejar-support.git" }, "funding": "https://github.com/sponsors/3846masa", "license": "MIT", "author": "3846masa <3846masahiro+git@gmail.com>", "type": "module", "exports": { ".": { "node": { "types": "./dist/index.d.ts", "default": "./dist/index.js" }, "browser": { "types": "./dist/index.d.ts", "default": "./noop.js" }, "default": { "types": "./dist/index.d.ts", "default": "./dist/index.js" } } }, "main": "./dist/index.js", "types": "./dist/index.d.ts", "files": [ "dist", "noop.js" ], "scripts": { "prebuild": "rimraf dist", "build": "tsc --project tsconfig.build.json", "format": "pnpm run --sequential \"/^format:.*/\"", "format:eslint": "eslint --fix .", "format:prettier": "prettier --write .", "prelint": "pnpm run build", "lint": "pnpm run \"/^lint:.*/\"", "lint:eslint": "eslint .", "lint:prettier": "prettier --check .", "lint:tsc": "tsc --noEmit", "release": "release-it", "test": "vitest run" }, "dependencies": { "http-cookie-agent": "^7.0.3" }, "devDependencies": { "@3846masa/configs": "github:3846masa/configs#fde6015cc9703c2aee5630993ba80e43ce7120ba", "@babel/plugin-proposal-explicit-resource-management": "7.27.4", "@babel/preset-env": "7.29.2", "@babel/preset-typescript": "7.28.5", "@release-it/conventional-changelog": "10.0.6", "@types/eslint": "9.6.1", "@types/node": "20.19.39", "axios": "1.13.2", "conventional-changelog-conventionalcommits": "9.3.1", "disposablestack": "1.1.7", "release-it": "19.2.4", "rimraf": "6.1.3", "tough-cookie": "6.0.1", "typescript": "6.0.2", "vitest": "4.0.18" }, "peerDependencies": { "axios": ">=0.20.0", "tough-cookie": ">=4.0.0" }, "packageManager": "pnpm@10.33.0", "engines": { "node": ">=20.0.0" }, "publishConfig": { "access": "public" }, "pnpm": { "overrides": { "conventional-changelog-conventionalcommits": "$conventional-changelog-conventionalcommits" } } } ================================================ FILE: patches/@semantic-release__git@10.0.1.patch ================================================ diff --git a/lib/git.js b/lib/git.js index 267ef1d7a38a4de2c1b9986333eb8b2782ec358b..5644689352ab0dfe9f83dbfc5c37156a3db8b3f1 100644 --- a/lib/git.js +++ b/lib/git.js @@ -48,7 +48,7 @@ async function commit(message, execaOptions) { * @throws {Error} if the push failed. */ async function push(origin, branch, execaOptions) { - await execa('git', ['push', '--tags', origin, `HEAD:${branch}`], execaOptions); + await execa('git', ['push', '--tags', '--force', origin, `HEAD:${branch}`], execaOptions); } /** ================================================ FILE: prettier.config.mjs ================================================ import { config as sharedConfig } from '@3846masa/configs/prettier'; export default { ...sharedConfig, }; ================================================ FILE: src/__tests__/basic.spec.ts ================================================ import http from 'node:http'; import https from 'node:https'; import axios from 'axios'; import { CookieJar } from 'tough-cookie'; import { beforeAll, expect, test } from 'vitest'; import { wrapper } from '../'; import { createTestServer } from './helpers'; beforeAll(() => { wrapper(axios); }); test('should receive response correctly', async () => { using server = await createTestServer([ (_req, res) => { res.end('Hello World!'); }, ]); const jar = new CookieJar(); const actual = await axios.get(`http://localhost:${server.port.toString(10)}`, { jar, responseType: 'text' }); expect(actual).toMatchObject({ data: 'Hello World!', status: 200, }); }); test('should store cookies to cookiejar', async () => { using server = await createTestServer([ (_req, res) => { res.setHeader('Set-Cookie', 'key=value'); res.end(); }, ]); const jar = new CookieJar(); await axios.get(`http://localhost:${server.port.toString(10)}`, { jar }); const actual = await jar.getCookies(`http://localhost:${server.port.toString(10)}`); expect(actual).toMatchObject([{ key: 'key', value: 'value' }]); }); test('should send cookies from cookiejar', async () => { using server = await createTestServer([ (req, res) => { res.write(req.headers['cookie']); res.end(); }, ]); const jar = new CookieJar(); await jar.setCookie('key=value', `http://localhost:${server.port.toString(10)}`); const { data: actual } = await axios.get(`http://localhost:${server.port.toString(10)}`, { jar, responseType: 'text', }); expect(actual).toBe('key=value'); }); test('should merge cookies from cookiejar and cookie header', async () => { using server = await createTestServer([ (req, res) => { res.write(req.headers['cookie']); res.end(); }, ]); const jar = new CookieJar(); await jar.setCookie('key1=value1', `http://localhost:${server.port.toString(10)}`); const { data: actual } = await axios.get(`http://localhost:${server.port.toString(10)}`, { headers: { Cookie: 'key2=value2' }, jar, responseType: 'text', }); expect(actual).toBe('key1=value1; key2=value2'); }); test('should send cookies which received first request when redirecting to same domain', async () => { using server = await createTestServer([ (_req, res) => { res.statusCode = 301; res.setHeader('Location', '/another-path'); res.setHeader('Set-Cookie', 'key=value'); res.end(); }, (req, res) => { res.write(req.headers['cookie']); res.end(); }, ]); const jar = new CookieJar(); const { data: actual } = await axios.get(`http://localhost:${server.port.toString(10)}`, { jar, responseType: 'text', }); expect(actual).toBe('key=value'); }); test('should not send cookies which received first request when redirecting to another domain', async () => { using server = await createTestServer([ (_req, res) => { res.statusCode = 301; res.setHeader('Location', `http://127.0.0.1:${server.port.toString(10)}`); res.setHeader('Set-Cookie', 'key=value'); res.end(); }, (req, res) => { res.write(JSON.stringify(req.headers)); res.end(); }, ]); const jar = new CookieJar(); const { data: actual } = await axios.get(`http://localhost:${server.port.toString(10)}`, { jar, responseType: 'json', }); expect(actual).not.toHaveProperty('cookie'); }); test('should send cookies even when target is same host but different port', async () => { using firstServer = await createTestServer([ (_req, res) => { res.setHeader('Set-Cookie', 'key=expected'); res.end(); }, ]); using secondServer = await createTestServer([ (req, res) => { res.write(req.headers['cookie']); res.end(); }, ]); const jar = new CookieJar(); await axios.get(`http://localhost:${firstServer.port.toString(10)}`, { jar }); const { data: actual } = await axios.get(`http://localhost:${secondServer.port.toString(10)}`, { jar, responseType: 'text', }); expect(actual).toBe('key=expected'); }); test('should throw error when config.httpAgent was assigned', async () => { using server = await createTestServer([ (_req, res) => { res.end(); }, ]); const jar = new CookieJar(); const actual = axios.get(`http://localhost:${server.port.toString(10)}`, { httpAgent: new http.Agent(), jar }); await expect(actual).rejects.toThrowError( expect.objectContaining({ message: 'axios-cookiejar-support does not support for use with other http(s).Agent.', }) as Error, ); }); test('should throw error when config.httpsAgent was assigned', async () => { using server = await createTestServer([ (_req, res) => { res.end(); }, ]); const jar = new CookieJar(); const actual = axios.get(`http://localhost:${server.port.toString(10)}`, { httpsAgent: new https.Agent(), jar }); await expect(actual).rejects.toThrowError( expect.objectContaining({ message: 'axios-cookiejar-support does not support for use with other http(s).Agent.', }) as Error, ); }); test('should throw error when config.jar was assigned with boolean', async () => { using server = await createTestServer([ (_req, res) => { res.end(); }, ]); const actual = axios.get(`http://localhost:${server.port.toString(10)}`, { // @ts-expect-error -- Legacy version allows to assign boolean as jar. jar: true, }); await expect(actual).rejects.toThrowError( expect.objectContaining({ message: 'config.jar does not accept boolean since axios-cookiejar-support@2.0.0.', }) as Error, ); }); test('should allow to reuse config', async () => { using server = await createTestServer([ (_req, res) => { res.end('Hello World!'); }, (_req, res) => { res.end('Hello World!'); }, ]); const jar = new CookieJar(); const { config } = await axios.get(`http://localhost:${server.port.toString(10)}`, { jar, responseType: 'text' }); const actual = axios.get(`http://localhost:${server.port.toString(10)}`, config); await expect(actual).resolves.not.toThrowError(); }); ================================================ FILE: src/__tests__/create_instance.spec.ts ================================================ import axios from 'axios'; import { CookieJar } from 'tough-cookie'; import { beforeAll, expect, test } from 'vitest'; import { wrapper } from '../'; import { createTestServer } from './helpers'; beforeAll(() => { wrapper(axios); }); test('should store cookies to cookiejar when using instance', async () => { using server = await createTestServer([ (_req, res) => { res.setHeader('Set-Cookie', 'key=value'); res.end(); }, ]); const jar = new CookieJar(); const client = axios.create({ jar }); await client.get(`http://localhost:${server.port.toString(10)}`); const actual = await jar.getCookies(`http://localhost:${server.port.toString(10)}`); expect(actual).toMatchObject([{ key: 'key', value: 'value' }]); }); test('should send cookies from cookiejar when using instance', async () => { using server = await createTestServer([ (req, res) => { res.write(req.headers['cookie']); res.end(); }, ]); const jar = new CookieJar(); const client = axios.create({ jar }); await jar.setCookie('key=value', `http://localhost:${server.port.toString(10)}`); const { data: actual } = await client.get(`http://localhost:${server.port.toString(10)}`, { responseType: 'text', }); expect(actual).toBe('key=value'); }); ================================================ FILE: src/__tests__/default_config.spec.ts ================================================ import axios from 'axios'; import { CookieJar } from 'tough-cookie'; import { afterEach, beforeAll, expect, test } from 'vitest'; import { wrapper } from '../'; import { createTestServer } from './helpers'; beforeAll(() => { wrapper(axios); }); afterEach(() => { delete axios.defaults.jar; }); test('should store cookies to cookiejar when default.jar was assigned', async () => { using server = await createTestServer([ (_req, res) => { res.setHeader('Set-Cookie', 'key=value'); res.end(); }, ]); const jar = new CookieJar(); axios.defaults.jar = jar; await axios.get(`http://localhost:${server.port.toString(10)}`); const actual = await jar.getCookies(`http://localhost:${server.port.toString(10)}`); expect(actual).toMatchObject([{ key: 'key', value: 'value' }]); }); test('should send cookies from cookiejar when default.jar was assigned', async () => { using server = await createTestServer([ (req, res) => { res.write(req.headers['cookie']); res.end(); }, ]); const jar = new CookieJar(); axios.defaults.jar = jar; await jar.setCookie('key=value', `http://localhost:${server.port.toString(10)}`); const { data: actual } = await axios.get(`http://localhost:${server.port.toString(10)}`, { responseType: 'text', }); expect(actual).toBe('key=value'); }); test('should use config.cookiejar in preference to default.jar', async () => { using server = await createTestServer([ (req, res) => { res.write(req.headers['cookie']); res.end(); }, ]); const defaultJar = new CookieJar(); axios.defaults.jar = defaultJar; await defaultJar.setCookie('key=default', `http://localhost:${server.port.toString(10)}`); const configJar = new CookieJar(); await configJar.setCookie('key=config', `http://localhost:${server.port.toString(10)}`); const { data: actual } = await axios.get(`http://localhost:${server.port.toString(10)}`, { jar: configJar, responseType: 'text', }); expect(actual).toBe('key=config'); }); ================================================ FILE: src/__tests__/helpers.ts ================================================ import http from 'node:http'; import { promisify } from 'node:util'; export async function createTestServer( stories: http.RequestListener[], ): Promise<{ [Symbol.dispose]: () => void; port: number }> { const server = http.createServer(); await promisify(server.listen.bind(server)).apply(null); const serverInfo = server.address(); if (serverInfo == null || typeof serverInfo === 'string') { throw new Error('Failed to setup a test server.'); } server.on('request', (req, res) => { const listener = stories.shift(); listener?.(req, res); }); return { [Symbol.dispose]: () => { server.close(); }, port: serverInfo.port, }; } ================================================ FILE: src/__tests__/without_cookiejar.spec.ts ================================================ import axios from 'axios'; import { beforeAll, expect, test } from 'vitest'; import { wrapper } from '../'; import { createTestServer } from './helpers'; beforeAll(() => { wrapper(axios); }); test('should receive response correctly without cookiejar', async () => { using server = await createTestServer([ (_req, res) => { res.end('Hello World!'); }, ]); const actual = await axios.get(`http://localhost:${server.port.toString(10)}`, { responseType: 'text' }); expect(actual).toMatchObject({ data: 'Hello World!', status: 200, }); }); ================================================ FILE: src/__tests__/wrap_instance.spec.ts ================================================ import axios from 'axios'; import { CookieJar } from 'tough-cookie'; import { expect, test } from 'vitest'; import { wrapper } from '../'; import { createTestServer } from './helpers'; test('should store cookies to cookiejar when instance was wrapped', async () => { using server = await createTestServer([ (_req, res) => { res.setHeader('Set-Cookie', 'key=value'); res.end(); }, ]); const jar = new CookieJar(); const client = wrapper(axios.create({ jar })); await client.get(`http://localhost:${server.port.toString(10)}`); const actual = await jar.getCookies(`http://localhost:${server.port.toString(10)}`); expect(actual).toMatchObject([{ key: 'key', value: 'value' }]); }); test('should send cookies from cookiejar when instance was wrapped', async () => { using server = await createTestServer([ (req, res) => { res.write(req.headers['cookie']); res.end(); }, ]); const jar = new CookieJar(); const client = wrapper(axios.create({ jar })); await jar.setCookie('key=value', `http://localhost:${server.port.toString(10)}`); const { data: actual } = await client.get(`http://localhost:${server.port.toString(10)}`, { responseType: 'text', }); expect(actual).toBe('key=value'); }); ================================================ FILE: src/index.ts ================================================ import type { AxiosInstance, AxiosStatic, InternalAxiosRequestConfig } from 'axios'; import { HttpCookieAgent, HttpsCookieAgent } from 'http-cookie-agent/http'; import type { CookieJar } from 'tough-cookie'; const AGENT_CREATED_BY_AXIOS_COOKIEJAR_SUPPORT = Symbol('AGENT_CREATED_BY_AXIOS_COOKIEJAR_SUPPORT'); type AttachedAgent = { [AGENT_CREATED_BY_AXIOS_COOKIEJAR_SUPPORT]?: boolean; }; declare module 'axios' { interface AxiosRequestConfig { jar?: CookieJar; } } function requestInterceptor(config: InternalAxiosRequestConfig): InternalAxiosRequestConfig { if (!config.jar) { return config; } // @ts-expect-error -- Legacy config allows to assign boolean as jar. if (config.jar === true) { throw new Error('config.jar does not accept boolean since axios-cookiejar-support@2.0.0.'); } if ( (config.httpAgent != null && (config.httpAgent as AttachedAgent)[AGENT_CREATED_BY_AXIOS_COOKIEJAR_SUPPORT] !== true) || (config.httpsAgent != null && (config.httpsAgent as AttachedAgent)[AGENT_CREATED_BY_AXIOS_COOKIEJAR_SUPPORT] !== true) ) { throw new Error('axios-cookiejar-support does not support for use with other http(s).Agent.'); } config.httpAgent = new HttpCookieAgent({ cookies: { jar: config.jar } }); Object.defineProperty(config.httpAgent, AGENT_CREATED_BY_AXIOS_COOKIEJAR_SUPPORT, { configurable: false, enumerable: false, value: true, writable: false, }); config.httpsAgent = new HttpsCookieAgent({ cookies: { jar: config.jar } }); Object.defineProperty(config.httpsAgent, AGENT_CREATED_BY_AXIOS_COOKIEJAR_SUPPORT, { configurable: false, enumerable: false, value: true, writable: false, }); return config; } export function wrapper(axios: T): T { const isWrapped = axios.interceptors.request.handlers.find(({ fulfilled }) => fulfilled === requestInterceptor); if (isWrapped) { return axios; } axios.interceptors.request.use(requestInterceptor); if ('create' in axios) { const create = axios.create.bind(axios); axios.create = (...args) => { const instance = create.apply(axios, args); instance.interceptors.request.use(requestInterceptor); return instance; }; } return axios; } ================================================ FILE: src/types.d.ts ================================================ import 'axios'; declare module 'axios' { interface AxiosInterceptorManager { handlers: Array<{ fulfilled: (...args: unknown[]) => unknown; rejected: (...args: unknown[]) => unknown; runWhen: unknown; synchronous: unknown; }>; } } ================================================ FILE: tsconfig.build.json ================================================ { "compilerOptions": { "declaration": true, "noEmit": false, "outDir": "./dist", "rootDir": "./src" }, "exclude": ["**/__tests__"], "extends": "./tsconfig.json", "include": ["src/"] } ================================================ FILE: tsconfig.json ================================================ { "compilerOptions": { "lib": ["ESNext"], "module": "ESNext", "moduleResolution": "bundler", "noEmit": true, "paths": { "axios-cookiejar-support": ["./"] }, "target": "ESNext", "types": ["@types/node"], "verbatimModuleSyntax": false }, "exclude": ["dist/", "examples/"], "extends": "@3846masa/configs/typescript/tsconfig.json", "include": ["**/*", "**/.*"] } ================================================ FILE: vitest.config.ts ================================================ import { defineConfig } from 'vitest/config'; export default defineConfig({ test: { include: ['**/__tests__/*.spec.ts'], root: './src', setupFiles: ['disposablestack/auto'], }, });