@depup/postcss 8.5.8-depup.0 → 8.5.21-depup.0

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/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright 2013 Andrey Sitnik <andrey@sitnik.ru>
3
+ Copyright 2013 Andrey Sitnik <andrey@sitnik.es>
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy of
6
6
  this software and associated documentation files (the "Software"), to deal in
package/README.md CHANGED
@@ -13,8 +13,8 @@ npm install @depup/postcss
13
13
 
14
14
  | Field | Value |
15
15
  |-------|-------|
16
- | Original | [postcss](https://www.npmjs.com/package/postcss) @ 8.5.8 |
17
- | Processed | 2026-03-09 |
16
+ | Original | [postcss](https://www.npmjs.com/package/postcss) @ 8.5.21 |
17
+ | Processed | 2026-07-21 |
18
18
  | Smoke test | passed |
19
19
  | Deps updated | 1 |
20
20
 
@@ -22,7 +22,7 @@ npm install @depup/postcss
22
22
 
23
23
  | Dependency | From | To |
24
24
  |------------|------|-----|
25
- | nanoid | ^3.3.11 | ^5.1.6 |
25
+ | nanoid | ^3.3.16 | ^6.0.0 |
26
26
 
27
27
  ---
28
28
 
package/changes.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "bumped": {
3
3
  "nanoid": {
4
- "from": "^3.3.11",
5
- "to": "^5.1.6"
4
+ "from": "^3.3.16",
5
+ "to": "^6.0.0"
6
6
  }
7
7
  },
8
- "timestamp": "2026-03-09T04:19:07.402Z",
8
+ "timestamp": "2026-07-21T17:29:17.055Z",
9
9
  "totalUpdated": 1
10
10
  }
package/lib/at-rule.d.ts CHANGED
@@ -49,7 +49,6 @@ declare namespace AtRule {
49
49
  raws?: AtRuleRaws
50
50
  }
51
51
 
52
-
53
52
  export { AtRule_ as default }
54
53
  }
55
54
 
package/lib/comment.d.ts CHANGED
@@ -26,7 +26,6 @@ declare namespace Comment {
26
26
  text: string
27
27
  }
28
28
 
29
-
30
29
  export { Comment_ as default }
31
30
  }
32
31
 
@@ -8,11 +8,7 @@ import Rule from './rule.js'
8
8
  declare namespace Container {
9
9
  export type ContainerWithChildren<Child extends Node = ChildNode> = {
10
10
  nodes: Child[]
11
- } & (
12
- | AtRule
13
- | Root
14
- | Rule
15
- )
11
+ } & (AtRule | Root | Rule)
16
12
 
17
13
  export interface ValueOptions {
18
14
  /**
@@ -43,7 +39,6 @@ declare namespace Container {
43
39
  | string
44
40
  | undefined
45
41
 
46
-
47
42
  export { Container_ as default }
48
43
  }
49
44
 
package/lib/container.js CHANGED
@@ -8,18 +8,25 @@ let { isClean, my } = require('./symbols')
8
8
  let AtRule, parse, Root, Rule
9
9
 
10
10
  function cleanSource(nodes) {
11
- return nodes.map(i => {
12
- if (i.nodes) i.nodes = cleanSource(i.nodes)
13
- delete i.source
14
- return i
15
- })
11
+ let stack = nodes.slice()
12
+ while (stack.length > 0) {
13
+ let node = stack.pop()
14
+ delete node.source
15
+ if (node.nodes) {
16
+ node.nodes = node.nodes.slice()
17
+ for (let i of node.nodes) stack.push(i)
18
+ }
19
+ }
20
+ return nodes.slice()
16
21
  }
17
22
 
18
23
  function markTreeDirty(node) {
19
- node[isClean] = false
20
- if (node.proxyOf.nodes) {
21
- for (let i of node.proxyOf.nodes) {
22
- markTreeDirty(i)
24
+ let stack = [node]
25
+ while (stack.length > 0) {
26
+ let next = stack.pop()
27
+ next[isClean] = false
28
+ if (next.proxyOf.nodes) {
29
+ for (let i of next.proxyOf.nodes) stack.push(i)
23
30
  }
24
31
  }
25
32
  }
@@ -47,9 +54,18 @@ class Container extends Node {
47
54
  }
48
55
 
49
56
  cleanRaws(keepBetween) {
50
- super.cleanRaws(keepBetween)
51
- if (this.nodes) {
52
- for (let node of this.nodes) node.cleanRaws(keepBetween)
57
+ let stack = [this]
58
+ while (stack.length > 0) {
59
+ let node = stack.pop()
60
+ if (node !== this && node.cleanRaws !== Container.prototype.cleanRaws) {
61
+ // Subclass with own logic; let it handle its subtree
62
+ node.cleanRaws(keepBetween)
63
+ continue
64
+ }
65
+ Node.prototype.cleanRaws.call(node, keepBetween)
66
+ if (node.nodes) {
67
+ for (let child of node.nodes) stack.push(child)
68
+ }
53
69
  }
54
70
  }
55
71
 
@@ -309,19 +325,48 @@ class Container extends Node {
309
325
  }
310
326
 
311
327
  walk(callback) {
312
- return this.each((child, i) => {
328
+ if (!this.proxyOf.nodes) return undefined
329
+
330
+ // An explicit stack instead of recursive `each()` calls to survive
331
+ // deeply nested trees. Each frame keeps a live `indexes` slot, so
332
+ // insertion and removal during the walk behave like `each()`: the
333
+ // slot stays at the current child until its subtree is finished.
334
+ let stack = [{ iterator: this.getIterator(), node: this.proxyOf }]
335
+
336
+ while (stack.length > 0) {
337
+ let { iterator, node } = stack[stack.length - 1]
338
+ let index = node.indexes[iterator]
339
+
340
+ if (index >= node.proxyOf.nodes.length) {
341
+ delete node.indexes[iterator]
342
+ stack.pop()
343
+ let parent = stack[stack.length - 1]
344
+ // Finish the parent’s step for the child subtree we just left
345
+ if (parent) parent.node.indexes[parent.iterator] += 1
346
+ continue
347
+ }
348
+
349
+ let child = node.proxyOf.nodes[index]
313
350
  let result
314
351
  try {
315
- result = callback(child, i)
352
+ result = callback(child, index)
316
353
  } catch (e) {
317
354
  throw child.addToError(e)
318
355
  }
319
- if (result !== false && child.walk) {
320
- result = child.walk(callback)
356
+ if (result === false) {
357
+ for (let opened of stack) {
358
+ delete opened.node.indexes[opened.iterator]
359
+ }
360
+ return false
361
+ }
362
+ if (child.walk && child.proxyOf.nodes) {
363
+ stack.push({ iterator: child.getIterator(), node: child })
364
+ } else {
365
+ node.indexes[iterator] += 1
321
366
  }
367
+ }
322
368
 
323
- return result
324
- })
369
+ return undefined
325
370
  }
326
371
 
327
372
  walkAtRules(name, callback) {
@@ -424,24 +469,26 @@ Container.default = Container
424
469
 
425
470
  /* c8 ignore start */
426
471
  Container.rebuild = node => {
427
- if (node.type === 'atrule') {
428
- Object.setPrototypeOf(node, AtRule.prototype)
429
- } else if (node.type === 'rule') {
430
- Object.setPrototypeOf(node, Rule.prototype)
431
- } else if (node.type === 'decl') {
432
- Object.setPrototypeOf(node, Declaration.prototype)
433
- } else if (node.type === 'comment') {
434
- Object.setPrototypeOf(node, Comment.prototype)
435
- } else if (node.type === 'root') {
436
- Object.setPrototypeOf(node, Root.prototype)
437
- }
472
+ let stack = [node]
473
+ while (stack.length > 0) {
474
+ let next = stack.pop()
475
+ if (next.type === 'atrule') {
476
+ Object.setPrototypeOf(next, AtRule.prototype)
477
+ } else if (next.type === 'rule') {
478
+ Object.setPrototypeOf(next, Rule.prototype)
479
+ } else if (next.type === 'decl') {
480
+ Object.setPrototypeOf(next, Declaration.prototype)
481
+ } else if (next.type === 'comment') {
482
+ Object.setPrototypeOf(next, Comment.prototype)
483
+ } else if (next.type === 'root') {
484
+ Object.setPrototypeOf(next, Root.prototype)
485
+ }
438
486
 
439
- node[my] = true
487
+ next[my] = true
440
488
 
441
- if (node.nodes) {
442
- node.nodes.forEach(child => {
443
- Container.rebuild(child)
444
- })
489
+ if (next.nodes) {
490
+ for (let child of next.nodes) stack.push(child)
491
+ }
445
492
  }
446
493
  }
447
494
  /* c8 ignore stop */
@@ -16,7 +16,6 @@ declare namespace CssSyntaxError {
16
16
  line: number
17
17
  }
18
18
 
19
-
20
19
  export { CssSyntaxError_ as default }
21
20
  }
22
21
 
@@ -39,7 +39,6 @@ declare namespace Declaration {
39
39
  value: string
40
40
  }
41
41
 
42
-
43
42
  export { Declaration_ as default }
44
43
  }
45
44
 
package/lib/document.d.ts CHANGED
@@ -16,7 +16,6 @@ declare namespace Document {
16
16
  raws?: Record<string, any>
17
17
  }
18
18
 
19
-
20
19
  export { Document_ as default }
21
20
  }
22
21
 
package/lib/fromJSON.d.ts CHANGED
@@ -4,6 +4,6 @@ interface FromJSON extends JSONHydrator {
4
4
  default: FromJSON
5
5
  }
6
6
 
7
- declare const fromJSON: FromJSON
7
+ declare let fromJSON: FromJSON
8
8
 
9
9
  export = fromJSON
package/lib/fromJSON.js CHANGED
@@ -8,26 +8,24 @@ let PreviousMap = require('./previous-map')
8
8
  let Root = require('./root')
9
9
  let Rule = require('./rule')
10
10
 
11
- function fromJSON(json, inputs) {
12
- if (Array.isArray(json)) return json.map(n => fromJSON(n))
13
-
14
- let { inputs: ownInputs, ...defaults } = json
15
- if (ownInputs) {
16
- inputs = []
17
- for (let input of ownInputs) {
18
- let inputHydrated = { ...input, __proto__: Input.prototype }
19
- if (inputHydrated.map) {
20
- inputHydrated.map = {
21
- ...inputHydrated.map,
22
- __proto__: PreviousMap.prototype
23
- }
11
+ function hydrateInputs(json, inputs) {
12
+ if (!json.inputs) return inputs
13
+ return json.inputs.map(input => {
14
+ let inputHydrated = { ...input, __proto__: Input.prototype }
15
+ if (inputHydrated.map) {
16
+ inputHydrated.map = {
17
+ ...inputHydrated.map,
18
+ __proto__: PreviousMap.prototype
24
19
  }
25
- inputs.push(inputHydrated)
26
20
  }
27
- }
28
- if (defaults.nodes) {
29
- defaults.nodes = json.nodes.map(n => fromJSON(n, inputs))
30
- }
21
+ return inputHydrated
22
+ })
23
+ }
24
+
25
+ function constructNode(json, inputs, children) {
26
+ let defaults = { ...json }
27
+ delete defaults.inputs
28
+ delete defaults.nodes
31
29
  if (defaults.source) {
32
30
  let { inputId, ...source } = defaults.source
33
31
  defaults.source = source
@@ -35,19 +33,74 @@ function fromJSON(json, inputs) {
35
33
  defaults.source.input = inputs[inputId]
36
34
  }
37
35
  }
36
+
37
+ let node
38
38
  if (defaults.type === 'root') {
39
- return new Root(defaults)
39
+ node = new Root(defaults)
40
40
  } else if (defaults.type === 'decl') {
41
- return new Declaration(defaults)
41
+ node = new Declaration(defaults)
42
42
  } else if (defaults.type === 'rule') {
43
- return new Rule(defaults)
43
+ node = new Rule(defaults)
44
44
  } else if (defaults.type === 'comment') {
45
- return new Comment(defaults)
45
+ node = new Comment(defaults)
46
46
  } else if (defaults.type === 'atrule') {
47
- return new AtRule(defaults)
47
+ node = new AtRule(defaults)
48
48
  } else {
49
49
  throw new Error('Unknown node type: ' + json.type)
50
50
  }
51
+
52
+ // Rehydrated children are attached after construction. Passing them
53
+ // through the container constructor would re-run insertion spacing
54
+ // normalization and overwrite each child's own `raws.before`.
55
+ if (children) {
56
+ node.nodes = children
57
+ for (let child of children) child.parent = node
58
+ }
59
+
60
+ return node
61
+ }
62
+
63
+ function fromJSON(json, inputs) {
64
+ if (Array.isArray(json)) return json.map(n => fromJSON(n))
65
+
66
+ // An explicit stack instead of recursive calls to survive deeply
67
+ // nested trees. Children are rehydrated before their parent node
68
+ // is constructed.
69
+ let result
70
+ let stack = [
71
+ { childIndex: 0, children: [], inputs: hydrateInputs(json, inputs), json }
72
+ ]
73
+
74
+ while (stack.length > 0) {
75
+ let frame = stack[stack.length - 1]
76
+ let jsonNodes = frame.json.nodes
77
+
78
+ if (jsonNodes && frame.childIndex < jsonNodes.length) {
79
+ let childJson = jsonNodes[frame.childIndex]
80
+ frame.childIndex += 1
81
+ stack.push({
82
+ childIndex: 0,
83
+ children: [],
84
+ inputs: hydrateInputs(childJson, frame.inputs),
85
+ json: childJson
86
+ })
87
+ continue
88
+ }
89
+
90
+ stack.pop()
91
+ let node = constructNode(
92
+ frame.json,
93
+ frame.inputs,
94
+ jsonNodes ? frame.children : undefined
95
+ )
96
+ if (stack.length > 0) {
97
+ stack[stack.length - 1].children.push(node)
98
+ } else {
99
+ result = node
100
+ }
101
+ }
102
+
103
+ return result
51
104
  }
52
105
 
53
106
  module.exports = fromJSON
package/lib/input.d.ts CHANGED
@@ -49,7 +49,6 @@ declare namespace Input {
49
49
  url: string
50
50
  }
51
51
 
52
-
53
52
  export { Input_ as default }
54
53
  }
55
54
 
package/lib/input.js CHANGED
@@ -142,7 +142,15 @@ class Input {
142
142
  )
143
143
  }
144
144
 
145
- result.input = { column, endColumn, endLine, endOffset, line, offset, source: this.css }
145
+ result.input = {
146
+ column,
147
+ endColumn,
148
+ endLine,
149
+ endOffset,
150
+ line,
151
+ offset,
152
+ source: this.css
153
+ }
146
154
  if (this.file) {
147
155
  if (pathToFileURL) {
148
156
  result.input.url = pathToFileURL(this.file).toString()
@@ -198,12 +206,21 @@ class Input {
198
206
  if (!this.map) return false
199
207
  let consumer = this.map.consumer()
200
208
 
201
- let from = consumer.originalPositionFor({ column, line })
209
+ let from = consumer.originalPositionFor({ column: column - 1, line })
202
210
  if (!from.source) return false
203
211
 
204
212
  let to
205
213
  if (typeof endLine === 'number') {
206
- to = consumer.originalPositionFor({ column: endColumn, line: endLine })
214
+ let toPosition = consumer.originalPositionFor({
215
+ column: endColumn - 1,
216
+ line: endLine
217
+ })
218
+ // The source map may not have a mapping that covers the end position
219
+ // (`originalPositionFor()` then returns `null` for `line`/`column`
220
+ // instead of omitting them). Treat that the same as not requesting
221
+ // an end position at all, so `endLine`/`endColumn` stay a consistent
222
+ // `undefined` pair instead of a mix of `null` and a bogus number.
223
+ if (toPosition.source) to = toPosition
207
224
  }
208
225
 
209
226
  let fromUrl
@@ -218,8 +235,8 @@ class Input {
218
235
  }
219
236
 
220
237
  let result = {
221
- column: from.column,
222
- endColumn: to && to.column,
238
+ column: from.column + 1,
239
+ endColumn: to && to.column + 1,
223
240
  endLine: to && to.line,
224
241
  line: from.line,
225
242
  url: fromUrl.toString()
@@ -6,7 +6,6 @@ import Root from './root.js'
6
6
  import Warning from './warning.js'
7
7
 
8
8
  declare namespace LazyResult {
9
-
10
9
  export { LazyResult_ as default }
11
10
  }
12
11
 
@@ -19,9 +18,9 @@ declare namespace LazyResult {
19
18
  * const lazy = postcss([autoprefixer]).process(css)
20
19
  * ```
21
20
  */
22
- declare class LazyResult_<RootNode = Document | Root>
23
- implements PromiseLike<Result<RootNode>>
24
- {
21
+ declare class LazyResult_<RootNode = Document | Root> implements PromiseLike<
22
+ Result<RootNode>
23
+ > {
25
24
  /**
26
25
  * Processes input CSS through synchronous and asynchronous plugins
27
26
  * and calls onRejected for each error thrown in any plugin.
@@ -97,8 +97,14 @@ function toStack(node) {
97
97
  }
98
98
 
99
99
  function cleanMarks(node) {
100
- node[isClean] = false
101
- if (node.nodes) node.nodes.forEach(i => cleanMarks(i))
100
+ let stack = [node]
101
+ while (stack.length > 0) {
102
+ let next = stack.pop()
103
+ next[isClean] = false
104
+ if (next.nodes) {
105
+ for (let i of next.nodes) stack.push(i)
106
+ }
107
+ }
102
108
  return node
103
109
  }
104
110
 
@@ -378,6 +384,19 @@ class LazyResult {
378
384
  if (opts.stringifier) str = opts.stringifier
379
385
  if (str.stringify) str = str.stringify
380
386
 
387
+ let rootSource = this.result.root.source
388
+ if (
389
+ opts.map === undefined &&
390
+ !(rootSource && rootSource.input && rootSource.input.map)
391
+ ) {
392
+ let result = ''
393
+ str(this.result.root, i => {
394
+ result += i
395
+ })
396
+ this.result.css = result
397
+ return this.result
398
+ }
399
+
381
400
  let map = new MapGenerator(str, this.result.root, this.result.opts)
382
401
  let data = map.generate()
383
402
  this.result.css = data[0]
@@ -516,21 +535,57 @@ class LazyResult {
516
535
  }
517
536
 
518
537
  walkSync(node) {
538
+ // An explicit stack like in async `visitTick()` to survive deeply
539
+ // nested trees. Unlike `visitTick()`, nodes are marked clean only
540
+ // on entering, so a node dirtied by its own visitors is revisited
541
+ // on the next pass.
519
542
  node[isClean] = true
520
- let events = getEvents(node)
521
- for (let event of events) {
522
- if (event === CHILDREN) {
523
- if (node.nodes) {
524
- node.each(child => {
525
- if (!child[isClean]) this.walkSync(child)
526
- })
543
+ let stack = [{ eventIndex: 0, events: getEvents(node), iterator: 0, node }]
544
+
545
+ while (stack.length > 0) {
546
+ let visit = stack[stack.length - 1]
547
+ let visitNode = visit.node
548
+
549
+ if (visit.iterator !== 0) {
550
+ let iterator = visit.iterator
551
+ let child
552
+ let descended = false
553
+ while ((child = visitNode.nodes[visitNode.indexes[iterator]])) {
554
+ visitNode.indexes[iterator] += 1
555
+ if (!child[isClean]) {
556
+ child[isClean] = true
557
+ stack.push({
558
+ eventIndex: 0,
559
+ events: getEvents(child),
560
+ iterator: 0,
561
+ node: child
562
+ })
563
+ descended = true
564
+ break
565
+ }
527
566
  }
528
- } else {
529
- let visitors = this.listeners[event]
530
- if (visitors) {
531
- if (this.visitSync(visitors, node.toProxy())) return
567
+ if (descended) continue
568
+ visit.iterator = 0
569
+ delete visitNode.indexes[iterator]
570
+ }
571
+
572
+ if (visit.eventIndex < visit.events.length) {
573
+ let event = visit.events[visit.eventIndex]
574
+ visit.eventIndex += 1
575
+ if (event === CHILDREN) {
576
+ if (visitNode.nodes && visitNode.nodes.length) {
577
+ visit.iterator = visitNode.getIterator()
578
+ }
579
+ } else {
580
+ let visitors = this.listeners[event]
581
+ if (visitors) {
582
+ if (this.visitSync(visitors, visitNode.toProxy())) stack.pop()
583
+ }
532
584
  }
585
+ continue
533
586
  }
587
+
588
+ stack.pop()
534
589
  }
535
590
  }
536
591
 
package/lib/list.d.ts CHANGED
@@ -55,6 +55,6 @@ declare namespace list {
55
55
  }
56
56
  }
57
57
 
58
- declare const list: list.List
58
+ declare let list: list.List
59
59
 
60
60
  export = list
@@ -6,7 +6,6 @@ import Root from './root.js'
6
6
  import Warning from './warning.js'
7
7
 
8
8
  declare namespace NoWorkResult {
9
-
10
9
  export { NoWorkResult_ as default }
11
10
  }
12
11
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  let MapGenerator = require('./map-generator')
4
4
  let parse = require('./parse')
5
- const Result = require('./result')
5
+ let Result = require('./result')
6
6
  let stringify = require('./stringify')
7
7
  let warnOnce = require('./warn-once')
8
8
 
package/lib/node.d.ts CHANGED
@@ -31,12 +31,12 @@ declare namespace Node {
31
31
 
32
32
  export interface Position {
33
33
  /**
34
- * Source line in file. In contrast to `offset` it starts from 1.
34
+ * Source column in file. It starts from 1.
35
35
  */
36
36
  column: number
37
37
 
38
38
  /**
39
- * Source column in file.
39
+ * Source line in file. It starts from 1.
40
40
  */
41
41
  line: number
42
42
 
@@ -126,7 +126,6 @@ declare namespace Node {
126
126
  word?: string
127
127
  }
128
128
 
129
-
130
129
  class Node extends Node_ {}
131
130
  export { Node as default }
132
131
  }