update tsconfig

This commit is contained in:
Philipp Kunz 2024-04-14 18:21:14 +02:00
parent 9912bbbc1c
commit 23bb1c70c9
4 changed files with 119 additions and 31 deletions

View File

@ -8,14 +8,23 @@
"shortDescription": "get sourcemap support in node",
"npmPackagename": "@push.rocks/smartsourcemap",
"license": "MIT",
"projectDomain": "push.rocks"
"projectDomain": "push.rocks",
"description": "Enables sourcemap support in Node.js projects for improved debugging.",
"keywords": [
"sourcemap",
"debugging",
"nodejs",
"typescript",
"source-map-support",
"development tools"
]
}
},
"npmci": {
"npmGlobalTools": [],
"npmAccessLevel": "public"
},
"tsdocs": {
"tsdoc": {
"legal": "\n## License and Legal Information\n\nThis repository contains open-source code that is licensed under the MIT License. A copy of the MIT License can be found in the [license](license) file within this repository. \n\n**Please note:** The MIT License does not grant permission to use the trade names, trademarks, service marks, or product names of the project, except as required for reasonable and customary use in describing the origin of the work and reproducing the content of the NOTICE file.\n\n### Trademarks\n\nThis project is owned and maintained by Task Venture Capital GmbH. The names and logos associated with Task Venture Capital GmbH and any related products or services are trademarks of Task Venture Capital GmbH and are not included within the scope of the MIT license granted herein. Use of these trademarks must comply with Task Venture Capital GmbH's Trademark Guidelines, and any usage must be approved in writing by Task Venture Capital GmbH.\n\n### Company Information\n\nTask Venture Capital GmbH \nRegistered at District court Bremen HRB 35230 HB, Germany\n\nFor any legal inquiries or if you require further information, please contact us via email at hello@task.vc.\n\nBy using this repository, you acknowledge that you have read this section, agree to comply with its terms, and understand that the licensing of the code does not imply endorsement by Task Venture Capital GmbH of any derivative works.\n"
}
}

View File

@ -2,7 +2,7 @@
"name": "@push.rocks/smartsourcemap",
"version": "1.0.6",
"private": false,
"description": "get sourcemap support in node",
"description": "Enables sourcemap support in Node.js projects for improved debugging.",
"main": "dist_ts/index.js",
"typings": "dist_ts/index.d.ts",
"author": "Lossless GmbH",
@ -37,5 +37,13 @@
],
"browserslist": [
"last 1 chrome versions"
],
"keywords": [
"sourcemap",
"debugging",
"nodejs",
"typescript",
"source-map-support",
"development tools"
]
}

1
readme.hints.md Normal file
View File

@ -0,0 +1 @@

126
readme.md
View File

@ -1,42 +1,112 @@
# @pushrocks/smartsourcemap
# @push.rocks/smartsourcemap
get sourcemap support in node
## Availabililty and Links
* [npmjs.org (npm package)](https://www.npmjs.com/package/@pushrocks/smartsourcemap)
* [gitlab.com (source)](https://gitlab.com/pushrocks/smartsourcemap)
* [github.com (source mirror)](https://github.com/pushrocks/smartsourcemap)
* [docs (typedoc)](https://pushrocks.gitlab.io/smartsourcemap/)
## Install
To use `@push.rocks/smartsourcemap` in your project, run:
## Status for master
```bash
npm install @push.rocks/smartsourcemap --save
```
Status Category | Status Badge
-- | --
GitLab Pipelines | [![pipeline status](https://gitlab.com/pushrocks/smartsourcemap/badges/master/pipeline.svg)](https://lossless.cloud)
GitLab Pipline Test Coverage | [![coverage report](https://gitlab.com/pushrocks/smartsourcemap/badges/master/coverage.svg)](https://lossless.cloud)
npm | [![npm downloads per month](https://badgen.net/npm/dy/@pushrocks/smartsourcemap)](https://lossless.cloud)
Snyk | [![Known Vulnerabilities](https://badgen.net/snyk/pushrocks/smartsourcemap)](https://lossless.cloud)
TypeScript Support | [![TypeScript](https://badgen.net/badge/TypeScript/>=%203.x/blue?icon=typescript)](https://lossless.cloud)
node Support | [![node](https://img.shields.io/badge/node->=%2010.x.x-blue.svg)](https://nodejs.org/dist/latest-v10.x/docs/api/)
Code Style | [![Code Style](https://badgen.net/badge/style/prettier/purple)](https://lossless.cloud)
PackagePhobia (total standalone install weight) | [![PackagePhobia](https://badgen.net/packagephobia/install/@pushrocks/smartsourcemap)](https://lossless.cloud)
PackagePhobia (package size on registry) | [![PackagePhobia](https://badgen.net/packagephobia/publish/@pushrocks/smartsourcemap)](https://lossless.cloud)
BundlePhobia (total size when bundled) | [![BundlePhobia](https://badgen.net/bundlephobia/minzip/@pushrocks/smartsourcemap)](https://lossless.cloud)
Platform support | [![Supports Windows 10](https://badgen.net/badge/supports%20Windows%2010/yes/green?icon=windows)](https://lossless.cloud) [![Supports Mac OS X](https://badgen.net/badge/supports%20Mac%20OS%20X/yes/green?icon=apple)](https://lossless.cloud)
This will add it to your project's dependencies.
## Usage
## Contribution
### Getting Started
We are always happy for code contributions. If you are not the code contributing type that is ok. Still, maintaining Open Source repositories takes considerable time and thought. If you like the quality of what we do and our modules are useful to you we would appreciate a little monthly contribution: You can [contribute one time](https://lossless.link/contribute-onetime) or [contribute monthly](https://lossless.link/contribute). :)
`@push.rocks/smartsourcemap` makes it straightforward to enable source map support in your Node.js applications. This is particularly useful when working with TypeScript or other compiled languages that produce source maps. By enabling source maps, you can pinpoint the original code position that corresponds to the generated code, making debugging much easier.
Let's dive into how to integrate `@push.rocks/smartsourcemap` into your Node.js or TypeScript project.
## Contribution
### Basic Integration
We are always happy for code contributions. If you are not the code contributing type that is ok. Still, maintaining Open Source repositories takes considerable time and thought. If you like the quality of what we do and our modules are useful to you we would appreciate a little monthly contribution: You can [contribute one time](https://lossless.link/contribute-onetime) or [contribute monthly](https://lossless.link/contribute). :)
First, ensure that your project is set up with either TypeScript or another compiler that generates source maps. Here's a quick setup in your `tsconfig.json` to enable source map generation:
For further information read the linked docs at the top of this readme.
```json
{
"compilerOptions": {
"sourceMap": true
}
}
```
> MIT licensed | **©** [Lossless GmbH](https://lossless.gmbh)
| By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy)
After installing `@push.rocks/smartsourcemap`, integrate it into your application's entry file. For a Node.js project, this might be your `index.js` or the first file that runs when your application starts. For a TypeScript project, this would correspond to your `index.ts` file or its equivalent.
[![repo-footer](https://lossless.gitlab.io/publicrelations/repofooter.svg)](https://maintainedby.lossless.com)
Here's how to integrate `@push.rocks/smartsourcemap` using TypeScript (ESM syntax):
```typescript
import 'source-map-support/register';
```
Or, if you prefer to control when source map support is enabled programmatically, you can do it like this:
```typescript
import { install } from 'source-map-support';
install();
```
This snippet activates the source map support early in your application's lifecycle, ensuring that all subsequent code benefits from accurate source mapping.
### Advanced Usage
Although the above method works well for many projects, you might encounter scenarios where you need more control over source map handling. `@push.rocks/smartsourcemap` can be flexibly configured to meet these advanced use cases.
For example, you might want to enable source map support only conditionally, based on environment variables or other runtime conditions. In such cases, you can wrap the installation call in a conditional block, like so:
```typescript
import { install } from 'source-map-support';
if (process.env.NODE_ENV === 'development') {
install({
handleUncaughtExceptions: false
});
}
```
This example demonstrates enabling source map support only in development environments and configuring it not to handle uncaught exceptions, leaving that responsibility to another part of your application.
### Integrating with Testing Frameworks
When writing tests for your application, having source map support can be incredibly helpful. It allows you to receive stack traces that point to your original source files rather than the compiled output. Integrating `@push.rocks/smartsourcemap` with testing frameworks like Jest, Mocha, or Tap is straightforward.
Here's an example of enabling source map support in a test setup file when using Jest:
```typescript
// jest.setup.ts
import 'source-map-support/register';
```
And in your `jest.config.js`, reference the setup file:
```javascript
module.exports = {
setupFilesAfterEnv: ['<rootDir>/jest.setup.ts'],
};
```
### Considerations
While `@push.rocks/smartsourcemap` greatly simplifies working with source maps, remember that it operates by rewriting error stack traces. This process can introduce overhead, especially in development environments. In production, it's essential to weigh the benefits of detailed stack traces against any potential performance impacts.
### Summary
`@push.rocks/smartsourcemap` provides an essential utility for modern Node.js applications, especially those using TypeScript or other compiled-to-JavaScript languages. By enabling source map support, developers can achieve more accurate debugging, leading to increased productivity and more maintainable codebases. Whether you're building a small tool or a large-scale application, consider integrating `@push.rocks/smartsourcemap` to enhance your development and debugging experience.
## License and Legal Information
This repository contains open-source code that is licensed under the MIT License. A copy of the MIT License can be found in the [license](license) file within this repository.
**Please note:** The MIT License does not grant permission to use the trade names, trademarks, service marks, or product names of the project, except as required for reasonable and customary use in describing the origin of the work and reproducing the content of the NOTICE file.
### Trademarks
This project is owned and maintained by Task Venture Capital GmbH. The names and logos associated with Task Venture Capital GmbH and any related products or services are trademarks of Task Venture Capital GmbH and are not included within the scope of the MIT license granted herein. Use of these trademarks must comply with Task Venture Capital GmbH's Trademark Guidelines, and any usage must be approved in writing by Task Venture Capital GmbH.
### Company Information
Task Venture Capital GmbH
Registered at District court Bremen HRB 35230 HB, Germany
For any legal inquiries or if you require further information, please contact us via email at hello@task.vc.
By using this repository, you acknowledge that you have read this section, agree to comply with its terms, and understand that the licensing of the code does not imply endorsement by Task Venture Capital GmbH of any derivative works.