@expressots/shared 3.0.0 → 4.0.0-preview.3
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/LICENSE.md +21 -21
- package/README.md +51 -118
- package/lib/CHANGELOG.md +27 -7
- package/lib/README.md +51 -118
- package/lib/cjs/config/index.js +3 -0
- package/lib/cjs/config/project-config.js +17 -0
- package/lib/cjs/env/cli-options.js +2 -2
- package/lib/cjs/env/environment.js +17 -17
- package/lib/cjs/env/index.js +1 -1
- package/lib/cjs/index.js +4 -4
- package/lib/cjs/interfaces/index.js +3 -5
- package/lib/cjs/types/config/index.d.ts +1 -1
- package/lib/cjs/types/config/project-config.d.ts +6 -1
- package/lib/cjs/types/env/cli-options.d.ts +1 -1
- package/lib/cjs/types/env/env-options.d.ts +1 -1
- package/lib/cjs/types/env/environment.d.ts +1 -1
- package/lib/cjs/types/env/index.d.ts +2 -2
- package/lib/cjs/types/index.d.ts +4 -4
- package/lib/cjs/types/interfaces/application-express.interface.d.ts +9 -4
- package/lib/cjs/types/interfaces/console.interface.d.ts +6 -0
- package/lib/cjs/types/interfaces/index.d.ts +5 -5
- package/lib/cjs/types/interfaces/render/render.types.d.ts +1 -1
- package/lib/cjs/types/utils/compiler.d.ts +1 -1
- package/lib/cjs/types/utils/index.d.ts +1 -1
- package/lib/cjs/utils/index.js +2 -2
- package/lib/esm/config/index.js +1 -0
- package/lib/esm/config/project-config.js +16 -0
- package/lib/esm/env/cli-options.js +15 -0
- package/lib/esm/env/constants.js +10 -0
- package/lib/esm/env/env-options.js +19 -0
- package/lib/esm/env/environment.js +304 -0
- package/lib/esm/env/index.js +1 -0
- package/lib/esm/env/interfaces.js +1 -0
- package/lib/esm/index.mjs +4 -0
- package/lib/esm/interfaces/application-express.interface.js +1 -0
- package/lib/esm/interfaces/console.interface.js +1 -0
- package/lib/esm/interfaces/environment.interface.js +19 -0
- package/lib/esm/interfaces/index.js +1 -0
- package/lib/esm/interfaces/middleware.interface.js +1 -0
- package/lib/esm/interfaces/render/ejs.types.js +2 -0
- package/lib/esm/interfaces/render/render.types.js +20 -0
- package/lib/esm/package.json +3 -0
- package/lib/esm/types/config/index.d.ts +1 -0
- package/lib/esm/types/config/project-config.d.ts +43 -0
- package/lib/esm/types/env/cli-options.d.ts +7 -0
- package/lib/esm/types/env/constants.d.ts +10 -0
- package/lib/esm/types/env/env-options.d.ts +9 -0
- package/lib/esm/types/env/environment.d.ts +83 -0
- package/lib/esm/types/env/index.d.ts +2 -0
- package/lib/esm/types/env/interfaces.d.ts +71 -0
- package/lib/esm/types/index.d.ts +4 -0
- package/lib/esm/types/interfaces/application-express.interface.d.ts +58 -0
- package/lib/esm/types/interfaces/console.interface.d.ts +14 -0
- package/lib/esm/types/interfaces/environment.interface.d.ts +37 -0
- package/lib/esm/types/interfaces/index.d.ts +5 -0
- package/lib/esm/types/interfaces/middleware.interface.d.ts +7 -0
- package/lib/esm/types/interfaces/render/ejs.types.d.ts +169 -0
- package/lib/esm/types/interfaces/render/render.types.d.ts +71 -0
- package/lib/esm/types/utils/compiler.d.ts +17 -0
- package/lib/esm/types/utils/index.d.ts +1 -0
- package/lib/esm/types/utils/logger.d.ts +19 -0
- package/lib/esm/utils/compiler.js +69 -0
- package/lib/esm/utils/index.js +1 -0
- package/lib/esm/utils/logger.js +60 -0
- package/lib/package.json +167 -147
- package/package.json +167 -147
package/LICENSE.md
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2021 Richard Zampieri
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2021 Richard Zampieri
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,118 +1,51 @@
|
|
|
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
|
-
# About The Project
|
|
53
|
-
|
|
54
|
-
ExpressoTS is a [Typescript](https://www.typescriptlang.org/) + [Node.js](https://nodejs.org/en/) lightweight framework for quick building scalable, easy to read and maintain, server-side applications 🐎
|
|
55
|
-
|
|
56
|
-
## Getting Started
|
|
57
|
-
|
|
58
|
-
- Here is our [Site](https://expresso-ts.com/)
|
|
59
|
-
- You can find our [Documentation here](https://doc.expresso-ts.com/)
|
|
60
|
-
- Checkout our [First Steps documentation](https://doc.expresso-ts.com/docs/overview/first-steps)
|
|
61
|
-
- Our [CLI Documentation](https://doc.expresso-ts.com/docs/cli/overview)
|
|
62
|
-
|
|
63
|
-
## Contributing
|
|
64
|
-
|
|
65
|
-
Welcome to the ExpressoTS community, a place bustling with innovative minds just like yours. We're absolutely thrilled to have you here!
|
|
66
|
-
ExpressoTS is more than just a TypeScript framework; it's a collective effort by developers who are passionate about creating a more efficient, secure, and robust web ecosystem. We firmly believe that the best ideas come from a diversity of perspectives, backgrounds, and skills.
|
|
67
|
-
|
|
68
|
-
Why Contribute to Documentation?
|
|
69
|
-
|
|
70
|
-
- **Share Knowledge**: If you've figured out something cool, why keep it to yourself?
|
|
71
|
-
- **Build Your Portfolio**: Contributing to an open-source project like ExpressoTS is a great way to showcase your skills.
|
|
72
|
-
- **Join a Network**: Get to know a community of like-minded developers.
|
|
73
|
-
- **Improve the Product**: Help us fill in the gaps, correct errors, or make complex topics easier to understand.
|
|
74
|
-
|
|
75
|
-
Ready to contribute?
|
|
76
|
-
|
|
77
|
-
- [Contributing Guidelines](https://github.com/expressots/expressots/blob/main/CONTRIBUTING.md)
|
|
78
|
-
- [How to Contribute](https://github.com/expressots/expressots/blob/main/CONTRIBUTING_HOWTO.md)
|
|
79
|
-
- [Coding Guidelines](https://github.com/rsaz/TypescriptCodingGuidelines)
|
|
80
|
-
|
|
81
|
-
## Support the project
|
|
82
|
-
|
|
83
|
-
ExpressoTS is an independent open source project with ongoing development made possible thanks to your support. If you'd like to help, please consider:
|
|
84
|
-
|
|
85
|
-
- Become a **[sponsor on GitHub](https://github.com/sponsors/expressots)**
|
|
86
|
-
- Follow the **[organization](https://github.com/expressots)** on GitHub and Star ⭐ the project
|
|
87
|
-
- Subscribe to the Twitch channel: **[Richard Zampieri](https://www.twitch.tv/richardzampieri)**
|
|
88
|
-
- Join our **[Discord](https://discord.com/invite/PyPJfGK)**
|
|
89
|
-
- Contribute submitting **[issues and pull requests](https://github.com/expressots/expressots/issues)**
|
|
90
|
-
- Share the project with your friends and colleagues
|
|
91
|
-
|
|
92
|
-
## License
|
|
93
|
-
|
|
94
|
-
Distributed under the MIT License. See [`LICENSE.txt`](https://github.com/expressots/expressots/blob/main/LICENSE) for more information.
|
|
95
|
-
|
|
96
|
-
<p align="right">(<a href="#readme-top">back to top</a>)</p>
|
|
97
|
-
|
|
98
|
-
<!-- MARKDOWN LINKS & IMAGES -->
|
|
99
|
-
<!-- https://www.markdownguide.org/basic-syntax/#reference-style-links -->
|
|
100
|
-
|
|
101
|
-
[codecov-url]: https://codecov.io/gh/expressots/shared
|
|
102
|
-
[codecov-shield]: https://img.shields.io/codecov/c/gh/expressots/shared/main?style=for-the-badge&logo=codecov&labelColor=FB9AD1
|
|
103
|
-
[npm-url]: https://www.npmjs.com/package/@expressots/shared
|
|
104
|
-
[npm-shield]: https://img.shields.io/npm/v/@expressots/shared?style=for-the-badge&logo=npm&color=9B3922
|
|
105
|
-
[build-shield]: https://img.shields.io/github/actions/workflow/status/expressots/adapter-express/build.yaml?branch=main&style=for-the-badge&logo=github
|
|
106
|
-
[contributors-shield]: https://img.shields.io/github/contributors/expressots/shared?style=for-the-badge
|
|
107
|
-
[contributors-url]: https://github.com/expressots/shared/graphs/contributors
|
|
108
|
-
[forks-shield]: https://img.shields.io/github/forks/expressots/shared?style=for-the-badge
|
|
109
|
-
[forks-url]: https://github.com/expressots/shared/forks
|
|
110
|
-
[stars-shield]: https://img.shields.io/github/stars/expressots/shared?style=for-the-badge
|
|
111
|
-
[stars-url]: https://github.com/expressots/shared/stargazers
|
|
112
|
-
[issues-shield]: https://img.shields.io/github/issues/expressots/shared?style=for-the-badge
|
|
113
|
-
[issues-url]: https://github.com/expressots/shared/issues
|
|
114
|
-
[license-shield]: https://img.shields.io/github/license/expressots/shared?style=for-the-badge
|
|
115
|
-
[license-url]: https://github.com/expressots/shared/blob/main/LICENSE
|
|
116
|
-
[linkedin-shield]: https://img.shields.io/badge/-LinkedIn-black.svg?style=for-the-badge&logo=linkedin&colorB=555
|
|
117
|
-
[linkedin-url]: https://www.linkedin.com/company/expresso-ts/
|
|
118
|
-
[product-screenshot]: images/screenshot.png
|
|
1
|
+
<div align="center">
|
|
2
|
+
<a href="https://expresso-ts.com">
|
|
3
|
+
<img src="https://github.com/expressots/expressots/blob/main/media/expressots.png" alt="ExpressoTS" width="120">
|
|
4
|
+
</a>
|
|
5
|
+
|
|
6
|
+
<h1>@expressots/shared</h1>
|
|
7
|
+
|
|
8
|
+
<p>Shared types, interfaces, and utilities used across all ExpressoTS packages.</p>
|
|
9
|
+
|
|
10
|
+
<p>
|
|
11
|
+
<a href="https://www.npmjs.com/package/@expressots/shared"><img src="https://img.shields.io/npm/v/@expressots/shared?style=flat&color=0d0d0d" alt="npm"></a>
|
|
12
|
+
<a href="https://github.com/expressots/shared/blob/main/LICENSE.md"><img src="https://img.shields.io/github/license/expressots/shared?style=flat&color=0d0d0d" alt="License"></a>
|
|
13
|
+
<a href="https://discord.com/invite/PyPJfGK"><img src="https://img.shields.io/badge/Discord-join-0d0d0d?logo=discord&logoColor=white" alt="Discord"></a>
|
|
14
|
+
</p>
|
|
15
|
+
|
|
16
|
+
<p>
|
|
17
|
+
<a href="https://doc.expresso-ts.com">Documentation</a> ·
|
|
18
|
+
<a href="https://doc.expresso-ts.com/docs/core/first-steps">Getting Started</a> ·
|
|
19
|
+
<a href="https://discord.com/invite/PyPJfGK">Community</a>
|
|
20
|
+
</p>
|
|
21
|
+
</div>
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## Install
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
npm i @expressots/shared
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## What This Package Does
|
|
32
|
+
|
|
33
|
+
This is the shared foundation layer for the ExpressoTS ecosystem. It provides common TypeScript interfaces, configuration types, environment utilities, and helper functions that `@expressots/core`, `@expressots/adapter-express`, and other packages depend on. Most applications consume it indirectly through the core package.
|
|
34
|
+
|
|
35
|
+
## Documentation
|
|
36
|
+
|
|
37
|
+
For guides, API reference, architecture patterns, and examples visit **[doc.expresso-ts.com](https://doc.expresso-ts.com)**.
|
|
38
|
+
|
|
39
|
+
## Contributing
|
|
40
|
+
|
|
41
|
+
See the [Contributing Guide](https://github.com/expressots/expressots/blob/main/CONTRIBUTING.md) for how to get involved.
|
|
42
|
+
|
|
43
|
+
## Support
|
|
44
|
+
|
|
45
|
+
- [GitHub Sponsors](https://github.com/sponsors/expressots)
|
|
46
|
+
- [Discord](https://discord.com/invite/PyPJfGK)
|
|
47
|
+
- [Report an Issue](https://github.com/expressots/shared/issues)
|
|
48
|
+
|
|
49
|
+
## License
|
|
50
|
+
|
|
51
|
+
MIT — see [LICENSE](./LICENSE.md).
|
package/lib/CHANGELOG.md
CHANGED
|
@@ -1,20 +1,40 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
## [4.0.0-preview.3](https://github.com/expressots/shared/compare/3.0.0...4.0.0-preview.3) (2026-05-25)
|
|
2
|
+
|
|
3
|
+
Part of the ExpressoTS **v4.0.0 preview bundle**. See the [v4.0.0 release notes](https://expresso-ts.com/docs/4.0.0/prologue/release) and the [upgrade guide](https://expresso-ts.com/docs/4.0.0/prologue/upgrade_guide) for the full picture.
|
|
4
|
+
|
|
5
|
+
### Features
|
|
6
|
+
|
|
7
|
+
* extend `ExpressoConfig` with `scaffoldSchematics` covering all v4 schematics (`controller`, `usecase`, `dto`, `module`, `provider`, `entity`, `middleware`, `interceptor`, `event`, `handler`, `guard`, `config`).
|
|
8
|
+
* add type-safe `Pattern` enum (regular `enum`, not `const enum`, so consumers compiling with `isolatedModules: true` such as Vite/Vitest/esbuild/SWC can import it).
|
|
9
|
+
* expose shared content-negotiation primitives consumed by `@expressots/core` formatters.
|
|
10
|
+
* add `Env.when(condition, value, fallback)` helper for environment-specific config resolution.
|
|
11
|
+
* publish dual ESM + CJS builds with subpath exports for both module systems.
|
|
12
|
+
* declare `engines.node: ">=20.18.0"`.
|
|
13
|
+
|
|
14
|
+
### Bug Fixes
|
|
15
|
+
|
|
16
|
+
* tighten the `IWebServer` / `IWebServerBuilder` typings so v4 adapters can declare their server contract without leaking Express types.
|
|
17
|
+
* `configDotenv()` is now safe to call with no arguments — null-guard added on `options.encoding` / `options.debug` (previously threw `TypeError: Cannot read properties of undefined`).
|
|
18
|
+
|
|
19
|
+
### Build System
|
|
20
|
+
|
|
21
|
+
* bump dev toolchain to TypeScript 5.5, ESLint 8.57, Jest 29.7, Prettier 3.5.
|
|
22
|
+
|
|
3
23
|
## [3.0.0](https://github.com/expressots/shared/compare/3.0.0-beta.3...3.0.0) (2024-12-04)
|
|
4
24
|
|
|
5
25
|
|
|
6
26
|
### Features
|
|
7
27
|
|
|
8
28
|
* refactor IWebServer interface, add IWebServerBuilder ([9a23fff](https://github.com/expressots/shared/commit/9a23fff1e7de8d3880ed90317ffde1037ef1947b))
|
|
9
|
-
* update initEnvironment method to return a Promise for better async handling ([6ae9525](https://github.com/expressots/shared/commit/6ae9525b5497dacf81c1861e467bf6e27421ad2e))
|
|
10
|
-
|
|
29
|
+
* update initEnvironment method to return a Promise for better async handling ([6ae9525](https://github.com/expressots/shared/commit/6ae9525b5497dacf81c1861e467bf6e27421ad2e))
|
|
30
|
+
|
|
11
31
|
## [3.0.0](https://github.com/expressots/shared/compare/3.0.0-beta.3...3.0.0) (2024-12-03)
|
|
12
32
|
|
|
13
33
|
|
|
14
34
|
### Features
|
|
15
35
|
|
|
16
|
-
* refactor IWebServer interface, add IWebServerBuilder ([9a23fff](https://github.com/expressots/shared/commit/9a23fff1e7de8d3880ed90317ffde1037ef1947b))
|
|
17
|
-
|
|
36
|
+
* refactor IWebServer interface, add IWebServerBuilder ([9a23fff](https://github.com/expressots/shared/commit/9a23fff1e7de8d3880ed90317ffde1037ef1947b))
|
|
37
|
+
|
|
18
38
|
## [3.0.0-beta.3](https://github.com/expressots/shared/compare/0.3.0...0.4.0) (2024-11-28)
|
|
19
39
|
|
|
20
40
|
### Features
|
|
@@ -69,4 +89,4 @@
|
|
|
69
89
|
|
|
70
90
|
### Bug Fixes
|
|
71
91
|
|
|
72
|
-
- testing commitlint ([0e78653](https://github.com/expressots/<<repo_name>>/commit/0e786539402f69fdca3fe5b684d850e523db7698))
|
|
92
|
+
- testing commitlint ([0e78653](https://github.com/expressots/<<repo_name>>/commit/0e786539402f69fdca3fe5b684d850e523db7698))
|
package/lib/README.md
CHANGED
|
@@ -1,118 +1,51 @@
|
|
|
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
|
-
# About The Project
|
|
53
|
-
|
|
54
|
-
ExpressoTS is a [Typescript](https://www.typescriptlang.org/) + [Node.js](https://nodejs.org/en/) lightweight framework for quick building scalable, easy to read and maintain, server-side applications 🐎
|
|
55
|
-
|
|
56
|
-
## Getting Started
|
|
57
|
-
|
|
58
|
-
- Here is our [Site](https://expresso-ts.com/)
|
|
59
|
-
- You can find our [Documentation here](https://doc.expresso-ts.com/)
|
|
60
|
-
- Checkout our [First Steps documentation](https://doc.expresso-ts.com/docs/overview/first-steps)
|
|
61
|
-
- Our [CLI Documentation](https://doc.expresso-ts.com/docs/cli/overview)
|
|
62
|
-
|
|
63
|
-
## Contributing
|
|
64
|
-
|
|
65
|
-
Welcome to the ExpressoTS community, a place bustling with innovative minds just like yours. We're absolutely thrilled to have you here!
|
|
66
|
-
ExpressoTS is more than just a TypeScript framework; it's a collective effort by developers who are passionate about creating a more efficient, secure, and robust web ecosystem. We firmly believe that the best ideas come from a diversity of perspectives, backgrounds, and skills.
|
|
67
|
-
|
|
68
|
-
Why Contribute to Documentation?
|
|
69
|
-
|
|
70
|
-
- **Share Knowledge**: If you've figured out something cool, why keep it to yourself?
|
|
71
|
-
- **Build Your Portfolio**: Contributing to an open-source project like ExpressoTS is a great way to showcase your skills.
|
|
72
|
-
- **Join a Network**: Get to know a community of like-minded developers.
|
|
73
|
-
- **Improve the Product**: Help us fill in the gaps, correct errors, or make complex topics easier to understand.
|
|
74
|
-
|
|
75
|
-
Ready to contribute?
|
|
76
|
-
|
|
77
|
-
- [Contributing Guidelines](https://github.com/expressots/expressots/blob/main/CONTRIBUTING.md)
|
|
78
|
-
- [How to Contribute](https://github.com/expressots/expressots/blob/main/CONTRIBUTING_HOWTO.md)
|
|
79
|
-
- [Coding Guidelines](https://github.com/rsaz/TypescriptCodingGuidelines)
|
|
80
|
-
|
|
81
|
-
## Support the project
|
|
82
|
-
|
|
83
|
-
ExpressoTS is an independent open source project with ongoing development made possible thanks to your support. If you'd like to help, please consider:
|
|
84
|
-
|
|
85
|
-
- Become a **[sponsor on GitHub](https://github.com/sponsors/expressots)**
|
|
86
|
-
- Follow the **[organization](https://github.com/expressots)** on GitHub and Star ⭐ the project
|
|
87
|
-
- Subscribe to the Twitch channel: **[Richard Zampieri](https://www.twitch.tv/richardzampieri)**
|
|
88
|
-
- Join our **[Discord](https://discord.com/invite/PyPJfGK)**
|
|
89
|
-
- Contribute submitting **[issues and pull requests](https://github.com/expressots/expressots/issues)**
|
|
90
|
-
- Share the project with your friends and colleagues
|
|
91
|
-
|
|
92
|
-
## License
|
|
93
|
-
|
|
94
|
-
Distributed under the MIT License. See [`LICENSE.txt`](https://github.com/expressots/expressots/blob/main/LICENSE) for more information.
|
|
95
|
-
|
|
96
|
-
<p align="right">(<a href="#readme-top">back to top</a>)</p>
|
|
97
|
-
|
|
98
|
-
<!-- MARKDOWN LINKS & IMAGES -->
|
|
99
|
-
<!-- https://www.markdownguide.org/basic-syntax/#reference-style-links -->
|
|
100
|
-
|
|
101
|
-
[codecov-url]: https://codecov.io/gh/expressots/shared
|
|
102
|
-
[codecov-shield]: https://img.shields.io/codecov/c/gh/expressots/shared/main?style=for-the-badge&logo=codecov&labelColor=FB9AD1
|
|
103
|
-
[npm-url]: https://www.npmjs.com/package/@expressots/shared
|
|
104
|
-
[npm-shield]: https://img.shields.io/npm/v/@expressots/shared?style=for-the-badge&logo=npm&color=9B3922
|
|
105
|
-
[build-shield]: https://img.shields.io/github/actions/workflow/status/expressots/adapter-express/build.yaml?branch=main&style=for-the-badge&logo=github
|
|
106
|
-
[contributors-shield]: https://img.shields.io/github/contributors/expressots/shared?style=for-the-badge
|
|
107
|
-
[contributors-url]: https://github.com/expressots/shared/graphs/contributors
|
|
108
|
-
[forks-shield]: https://img.shields.io/github/forks/expressots/shared?style=for-the-badge
|
|
109
|
-
[forks-url]: https://github.com/expressots/shared/forks
|
|
110
|
-
[stars-shield]: https://img.shields.io/github/stars/expressots/shared?style=for-the-badge
|
|
111
|
-
[stars-url]: https://github.com/expressots/shared/stargazers
|
|
112
|
-
[issues-shield]: https://img.shields.io/github/issues/expressots/shared?style=for-the-badge
|
|
113
|
-
[issues-url]: https://github.com/expressots/shared/issues
|
|
114
|
-
[license-shield]: https://img.shields.io/github/license/expressots/shared?style=for-the-badge
|
|
115
|
-
[license-url]: https://github.com/expressots/shared/blob/main/LICENSE
|
|
116
|
-
[linkedin-shield]: https://img.shields.io/badge/-LinkedIn-black.svg?style=for-the-badge&logo=linkedin&colorB=555
|
|
117
|
-
[linkedin-url]: https://www.linkedin.com/company/expresso-ts/
|
|
118
|
-
[product-screenshot]: images/screenshot.png
|
|
1
|
+
<div align="center">
|
|
2
|
+
<a href="https://expresso-ts.com">
|
|
3
|
+
<img src="https://github.com/expressots/expressots/blob/main/media/expressots.png" alt="ExpressoTS" width="120">
|
|
4
|
+
</a>
|
|
5
|
+
|
|
6
|
+
<h1>@expressots/shared</h1>
|
|
7
|
+
|
|
8
|
+
<p>Shared types, interfaces, and utilities used across all ExpressoTS packages.</p>
|
|
9
|
+
|
|
10
|
+
<p>
|
|
11
|
+
<a href="https://www.npmjs.com/package/@expressots/shared"><img src="https://img.shields.io/npm/v/@expressots/shared?style=flat&color=0d0d0d" alt="npm"></a>
|
|
12
|
+
<a href="https://github.com/expressots/shared/blob/main/LICENSE.md"><img src="https://img.shields.io/github/license/expressots/shared?style=flat&color=0d0d0d" alt="License"></a>
|
|
13
|
+
<a href="https://discord.com/invite/PyPJfGK"><img src="https://img.shields.io/badge/Discord-join-0d0d0d?logo=discord&logoColor=white" alt="Discord"></a>
|
|
14
|
+
</p>
|
|
15
|
+
|
|
16
|
+
<p>
|
|
17
|
+
<a href="https://doc.expresso-ts.com">Documentation</a> ·
|
|
18
|
+
<a href="https://doc.expresso-ts.com/docs/core/first-steps">Getting Started</a> ·
|
|
19
|
+
<a href="https://discord.com/invite/PyPJfGK">Community</a>
|
|
20
|
+
</p>
|
|
21
|
+
</div>
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## Install
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
npm i @expressots/shared
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## What This Package Does
|
|
32
|
+
|
|
33
|
+
This is the shared foundation layer for the ExpressoTS ecosystem. It provides common TypeScript interfaces, configuration types, environment utilities, and helper functions that `@expressots/core`, `@expressots/adapter-express`, and other packages depend on. Most applications consume it indirectly through the core package.
|
|
34
|
+
|
|
35
|
+
## Documentation
|
|
36
|
+
|
|
37
|
+
For guides, API reference, architecture patterns, and examples visit **[doc.expresso-ts.com](https://doc.expresso-ts.com)**.
|
|
38
|
+
|
|
39
|
+
## Contributing
|
|
40
|
+
|
|
41
|
+
See the [Contributing Guide](https://github.com/expressots/expressots/blob/main/CONTRIBUTING.md) for how to get involved.
|
|
42
|
+
|
|
43
|
+
## Support
|
|
44
|
+
|
|
45
|
+
- [GitHub Sponsors](https://github.com/sponsors/expressots)
|
|
46
|
+
- [Discord](https://discord.com/invite/PyPJfGK)
|
|
47
|
+
- [Report an Issue](https://github.com/expressots/shared/issues)
|
|
48
|
+
|
|
49
|
+
## License
|
|
50
|
+
|
|
51
|
+
MIT — see [LICENSE](./LICENSE.md).
|
package/lib/cjs/config/index.js
CHANGED
|
@@ -1,2 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Pattern = void 0;
|
|
4
|
+
var project_config_js_1 = require("./project-config.js");
|
|
5
|
+
Object.defineProperty(exports, "Pattern", { enumerable: true, get: function () { return project_config_js_1.Pattern; } });
|
|
@@ -1,2 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Pattern = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Enum representing different string patterns.
|
|
6
|
+
*
|
|
7
|
+
* - LOWER_CASE: Represents strings in all lowercase letters. E.g. "hello"
|
|
8
|
+
* - KEBAB_CASE: Represents strings separated by hyphens. E.g. "hello-world"
|
|
9
|
+
* - PASCAL_CASE: Represents strings where the first letter of each word is capitalized. E.g. "HelloWorld"
|
|
10
|
+
* - CAMEL_CASE: Represents strings where the first letter of the first word is lowercase and the first letter of subsequent words are capitalized. E.g. "helloWorld"
|
|
11
|
+
* @public API
|
|
12
|
+
*/
|
|
13
|
+
var Pattern;
|
|
14
|
+
(function (Pattern) {
|
|
15
|
+
Pattern["LOWER_CASE"] = "lowercase";
|
|
16
|
+
Pattern["KEBAB_CASE"] = "kebab-case";
|
|
17
|
+
Pattern["PASCAL_CASE"] = "PascalCase";
|
|
18
|
+
Pattern["CAMEL_CASE"] = "camelCase";
|
|
19
|
+
})(Pattern || (exports.Pattern = Pattern = {}));
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.optionMatcher = optionMatcher;
|
|
4
|
-
const
|
|
4
|
+
const constants_js_1 = require("./constants.js");
|
|
5
5
|
/**
|
|
6
6
|
* Matches the options passed in the command line
|
|
7
7
|
* @param args - The arguments passed in the command line
|
|
@@ -9,7 +9,7 @@ const constants_1 = require("./constants");
|
|
|
9
9
|
*/
|
|
10
10
|
function optionMatcher(args) {
|
|
11
11
|
return args.reduce((previous, current) => {
|
|
12
|
-
const matches = current.match(
|
|
12
|
+
const matches = current.match(constants_js_1.ENV_VAR_REGEX);
|
|
13
13
|
if (matches) {
|
|
14
14
|
previous[matches[1]] = matches[2];
|
|
15
15
|
}
|
|
@@ -20,8 +20,8 @@ const fs_1 = __importDefault(require("fs"));
|
|
|
20
20
|
const path_1 = __importDefault(require("path"));
|
|
21
21
|
const os_1 = __importDefault(require("os"));
|
|
22
22
|
const crypto_1 = __importDefault(require("crypto"));
|
|
23
|
-
const
|
|
24
|
-
const
|
|
23
|
+
const constants_js_1 = require("./constants.js");
|
|
24
|
+
const logger_js_1 = require("../utils/logger.js");
|
|
25
25
|
/**
|
|
26
26
|
* Module to parse the .env.vault file
|
|
27
27
|
* @param options - The configuration options
|
|
@@ -152,7 +152,7 @@ function _resolveHome(envPath) {
|
|
|
152
152
|
* @returns The parsed object
|
|
153
153
|
*/
|
|
154
154
|
function _configVault(options) {
|
|
155
|
-
(0,
|
|
155
|
+
(0, logger_js_1.log)("Loading env from encrypted .env.vault");
|
|
156
156
|
const parsed = _parseVault(options);
|
|
157
157
|
let processEnv = process.env;
|
|
158
158
|
if (options && options.envObject != null) {
|
|
@@ -172,9 +172,9 @@ function config(options) {
|
|
|
172
172
|
return configDotenv(options);
|
|
173
173
|
}
|
|
174
174
|
const vaultPath = _vaultPath(options);
|
|
175
|
-
console.log(vaultPath);
|
|
176
175
|
if (!vaultPath) {
|
|
177
|
-
|
|
176
|
+
const expected = path_1.default.resolve(process.cwd(), ".env.vault");
|
|
177
|
+
(0, logger_js_1.log)(`You set DOTENV_KEY but no .env.vault file was found (expected at ${expected}). Did you forget to build it?`, logger_js_1.LogLevel.Warn);
|
|
178
178
|
return configDotenv(options);
|
|
179
179
|
}
|
|
180
180
|
return _configVault(options);
|
|
@@ -186,24 +186,24 @@ function config(options) {
|
|
|
186
186
|
* @public API
|
|
187
187
|
*/
|
|
188
188
|
function configDotenv(options) {
|
|
189
|
-
const
|
|
190
|
-
const
|
|
191
|
-
const
|
|
192
|
-
const
|
|
193
|
-
|
|
194
|
-
: [_resolveHome(dotenvPath)];
|
|
189
|
+
const opts = options ?? {};
|
|
190
|
+
const dotenvPath = path_1.default.resolve(process.cwd(), String(opts.path ?? ".env"));
|
|
191
|
+
const encoding = (opts.encoding ?? "utf8");
|
|
192
|
+
const debug = !!opts.debug;
|
|
193
|
+
const paths = Array.isArray(opts.path) ? opts.path.map(_resolveHome) : [_resolveHome(dotenvPath)];
|
|
195
194
|
const parsed = {};
|
|
196
195
|
let lastError;
|
|
197
196
|
for (const envPath of paths) {
|
|
198
197
|
try {
|
|
199
198
|
const fileContent = fs_1.default.readFileSync(envPath, { encoding });
|
|
200
199
|
const parsedContent = parse(fileContent);
|
|
201
|
-
|
|
200
|
+
Object.assign(parsed, parsedContent);
|
|
201
|
+
populate(process.env, parsedContent, opts);
|
|
202
202
|
}
|
|
203
203
|
catch (error) {
|
|
204
204
|
lastError = error;
|
|
205
205
|
if (debug) {
|
|
206
|
-
(0,
|
|
206
|
+
(0, logger_js_1.log)(`Failed to load ${envPath} file with error: ${error.message}`, logger_js_1.LogLevel.Debug);
|
|
207
207
|
}
|
|
208
208
|
}
|
|
209
209
|
}
|
|
@@ -219,7 +219,7 @@ function parse(envFile) {
|
|
|
219
219
|
const obj = {};
|
|
220
220
|
const lines = envFile.toString().replace(/\r\n?/gm, "\n");
|
|
221
221
|
let match;
|
|
222
|
-
while ((match =
|
|
222
|
+
while ((match = constants_js_1.LINE_REGEX.exec(lines)) != null) {
|
|
223
223
|
const key = match[1].trim();
|
|
224
224
|
let value = match[2]?.trim() ?? "";
|
|
225
225
|
if (["'", '"', "`"].includes(value[0])) {
|
|
@@ -294,18 +294,18 @@ parsed, options = {}) {
|
|
|
294
294
|
if (override) {
|
|
295
295
|
envObject[key] = parsedValue;
|
|
296
296
|
if (debug) {
|
|
297
|
-
(0,
|
|
297
|
+
(0, logger_js_1.log)(`"${key}" was overwritten to "${parsedValue}"`, logger_js_1.LogLevel.Debug);
|
|
298
298
|
}
|
|
299
299
|
}
|
|
300
300
|
else if (debug) {
|
|
301
|
-
(0,
|
|
301
|
+
(0, logger_js_1.log)(`"${key}" was NOT overwritten (already exists)`, logger_js_1.LogLevel.Debug);
|
|
302
302
|
}
|
|
303
303
|
}
|
|
304
304
|
else {
|
|
305
305
|
// Variable doesn't exist in process.env, so set it
|
|
306
306
|
envObject[key] = parsedValue;
|
|
307
307
|
if (debug) {
|
|
308
|
-
(0,
|
|
308
|
+
(0, logger_js_1.log)(`"${key}" was set to "${parsedValue}"`, logger_js_1.LogLevel.Debug);
|
|
309
309
|
}
|
|
310
310
|
}
|
|
311
311
|
}
|
package/lib/cjs/env/index.js
CHANGED
|
@@ -14,4 +14,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./environment"), exports);
|
|
17
|
+
__exportStar(require("./environment.js"), exports);
|
package/lib/cjs/index.js
CHANGED
|
@@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./config"), exports);
|
|
18
|
-
__exportStar(require("./env"), exports);
|
|
19
|
-
__exportStar(require("./interfaces"), exports);
|
|
20
|
-
__exportStar(require("./utils"), exports);
|
|
17
|
+
__exportStar(require("./config/index.js"), exports);
|
|
18
|
+
__exportStar(require("./env/index.js"), exports);
|
|
19
|
+
__exportStar(require("./interfaces/index.js"), exports);
|
|
20
|
+
__exportStar(require("./utils/index.js"), exports);
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
var
|
|
5
|
-
Object.defineProperty(exports, "RenderEngine", { enumerable: true, get: function () { return
|
|
6
|
-
var environment_interface_1 = require("./environment.interface");
|
|
7
|
-
Object.defineProperty(exports, "Env", { enumerable: true, get: function () { return environment_interface_1.Env; } });
|
|
3
|
+
exports.RenderEngine = void 0;
|
|
4
|
+
var render_types_js_1 = require("./render/render.types.js");
|
|
5
|
+
Object.defineProperty(exports, "RenderEngine", { enumerable: true, get: function () { return render_types_js_1.RenderEngine; } });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { Pattern, ExpressoConfig } from "./project-config";
|
|
1
|
+
export { Pattern, ExpressoConfig } from "./project-config.js";
|