postcss 8.4.19 → 8.4.21
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.
Potentially problematic release.
This version of postcss might be problematic. Click here for more details.
- package/README.md +1 -1
- package/lib/input.d.ts +36 -1
- package/lib/input.js +1 -1
- package/lib/map-generator.js +3 -1
- package/lib/processor.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
package/lib/input.d.ts
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import { ProcessOptions } from './postcss.js'
|
1
|
+
import { CssSyntaxError, ProcessOptions } from './postcss.js'
|
2
2
|
import PreviousMap from './previous-map.js'
|
3
3
|
|
4
4
|
export interface FilePosition {
|
@@ -147,4 +147,39 @@ export default class Input {
|
|
147
147
|
* @param offset Source offset.
|
148
148
|
*/
|
149
149
|
fromOffset(offset: number): { line: number; col: number } | null
|
150
|
+
|
151
|
+
/**
|
152
|
+
* Returns `CssSyntaxError` with information about the error and its position.
|
153
|
+
*/
|
154
|
+
error(
|
155
|
+
message: string,
|
156
|
+
line: number,
|
157
|
+
column: number,
|
158
|
+
opts?: { plugin?: CssSyntaxError['plugin'] }
|
159
|
+
): CssSyntaxError
|
160
|
+
error(
|
161
|
+
message: string,
|
162
|
+
offset: number,
|
163
|
+
opts?: { plugin?: CssSyntaxError['plugin'] }
|
164
|
+
): CssSyntaxError
|
165
|
+
error(
|
166
|
+
message: string,
|
167
|
+
start:
|
168
|
+
| {
|
169
|
+
offset: number
|
170
|
+
}
|
171
|
+
| {
|
172
|
+
line: number
|
173
|
+
column: number
|
174
|
+
},
|
175
|
+
end:
|
176
|
+
| {
|
177
|
+
offset: number
|
178
|
+
}
|
179
|
+
| {
|
180
|
+
line: number
|
181
|
+
column: number
|
182
|
+
},
|
183
|
+
opts?: { plugin?: CssSyntaxError['plugin'] }
|
184
|
+
): CssSyntaxError
|
150
185
|
}
|
package/lib/input.js
CHANGED
@@ -108,7 +108,7 @@ class Input {
|
|
108
108
|
if (line && typeof line === 'object') {
|
109
109
|
let start = line
|
110
110
|
let end = column
|
111
|
-
if (typeof
|
111
|
+
if (typeof start.offset === 'number') {
|
112
112
|
let pos = this.fromOffset(start.offset)
|
113
113
|
line = pos.line
|
114
114
|
column = pos.col
|
package/lib/map-generator.js
CHANGED
@@ -298,7 +298,9 @@ class MapGenerator {
|
|
298
298
|
|
299
299
|
if (node && type !== 'start') {
|
300
300
|
let p = node.parent || { raws: {} }
|
301
|
-
|
301
|
+
let childless =
|
302
|
+
node.type === 'decl' || (node.type === 'atrule' && !node.nodes)
|
303
|
+
if (!childless || node !== p.last || p.raws.semicolon) {
|
302
304
|
if (node.source && node.source.end) {
|
303
305
|
mapping.source = this.sourcePath(node)
|
304
306
|
mapping.original.line = node.source.end.line
|
package/lib/processor.js
CHANGED