@volar/source-map 1.5.4 → 1.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/out/index.d.ts +6 -1
- package/out/index.js +25 -2
- package/package.json +3 -3
package/out/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Segment } from 'muggle-string';
|
|
1
|
+
import { Segment, StackNode } from 'muggle-string';
|
|
2
2
|
export * from 'muggle-string';
|
|
3
3
|
export interface Mapping<T = any> {
|
|
4
4
|
source?: string;
|
|
@@ -6,6 +6,10 @@ export interface Mapping<T = any> {
|
|
|
6
6
|
generatedRange: [number, number];
|
|
7
7
|
data: T;
|
|
8
8
|
}
|
|
9
|
+
export interface Stack {
|
|
10
|
+
source: string;
|
|
11
|
+
range: [number, number];
|
|
12
|
+
}
|
|
9
13
|
export declare class SourceMap<Data = any> {
|
|
10
14
|
readonly mappings: Mapping<Data>[];
|
|
11
15
|
private _memo;
|
|
@@ -20,3 +24,4 @@ export declare class SourceMap<Data = any> {
|
|
|
20
24
|
private binarySearchMemo;
|
|
21
25
|
}
|
|
22
26
|
export declare function buildMappings<T>(chunks: Segment<T>[]): Mapping<T>[];
|
|
27
|
+
export declare function buildStacks<T>(chunks: Segment<T>[], stacks: StackNode[]): Stack[];
|
package/out/index.js
CHANGED
|
@@ -14,9 +14,8 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.buildMappings = exports.SourceMap = void 0;
|
|
17
|
+
exports.buildStacks = exports.buildMappings = exports.SourceMap = void 0;
|
|
18
18
|
__exportStar(require("muggle-string"), exports);
|
|
19
|
-
;
|
|
20
19
|
class SourceMap {
|
|
21
20
|
get memo() {
|
|
22
21
|
if (!this._memo) {
|
|
@@ -156,4 +155,28 @@ function buildMappings(chunks) {
|
|
|
156
155
|
return mappings;
|
|
157
156
|
}
|
|
158
157
|
exports.buildMappings = buildMappings;
|
|
158
|
+
function buildStacks(chunks, stacks) {
|
|
159
|
+
let offset = 0;
|
|
160
|
+
let index = 0;
|
|
161
|
+
const result = [];
|
|
162
|
+
for (const stack of stacks) {
|
|
163
|
+
const start = offset;
|
|
164
|
+
for (let i = 0; i < stack.length; i++) {
|
|
165
|
+
const segment = chunks[index + i];
|
|
166
|
+
if (typeof segment === 'string') {
|
|
167
|
+
offset += segment.length;
|
|
168
|
+
}
|
|
169
|
+
else {
|
|
170
|
+
offset += segment[0].length;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
index += stack.length;
|
|
174
|
+
result.push({
|
|
175
|
+
range: [start, offset],
|
|
176
|
+
source: stack.stack,
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
return result;
|
|
180
|
+
}
|
|
181
|
+
exports.buildStacks = buildStacks;
|
|
159
182
|
//# sourceMappingURL=index.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@volar/source-map",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.1",
|
|
4
4
|
"main": "out/index.js",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"files": [
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"directory": "packages/source-map"
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"muggle-string": "^0.
|
|
16
|
+
"muggle-string": "^0.3.1"
|
|
17
17
|
},
|
|
18
|
-
"gitHead": "
|
|
18
|
+
"gitHead": "1e1e99f43ff39db5432a33c8013eda706e765001"
|
|
19
19
|
}
|