@glimt/record 0.0.10 → 0.0.12
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/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/record.cjs +128 -72
- package/dist/record.cjs.map +1 -1
- package/dist/record.js +128 -72
- package/dist/record.js.map +1 -1
- package/dist/record.umd.cjs +128 -72
- package/dist/record.umd.cjs.map +3 -3
- package/dist/record.umd.min.cjs +27 -27
- package/dist/record.umd.min.cjs.map +4 -4
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/record.cjs
CHANGED
|
@@ -2074,7 +2074,7 @@ let Node$4$1 = class Node2 {
|
|
|
2074
2074
|
let index2 = this.parent.index(this);
|
|
2075
2075
|
return this.parent.nodes[index2 + 1];
|
|
2076
2076
|
}
|
|
2077
|
-
positionBy(opts) {
|
|
2077
|
+
positionBy(opts = {}) {
|
|
2078
2078
|
let pos = this.source.start;
|
|
2079
2079
|
if (opts.index) {
|
|
2080
2080
|
pos = this.positionInside(opts.index);
|
|
@@ -2103,27 +2103,38 @@ let Node$4$1 = class Node2 {
|
|
|
2103
2103
|
column += 1;
|
|
2104
2104
|
}
|
|
2105
2105
|
}
|
|
2106
|
-
return { column, line };
|
|
2106
|
+
return { column, line, offset: end };
|
|
2107
2107
|
}
|
|
2108
2108
|
prev() {
|
|
2109
2109
|
if (!this.parent) return void 0;
|
|
2110
2110
|
let index2 = this.parent.index(this);
|
|
2111
2111
|
return this.parent.nodes[index2 - 1];
|
|
2112
2112
|
}
|
|
2113
|
-
rangeBy(opts) {
|
|
2113
|
+
rangeBy(opts = {}) {
|
|
2114
|
+
let inputString = "document" in this.source.input ? this.source.input.document : this.source.input.css;
|
|
2114
2115
|
let start = {
|
|
2115
2116
|
column: this.source.start.column,
|
|
2116
|
-
line: this.source.start.line
|
|
2117
|
+
line: this.source.start.line,
|
|
2118
|
+
offset: sourceOffset$1(inputString, this.source.start)
|
|
2117
2119
|
};
|
|
2118
2120
|
let end = this.source.end ? {
|
|
2119
2121
|
column: this.source.end.column + 1,
|
|
2120
|
-
line: this.source.end.line
|
|
2122
|
+
line: this.source.end.line,
|
|
2123
|
+
offset: typeof this.source.end.offset === "number" ? (
|
|
2124
|
+
// `source.end.offset` is exclusive, so we don't need to add 1
|
|
2125
|
+
this.source.end.offset
|
|
2126
|
+
) : (
|
|
2127
|
+
// Since line/column in this.source.end is inclusive,
|
|
2128
|
+
// the `sourceOffset(... , this.source.end)` returns an inclusive offset.
|
|
2129
|
+
// So, we add 1 to convert it to exclusive.
|
|
2130
|
+
sourceOffset$1(inputString, this.source.end) + 1
|
|
2131
|
+
)
|
|
2121
2132
|
} : {
|
|
2122
2133
|
column: start.column + 1,
|
|
2123
|
-
line: start.line
|
|
2134
|
+
line: start.line,
|
|
2135
|
+
offset: start.offset + 1
|
|
2124
2136
|
};
|
|
2125
2137
|
if (opts.word) {
|
|
2126
|
-
let inputString = "document" in this.source.input ? this.source.input.document : this.source.input.css;
|
|
2127
2138
|
let stringRepresentation = inputString.slice(
|
|
2128
2139
|
sourceOffset$1(inputString, this.source.start),
|
|
2129
2140
|
sourceOffset$1(inputString, this.source.end)
|
|
@@ -2131,15 +2142,14 @@ let Node$4$1 = class Node2 {
|
|
|
2131
2142
|
let index2 = stringRepresentation.indexOf(opts.word);
|
|
2132
2143
|
if (index2 !== -1) {
|
|
2133
2144
|
start = this.positionInside(index2);
|
|
2134
|
-
end = this.positionInside(
|
|
2135
|
-
index2 + opts.word.length
|
|
2136
|
-
);
|
|
2145
|
+
end = this.positionInside(index2 + opts.word.length);
|
|
2137
2146
|
}
|
|
2138
2147
|
} else {
|
|
2139
2148
|
if (opts.start) {
|
|
2140
2149
|
start = {
|
|
2141
2150
|
column: opts.start.column,
|
|
2142
|
-
line: opts.start.line
|
|
2151
|
+
line: opts.start.line,
|
|
2152
|
+
offset: sourceOffset$1(inputString, opts.start)
|
|
2143
2153
|
};
|
|
2144
2154
|
} else if (opts.index) {
|
|
2145
2155
|
start = this.positionInside(opts.index);
|
|
@@ -2147,7 +2157,8 @@ let Node$4$1 = class Node2 {
|
|
|
2147
2157
|
if (opts.end) {
|
|
2148
2158
|
end = {
|
|
2149
2159
|
column: opts.end.column,
|
|
2150
|
-
line: opts.end.line
|
|
2160
|
+
line: opts.end.line,
|
|
2161
|
+
offset: sourceOffset$1(inputString, opts.end)
|
|
2151
2162
|
};
|
|
2152
2163
|
} else if (typeof opts.endIndex === "number") {
|
|
2153
2164
|
end = this.positionInside(opts.endIndex);
|
|
@@ -2156,7 +2167,11 @@ let Node$4$1 = class Node2 {
|
|
|
2156
2167
|
}
|
|
2157
2168
|
}
|
|
2158
2169
|
if (end.line < start.line || end.line === start.line && end.column <= start.column) {
|
|
2159
|
-
end = {
|
|
2170
|
+
end = {
|
|
2171
|
+
column: start.column + 1,
|
|
2172
|
+
line: start.line,
|
|
2173
|
+
offset: start.offset + 1
|
|
2174
|
+
};
|
|
2160
2175
|
}
|
|
2161
2176
|
return { end, start };
|
|
2162
2177
|
}
|
|
@@ -2220,6 +2235,7 @@ let Node$4$1 = class Node2 {
|
|
|
2220
2235
|
} else if (typeof value === "object" && value.toJSON) {
|
|
2221
2236
|
fixed[name] = value.toJSON(null, inputs);
|
|
2222
2237
|
} else if (name === "source") {
|
|
2238
|
+
if (value == null) continue;
|
|
2223
2239
|
let inputId = inputs.get(value.input);
|
|
2224
2240
|
if (inputId == null) {
|
|
2225
2241
|
inputId = inputsNextIndex;
|
|
@@ -2254,7 +2270,7 @@ let Node$4$1 = class Node2 {
|
|
|
2254
2270
|
});
|
|
2255
2271
|
return result2;
|
|
2256
2272
|
}
|
|
2257
|
-
warn(result2, text, opts) {
|
|
2273
|
+
warn(result2, text, opts = {}) {
|
|
2258
2274
|
let data = { node: this };
|
|
2259
2275
|
for (let i2 in opts) data[i2] = opts[i2];
|
|
2260
2276
|
return result2.warn(text, data);
|
|
@@ -2831,9 +2847,21 @@ let { fileURLToPath: fileURLToPath$1, pathToFileURL: pathToFileURL$1$1 } = requi
|
|
|
2831
2847
|
let CssSyntaxError$1$1 = cssSyntaxError$1;
|
|
2832
2848
|
let PreviousMap$1$1 = previousMap$1;
|
|
2833
2849
|
let terminalHighlight$2 = require$$2$1;
|
|
2834
|
-
let
|
|
2850
|
+
let lineToIndexCache$1 = Symbol("lineToIndexCache");
|
|
2835
2851
|
let sourceMapAvailable$1$1 = Boolean(SourceMapConsumer$1$1 && SourceMapGenerator$1$1);
|
|
2836
2852
|
let pathAvailable$1$1 = Boolean(resolve$1$1 && isAbsolute$1);
|
|
2853
|
+
function getLineToIndex$1(input2) {
|
|
2854
|
+
if (input2[lineToIndexCache$1]) return input2[lineToIndexCache$1];
|
|
2855
|
+
let lines = input2.css.split("\n");
|
|
2856
|
+
let lineToIndex = new Array(lines.length);
|
|
2857
|
+
let prevIndex = 0;
|
|
2858
|
+
for (let i2 = 0, l2 = lines.length; i2 < l2; i2++) {
|
|
2859
|
+
lineToIndex[i2] = prevIndex;
|
|
2860
|
+
prevIndex += lines[i2].length + 1;
|
|
2861
|
+
}
|
|
2862
|
+
input2[lineToIndexCache$1] = lineToIndex;
|
|
2863
|
+
return lineToIndex;
|
|
2864
|
+
}
|
|
2837
2865
|
let Input$4$1 = class Input {
|
|
2838
2866
|
get from() {
|
|
2839
2867
|
return this.file || this.id;
|
|
@@ -2872,30 +2900,37 @@ let Input$4$1 = class Input {
|
|
|
2872
2900
|
if (this.map) this.map.file = this.from;
|
|
2873
2901
|
}
|
|
2874
2902
|
error(message, line, column, opts = {}) {
|
|
2875
|
-
let endColumn, endLine, result2;
|
|
2903
|
+
let endColumn, endLine, endOffset, offset, result2;
|
|
2876
2904
|
if (line && typeof line === "object") {
|
|
2877
2905
|
let start = line;
|
|
2878
2906
|
let end = column;
|
|
2879
2907
|
if (typeof start.offset === "number") {
|
|
2880
|
-
|
|
2908
|
+
offset = start.offset;
|
|
2909
|
+
let pos = this.fromOffset(offset);
|
|
2881
2910
|
line = pos.line;
|
|
2882
2911
|
column = pos.col;
|
|
2883
2912
|
} else {
|
|
2884
2913
|
line = start.line;
|
|
2885
2914
|
column = start.column;
|
|
2915
|
+
offset = this.fromLineAndColumn(line, column);
|
|
2886
2916
|
}
|
|
2887
2917
|
if (typeof end.offset === "number") {
|
|
2888
|
-
|
|
2918
|
+
endOffset = end.offset;
|
|
2919
|
+
let pos = this.fromOffset(endOffset);
|
|
2889
2920
|
endLine = pos.line;
|
|
2890
2921
|
endColumn = pos.col;
|
|
2891
2922
|
} else {
|
|
2892
2923
|
endLine = end.line;
|
|
2893
2924
|
endColumn = end.column;
|
|
2925
|
+
endOffset = this.fromLineAndColumn(end.line, end.column);
|
|
2894
2926
|
}
|
|
2895
2927
|
} else if (!column) {
|
|
2896
|
-
|
|
2928
|
+
offset = line;
|
|
2929
|
+
let pos = this.fromOffset(offset);
|
|
2897
2930
|
line = pos.line;
|
|
2898
2931
|
column = pos.col;
|
|
2932
|
+
} else {
|
|
2933
|
+
offset = this.fromLineAndColumn(line, column);
|
|
2899
2934
|
}
|
|
2900
2935
|
let origin = this.origin(line, column, endLine, endColumn);
|
|
2901
2936
|
if (origin) {
|
|
@@ -2917,7 +2952,7 @@ let Input$4$1 = class Input {
|
|
|
2917
2952
|
opts.plugin
|
|
2918
2953
|
);
|
|
2919
2954
|
}
|
|
2920
|
-
result2.input = { column, endColumn, endLine, line, source: this.css };
|
|
2955
|
+
result2.input = { column, endColumn, endLine, endOffset, line, offset, source: this.css };
|
|
2921
2956
|
if (this.file) {
|
|
2922
2957
|
if (pathToFileURL$1$1) {
|
|
2923
2958
|
result2.input.url = pathToFileURL$1$1(this.file).toString();
|
|
@@ -2926,21 +2961,14 @@ let Input$4$1 = class Input {
|
|
|
2926
2961
|
}
|
|
2927
2962
|
return result2;
|
|
2928
2963
|
}
|
|
2964
|
+
fromLineAndColumn(line, column) {
|
|
2965
|
+
let lineToIndex = getLineToIndex$1(this);
|
|
2966
|
+
let index2 = lineToIndex[line - 1];
|
|
2967
|
+
return index2 + column - 1;
|
|
2968
|
+
}
|
|
2929
2969
|
fromOffset(offset) {
|
|
2930
|
-
let
|
|
2931
|
-
|
|
2932
|
-
let lines = this.css.split("\n");
|
|
2933
|
-
lineToIndex = new Array(lines.length);
|
|
2934
|
-
let prevIndex = 0;
|
|
2935
|
-
for (let i2 = 0, l2 = lines.length; i2 < l2; i2++) {
|
|
2936
|
-
lineToIndex[i2] = prevIndex;
|
|
2937
|
-
prevIndex += lines[i2].length + 1;
|
|
2938
|
-
}
|
|
2939
|
-
this[fromOffsetCache$1] = lineToIndex;
|
|
2940
|
-
} else {
|
|
2941
|
-
lineToIndex = this[fromOffsetCache$1];
|
|
2942
|
-
}
|
|
2943
|
-
lastLine = lineToIndex[lineToIndex.length - 1];
|
|
2970
|
+
let lineToIndex = getLineToIndex$1(this);
|
|
2971
|
+
let lastLine = lineToIndex[lineToIndex.length - 1];
|
|
2944
2972
|
let min = 0;
|
|
2945
2973
|
if (offset >= lastLine) {
|
|
2946
2974
|
min = lineToIndex.length - 1;
|
|
@@ -4302,7 +4330,7 @@ let Result$3$1 = class Result {
|
|
|
4302
4330
|
this.messages = [];
|
|
4303
4331
|
this.root = root2;
|
|
4304
4332
|
this.opts = opts;
|
|
4305
|
-
this.css =
|
|
4333
|
+
this.css = "";
|
|
4306
4334
|
this.map = void 0;
|
|
4307
4335
|
}
|
|
4308
4336
|
toString() {
|
|
@@ -4914,7 +4942,7 @@ let NoWorkResult2$1 = noWorkResult$1;
|
|
|
4914
4942
|
let Root$1$1 = root$1;
|
|
4915
4943
|
let Processor$1$1 = class Processor {
|
|
4916
4944
|
constructor(plugins = []) {
|
|
4917
|
-
this.version = "8.5.
|
|
4945
|
+
this.version = "8.5.4";
|
|
4918
4946
|
this.plugins = this.normalize(plugins);
|
|
4919
4947
|
}
|
|
4920
4948
|
normalize(plugins) {
|
|
@@ -5675,7 +5703,7 @@ let Node$4 = class Node3 {
|
|
|
5675
5703
|
let index2 = this.parent.index(this);
|
|
5676
5704
|
return this.parent.nodes[index2 + 1];
|
|
5677
5705
|
}
|
|
5678
|
-
positionBy(opts) {
|
|
5706
|
+
positionBy(opts = {}) {
|
|
5679
5707
|
let pos = this.source.start;
|
|
5680
5708
|
if (opts.index) {
|
|
5681
5709
|
pos = this.positionInside(opts.index);
|
|
@@ -5704,27 +5732,38 @@ let Node$4 = class Node3 {
|
|
|
5704
5732
|
column += 1;
|
|
5705
5733
|
}
|
|
5706
5734
|
}
|
|
5707
|
-
return { column, line };
|
|
5735
|
+
return { column, line, offset: end };
|
|
5708
5736
|
}
|
|
5709
5737
|
prev() {
|
|
5710
5738
|
if (!this.parent) return void 0;
|
|
5711
5739
|
let index2 = this.parent.index(this);
|
|
5712
5740
|
return this.parent.nodes[index2 - 1];
|
|
5713
5741
|
}
|
|
5714
|
-
rangeBy(opts) {
|
|
5742
|
+
rangeBy(opts = {}) {
|
|
5743
|
+
let inputString = "document" in this.source.input ? this.source.input.document : this.source.input.css;
|
|
5715
5744
|
let start = {
|
|
5716
5745
|
column: this.source.start.column,
|
|
5717
|
-
line: this.source.start.line
|
|
5746
|
+
line: this.source.start.line,
|
|
5747
|
+
offset: sourceOffset(inputString, this.source.start)
|
|
5718
5748
|
};
|
|
5719
5749
|
let end = this.source.end ? {
|
|
5720
5750
|
column: this.source.end.column + 1,
|
|
5721
|
-
line: this.source.end.line
|
|
5751
|
+
line: this.source.end.line,
|
|
5752
|
+
offset: typeof this.source.end.offset === "number" ? (
|
|
5753
|
+
// `source.end.offset` is exclusive, so we don't need to add 1
|
|
5754
|
+
this.source.end.offset
|
|
5755
|
+
) : (
|
|
5756
|
+
// Since line/column in this.source.end is inclusive,
|
|
5757
|
+
// the `sourceOffset(... , this.source.end)` returns an inclusive offset.
|
|
5758
|
+
// So, we add 1 to convert it to exclusive.
|
|
5759
|
+
sourceOffset(inputString, this.source.end) + 1
|
|
5760
|
+
)
|
|
5722
5761
|
} : {
|
|
5723
5762
|
column: start.column + 1,
|
|
5724
|
-
line: start.line
|
|
5763
|
+
line: start.line,
|
|
5764
|
+
offset: start.offset + 1
|
|
5725
5765
|
};
|
|
5726
5766
|
if (opts.word) {
|
|
5727
|
-
let inputString = "document" in this.source.input ? this.source.input.document : this.source.input.css;
|
|
5728
5767
|
let stringRepresentation = inputString.slice(
|
|
5729
5768
|
sourceOffset(inputString, this.source.start),
|
|
5730
5769
|
sourceOffset(inputString, this.source.end)
|
|
@@ -5732,15 +5771,14 @@ let Node$4 = class Node3 {
|
|
|
5732
5771
|
let index2 = stringRepresentation.indexOf(opts.word);
|
|
5733
5772
|
if (index2 !== -1) {
|
|
5734
5773
|
start = this.positionInside(index2);
|
|
5735
|
-
end = this.positionInside(
|
|
5736
|
-
index2 + opts.word.length
|
|
5737
|
-
);
|
|
5774
|
+
end = this.positionInside(index2 + opts.word.length);
|
|
5738
5775
|
}
|
|
5739
5776
|
} else {
|
|
5740
5777
|
if (opts.start) {
|
|
5741
5778
|
start = {
|
|
5742
5779
|
column: opts.start.column,
|
|
5743
|
-
line: opts.start.line
|
|
5780
|
+
line: opts.start.line,
|
|
5781
|
+
offset: sourceOffset(inputString, opts.start)
|
|
5744
5782
|
};
|
|
5745
5783
|
} else if (opts.index) {
|
|
5746
5784
|
start = this.positionInside(opts.index);
|
|
@@ -5748,7 +5786,8 @@ let Node$4 = class Node3 {
|
|
|
5748
5786
|
if (opts.end) {
|
|
5749
5787
|
end = {
|
|
5750
5788
|
column: opts.end.column,
|
|
5751
|
-
line: opts.end.line
|
|
5789
|
+
line: opts.end.line,
|
|
5790
|
+
offset: sourceOffset(inputString, opts.end)
|
|
5752
5791
|
};
|
|
5753
5792
|
} else if (typeof opts.endIndex === "number") {
|
|
5754
5793
|
end = this.positionInside(opts.endIndex);
|
|
@@ -5757,7 +5796,11 @@ let Node$4 = class Node3 {
|
|
|
5757
5796
|
}
|
|
5758
5797
|
}
|
|
5759
5798
|
if (end.line < start.line || end.line === start.line && end.column <= start.column) {
|
|
5760
|
-
end = {
|
|
5799
|
+
end = {
|
|
5800
|
+
column: start.column + 1,
|
|
5801
|
+
line: start.line,
|
|
5802
|
+
offset: start.offset + 1
|
|
5803
|
+
};
|
|
5761
5804
|
}
|
|
5762
5805
|
return { end, start };
|
|
5763
5806
|
}
|
|
@@ -5821,6 +5864,7 @@ let Node$4 = class Node3 {
|
|
|
5821
5864
|
} else if (typeof value === "object" && value.toJSON) {
|
|
5822
5865
|
fixed[name] = value.toJSON(null, inputs);
|
|
5823
5866
|
} else if (name === "source") {
|
|
5867
|
+
if (value == null) continue;
|
|
5824
5868
|
let inputId = inputs.get(value.input);
|
|
5825
5869
|
if (inputId == null) {
|
|
5826
5870
|
inputId = inputsNextIndex;
|
|
@@ -5855,7 +5899,7 @@ let Node$4 = class Node3 {
|
|
|
5855
5899
|
});
|
|
5856
5900
|
return result2;
|
|
5857
5901
|
}
|
|
5858
|
-
warn(result2, text, opts) {
|
|
5902
|
+
warn(result2, text, opts = {}) {
|
|
5859
5903
|
let data = { node: this };
|
|
5860
5904
|
for (let i2 in opts) data[i2] = opts[i2];
|
|
5861
5905
|
return result2.warn(text, data);
|
|
@@ -6432,9 +6476,21 @@ let { fileURLToPath, pathToFileURL: pathToFileURL$1 } = require$$2;
|
|
|
6432
6476
|
let CssSyntaxError$1 = cssSyntaxError;
|
|
6433
6477
|
let PreviousMap$1 = previousMap;
|
|
6434
6478
|
let terminalHighlight = require$$2;
|
|
6435
|
-
let
|
|
6479
|
+
let lineToIndexCache = Symbol("lineToIndexCache");
|
|
6436
6480
|
let sourceMapAvailable$1 = Boolean(SourceMapConsumer$1 && SourceMapGenerator$1);
|
|
6437
6481
|
let pathAvailable$1 = Boolean(resolve$1 && isAbsolute);
|
|
6482
|
+
function getLineToIndex(input2) {
|
|
6483
|
+
if (input2[lineToIndexCache]) return input2[lineToIndexCache];
|
|
6484
|
+
let lines = input2.css.split("\n");
|
|
6485
|
+
let lineToIndex = new Array(lines.length);
|
|
6486
|
+
let prevIndex = 0;
|
|
6487
|
+
for (let i2 = 0, l2 = lines.length; i2 < l2; i2++) {
|
|
6488
|
+
lineToIndex[i2] = prevIndex;
|
|
6489
|
+
prevIndex += lines[i2].length + 1;
|
|
6490
|
+
}
|
|
6491
|
+
input2[lineToIndexCache] = lineToIndex;
|
|
6492
|
+
return lineToIndex;
|
|
6493
|
+
}
|
|
6438
6494
|
let Input$4 = class Input2 {
|
|
6439
6495
|
get from() {
|
|
6440
6496
|
return this.file || this.id;
|
|
@@ -6473,30 +6529,37 @@ let Input$4 = class Input2 {
|
|
|
6473
6529
|
if (this.map) this.map.file = this.from;
|
|
6474
6530
|
}
|
|
6475
6531
|
error(message, line, column, opts = {}) {
|
|
6476
|
-
let endColumn, endLine, result2;
|
|
6532
|
+
let endColumn, endLine, endOffset, offset, result2;
|
|
6477
6533
|
if (line && typeof line === "object") {
|
|
6478
6534
|
let start = line;
|
|
6479
6535
|
let end = column;
|
|
6480
6536
|
if (typeof start.offset === "number") {
|
|
6481
|
-
|
|
6537
|
+
offset = start.offset;
|
|
6538
|
+
let pos = this.fromOffset(offset);
|
|
6482
6539
|
line = pos.line;
|
|
6483
6540
|
column = pos.col;
|
|
6484
6541
|
} else {
|
|
6485
6542
|
line = start.line;
|
|
6486
6543
|
column = start.column;
|
|
6544
|
+
offset = this.fromLineAndColumn(line, column);
|
|
6487
6545
|
}
|
|
6488
6546
|
if (typeof end.offset === "number") {
|
|
6489
|
-
|
|
6547
|
+
endOffset = end.offset;
|
|
6548
|
+
let pos = this.fromOffset(endOffset);
|
|
6490
6549
|
endLine = pos.line;
|
|
6491
6550
|
endColumn = pos.col;
|
|
6492
6551
|
} else {
|
|
6493
6552
|
endLine = end.line;
|
|
6494
6553
|
endColumn = end.column;
|
|
6554
|
+
endOffset = this.fromLineAndColumn(end.line, end.column);
|
|
6495
6555
|
}
|
|
6496
6556
|
} else if (!column) {
|
|
6497
|
-
|
|
6557
|
+
offset = line;
|
|
6558
|
+
let pos = this.fromOffset(offset);
|
|
6498
6559
|
line = pos.line;
|
|
6499
6560
|
column = pos.col;
|
|
6561
|
+
} else {
|
|
6562
|
+
offset = this.fromLineAndColumn(line, column);
|
|
6500
6563
|
}
|
|
6501
6564
|
let origin = this.origin(line, column, endLine, endColumn);
|
|
6502
6565
|
if (origin) {
|
|
@@ -6518,7 +6581,7 @@ let Input$4 = class Input2 {
|
|
|
6518
6581
|
opts.plugin
|
|
6519
6582
|
);
|
|
6520
6583
|
}
|
|
6521
|
-
result2.input = { column, endColumn, endLine, line, source: this.css };
|
|
6584
|
+
result2.input = { column, endColumn, endLine, endOffset, line, offset, source: this.css };
|
|
6522
6585
|
if (this.file) {
|
|
6523
6586
|
if (pathToFileURL$1) {
|
|
6524
6587
|
result2.input.url = pathToFileURL$1(this.file).toString();
|
|
@@ -6527,21 +6590,14 @@ let Input$4 = class Input2 {
|
|
|
6527
6590
|
}
|
|
6528
6591
|
return result2;
|
|
6529
6592
|
}
|
|
6593
|
+
fromLineAndColumn(line, column) {
|
|
6594
|
+
let lineToIndex = getLineToIndex(this);
|
|
6595
|
+
let index2 = lineToIndex[line - 1];
|
|
6596
|
+
return index2 + column - 1;
|
|
6597
|
+
}
|
|
6530
6598
|
fromOffset(offset) {
|
|
6531
|
-
let
|
|
6532
|
-
|
|
6533
|
-
let lines = this.css.split("\n");
|
|
6534
|
-
lineToIndex = new Array(lines.length);
|
|
6535
|
-
let prevIndex = 0;
|
|
6536
|
-
for (let i2 = 0, l2 = lines.length; i2 < l2; i2++) {
|
|
6537
|
-
lineToIndex[i2] = prevIndex;
|
|
6538
|
-
prevIndex += lines[i2].length + 1;
|
|
6539
|
-
}
|
|
6540
|
-
this[fromOffsetCache] = lineToIndex;
|
|
6541
|
-
} else {
|
|
6542
|
-
lineToIndex = this[fromOffsetCache];
|
|
6543
|
-
}
|
|
6544
|
-
lastLine = lineToIndex[lineToIndex.length - 1];
|
|
6599
|
+
let lineToIndex = getLineToIndex(this);
|
|
6600
|
+
let lastLine = lineToIndex[lineToIndex.length - 1];
|
|
6545
6601
|
let min = 0;
|
|
6546
6602
|
if (offset >= lastLine) {
|
|
6547
6603
|
min = lineToIndex.length - 1;
|
|
@@ -7903,7 +7959,7 @@ let Result$3 = class Result2 {
|
|
|
7903
7959
|
this.messages = [];
|
|
7904
7960
|
this.root = root2;
|
|
7905
7961
|
this.opts = opts;
|
|
7906
|
-
this.css =
|
|
7962
|
+
this.css = "";
|
|
7907
7963
|
this.map = void 0;
|
|
7908
7964
|
}
|
|
7909
7965
|
toString() {
|
|
@@ -8515,7 +8571,7 @@ let NoWorkResult22 = noWorkResult;
|
|
|
8515
8571
|
let Root$1 = root;
|
|
8516
8572
|
let Processor$1 = class Processor2 {
|
|
8517
8573
|
constructor(plugins = []) {
|
|
8518
|
-
this.version = "8.5.
|
|
8574
|
+
this.version = "8.5.4";
|
|
8519
8575
|
this.plugins = this.normalize(plugins);
|
|
8520
8576
|
}
|
|
8521
8577
|
normalize(plugins) {
|