Skip to content
This repository was archived by the owner on Jun 28, 2025. It is now read-only.

Commit cb14ea8

Browse files
committed
Upgrade gen-mapping
1 parent ee9a0b0 commit cb14ea8

File tree

4 files changed

+29
-27
lines changed

4 files changed

+29
-27
lines changed

package-lock.json

Lines changed: 13 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
"typescript": "4.6.3"
5858
},
5959
"dependencies": {
60-
"@jridgewell/gen-mapping": "^0.1.0",
60+
"@jridgewell/gen-mapping": "^0.2.0",
6161
"@jridgewell/trace-mapping": "^0.3.9"
6262
}
6363
}

src/source-map.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { decodedMap, encodedMap } from '@jridgewell/gen-mapping';
1+
import { toDecodedMap, toEncodedMap } from '@jridgewell/gen-mapping';
22

33
import type { GenMapping } from '@jridgewell/gen-mapping';
44
import type { DecodedSourceMap, EncodedSourceMap, Options } from './types';
@@ -17,7 +17,7 @@ export default class SourceMap {
1717
declare version: 3;
1818

1919
constructor(map: GenMapping, options: Options) {
20-
const out = options.decodedMappings ? decodedMap(map) : encodedMap(map);
20+
const out = options.decodedMappings ? toDecodedMap(map) : toEncodedMap(map);
2121
this.version = out.version; // SourceMap spec says this should be first.
2222
this.file = out.file;
2323
this.mappings = out.mappings as SourceMap['mappings'];

test/unit/source-map-tree.ts

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { decodedMap } from '@jridgewell/gen-mapping';
1+
import { toDecodedMap } from '@jridgewell/gen-mapping';
22
import { TraceMap } from '@jridgewell/trace-mapping';
33

44
import {
@@ -44,7 +44,7 @@ describe('MapSource', () => {
4444
};
4545

4646
const tree = MapSource(new TraceMap(map), [child]);
47-
const traced = decodedMap(traceMappings(tree));
47+
const traced = toDecodedMap(traceMappings(tree));
4848
expect(traced.mappings).toEqual([[[0, 0, 1, 1], [5]]]);
4949
});
5050

@@ -60,7 +60,7 @@ describe('MapSource', () => {
6060
};
6161

6262
const tree = MapSource(new TraceMap(map), [child]);
63-
const traced = decodedMap(traceMappings(tree));
63+
const traced = toDecodedMap(traceMappings(tree));
6464
expect(traced.mappings).toEqual([[[0, 0, 1, 1], [5]]]);
6565
});
6666

@@ -74,7 +74,7 @@ describe('MapSource', () => {
7474
};
7575

7676
const tree = MapSource(new TraceMap(map), [child]);
77-
const traced = decodedMap(traceMappings(tree));
77+
const traced = toDecodedMap(traceMappings(tree));
7878
expect(traced.mappings).toEqual([]);
7979
});
8080

@@ -91,7 +91,7 @@ describe('MapSource', () => {
9191
};
9292

9393
const tree = MapSource(new TraceMap(map), [child]);
94-
const traced = decodedMap(traceMappings(tree));
94+
const traced = toDecodedMap(traceMappings(tree));
9595
expect(traced.mappings).toEqual([[[0, 0, 0, 0, 0]]]);
9696
expect(traced).toMatchObject({
9797
names: [name],
@@ -108,7 +108,7 @@ describe('MapSource', () => {
108108
};
109109

110110
const tree = MapSource(new TraceMap(map), [child]);
111-
const traced = decodedMap(traceMappings(tree));
111+
const traced = toDecodedMap(traceMappings(tree));
112112
expect(traced.mappings).toEqual([[[0, 0, 1, 1]]]);
113113
});
114114

@@ -122,7 +122,7 @@ describe('MapSource', () => {
122122
};
123123

124124
const tree = MapSource(new TraceMap(map), [child]);
125-
const traced = decodedMap(traceMappings(tree));
125+
const traced = toDecodedMap(traceMappings(tree));
126126
expect(traced.mappings).toEqual([[[0, 0, 0, 0, 0]]]);
127127
expect(traced).toMatchObject({
128128
names: ['child'],
@@ -142,7 +142,7 @@ describe('MapSource', () => {
142142
};
143143

144144
const tree = MapSource(new TraceMap(map), [child]);
145-
const traced = decodedMap(traceMappings(tree));
145+
const traced = toDecodedMap(traceMappings(tree));
146146
expect(traced).toMatchObject(extras);
147147
});
148148

@@ -153,7 +153,7 @@ describe('MapSource', () => {
153153
};
154154

155155
const tree = MapSource(new TraceMap(map), [child]);
156-
const traced = decodedMap(traceMappings(tree));
156+
const traced = toDecodedMap(traceMappings(tree));
157157
expect(traced).toMatchObject({
158158
// TODO: support sourceRoot
159159
sourceRoot: undefined,
@@ -169,7 +169,7 @@ describe('MapSource', () => {
169169
};
170170

171171
const tree = MapSource(new TraceMap(map), [child]);
172-
const traced = decodedMap(traceMappings(tree));
172+
const traced = toDecodedMap(traceMappings(tree));
173173
expect(traced.mappings).toEqual([[[0, 0, 0, 0]]]);
174174
});
175175

@@ -181,7 +181,7 @@ describe('MapSource', () => {
181181
};
182182

183183
const tree = MapSource(new TraceMap(map), [child]);
184-
const traced = decodedMap(traceMappings(tree));
184+
const traced = toDecodedMap(traceMappings(tree));
185185
expect(traced.mappings).toEqual([]);
186186
});
187187

@@ -198,7 +198,7 @@ describe('MapSource', () => {
198198
};
199199

200200
const tree = MapSource(new TraceMap(map), [child]);
201-
const traced = decodedMap(traceMappings(tree));
201+
const traced = toDecodedMap(traceMappings(tree));
202202
expect(traced.mappings).toEqual([[[0, 0, 0, 0]]]);
203203
});
204204

@@ -209,7 +209,7 @@ describe('MapSource', () => {
209209
};
210210

211211
const tree = MapSource(new TraceMap(map), [child]);
212-
const traced = decodedMap(traceMappings(tree));
212+
const traced = toDecodedMap(traceMappings(tree));
213213
expect(traced.mappings).toEqual([[[0, 0, 0, 0]], [[0, 0, 0, 0]]]);
214214
});
215215
});

0 commit comments

Comments
 (0)