@jridgewell/gen-mapping
Advanced tools
Comparing version 0.3.0 to 0.3.1
@@ -75,7 +75,7 @@ (function (global, factory) { | ||
(() => { | ||
exports.addSegment = (map, genLine, genColumn, source, sourceLine, sourceColumn, name) => { | ||
return addSegmentInternal(false, map, genLine, genColumn, source, sourceLine, sourceColumn, name); | ||
exports.addSegment = (map, genLine, genColumn, source, sourceLine, sourceColumn, name, content) => { | ||
return addSegmentInternal(false, map, genLine, genColumn, source, sourceLine, sourceColumn, name, content); | ||
}; | ||
exports.maybeAddSegment = (map, genLine, genColumn, source, sourceLine, sourceColumn, name) => { | ||
return addSegmentInternal(true, map, genLine, genColumn, source, sourceLine, sourceColumn, name); | ||
exports.maybeAddSegment = (map, genLine, genColumn, source, sourceLine, sourceColumn, name, content) => { | ||
return addSegmentInternal(true, map, genLine, genColumn, source, sourceLine, sourceColumn, name, content); | ||
}; | ||
@@ -141,3 +141,3 @@ exports.addMapping = (map, mapping) => { | ||
// Internal helpers | ||
addSegmentInternal = (skipable, map, genLine, genColumn, source, sourceLine, sourceColumn, name) => { | ||
addSegmentInternal = (skipable, map, genLine, genColumn, source, sourceLine, sourceColumn, name, content) => { | ||
const { _mappings: mappings, _sources: sources, _sourcesContent: sourcesContent, _names: names, } = map; | ||
@@ -154,3 +154,3 @@ const line = getLine(mappings, genLine); | ||
if (sourcesIndex === sourcesContent.length) | ||
sourcesContent[sourcesIndex] = null; | ||
sourcesContent[sourcesIndex] = content !== null && content !== void 0 ? content : null; | ||
if (skipable && skipSource(line, index, sourcesIndex, sourceLine, sourceColumn, namesIndex)) { | ||
@@ -226,8 +226,8 @@ return; | ||
function addMappingInternal(skipable, map, mapping) { | ||
const { generated, source, original, name } = mapping; | ||
const { generated, source, original, name, content } = mapping; | ||
if (!source) { | ||
return addSegmentInternal(skipable, map, generated.line - 1, generated.column, null, null, null, null); | ||
return addSegmentInternal(skipable, map, generated.line - 1, generated.column, null, null, null, null, null); | ||
} | ||
const s = source; | ||
return addSegmentInternal(skipable, map, generated.line - 1, generated.column, s, original.line - 1, original.column, name); | ||
return addSegmentInternal(skipable, map, generated.line - 1, generated.column, s, original.line - 1, original.column, name, content); | ||
} | ||
@@ -234,0 +234,0 @@ |
@@ -13,5 +13,5 @@ import type { SourceMapInput } from '@jridgewell/trace-mapping'; | ||
export declare let addSegment: { | ||
(map: GenMapping, genLine: number, genColumn: number, source?: null, sourceLine?: null, sourceColumn?: null, name?: null): void; | ||
(map: GenMapping, genLine: number, genColumn: number, source: string, sourceLine: number, sourceColumn: number, name?: null): void; | ||
(map: GenMapping, genLine: number, genColumn: number, source: string, sourceLine: number, sourceColumn: number, name: string): void; | ||
(map: GenMapping, genLine: number, genColumn: number, source?: null, sourceLine?: null, sourceColumn?: null, name?: null, content?: null): void; | ||
(map: GenMapping, genLine: number, genColumn: number, source: string, sourceLine: number, sourceColumn: number, name?: null, content?: string | null): void; | ||
(map: GenMapping, genLine: number, genColumn: number, source: string, sourceLine: number, sourceColumn: number, name: string, content?: string | null): void; | ||
}; | ||
@@ -28,2 +28,3 @@ /** | ||
name?: null; | ||
content?: null; | ||
}): void; | ||
@@ -35,2 +36,3 @@ (map: GenMapping, mapping: { | ||
name?: null; | ||
content?: string | null; | ||
}): void; | ||
@@ -42,2 +44,3 @@ (map: GenMapping, mapping: { | ||
name: string; | ||
content?: string | null; | ||
}): void; | ||
@@ -44,0 +47,0 @@ }; |
{ | ||
"name": "@jridgewell/gen-mapping", | ||
"version": "0.3.0", | ||
"version": "0.3.1", | ||
"description": "Generate source maps", | ||
@@ -17,2 +17,3 @@ "keywords": [ | ||
".": { | ||
"types": "./dist/types/gen-mapping.d.ts", | ||
"browser": "./dist/gen-mapping.umd.js", | ||
@@ -19,0 +20,0 @@ "require": "./dist/gen-mapping.umd.js", |
126
README.md
@@ -114,65 +114,111 @@ # @jridgewell/gen-mapping | ||
amp.js.map | ||
gen-mapping: addSegment x 450 ops/sec ±1.16% (87 runs sampled) | ||
gen-mapping: addMapping x 430 ops/sec ±0.90% (90 runs sampled) | ||
source-map-js: addMapping x 178 ops/sec ±1.06% (84 runs sampled) | ||
source-map-0.6.1: addMapping x 177 ops/sec ±1.07% (84 runs sampled) | ||
source-map-0.8.0: addMapping x 178 ops/sec ±0.98% (84 runs sampled) | ||
Memory Usage: | ||
gen-mapping: addSegment 5852872 bytes | ||
gen-mapping: addMapping 7716042 bytes | ||
source-map-js 6143250 bytes | ||
source-map-0.6.1 6124102 bytes | ||
source-map-0.8.0 6121173 bytes | ||
Smallest memory usage is gen-mapping: addSegment | ||
Adding speed: | ||
gen-mapping: addSegment x 441 ops/sec ±2.07% (90 runs sampled) | ||
gen-mapping: addMapping x 350 ops/sec ±2.40% (86 runs sampled) | ||
source-map-js: addMapping x 169 ops/sec ±2.42% (80 runs sampled) | ||
source-map-0.6.1: addMapping x 167 ops/sec ±2.56% (80 runs sampled) | ||
source-map-0.8.0: addMapping x 168 ops/sec ±2.52% (80 runs sampled) | ||
Fastest is gen-mapping: addSegment | ||
gen-mapping: decoded output x 157,549,649 ops/sec ±0.14% (97 runs sampled) | ||
gen-mapping: encoded output x 669 ops/sec ±1.34% (95 runs sampled) | ||
source-map-js: encoded output x 160 ops/sec ±0.64% (83 runs sampled) | ||
source-map-0.6.1: encoded output x 161 ops/sec ±0.47% (84 runs sampled) | ||
source-map-0.8.0: encoded output x 190 ops/sec ±0.28% (90 runs sampled) | ||
Generate speed: | ||
gen-mapping: decoded output x 150,824,370 ops/sec ±0.07% (102 runs sampled) | ||
gen-mapping: encoded output x 663 ops/sec ±0.22% (98 runs sampled) | ||
source-map-js: encoded output x 197 ops/sec ±0.45% (84 runs sampled) | ||
source-map-0.6.1: encoded output x 198 ops/sec ±0.33% (85 runs sampled) | ||
source-map-0.8.0: encoded output x 197 ops/sec ±0.06% (93 runs sampled) | ||
Fastest is gen-mapping: decoded output | ||
*** | ||
babel.min.js.map | ||
gen-mapping: addSegment x 51.09 ops/sec ±4.58% (56 runs sampled) | ||
gen-mapping: addMapping x 39.38 ops/sec ±4.40% (54 runs sampled) | ||
source-map-js: addMapping x 21.65 ops/sec ±3.34% (40 runs sampled) | ||
source-map-0.6.1: addMapping x 21.90 ops/sec ±3.59% (41 runs sampled) | ||
source-map-0.8.0: addMapping x 21.89 ops/sec ±3.10% (41 runs sampled) | ||
Memory Usage: | ||
gen-mapping: addSegment 37578063 bytes | ||
gen-mapping: addMapping 37212897 bytes | ||
source-map-js 47638527 bytes | ||
source-map-0.6.1 47690503 bytes | ||
source-map-0.8.0 47470188 bytes | ||
Smallest memory usage is gen-mapping: addMapping | ||
Adding speed: | ||
gen-mapping: addSegment x 31.05 ops/sec ±8.31% (43 runs sampled) | ||
gen-mapping: addMapping x 29.83 ops/sec ±7.36% (51 runs sampled) | ||
source-map-js: addMapping x 20.73 ops/sec ±6.22% (38 runs sampled) | ||
source-map-0.6.1: addMapping x 20.03 ops/sec ±10.51% (38 runs sampled) | ||
source-map-0.8.0: addMapping x 19.30 ops/sec ±8.27% (37 runs sampled) | ||
Fastest is gen-mapping: addSegment | ||
gen-mapping: decoded output x 154,505,123 ops/sec ±0.45% (100 runs sampled) | ||
gen-mapping: encoded output x 84.17 ops/sec ±5.44% (66 runs sampled) | ||
source-map-js: encoded output x 17.57 ops/sec ±4.55% (33 runs sampled) | ||
source-map-0.6.1: encoded output x 16.43 ops/sec ±7.03% (34 runs sampled) | ||
source-map-0.8.0: encoded output x 16.60 ops/sec ±6.44% (32 runs sampled) | ||
Generate speed: | ||
gen-mapping: decoded output x 381,379,234 ops/sec ±0.29% (96 runs sampled) | ||
gen-mapping: encoded output x 95.15 ops/sec ±2.98% (72 runs sampled) | ||
source-map-js: encoded output x 15.20 ops/sec ±7.41% (33 runs sampled) | ||
source-map-0.6.1: encoded output x 16.36 ops/sec ±10.46% (31 runs sampled) | ||
source-map-0.8.0: encoded output x 16.06 ops/sec ±6.45% (31 runs sampled) | ||
Fastest is gen-mapping: decoded output | ||
*** | ||
preact.js.map | ||
gen-mapping: addSegment x 11,643 ops/sec ±3.36% (91 runs sampled) | ||
gen-mapping: addMapping x 10,921 ops/sec ±0.63% (87 runs sampled) | ||
source-map-js: addMapping x 4,534 ops/sec ±0.25% (98 runs sampled) | ||
source-map-0.6.1: addMapping x 4,572 ops/sec ±0.18% (99 runs sampled) | ||
source-map-0.8.0: addMapping x 4,519 ops/sec ±0.27% (99 runs sampled) | ||
Memory Usage: | ||
gen-mapping: addSegment 416247 bytes | ||
gen-mapping: addMapping 419824 bytes | ||
source-map-js 1024619 bytes | ||
source-map-0.6.1 1146004 bytes | ||
source-map-0.8.0 1113250 bytes | ||
Smallest memory usage is gen-mapping: addSegment | ||
Adding speed: | ||
gen-mapping: addSegment x 13,755 ops/sec ±0.15% (98 runs sampled) | ||
gen-mapping: addMapping x 13,013 ops/sec ±0.11% (101 runs sampled) | ||
source-map-js: addMapping x 4,564 ops/sec ±0.21% (98 runs sampled) | ||
source-map-0.6.1: addMapping x 4,562 ops/sec ±0.11% (99 runs sampled) | ||
source-map-0.8.0: addMapping x 4,593 ops/sec ±0.11% (100 runs sampled) | ||
Fastest is gen-mapping: addSegment | ||
gen-mapping: decoded output x 157,554,436 ops/sec ±0.09% (98 runs sampled) | ||
gen-mapping: encoded output x 17,673 ops/sec ±1.11% (87 runs sampled) | ||
source-map-js: encoded output x 5,526 ops/sec ±0.63% (93 runs sampled) | ||
source-map-0.6.1: encoded output x 5,679 ops/sec ±0.21% (98 runs sampled) | ||
source-map-0.8.0: encoded output x 5,911 ops/sec ±0.14% (101 runs sampled) | ||
Generate speed: | ||
gen-mapping: decoded output x 379,864,020 ops/sec ±0.23% (93 runs sampled) | ||
gen-mapping: encoded output x 14,368 ops/sec ±4.07% (82 runs sampled) | ||
source-map-js: encoded output x 5,261 ops/sec ±0.21% (99 runs sampled) | ||
source-map-0.6.1: encoded output x 5,124 ops/sec ±0.58% (99 runs sampled) | ||
source-map-0.8.0: encoded output x 5,434 ops/sec ±0.33% (96 runs sampled) | ||
Fastest is gen-mapping: decoded output | ||
*** | ||
react.js.map | ||
gen-mapping: addSegment x 4,168 ops/sec ±1.08% (81 runs sampled) | ||
gen-mapping: addMapping x 3,842 ops/sec ±1.27% (84 runs sampled) | ||
source-map-js: addMapping x 1,510 ops/sec ±1.63% (95 runs sampled) | ||
source-map-0.6.1: addMapping x 1,537 ops/sec ±0.34% (97 runs sampled) | ||
source-map-0.8.0: addMapping x 1,546 ops/sec ±0.29% (98 runs sampled) | ||
Memory Usage: | ||
gen-mapping: addSegment 975096 bytes | ||
gen-mapping: addMapping 1102981 bytes | ||
source-map-js 2918836 bytes | ||
source-map-0.6.1 2885435 bytes | ||
source-map-0.8.0 2874336 bytes | ||
Smallest memory usage is gen-mapping: addSegment | ||
Adding speed: | ||
gen-mapping: addSegment x 4,772 ops/sec ±0.15% (100 runs sampled) | ||
gen-mapping: addMapping x 4,456 ops/sec ±0.13% (97 runs sampled) | ||
source-map-js: addMapping x 1,618 ops/sec ±0.24% (97 runs sampled) | ||
source-map-0.6.1: addMapping x 1,622 ops/sec ±0.12% (99 runs sampled) | ||
source-map-0.8.0: addMapping x 1,631 ops/sec ±0.12% (100 runs sampled) | ||
Fastest is gen-mapping: addSegment | ||
gen-mapping: decoded output x 157,136,960 ops/sec ±0.13% (92 runs sampled) | ||
gen-mapping: encoded output x 6,494 ops/sec ±0.56% (96 runs sampled) | ||
source-map-js: encoded output x 2,206 ops/sec ±0.25% (100 runs sampled) | ||
source-map-0.6.1: encoded output x 2,188 ops/sec ±0.51% (99 runs sampled) | ||
source-map-0.8.0: encoded output x 2,254 ops/sec ±0.27% (100 runs sampled) | ||
Generate speed: | ||
gen-mapping: decoded output x 379,107,695 ops/sec ±0.07% (99 runs sampled) | ||
gen-mapping: encoded output x 5,421 ops/sec ±1.60% (89 runs sampled) | ||
source-map-js: encoded output x 2,113 ops/sec ±1.81% (98 runs sampled) | ||
source-map-0.6.1: encoded output x 2,126 ops/sec ±0.10% (100 runs sampled) | ||
source-map-0.8.0: encoded output x 2,176 ops/sec ±0.39% (98 runs sampled) | ||
Fastest is gen-mapping: decoded output | ||
@@ -179,0 +225,0 @@ ``` |
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
79144
595
228