@lorenzopant/tmdb 0.0.1
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/.eslintignore +0 -0
- package/.eslintrc.js +0 -0
- package/.husky/pre-commit +15 -0
- package/.prettierrc +5 -0
- package/.release-it.json +18 -0
- package/CODE_OF_CONDUCT.md +128 -0
- package/CONTRIBUTING.md +71 -0
- package/LICENSE +21 -0
- package/README.md +121 -0
- package/eslint.config.mjs +6 -0
- package/package-scripts.json +0 -0
- package/package.json +64 -0
- package/tsconfig.json +115 -0
- package/vitest.config.mts +16 -0
package/.eslintignore
ADDED
|
File without changes
|
package/.eslintrc.js
ADDED
|
File without changes
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
pnpm run lint
|
|
2
|
+
RESULT=$?
|
|
3
|
+
if [ $RESULT -ne 0 ]; then
|
|
4
|
+
echo "\n❌ Lint errors found. Commit aborted."
|
|
5
|
+
exit 1
|
|
6
|
+
fi
|
|
7
|
+
|
|
8
|
+
pnpm run build
|
|
9
|
+
RESULT=$?
|
|
10
|
+
if [ $RESULT -ne 0 ]; then
|
|
11
|
+
echo "\n❌ Build failed. Commit aborted."
|
|
12
|
+
exit 1
|
|
13
|
+
fi
|
|
14
|
+
|
|
15
|
+
pnpm test
|
package/.prettierrc
ADDED
package/.release-it.json
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"plugins": {
|
|
3
|
+
"release-it-pnpm": {}
|
|
4
|
+
},
|
|
5
|
+
"github": {
|
|
6
|
+
"release": true
|
|
7
|
+
},
|
|
8
|
+
"git": {
|
|
9
|
+
"commitMessage": "chore: release v${version}",
|
|
10
|
+
"release": true
|
|
11
|
+
},
|
|
12
|
+
"npm": {
|
|
13
|
+
"skipChecks": true
|
|
14
|
+
},
|
|
15
|
+
"publishConfig": {
|
|
16
|
+
"access": "public"
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
|
2
|
+
|
|
3
|
+
## Our Pledge
|
|
4
|
+
|
|
5
|
+
We as members, contributors, and leaders pledge to make participation in our
|
|
6
|
+
community a harassment-free experience for everyone, regardless of age, body
|
|
7
|
+
size, visible or invisible disability, ethnicity, sex characteristics, gender
|
|
8
|
+
identity and expression, level of experience, education, socio-economic status,
|
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity
|
|
10
|
+
and orientation.
|
|
11
|
+
|
|
12
|
+
We pledge to act and interact in ways that contribute to an open, welcoming,
|
|
13
|
+
diverse, inclusive, and healthy community.
|
|
14
|
+
|
|
15
|
+
## Our Standards
|
|
16
|
+
|
|
17
|
+
Examples of behavior that contributes to a positive environment for our
|
|
18
|
+
community include:
|
|
19
|
+
|
|
20
|
+
* Demonstrating empathy and kindness toward other people
|
|
21
|
+
* Being respectful of differing opinions, viewpoints, and experiences
|
|
22
|
+
* Giving and gracefully accepting constructive feedback
|
|
23
|
+
* Accepting responsibility and apologizing to those affected by our mistakes,
|
|
24
|
+
and learning from the experience
|
|
25
|
+
* Focusing on what is best not just for us as individuals, but for the
|
|
26
|
+
overall community
|
|
27
|
+
|
|
28
|
+
Examples of unacceptable behavior include:
|
|
29
|
+
|
|
30
|
+
* The use of sexualized language or imagery, and sexual attention or
|
|
31
|
+
advances of any kind
|
|
32
|
+
* Trolling, insulting or derogatory comments, and personal or political attacks
|
|
33
|
+
* Public or private harassment
|
|
34
|
+
* Publishing others' private information, such as a physical or email
|
|
35
|
+
address, without their explicit permission
|
|
36
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
|
37
|
+
professional setting
|
|
38
|
+
|
|
39
|
+
## Enforcement Responsibilities
|
|
40
|
+
|
|
41
|
+
Community leaders are responsible for clarifying and enforcing our standards of
|
|
42
|
+
acceptable behavior and will take appropriate and fair corrective action in
|
|
43
|
+
response to any behavior that they deem inappropriate, threatening, offensive,
|
|
44
|
+
or harmful.
|
|
45
|
+
|
|
46
|
+
Community leaders have the right and responsibility to remove, edit, or reject
|
|
47
|
+
comments, commits, code, wiki edits, issues, and other contributions that are
|
|
48
|
+
not aligned to this Code of Conduct, and will communicate reasons for moderation
|
|
49
|
+
decisions when appropriate.
|
|
50
|
+
|
|
51
|
+
## Scope
|
|
52
|
+
|
|
53
|
+
This Code of Conduct applies within all community spaces, and also applies when
|
|
54
|
+
an individual is officially representing the community in public spaces.
|
|
55
|
+
Examples of representing our community include using an official e-mail address,
|
|
56
|
+
posting via an official social media account, or acting as an appointed
|
|
57
|
+
representative at an online or offline event.
|
|
58
|
+
|
|
59
|
+
## Enforcement
|
|
60
|
+
|
|
61
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
|
62
|
+
reported to the community leaders responsible for enforcement at
|
|
63
|
+
l.pantano97@gmail.com.
|
|
64
|
+
All complaints will be reviewed and investigated promptly and fairly.
|
|
65
|
+
|
|
66
|
+
All community leaders are obligated to respect the privacy and security of the
|
|
67
|
+
reporter of any incident.
|
|
68
|
+
|
|
69
|
+
## Enforcement Guidelines
|
|
70
|
+
|
|
71
|
+
Community leaders will follow these Community Impact Guidelines in determining
|
|
72
|
+
the consequences for any action they deem in violation of this Code of Conduct:
|
|
73
|
+
|
|
74
|
+
### 1. Correction
|
|
75
|
+
|
|
76
|
+
**Community Impact**: Use of inappropriate language or other behavior deemed
|
|
77
|
+
unprofessional or unwelcome in the community.
|
|
78
|
+
|
|
79
|
+
**Consequence**: A private, written warning from community leaders, providing
|
|
80
|
+
clarity around the nature of the violation and an explanation of why the
|
|
81
|
+
behavior was inappropriate. A public apology may be requested.
|
|
82
|
+
|
|
83
|
+
### 2. Warning
|
|
84
|
+
|
|
85
|
+
**Community Impact**: A violation through a single incident or series
|
|
86
|
+
of actions.
|
|
87
|
+
|
|
88
|
+
**Consequence**: A warning with consequences for continued behavior. No
|
|
89
|
+
interaction with the people involved, including unsolicited interaction with
|
|
90
|
+
those enforcing the Code of Conduct, for a specified period of time. This
|
|
91
|
+
includes avoiding interactions in community spaces as well as external channels
|
|
92
|
+
like social media. Violating these terms may lead to a temporary or
|
|
93
|
+
permanent ban.
|
|
94
|
+
|
|
95
|
+
### 3. Temporary Ban
|
|
96
|
+
|
|
97
|
+
**Community Impact**: A serious violation of community standards, including
|
|
98
|
+
sustained inappropriate behavior.
|
|
99
|
+
|
|
100
|
+
**Consequence**: A temporary ban from any sort of interaction or public
|
|
101
|
+
communication with the community for a specified period of time. No public or
|
|
102
|
+
private interaction with the people involved, including unsolicited interaction
|
|
103
|
+
with those enforcing the Code of Conduct, is allowed during this period.
|
|
104
|
+
Violating these terms may lead to a permanent ban.
|
|
105
|
+
|
|
106
|
+
### 4. Permanent Ban
|
|
107
|
+
|
|
108
|
+
**Community Impact**: Demonstrating a pattern of violation of community
|
|
109
|
+
standards, including sustained inappropriate behavior, harassment of an
|
|
110
|
+
individual, or aggression toward or disparagement of classes of individuals.
|
|
111
|
+
|
|
112
|
+
**Consequence**: A permanent ban from any sort of public interaction within
|
|
113
|
+
the community.
|
|
114
|
+
|
|
115
|
+
## Attribution
|
|
116
|
+
|
|
117
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
|
118
|
+
version 2.0, available at
|
|
119
|
+
https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
|
|
120
|
+
|
|
121
|
+
Community Impact Guidelines were inspired by [Mozilla's code of conduct
|
|
122
|
+
enforcement ladder](https://github.com/mozilla/diversity).
|
|
123
|
+
|
|
124
|
+
[homepage]: https://www.contributor-covenant.org
|
|
125
|
+
|
|
126
|
+
For answers to common questions about this code of conduct, see the FAQ at
|
|
127
|
+
https://www.contributor-covenant.org/faq. Translations are available at
|
|
128
|
+
https://www.contributor-covenant.org/translations.
|
package/CONTRIBUTING.md
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# Contributing to tmdb-api-ts
|
|
2
|
+
|
|
3
|
+
Thank you for considering contributing to **tmdb-api-ts**! Whether it's bug reports, feature requests, documentation improvements, or code contributions — all help is appreciated 🙌
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## 🧰 Getting Started
|
|
8
|
+
|
|
9
|
+
1. Fork the repository and clone it locally.
|
|
10
|
+
2. Install dependencies:
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
pnpm install
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
3. Run the development server and test suite:
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
pnpm dev
|
|
20
|
+
pnpm test
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## 🧪 Running Tests
|
|
26
|
+
|
|
27
|
+
We use [Vitest](https://vitest.dev/) for testing.
|
|
28
|
+
|
|
29
|
+
To run tests:
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
pnpm test
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
To generate a coverage report:
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
pnpm test --coverage
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
## ✍️ Code Style
|
|
44
|
+
|
|
45
|
+
- Use **TypeScript**
|
|
46
|
+
- Use **named exports** where possible
|
|
47
|
+
- Follow the established file structure (`src/`, `types/`, `tests/`, etc.)
|
|
48
|
+
- Use `pnpm lint` and `pnpm format` before submitting a PR
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
52
|
+
## 🧩 Submitting a Pull Request
|
|
53
|
+
|
|
54
|
+
1. Create a new branch from `main`
|
|
55
|
+
2. Follow the PR template if available
|
|
56
|
+
3. Provide a clear description of what you changed and why
|
|
57
|
+
4. Include related issue numbers if applicable
|
|
58
|
+
5. Ensure all tests pass and types are correct
|
|
59
|
+
|
|
60
|
+
---
|
|
61
|
+
|
|
62
|
+
## 🗃 Feature Requests & Bugs
|
|
63
|
+
|
|
64
|
+
- Open an issue describing the problem or idea
|
|
65
|
+
- Provide examples if possible (stack traces, API request/response, etc.)
|
|
66
|
+
|
|
67
|
+
---
|
|
68
|
+
|
|
69
|
+
## 🙌 Thank You
|
|
70
|
+
|
|
71
|
+
You're helping improve the developer experience for people building with the TMDB API in TypeScript. Thank you for your contributions!
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 @lorenzopant
|
|
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
ADDED
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
# TMDB API TS
|
|
2
|
+
|
|
3
|
+
A **TypeScript-first** lightweight client for [The Movie Database (TMDB)](https://developer.themoviedb.org/docs/getting-started) API.
|
|
4
|
+
|
|
5
|
+
This package is open-source and will be updated regularly with new features.
|
|
6
|
+
Feel free to open pull requests on the project repository.
|
|
7
|
+
|
|
8
|
+
- 📦 Full TypeScript support
|
|
9
|
+
- 🔥 Simple and tiny wrapper
|
|
10
|
+
- 🚀 Designed for server-side and frontend use (NextJS, React, Vue, etc.)
|
|
11
|
+
|
|
12
|
+
## Full documentation is available at [@lorenzopant/tmdb](https://lorenzopant-docs.vercel.app/)
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## Installation
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
npm install @lorenzopant/tmdb
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## Usage
|
|
25
|
+
|
|
26
|
+
```typescript
|
|
27
|
+
import { TMDB } from '@lorenzopant/tmdb';
|
|
28
|
+
|
|
29
|
+
const tmdb = new TMDB('your_access_token');
|
|
30
|
+
|
|
31
|
+
async function searchMovies() {
|
|
32
|
+
try {
|
|
33
|
+
const movies = await tmdb.search.movies({ query: 'Fight Club' });
|
|
34
|
+
console.log(movies);
|
|
35
|
+
} catch (error) {
|
|
36
|
+
if (error instanceof TMDBError) {
|
|
37
|
+
console.error('TMDB Error:', error.message);
|
|
38
|
+
console.error('HTTP Status:', error.http_status_code);
|
|
39
|
+
console.error('TMDB Status Code:', error.tmdb_status_code);
|
|
40
|
+
} else {
|
|
41
|
+
console.error('Unknown error:', error);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
searchMovies();
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
## API
|
|
52
|
+
|
|
53
|
+
### `TMDB`
|
|
54
|
+
|
|
55
|
+
The main client class. **Each API method supports all the parameters supported by TMDB API**, for example the search method supports: query, language, region, year, primary_release_year and so on...
|
|
56
|
+
|
|
57
|
+
#### Constructor
|
|
58
|
+
|
|
59
|
+
```typescript
|
|
60
|
+
const tmdb = new TMDB(accessToken: string);
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
- `accessToken`: **required**. Your TMDB API v4 access token.
|
|
64
|
+
|
|
65
|
+
---
|
|
66
|
+
|
|
67
|
+
### `Search`
|
|
68
|
+
|
|
69
|
+
Search for movies:
|
|
70
|
+
|
|
71
|
+
```typescript
|
|
72
|
+
tmdb.search.movies({ query: "Fight Club" });
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
Returns a **typed response** containing movies.
|
|
76
|
+
|
|
77
|
+
---
|
|
78
|
+
|
|
79
|
+
### `Movie Lists`
|
|
80
|
+
|
|
81
|
+
Now Playing, Popular, Top Rated and Upcoming movies:
|
|
82
|
+
|
|
83
|
+
```typescript
|
|
84
|
+
tmdb.movie_lists.now_playing();
|
|
85
|
+
tmdb.movie_lists.top_rated();
|
|
86
|
+
tmdb.movie_lists.popular();
|
|
87
|
+
tmdb.movie_lists.upcoming();
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
Returns a **typed response** containing movies.
|
|
91
|
+
|
|
92
|
+
---
|
|
93
|
+
|
|
94
|
+
### `Movie`
|
|
95
|
+
|
|
96
|
+
Details, alternative titles, changes, credits, external IDs and more:
|
|
97
|
+
|
|
98
|
+
```typescript
|
|
99
|
+
tmdb.movie.details({ movie_id: 550 });
|
|
100
|
+
tmdb.movie.alternative_titles({ movie_id: 550 });
|
|
101
|
+
tmdb.movie.changes({ movie_id: 550 });
|
|
102
|
+
tmdb.movie.credits({ movie_id: 550 });
|
|
103
|
+
tmdb.movie.external_ids({ movie_id: 550 });
|
|
104
|
+
|
|
105
|
+
...and more
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
Returns a **typed response** containing movies.
|
|
109
|
+
|
|
110
|
+
---
|
|
111
|
+
|
|
112
|
+
## Requirements
|
|
113
|
+
|
|
114
|
+
- Node.js 18+ recommended
|
|
115
|
+
- Works on frontend (React, Vue) but **don't expose sensitive access tokens** to users!
|
|
116
|
+
|
|
117
|
+
---
|
|
118
|
+
|
|
119
|
+
## License
|
|
120
|
+
|
|
121
|
+
MIT
|
|
File without changes
|
package/package.json
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@lorenzopant/tmdb",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "A completely type-safe The Movie Database (TMDB) API wrapper for typescript applications.",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/lorenzopant/tmdb"
|
|
10
|
+
},
|
|
11
|
+
"homepage": "https://lorenzopant-docs.vercel.app/",
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/lorenzopant/tmdb/issues"
|
|
14
|
+
},
|
|
15
|
+
"author": "Lorenzo Pantano",
|
|
16
|
+
"license": "MIT",
|
|
17
|
+
"keywords": [
|
|
18
|
+
"tmdb",
|
|
19
|
+
"typescript",
|
|
20
|
+
"api",
|
|
21
|
+
"movies"
|
|
22
|
+
],
|
|
23
|
+
"packageManager": "pnpm@8.8.0",
|
|
24
|
+
"devDependencies": {
|
|
25
|
+
"@eslint/compat": "^2.0.0",
|
|
26
|
+
"@eslint/eslintrc": "^3.3.1",
|
|
27
|
+
"@eslint/js": "^9.30.0",
|
|
28
|
+
"@types/node": "^22.15.2",
|
|
29
|
+
"@typescript-eslint/eslint-plugin": "^8.35.0",
|
|
30
|
+
"@typescript-eslint/parser": "^8.35.0",
|
|
31
|
+
"@vitest/coverage-v8": "^4.0.9",
|
|
32
|
+
"@vitest/ui": "^4.0.10",
|
|
33
|
+
"dotenv": "^16.5.0",
|
|
34
|
+
"eslint": "^9.30.0",
|
|
35
|
+
"eslint-config-prettier": "^10.1.5",
|
|
36
|
+
"eslint-plugin-import": "^2.32.0",
|
|
37
|
+
"husky": "^9.1.7",
|
|
38
|
+
"release-it": "^19.0.3",
|
|
39
|
+
"release-it-pnpm": "^4.6.6",
|
|
40
|
+
"typescript": "^5.8.3",
|
|
41
|
+
"typescript-eslint": "^8.35.0",
|
|
42
|
+
"vite": "^7.0.0",
|
|
43
|
+
"vitest": "^4.0.9"
|
|
44
|
+
},
|
|
45
|
+
"exports": {
|
|
46
|
+
".": {
|
|
47
|
+
"import": "./dist/index.js",
|
|
48
|
+
"types": "./dist/index.d.ts"
|
|
49
|
+
},
|
|
50
|
+
"./types": {
|
|
51
|
+
"types": "./dist/types/index.d.ts",
|
|
52
|
+
"default": "./dist/types/index.js"
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
"scripts": {
|
|
56
|
+
"build": "tsc",
|
|
57
|
+
"build:watch": "tsc --watch",
|
|
58
|
+
"test": "vitest",
|
|
59
|
+
"test:ui": "vitest --ui",
|
|
60
|
+
"test:coverage": "vitest --coverage",
|
|
61
|
+
"lint": "eslint .",
|
|
62
|
+
"patch": "npm version patch && npm publish"
|
|
63
|
+
}
|
|
64
|
+
}
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
/* Visit https://aka.ms/tsconfig to read more about this file */
|
|
4
|
+
|
|
5
|
+
/* Projects */
|
|
6
|
+
// "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */
|
|
7
|
+
// "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */
|
|
8
|
+
// "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */
|
|
9
|
+
// "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */
|
|
10
|
+
// "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */
|
|
11
|
+
// "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
|
|
12
|
+
|
|
13
|
+
/* Language and Environment */
|
|
14
|
+
"target": "ESNext" /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */,
|
|
15
|
+
// "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
|
|
16
|
+
"jsx": "react-jsx" /* Specify what JSX code is generated. */,
|
|
17
|
+
// "libReplacement": true, /* Enable lib replacement. */
|
|
18
|
+
// "experimentalDecorators": true, /* Enable experimental support for legacy experimental decorators. */
|
|
19
|
+
// "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */
|
|
20
|
+
// "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */
|
|
21
|
+
// "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */
|
|
22
|
+
// "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */
|
|
23
|
+
// "reactNamespace": "", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */
|
|
24
|
+
// "noLib": true, /* Disable including any library files, including the default lib.d.ts. */
|
|
25
|
+
// "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */
|
|
26
|
+
// "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */
|
|
27
|
+
|
|
28
|
+
/* Modules */
|
|
29
|
+
"module": "nodenext" /* Specify what module code is generated. */,
|
|
30
|
+
"rootDir": "src" /* Specify the root folder within your source files. */,
|
|
31
|
+
"moduleResolution": "nodenext" /* Specify how TypeScript looks up a file from a given module specifier. */,
|
|
32
|
+
// "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
|
|
33
|
+
// "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
|
|
34
|
+
// "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
|
|
35
|
+
// "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */
|
|
36
|
+
// "types": [], /* Specify type package names to be included without being referenced in a source file. */
|
|
37
|
+
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
|
|
38
|
+
// "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */
|
|
39
|
+
// "allowImportingTsExtensions": true, /* Allow imports to include TypeScript file extensions. Requires '--moduleResolution bundler' and either '--noEmit' or '--emitDeclarationOnly' to be set. */
|
|
40
|
+
// "rewriteRelativeImportExtensions": true, /* Rewrite '.ts', '.tsx', '.mts', and '.cts' file extensions in relative import paths to their JavaScript equivalent in output files. */
|
|
41
|
+
// "resolvePackageJsonExports": true, /* Use the package.json 'exports' field when resolving package imports. */
|
|
42
|
+
// "resolvePackageJsonImports": true, /* Use the package.json 'imports' field when resolving imports. */
|
|
43
|
+
// "customConditions": [], /* Conditions to set in addition to the resolver-specific defaults when resolving imports. */
|
|
44
|
+
// "noUncheckedSideEffectImports": true, /* Check side effect imports. */
|
|
45
|
+
// "resolveJsonModule": true, /* Enable importing .json files. */
|
|
46
|
+
// "allowArbitraryExtensions": true, /* Enable importing files with any extension, provided a declaration file is present. */
|
|
47
|
+
// "noResolve": true, /* Disallow 'import's, 'require's or '<reference>'s from expanding the number of files TypeScript should add to a project. */
|
|
48
|
+
|
|
49
|
+
/* JavaScript Support */
|
|
50
|
+
// "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */
|
|
51
|
+
// "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */
|
|
52
|
+
// "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */
|
|
53
|
+
|
|
54
|
+
/* Emit */
|
|
55
|
+
"declaration": true /* Generate .d.ts files from TypeScript and JavaScript files in your project. */,
|
|
56
|
+
"declarationMap": true /* Create sourcemaps for d.ts files. */,
|
|
57
|
+
// "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
|
|
58
|
+
// "sourceMap": true, /* Create source map files for emitted JavaScript files. */
|
|
59
|
+
// "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
|
|
60
|
+
// "noEmit": true, /* Disable emitting files from a compilation. */
|
|
61
|
+
// "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */
|
|
62
|
+
"outDir": "dist" /* Specify an output folder for all emitted files. */,
|
|
63
|
+
"removeComments": false /* Disable emitting comments. */,
|
|
64
|
+
// "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
|
|
65
|
+
// "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */
|
|
66
|
+
// "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */
|
|
67
|
+
// "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
|
|
68
|
+
// "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */
|
|
69
|
+
// "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */
|
|
70
|
+
// "newLine": "crlf", /* Set the newline character for emitting files. */
|
|
71
|
+
// "stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */
|
|
72
|
+
// "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */
|
|
73
|
+
// "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */
|
|
74
|
+
// "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */
|
|
75
|
+
// "declarationDir": "./", /* Specify the output directory for generated declaration files. */
|
|
76
|
+
|
|
77
|
+
/* Interop Constraints */
|
|
78
|
+
// "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */
|
|
79
|
+
// "verbatimModuleSyntax": true, /* Do not transform or elide any imports or exports not marked as type-only, ensuring they are written in the output file's format based on the 'module' setting. */
|
|
80
|
+
// "isolatedDeclarations": true, /* Require sufficient annotation on exports so other tools can trivially generate declaration files. */
|
|
81
|
+
// "erasableSyntaxOnly": true, /* Do not allow runtime constructs that are not part of ECMAScript. */
|
|
82
|
+
"allowSyntheticDefaultImports": true /* Allow 'import x from y' when a module doesn't have a default export. */,
|
|
83
|
+
"esModuleInterop": true /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */,
|
|
84
|
+
// "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */
|
|
85
|
+
"forceConsistentCasingInFileNames": true /* Ensure that casing is correct in imports. */,
|
|
86
|
+
|
|
87
|
+
/* Type Checking */
|
|
88
|
+
"strict": true /* Enable all strict type-checking options. */,
|
|
89
|
+
// "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */
|
|
90
|
+
// "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */
|
|
91
|
+
// "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
|
|
92
|
+
// "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */
|
|
93
|
+
// "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */
|
|
94
|
+
// "strictBuiltinIteratorReturn": true, /* Built-in iterators are instantiated with a 'TReturn' type of 'undefined' instead of 'any'. */
|
|
95
|
+
// "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */
|
|
96
|
+
// "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */
|
|
97
|
+
// "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */
|
|
98
|
+
// "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */
|
|
99
|
+
// "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */
|
|
100
|
+
// "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */
|
|
101
|
+
// "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */
|
|
102
|
+
// "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */
|
|
103
|
+
// "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */
|
|
104
|
+
// "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */
|
|
105
|
+
// "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */
|
|
106
|
+
// "allowUnusedLabels": true, /* Disable error reporting for unused labels. */
|
|
107
|
+
// "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */
|
|
108
|
+
|
|
109
|
+
/* Completeness */
|
|
110
|
+
// "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
|
|
111
|
+
"skipLibCheck": true /* Skip type checking all .d.ts files. */
|
|
112
|
+
},
|
|
113
|
+
"include": ["src"],
|
|
114
|
+
"exclude": ["**/*.test.ts", "**/*.spec.ts", "src/tests", "dist"]
|
|
115
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { defineConfig } from "vitest/config";
|
|
2
|
+
import { loadEnv } from "vite";
|
|
3
|
+
|
|
4
|
+
export default defineConfig({
|
|
5
|
+
test: {
|
|
6
|
+
globals: true,
|
|
7
|
+
environment: "node", // Use node if you don't need a browser environment
|
|
8
|
+
coverage: {
|
|
9
|
+
enabled: true,
|
|
10
|
+
reporter: ["text", "json", "html", "clover"],
|
|
11
|
+
exclude: ["src/types/**", "dist/**", "vitest.config.mts", "eslint.config.mjs", ".eslintrc.js", "src/index.ts"],
|
|
12
|
+
},
|
|
13
|
+
setupFiles: ["dotenv/config"],
|
|
14
|
+
env: loadEnv(process.cwd(), ""),
|
|
15
|
+
},
|
|
16
|
+
});
|