Skip to content

Commit 45e2b8f

Browse files
jonathantnealromainmenke
authored andcommitted
5.0.0
1 parent fb9cbfd commit 45e2b8f

19 files changed

Lines changed: 265 additions & 159 deletions
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# https://www.appveyor.com/docs/appveyor-yml
2+
3+
environment:
4+
matrix:
5+
- nodejs_version: 4
6+
7+
version: "{build}"
8+
build: off
9+
deploy: off
10+
11+
install:
12+
- ps: Install-Product node $env:nodejs_version
13+
- npm install --ignore-scripts
14+
15+
test_script:
16+
- node --version
17+
- npm --version
18+
- cmd: "npm test"

plugins/postcss-nesting/.gitignore

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
node_modules
2+
index.*.js
23
package-lock.json
4+
*.log*
5+
*.result.css
36
.*
47
!.appveyor.yml
58
!.editorconfig
69
!.gitignore
10+
!.rollup.js
711
!.tape.js
812
!.travis.yml
9-
*.log*
10-
*.result.css

plugins/postcss-nesting/.rollup.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import babel from 'rollup-plugin-babel';
2+
3+
export default {
4+
input: 'index.js',
5+
output: [
6+
{ file: 'index.cjs.js', format: 'cjs' },
7+
{ file: 'index.es.js', format: 'es' }
8+
],
9+
plugins: [
10+
babel({
11+
presets: [
12+
['env', { modules: false, targets: { node: 4 } }]
13+
]
14+
})
15+
]
16+
};
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
# https://docs.travis-ci.com/user/travis-lint
22

33
language: node_js
4+
45
node_js:
56
- 4
7+
68
install:
79
- npm install --ignore-scripts

plugins/postcss-nesting/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changes to PostCSS Nesting
22

3+
### 5.0.0 (March 24, 2018)
4+
5+
- Refactored code to use Imports babel-transformed for Node v4 compatibility
6+
37
### 4.2.1 (September 19, 2017)
48

59
- Updated: Exposing the transform function as its own for postcss-extend

plugins/postcss-nesting/LICENSE.md

Lines changed: 67 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -30,77 +30,79 @@ effect of CC0 on those rights.
3030
protected by copyright and related or neighboring rights (“Copyright and
3131
Related Rights”). Copyright and Related Rights include, but are not limited
3232
to, the following:
33-
1. the right to reproduce, adapt, distribute, perform, display,
34-
communicate, and translate a Work;
35-
2. moral rights retained by the original author(s) and/or performer(s);
36-
3. publicity and privacy rights pertaining to a person’s image or likeness
37-
depicted in a Work;
38-
4. rights protecting against unfair competition in regards to a Work,
39-
subject to the limitations in paragraph 4(i), below;
40-
5. rights protecting the extraction, dissemination, use and reuse of data
41-
in a Work;
42-
6. database rights (such as those arising under Directive 96/9/EC of the
43-
European Parliament and of the Council of 11 March 1996 on the legal
44-
protection of databases, and under any national implementation thereof,
45-
including any amended or successor version of such directive); and
46-
7. other similar, equivalent or corresponding rights throughout the world
47-
based on applicable law or treaty, and any national implementations
48-
thereof.
33+
1. the right to reproduce, adapt, distribute, perform, display, communicate,
34+
and translate a Work;
35+
2. moral rights retained by the original author(s) and/or performer(s);
36+
3. publicity and privacy rights pertaining to a person’s image or likeness
37+
depicted in a Work;
38+
4. rights protecting against unfair competition in regards to a Work,
39+
subject to the limitations in paragraph 4(i), below;
40+
5. rights protecting the extraction, dissemination, use and reuse of data in
41+
a Work;
42+
6. database rights (such as those arising under Directive 96/9/EC of the
43+
European Parliament and of the Council of 11 March 1996 on the legal
44+
protection of databases, and under any national implementation thereof,
45+
including any amended or successor version of such directive); and
46+
7. other similar, equivalent or corresponding rights throughout the world
47+
based on applicable law or treaty, and any national implementations
48+
thereof.
4949

5050
2. Waiver. To the greatest extent permitted by, but not in contravention of,
51-
applicable law, Affirmer hereby overtly, fully, permanently, irrevocably and
52-
unconditionally waives, abandons, and surrenders all of Affirmer’s Copyright
53-
and Related Rights and associated claims and causes of action, whether now
54-
known or unknown (including existing as well as future claims and causes of
55-
action), in the Work (i) in all territories worldwide, (ii) for the maximum
56-
duration provided by applicable law or treaty (including future time
57-
extensions), (iii) in any current or future medium and for any number of
58-
copies, and (iv) for any purpose whatsoever, including without limitation
59-
commercial, advertising or promotional purposes (the “Waiver”). Affirmer makes
60-
the Waiver for the benefit of each member of the public at large and to the
61-
detriment of Affirmer’s heirs and successors, fully intending that such Waiver
62-
shall not be subject to revocation, rescission, cancellation, termination, or
63-
any other legal or equitable action to disrupt the quiet enjoyment of the Work
64-
by the public as contemplated by Affirmer’s express Statement of Purpose.
51+
applicable law, Affirmer hereby overtly, fully, permanently, irrevocably and
52+
unconditionally waives, abandons, and surrenders all of Affirmer’s Copyright
53+
and Related Rights and associated claims and causes of action, whether now
54+
known or unknown (including existing as well as future claims and causes of
55+
action), in the Work (i) in all territories worldwide, (ii) for the maximum
56+
duration provided by applicable law or treaty (including future time
57+
extensions), (iii) in any current or future medium and for any number of
58+
copies, and (iv) for any purpose whatsoever, including without limitation
59+
commercial, advertising or promotional purposes (the “Waiver”). Affirmer
60+
makes the Waiver for the benefit of each member of the public at large and
61+
to the detriment of Affirmer’s heirs and successors, fully intending that
62+
such Waiver shall not be subject to revocation, rescission, cancellation,
63+
termination, or any other legal or equitable action to disrupt the quiet
64+
enjoyment of the Work by the public as contemplated by Affirmer’s express
65+
Statement of Purpose.
6566

6667
3. Public License Fallback. Should any part of the Waiver for any reason be
67-
judged legally invalid or ineffective under applicable law, then the Waiver
68-
shall be preserved to the maximum extent permitted taking into account
69-
Affirmer’s express Statement of Purpose. In addition, to the extent the Waiver
70-
is so judged Affirmer hereby grants to each affected person a royalty-free, non
71-
transferable, non sublicensable, non exclusive, irrevocable and unconditional
72-
license to exercise Affirmer’s Copyright and Related Rights in the Work (i) in
73-
all territories worldwide, (ii) for the maximum duration provided by applicable
74-
law or treaty (including future time extensions), (iii) in any current or
75-
future medium and for any number of copies, and (iv) for any purpose
76-
whatsoever, including without limitation commercial, advertising or promotional
77-
purposes (the “License”). The License shall be deemed effective as of the date
78-
CC0 was applied by Affirmer to the Work. Should any part of the License for any
79-
reason be judged legally invalid or ineffective under applicable law, such
80-
partial invalidity or ineffectiveness shall not invalidate the remainder of the
81-
License, and in such case Affirmer hereby affirms that he or she will not (i)
82-
exercise any of his or her remaining Copyright and Related Rights in the Work
83-
or (ii) assert any associated claims and causes of action with respect to the
84-
Work, in either case contrary to Affirmer’s express Statement of Purpose.
68+
judged legally invalid or ineffective under applicable law, then the Waiver
69+
shall be preserved to the maximum extent permitted taking into account
70+
Affirmer’s express Statement of Purpose. In addition, to the extent the
71+
Waiver is so judged Affirmer hereby grants to each affected person a
72+
royalty-free, non transferable, non sublicensable, non exclusive,
73+
irrevocable and unconditional license to exercise Affirmer’s Copyright and
74+
Related Rights in the Work (i) in all territories worldwide, (ii) for the
75+
maximum duration provided by applicable law or treaty (including future time
76+
extensions), (iii) in any current or future medium and for any number of
77+
copies, and (iv) for any purpose whatsoever, including without limitation
78+
commercial, advertising or promotional purposes (the “License”). The License
79+
shall be deemed effective as of the date CC0 was applied by Affirmer to the
80+
Work. Should any part of the License for any reason be judged legally
81+
invalid or ineffective under applicable law, such partial invalidity or
82+
ineffectiveness shall not invalidate the remainder of the License, and in
83+
such case Affirmer hereby affirms that he or she will not (i) exercise any
84+
of his or her remaining Copyright and Related Rights in the Work or (ii)
85+
assert any associated claims and causes of action with respect to the Work,
86+
in either case contrary to Affirmer’s express Statement of Purpose.
8587

8688
4. Limitations and Disclaimers.
87-
1. No trademark or patent rights held by Affirmer are waived, abandoned,
88-
surrendered, licensed or otherwise affected by this document.
89-
2. Affirmer offers the Work as-is and makes no representations or
90-
warranties of any kind concerning the Work, express, implied, statutory
91-
or otherwise, including without limitation warranties of title,
92-
merchantability, fitness for a particular purpose, non infringement, or
93-
the absence of latent or other defects, accuracy, or the present or
94-
absence of errors, whether or not discoverable, all to the greatest
95-
extent permissible under applicable law.
96-
3. Affirmer disclaims responsibility for clearing rights of other persons
97-
that may apply to the Work or any use thereof, including without
98-
limitation any person’s Copyright and Related Rights in the Work.
99-
Further, Affirmer disclaims responsibility for obtaining any necessary
100-
consents, permissions or other rights required for any use of the Work.
101-
4. Affirmer understands and acknowledges that Creative Commons is not a
102-
party to this document and has no duty or obligation with respect to
103-
this CC0 or use of the Work.
89+
1. No trademark or patent rights held by Affirmer are waived, abandoned,
90+
surrendered, licensed or otherwise affected by this document.
91+
2. Affirmer offers the Work as-is and makes no representations or warranties
92+
of any kind concerning the Work, express, implied, statutory or
93+
otherwise, including without limitation warranties of title,
94+
merchantability, fitness for a particular purpose, non infringement, or
95+
the absence of latent or other defects, accuracy, or the present or
96+
absence of errors, whether or not discoverable, all to the greatest
97+
extent permissible under applicable law.
98+
3. Affirmer disclaims responsibility for clearing rights of other persons
99+
that may apply to the Work or any use thereof, including without
100+
limitation any person’s Copyright and Related Rights in the Work.
101+
Further, Affirmer disclaims responsibility for obtaining any necessary
102+
consents, permissions or other rights required for any use of the Work.
103+
4. Affirmer understands and acknowledges that Creative Commons is not a
104+
party to this document and has no duty or obligation with respect to this
105+
CC0 or use of the Work.
104106

105107
For more information, please see
106108
http://creativecommons.org/publicdomain/zero/1.0/.

plugins/postcss-nesting/README.md

Lines changed: 65 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
# PostCSS Nesting [<img src="https://postcss.github.io/postcss/logo.svg" alt="PostCSS Logo" width="90" height="90" align="right">][postcss]
22

3-
[![CSS Standard Status][css-img]][css-url]
43
[![NPM Version][npm-img]][npm-url]
4+
[![CSS Standard Status][css-img]][css-url]
55
[![Build Status][cli-img]][cli-url]
6-
[![Licensing][lic-img]][lic-url]
7-
[![Gitter Chat][git-img]][git-url]
6+
[![Windows Build Status][win-img]][win-url]
7+
[![Support Chat][git-img]][git-url]
88

99
[PostCSS Nesting] lets you nest style rules inside each other, following the
1010
[CSS Nesting] specification.
1111

12-
```css
12+
```pcss
1313
a, b {
1414
color: red;
1515
@@ -18,7 +18,7 @@ a, b {
1818
}
1919
}
2020
21-
/* after postcss-nesting */
21+
/* becomes */
2222
2323
a, b {
2424
color: red;
@@ -42,7 +42,9 @@ npm install postcss-nesting --save-dev
4242
Use [PostCSS Nesting] to process your CSS:
4343

4444
```js
45-
require('postcss-nesting').process(YOUR_CSS, { /* options */ });
45+
import postcssNesting from 'postcss-nesting';
46+
47+
postcssNesting.process(YOUR_CSS);
4648
```
4749

4850
#### PostCSS
@@ -56,9 +58,46 @@ npm install postcss --save-dev
5658
Use [PostCSS Nesting] as a plugin:
5759

5860
```js
61+
import postcss from 'gulp-postcss';
62+
import postcssNesting from 'postcss-nesting';
63+
5964
postcss([
60-
require('postcss-nesting')({ /* options */ })
61-
]).process(YOUR_CSS, /* options */);
65+
postcssNesting(/* options */)
66+
]).process(YOUR_CSS);
67+
```
68+
69+
#### Webpack
70+
71+
Add [PostCSS Loader] to your build tool:
72+
73+
```bash
74+
npm install postcss-loader --save-dev
75+
```
76+
77+
Use [PostCSS Nesting] in your Webpack configuration:
78+
79+
```js
80+
import postcssNesting from 'postcss-nesting';
81+
82+
export default {
83+
module: {
84+
rules: [
85+
{
86+
test: /\.css$/,
87+
use: [
88+
'style-loader',
89+
{ loader: 'css-loader', options: { importLoaders: 1 } },
90+
{ loader: 'postcss-loader', options: {
91+
ident: 'postcss',
92+
plugins: () => [
93+
postcssNesting(/* options */)
94+
]
95+
} }
96+
]
97+
}
98+
]
99+
}
100+
}
62101
```
63102

64103
#### Gulp
@@ -72,17 +111,16 @@ npm install gulp-postcss --save-dev
72111
Use [PostCSS Nesting] in your Gulpfile:
73112

74113
```js
75-
var postcss = require('gulp-postcss');
76-
77-
gulp.task('css', function () {
78-
return gulp.src('./src/*.css').pipe(
79-
postcss([
80-
require('postcss-nesting')({ /* options */ })
81-
])
82-
).pipe(
83-
gulp.dest('.')
84-
);
85-
});
114+
import postcss from 'gulp-postcss';
115+
import postcssNesting from 'postcss-nesting';
116+
117+
gulp.task('css', () => gulp.src('./src/*.css').pipe(
118+
postcss([
119+
postcssNesting(/* options */)
120+
])
121+
).pipe(
122+
gulp.dest('.')
123+
));
86124
```
87125

88126
#### Grunt
@@ -96,13 +134,15 @@ npm install grunt-postcss --save-dev
96134
Use [PostCSS Nesting] in your Gruntfile:
97135

98136
```js
137+
import postcssNesting from 'postcss-nesting';
138+
99139
grunt.loadNpmTasks('grunt-postcss');
100140

101141
grunt.initConfig({
102142
postcss: {
103143
options: {
104144
use: [
105-
require('postcss-nesting')({ /* options */ })
145+
postcssNesting(/* options */)
106146
]
107147
},
108148
dist: {
@@ -114,17 +154,18 @@ grunt.initConfig({
114154

115155
[cli-url]: https://travis-ci.org/jonathantneal/postcss-nesting
116156
[cli-img]: https://img.shields.io/travis/jonathantneal/postcss-nesting.svg
117-
[css-img]: https://jonathantneal.github.io/css-db/badge/css-nesting.svg
118-
[css-url]: https://jonathantneal.github.io/css-db/#css-nesting
157+
[css-img]: https://jonathantneal.github.io/cssdb/badge/nesting-rules.svg
158+
[css-url]: https://jonathantneal.github.io/cssdb/#nesting-rules
119159
[git-url]: https://gitter.im/postcss/postcss
120160
[git-img]: https://img.shields.io/badge/chat-gitter-blue.svg
121-
[lic-url]: LICENSE.md
122-
[lic-img]: https://img.shields.io/npm/l/postcss-nesting.svg
123161
[npm-url]: https://www.npmjs.com/package/postcss-nesting
124162
[npm-img]: https://img.shields.io/npm/v/postcss-nesting.svg
163+
[win-img]: https://img.shields.io/appveyor/ci/jonathantneal/postcss-nesting.svg
164+
[win-url]: https://ci.appveyor.com/project/jonathantneal/postcss-nesting
125165

126166
[CSS Nesting]: http://tabatkins.github.io/specs/css-nesting/
127167
[Gulp PostCSS]: https://github.com/postcss/gulp-postcss
128168
[Grunt PostCSS]: https://github.com/nDmitry/grunt-postcss
129169
[PostCSS]: https://github.com/postcss/postcss
170+
[PostCSS Loader]: https://github.com/postcss/postcss-loader
130171
[PostCSS Nesting]: https://github.com/jonathantneal/postcss-nesting

plugins/postcss-nesting/index.js

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,4 @@
1-
'use strict';
1+
import postcss from 'postcss';
2+
import transform from './lib/transform';
23

3-
// tooling
4-
const postcss = require('postcss');
5-
const transform = require('./lib/transform');
6-
7-
// plugin
8-
module.exports = postcss.plugin('postcss-nesting', () => {
9-
return (root) => root.walk(transform);
10-
});
4+
export default postcss.plugin('postcss-nesting', () => root => root.walk(transform));

plugins/postcss-nesting/lib/clean-node.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// clean the raws of the node
2-
module.exports = (node) => {
2+
export default node => {
33
node.raws = Object.assign(
44
node.raws.between ? { between: node.raws.between } : {},
55
node.raws.semicolon ? { semicolon: true } : {},

0 commit comments

Comments
 (0)