postcss-modules 4.2.1 → 4.3.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/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # Changelog
2
2
 
3
+ ## 4.3.1
4
+
5
+ - Fixed errors when using shorthand selectors by Felix Bruns (@fxb) https://github.com/madyankin/postcss-modules/pull/130
6
+
7
+ ## 4.3.0
8
+
9
+ - Updated the `generic-names` dependency to reduce packages size by Bogdan Chadkin (@TrySound) https://github.com/madyankin/postcss-modules/pull/129
10
+
11
+ ## 4.2.2
12
+
13
+ - Fix the build
14
+
3
15
  ## 4.2.1
4
16
 
5
17
  - Fixed the `resolve` option behaviour by @kamilic https://github.com/madyankin/postcss-modules/pull/127
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright 2015-2016 Alexander Madyankin <alexander@madyankin.name>
3
+ Copyright 2015-present Alexander Madyankin <alexander@madyankin.name>
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy of
6
6
  this software and associated documentation files (the "Software"), to deal in
package/README.md CHANGED
@@ -10,8 +10,9 @@ A [PostCSS] plugin to use [CSS Modules] everywhere. Not only at the client side.
10
10
  I maintain the plugin in my free time, so I don't receive any payment for this work.
11
11
  To have better docs, new features and integrations with frameworks, you can [support me on Patreon](https://www.patreon.com/bePatron?u=25976212).
12
12
 
13
+ The sponsors are listed [below in the README](#sponsors)
13
14
 
14
- ## What is this?
15
+ ## What is this?
15
16
 
16
17
  For example, you have the following CSS:
17
18
 
@@ -213,7 +214,7 @@ In lieu of a string, a custom function can generate the exported class names.
213
214
 
214
215
  ### Resolve path alias
215
216
 
216
- You can rewrite paths for `composes/from` by using `resolve` options.
217
+ You can rewrite paths for `composes/from` by using `resolve` options.
217
218
  It's useful when you need to resolve custom path alias.
218
219
 
219
220
  ```js
@@ -325,3 +326,7 @@ npm install --save-dev postcss postcss-modules
325
326
  ```
326
327
 
327
328
  [filesystemloader]: https://github.com/css-modules/css-modules-loader-core/blob/master/src/file-system-loader.js
329
+
330
+
331
+ ## Sponsors
332
+ - Dmitry Olyenyov
@@ -38,8 +38,8 @@ function getDefaultPlugins({
38
38
  const scope = (0, _postcssModulesScope2.default)({ generateScopedName, exportGlobals });
39
39
 
40
40
  const plugins = {
41
- [behaviours.LOCAL]: [_postcssModulesValues2.default, _postcssModulesLocalByDefault2.default, _postcssModulesExtractImports2.default, scope],
42
- [behaviours.GLOBAL]: [_postcssModulesValues2.default, _postcssModulesExtractImports2.default, scope]
41
+ [behaviours.LOCAL]: [_postcssModulesValues2.default, (0, _postcssModulesLocalByDefault2.default)({ mode: 'local' }), _postcssModulesExtractImports2.default, scope],
42
+ [behaviours.GLOBAL]: [_postcssModulesValues2.default, (0, _postcssModulesLocalByDefault2.default)({ mode: 'global' }), _postcssModulesExtractImports2.default, scope]
43
43
  };
44
44
 
45
45
  return plugins[behaviour];
package/build/index.js CHANGED
@@ -12,6 +12,10 @@ var _genericNames = require("generic-names");
12
12
 
13
13
  var _genericNames2 = _interopRequireDefault(_genericNames);
14
14
 
15
+ var _unquote = require("./unquote");
16
+
17
+ var _unquote2 = _interopRequireDefault(_unquote);
18
+
15
19
  var _parser = require("./css-loader-core/parser");
16
20
 
17
21
  var _parser2 = _interopRequireDefault(_parser);
@@ -110,11 +114,12 @@ module.exports = (opts = {}) => {
110
114
  const loaderPlugins = [...earlierPlugins, ...pluginList];
111
115
  const loader = getLoader(opts, loaderPlugins);
112
116
  const fetcher = function fetcher(file, relativeTo, depTrace) {
113
- const resolvedResult = typeof opts.resolve === 'function' && opts.resolve(file);
117
+ const unquoteFile = (0, _unquote2.default)(file);
118
+ const resolvedResult = typeof opts.resolve === 'function' && opts.resolve(unquoteFile);
114
119
  const resolvedFile = resolvedResult instanceof Promise ? resolvedResult : Promise.resolve(resolvedResult);
115
120
 
116
- return resolvedFile.then(function (f = file) {
117
- return loader.fetch.call(loader, f || file, relativeTo, depTrace);
121
+ return resolvedFile.then(function (f) {
122
+ return loader.fetch.call(loader, `"${f || unquoteFile}"`, relativeTo, depTrace);
118
123
  });
119
124
  };
120
125
  const parser = new _parser2.default(fetcher);
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = unquote;
7
+ // copied from https://github.com/lakenen/node-unquote
8
+
9
+ var reg = /['"]/;
10
+
11
+ function unquote(str) {
12
+ if (!str) {
13
+ return "";
14
+ }
15
+ if (reg.test(str.charAt(0))) {
16
+ str = str.substr(1);
17
+ }
18
+ if (reg.test(str.charAt(str.length - 1))) {
19
+ str = str.substr(0, str.length - 1);
20
+ }
21
+ return str;
22
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "postcss-modules",
3
- "version": "4.2.1",
3
+ "version": "4.3.1",
4
4
  "description": "PostCSS plugin to use CSS Modules everywhere",
5
5
  "main": "build/index.js",
6
6
  "types": "index.d.ts",
@@ -19,7 +19,7 @@
19
19
  "url": "https://github.com/css-modules/postcss-modules.git"
20
20
  },
21
21
  "dependencies": {
22
- "generic-names": "^2.0.1",
22
+ "generic-names": "^4.0.0",
23
23
  "icss-replace-symbols": "^1.1.0",
24
24
  "lodash.camelcase": "^4.3.0",
25
25
  "postcss-modules-extract-imports": "^3.0.0",