nitro-web 0.0.162 → 0.0.163
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/package.json +1 -1
- package/types/util.d.ts +3 -3
- package/util.js +4 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nitro-web",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.163",
|
|
4
4
|
"repository": "github:boycce/nitro-web",
|
|
5
5
|
"homepage": "https://boycce.github.io/nitro-web/",
|
|
6
6
|
"description": "Nitro is a battle-tested, modular base project to turbocharge your projects, styled using Tailwind 🚀",
|
package/types/util.d.ts
CHANGED
|
@@ -51,7 +51,7 @@ export function addressSchema(): {
|
|
|
51
51
|
/**
|
|
52
52
|
* Returns an axios instance for the client
|
|
53
53
|
* @param {object} [options] - Options for the axios instance
|
|
54
|
-
* @param {import('axios').CreateAxiosDefaults} [options.
|
|
54
|
+
* @param {import('axios').CreateAxiosDefaults} [options.createConfig] - Options for the axios instance creation on the server,
|
|
55
55
|
* e.g. { httpsAgent: new https.Agent({ keepAlive: true }) }
|
|
56
56
|
* @returns {AxiosInstanceWithRetry}
|
|
57
57
|
*
|
|
@@ -61,8 +61,8 @@ export function addressSchema(): {
|
|
|
61
61
|
* axios().defaults.baseURL = 'https://example.com'
|
|
62
62
|
* ```
|
|
63
63
|
*/
|
|
64
|
-
export function axios({
|
|
65
|
-
|
|
64
|
+
export function axios({ createConfig }?: {
|
|
65
|
+
createConfig?: import("axios").CreateAxiosDefaults;
|
|
66
66
|
}): AxiosInstanceWithRetry;
|
|
67
67
|
/**
|
|
68
68
|
* Builds the url with params
|
package/util.js
CHANGED
|
@@ -88,7 +88,7 @@ export function addressSchema () {
|
|
|
88
88
|
/**
|
|
89
89
|
* Returns an axios instance for the client
|
|
90
90
|
* @param {object} [options] - Options for the axios instance
|
|
91
|
-
* @param {import('axios').CreateAxiosDefaults} [options.
|
|
91
|
+
* @param {import('axios').CreateAxiosDefaults} [options.createConfig] - Options for the axios instance creation on the server,
|
|
92
92
|
* e.g. { httpsAgent: new https.Agent({ keepAlive: true }) }
|
|
93
93
|
* @returns {AxiosInstanceWithRetry}
|
|
94
94
|
*
|
|
@@ -98,7 +98,7 @@ export function addressSchema () {
|
|
|
98
98
|
* axios().defaults.baseURL = 'https://example.com'
|
|
99
99
|
* ```
|
|
100
100
|
*/
|
|
101
|
-
export function axios ({
|
|
101
|
+
export function axios ({ createConfig } = {}) {
|
|
102
102
|
// On the client, add retries and set the baseURL
|
|
103
103
|
if (typeof window !== 'undefined') {
|
|
104
104
|
if (!axiosNonce) {
|
|
@@ -114,9 +114,9 @@ export function axios ({ serverConfig } = {}) {
|
|
|
114
114
|
return _axios
|
|
115
115
|
|
|
116
116
|
// On the server, we can create an axios instance if we want to maintain keep-alive (for Azure SNAT Port Exhaustion / speed up requests)
|
|
117
|
-
// E.g. axios({
|
|
117
|
+
// E.g. axios({ createConfig: { httpsAgent: new https.Agent({ keepAlive: true }) } })
|
|
118
118
|
} else {
|
|
119
|
-
if (!axiosInstance &&
|
|
119
|
+
if (!axiosInstance && createConfig) axiosInstance = _axios.create(createConfig)
|
|
120
120
|
return axiosInstance || _axios
|
|
121
121
|
}
|
|
122
122
|
}
|