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 CHANGED
@@ -41,4 +41,4 @@ at <postcss@evilmartians.com>.
41
41
 
42
42
 
43
43
  ## Docs
44
- Read **[full docs](https://github.com/postcss/postcss#readme)** on GitHub.
44
+ Read full docs **[here](https://postcss.org/)**.
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 line.offset === 'number') {
111
+ if (typeof start.offset === 'number') {
112
112
  let pos = this.fromOffset(start.offset)
113
113
  line = pos.line
114
114
  column = pos.col
@@ -298,7 +298,9 @@ class MapGenerator {
298
298
 
299
299
  if (node && type !== 'start') {
300
300
  let p = node.parent || { raws: {} }
301
- if (node.type !== 'decl' || node !== p.last || p.raws.semicolon) {
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
@@ -7,7 +7,7 @@ let Root = require('./root')
7
7
 
8
8
  class Processor {
9
9
  constructor(plugins = []) {
10
- this.version = '8.4.19'
10
+ this.version = '8.4.21'
11
11
  this.plugins = this.normalize(plugins)
12
12
  }
13
13
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "postcss",
3
- "version": "8.4.19",
3
+ "version": "8.4.21",
4
4
  "description": "Tool for transforming styles with JS plugins",
5
5
  "engines": {
6
6
  "node": "^10 || ^12 || >=14"