Skip to content

Commit

Permalink
Merge pull request #123 from parcel-bundler/fix-index-d-ts
Browse files Browse the repository at this point in the history
Fix: update index d ts and remove unused imports
  • Loading branch information
Nikola-3 committed Jan 18, 2024
2 parents 0cc878c + 7952860 commit b290dae
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 7 deletions.
9 changes: 8 additions & 1 deletion index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ export default class SourceMap {
static generateEmptyMap(opts: GenerateEmptyMapOptions): SourceMap;
addEmptyMap(sourceName: string, sourceContent: string, lineOffset?: number): SourceMap;
addVLQMap(map: VLQMap, lineOffset?: number, columnOffset?: number): SourceMap;
addSourceMap(sourcemap: SourceMap, lineOffset: number): SourceMap;
addBuffer(buffer: Buffer, lineOffset?: number): SourceMap;
addIndexedMapping(mapping: IndexedMapping<string>, lineOffset?: number, columnOffset?: number): void;
addIndexedMappings(mappings: Array<IndexedMapping<string>>, lineOffset?: number, columnOffset?: number): void;
Expand All @@ -80,11 +81,17 @@ export default class SourceMap {
addSources(sources: string[]): number[];
getSourceIndex(source: string): number;
getSource(index: number): string;
getSources(): string[];
setSourceContent(sourceName: string, sourceContent: string): void;
getSourceContent(sourceName: string): string;
getSourcesContent(): (string | null)[];
getSourcesContentMap(): { [key: string]: string | null };
getNameIndex(name: string): number;
getName(index: number): string;
extends(buffer: Buffer): SourceMap;
getNames(): string[];
getMappings(): IndexedMapping<number>[];
indexedMappingToStringMapping(mapping: IndexedMapping<number> | null | undefined): IndexedMapping<string> | null | undefined;
extends(buffer: Buffer | SourceMap): SourceMap;
getMap(): ParsedMap;
findClosestMapping(line: number, column: number): IndexedMapping<string> | undefined;
offsetLines(line: number, lineOffset: number): IndexedMapping<string> | undefined;
Expand Down
3 changes: 1 addition & 2 deletions src/SourceMap.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
// @flow
import type { ParsedMap, VLQMap, SourceMapStringifyOptions, IndexedMapping, GenerateEmptyMapOptions } from './types';

import path from 'path';
import { generateInlineMap, partialVlqMapToSourceMap } from './utils';
import { partialVlqMapToSourceMap } from './utils';
import { version } from '../package.json';

export default class SourceMap {
Expand Down
3 changes: 1 addition & 2 deletions src/node.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// @flow
import type { ParsedMap, VLQMap, SourceMapStringifyOptions, IndexedMapping, GenerateEmptyMapOptions } from './types';
import path from 'path';
import type { VLQMap, GenerateEmptyMapOptions } from './types';
import SourceMap from './SourceMap';

const bindings = require('../parcel_sourcemap_node/artifacts/index');
Expand Down
3 changes: 1 addition & 2 deletions src/wasm.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// @flow
import type { ParsedMap, VLQMap, SourceMapStringifyOptions, IndexedMapping, GenerateEmptyMapOptions } from './types';
import path from 'path';
import type { VLQMap, GenerateEmptyMapOptions } from './types';
import SourceMap from './SourceMap';

import * as bindings from './wasm-bindings';
Expand Down

1 comment on commit b290dae

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Parcel sourcemap benchmark

Benchmark suite Current: b290dae Previous: 0cc878c Ratio
consume#consume buffer 107047 ops/sec (±1.1e+2%) 159182 ops/sec (±27%) 1.49
consume#consume vlq mappings 76030 ops/sec (±15%) 76433 ops/sec (±17%) 1.01
consume#consume JS Mappings 74821 ops/sec (±6.8%) 73810 ops/sec (±7.1%) 0.99
serialize#Save buffer 419 ops/sec (±1.3%) 409 ops/sec (±1.1%) 0.98
serialize#Serialize to vlq 304 ops/sec (±10%) 291 ops/sec (±11%) 0.96
modify#negative column offset 221458 ops/sec (±26%) 117194 ops/sec (±14%) 0.53
modify#positive column offset 195265 ops/sec (±38%) 119708 ops/sec (±23%) 0.61
modify#negative line offset 148071 ops/sec (±16%) 107995 ops/sec (±14%) 0.73
modify#positive line offset 136587 ops/sec (±14%) 99934 ops/sec (±13%) 0.73
append#addSourceMap 312 ops/sec (±3.1%) 294 ops/sec (±6.8%) 0.94

This comment was automatically generated by workflow using github-action-benchmark.

Please sign in to comment.