@volar/source-map 0.33.5 → 0.33.9

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.
Files changed (2) hide show
  1. package/out/index.js +23 -23
  2. package/package.json +2 -2
package/out/index.js CHANGED
@@ -45,13 +45,13 @@ class SourceMapBase {
45
45
  this.mappings = _mappings ?? [];
46
46
  }
47
47
  getSourceRange(start, end, filter) {
48
- for (const maped of this.getRanges(start, end ?? start, false, filter)) {
49
- return maped;
48
+ for (const mapped of this.getRanges(start, end ?? start, false, filter)) {
49
+ return mapped;
50
50
  }
51
51
  }
52
52
  getMappedRange(start, end, filter) {
53
- for (const maped of this.getRanges(start, end ?? start, true, filter)) {
54
- return maped;
53
+ for (const mapped of this.getRanges(start, end ?? start, true, filter)) {
54
+ return mapped;
55
55
  }
56
56
  }
57
57
  getSourceRanges(start, end, filter) {
@@ -64,31 +64,31 @@ class SourceMapBase {
64
64
  for (const mapping of this.mappings) {
65
65
  if (filter && !filter(mapping.data))
66
66
  continue;
67
- const maped = this.getRange(startOffset, endOffset, sourceToTarget, mapping.mode, mapping.sourceRange, mapping.mappedRange, mapping.data);
68
- if (maped) {
69
- yield getMaped(maped);
67
+ const mapped = this.getRange(startOffset, endOffset, sourceToTarget, mapping.mode, mapping.sourceRange, mapping.mappedRange, mapping.data);
68
+ if (mapped) {
69
+ yield getMapped(mapped);
70
70
  }
71
71
  else if (mapping.additional) {
72
72
  for (const other of mapping.additional) {
73
- const maped = this.getRange(startOffset, endOffset, sourceToTarget, other.mode, other.sourceRange, other.mappedRange, mapping.data);
74
- if (maped) {
75
- yield getMaped(maped);
73
+ const mapped = this.getRange(startOffset, endOffset, sourceToTarget, other.mode, other.sourceRange, other.mappedRange, mapping.data);
74
+ if (mapped) {
75
+ yield getMapped(mapped);
76
76
  break; // only return first match additional range
77
77
  }
78
78
  }
79
79
  }
80
80
  }
81
- function getMaped(maped) {
82
- return maped;
81
+ function getMapped(mapped) {
82
+ return mapped;
83
83
  }
84
84
  }
85
85
  getRange(start, end, sourceToTarget, mode, sourceRange, targetRange, data) {
86
- const mapedToRange = sourceToTarget ? targetRange : sourceRange;
87
- const mapedFromRange = sourceToTarget ? sourceRange : targetRange;
86
+ const mappedToRange = sourceToTarget ? targetRange : sourceRange;
87
+ const mappedFromRange = sourceToTarget ? sourceRange : targetRange;
88
88
  if (mode === Mode.Totally) {
89
- if (start === mapedFromRange.start && end === mapedFromRange.end) {
90
- const _start = mapedToRange.start;
91
- const _end = mapedToRange.end;
89
+ if (start === mappedFromRange.start && end === mappedFromRange.end) {
90
+ const _start = mappedToRange.start;
91
+ const _end = mappedToRange.end;
92
92
  return [{
93
93
  start: Math.min(_start, _end),
94
94
  end: Math.max(_start, _end),
@@ -96,9 +96,9 @@ class SourceMapBase {
96
96
  }
97
97
  }
98
98
  else if (mode === Mode.Offset) {
99
- if (start >= mapedFromRange.start && end <= mapedFromRange.end) {
100
- const _start = mapedToRange.start + start - mapedFromRange.start;
101
- const _end = mapedToRange.end + end - mapedFromRange.end;
99
+ if (start >= mappedFromRange.start && end <= mappedFromRange.end) {
100
+ const _start = mappedToRange.start + start - mappedFromRange.start;
101
+ const _end = mappedToRange.end + end - mappedFromRange.end;
102
102
  return [{
103
103
  start: Math.min(_start, _end),
104
104
  end: Math.max(_start, _end),
@@ -106,9 +106,9 @@ class SourceMapBase {
106
106
  }
107
107
  }
108
108
  else if (mode === Mode.Expand) {
109
- if (start >= mapedFromRange.start && end <= mapedFromRange.end) {
110
- const _start = mapedToRange.start;
111
- const _end = mapedToRange.end;
109
+ if (start >= mappedFromRange.start && end <= mappedFromRange.end) {
110
+ const _start = mappedToRange.start;
111
+ const _end = mappedToRange.end;
112
112
  return [{
113
113
  start: Math.min(_start, _end),
114
114
  end: Math.max(_start, _end),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@volar/source-map",
3
- "version": "0.33.5",
3
+ "version": "0.33.9",
4
4
  "main": "out/index.js",
5
5
  "license": "MIT",
6
6
  "files": [
@@ -12,5 +12,5 @@
12
12
  "url": "https://github.com/johnsoncodehk/volar.git",
13
13
  "directory": "packages/source-map"
14
14
  },
15
- "gitHead": "cd8eb5ebc6b2503fa0fa70fe78b6bdf82450a2e4"
15
+ "gitHead": "9031e662fe238df7ec385ddde6a91e1e363a4af4"
16
16
  }