postcss 8.3.3 → 8.3.7

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
@@ -89,8 +89,7 @@ If you have any new ideas, [PostCSS plugin development] is really easy.
89
89
 
90
90
  ### Better CSS Readability
91
91
 
92
- * [`precss`] contains plugins for Sass-like features, like variables, nesting,
93
- and mixins.
92
+ * [`postcss-nested`] unwraps nested rules the way Sass does.
94
93
  * [`postcss-sorting`] sorts the content of rules and at-rules.
95
94
  * [`postcss-utilities`] includes the most commonly used shortcuts and helpers.
96
95
  * [`short`] adds and extends numerous shorthand properties.
@@ -146,7 +145,7 @@ If you have any new ideas, [PostCSS plugin development] is really easy.
146
145
  [`stylelint`]: https://github.com/stylelint/stylelint
147
146
  [`stylefmt`]: https://github.com/morishitter/stylefmt
148
147
  [`cssnano`]: https://cssnano.co/
149
- [`precss`]: https://github.com/jonathantneal/precss
148
+ [`postcss-nested`]: https://github.com/postcss/postcss-nested
150
149
  [`doiuse`]: https://github.com/anandthakker/doiuse
151
150
  [`rtlcss`]: https://github.com/MohammadYounes/rtlcss
152
151
  [`short`]: https://github.com/jonathantneal/postcss-short
@@ -310,8 +309,8 @@ Then create `postcss.config.js`:
310
309
  ```js
311
310
  module.exports = {
312
311
  plugins: [
313
- require('precss'),
314
- require('autoprefixer')
312
+ require('autoprefixer'),
313
+ require('postcss-nested')
315
314
  ]
316
315
  }
317
316
  ```
@@ -330,7 +329,7 @@ gulp.task('css', () => {
330
329
 
331
330
  return gulp.src('src/**/*.css')
332
331
  .pipe( sourcemaps.init() )
333
- .pipe( postcss([ require('precss'), require('autoprefixer') ]) )
332
+ .pipe( postcss([ require('autoprefixer'), require('postcss-nested') ]) )
334
333
  .pipe( sourcemaps.write('.') )
335
334
  .pipe( gulp.dest('build/') )
336
335
  })
@@ -410,11 +409,11 @@ For other environments, you can use the JS API:
410
409
  ```js
411
410
  const autoprefixer = require('autoprefixer')
412
411
  const postcss = require('postcss')
413
- const precss = require('precss')
412
+ const postcssNested = require('postcss-nested')
414
413
  const fs = require('fs')
415
414
 
416
415
  fs.readFile('src/app.css', (err, css) => {
417
- postcss([precss, autoprefixer])
416
+ postcss([autoprefixer, postcssNested])
418
417
  .process(css, { from: 'src/app.css', to: 'dest/app.css' })
419
418
  .then(result => {
420
419
  fs.writeFile('dest/app.css', result.css, () => true)
package/lib/container.js CHANGED
@@ -422,6 +422,8 @@ Container.rebuild = node => {
422
422
  Object.setPrototypeOf(node, Comment.prototype)
423
423
  }
424
424
 
425
+ node[my] = true
426
+
425
427
  if (node.nodes) {
426
428
  node.nodes.forEach(child => {
427
429
  Container.rebuild(child)
@@ -1,6 +1,6 @@
1
1
  'use strict'
2
2
 
3
- let { red, bold, gray, options: colorette } = require('colorette')
3
+ let { red, bold, gray, isColorSupported } = require('nanocolors')
4
4
 
5
5
  let terminalHighlight = require('./terminal-highlight')
6
6
 
@@ -44,7 +44,7 @@ class CssSyntaxError extends Error {
44
44
  if (!this.source) return ''
45
45
 
46
46
  let css = this.source
47
- if (color == null) color = colorette.enabled
47
+ if (color == null) color = isColorSupported
48
48
  if (terminalHighlight) {
49
49
  if (color) css = terminalHighlight(css)
50
50
  }
@@ -136,7 +136,10 @@ class LazyResult {
136
136
  this.error = error
137
137
  }
138
138
 
139
- if (root && !root[my]) Container.rebuild(root)
139
+ if (root && !root[my]) {
140
+ // istanbul ignore next
141
+ Container.rebuild(root)
142
+ }
140
143
  }
141
144
 
142
145
  this.result = new Result(processor, root, opts)
package/lib/node.js CHANGED
@@ -1,8 +1,8 @@
1
1
  'use strict'
2
2
 
3
+ let { isClean, my } = require('./symbols')
3
4
  let CssSyntaxError = require('./css-syntax-error')
4
5
  let Stringifier = require('./stringifier')
5
- let { isClean } = require('./symbols')
6
6
  let stringify = require('./stringify')
7
7
 
8
8
  function cloneNode(obj, parent) {
@@ -36,6 +36,7 @@ class Node {
36
36
  constructor(defaults = {}) {
37
37
  this.raws = {}
38
38
  this[isClean] = false
39
+ this[my] = true
39
40
 
40
41
  for (let name in defaults) {
41
42
  if (name === 'nodes') {
package/lib/parser.js CHANGED
@@ -552,7 +552,13 @@ class Parser {
552
552
  if (founded === 2) break
553
553
  }
554
554
  }
555
- throw this.input.error('Missed semicolon', token[2])
555
+ // If the token is a word, e.g. `!important`, `red` or any other valid property's value.
556
+ // Then we need to return the colon after that word token. [3] is the "end" colon of that word.
557
+ // And because we need it after that one we do +1 to get the next one.
558
+ throw this.input.error(
559
+ 'Missed semicolon',
560
+ token[0] === 'word' ? token[3] + 1 : token[2]
561
+ )
556
562
  }
557
563
  }
558
564
 
package/lib/processor.js CHANGED
@@ -6,7 +6,7 @@ let Root = require('./root')
6
6
 
7
7
  class Processor {
8
8
  constructor(plugins = []) {
9
- this.version = '8.3.3'
9
+ this.version = '8.3.7'
10
10
  this.plugins = this.normalize(plugins)
11
11
  }
12
12
 
@@ -1,6 +1,6 @@
1
1
  'use strict'
2
2
 
3
- let { cyan, gray, green, yellow, magenta } = require('colorette')
3
+ let { cyan, gray, green, yellow, magenta } = require('nanocolors')
4
4
 
5
5
  let tokenizer = require('./tokenize')
6
6
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "postcss",
3
- "version": "8.3.3",
3
+ "version": "8.3.7",
4
4
  "description": "Tool for transforming styles with JS plugins",
5
5
  "engines": {
6
6
  "node": "^10 || ^12 || >=14"
@@ -60,15 +60,17 @@
60
60
  "license": "MIT",
61
61
  "homepage": "https://postcss.org/",
62
62
  "repository": "postcss/postcss",
63
+ "bugs": {
64
+ "url": "https://github.com/postcss/postcss/issues"
65
+ },
63
66
  "dependencies": {
64
- "colorette": "^1.2.2",
65
- "nanoid": "^3.1.23",
67
+ "nanocolors": "^0.1.5",
68
+ "nanoid": "^3.1.25",
66
69
  "source-map-js": "^0.6.2"
67
70
  },
68
71
  "browser": {
69
72
  "./lib/terminal-highlight": false,
70
73
  "source-map-js": false,
71
- "colorette": false,
72
74
  "path": false,
73
75
  "url": false,
74
76
  "fs": false