Skip to content

Commit b79888b

Browse files
chore(deps): update
1 parent 68affb4 commit b79888b

File tree

7 files changed

+2903
-73
lines changed

7 files changed

+2903
-73
lines changed

.eslintrc

+3-18
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,10 @@
11
{
2-
"parser": "babel-eslint",
2+
"parserOptions": {
3+
"ecmaVersion": 2018
4+
},
35
"env": {
46
"node": true
57
},
6-
"ecmaFeatures": {
7-
"arrowFunctions": true,
8-
"blockBindings": true,
9-
"classes": true,
10-
"defaultParams": true,
11-
"destructuring": true,
12-
"forOf": true,
13-
"modules": true,
14-
"objectLiteralComputedProperties": true,
15-
"objectLiteralShorthandMethods": true,
16-
"objectLiteralShorthandProperties": true,
17-
"spread": true,
18-
"superInFunctions": true,
19-
"templateStrings": true,
20-
"unicodeCodePointEscapes": true,
21-
"jsx": true
22-
},
238
"rules": {
249
"quotes": [2, "single"]
2510
}

.travis.yml

+3-5
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
language: node_js
22
node_js:
3-
- "4"
43
- "6"
5-
- "node"
4+
- "8"
5+
- "10"
6+
- "11"
67
script: npm run travis
78

8-
before_install:
9-
- '[ "${TRAVIS_NODE_VERSION}" != "0.10" ] || npm install -g npm'
10-
119
after_success:
1210
- cat ./coverage/lcov.info | node_modules/.bin/coveralls --verbose
1311
- cat ./coverage/coverage.json | node_modules/codecov.io/bin/codecov.io.js

package.json

+19-21
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,20 @@
11
{
22
"name": "postcss-modules-scope",
3-
"version": "1.1.0",
3+
"version": "2.0.0",
44
"description": "A CSS Modules transform to extract export statements from local-scope classes",
5-
"main": "lib/index.js",
5+
"main": "src/index.js",
6+
"engines": {
7+
"node": ">= 6"
8+
},
69
"scripts": {
7-
"lint": "eslint src",
8-
"build": "babel --out-dir lib src",
9-
"watch": "chokidar src -c 'npm run build'",
10-
"test": "mocha --compilers js:babel/register",
11-
"posttest": "npm run lint && npm run build",
12-
"autotest": "chokidar src test -c 'npm test'",
13-
"precover": "npm run lint && npm run build",
14-
"cover": "babel-istanbul cover node_modules/.bin/_mocha",
15-
"travis": "npm run cover -- --report lcovonly",
16-
"prepublish": "npm run build"
10+
"lint": "eslint src test",
11+
"pretest": "yarn lint",
12+
"test": "mocha",
13+
"autotest": "chokidar src test -c 'yarn test'",
14+
"precover": "yarn lint",
15+
"cover": "nyc mocha",
16+
"travis": "yarn cover",
17+
"prepublish": "yarn run test"
1718
},
1819
"repository": {
1920
"type": "git",
@@ -25,7 +26,7 @@
2526
"plugin"
2627
],
2728
"files": [
28-
"lib"
29+
"src"
2930
],
3031
"author": "Glen Maddern",
3132
"license": "ISC",
@@ -35,18 +36,15 @@
3536
"homepage": "https://github.com/css-modules/postcss-modules-scope",
3637
"dependencies": {
3738
"css-selector-tokenizer": "^0.7.0",
38-
"postcss": "^6.0.1"
39+
"postcss": "^7.0.6"
3940
},
4041
"devDependencies": {
41-
"babel": "^5.4.7",
42-
"babel-eslint": "^6.1.2",
43-
"babel-istanbul": "^0.4.0",
44-
"babelify": "^7.1.0",
4542
"chokidar-cli": "^1.0.1",
4643
"codecov.io": "^0.1.2",
47-
"coveralls": "^2.11.2",
44+
"coveralls": "^3.0.2",
4845
"css-selector-parser": "^1.0.4",
49-
"eslint": "^1.5.0",
50-
"mocha": "^3.0.1"
46+
"eslint": "^5.9.0",
47+
"nyc": "^13.1.0",
48+
"mocha": "^5.2.0"
5149
}
5250
}

src/index.js

+7-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
import postcss from 'postcss';
2-
import Tokenizer from 'css-selector-tokenizer';
1+
'use strict';
2+
3+
const postcss = require('postcss');
4+
const Tokenizer = require('css-selector-tokenizer');
35

46
let hasOwnProperty = Object.prototype.hasOwnProperty;
57

@@ -149,8 +151,8 @@ const processor = postcss.plugin('postcss-modules-scope', function(options) {
149151
// If we found any :locals, insert an :export rule
150152
let exportedNames = Object.keys(exports);
151153
if (exportedNames.length > 0) {
152-
let exportRule = postcss.rule({selector: `:export`});
153-
exportedNames.forEach(exportedName =>
154+
let exportRule = postcss.rule({selector: ':export'});
155+
exportedNames.forEach(exportedName =>
154156
exportRule.append({
155157
prop: exportedName,
156158
value: exports[exportedName].join(' '),
@@ -167,4 +169,4 @@ processor.generateScopedName = function(exportedName, path) {
167169
return `_${sanitisedPath}__${exportedName}`;
168170
};
169171

170-
export default processor;
172+
module.exports = processor;

test/test-cases.js

+23-23
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,50 @@
1-
"use strict";
1+
'use strict';
22

33
/*globals describe it */
44

5-
var assert = require("assert");
6-
var fs = require("fs");
7-
var path = require("path");
8-
var postcss = require("postcss");
9-
var processor = require("../src");
5+
var assert = require('assert');
6+
var fs = require('fs');
7+
var path = require('path');
8+
var postcss = require('postcss');
9+
var processor = require('../src');
1010

1111
function generateInvalidCSS(css) {
1212
css.walkDecls(function(decl) {
13-
decl.value = decl.value.replace(/_colon_/g, ":"); // because using a : in the tests would make it invalid CSS.
13+
decl.value = decl.value.replace(/_colon_/g, ':'); // because using a : in the tests would make it invalid CSS.
1414
});
1515
}
1616

1717
function normalize(str) {
18-
return str.replace(/\r\n?/g, "\n").replace(/\n$/, '');
18+
return str.replace(/\r\n?/g, '\n').replace(/\n$/, '');
1919
}
2020

2121
var generateScopedName = processor.generateScopedName;
2222

23-
describe("test-cases", function() {
24-
var testDir = path.join(__dirname, "test-cases");
23+
describe('test-cases', function() {
24+
var testDir = path.join(__dirname, 'test-cases');
2525
fs.readdirSync(testDir).forEach(function(testCase) {
26-
if(fs.existsSync(path.join(testDir, testCase, "source.css"))) {
27-
it("should " + testCase.replace(/-/g, " "), function() {
28-
var input = normalize(fs.readFileSync(path.join(testDir, testCase, "source.css"), "utf-8"));
26+
if(fs.existsSync(path.join(testDir, testCase, 'source.css'))) {
27+
it('should ' + testCase.replace(/-/g, ' '), function() {
28+
var input = normalize(fs.readFileSync(path.join(testDir, testCase, 'source.css'), 'utf-8'));
2929
var expected, expectedError;
30-
if(fs.existsSync(path.join(testDir, testCase, "expected.error.txt"))) {
31-
expectedError = normalize(fs.readFileSync(path.join(testDir, testCase, "expected.error.txt"), "utf-8"))
32-
.split("\n")[0];
30+
if(fs.existsSync(path.join(testDir, testCase, 'expected.error.txt'))) {
31+
expectedError = normalize(fs.readFileSync(path.join(testDir, testCase, 'expected.error.txt'), 'utf-8'))
32+
.split('\n')[0];
3333
} else {
34-
expected = normalize(fs.readFileSync(path.join(testDir, testCase, "expected.css"), "utf-8"));
34+
expected = normalize(fs.readFileSync(path.join(testDir, testCase, 'expected.css'), 'utf-8'));
3535
}
36-
var config = { from: "/input" };
36+
var config = { from: '/input' };
3737
var options = {
3838
generateScopedName: function(exportedName, inputPath) {
39-
var normalizedPath = inputPath.replace(/^[A-Z]:/, "");
39+
var normalizedPath = inputPath.replace(/^[A-Z]:/, '');
4040
return generateScopedName(exportedName, normalizedPath);
4141
}
4242
};
43-
if(fs.existsSync(path.join(testDir, testCase, "config.json"))) {
44-
config = JSON.parse(fs.readFileSync(path.join(testDir, testCase, "config.json"), "utf-8"));
43+
if(fs.existsSync(path.join(testDir, testCase, 'config.json'))) {
44+
config = JSON.parse(fs.readFileSync(path.join(testDir, testCase, 'config.json'), 'utf-8'));
4545
}
46-
if(fs.existsSync(path.join(testDir, testCase, "options.js"))) {
47-
options = require(path.join(testDir, testCase, "options.js"));
46+
if(fs.existsSync(path.join(testDir, testCase, 'options.js'))) {
47+
options = require(path.join(testDir, testCase, 'options.js'));
4848
}
4949
var pipeline = postcss([generateInvalidCSS, processor(options)]);
5050
if(expectedError) {
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
module.exports = {
22
generateScopedName: function(name, path) {
3-
return "_" + name + "_";
3+
return '_' + name + '_';
44
}
55
};

0 commit comments

Comments
 (0)