postcss 8.4.47 → 8.4.48

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
@@ -177,22 +177,23 @@ class Node {
177
177
  positionBy(opts, stringRepresentation) {
178
178
  let pos = this.source.start
179
179
  if (opts.index) {
180
- pos = this.positionInside(opts.index, stringRepresentation)
180
+ pos = this.positionInside(opts.index)
181
181
  } else if (opts.word) {
182
- stringRepresentation = this.toString()
182
+ stringRepresentation = this.source.input.css.slice(this.source.start.offset, this.source.end.offset)
183
183
  let index = stringRepresentation.indexOf(opts.word)
184
- if (index !== -1) pos = this.positionInside(index, stringRepresentation)
184
+ if (index !== -1) pos = this.positionInside(index)
185
185
  }
186
186
  return pos
187
187
  }
188
188
 
189
- positionInside(index, stringRepresentation) {
190
- let string = stringRepresentation || this.toString()
189
+ positionInside(index) {
191
190
  let column = this.source.start.column
192
191
  let line = this.source.start.line
192
+ let offset = this.source.start.offset
193
+ let end = offset + index
193
194
 
194
- for (let i = 0; i < index; i++) {
195
- if (string[i] === '\n') {
195
+ for (let i = offset; i < end; i++) {
196
+ if (this.source.input.css[i] === '\n') {
196
197
  column = 1
197
198
  line += 1
198
199
  } else {
@@ -225,7 +226,7 @@ class Node {
225
226
  }
226
227
 
227
228
  if (opts.word) {
228
- let stringRepresentation = this.toString()
229
+ let stringRepresentation = this.source.input.css.slice(this.source.start.offset, this.source.end.offset)
229
230
  let index = stringRepresentation.indexOf(opts.word)
230
231
  if (index !== -1) {
231
232
  start = this.positionInside(index, stringRepresentation)
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.47'
10
+ this.version = '8.4.48'
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.47",
3
+ "version": "8.4.48",
4
4
  "description": "Tool for transforming styles with JS plugins",
5
5
  "engines": {
6
6
  "node": "^10 || ^12 || >=14"
@@ -75,7 +75,7 @@
75
75
  },
76
76
  "dependencies": {
77
77
  "nanoid": "^3.3.7",
78
- "picocolors": "^1.1.0",
78
+ "picocolors": "^1.1.1",
79
79
  "source-map-js": "^1.2.1"
80
80
  },
81
81
  "browser": {