Compare commits

...

10 Commits

Author SHA1 Message Date
c93c1f80ac update description 2024-05-29 14:16:22 +02:00
23bb1c70c9 update tsconfig 2024-04-14 18:21:14 +02:00
9912bbbc1c update tsconfig 2024-04-01 21:41:10 +02:00
f31dc65132 update npmextra.json: githost 2024-04-01 19:59:43 +02:00
6139b21c6e update npmextra.json: githost 2024-03-30 21:48:43 +01:00
bee90c2c9a 1.0.6 2020-09-28 13:35:40 +00:00
24ca38b3b5 1.0.5 2020-09-28 13:30:34 +00:00
e15405981c fix(core): update 2020-09-28 13:30:33 +00:00
b75025e1f8 1.0.4 2019-06-05 14:00:46 +02:00
0d98edbf46 fix(core): update 2019-06-05 14:00:46 +02:00
14 changed files with 10410 additions and 856 deletions

4
.gitignore vendored
View File

@ -15,8 +15,6 @@ node_modules/
# builds
dist/
dist_web/
dist_serve/
dist_ts_web/
dist_*/
# custom

View File

@ -1,16 +1,16 @@
# gitzone ci_default
image: hosttoday/ht-docker-node:npmci
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
cache:
paths:
- .npmci_cache/
key: "$CI_BUILD_STAGE"
- .npmci_cache/
key: '$CI_BUILD_STAGE'
stages:
- security
- test
- release
- metadata
- security
- test
- release
- metadata
# ====================
# security stage
@ -18,60 +18,74 @@ stages:
mirror:
stage: security
script:
- npmci git mirror
- npmci git mirror
only:
- tags
tags:
- docker
- notpriv
- lossless
- docker
- notpriv
snyk:
auditProductionDependencies:
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
stage: security
script:
- npmci npm prepare
- npmci command npm install -g snyk
- npmci command npm install --ignore-scripts
- npmci command snyk test
- npmci command npm install --production --ignore-scripts
- npmci command npm config set registry https://registry.npmjs.org
- npmci command npm audit --audit-level=high --only=prod --production
tags:
- docker
- notpriv
- docker
auditDevDependencies:
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
stage: security
script:
- npmci npm prepare
- npmci command npm install --ignore-scripts
- npmci command npm config set registry https://registry.npmjs.org
- npmci command npm audit --audit-level=high --only=dev
tags:
- docker
allow_failure: true
# ====================
# test stage
# ====================
testLTS:
testStable:
stage: test
script:
- npmci npm prepare
- npmci node install lts
- npmci npm install
- npmci npm test
- npmci npm prepare
- npmci node install stable
- npmci npm install
- npmci npm test
coverage: /\d+.?\d+?\%\s*coverage/
tags:
- docker
- notpriv
testSTABLE:
- docker
testBuild:
stage: test
script:
- npmci npm prepare
- npmci node install stable
- npmci npm install
- npmci npm test
- npmci npm prepare
- npmci node install stable
- npmci npm install
- npmci command npm run build
coverage: /\d+.?\d+?\%\s*coverage/
tags:
- docker
- notpriv
- docker
release:
stage: release
script:
- npmci node install stable
- npmci npm publish
- npmci node install stable
- npmci npm publish
only:
- tags
- tags
tags:
- docker
- notpriv
- lossless
- docker
- notpriv
# ====================
# metadata stage
@ -79,33 +93,39 @@ release:
codequality:
stage: metadata
allow_failure: true
only:
- tags
script:
- npmci command npm install -g tslint typescript
- npmci npm prepare
- npmci npm install
- npmci command "tslint -c tslint.json ./ts/**/*.ts"
tags:
- docker
- priv
- lossless
- docker
- priv
trigger:
stage: metadata
script:
- npmci trigger
- npmci trigger
only:
- tags
- tags
tags:
- docker
- notpriv
- lossless
- docker
- notpriv
pages:
image: hosttoday/ht-docker-node:npmci
stage: metadata
script:
- npmci node install lts
- npmci command npm install -g @gitzone/tsdoc
- npmci npm prepare
- npmci npm install
- npmci command tsdoc
tags:
- lossless
- docker
- notpriv
only:
@ -113,5 +133,5 @@ pages:
artifacts:
expire_in: 1 week
paths:
- public
- public
allow_failure: true

29
.vscode/launch.json vendored Normal file
View File

@ -0,0 +1,29 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "current file",
"type": "node",
"request": "launch",
"args": [
"${relativeFile}"
],
"runtimeArgs": ["-r", "@gitzone/tsrun"],
"cwd": "${workspaceRoot}",
"protocol": "inspector",
"internalConsoleOptions": "openOnSessionStart"
},
{
"name": "test.ts",
"type": "node",
"request": "launch",
"args": [
"test/test.ts"
],
"runtimeArgs": ["-r", "@gitzone/tsrun"],
"cwd": "${workspaceRoot}",
"protocol": "inspector",
"internalConsoleOptions": "openOnSessionStart"
}
]
}

26
.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,26 @@
{
"json.schemas": [
{
"fileMatch": ["/npmextra.json"],
"schema": {
"type": "object",
"properties": {
"npmci": {
"type": "object",
"description": "settings for npmci"
},
"gitzone": {
"type": "object",
"description": "settings for gitzone",
"properties": {
"projectType": {
"type": "string",
"enum": ["website", "element", "service", "npm", "wcc"]
}
}
}
}
}
}
]
}

View File

@ -1,17 +1,30 @@
{
"gitzone": {
"projectType": "npm",
"module": {
"githost": "gitlab.com",
"gitscope": "pushrocks",
"githost": "code.foss.global",
"gitscope": "push.rocks",
"gitrepo": "smartsourcemap",
"shortDescription": "get sourcemap support in node",
"npmPackagename": "@pushrocks/smartsourcemap",
"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"
},
"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"
}
}

10857
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,37 +1,54 @@
{
"name": "@pushrocks/smartsourcemap",
"version": "1.0.3",
"name": "@push.rocks/smartsourcemap",
"version": "1.0.6",
"private": false,
"description": "get sourcemap support in node",
"main": "dist/index.js",
"typings": "dist/index.d.ts",
"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",
"license": "MIT",
"scripts": {
"test": "(tstest test/)",
"build": "(tsbuild)",
"format": "(gitzone format)"
"test": "(tstest test/ --web)",
"build": "(tsbuild --web)"
},
"devDependencies": {
"@gitzone/tsbuild": "^2.1.11",
"@gitzone/tstest": "^1.0.24",
"@pushrocks/tapbundle": "^3.0.9",
"@types/node": "^12.0.4",
"tslint": "^5.17.0",
"@gitzone/tsbuild": "^2.1.25",
"@gitzone/tstest": "^1.0.44",
"@pushrocks/tapbundle": "^3.2.9",
"@types/node": "^14.11.2",
"tslint": "^6.1.3",
"tslint-config-prettier": "^1.18.0"
},
"dependencies": {
"@types/source-map-support": "^0.5.0",
"source-map-support": "^0.5.12"
"@types/source-map-support": "^0.5.3",
"source-map-support": "^0.5.19"
},
"files": [
"ts/*",
"ts_web/*",
"dist/*",
"dist_web/*",
"assets/*",
"ts/**/*",
"ts_web/**/*",
"dist/**/*",
"dist_*/**/*",
"dist_ts/**/*",
"dist_ts_web/**/*",
"assets/**/*",
"cli.js",
"npmextra.json",
"readme.md"
]
}
],
"browserslist": [
"last 1 chrome versions"
],
"keywords": [
"sourcemap",
"debugging",
"nodejs",
"typescript",
"source-map-support",
"development tools"
],
"homepage": "https://code.foss.global/push.rocks/smartsourcemap",
"repository": {
"type": "git",
"url": "https://code.foss.global/push.rocks/smartsourcemap.git"
}
}

1
readme.hints.md Normal file
View File

@ -0,0 +1 @@

122
readme.md
View File

@ -1,26 +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
[![build status](https://gitlab.com/pushrocks/smartsourcemap/badges/master/build.svg)](https://gitlab.com/pushrocks/smartsourcemap/commits/master)
[![coverage report](https://gitlab.com/pushrocks/smartsourcemap/badges/master/coverage.svg)](https://gitlab.com/pushrocks/smartsourcemap/commits/master)
[![npm downloads per month](https://img.shields.io/npm/dm/@pushrocks/smartsourcemap.svg)](https://www.npmjs.com/package/@pushrocks/smartsourcemap)
[![Known Vulnerabilities](https://snyk.io/test/npm/@pushrocks/smartsourcemap/badge.svg)](https://snyk.io/test/npm/@pushrocks/smartsourcemap)
[![TypeScript](https://img.shields.io/badge/TypeScript->=%203.x-blue.svg)](https://nodejs.org/dist/latest-v10.x/docs/api/)
[![node](https://img.shields.io/badge/node->=%2010.x.x-blue.svg)](https://nodejs.org/dist/latest-v10.x/docs/api/)
[![JavaScript Style Guide](https://img.shields.io/badge/code%20style-prettier-ff69b4.svg)](https://prettier.io/)
```bash
npm install @push.rocks/smartsourcemap --save
```
This will add it to your project's dependencies.
## Usage
For further information read the linked docs at the top of this readme.
### Getting Started
> MIT licensed | **©** [Lossless GmbH](https://lossless.gmbh)
| By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy.html)
`@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.
[![repo-footer](https://pushrocks.gitlab.io/assets/repo-footer.svg)](https://maintainedby.lossless.com)
Let's dive into how to integrate `@push.rocks/smartsourcemap` into your Node.js or TypeScript project.
### Basic Integration
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:
```json
{
"compilerOptions": {
"sourceMap": true
}
}
```
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.
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.

View File

@ -2,7 +2,6 @@ import { expect, tap } from '@pushrocks/tapbundle';
delete process.env.CLI_CALL_TSRUN;
import '../ts/index';
tap.test('first test', async () => {
console.log('should create a sourcemap');
});

View File

@ -2,4 +2,5 @@ import * as plugins from './smartsourcemap.plugins';
if (!process.env.CLI_CALL_TSRUN) {
plugins.sourceMapSupport.install();
console.log('sourcemap support enabled by smartsourcemap!');
}

View File

@ -1,5 +1,3 @@
import sourceMapSupport from 'source-map-support';
export {
sourceMapSupport
};
export { sourceMapSupport };

14
tsconfig.json Normal file
View File

@ -0,0 +1,14 @@
{
"compilerOptions": {
"experimentalDecorators": true,
"useDefineForClassFields": false,
"target": "ES2022",
"module": "NodeNext",
"moduleResolution": "NodeNext",
"esModuleInterop": true,
"verbatimModuleSyntax": true
},
"exclude": [
"dist_*/**/*.d.ts"
]
}

View File

@ -1,17 +0,0 @@
{
"extends": ["tslint:latest", "tslint-config-prettier"],
"rules": {
"semicolon": [true, "always"],
"no-console": false,
"ordered-imports": false,
"object-literal-sort-keys": false,
"member-ordering": {
"options":{
"order": [
"static-method"
]
}
}
},
"defaultSeverity": "warning"
}