postcss-modules 1.2.0 → 1.4.1
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/.vscode/settings.json +3 -0
- package/CHANGELOG.md +17 -0
- package/build/behaviours.js +4 -4
- package/build/generateScopedName.js +2 -2
- package/build/index.js +23 -16
- package/build/saveJSON.js +2 -2
- package/package.json +27 -14
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.4.1
|
|
4
|
+
|
|
5
|
+
- Rebublished the previous release. Sorry :(
|
|
6
|
+
|
|
7
|
+
## 1.4.0
|
|
8
|
+
|
|
9
|
+
- Added export for other plugins by Evilebot Tnawi (@evilebottnawi) <https://github.com/css-modules/postcss-modules/pull/88>, <https://github.com/css-modules/postcss-modules/issues/29>
|
|
10
|
+
|
|
11
|
+
## 1.3.1
|
|
12
|
+
|
|
13
|
+
- Move dev tools to devDependecies by Anton Khlynovskiy (@ubzey) <https://github.com/css-modules/postcss-modules/pull/85>
|
|
14
|
+
|
|
15
|
+
## 1.3.0
|
|
16
|
+
|
|
17
|
+
- Updated dependecies
|
|
18
|
+
- Added prettier to format code
|
|
19
|
+
|
|
3
20
|
## 1.2.0
|
|
4
21
|
|
|
5
22
|
- Added option to transform classes to camelCase by Igor Ribeiro (@igor-ribeiro) <https://github.com/css-modules/postcss-modules/pull/82>
|
package/build/behaviours.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
@@ -7,15 +7,15 @@ exports.behaviours = undefined;
|
|
|
7
7
|
exports.getDefaultPlugins = getDefaultPlugins;
|
|
8
8
|
exports.isValidBehaviour = isValidBehaviour;
|
|
9
9
|
|
|
10
|
-
var _cssModulesLoaderCore = require(
|
|
10
|
+
var _cssModulesLoaderCore = require("css-modules-loader-core");
|
|
11
11
|
|
|
12
12
|
var _cssModulesLoaderCore2 = _interopRequireDefault(_cssModulesLoaderCore);
|
|
13
13
|
|
|
14
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
15
|
|
|
16
16
|
const behaviours = exports.behaviours = {
|
|
17
|
-
LOCAL:
|
|
18
|
-
GLOBAL:
|
|
17
|
+
LOCAL: "local",
|
|
18
|
+
GLOBAL: "global"
|
|
19
19
|
};
|
|
20
20
|
|
|
21
21
|
function getDefaultPlugins(behaviour, generateScopedName) {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = generateScopedName;
|
|
7
7
|
|
|
8
|
-
var _stringHash = require(
|
|
8
|
+
var _stringHash = require("string-hash");
|
|
9
9
|
|
|
10
10
|
var _stringHash2 = _interopRequireDefault(_stringHash);
|
|
11
11
|
|
package/build/index.js
CHANGED
|
@@ -1,40 +1,40 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
2
|
|
|
3
|
-
var _postcss = require(
|
|
3
|
+
var _postcss = require("postcss");
|
|
4
4
|
|
|
5
5
|
var _postcss2 = _interopRequireDefault(_postcss);
|
|
6
6
|
|
|
7
|
-
var _lodash = require(
|
|
7
|
+
var _lodash = require("lodash.camelcase");
|
|
8
8
|
|
|
9
9
|
var _lodash2 = _interopRequireDefault(_lodash);
|
|
10
10
|
|
|
11
|
-
var _parser = require(
|
|
11
|
+
var _parser = require("css-modules-loader-core/lib/parser");
|
|
12
12
|
|
|
13
13
|
var _parser2 = _interopRequireDefault(_parser);
|
|
14
14
|
|
|
15
|
-
var _fileSystemLoader = require(
|
|
15
|
+
var _fileSystemLoader = require("css-modules-loader-core/lib/file-system-loader");
|
|
16
16
|
|
|
17
17
|
var _fileSystemLoader2 = _interopRequireDefault(_fileSystemLoader);
|
|
18
18
|
|
|
19
|
-
var _genericNames = require(
|
|
19
|
+
var _genericNames = require("generic-names");
|
|
20
20
|
|
|
21
21
|
var _genericNames2 = _interopRequireDefault(_genericNames);
|
|
22
22
|
|
|
23
|
-
var _generateScopedName = require(
|
|
23
|
+
var _generateScopedName = require("./generateScopedName");
|
|
24
24
|
|
|
25
25
|
var _generateScopedName2 = _interopRequireDefault(_generateScopedName);
|
|
26
26
|
|
|
27
|
-
var _saveJSON = require(
|
|
27
|
+
var _saveJSON = require("./saveJSON");
|
|
28
28
|
|
|
29
29
|
var _saveJSON2 = _interopRequireDefault(_saveJSON);
|
|
30
30
|
|
|
31
|
-
var _behaviours = require(
|
|
31
|
+
var _behaviours = require("./behaviours");
|
|
32
32
|
|
|
33
33
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
34
34
|
|
|
35
35
|
function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; }
|
|
36
36
|
|
|
37
|
-
const PLUGIN_NAME =
|
|
37
|
+
const PLUGIN_NAME = "postcss-modules";
|
|
38
38
|
|
|
39
39
|
function getDefaultScopeBehaviour(opts) {
|
|
40
40
|
if (opts.scopeBehaviour && (0, _behaviours.isValidBehaviour)(opts.scopeBehaviour)) {
|
|
@@ -47,13 +47,13 @@ function getDefaultScopeBehaviour(opts) {
|
|
|
47
47
|
function getScopedNameGenerator(opts) {
|
|
48
48
|
const scopedNameGenerator = opts.generateScopedName || _generateScopedName2.default;
|
|
49
49
|
|
|
50
|
-
if (typeof scopedNameGenerator ===
|
|
50
|
+
if (typeof scopedNameGenerator === "function") return scopedNameGenerator;
|
|
51
51
|
return (0, _genericNames2.default)(scopedNameGenerator, { context: process.cwd() });
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
function getLoader(opts, plugins) {
|
|
55
|
-
const root = typeof opts.root ===
|
|
56
|
-
return typeof opts.Loader ===
|
|
55
|
+
const root = typeof opts.root === "undefined" ? "/" : opts.root;
|
|
56
|
+
return typeof opts.Loader === "function" ? new opts.Loader(root, plugins) : new _fileSystemLoader2.default(root, plugins);
|
|
57
57
|
}
|
|
58
58
|
|
|
59
59
|
function isGlobalModule(globalModules, inputFile) {
|
|
@@ -88,19 +88,26 @@ module.exports = _postcss2.default.plugin(PLUGIN_NAME, (opts = {}) => {
|
|
|
88
88
|
const loader = getLoader(opts, plugins);
|
|
89
89
|
const parser = new _parser2.default(loader.fetch.bind(loader));
|
|
90
90
|
|
|
91
|
-
yield (0, _postcss2.default)([...plugins, parser.plugin]).process(css, {
|
|
91
|
+
yield (0, _postcss2.default)([...plugins, parser.plugin]).process(css, {
|
|
92
|
+
from: inputFile
|
|
93
|
+
});
|
|
92
94
|
|
|
93
95
|
const out = loader.finalSource;
|
|
94
96
|
if (out) css.prepend(out);
|
|
95
97
|
|
|
96
|
-
if (opts.camelCase
|
|
98
|
+
if (opts.camelCase) {
|
|
97
99
|
Object.keys(parser.exportTokens).forEach(function (token) {
|
|
98
100
|
const camelCaseToken = (0, _lodash2.default)(token);
|
|
99
|
-
|
|
100
101
|
parser.exportTokens[camelCaseToken] = parser.exportTokens[token];
|
|
101
102
|
});
|
|
102
103
|
}
|
|
103
104
|
|
|
105
|
+
result.messages.push({
|
|
106
|
+
type: "export",
|
|
107
|
+
plugin: "postcss-modules",
|
|
108
|
+
exportTokens: parser.exportTokens
|
|
109
|
+
});
|
|
110
|
+
|
|
104
111
|
// getJSON may return a promise
|
|
105
112
|
return getJSON(css.source.input.file, parser.exportTokens, result.opts.to);
|
|
106
113
|
});
|
package/build/saveJSON.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = saveJSON;
|
|
7
7
|
|
|
8
|
-
var _fs = require(
|
|
8
|
+
var _fs = require("fs");
|
|
9
9
|
|
|
10
10
|
function saveJSON(cssFile, json) {
|
|
11
11
|
return new Promise((resolve, reject) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "postcss-modules",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.1",
|
|
4
4
|
"description": "PostCSS plugin to use CSS Modules everywhere",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"keywords": [
|
|
@@ -19,29 +19,42 @@
|
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"css-modules-loader-core": "^1.1.0",
|
|
22
|
-
"generic-names": "^1.0.
|
|
22
|
+
"generic-names": "^1.0.3",
|
|
23
23
|
"lodash.camelcase": "^4.3.0",
|
|
24
|
-
"postcss": "^
|
|
24
|
+
"postcss": "^7.0.1",
|
|
25
25
|
"string-hash": "^1.1.1"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
|
-
"autoprefixer": "
|
|
29
|
-
"ava": "^0.
|
|
30
|
-
"babel": "^6.
|
|
31
|
-
"babel-
|
|
32
|
-
"babel-
|
|
33
|
-
"babel-
|
|
34
|
-
"
|
|
35
|
-
"eslint": "^
|
|
36
|
-
"
|
|
37
|
-
"
|
|
28
|
+
"autoprefixer": "6.7.7",
|
|
29
|
+
"ava": "^0.25.0",
|
|
30
|
+
"babel-cli": "^6.26.0",
|
|
31
|
+
"babel-core": "^6.26.3",
|
|
32
|
+
"babel-eslint": "^8.2.6",
|
|
33
|
+
"babel-preset-env": "^1.7.0",
|
|
34
|
+
"eslint": "^5.1.0",
|
|
35
|
+
"eslint-plugin-import": "^2.13.0",
|
|
36
|
+
"husky": "0.14.3",
|
|
37
|
+
"lint-staged": "7.2.0",
|
|
38
|
+
"prettier": "1.13.7"
|
|
38
39
|
},
|
|
39
40
|
"scripts": {
|
|
40
41
|
"pretest": "$(npm bin)/eslint src test",
|
|
41
42
|
"test": "$(npm bin)/babel-node $(npm bin)/ava",
|
|
42
43
|
"transpile": "$(npm bin)/babel src -d build",
|
|
43
44
|
"prepublish": "npm run transpile",
|
|
44
|
-
"postpublish": "rm -rf build && git push --follow-tags"
|
|
45
|
+
"postpublish": "rm -rf build && git push --follow-tags",
|
|
46
|
+
"precommit": "lint-staged"
|
|
47
|
+
},
|
|
48
|
+
"lint-staged": {
|
|
49
|
+
"*.{json,md}": [
|
|
50
|
+
"prettier --write",
|
|
51
|
+
"git add"
|
|
52
|
+
],
|
|
53
|
+
"*.js": [
|
|
54
|
+
"prettier --write",
|
|
55
|
+
"eslint --fix",
|
|
56
|
+
"git add"
|
|
57
|
+
]
|
|
45
58
|
},
|
|
46
59
|
"require": "babel-core/register"
|
|
47
60
|
}
|