Skip to content

Commit fb24770

Browse files
jonathantnealromainmenke
authored andcommitted
3.0.0
* Update packages without breaking local tests * Update PostCSS Values Parser
1 parent 1a8a2d4 commit fb24770

20 files changed

+124
-112
lines changed

plugins/postcss-env-function/.rollup.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
import babel from 'rollup-plugin-babel';
22

33
export default {
4-
input: 'index.js',
4+
input: 'src/index.js',
55
output: [
66
{ file: 'index.cjs.js', format: 'cjs', sourcemap: true },
7-
{ file: 'index.es.mjs', format: 'es', sourcemap: true }
7+
{ file: 'index.esm.mjs', format: 'es', sourcemap: true }
88
],
99
plugins: [
1010
babel({
1111
plugins: [
1212
'@babel/plugin-syntax-dynamic-import'
1313
],
1414
presets: [
15-
['@babel/env', { modules: false, targets: { node: 6 } }]
15+
['@babel/env', { modules: false, targets: { node: 8 } }]
1616
]
1717
})
1818
]

plugins/postcss-env-function/.tape.js

+67-69
Original file line numberDiff line numberDiff line change
@@ -1,88 +1,86 @@
11
module.exports = {
2-
'postcss-env-function': {
3-
'basic': {
4-
message: 'supports basic usage'
5-
},
6-
'basic:import': {
7-
message: 'supports { importFrom: { environmentVariables: { ... } } } usage',
8-
options: {
9-
importFrom: {
2+
'basic': {
3+
message: 'supports basic usage'
4+
},
5+
'basic:import': {
6+
message: 'supports { importFrom: { environmentVariables: { ... } } } usage',
7+
options: {
8+
importFrom: {
9+
environmentVariables: {
10+
'--some-custom-padding': '20px',
11+
'--another-custom-width': '600px'
12+
}
13+
}
14+
}
15+
},
16+
'basic:import-fn': {
17+
message: 'supports { importFrom() } usage',
18+
options: {
19+
importFrom() {
20+
return {
1021
environmentVariables: {
1122
'--some-custom-padding': '20px',
1223
'--another-custom-width': '600px'
1324
}
14-
}
25+
};
1526
}
1627
},
17-
'basic:import-fn': {
18-
message: 'supports { importFrom() } usage',
19-
options: {
20-
importFrom() {
21-
return {
28+
expect: 'basic.import.expect.css',
29+
result: 'basic.import.result.css'
30+
},
31+
'basic:import-fn-promise': {
32+
message: 'supports { async importFrom() } usage',
33+
options: {
34+
importFrom() {
35+
return new Promise(resolve => {
36+
resolve({
2237
environmentVariables: {
2338
'--some-custom-padding': '20px',
2439
'--another-custom-width': '600px'
2540
}
26-
};
27-
}
28-
},
29-
expect: 'basic.import.expect.css',
30-
result: 'basic.import.result.css'
31-
},
32-
'basic:import-fn-promise': {
33-
message: 'supports { async importFrom() } usage',
34-
options: {
35-
importFrom() {
36-
return new Promise(resolve => {
37-
resolve({
38-
environmentVariables: {
39-
'--some-custom-padding': '20px',
40-
'--another-custom-width': '600px'
41-
}
42-
})
43-
});
44-
}
45-
},
46-
expect: 'basic.import.expect.css',
47-
result: 'basic.import.result.css'
41+
})
42+
});
43+
}
4844
},
49-
'basic:import-json': {
50-
message: 'supports { importFrom: "test/import-variables.json" } usage',
51-
options: {
52-
importFrom: 'test/import-variables.json'
53-
},
54-
expect: 'basic.import.expect.css',
55-
result: 'basic.import.result.css'
45+
expect: 'basic.import.expect.css',
46+
result: 'basic.import.result.css'
47+
},
48+
'basic:import-json': {
49+
message: 'supports { importFrom: "test/import-variables.json" } usage',
50+
options: {
51+
importFrom: 'test/import-variables.json'
5652
},
57-
'basic:import-js': {
58-
message: 'supports { importFrom: "test/import-variables.js" } usage',
59-
options: {
60-
importFrom: 'test/import-variables.js'
61-
},
62-
expect: 'basic.import.expect.css',
63-
result: 'basic.import.result.css'
53+
expect: 'basic.import.expect.css',
54+
result: 'basic.import.result.css'
55+
},
56+
'basic:import-js': {
57+
message: 'supports { importFrom: "test/import-variables.js" } usage',
58+
options: {
59+
importFrom: 'test/import-variables.js'
6460
},
65-
'basic:import-js-from': {
66-
message: 'supports { importFrom: { from: "test/import-variables.js" } } usage',
67-
options: {
68-
importFrom: { from: 'test/import-variables.js' }
69-
},
70-
expect: 'basic.import.expect.css',
71-
result: 'basic.import.result.css'
61+
expect: 'basic.import.expect.css',
62+
result: 'basic.import.result.css'
63+
},
64+
'basic:import-js-from': {
65+
message: 'supports { importFrom: { from: "test/import-variables.js" } } usage',
66+
options: {
67+
importFrom: { from: 'test/import-variables.js' }
7268
},
73-
'basic:import-js-from-type': {
74-
message: 'supports { importFrom: [ { from: "test/import-variables.js", type: "js" } ] } usage',
75-
options: {
76-
importFrom: [ { from: 'test/import-variables.js', type: 'js' } ]
77-
},
78-
expect: 'basic.import.expect.css',
79-
result: 'basic.import.result.css'
69+
expect: 'basic.import.expect.css',
70+
result: 'basic.import.result.css'
71+
},
72+
'basic:import-js-from-type': {
73+
message: 'supports { importFrom: [ { from: "test/import-variables.js", type: "js" } ] } usage',
74+
options: {
75+
importFrom: [ { from: 'test/import-variables.js', type: 'js' } ]
8076
},
81-
'basic:import-is-empty': {
82-
message: 'supports { importFrom: {} } usage',
83-
options: {
84-
importFrom: {}
85-
}
77+
expect: 'basic.import.expect.css',
78+
result: 'basic.import.result.css'
79+
},
80+
'basic:import-is-empty': {
81+
message: 'supports { importFrom: {} } usage',
82+
options: {
83+
importFrom: {}
8684
}
8785
}
8886
};

plugins/postcss-env-function/.travis.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
language: node_js
44

55
node_js:
6-
- 6
6+
- 8
77

88
install:
99
- npm install --ignore-scripts

plugins/postcss-env-function/CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Changes to PostCSS Environment Variables
22

3+
### 3.0.0 (June 13, 2019)
4+
5+
- Updated: `postcss-values-parser` to 3.0.4 (major)
6+
- Updated: `postcss` to 7.0.17 (patch)
7+
38
### 2.0.2 (September 20, 2018)
49

510
- Updated: Do not break on an empty importFrom object

plugins/postcss-env-function/CONTRIBUTING.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ scope and avoid unrelated commits.
2626
cd postcss-env-function
2727

2828
# Assign the original repo to a remote called "upstream"
29-
git remote add upstream git@github.com:jonathantneal/postcss-env-function.git
29+
git remote add upstream git@github.com:csstools/postcss-env-function.git
3030

3131
# Install the tools necessary for testing
3232
npm install

plugins/postcss-env-function/INSTALL.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,6 @@ grunt.initConfig({
165165
[PostCSS]: https://github.com/postcss/postcss
166166
[PostCSS CLI]: https://github.com/postcss/postcss-cli
167167
[PostCSS Loader]: https://github.com/postcss/postcss-loader
168-
[PostCSS Environment Variables]: https://github.com/jonathantneal/postcss-env-function
168+
[PostCSS Environment Variables]: https://github.com/csstools/postcss-env-function
169169
[React App Rewire PostCSS]: https://github.com/csstools/react-app-rewire-postcss
170170
[React App Rewired]: https://github.com/timarney/react-app-rewired

plugins/postcss-env-function/README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,8 @@ postcssCustomProperties({
123123
See example imports written in [JS](test/import-variables.js) and
124124
[JSON](test/import-variables.json).
125125

126-
[cli-img]: https://img.shields.io/travis/jonathantneal/postcss-env-function.svg
127-
[cli-url]: https://travis-ci.org/jonathantneal/postcss-env-function
126+
[cli-img]: https://img.shields.io/travis/csstools/postcss-env-function/master.svg
127+
[cli-url]: https://travis-ci.org/csstools/postcss-env-function
128128
[css-img]: https://cssdb.org/badge/environment-variables.svg
129129
[css-url]: https://cssdb.org/#environment-variables
130130
[git-img]: https://img.shields.io/badge/support-chat-blue.svg
@@ -134,4 +134,4 @@ See example imports written in [JS](test/import-variables.js) and
134134

135135
[CSS Environment Variables]: https://drafts.csswg.org/css-env-1/
136136
[PostCSS]: https://github.com/postcss/postcss
137-
[PostCSS Environment Variables]: https://github.com/jonathantneal/postcss-env-function
137+
[PostCSS Environment Variables]: https://github.com/csstools/postcss-env-function

plugins/postcss-env-function/lib/is-env-func.js

-2
This file was deleted.

plugins/postcss-env-function/package.json

+34-25
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,59 @@
11
{
22
"name": "postcss-env-function",
3-
"version": "2.0.2",
3+
"version": "3.0.0",
44
"description": "Use env() variables in CSS",
55
"author": "Jonathan Neal <jonathantneal@hotmail.com>",
66
"license": "CC0-1.0",
7-
"repository": "jonathantneal/postcss-env-function",
8-
"homepage": "https://github.com/jonathantneal/postcss-env-function#readme",
9-
"bugs": "https://github.com/jonathantneal/postcss-env-function/issues",
7+
"repository": "csstools/postcss-env-function",
8+
"homepage": "https://github.com/csstools/postcss-env-function#readme",
9+
"bugs": "https://github.com/csstools/postcss-env-function/issues",
1010
"main": "index.cjs.js",
11-
"module": "index.es.mjs",
11+
"module": "index.esm.mjs",
1212
"files": [
1313
"index.cjs.js",
1414
"index.cjs.js.map",
15-
"index.es.mjs",
16-
"index.es.mjs.map"
15+
"index.esm.mjs",
16+
"index.esm.mjs.map"
1717
],
1818
"scripts": {
1919
"prepublishOnly": "npm test",
20-
"pretest": "rollup -c .rollup.js --silent",
21-
"test": "echo 'Running tests...'; npm run test:js && npm run test:tape",
22-
"test:ec": "echint --ignore index.*.js test",
23-
"test:js": "eslint *.js --cache --ignore-path .gitignore --quiet",
20+
"pretest:tape": "rollup -c .rollup.js --silent",
21+
"test": "npm run test:js && npm run test:tape",
22+
"test:js": "eslint src/{*,**/*}.js --cache --ignore-path .gitignore --quiet",
2423
"test:tape": "postcss-tape"
2524
},
2625
"engines": {
27-
"node": ">=6.0.0"
26+
"node": ">=8.0.0"
2827
},
2928
"dependencies": {
30-
"postcss": "^7.0.2",
31-
"postcss-values-parser": "^2.0.0"
29+
"postcss": "^7.0.17",
30+
"postcss-values-parser": "^3.0.4"
3231
},
3332
"devDependencies": {
34-
"@babel/core": "^7.1.0",
35-
"@babel/plugin-syntax-dynamic-import": "^7.0.0",
36-
"@babel/preset-env": "^7.1.0",
37-
"babel-eslint": "^9.0.0",
38-
"eslint": "^5.6.0",
39-
"eslint-config-dev": "^2.0.0",
40-
"postcss-tape": "^2.2.0",
33+
"@babel/core": "^7.4.5",
34+
"@babel/plugin-syntax-dynamic-import": "^7.2.0",
35+
"@babel/preset-env": "^7.4.5",
36+
"babel-eslint": "^10.0.1",
37+
"eslint": "^5.16.0",
38+
"postcss-tape": "^5.0.0",
4139
"pre-commit": "^1.2.2",
42-
"rollup": "^0.66.1",
43-
"rollup-plugin-babel": "^4.0.3"
40+
"rollup": "^1.15.3",
41+
"rollup-plugin-babel": "^4.3.2"
4442
},
4543
"eslintConfig": {
46-
"extends": "dev",
47-
"parser": "babel-eslint"
44+
"env": {
45+
"browser": true,
46+
"es6": true,
47+
"node": true
48+
},
49+
"extends": "eslint:recommended",
50+
"parser": "babel-eslint",
51+
"parserOptions": {
52+
"ecmaVersion": 2018,
53+
"impliedStrict": true,
54+
"sourceType": "module"
55+
},
56+
"root": true
4857
},
4958
"keywords": [
5059
"postcss",

plugins/postcss-env-function/lib/get-fn-value.js renamed to plugins/postcss-env-function/src/lib/get-fn-value.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ const dashedMatch = /^--/;
22

33
// returns the value of a css function as a string
44
export default (node) => {
5-
const value = String(node.nodes.slice(1, -1));
5+
const value = String(node.nodes);
66

77
return dashedMatch.test(value) ? value : undefined;
88
};

plugins/postcss-env-function/lib/get-replaced-value.js renamed to plugins/postcss-env-function/src/lib/get-replaced-value.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
import parser from 'postcss-values-parser';
1+
import { parse } from 'postcss-values-parser';
22
import updateEnvValue from './update-env-value';
33
import walkEnvFuncs from './walk-env-funcs';
44

55
// returns a value replaced with environment variables
66
export default (originalValue, variables) => {
77
// get the ast of the original value
8-
const ast = parser(originalValue).parse();
8+
const ast = parse(originalValue);
99

1010
// walk all of the css env() functions
1111
walkEnvFuncs(ast, node => {

plugins/postcss-env-function/lib/get-supported-value.js renamed to plugins/postcss-env-function/src/lib/get-supported-value.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ import isAtrule from './is-atrule';
22
import isDecl from './is-decl';
33

44
// returns a value from an at-rule or declaration
5-
export default (node) => isAtrule(node) && node.params || isDecl(node) && node.value;
5+
export default (node) => isAtrule(node) ? node.params : isDecl(node) ? node.value : null;

plugins/postcss-env-function/lib/import-from.js renamed to plugins/postcss-env-function/src/lib/import-from.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import fs from 'fs';
22
import path from 'path';
3-
import valueParser from 'postcss-values-parser';
3+
import { parse } from 'postcss-values-parser';
44

55
/* Import Custom Properties from Object
66
/* ========================================================================== */
@@ -12,7 +12,7 @@ function importEnvironmentVariablesFromObject(object) {
1212
);
1313

1414
for (const key in environmentVariables) {
15-
environmentVariables[key] = valueParser(environmentVariables[key]).parse().nodes;
15+
environmentVariables[key] = parse(environmentVariables[key]).nodes;
1616
}
1717

1818
return environmentVariables;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
// returns whether a node is a css env() function
2+
export default (node) => node && node.type === 'func' && node.name === 'env';

plugins/postcss-env-function/lib/walk-env-funcs.js renamed to plugins/postcss-env-function/src/lib/walk-env-funcs.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import isEnvFunc from './is-env-func';
22

33
// walks a node recursively and runs a function using its children
4-
export default function walk(node, fn) {
4+
export default function walk (node, fn) {
55
node.nodes.slice(0).forEach(childNode => {
66
if (childNode.nodes) {
77
walk(childNode, fn);

0 commit comments

Comments
 (0)