Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@jridgewell/gen-mapping

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@jridgewell/gen-mapping - npm Package Compare versions

Comparing version 0.1.0 to 0.1.1

23

dist/gen-mapping.umd.js

@@ -7,7 +7,30 @@ (function (global, factory) {

/**
* A low-level API to associate a generated position with an original source position. Line and
* column here are 0-based, unlike `addMapping`.
*/
exports.addSegment = void 0;
/**
* A high-level API to associate a generated position with an original source position. Line is
* 1-based, but column is 0-based, due to legacy behavior in `source-map` library.
*/
exports.addMapping = void 0;
/**
* Adds/removes the content of the source file to the source map.
*/
exports.setSourceContent = void 0;
/**
* Returns a sourcemap object (with decoded mappings) suitable for passing to a library that expects
* a sourcemap, or to JSON.stringify.
*/
exports.decodedMap = void 0;
/**
* Returns a sourcemap object (with encoded mappings) suitable for passing to a library that expects
* a sourcemap, or to JSON.stringify.
*/
exports.encodedMap = void 0;
/**
* Returns an array of high-level mapping objects for every recorded segment, which could then be
* passed to the `source-map` library.
*/
exports.allMappings = void 0;

@@ -14,0 +37,0 @@ /**

@@ -7,2 +7,6 @@ import type { DecodedSourceMap, EncodedSourceMap, Pos, Mapping } from './types';

};
/**
* A low-level API to associate a generated position with an original source position. Line and
* column here are 0-based, unlike `addMapping`.
*/
export declare let addSegment: {

@@ -13,2 +17,6 @@ (map: GenMapping, genLine: number, genColumn: number, source?: null, sourceLine?: null, sourceColumn?: null, name?: null): void;

};
/**
* A high-level API to associate a generated position with an original source position. Line is
* 1-based, but column is 0-based, due to legacy behavior in `source-map` library.
*/
export declare let addMapping: {

@@ -34,5 +42,20 @@ (map: GenMapping, mapping: {

};
/**
* Adds/removes the content of the source file to the source map.
*/
export declare let setSourceContent: (map: GenMapping, source: string, content: string | null) => void;
/**
* Returns a sourcemap object (with decoded mappings) suitable for passing to a library that expects
* a sourcemap, or to JSON.stringify.
*/
export declare let decodedMap: (map: GenMapping) => DecodedSourceMap;
/**
* Returns a sourcemap object (with encoded mappings) suitable for passing to a library that expects
* a sourcemap, or to JSON.stringify.
*/
export declare let encodedMap: (map: GenMapping) => EncodedSourceMap;
/**
* Returns an array of high-level mapping objects for every recorded segment, which could then be
* passed to the `source-map` library.
*/
export declare let allMappings: (map: GenMapping) => Mapping[];

@@ -39,0 +62,0 @@ /**

30

package.json
{
"name": "@jridgewell/gen-mapping",
"version": "0.1.0",
"version": "0.1.1",
"description": "Generate source maps",

@@ -30,2 +30,5 @@ "keywords": [

"scripts": {
"benchmark": "run-s build:rollup benchmark:*",
"benchmark:install": "cd benchmark && npm install",
"benchmark:only": "node benchmark/index.mjs",
"prebuild": "rm -rf dist",

@@ -51,20 +54,21 @@ "build": "run-s -n build:*",

"devDependencies": {
"@rollup/plugin-typescript": "8.3.0",
"@rollup/plugin-typescript": "8.3.2",
"@types/mocha": "9.1.1",
"@types/node": "17.0.28",
"@typescript-eslint/eslint-plugin": "5.10.0",
"@typescript-eslint/parser": "5.10.0",
"c8": "7.11.0",
"eslint": "8.7.0",
"eslint-config-prettier": "8.3.0",
"mocha": "9.2.0",
"@types/node": "17.0.29",
"@typescript-eslint/eslint-plugin": "5.21.0",
"@typescript-eslint/parser": "5.21.0",
"benchmark": "2.1.4",
"c8": "7.11.2",
"eslint": "8.14.0",
"eslint-config-prettier": "8.5.0",
"mocha": "9.2.2",
"npm-run-all": "4.1.5",
"prettier": "2.5.1",
"rollup": "2.66.0",
"typescript": "4.5.5"
"prettier": "2.6.2",
"rollup": "2.70.2",
"typescript": "4.6.3"
},
"dependencies": {
"@jridgewell/set-array": "1.0.0",
"@jridgewell/set-array": "^1.0.0",
"@jridgewell/sourcemap-codec": "^1.4.10"
}
}

@@ -55,3 +55,75 @@ # @jridgewell/gen-mapping

## Benchmarks
```
node v18.0.0
amp.js.map
gen-mapping: addSegment x 462 ops/sec ±1.53% (91 runs sampled)
gen-mapping: addMapping x 471 ops/sec ±0.77% (93 runs sampled)
source-map-js: addMapping x 178 ops/sec ±1.14% (84 runs sampled)
source-map-0.6.1: addMapping x 178 ops/sec ±1.21% (84 runs sampled)
source-map-0.8.0: addMapping x 177 ops/sec ±1.21% (83 runs sampled)
Fastest is gen-mapping: addMapping,gen-mapping: addSegment
gen-mapping: decoded output x 157,499,812 ops/sec ±0.25% (100 runs sampled)
gen-mapping: encoded output x 625 ops/sec ±1.95% (88 runs sampled)
source-map-js: encoded output x 162 ops/sec ±0.37% (84 runs sampled)
source-map-0.6.1: encoded output x 161 ops/sec ±0.51% (84 runs sampled)
source-map-0.8.0: encoded output x 191 ops/sec ±0.12% (90 runs sampled)
Fastest is gen-mapping: decoded output
***
babel.min.js.map
gen-mapping: addSegment x 35.38 ops/sec ±4.48% (48 runs sampled)
gen-mapping: addMapping x 29.93 ops/sec ±5.03% (55 runs sampled)
source-map-js: addMapping x 22.19 ops/sec ±3.39% (41 runs sampled)
source-map-0.6.1: addMapping x 22.57 ops/sec ±2.90% (41 runs sampled)
source-map-0.8.0: addMapping x 22.73 ops/sec ±2.84% (41 runs sampled)
Fastest is gen-mapping: addSegment
gen-mapping: decoded output x 157,767,591 ops/sec ±0.10% (99 runs sampled)
gen-mapping: encoded output x 97.06 ops/sec ±1.69% (73 runs sampled)
source-map-js: encoded output x 17.51 ops/sec ±2.27% (37 runs sampled)
source-map-0.6.1: encoded output x 17.40 ops/sec ±4.61% (35 runs sampled)
source-map-0.8.0: encoded output x 17.83 ops/sec ±4.85% (36 runs sampled)
Fastest is gen-mapping: decoded output
***
preact.js.map
gen-mapping: addSegment x 13,516 ops/sec ±0.27% (98 runs sampled)
gen-mapping: addMapping x 12,117 ops/sec ±0.25% (97 runs sampled)
source-map-js: addMapping x 4,285 ops/sec ±1.53% (98 runs sampled)
source-map-0.6.1: addMapping x 4,482 ops/sec ±0.20% (100 runs sampled)
source-map-0.8.0: addMapping x 4,482 ops/sec ±0.28% (99 runs sampled)
Fastest is gen-mapping: addSegment
gen-mapping: decoded output x 157,769,691 ops/sec ±0.06% (92 runs sampled)
gen-mapping: encoded output x 18,610 ops/sec ±1.03% (93 runs sampled)
source-map-js: encoded output x 5,397 ops/sec ±0.38% (97 runs sampled)
source-map-0.6.1: encoded output x 5,422 ops/sec ±0.16% (100 runs sampled)
source-map-0.8.0: encoded output x 5,595 ops/sec ±0.11% (100 runs sampled)
Fastest is gen-mapping: decoded output
***
react.js.map
gen-mapping: addSegment x 5,058 ops/sec ±0.27% (100 runs sampled)
gen-mapping: addMapping x 4,352 ops/sec ±0.13% (97 runs sampled)
source-map-js: addMapping x 1,569 ops/sec ±0.19% (99 runs sampled)
source-map-0.6.1: addMapping x 1,550 ops/sec ±0.31% (97 runs sampled)
source-map-0.8.0: addMapping x 1,560 ops/sec ±0.18% (99 runs sampled)
Fastest is gen-mapping: addSegment
gen-mapping: decoded output x 157,479,701 ops/sec ±0.14% (99 runs sampled)
gen-mapping: encoded output x 6,392 ops/sec ±1.03% (94 runs sampled)
source-map-js: encoded output x 2,213 ops/sec ±0.36% (99 runs sampled)
source-map-0.6.1: encoded output x 2,238 ops/sec ±0.23% (100 runs sampled)
source-map-0.8.0: encoded output x 2,304 ops/sec ±0.20% (100 runs sampled)
Fastest is gen-mapping: decoded output
```
[source-map]: https://www.npmjs.com/package/source-map
[trace-mapping]: https://github.com/jridgewell/trace-mapping

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc