@wiajs/req 1.7.7

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.
Files changed (78) hide show
  1. package/CHANGELOG.md +1023 -0
  2. package/LICENSE +7 -0
  3. package/MIGRATION_GUIDE.md +3 -0
  4. package/README.md +1645 -0
  5. package/SECURITY.md +6 -0
  6. package/dist/node/req.cjs +4397 -0
  7. package/dist/node/req.mjs +3551 -0
  8. package/dist/web/req.mjs +2609 -0
  9. package/index.d.cts +545 -0
  10. package/index.d.ts +565 -0
  11. package/index.js +43 -0
  12. package/lib/adapters/README.md +37 -0
  13. package/lib/adapters/adapters.js +57 -0
  14. package/lib/adapters/fetch.js +229 -0
  15. package/lib/adapters/http.js +552 -0
  16. package/lib/adapters/xhr.js +200 -0
  17. package/lib/axios.js +89 -0
  18. package/lib/cancel/CancelToken.js +106 -0
  19. package/lib/cancel/CanceledError.js +20 -0
  20. package/lib/cancel/isCancel.js +4 -0
  21. package/lib/core/Axios.js +359 -0
  22. package/lib/core/AxiosError.js +89 -0
  23. package/lib/core/AxiosHeaders.js +243 -0
  24. package/lib/core/InterceptorManager.js +59 -0
  25. package/lib/core/README.md +8 -0
  26. package/lib/core/buildFullPath.js +18 -0
  27. package/lib/core/dispatchRequest.js +72 -0
  28. package/lib/core/mergeConfig.js +98 -0
  29. package/lib/core/settle.js +21 -0
  30. package/lib/core/transformData.js +22 -0
  31. package/lib/defaults/index.js +136 -0
  32. package/lib/defaults/transitional.js +6 -0
  33. package/lib/env/README.md +3 -0
  34. package/lib/env/classes/FormData.js +2 -0
  35. package/lib/env/data.js +1 -0
  36. package/lib/helpers/AxiosTransformStream.js +116 -0
  37. package/lib/helpers/AxiosURLSearchParams.js +50 -0
  38. package/lib/helpers/HttpStatusCode.js +69 -0
  39. package/lib/helpers/README.md +7 -0
  40. package/lib/helpers/ZlibHeaderTransformStream.js +22 -0
  41. package/lib/helpers/bind.js +6 -0
  42. package/lib/helpers/buildURL.js +42 -0
  43. package/lib/helpers/callbackify.js +14 -0
  44. package/lib/helpers/combineURLs.js +11 -0
  45. package/lib/helpers/composeSignals.js +37 -0
  46. package/lib/helpers/cookies.js +29 -0
  47. package/lib/helpers/deprecatedMethod.js +18 -0
  48. package/lib/helpers/formDataToJSON.js +78 -0
  49. package/lib/helpers/formDataToStream.js +77 -0
  50. package/lib/helpers/fromDataURI.js +44 -0
  51. package/lib/helpers/isAbsoluteURL.js +13 -0
  52. package/lib/helpers/isAxiosError.js +11 -0
  53. package/lib/helpers/isURLSameOrigin.js +50 -0
  54. package/lib/helpers/null.js +2 -0
  55. package/lib/helpers/parseHeaders.js +61 -0
  56. package/lib/helpers/parseProtocol.js +5 -0
  57. package/lib/helpers/progressEventReducer.js +54 -0
  58. package/lib/helpers/readBlob.js +13 -0
  59. package/lib/helpers/resolveConfig.js +45 -0
  60. package/lib/helpers/speedometer.js +40 -0
  61. package/lib/helpers/spread.js +26 -0
  62. package/lib/helpers/throttle.js +41 -0
  63. package/lib/helpers/toFormData.js +175 -0
  64. package/lib/helpers/toURLEncodedForm.js +15 -0
  65. package/lib/helpers/trackStream.js +75 -0
  66. package/lib/helpers/validator.js +84 -0
  67. package/lib/platform/browser/classes/Blob.js +2 -0
  68. package/lib/platform/browser/classes/FormData.js +2 -0
  69. package/lib/platform/browser/classes/URLSearchParams.js +3 -0
  70. package/lib/platform/browser/index.js +19 -0
  71. package/lib/platform/common/utils.js +37 -0
  72. package/lib/platform/index.js +6 -0
  73. package/lib/platform/node/classes/FormData.js +2 -0
  74. package/lib/platform/node/classes/URLSearchParams.js +3 -0
  75. package/lib/platform/node/index.js +16 -0
  76. package/lib/req.js +67 -0
  77. package/lib/utils.js +635 -0
  78. package/package.json +214 -0
package/package.json ADDED
@@ -0,0 +1,214 @@
1
+ {
2
+ "name": "@wiajs/req",
3
+ "version": "1.7.7",
4
+ "description": "Promise And Stream based AXIOS client for the browser and node.js",
5
+ "type": "module",
6
+ "types": "index.d.ts",
7
+ "main": "index.js",
8
+ "browser": {
9
+ "./lib/adapters/http.js": "./lib/helpers/null.js",
10
+ "./lib/platform/node/index.js": "./lib/platform/browser/index.js",
11
+ "./lib/platform/node/classes/FormData.js": "./lib/helpers/null.js"
12
+ },
13
+ "exports": {
14
+ ".": {
15
+ "types": {
16
+ "require": "./index.d.cts",
17
+ "default": "./index.d.ts"
18
+ },
19
+ "browser": {
20
+ "require": "./dist/web/req.cjs",
21
+ "default": "./index.js"
22
+ },
23
+ "default": {
24
+ "require": "./dist/node/req.cjs",
25
+ "default": "./index.js"
26
+ }
27
+ },
28
+ "./lib/adapters/http.js": "./lib/adapters/http.js",
29
+ "./lib/adapters/xhr.js": "./lib/adapters/xhr.js",
30
+ "./unsafe/*": "./lib/*",
31
+ "./unsafe/core/settle.js": "./lib/core/settle.js",
32
+ "./unsafe/core/buildFullPath.js": "./lib/core/buildFullPath.js",
33
+ "./unsafe/helpers/isAbsoluteURL.js": "./lib/helpers/isAbsoluteURL.js",
34
+ "./unsafe/helpers/buildURL.js": "./lib/helpers/buildURL.js",
35
+ "./unsafe/helpers/combineURLs.js": "./lib/helpers/combineURLs.js",
36
+ "./unsafe/adapters/http.js": "./lib/adapters/http.js",
37
+ "./unsafe/adapters/xhr.js": "./lib/adapters/xhr.js",
38
+ "./unsafe/utils.js": "./lib/utils.js",
39
+ "./package.json": "./package.json"
40
+ },
41
+ "scripts": {
42
+ "test": "npm run test:eslint && npm run test:mocha && npm run test:karma && npm run test:dtslint && npm run test:exports",
43
+ "test:eslint": "node bin/ssl_hotfix.js eslint lib/**/*.js",
44
+ "test:dtslint": "dtslint --localTs node_modules/typescript/lib",
45
+ "test:mocha": "node bin/ssl_hotfix.js mocha test/unit/**/*.js --timeout 30000 --exit",
46
+ "test:exports": "node bin/ssl_hotfix.js mocha test/module/test.js --timeout 30000 --exit",
47
+ "test:karma": "node bin/ssl_hotfix.js cross-env LISTEN_ADDR=:: karma start karma.conf.cjs --single-run",
48
+ "test:karma:firefox": "node bin/ssl_hotfix.js cross-env LISTEN_ADDR=:: Browsers=Firefox karma start karma.conf.cjs --single-run",
49
+ "test:karma:server": "node bin/ssl_hotfix.js cross-env karma start karma.conf.cjs",
50
+ "test:build:version": "node ./bin/check-build-version.js",
51
+ "start": "node ./sandbox/server.js",
52
+ "preversion-x": "gulp version",
53
+ "version": "npm run build && git add dist && git add package.json",
54
+ "prepublishOnly-x": "npm run test:build:version",
55
+ "postpublish": "git push && git push --tags",
56
+ "build-x": "gulp clear && cross-env NODE_ENV=production rollup -c -m",
57
+ "bin": "swc --config-file ./bin.swcrc ./src -d bin -w --strip-leading-paths",
58
+ "lib": "swc --config-file ./lib.swcrc ./src -d lib -w --strip-leading-paths",
59
+ "build": "cross-env NODE_ENV=production gulp build",
60
+ "examples": "node ./examples/server.js",
61
+ "coveralls": "cat coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js",
62
+ "fix": "eslint --fix lib/**/*.js",
63
+ "prepare-x": "husky install && npm run prepare:hooks",
64
+ "prepare:hooks": "npx husky set .husky/commit-msg \"npx commitlint --edit $1\"",
65
+ "release:dry": "release-it --dry-run --no-npm",
66
+ "release:info": "release-it --release-version",
67
+ "release:beta:no-npm": "release-it --preRelease=beta --no-npm",
68
+ "release:beta": "release-it --preRelease=beta",
69
+ "release:no-npm": "release-it --no-npm",
70
+ "release:changelog:fix": "node ./bin/injectContributorsList.js && git add CHANGELOG.md",
71
+ "release": "release-it"
72
+ },
73
+ "repository": {
74
+ "type": "git",
75
+ "url": "https://github.com/wiajs/req.git"
76
+ },
77
+ "keywords": ["xhr", "http", "ajax", "promise", "stream", "node"],
78
+ "author": "Sibyl Yu <sibyl@wia.pub>",
79
+ "bugs": "https://github.com/wiajs/req/issues",
80
+ "homepage": "https://wiajs.pub/req",
81
+ "license": "MIT",
82
+ "publishConfig": {
83
+ "access": "public"
84
+ },
85
+ "devDependencies": {
86
+ "@babel/core": "^7.23.9",
87
+ "@babel/preset-env": "^7.23.9",
88
+ "@commitlint/cli": "^17.8.1",
89
+ "@commitlint/config-conventional": "^17.8.1",
90
+ "@release-it/conventional-changelog": "^5.1.1",
91
+ "@rollup/plugin-babel": "^5.3.1",
92
+ "@rollup/plugin-commonjs": "^15.1.0",
93
+ "@rollup/plugin-json": "^4.1.0",
94
+ "@rollup/plugin-multi-entry": "^4.1.0",
95
+ "@rollup/plugin-node-resolve": "^9.0.0",
96
+ "abortcontroller-polyfill": "^1.7.5",
97
+ "auto-changelog": "^2.4.0",
98
+ "body-parser": "^1.20.2",
99
+ "chalk": "^5.3.0",
100
+ "coveralls": "^3.1.1",
101
+ "cross-env": "^7.0.3",
102
+ "dev-null": "^0.1.1",
103
+ "dtslint": "^4.2.1",
104
+ "es6-promise": "^4.2.8",
105
+ "eslint": "^8.56.0",
106
+ "express": "^4.18.2",
107
+ "formdata-node": "^5.0.1",
108
+ "formidable": "^2.1.2",
109
+ "fs-extra": "^10.1.0",
110
+ "get-stream": "^3.0.0",
111
+ "gulp": "^4.0.2",
112
+ "gzip-size": "^7.0.0",
113
+ "handlebars": "^4.7.8",
114
+ "husky": "^8.0.3",
115
+ "istanbul-instrumenter-loader": "^3.0.1",
116
+ "jasmine-core": "^2.99.1",
117
+ "karma": "^6.3.17",
118
+ "karma-chrome-launcher": "^3.2.0",
119
+ "karma-firefox-launcher": "^2.1.2",
120
+ "karma-jasmine": "^1.1.2",
121
+ "karma-jasmine-ajax": "^0.1.13",
122
+ "karma-rollup-preprocessor": "^7.0.8",
123
+ "karma-safari-launcher": "^1.0.0",
124
+ "karma-sauce-launcher": "^4.3.6",
125
+ "karma-sinon": "^1.0.5",
126
+ "karma-sourcemap-loader": "^0.3.8",
127
+ "memoizee": "^0.4.15",
128
+ "minimist": "^1.2.8",
129
+ "mocha": "^10.3.0",
130
+ "multer": "^1.4.4",
131
+ "pretty-bytes": "^6.1.1",
132
+ "release-it": "^15.11.0",
133
+ "rollup": "^2.79.1",
134
+ "rollup-plugin-auto-external": "^2.0.0",
135
+ "rollup-plugin-bundle-size": "^1.0.3",
136
+ "rollup-plugin-terser": "^7.0.2",
137
+ "sinon": "^4.5.0",
138
+ "stream-throttle": "^0.1.3",
139
+ "string-replace-async": "^3.0.2",
140
+ "terser-webpack-plugin": "^4.2.3",
141
+ "typescript": "^4.9.5",
142
+ "@rollup/plugin-alias": "^5.1.0"
143
+ },
144
+ "dependencies": {
145
+ "@wiajs/log": "^4.3.11",
146
+ "@wiajs/request": "^3.0.8",
147
+ "@wiajs/agent": "^1.0.13",
148
+ "form-data": "^4.0.0",
149
+ "proxy-from-env": "^1.1.0"
150
+ },
151
+ "jsdelivr": "dist/req.min.js",
152
+ "unpkg": "dist/req.min.js",
153
+ "typings": "./index.d.ts",
154
+ "bundlesize": [
155
+ {
156
+ "path": "./dist/req.min.js",
157
+ "threshold": "5kB"
158
+ }
159
+ ],
160
+ "contributors": [
161
+ "Sibyl Yu (https://github.com/wiajs)",
162
+ "Matt Zabriskie (https://github.com/mzabriskie)",
163
+ "Nick Uraltsev (https://github.com/nickuraltsev)",
164
+ "Dmitriy Mozgovoy (https://github.com/DigitalBrainJS)",
165
+ "Jay (https://github.com/jasonsaayman)",
166
+ "Emily Morehouse (https://github.com/emilyemorehouse)",
167
+ "Rubén Norte (https://github.com/rubennorte)",
168
+ "Justin Beckwith (https://github.com/JustinBeckwith)",
169
+ "Martti Laine (https://github.com/codeclown)",
170
+ "Xianming Zhong (https://github.com/chinesedfan)",
171
+ "Rikki Gibson (https://github.com/RikkiGibson)",
172
+ "Remco Haszing (https://github.com/remcohaszing)",
173
+ "Yasu Flores (https://github.com/yasuf)",
174
+ "Ben Carp (https://github.com/carpben)"
175
+ ],
176
+ "sideEffects": false,
177
+ "release-it": {
178
+ "git": {
179
+ "commitMessage": "chore(release): v${version}",
180
+ "push": true,
181
+ "commit": true,
182
+ "tag": true,
183
+ "requireCommits": false,
184
+ "requireCleanWorkingDir": false
185
+ },
186
+ "github": {
187
+ "release": true,
188
+ "draft": true
189
+ },
190
+ "npm": {
191
+ "publish": false,
192
+ "ignoreVersion": false
193
+ },
194
+ "plugins": {
195
+ "@release-it/conventional-changelog": {
196
+ "preset": "angular",
197
+ "infile": "CHANGELOG.md",
198
+ "header": "# Changelog"
199
+ }
200
+ },
201
+ "hooks": {
202
+ "before:init": "npm test",
203
+ "after:bump": "gulp version --bump ${version} && npm run build && npm run test:build:version && git add ./dist && git add ./package-lock.json",
204
+ "before:release": "npm run release:changelog:fix",
205
+ "after:release": "echo Successfully released ${name} v${version} to ${repo.repository}."
206
+ }
207
+ },
208
+ "commitlint": {
209
+ "rules": {
210
+ "header-max-length": [2, "always", 130]
211
+ },
212
+ "extends": ["@commitlint/config-conventional"]
213
+ }
214
+ }