keq 5.0.0-alpha.5 → 5.0.0-alpha.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 (74) hide show
  1. package/CHANGELOG.md +191 -240
  2. package/jest.browser.config.ts +22 -0
  3. package/jest.config.cts +22 -0
  4. package/package.json +21 -24
  5. package/dist/index.cjs.js +0 -1115
  6. package/dist/index.d.ts +0 -1
  7. package/dist/index.esm.js +0 -1082
  8. package/dist/package.json +0 -65
  9. package/dist/src/constant.d.ts +0 -2
  10. package/dist/src/core.d.ts +0 -36
  11. package/dist/src/create-request.d.ts +0 -9
  12. package/dist/src/exception/exception.d.ts +0 -4
  13. package/dist/src/exception/invalid-arguments.exception.d.ts +0 -4
  14. package/dist/src/index.d.ts +0 -23
  15. package/dist/src/is/is-array-buffer.d.ts +0 -1
  16. package/dist/src/is/is-blob.d.ts +0 -4
  17. package/dist/src/is/is-browser.d.ts +0 -1
  18. package/dist/src/is/is-buffer.d.ts +0 -1
  19. package/dist/src/is/is-file.d.ts +0 -1
  20. package/dist/src/is/is-form-data.d.ts +0 -1
  21. package/dist/src/is/is-function.d.ts +0 -1
  22. package/dist/src/is/is-headers.d.ts +0 -1
  23. package/dist/src/is/is-object.d.ts +0 -1
  24. package/dist/src/is/is-readable-stream.d.ts +0 -1
  25. package/dist/src/is/is-string.d.ts +0 -1
  26. package/dist/src/is/is-url-search-params.d.ts +0 -1
  27. package/dist/src/keq.d.ts +0 -93
  28. package/dist/src/middlewares/abort-flow-control-middleware.d.ts +0 -2
  29. package/dist/src/middlewares/fetch-arguments-middleware.d.ts +0 -2
  30. package/dist/src/middlewares/fetch-middleware.d.ts +0 -5
  31. package/dist/src/middlewares/proxy-response-middleware.d.ts +0 -2
  32. package/dist/src/middlewares/retry-middleware.d.ts +0 -2
  33. package/dist/src/middlewares/serial-flow-control-middleware.d.ts +0 -2
  34. package/dist/src/middlewares/timeout-middleware.d.ts +0 -2
  35. package/dist/src/request.d.ts +0 -1
  36. package/dist/src/router/keq-host-route.d.ts +0 -2
  37. package/dist/src/router/keq-location-route.d.ts +0 -2
  38. package/dist/src/router/keq-method-route.d.ts +0 -2
  39. package/dist/src/router/keq-module-route.d.ts +0 -2
  40. package/dist/src/router/keq-pathname-route.d.ts +0 -2
  41. package/dist/src/router/keq-router.d.ts +0 -12
  42. package/dist/src/types/content-type.d.ts +0 -2
  43. package/dist/src/types/exclude-property.d.ts +0 -3
  44. package/dist/src/types/extract-property.d.ts +0 -3
  45. package/dist/src/types/keq-context-request.d.ts +0 -18
  46. package/dist/src/types/keq-context.d.ts +0 -62
  47. package/dist/src/types/keq-events.d.ts +0 -8
  48. package/dist/src/types/keq-flow-control.d.ts +0 -7
  49. package/dist/src/types/keq-global.d.ts +0 -6
  50. package/dist/src/types/keq-init.d.ts +0 -2
  51. package/dist/src/types/keq-middleware.d.ts +0 -3
  52. package/dist/src/types/keq-next.d.ts +0 -1
  53. package/dist/src/types/keq-operation.d.ts +0 -44
  54. package/dist/src/types/keq-options.d.ts +0 -55
  55. package/dist/src/types/keq-query-value.d.ts +0 -6
  56. package/dist/src/types/keq-request.d.ts +0 -32
  57. package/dist/src/types/keq-resolve-with-mode.d.ts +0 -1
  58. package/dist/src/types/keq-retry.d.ts +0 -3
  59. package/dist/src/types/keq-route.d.ts +0 -2
  60. package/dist/src/types/keq-timeout.d.ts +0 -3
  61. package/dist/src/util/base64.d.ts +0 -2
  62. package/dist/src/util/clone-body.d.ts +0 -1
  63. package/dist/src/util/compile-url.d.ts +0 -1
  64. package/dist/src/util/compose-middleware.d.ts +0 -2
  65. package/dist/src/util/compose-route.d.ts +0 -2
  66. package/dist/src/util/create-response-proxy.d.ts +0 -1
  67. package/dist/src/util/fix-content-type.d.ts +0 -3
  68. package/dist/src/util/get-unique-code-identifier.d.ts +0 -1
  69. package/dist/src/util/is-valid-header-value.d.ts +0 -1
  70. package/dist/src/util/merge-keq-request-body.d.ts +0 -2
  71. package/dist/src/util/shallow-clone.d.ts +0 -4
  72. package/project.json +0 -16
  73. package/tsconfig.json +0 -28
  74. package/tsconfig.lib.json +0 -15
@@ -0,0 +1,22 @@
1
+ import type { Config } from 'jest'
2
+ import { pathsToModuleNameMapper } from 'ts-jest'
3
+
4
+
5
+ export default async (): Promise<Config> => {
6
+ const tsconfig = (await import('./tsconfig.json', { with: { type: 'json' } })).default
7
+
8
+ return {
9
+ preset: 'ts-jest',
10
+ setupFilesAfterEnv: ['<rootDir>/__tests__/setup.ts'],
11
+ moduleNameMapper: pathsToModuleNameMapper(tsconfig.compilerOptions.paths, { prefix: '<rootDir>/', useESM: true }),
12
+
13
+ displayName: 'Browser',
14
+ testEnvironment: 'jest-environment-jsdom',
15
+ testMatch: [
16
+ '<rootDir>/__tests__/browser/**/*.spec.ts',
17
+ '<rootDir>/__tests__/*.spec.ts',
18
+ '<rootDir>/src/**/*.browser.spec.ts',
19
+ '<rootDir>/src/**/!(*.node|*.browser).spec.ts',
20
+ ],
21
+ }
22
+ }
@@ -0,0 +1,22 @@
1
+ import fs from 'fs'
2
+ import path from 'path'
3
+ import type { Config } from 'jest'
4
+ import { pathsToModuleNameMapper } from 'ts-jest'
5
+
6
+
7
+ export default (): Config => {
8
+ const tsconfig = JSON.parse(fs.readFileSync(path.join(__dirname, './tsconfig.json'), 'utf-8'))
9
+
10
+ return {
11
+ preset: 'ts-jest',
12
+ setupFilesAfterEnv: ['<rootDir>/__tests__/setup.ts'],
13
+ moduleNameMapper: pathsToModuleNameMapper(tsconfig.compilerOptions.paths, { prefix: '<rootDir>/src', useESM: true }),
14
+ testEnvironment: 'node',
15
+ testMatch: [
16
+ '<rootDir>/__tests__/node/**/*.spec.ts',
17
+ '<rootDir>/__tests__/*.spec.ts',
18
+ '<rootDir>/src/**/*.node.spec.ts',
19
+ '<rootDir>/src/**/!(*.node|*.browser).spec.ts',
20
+ ],
21
+ }
22
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "keq",
3
- "version": "5.0.0-alpha.5",
3
+ "version": "5.0.0-alpha.7",
4
4
  "description": "Request API write by Typescript for flexibility, readability, and a low learning curve.",
5
5
  "keywords": [
6
6
  "request",
@@ -16,12 +16,14 @@
16
16
  ],
17
17
  "license": "MIT",
18
18
  "author": "Val.istar.Guo <val.istar.guo@gmail.com>",
19
- "main": "dist/index.js",
20
- "module": "dist/index.esm.js",
21
19
  "types": "dist/index.d.ts",
20
+ "main": "dist/index.js",
22
21
  "exports": {
23
- "require": "./dist/index.cjs.js",
24
- "import": "./dist/index.esm.js"
22
+ ".": {
23
+ "types": "./dist/index.d.ts",
24
+ "require": "./dist/index.js",
25
+ "import": "./dist/index.mjs"
26
+ }
25
27
  },
26
28
  "homepage": "https://github.com/keq-request/keq#readme",
27
29
  "bugs": {
@@ -32,34 +34,29 @@
32
34
  "url": "git+https://github.com/keq-request/keq.git"
33
35
  },
34
36
  "dependencies": {
35
- "fastq": "^1.17.1",
36
- "minimatch": "^9.0.4",
37
+ "@opendoc/uri-template": "^1.5.4",
38
+ "fastq": "^1.19.1",
39
+ "klona": "^2.0.6",
40
+ "minimatch": "^10.1.1",
37
41
  "mitt": "^3.0.1",
38
- "qs": "^6.13.1",
42
+ "qs": "^6.14.0",
39
43
  "ts-custom-error": "^3.3.1",
40
- "type-fest": "^4.30.2"
44
+ "type-fest": "^5.2.0"
41
45
  },
42
46
  "devDependencies": {
43
- "@buka/eslint-config": "^2.1.1",
44
- "@jest/globals": "^29.7.0",
45
47
  "@types/clone": "^2.1.4",
46
- "@types/minimatch": "^5.1.2",
47
- "@types/node": "^20.14.1",
48
- "@types/qs": "^6.9.17",
49
- "eslint": "^9.13.0",
50
- "jest": "^29.7.0",
51
- "jest-environment-jsdom": "^29.7.0",
52
- "jest-mock": "^29.7.0",
53
- "ts-jest": "^29.1.5",
54
- "ts-node": "^10.9.2",
55
- "typescript": "5.4.5"
48
+ "@types/node": "^20.19.24",
49
+ "@types/qs": "^6.14.0",
50
+ "typescript": "^5.9.3",
51
+ "@keq-request/test": "5.0.0-alpha.7"
56
52
  },
57
53
  "engines": {
58
54
  "node": ">=20.0.0"
59
55
  },
60
56
  "scripts": {
61
- "build": "nx rollup:build",
62
- "test": "nx jest:test",
63
- "test:update": "nx jest:test -u"
57
+ "build": "tsup",
58
+ "dev": "tsup --watch",
59
+ "test": "jest",
60
+ "test:update": "jest -u"
64
61
  }
65
62
  }