jimpex 10.0.1 → 11.0.0
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/CHANGELOG.md +38 -0
- package/README.md +7 -9
- package/dist/app/index.d.ts +1 -1
- package/dist/app/index.js +1 -22
- package/dist/app/index.js.map +1 -1
- package/dist/app/jimpex.d.ts +1 -1
- package/dist/app/jimpex.js +104 -145
- package/dist/app/jimpex.js.map +1 -1
- package/dist/controllers/common/config.d.ts +2 -2
- package/dist/controllers/common/config.js +12 -42
- package/dist/controllers/common/config.js.map +1 -1
- package/dist/controllers/common/health.d.ts +4 -4
- package/dist/controllers/common/health.js +20 -50
- package/dist/controllers/common/health.js.map +1 -1
- package/dist/controllers/common/index.d.ts +1 -1
- package/dist/controllers/common/index.js +3 -26
- package/dist/controllers/common/index.js.map +1 -1
- package/dist/controllers/common/statics.d.ts +3 -3
- package/dist/controllers/common/statics.js +32 -68
- package/dist/controllers/common/statics.js.map +1 -1
- package/dist/controllers/index.d.ts +1 -1
- package/dist/controllers/index.js +2 -24
- package/dist/controllers/index.js.map +1 -1
- package/dist/controllers/utils/gateway.d.ts +5 -5
- package/dist/controllers/utils/gateway.js +70 -94
- package/dist/controllers/utils/gateway.js.map +1 -1
- package/dist/controllers/utils/index.d.ts +1 -1
- package/dist/controllers/utils/index.js +1 -22
- package/dist/controllers/utils/index.js.map +1 -1
- package/dist/{index-C6I3NCC-.d.ts → index-BlSpNHox.d.ts} +13 -13
- package/dist/index.d.ts +3 -3
- package/dist/index.js +6 -32
- package/dist/index.js.map +1 -1
- package/dist/middlewares/common/errorHandler.d.ts +5 -5
- package/dist/middlewares/common/errorHandler.js +31 -59
- package/dist/middlewares/common/errorHandler.js.map +1 -1
- package/dist/middlewares/common/forceHTTPS.d.ts +1 -1
- package/dist/middlewares/common/forceHTTPS.js +9 -40
- package/dist/middlewares/common/forceHTTPS.js.map +1 -1
- package/dist/middlewares/common/hsts.d.ts +1 -1
- package/dist/middlewares/common/hsts.js +12 -42
- package/dist/middlewares/common/hsts.js.map +1 -1
- package/dist/middlewares/common/index.d.ts +3 -3
- package/dist/middlewares/common/index.js +3 -26
- package/dist/middlewares/common/index.js.map +1 -1
- package/dist/middlewares/html/fastHTML.d.ts +4 -4
- package/dist/middlewares/html/fastHTML.js +44 -71
- package/dist/middlewares/html/fastHTML.js.map +1 -1
- package/dist/middlewares/html/index.d.ts +2 -2
- package/dist/middlewares/html/index.js +2 -24
- package/dist/middlewares/html/index.js.map +1 -1
- package/dist/middlewares/html/showHTML.d.ts +3 -3
- package/dist/middlewares/html/showHTML.js +25 -55
- package/dist/middlewares/html/showHTML.js.map +1 -1
- package/dist/middlewares/index.d.ts +4 -4
- package/dist/middlewares/index.js +3 -26
- package/dist/middlewares/index.js.map +1 -1
- package/dist/middlewares/utils/index.d.ts +3 -3
- package/dist/middlewares/utils/index.js +1 -22
- package/dist/middlewares/utils/index.js.map +1 -1
- package/dist/middlewares/utils/versionValidator.d.ts +5 -5
- package/dist/middlewares/utils/versionValidator.js +24 -54
- package/dist/middlewares/utils/versionValidator.js.map +1 -1
- package/dist/services/common/appError.d.ts +2 -2
- package/dist/services/common/appError.js +18 -49
- package/dist/services/common/appError.js.map +1 -1
- package/dist/services/common/httpError.d.ts +2 -2
- package/dist/services/common/httpError.js +7 -33
- package/dist/services/common/httpError.js.map +1 -1
- package/dist/services/common/index.d.ts +1 -1
- package/dist/services/common/index.js +14 -42
- package/dist/services/common/index.js.map +1 -1
- package/dist/services/common/sendFile.d.ts +1 -1
- package/dist/services/common/sendFile.js +4 -29
- package/dist/services/common/sendFile.js.map +1 -1
- package/dist/services/frontend/frontendFs.d.ts +2 -2
- package/dist/services/frontend/frontendFs.js +12 -52
- package/dist/services/frontend/frontendFs.js.map +1 -1
- package/dist/services/frontend/index.d.ts +2 -2
- package/dist/services/frontend/index.js +8 -34
- package/dist/services/frontend/index.js.map +1 -1
- package/dist/services/html/htmlGenerator.d.ts +5 -5
- package/dist/services/html/htmlGenerator.js +48 -82
- package/dist/services/html/htmlGenerator.js.map +1 -1
- package/dist/services/html/index.d.ts +2 -2
- package/dist/services/html/index.js +8 -34
- package/dist/services/html/index.js.map +1 -1
- package/dist/services/http/apiClient.d.ts +1 -1
- package/dist/services/http/apiClient.js +26 -57
- package/dist/services/http/apiClient.js.map +1 -1
- package/dist/services/http/http.d.ts +5 -5
- package/dist/services/http/http.js +23 -63
- package/dist/services/http/http.js.map +1 -1
- package/dist/services/http/index.d.ts +2 -2
- package/dist/services/http/index.js +14 -42
- package/dist/services/http/index.js.map +1 -1
- package/dist/services/http/responsesBuilder.d.ts +4 -4
- package/dist/services/http/responsesBuilder.js +14 -44
- package/dist/services/http/responsesBuilder.js.map +1 -1
- package/dist/services/index.d.ts +3 -3
- package/dist/services/index.js +5 -30
- package/dist/services/index.js.map +1 -1
- package/dist/services/utils/ensureBearerToken.d.ts +2 -2
- package/dist/services/utils/ensureBearerToken.js +15 -45
- package/dist/services/utils/ensureBearerToken.js.map +1 -1
- package/dist/services/utils/index.d.ts +1 -1
- package/dist/services/utils/index.js +8 -34
- package/dist/services/utils/index.js.map +1 -1
- package/dist/types/events.d.ts +1 -1
- package/dist/types/events.js +0 -16
- package/dist/types/events.js.map +1 -1
- package/dist/types/express.js +0 -16
- package/dist/types/express.js.map +1 -1
- package/dist/types/http.js +0 -16
- package/dist/types/http.js.map +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.js +6 -32
- package/dist/types/index.js.map +1 -1
- package/dist/types/options.d.ts +1 -1
- package/dist/types/options.js +0 -16
- package/dist/types/options.js.map +1 -1
- package/dist/types/utils.js +0 -16
- package/dist/types/utils.js.map +1 -1
- package/dist/types/wootils.js +0 -16
- package/dist/types/wootils.js.map +1 -1
- package/dist/utils/fns/index.js +4 -28
- package/dist/utils/fns/index.js.map +1 -1
- package/dist/utils/fns/others.js +2 -26
- package/dist/utils/fns/others.js.map +1 -1
- package/dist/utils/fns/routes.js +4 -31
- package/dist/utils/fns/routes.js.map +1 -1
- package/dist/utils/fns/statuses.js +3 -37
- package/dist/utils/fns/statuses.js.map +1 -1
- package/dist/utils/fns/text.js +2 -26
- package/dist/utils/fns/text.js.map +1 -1
- package/dist/utils/index.d.ts +1 -1
- package/dist/utils/index.js +2 -24
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/wrappers.d.ts +1 -1
- package/dist/utils/wrappers.js +20 -48
- package/dist/utils/wrappers.js.map +1 -1
- package/eslint.config.js +19 -0
- package/examples/basic/app.ts +4 -4
- package/examples/basic/controller.ts +2 -2
- package/examples/basic/index.ts +4 -4
- package/examples/basic/middleware.ts +2 -2
- package/examples/basic/service.ts +1 -1
- package/package.json +64 -49
- package/pnpm-workspace.yaml +4 -0
- package/src/app/index.ts +1 -1
- package/src/app/jimpex.ts +23 -20
- package/src/controllers/common/config.ts +4 -4
- package/src/controllers/common/health.ts +9 -5
- package/src/controllers/common/index.ts +3 -3
- package/src/controllers/common/statics.ts +12 -7
- package/src/controllers/index.ts +2 -2
- package/src/controllers/utils/gateway.ts +8 -8
- package/src/controllers/utils/index.ts +1 -1
- package/src/index.ts +6 -6
- package/src/middlewares/common/errorHandler.ts +9 -5
- package/src/middlewares/common/forceHTTPS.ts +2 -2
- package/src/middlewares/common/hsts.ts +2 -2
- package/src/middlewares/common/index.ts +3 -3
- package/src/middlewares/html/fastHTML.ts +14 -5
- package/src/middlewares/html/index.ts +2 -2
- package/src/middlewares/html/showHTML.ts +8 -4
- package/src/middlewares/index.ts +3 -3
- package/src/middlewares/utils/index.ts +1 -1
- package/src/middlewares/utils/versionValidator.ts +6 -6
- package/src/services/common/appError.ts +1 -1
- package/src/services/common/httpError.ts +2 -2
- package/src/services/common/index.ts +7 -7
- package/src/services/common/sendFile.ts +2 -2
- package/src/services/frontend/frontendFs.ts +3 -3
- package/src/services/frontend/index.ts +3 -3
- package/src/services/html/htmlGenerator.ts +11 -13
- package/src/services/html/index.ts +3 -3
- package/src/services/http/apiClient.ts +3 -3
- package/src/services/http/http.ts +5 -5
- package/src/services/http/index.ts +7 -7
- package/src/services/http/responsesBuilder.ts +6 -6
- package/src/services/index.ts +5 -5
- package/src/services/utils/ensureBearerToken.ts +4 -4
- package/src/services/utils/index.ts +3 -3
- package/src/types/events.ts +8 -8
- package/src/types/http.ts +1 -1
- package/src/types/index.ts +6 -6
- package/src/types/options.ts +2 -2
- package/src/types/utils.ts +4 -4
- package/src/utils/fns/index.ts +4 -4
- package/src/utils/fns/routes.ts +1 -1
- package/src/utils/index.ts +2 -2
- package/src/utils/wrappers.ts +6 -6
- package/tsconfig.json +9 -4
- package/tsup.config.ts +1 -2
- package/vitest.config.ts +24 -0
- package/dist/app/index.d.mts +0 -14
- package/dist/app/jimpex.d.mts +0 -14
- package/dist/controllers/common/config.d.mts +0 -79
- package/dist/controllers/common/health.d.mts +0 -83
- package/dist/controllers/common/index.d.mts +0 -22
- package/dist/controllers/common/statics.d.mts +0 -223
- package/dist/controllers/index.d.mts +0 -25
- package/dist/controllers/utils/gateway.d.mts +0 -725
- package/dist/controllers/utils/index.d.mts +0 -17
- package/dist/esm/app/index.js +0 -2
- package/dist/esm/app/index.js.map +0 -1
- package/dist/esm/app/jimpex.js +0 -647
- package/dist/esm/app/jimpex.js.map +0 -1
- package/dist/esm/chunk-F3FYYIAV.js +0 -11
- package/dist/esm/chunk-F3FYYIAV.js.map +0 -1
- package/dist/esm/controllers/common/config.js +0 -80
- package/dist/esm/controllers/common/config.js.map +0 -1
- package/dist/esm/controllers/common/health.js +0 -88
- package/dist/esm/controllers/common/health.js.map +0 -1
- package/dist/esm/controllers/common/index.js +0 -4
- package/dist/esm/controllers/common/index.js.map +0 -1
- package/dist/esm/controllers/common/statics.js +0 -226
- package/dist/esm/controllers/common/statics.js.map +0 -1
- package/dist/esm/controllers/index.js +0 -3
- package/dist/esm/controllers/index.js.map +0 -1
- package/dist/esm/controllers/utils/gateway.js +0 -559
- package/dist/esm/controllers/utils/gateway.js.map +0 -1
- package/dist/esm/controllers/utils/index.js +0 -2
- package/dist/esm/controllers/utils/index.js.map +0 -1
- package/dist/esm/index.js +0 -7
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/middlewares/common/errorHandler.js +0 -116
- package/dist/esm/middlewares/common/errorHandler.js.map +0 -1
- package/dist/esm/middlewares/common/forceHTTPS.js +0 -53
- package/dist/esm/middlewares/common/forceHTTPS.js.map +0 -1
- package/dist/esm/middlewares/common/hsts.js +0 -74
- package/dist/esm/middlewares/common/hsts.js.map +0 -1
- package/dist/esm/middlewares/common/index.js +0 -4
- package/dist/esm/middlewares/common/index.js.map +0 -1
- package/dist/esm/middlewares/html/fastHTML.js +0 -158
- package/dist/esm/middlewares/html/fastHTML.js.map +0 -1
- package/dist/esm/middlewares/html/index.js +0 -3
- package/dist/esm/middlewares/html/index.js.map +0 -1
- package/dist/esm/middlewares/html/showHTML.js +0 -100
- package/dist/esm/middlewares/html/showHTML.js.map +0 -1
- package/dist/esm/middlewares/index.js +0 -4
- package/dist/esm/middlewares/index.js.map +0 -1
- package/dist/esm/middlewares/utils/index.js +0 -2
- package/dist/esm/middlewares/utils/index.js.map +0 -1
- package/dist/esm/middlewares/utils/versionValidator.js +0 -135
- package/dist/esm/middlewares/utils/versionValidator.js.map +0 -1
- package/dist/esm/services/common/appError.js +0 -98
- package/dist/esm/services/common/appError.js.map +0 -1
- package/dist/esm/services/common/httpError.js +0 -28
- package/dist/esm/services/common/httpError.js.map +0 -1
- package/dist/esm/services/common/index.js +0 -17
- package/dist/esm/services/common/index.js.map +0 -1
- package/dist/esm/services/common/sendFile.js +0 -27
- package/dist/esm/services/common/sendFile.js.map +0 -1
- package/dist/esm/services/frontend/frontendFs.js +0 -66
- package/dist/esm/services/frontend/frontendFs.js.map +0 -1
- package/dist/esm/services/frontend/index.js +0 -11
- package/dist/esm/services/frontend/index.js.map +0 -1
- package/dist/esm/services/html/htmlGenerator.js +0 -194
- package/dist/esm/services/html/htmlGenerator.js.map +0 -1
- package/dist/esm/services/html/index.js +0 -11
- package/dist/esm/services/html/index.js.map +0 -1
- package/dist/esm/services/http/apiClient.js +0 -97
- package/dist/esm/services/http/apiClient.js.map +0 -1
- package/dist/esm/services/http/http.js +0 -180
- package/dist/esm/services/http/http.js.map +0 -1
- package/dist/esm/services/http/index.js +0 -17
- package/dist/esm/services/http/index.js.map +0 -1
- package/dist/esm/services/http/responsesBuilder.js +0 -152
- package/dist/esm/services/http/responsesBuilder.js.map +0 -1
- package/dist/esm/services/index.js +0 -6
- package/dist/esm/services/index.js.map +0 -1
- package/dist/esm/services/utils/ensureBearerToken.js +0 -94
- package/dist/esm/services/utils/ensureBearerToken.js.map +0 -1
- package/dist/esm/services/utils/index.js +0 -11
- package/dist/esm/services/utils/index.js.map +0 -1
- package/dist/esm/types/events.js +0 -1
- package/dist/esm/types/events.js.map +0 -1
- package/dist/esm/types/express.js +0 -1
- package/dist/esm/types/express.js.map +0 -1
- package/dist/esm/types/http.js +0 -1
- package/dist/esm/types/http.js.map +0 -1
- package/dist/esm/types/index.js +0 -7
- package/dist/esm/types/index.js.map +0 -1
- package/dist/esm/types/options.js +0 -1
- package/dist/esm/types/options.js.map +0 -1
- package/dist/esm/types/utils.js +0 -1
- package/dist/esm/types/utils.js.map +0 -1
- package/dist/esm/types/wootils.js +0 -1
- package/dist/esm/types/wootils.js.map +0 -1
- package/dist/esm/utils/fns/index.js +0 -5
- package/dist/esm/utils/fns/index.js.map +0 -1
- package/dist/esm/utils/fns/others.js +0 -6
- package/dist/esm/utils/fns/others.js.map +0 -1
- package/dist/esm/utils/fns/routes.js +0 -25
- package/dist/esm/utils/fns/routes.js.map +0 -1
- package/dist/esm/utils/fns/statuses.js +0 -6
- package/dist/esm/utils/fns/statuses.js.map +0 -1
- package/dist/esm/utils/fns/text.js +0 -6
- package/dist/esm/utils/fns/text.js.map +0 -1
- package/dist/esm/utils/index.js +0 -3
- package/dist/esm/utils/index.js.map +0 -1
- package/dist/esm/utils/wrappers.js +0 -41
- package/dist/esm/utils/wrappers.js.map +0 -1
- package/dist/index-Bwf7JHu9.d.mts +0 -1287
- package/dist/index.d.mts +0 -47
- package/dist/middlewares/common/errorHandler.d.mts +0 -132
- package/dist/middlewares/common/forceHTTPS.d.mts +0 -69
- package/dist/middlewares/common/hsts.d.mts +0 -110
- package/dist/middlewares/common/index.d.mts +0 -22
- package/dist/middlewares/html/fastHTML.d.mts +0 -180
- package/dist/middlewares/html/index.d.mts +0 -21
- package/dist/middlewares/html/showHTML.d.mts +0 -127
- package/dist/middlewares/index.d.mts +0 -30
- package/dist/middlewares/utils/index.d.mts +0 -20
- package/dist/middlewares/utils/versionValidator.d.mts +0 -215
- package/dist/services/common/appError.d.mts +0 -139
- package/dist/services/common/httpError.d.mts +0 -80
- package/dist/services/common/index.d.mts +0 -47
- package/dist/services/common/sendFile.d.mts +0 -102
- package/dist/services/frontend/frontendFs.d.mts +0 -96
- package/dist/services/frontend/index.d.mts +0 -40
- package/dist/services/html/htmlGenerator.d.mts +0 -237
- package/dist/services/html/index.d.mts +0 -43
- package/dist/services/http/apiClient.d.mts +0 -170
- package/dist/services/http/http.d.mts +0 -182
- package/dist/services/http/index.d.mts +0 -51
- package/dist/services/http/responsesBuilder.d.mts +0 -179
- package/dist/services/index.d.mts +0 -33
- package/dist/services/utils/ensureBearerToken.d.mts +0 -158
- package/dist/services/utils/index.d.mts +0 -44
- package/dist/types/events.d.mts +0 -14
- package/dist/types/express.d.mts +0 -10
- package/dist/types/http.d.mts +0 -82
- package/dist/types/index.d.mts +0 -14
- package/dist/types/options.d.mts +0 -14
- package/dist/types/utils.d.mts +0 -48
- package/dist/types/wootils.d.mts +0 -4
- package/dist/utils/fns/index.d.mts +0 -5
- package/dist/utils/fns/others.d.mts +0 -17
- package/dist/utils/fns/routes.d.mts +0 -39
- package/dist/utils/fns/statuses.d.mts +0 -45
- package/dist/utils/fns/text.d.mts +0 -9
- package/dist/utils/index.d.mts +0 -19
- package/dist/utils/wrappers.d.mts +0 -14
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,41 @@
|
|
|
1
|
+
# [11.0.0](https://github.com/homer0/jimpex/compare/10.0.2...11.0.0) (2025-12-08)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* add missing extensions for esm ([c08930d](https://github.com/homer0/jimpex/commit/c08930d559f6b656c7fe9aa84b4ab894141439aa))
|
|
7
|
+
* define module exports for the package and set the type to module ([935a9d2](https://github.com/homer0/jimpex/commit/935a9d273f9495f833a0e976e12ffe8d1f4cba3a))
|
|
8
|
+
* drop Node v18 ([46de5f2](https://github.com/homer0/jimpex/commit/46de5f20e185cea701a57de46ed92fb5f8c1c854))
|
|
9
|
+
* import a single obj from spdy ([ee96af3](https://github.com/homer0/jimpex/commit/ee96af3c0a64b4bc1d115a77ef26e635a852a3df))
|
|
10
|
+
* import spdy only when using it ([385b70f](https://github.com/homer0/jimpex/commit/385b70fd14127cbc4510ab2364476d7dad2ba99d))
|
|
11
|
+
* remove unnecessary check ([7530b2b](https://github.com/homer0/jimpex/commit/7530b2b0a16abdddb608c0541a56a765bfc36e35))
|
|
12
|
+
* typo on default value ([9fd84c5](https://github.com/homer0/jimpex/commit/9fd84c5e1ba6ca9908e0e8da45a71b37e8d76206))
|
|
13
|
+
* typo on type name ([c0c3118](https://github.com/homer0/jimpex/commit/c0c311825e9f8895b08b5d8ae09a93111264724c))
|
|
14
|
+
* update dependencies ([8245c8f](https://github.com/homer0/jimpex/commit/8245c8fc11863d27b98652c09b0df9a2345498e3))
|
|
15
|
+
* update regex to cover new stack trace ([c6672ef](https://github.com/homer0/jimpex/commit/c6672ef08c9e4880759fe9a615b5e28419cc0239))
|
|
16
|
+
* use node prefix for importing internals ([ed1df9e](https://github.com/homer0/jimpex/commit/ed1df9e295368a0de417298b38b8fcbd95101492))
|
|
17
|
+
* use the right import path ([7ed1721](https://github.com/homer0/jimpex/commit/7ed1721ddccb170a5ff45e61fee874c040c2d5ad))
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### BREAKING CHANGES
|
|
21
|
+
|
|
22
|
+
* The VersionValidator default option for `popup.message`
|
|
23
|
+
was changed from `vesion:conflict` to `version:confict`
|
|
24
|
+
* The type HTTPContructorOptions was renamed to
|
|
25
|
+
HTTPConstructorOptions
|
|
26
|
+
* This package is now esm only
|
|
27
|
+
* Node v18 is not longer supported. Node v20.19 is the minimum
|
|
28
|
+
required version now.
|
|
29
|
+
|
|
30
|
+
## [10.0.2](https://github.com/homer0/jimpex/compare/10.0.1...10.0.2) (2024-11-09)
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
### Bug Fixes
|
|
34
|
+
|
|
35
|
+
* add support for Node v22 and set v20 for dev ([743f987](https://github.com/homer0/jimpex/commit/743f987c19a5ef93329a05b633eadf82ed52859d))
|
|
36
|
+
* get rid of unused variable ([09c92b5](https://github.com/homer0/jimpex/commit/09c92b5aadff5fb914c4ebdff8159472a1b04d05))
|
|
37
|
+
* update dependencies ([e7ed985](https://github.com/homer0/jimpex/commit/e7ed9855b12743686f5ba64965f86241e0025db6))
|
|
38
|
+
|
|
1
39
|
## [10.0.1](https://github.com/homer0/jimpex/compare/10.0.0...10.0.1) (2024-04-07)
|
|
2
40
|
|
|
3
41
|
|
package/README.md
CHANGED
|
@@ -96,7 +96,7 @@ app.set('message', 'Hello Pili!');
|
|
|
96
96
|
app.boot();
|
|
97
97
|
```
|
|
98
98
|
|
|
99
|
-
Now, this may look like an unnecessary feature, but if you consider the
|
|
99
|
+
Now, this may look like an unnecessary feature, but if you consider the possibility of different entry points based on environment, maybe to enable debugging tools on dev, this becomes really useful.
|
|
100
100
|
|
|
101
101
|
### ⚙️ Options and configuration
|
|
102
102
|
|
|
@@ -356,7 +356,7 @@ Jimpex already comes with a few built-in service providers ready to be used, and
|
|
|
356
356
|
|
|
357
357
|
##### Configurable services
|
|
358
358
|
|
|
359
|
-
Since the version of Jimple that Jimpex uses under the hood is [`@homer0/jimple`](https://www.npmjs.com/package/@homer0/jimple), my custom "fork", you can also create "
|
|
359
|
+
Since the version of Jimple that Jimpex uses under the hood is [`@homer0/jimple`](https://www.npmjs.com/package/@homer0/jimple), my custom "fork", you can also create "configurable providers":
|
|
360
360
|
|
|
361
361
|
```ts
|
|
362
362
|
// src/my-service.js
|
|
@@ -502,7 +502,7 @@ class MyApp extends Jimpex {
|
|
|
502
502
|
|
|
503
503
|
#### Controllers with services
|
|
504
504
|
|
|
505
|
-
If for some reason, your controller needs to register a service that the rest of the container needs to have access to, and you plan to do it on the `controller`/`controllerCreator` callback, you could end up messing with the
|
|
505
|
+
If for some reason, your controller needs to register a service that the rest of the container needs to have access to, and you plan to do it on the `controller`/`controllerCreator` callback, you could end up messing with the _laziness_ of the container: If a middleware or another controller tries to access the service and the controller that registers it is mounted after it, it will get an error as the service _doesn't exist yet_.
|
|
506
506
|
|
|
507
507
|
A way to solve this issue would be with a `provider`/`providerCreator`, mounting the controller:
|
|
508
508
|
|
|
@@ -623,7 +623,7 @@ Just like the `controllerCreator` wrapper, you can also use the `middlewareCreat
|
|
|
623
623
|
|
|
624
624
|
```ts
|
|
625
625
|
// my-middleware.js
|
|
626
|
-
import {
|
|
626
|
+
import { middlewareCreator } from 'jimpex';
|
|
627
627
|
|
|
628
628
|
// Define your middleware function (or class if it gets more complex)
|
|
629
629
|
export const greetingsMiddleware = (message) => (req, res, next) => {
|
|
@@ -743,15 +743,13 @@ The configuration for `semantic-release` is on `./releaserc` and the workflow fo
|
|
|
743
743
|
|
|
744
744
|
### Testing
|
|
745
745
|
|
|
746
|
-
I use [
|
|
746
|
+
I use [Vitest](https://vitest.dev) to test the project.
|
|
747
747
|
|
|
748
748
|
The configuration file is on `./.jestrc.js`, the tests are on `./tests` and the script that runs it is on `./utils/scripts/test`.
|
|
749
749
|
|
|
750
750
|
### Code linting and formatting
|
|
751
751
|
|
|
752
|
-
For linting, I use [ESlint](https://eslint.org) with [my own custom configuration](https://npmjs.com/package/@homer0/eslint-plugin).
|
|
753
|
-
|
|
754
|
-
There are two configuration files, `./.eslintrc` for the source and the tooling, and `./tests/.eslintrc`, and there's also a `./.eslintignore` to exclude some files.
|
|
752
|
+
For linting, I use [ESlint](https://eslint.org) with [my own custom configuration](https://npmjs.com/package/@homer0/eslint-plugin). The configuration file is `./eslint.config.js`.
|
|
755
753
|
|
|
756
754
|
For formatting, I use [Prettier](https://prettier.io) with [my JSDoc plugin](https://npmjs.com/package/@homer0/prettier-plugin-jsdoc) and [my own custom configuration](https://npmjs.com/package/@homer0/prettier-config). The configuration file is `./.prettierrc`.
|
|
757
755
|
|
|
@@ -767,4 +765,4 @@ The configuration file is `./.typedoc.json` and the script that runs it is on `.
|
|
|
767
765
|
|
|
768
766
|
A friend, who's also web developer, brought the idea of start using a dependency injection container on Node, and how Jimple was a great tool for it; from the moment I tried Jimple, I could never think of starting another project without it: It not only allows you to implement dependency injection on a simple and clean way, but it also kind of forces you to have a really good organization of your code.
|
|
769
767
|
|
|
770
|
-
A couple of months after that, the same friend told me that we should do something similar to [Silex](https://github.com/silexphp/Silex), which is based on Pimple,
|
|
768
|
+
A couple of months after that, the same friend told me that we should do something similar to [Silex](https://github.com/silexphp/Silex), which is based on Pimple, but with Express. I ran with the idea and... this project is what I think a mix of Jimple and Express would look like. To be clear, **this is not a port of Silex**.
|
package/dist/app/index.d.ts
CHANGED
package/dist/app/index.js
CHANGED
|
@@ -1,23 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __copyProps = (to, from, except, desc) => {
|
|
7
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
-
for (let key of __getOwnPropNames(from))
|
|
9
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
-
}
|
|
12
|
-
return to;
|
|
13
|
-
};
|
|
14
|
-
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
15
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
16
|
-
var app_exports = {};
|
|
17
|
-
module.exports = __toCommonJS(app_exports);
|
|
18
|
-
__reExport(app_exports, require("./jimpex"), module.exports);
|
|
19
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
20
|
-
0 && (module.exports = {
|
|
21
|
-
...require("./jimpex")
|
|
22
|
-
});
|
|
1
|
+
export * from "./jimpex.js";
|
|
23
2
|
//# sourceMappingURL=index.js.map
|
package/dist/app/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/app/index.ts"],"sourcesContent":["export * from './jimpex';\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../src/app/index.ts"],"sourcesContent":["export * from './jimpex.js';\n"],"mappings":"AAAA,cAAc;","names":[]}
|
package/dist/app/jimpex.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import '@homer0/jimple';
|
|
2
2
|
import '@homer0/events-hub';
|
|
3
|
-
export { J as Jimpex, j as jimpex } from '../index-
|
|
3
|
+
export { J as Jimpex, j as jimpex } from '../index-BlSpNHox.js';
|
|
4
4
|
import 'express';
|
|
5
5
|
import '../types/http.js';
|
|
6
6
|
import '../types/utils.js';
|
package/dist/app/jimpex.js
CHANGED
|
@@ -1,109 +1,75 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
1
|
+
import * as path from "node:path";
|
|
2
|
+
import fs from "node:fs/promises";
|
|
3
|
+
import { createServer as createHTTPSServer } from "https";
|
|
4
|
+
import { Jimple } from "@homer0/jimple";
|
|
5
|
+
import { deepAssignWithOverwrite } from "@homer0/deep-assign";
|
|
6
|
+
import { appLoggerProvider } from "@homer0/simple-logger";
|
|
7
|
+
import { envUtilsProvider } from "@homer0/env-utils";
|
|
8
|
+
import { packageInfoProvider } from "@homer0/package-info";
|
|
9
|
+
import { pathUtilsProvider } from "@homer0/path-utils";
|
|
10
|
+
import { rootFileProvider } from "@homer0/root-file";
|
|
11
|
+
import { tsAsyncImport } from "@homer0/ts-async-import";
|
|
12
|
+
import { EventsHub } from "@homer0/events-hub";
|
|
13
|
+
import { simpleConfigProvider } from "@homer0/simple-config";
|
|
14
|
+
import compression from "compression";
|
|
15
|
+
import bodyParser from "body-parser";
|
|
16
|
+
import multer from "multer";
|
|
17
|
+
import express from "express";
|
|
18
|
+
import {
|
|
19
|
+
commonServicesProvider,
|
|
20
|
+
httpServicesProvider,
|
|
21
|
+
utilsServicesProvider
|
|
22
|
+
} from "../services/index.js";
|
|
23
|
+
import {
|
|
24
|
+
statuses
|
|
25
|
+
} from "../utils/index.js";
|
|
26
|
+
class Jimpex extends Jimple {
|
|
27
|
+
/**
|
|
28
|
+
* The customization settings for the application.
|
|
29
|
+
*/
|
|
30
|
+
_options;
|
|
31
|
+
/**
|
|
32
|
+
* The Express application Jimpex uses under the hood.
|
|
33
|
+
*/
|
|
34
|
+
_express;
|
|
35
|
+
/**
|
|
36
|
+
* Since the configuration service has an async initialization, the class uses this flag
|
|
37
|
+
* internally to validate if the configuration has been initialized or not.
|
|
38
|
+
*/
|
|
39
|
+
_configReady = false;
|
|
40
|
+
/**
|
|
41
|
+
* A reference to the actual HTTP the application will use. This can vary depending on
|
|
42
|
+
* whether HTTPS, or HTTP2 are enabled. If HTTPS is not enabled, it will be the same as
|
|
43
|
+
* the `express` property; if HTTPS is enabled, it will be an `https` server; and if
|
|
44
|
+
* HTTP2 is enabled, it will be an `spdy` server.
|
|
45
|
+
*/
|
|
46
|
+
_server;
|
|
47
|
+
/**
|
|
48
|
+
* The instance of the server that is listening for requests.
|
|
49
|
+
*/
|
|
50
|
+
_instance;
|
|
51
|
+
/**
|
|
52
|
+
* A list of functions that implement controllers and middlewares. When the application
|
|
53
|
+
* starts, the queue will be processed and those controllers and middlewares will be
|
|
54
|
+
* added to the server instance. The reason they are not added directly like with a
|
|
55
|
+
* regular Express implementation is that services on Jimple use lazy loading, and
|
|
56
|
+
* adding middlewares and controllers as they come could cause errors if they depend on
|
|
57
|
+
* services that are not yet registered.
|
|
58
|
+
*/
|
|
59
|
+
_mountQueue = [];
|
|
60
|
+
/**
|
|
61
|
+
* A list with all the top routes controlled by the application. Every time a controller
|
|
62
|
+
* is mounted, its route will be added here.
|
|
63
|
+
*/
|
|
64
|
+
_controlledRoutes = [];
|
|
61
65
|
/**
|
|
62
66
|
* @param options Preferences to customize the application.
|
|
63
67
|
* @param config The default settings for the configuration service. It's a
|
|
64
|
-
*
|
|
68
|
+
* short-circuit for `options.config.default`
|
|
65
69
|
*/
|
|
66
70
|
constructor(options = {}, config = {}) {
|
|
67
71
|
super();
|
|
68
|
-
|
|
69
|
-
* The customization settings for the application.
|
|
70
|
-
*/
|
|
71
|
-
__publicField(this, "_options");
|
|
72
|
-
/**
|
|
73
|
-
* The Express application Jimpex uses under the hood.
|
|
74
|
-
*/
|
|
75
|
-
__publicField(this, "_express");
|
|
76
|
-
/**
|
|
77
|
-
* Since the configuration service has an async initialization, the class uses this flag
|
|
78
|
-
* internally to validate if the configuration has been initialized or not.
|
|
79
|
-
*/
|
|
80
|
-
__publicField(this, "_configReady", false);
|
|
81
|
-
/**
|
|
82
|
-
* A reference to the actuall HTTP the application will use. This can vary depending on
|
|
83
|
-
* whether HTTPS, or HTTP2 are enabled. If HTTPS is not enabled, it will be the same as
|
|
84
|
-
* the `express` property; if HTTPS is enabled, it will be an `https` server; and if
|
|
85
|
-
* HTTP2 is enabled, it will be an `spdy` server.
|
|
86
|
-
*/
|
|
87
|
-
__publicField(this, "_server");
|
|
88
|
-
/**
|
|
89
|
-
* The instance of the server that is listening for requests.
|
|
90
|
-
*/
|
|
91
|
-
__publicField(this, "_instance");
|
|
92
|
-
/**
|
|
93
|
-
* A list of functions that implement controllers and middlewares. When the application
|
|
94
|
-
* starts, the queue will be processed and those controllers and middlewares will be
|
|
95
|
-
* added to the server instance. The reason they are not added directly like with a
|
|
96
|
-
* regular Express implementation is that services on Jimple use lazy loading, and
|
|
97
|
-
* adding middlewares and controllers as they come could cause errors if they depend on
|
|
98
|
-
* services that are not yet registered.
|
|
99
|
-
*/
|
|
100
|
-
__publicField(this, "_mountQueue", []);
|
|
101
|
-
/**
|
|
102
|
-
* A list with all the top routes controlled by the application. Every time a controller
|
|
103
|
-
* is mounted, its route will be added here.
|
|
104
|
-
*/
|
|
105
|
-
__publicField(this, "_controlledRoutes", []);
|
|
106
|
-
this._options = (0, import_deep_assign.deepAssignWithOverwrite)(
|
|
72
|
+
this._options = deepAssignWithOverwrite(
|
|
107
73
|
{
|
|
108
74
|
filesizeLimit: "15MB",
|
|
109
75
|
boot: true,
|
|
@@ -143,7 +109,7 @@ class Jimpex extends import_jimple.Jimple {
|
|
|
143
109
|
options,
|
|
144
110
|
this._initOptions()
|
|
145
111
|
);
|
|
146
|
-
this._express = (
|
|
112
|
+
this._express = express();
|
|
147
113
|
this._setupCoreServices();
|
|
148
114
|
this._setupExpress();
|
|
149
115
|
this._configurePath();
|
|
@@ -214,8 +180,7 @@ class Jimpex extends import_jimple.Jimple {
|
|
|
214
180
|
* Stops the server instance.
|
|
215
181
|
*/
|
|
216
182
|
stop() {
|
|
217
|
-
if (!this._instance)
|
|
218
|
-
return;
|
|
183
|
+
if (!this._instance) return;
|
|
219
184
|
this._emitEvent("beforeStop", { app: this });
|
|
220
185
|
this._instance.close();
|
|
221
186
|
this._instance = void 0;
|
|
@@ -241,8 +206,7 @@ class Jimpex extends import_jimple.Jimple {
|
|
|
241
206
|
}
|
|
242
207
|
this._mountQueue.push((server) => {
|
|
243
208
|
const connected = useController.connect(this, route);
|
|
244
|
-
if (!connected)
|
|
245
|
-
return;
|
|
209
|
+
if (!connected) return;
|
|
246
210
|
const router = this._reduceWithEvent("controllerWillBeMounted", connected, {
|
|
247
211
|
route,
|
|
248
212
|
controller: useController,
|
|
@@ -326,7 +290,7 @@ class Jimpex extends import_jimple.Jimple {
|
|
|
326
290
|
* The application customization options.
|
|
327
291
|
*/
|
|
328
292
|
get options() {
|
|
329
|
-
return
|
|
293
|
+
return deepAssignWithOverwrite({}, this._options);
|
|
330
294
|
}
|
|
331
295
|
/**
|
|
332
296
|
* Gets the events service.
|
|
@@ -353,7 +317,7 @@ class Jimpex extends import_jimple.Jimple {
|
|
|
353
317
|
return this.eventsHub.on(eventName, listener);
|
|
354
318
|
}
|
|
355
319
|
/**
|
|
356
|
-
* Adds a listener for an application event that will only be
|
|
320
|
+
* Adds a listener for an application event that will only be executed once: the first
|
|
357
321
|
* time the event is triggered.
|
|
358
322
|
*
|
|
359
323
|
* @param eventName The name of the event to listen for.
|
|
@@ -366,7 +330,7 @@ class Jimpex extends import_jimple.Jimple {
|
|
|
366
330
|
return this.eventsHub.once(eventName, listener);
|
|
367
331
|
}
|
|
368
332
|
/**
|
|
369
|
-
* Based on the application options, it returns
|
|
333
|
+
* Based on the application options, it returns whether the application is healthy or
|
|
370
334
|
* not.
|
|
371
335
|
*/
|
|
372
336
|
isHealthy() {
|
|
@@ -375,7 +339,7 @@ class Jimpex extends import_jimple.Jimple {
|
|
|
375
339
|
/**
|
|
376
340
|
* This method is like a "lifecycle method", it gets executed on the constructor right
|
|
377
341
|
* before the "boot step". The idea is for the method to be a helper when the
|
|
378
|
-
* application is defined by
|
|
342
|
+
* application is defined by sub-classing {@link Jimpex}: the application could register
|
|
379
343
|
* all important services here and the routes on boot, then, if the implementation needs
|
|
380
344
|
* to access or overwrite a something, it can send `boot: false`, access/register what
|
|
381
345
|
* it needs, and then call `boot()`. That would be impossible for an application without
|
|
@@ -385,7 +349,7 @@ class Jimpex extends import_jimple.Jimple {
|
|
|
385
349
|
}
|
|
386
350
|
/**
|
|
387
351
|
* It generates overwrites for the application options when it gets created. This method
|
|
388
|
-
* is a helper for when the application is defined by
|
|
352
|
+
* is a helper for when the application is defined by sub-classing {@link Jimpex}: It's
|
|
389
353
|
* highly probable that if the application needs to change the default options, it would
|
|
390
354
|
* want to do it right from the class, instead of having to do it on every
|
|
391
355
|
* implementation. A way to do it would be overwriting the constructor and calling
|
|
@@ -401,23 +365,20 @@ class Jimpex extends import_jimple.Jimple {
|
|
|
401
365
|
*/
|
|
402
366
|
_setupCoreServices() {
|
|
403
367
|
this.register(
|
|
404
|
-
|
|
368
|
+
appLoggerProvider({
|
|
405
369
|
serviceName: "logger"
|
|
406
370
|
})
|
|
407
371
|
);
|
|
408
|
-
this.register(
|
|
409
|
-
this.register(
|
|
410
|
-
this.register(
|
|
411
|
-
this.register(
|
|
372
|
+
this.register(envUtilsProvider);
|
|
373
|
+
this.register(packageInfoProvider);
|
|
374
|
+
this.register(pathUtilsProvider);
|
|
375
|
+
this.register(rootFileProvider);
|
|
412
376
|
const { services: enabledServices } = this._options;
|
|
413
|
-
if (enabledServices.common)
|
|
414
|
-
|
|
415
|
-
if (enabledServices.
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
this.register(import_services.utilsServicesProvider);
|
|
419
|
-
this.set("events", () => new import_events_hub.EventsHub());
|
|
420
|
-
this.set("statuses", () => import_utils.statuses);
|
|
377
|
+
if (enabledServices.common) this.register(commonServicesProvider);
|
|
378
|
+
if (enabledServices.http) this.register(httpServicesProvider);
|
|
379
|
+
if (enabledServices.utils) this.register(utilsServicesProvider);
|
|
380
|
+
this.set("events", () => new EventsHub());
|
|
381
|
+
this.set("statuses", () => statuses);
|
|
421
382
|
}
|
|
422
383
|
/**
|
|
423
384
|
* Configures the Express application based on the class options.
|
|
@@ -431,30 +392,30 @@ class Jimpex extends import_jimple.Jimple {
|
|
|
431
392
|
this._express.disable("x-powered-by");
|
|
432
393
|
}
|
|
433
394
|
if (expressOptions.compression) {
|
|
434
|
-
this._express.use((
|
|
395
|
+
this._express.use(compression());
|
|
435
396
|
}
|
|
436
397
|
if (statics.enabled) {
|
|
437
398
|
this._addStaticsFolder(statics.route, statics.folder, statics.onHome);
|
|
438
399
|
}
|
|
439
400
|
if (expressOptions.bodyParser) {
|
|
440
401
|
this._express.use(
|
|
441
|
-
|
|
402
|
+
bodyParser.json({
|
|
442
403
|
limit: filesizeLimit
|
|
443
404
|
})
|
|
444
405
|
);
|
|
445
406
|
this._express.use(
|
|
446
|
-
|
|
407
|
+
bodyParser.urlencoded({
|
|
447
408
|
extended: true,
|
|
448
409
|
limit: filesizeLimit
|
|
449
410
|
})
|
|
450
411
|
);
|
|
451
412
|
}
|
|
452
413
|
if (expressOptions.multer) {
|
|
453
|
-
this._express.use((
|
|
414
|
+
this._express.use(multer().any());
|
|
454
415
|
}
|
|
455
416
|
this.set(
|
|
456
417
|
"router",
|
|
457
|
-
this.factory(() =>
|
|
418
|
+
this.factory(() => express.Router())
|
|
458
419
|
);
|
|
459
420
|
}
|
|
460
421
|
/**
|
|
@@ -475,7 +436,7 @@ class Jimpex extends import_jimple.Jimple {
|
|
|
475
436
|
const pathUtils = this.get("pathUtils");
|
|
476
437
|
const staticFolder = pathUtils.joinFrom(location, folder || staticRoute);
|
|
477
438
|
this.mount(`/${staticRoute}`, {
|
|
478
|
-
connect: () =>
|
|
439
|
+
connect: () => express.static(staticFolder),
|
|
479
440
|
controller: true
|
|
480
441
|
});
|
|
481
442
|
}
|
|
@@ -483,7 +444,7 @@ class Jimpex extends import_jimple.Jimple {
|
|
|
483
444
|
* This helper method validates the `path` options in order to register the `app`
|
|
484
445
|
* location in the `pathUtils` service. The `app` location should be the path to where
|
|
485
446
|
* the application executable is located, but due to how ESM works, we can't infer it
|
|
486
|
-
* from the `module` object, so we need either
|
|
447
|
+
* from the `module` object, so we need either received as the `appPath` setting, or try
|
|
487
448
|
* to get it from the parent module.
|
|
488
449
|
*
|
|
489
450
|
* @throws If the method should use the path from the parent module, but can't find
|
|
@@ -505,7 +466,7 @@ class Jimpex extends import_jimple.Jimple {
|
|
|
505
466
|
stackList.shift();
|
|
506
467
|
const parentFromStack = stackList.find((line) => !line.includes(__filename));
|
|
507
468
|
if (parentFromStack) {
|
|
508
|
-
const parentFile = parentFromStack.replace(/^.*?\s\(([^\s]+):\d+:\d+\)
|
|
469
|
+
const parentFile = parentFromStack.replace(/^.*?\s\(?([^\s]+):\d+:\d+\)?/, "$1");
|
|
509
470
|
if (parentFile !== parentFromStack) {
|
|
510
471
|
foundPath = true;
|
|
511
472
|
pathUtils.addLocation("app", path.dirname(parentFile));
|
|
@@ -525,8 +486,7 @@ class Jimpex extends import_jimple.Jimple {
|
|
|
525
486
|
* This method is called just before starting the application.
|
|
526
487
|
*/
|
|
527
488
|
async _setupConfig() {
|
|
528
|
-
if (this._configReady)
|
|
529
|
-
return;
|
|
489
|
+
if (this._configReady) return;
|
|
530
490
|
this._configReady = true;
|
|
531
491
|
const { config: options } = this._options;
|
|
532
492
|
let configsPath = options.path.replace(/\/$/, "");
|
|
@@ -539,7 +499,7 @@ class Jimpex extends import_jimple.Jimple {
|
|
|
539
499
|
options.name
|
|
540
500
|
);
|
|
541
501
|
this.register(
|
|
542
|
-
|
|
502
|
+
simpleConfigProvider({
|
|
543
503
|
name: options.name,
|
|
544
504
|
defaultConfig: options.default,
|
|
545
505
|
defaultConfigFilename,
|
|
@@ -559,8 +519,8 @@ class Jimpex extends import_jimple.Jimple {
|
|
|
559
519
|
* the application so they'll be available for all the services.
|
|
560
520
|
*/
|
|
561
521
|
async _loadESMModules() {
|
|
562
|
-
const { default: nodeFetch } = await
|
|
563
|
-
const { default: mime } = await
|
|
522
|
+
const { default: nodeFetch } = await tsAsyncImport("node-fetch");
|
|
523
|
+
const { default: mime } = await tsAsyncImport("mime");
|
|
564
524
|
this.set("node-fetch", () => nodeFetch);
|
|
565
525
|
this.set("mime", () => mime);
|
|
566
526
|
}
|
|
@@ -611,9 +571,8 @@ class Jimpex extends import_jimple.Jimple {
|
|
|
611
571
|
const info = await Promise.all(
|
|
612
572
|
keys.map(async (key) => {
|
|
613
573
|
const filepath = credentialsInfo[key];
|
|
614
|
-
if (!filepath)
|
|
615
|
-
|
|
616
|
-
const file = await import_promises.default.readFile(pathUtils.joinFrom(location, filepath), "utf8");
|
|
574
|
+
if (!filepath) return void 0;
|
|
575
|
+
const file = await fs.readFile(pathUtils.joinFrom(location, filepath), "utf8");
|
|
617
576
|
return {
|
|
618
577
|
key,
|
|
619
578
|
file
|
|
@@ -635,7 +594,7 @@ class Jimpex extends import_jimple.Jimple {
|
|
|
635
594
|
* @returns {Server}
|
|
636
595
|
* @throws {Error} If HTTP2 is enabled but HTTPS is not.
|
|
637
596
|
* @throws {Error} If HTTPS is enabled but there's no `https.credentials` object.
|
|
638
|
-
* @throws {Error} If HTTPS is enabled and no
|
|
597
|
+
* @throws {Error} If HTTPS is enabled and no credentials are found.
|
|
639
598
|
* @access protected
|
|
640
599
|
* @ignore
|
|
641
600
|
*/
|
|
@@ -662,15 +621,15 @@ class Jimpex extends import_jimple.Jimple {
|
|
|
662
621
|
...credentials,
|
|
663
622
|
spdy: http2Config.spdy
|
|
664
623
|
};
|
|
665
|
-
|
|
624
|
+
const spdyModule = await tsAsyncImport("spdy");
|
|
625
|
+
return spdyModule.default.createServer(serverOptions, this._express);
|
|
666
626
|
}
|
|
667
|
-
return (
|
|
627
|
+
return createHTTPSServer(credentials, this._express);
|
|
668
628
|
}
|
|
669
629
|
}
|
|
670
630
|
const jimpex = (...args) => new Jimpex(...args);
|
|
671
|
-
|
|
672
|
-
0 && (module.exports = {
|
|
631
|
+
export {
|
|
673
632
|
Jimpex,
|
|
674
633
|
jimpex
|
|
675
|
-
}
|
|
634
|
+
};
|
|
676
635
|
//# sourceMappingURL=jimpex.js.map
|