postcss 8.5.0 → 8.5.2

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/lib/node.js CHANGED
@@ -209,9 +209,12 @@ class Node {
209
209
  if (opts.index) {
210
210
  pos = this.positionInside(opts.index)
211
211
  } else if (opts.word) {
212
- let stringRepresentation = this.source.input.document.slice(
213
- sourceOffset(this.source.input.document, this.source.start),
214
- sourceOffset(this.source.input.document, this.source.end)
212
+ let inputString = ('document' in this.source.input)
213
+ ? this.source.input.document
214
+ : this.source.input.css
215
+ let stringRepresentation = inputString.slice(
216
+ sourceOffset(inputString, this.source.start),
217
+ sourceOffset(inputString, this.source.end)
215
218
  )
216
219
  let index = stringRepresentation.indexOf(opts.word)
217
220
  if (index !== -1) pos = this.positionInside(index)
@@ -222,11 +225,14 @@ class Node {
222
225
  positionInside(index) {
223
226
  let column = this.source.start.column
224
227
  let line = this.source.start.line
225
- let offset = sourceOffset(this.source.input.document, this.source.start)
228
+ let inputString = ('document' in this.source.input)
229
+ ? this.source.input.document
230
+ : this.source.input.css
231
+ let offset = sourceOffset(inputString, this.source.start)
226
232
  let end = offset + index
227
233
 
228
234
  for (let i = offset; i < end; i++) {
229
- if (this.source.input.document[i] === '\n') {
235
+ if (inputString[i] === '\n') {
230
236
  column = 1
231
237
  line += 1
232
238
  } else {
@@ -259,9 +265,12 @@ class Node {
259
265
  }
260
266
 
261
267
  if (opts.word) {
262
- let stringRepresentation = this.source.input.document.slice(
263
- sourceOffset(this.source.input.document, this.source.start),
264
- sourceOffset(this.source.input.document, this.source.end)
268
+ let inputString = ('document' in this.source.input)
269
+ ? this.source.input.document
270
+ : this.source.input.css
271
+ let stringRepresentation = inputString.slice(
272
+ sourceOffset(inputString, this.source.start),
273
+ sourceOffset(inputString, this.source.end)
265
274
  )
266
275
  let index = stringRepresentation.indexOf(opts.word)
267
276
  if (index !== -1) {
package/lib/parser.js CHANGED
@@ -347,6 +347,8 @@ class Parser {
347
347
  if (prev && prev.type === 'rule' && !prev.raws.ownSemicolon) {
348
348
  prev.raws.ownSemicolon = this.spaces
349
349
  this.spaces = ''
350
+ prev.source.end = this.getPosition(token[2])
351
+ prev.source.end.offset += prev.raws.ownSemicolon.length
350
352
  }
351
353
  }
352
354
  }
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.5.0'
10
+ this.version = '8.5.2'
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.5.0",
3
+ "version": "8.5.2",
4
4
  "description": "Tool for transforming styles with JS plugins",
5
5
  "engines": {
6
6
  "node": "^10 || ^12 || >=14"