-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: optimize modules shared, adapter, middleware
- optimize build modules: + add `requete/shared` (helpers) + refactor `requete/middleware` + refactor `requete/adapter` - add specs: + module-specs: for test build exports
- Loading branch information
Rexer Wang
committed
May 1, 2023
1 parent
a21b9b1
commit 861f52f
Showing
39 changed files
with
184 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1 @@ | ||
helpers | ||
index.js |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
export * from './shared/getUri' | ||
export * from './shared/headers' | ||
export * from './shared/logger' | ||
export * from './shared/pick' | ||
export * from './shared/progress' | ||
export * from './shared/RequestError' | ||
export * from './shared/transform' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"rules": { | ||
"@typescript-eslint/no-var-requires": "off", | ||
"simple-import-sort/imports": "off", | ||
"simple-import-sort/exports": "off" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# module-specs | ||
|
||
requete module (commonjs/esm) specs | ||
|
||
Run install & test: | ||
|
||
```sh | ||
pnpm it | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import { equal } from 'assert/strict' | ||
|
||
import requete, { | ||
RequestError, | ||
Requete, | ||
TimeoutAbortController, | ||
create, | ||
} from 'requete' | ||
equal(typeof requete, 'object', 'requete') | ||
equal(typeof requete.request, 'function', 'requete.request') | ||
equal(typeof RequestError, 'function', 'requete.RequestError') | ||
equal(typeof Requete, 'function', 'requete.Requete') | ||
equal( | ||
typeof TimeoutAbortController, | ||
'function', | ||
'requete.TimeoutAbortController' | ||
) | ||
equal(typeof create, 'function', 'requete.create') | ||
|
||
import { logger } from 'requete/middleware' | ||
equal(typeof logger, 'function', 'requete/middleware:logger') | ||
|
||
import { | ||
Adapter, | ||
FetchAdapter, | ||
XhrAdapter, | ||
createAdapter, | ||
} from 'requete/adapter' | ||
equal(typeof Adapter, 'function', 'requete/adapter:Adapter') | ||
equal(typeof FetchAdapter, 'function', 'requete/adapter:FetchAdapter') | ||
equal(typeof XhrAdapter, 'function', 'requete/adapter:XhrAdapter') | ||
equal(typeof createAdapter, 'function', 'requete/adapter:createAdapter') | ||
|
||
import { | ||
getUri, | ||
mergeHeaders, | ||
parseHeaders, | ||
Logger, | ||
pick, | ||
progressEventReducer, | ||
transformRequestBody, | ||
} from 'requete/shared' | ||
equal(typeof getUri, 'function', 'requete/shared:getUri') | ||
equal(typeof mergeHeaders, 'function', 'requete/shared:mergeHeaders') | ||
equal(typeof parseHeaders, 'function', 'requete/shared:parseHeaders') | ||
equal(typeof Logger, 'function', 'requete/shared:Logger') | ||
equal(typeof pick, 'function', 'requete/shared:pick') | ||
equal( | ||
typeof progressEventReducer, | ||
'function', | ||
'requete/shared:progressEventReducer' | ||
) | ||
equal( | ||
typeof transformRequestBody, | ||
'function', | ||
'requete/shared:transformRequestBody' | ||
) | ||
|
||
console.log('All esm exports specs passed.') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.