postcss-modules 6.0.0 → 7.0.0

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.
@@ -0,0 +1 @@
1
+ {"sessionId":"90487c0d-02d1-4853-8d09-cfc07c0fcb62","pid":81146,"procStart":"Tue Jun 30 11:29:58 2026","acquiredAt":1782820063000}
@@ -0,0 +1,58 @@
1
+ <component name="ProjectCodeStyleConfiguration">
2
+ <code_scheme name="Project" version="173">
3
+ <HTMLCodeStyleSettings>
4
+ <option name="HTML_SPACE_INSIDE_EMPTY_TAG" value="true" />
5
+ <option name="HTML_ENFORCE_QUOTES" value="true" />
6
+ </HTMLCodeStyleSettings>
7
+ <JSCodeStyleSettings version="0">
8
+ <option name="FORCE_SEMICOLON_STYLE" value="true" />
9
+ <option name="SPACE_BEFORE_FUNCTION_LEFT_PARENTH" value="false" />
10
+ <option name="FORCE_QUOTE_STYlE" value="true" />
11
+ <option name="ENFORCE_TRAILING_COMMA" value="Remove" />
12
+ <option name="SPACES_WITHIN_OBJECT_LITERAL_BRACES" value="true" />
13
+ <option name="SPACES_WITHIN_IMPORTS" value="true" />
14
+ </JSCodeStyleSettings>
15
+ <TypeScriptCodeStyleSettings version="0">
16
+ <option name="FORCE_SEMICOLON_STYLE" value="true" />
17
+ <option name="SPACE_BEFORE_FUNCTION_LEFT_PARENTH" value="false" />
18
+ <option name="FORCE_QUOTE_STYlE" value="true" />
19
+ <option name="ENFORCE_TRAILING_COMMA" value="Remove" />
20
+ <option name="SPACES_WITHIN_OBJECT_LITERAL_BRACES" value="true" />
21
+ <option name="SPACES_WITHIN_IMPORTS" value="true" />
22
+ </TypeScriptCodeStyleSettings>
23
+ <VueCodeStyleSettings>
24
+ <option name="INTERPOLATION_NEW_LINE_AFTER_START_DELIMITER" value="false" />
25
+ <option name="INTERPOLATION_NEW_LINE_BEFORE_END_DELIMITER" value="false" />
26
+ </VueCodeStyleSettings>
27
+ <codeStyleSettings language="HTML">
28
+ <option name="SOFT_MARGINS" value="80" />
29
+ <indentOptions>
30
+ <option name="INDENT_SIZE" value="2" />
31
+ <option name="CONTINUATION_INDENT_SIZE" value="2" />
32
+ <option name="TAB_SIZE" value="2" />
33
+ </indentOptions>
34
+ </codeStyleSettings>
35
+ <codeStyleSettings language="JavaScript">
36
+ <option name="SOFT_MARGINS" value="80" />
37
+ <indentOptions>
38
+ <option name="INDENT_SIZE" value="2" />
39
+ <option name="CONTINUATION_INDENT_SIZE" value="2" />
40
+ <option name="TAB_SIZE" value="2" />
41
+ </indentOptions>
42
+ </codeStyleSettings>
43
+ <codeStyleSettings language="TypeScript">
44
+ <option name="SOFT_MARGINS" value="80" />
45
+ <indentOptions>
46
+ <option name="INDENT_SIZE" value="2" />
47
+ <option name="CONTINUATION_INDENT_SIZE" value="2" />
48
+ <option name="TAB_SIZE" value="2" />
49
+ </indentOptions>
50
+ </codeStyleSettings>
51
+ <codeStyleSettings language="Vue">
52
+ <option name="SOFT_MARGINS" value="80" />
53
+ <indentOptions>
54
+ <option name="CONTINUATION_INDENT_SIZE" value="2" />
55
+ </indentOptions>
56
+ </codeStyleSettings>
57
+ </code_scheme>
58
+ </component>
@@ -0,0 +1,5 @@
1
+ <component name="ProjectCodeStyleConfiguration">
2
+ <state>
3
+ <option name="USE_PER_PROJECT_SETTINGS" value="true" />
4
+ </state>
5
+ </component>
@@ -0,0 +1,6 @@
1
+ <component name="InspectionProjectProfileManager">
2
+ <profile version="1.0">
3
+ <option name="myName" value="Project Default" />
4
+ <inspection_tool class="Eslint" enabled="true" level="WARNING" enabled_by_default="true" />
5
+ </profile>
6
+ </component>
@@ -0,0 +1,8 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ProjectModuleManager">
4
+ <modules>
5
+ <module fileurl="file://$PROJECT_DIR$/.idea/postcss-modules.iml" filepath="$PROJECT_DIR$/.idea/postcss-modules.iml" />
6
+ </modules>
7
+ </component>
8
+ </project>
@@ -0,0 +1,12 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <module type="WEB_MODULE" version="4">
3
+ <component name="NewModuleRootManager">
4
+ <content url="file://$MODULE_DIR$">
5
+ <excludeFolder url="file://$MODULE_DIR$/temp" />
6
+ <excludeFolder url="file://$MODULE_DIR$/.tmp" />
7
+ <excludeFolder url="file://$MODULE_DIR$/tmp" />
8
+ </content>
9
+ <orderEntry type="inheritedJdk" />
10
+ <orderEntry type="sourceFolder" forTests="false" />
11
+ </component>
12
+ </module>
package/.idea/vcs.xml ADDED
@@ -0,0 +1,6 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="VcsDirectoryMappings">
4
+ <mapping directory="" vcs="Git" />
5
+ </component>
6
+ </project>
package/CHANGELOG.md CHANGED
@@ -1,5 +1,24 @@
1
1
  # Changelog
2
2
 
3
+ ## 7.0.0
4
+
5
+ ### Breaking
6
+
7
+ - Dropped support for Node.js 10, 12, 14, and 15. The minimum supported Node.js version is now 18.
8
+
9
+ ### Security
10
+
11
+ - Patched 14 Dependabot security alerts in transitive dependencies (`form-data`, `lodash`, `@babel/core`, `@babel/plugin-transform-modules-systemjs`, `uuid`, `picomatch`, `flatted`, `minimatch`, `qs`, `js-yaml`, `nanoid`)
12
+ - Bumped `jest` from 26 to 30 to drop vulnerable `node-notifier`, `sane`, and `jsdom` chains
13
+
14
+ ### Internal
15
+
16
+ - Regenerated Jest snapshots for the new `pretty-format` serializer (cosmetic only; emitted CSS and JSON are unchanged)
17
+
18
+ ## 6.0.1
19
+
20
+ - Updated dependencies by Bill Collins (@mrginglymus)
21
+
3
22
  ## 6.0.0
4
23
 
5
24
  ### Breaking
@@ -4,23 +4,17 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
7
  var _postcss = _interopRequireDefault(require("postcss"));
9
-
10
8
  var _path = _interopRequireDefault(require("path"));
11
-
12
9
  var _Parser = _interopRequireDefault(require("./Parser"));
13
-
14
10
  var _fs = require("./fs");
15
-
16
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
-
11
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
18
12
  // Initially copied from https://github.com/css-modules/css-modules-loader-core
13
+
19
14
  class Core {
20
15
  constructor(plugins) {
21
16
  this.plugins = plugins || Core.defaultPlugins;
22
17
  }
23
-
24
18
  async load(sourceString, sourcePath, trace, pathFetcher) {
25
19
  const parser = new _Parser.default(pathFetcher, trace);
26
20
  const plugins = this.plugins.concat([parser.plugin()]);
@@ -32,40 +26,33 @@ class Core {
32
26
  exportTokens: parser.exportTokens
33
27
  };
34
28
  }
29
+ }
35
30
 
36
- } // Sorts dependencies in the following way:
31
+ // Sorts dependencies in the following way:
37
32
  // AAA comes before AA and A
38
33
  // AB comes after AA and before A
39
34
  // All Bs come after all As
40
35
  // This ensures that the files are always returned in the following order:
41
36
  // - In the order they were required, except
42
37
  // - After all their dependencies
43
-
44
-
45
38
  const traceKeySorter = (a, b) => {
46
39
  if (a.length < b.length) {
47
40
  return a < b.substring(0, a.length) ? -1 : 1;
48
41
  }
49
-
50
42
  if (a.length > b.length) {
51
43
  return a.substring(0, b.length) <= b ? -1 : 1;
52
44
  }
53
-
54
45
  return a < b ? -1 : 1;
55
46
  };
56
-
57
47
  class FileSystemLoader {
58
48
  constructor(root, plugins, fileResolve) {
59
49
  if (root === "/" && process.platform === "win32") {
60
50
  const cwdDrive = process.cwd().slice(0, 3);
61
-
62
51
  if (!/^[A-Za-z]:\\$/.test(cwdDrive)) {
63
52
  throw new Error(`Failed to obtain root from "${process.cwd()}".`);
64
53
  }
65
-
66
54
  root = cwdDrive;
67
55
  }
68
-
69
56
  this.root = root;
70
57
  this.fileResolve = fileResolve;
71
58
  this.sources = {};
@@ -75,33 +62,26 @@ class FileSystemLoader {
75
62
  this.tokensByFile = {};
76
63
  this.fs = (0, _fs.getFileSystem)();
77
64
  }
78
-
79
65
  async fetch(_newPath, relativeTo, _trace) {
80
66
  const newPath = _newPath.replace(/^["']|["']$/g, "");
81
-
82
67
  const trace = _trace || String.fromCharCode(this.importNr++);
83
-
84
68
  const useFileResolve = typeof this.fileResolve === "function";
85
69
  const fileResolvedPath = useFileResolve ? await this.fileResolve(newPath, relativeTo) : await Promise.resolve();
86
-
87
70
  if (fileResolvedPath && !_path.default.isAbsolute(fileResolvedPath)) {
88
71
  throw new Error('The returned path from the "fileResolve" option must be absolute.');
89
72
  }
90
-
91
73
  const relativeDir = _path.default.dirname(relativeTo);
92
-
93
74
  const rootRelativePath = fileResolvedPath || _path.default.resolve(relativeDir, newPath);
75
+ let fileRelativePath = fileResolvedPath || _path.default.resolve(_path.default.resolve(this.root, relativeDir), newPath);
94
76
 
95
- let fileRelativePath = fileResolvedPath || _path.default.resolve(_path.default.resolve(this.root, relativeDir), newPath); // if the path is not relative or absolute, try to resolve it in node_modules
96
-
97
-
77
+ // if the path is not relative or absolute, try to resolve it in node_modules
98
78
  if (!useFileResolve && newPath[0] !== "." && !_path.default.isAbsolute(newPath)) {
99
79
  try {
100
80
  fileRelativePath = require.resolve(newPath);
101
- } catch (e) {// noop
81
+ } catch (e) {
82
+ // noop
102
83
  }
103
84
  }
104
-
105
85
  const tokens = this.tokensByFile[fileRelativePath];
106
86
  if (tokens) return tokens;
107
87
  return new Promise((resolve, reject) => {
@@ -118,23 +98,18 @@ class FileSystemLoader {
118
98
  });
119
99
  });
120
100
  }
121
-
122
101
  get finalSource() {
123
102
  const traces = this.traces;
124
103
  const sources = this.sources;
125
104
  let written = new Set();
126
105
  return Object.keys(traces).sort(traceKeySorter).map(key => {
127
106
  const filename = traces[key];
128
-
129
107
  if (written.has(filename)) {
130
108
  return null;
131
109
  }
132
-
133
110
  written.add(filename);
134
111
  return sources[filename];
135
112
  }).join("");
136
113
  }
137
-
138
114
  }
139
-
140
115
  exports.default = FileSystemLoader;
package/build/Parser.js CHANGED
@@ -4,12 +4,10 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
7
  var _icssUtils = require("icss-utils");
9
-
10
8
  // Initially copied from https://github.com/css-modules/css-modules-loader-core
11
- const importRegexp = /^:import\((.+)\)$/;
12
9
 
10
+ const importRegexp = /^:import\((.+)\)$/;
13
11
  class Parser {
14
12
  constructor(pathFetcher, trace) {
15
13
  this.pathFetcher = pathFetcher;
@@ -18,21 +16,17 @@ class Parser {
18
16
  this.translations = {};
19
17
  this.trace = trace;
20
18
  }
21
-
22
19
  plugin() {
23
20
  const parser = this;
24
21
  return {
25
22
  postcssPlugin: "css-modules-parser",
26
-
27
23
  async OnceExit(css) {
28
24
  await Promise.all(parser.fetchAllImports(css));
29
25
  parser.linkImportedSymbols(css);
30
26
  return parser.extractExports(css);
31
27
  }
32
-
33
28
  };
34
29
  }
35
-
36
30
  fetchAllImports(css) {
37
31
  let imports = [];
38
32
  css.each(node => {
@@ -42,17 +36,14 @@ class Parser {
42
36
  });
43
37
  return imports;
44
38
  }
45
-
46
39
  linkImportedSymbols(css) {
47
40
  (0, _icssUtils.replaceSymbols)(css, this.translations);
48
41
  }
49
-
50
42
  extractExports(css) {
51
43
  css.each(node => {
52
44
  if (node.type == "rule" && node.selector == ":export") this.handleExport(node);
53
45
  });
54
46
  }
55
-
56
47
  handleExport(exportNode) {
57
48
  exportNode.each(decl => {
58
49
  if (decl.type == "decl") {
@@ -64,12 +55,10 @@ class Parser {
64
55
  });
65
56
  exportNode.remove();
66
57
  }
67
-
68
58
  async fetchImport(importNode, relativeTo, depNr) {
69
59
  const file = importNode.selector.match(importRegexp)[1];
70
60
  const depTrace = this.trace + String.fromCharCode(depNr);
71
61
  const exports = await this.pathFetcher(file, relativeTo, depTrace);
72
-
73
62
  try {
74
63
  importNode.each(decl => {
75
64
  if (decl.type == "decl") {
@@ -81,7 +70,5 @@ class Parser {
81
70
  console.log(err);
82
71
  }
83
72
  }
84
-
85
73
  }
86
-
87
74
  exports.default = Parser;
package/build/fs.js CHANGED
@@ -13,12 +13,10 @@ let fileSystem = {
13
13
  throw Error("writeFile not implemented");
14
14
  }
15
15
  };
16
-
17
16
  function setFileSystem(fs) {
18
17
  fileSystem.readFile = fs.readFile;
19
18
  fileSystem.writeFile = fs.writeFile;
20
19
  }
21
-
22
20
  function getFileSystem() {
23
21
  return fileSystem;
24
22
  }
package/build/index.js CHANGED
@@ -1,16 +1,11 @@
1
1
  "use strict";
2
2
 
3
3
  var _fs = require("fs");
4
-
5
4
  var _fs2 = require("./fs");
6
-
7
5
  var _pluginFactory = require("./pluginFactory");
8
-
9
6
  (0, _fs2.setFileSystem)({
10
7
  readFile: _fs.readFile,
11
8
  writeFile: _fs.writeFile
12
9
  });
13
-
14
10
  module.exports = (opts = {}) => (0, _pluginFactory.makePlugin)(opts);
15
-
16
11
  module.exports.postcss = true;
@@ -4,15 +4,11 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.makeLocalsConventionReducer = makeLocalsConventionReducer;
7
-
8
7
  var _lodash = _interopRequireDefault(require("lodash.camelcase"));
9
-
10
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
-
8
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
12
9
  function dashesCamelCase(string) {
13
10
  return string.replace(/-+(\w)/g, (_, firstLetter) => firstLetter.toUpperCase());
14
11
  }
15
-
16
12
  function makeLocalsConventionReducer(localsConvention, inputFile) {
17
13
  const isFunc = typeof localsConvention === "function";
18
14
  return (tokens, [className, value]) => {
@@ -21,27 +17,22 @@ function makeLocalsConventionReducer(localsConvention, inputFile) {
21
17
  tokens[convention] = value;
22
18
  return tokens;
23
19
  }
24
-
25
20
  switch (localsConvention) {
26
21
  case "camelCase":
27
22
  tokens[className] = value;
28
23
  tokens[(0, _lodash.default)(className)] = value;
29
24
  break;
30
-
31
25
  case "camelCaseOnly":
32
26
  tokens[(0, _lodash.default)(className)] = value;
33
27
  break;
34
-
35
28
  case "dashes":
36
29
  tokens[className] = value;
37
30
  tokens[dashesCamelCase(className)] = value;
38
31
  break;
39
-
40
32
  case "dashesOnly":
41
33
  tokens[dashesCamelCase(className)] = value;
42
34
  break;
43
35
  }
44
-
45
36
  return tokens;
46
37
  };
47
38
  }
@@ -4,35 +4,23 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.makePlugin = makePlugin;
7
-
8
7
  var _postcss = _interopRequireDefault(require("postcss"));
9
-
10
8
  var _unquote = _interopRequireDefault(require("./unquote"));
11
-
12
9
  var _Parser = _interopRequireDefault(require("./Parser"));
13
-
14
10
  var _saveJSON = _interopRequireDefault(require("./saveJSON"));
15
-
16
11
  var _localsConvention = require("./localsConvention");
17
-
18
12
  var _FileSystemLoader = _interopRequireDefault(require("./FileSystemLoader"));
19
-
20
13
  var _scoping = require("./scoping");
21
-
22
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
23
-
14
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
24
15
  const PLUGIN_NAME = "postcss-modules";
25
-
26
16
  function isGlobalModule(globalModules, inputFile) {
27
17
  return globalModules.some(regex => inputFile.match(regex));
28
18
  }
29
-
30
19
  function getDefaultPluginsList(opts, inputFile) {
31
20
  const globalModulesList = opts.globalModulePaths || null;
32
21
  const exportGlobals = opts.exportGlobals || false;
33
22
  const defaultBehaviour = (0, _scoping.getDefaultScopeBehaviour)(opts.scopeBehaviour);
34
23
  const generateScopedName = (0, _scoping.getScopedNameGenerator)(opts.generateScopedName, opts.hashPrefix);
35
-
36
24
  if (globalModulesList && isGlobalModule(globalModulesList, inputFile)) {
37
25
  return (0, _scoping.getDefaultPlugins)({
38
26
  behaviour: _scoping.behaviours.GLOBAL,
@@ -40,27 +28,22 @@ function getDefaultPluginsList(opts, inputFile) {
40
28
  exportGlobals
41
29
  });
42
30
  }
43
-
44
31
  return (0, _scoping.getDefaultPlugins)({
45
32
  behaviour: defaultBehaviour,
46
33
  generateScopedName,
47
34
  exportGlobals
48
35
  });
49
36
  }
50
-
51
37
  function getLoader(opts, plugins) {
52
38
  const root = typeof opts.root === "undefined" ? "/" : opts.root;
53
39
  return typeof opts.Loader === "function" ? new opts.Loader(root, plugins, opts.resolve) : new _FileSystemLoader.default(root, plugins, opts.resolve);
54
40
  }
55
-
56
41
  function isOurPlugin(plugin) {
57
42
  return plugin.postcssPlugin === PLUGIN_NAME;
58
43
  }
59
-
60
44
  function makePlugin(opts) {
61
45
  return {
62
46
  postcssPlugin: PLUGIN_NAME,
63
-
64
47
  async OnceExit(css, {
65
48
  result
66
49
  }) {
@@ -68,40 +51,34 @@ function makePlugin(opts) {
68
51
  const inputFile = css.source.input.file;
69
52
  const pluginList = getDefaultPluginsList(opts, inputFile);
70
53
  const resultPluginIndex = result.processor.plugins.findIndex(plugin => isOurPlugin(plugin));
71
-
72
54
  if (resultPluginIndex === -1) {
73
55
  throw new Error("Plugin missing from options.");
74
56
  }
75
-
76
57
  const earlierPlugins = result.processor.plugins.slice(0, resultPluginIndex);
77
58
  const loaderPlugins = [...earlierPlugins, ...pluginList];
78
59
  const loader = getLoader(opts, loaderPlugins);
79
-
80
60
  const fetcher = async (file, relativeTo, depTrace) => {
81
61
  const unquoteFile = (0, _unquote.default)(file);
82
62
  return loader.fetch.call(loader, unquoteFile, relativeTo, depTrace);
83
63
  };
84
-
85
64
  const parser = new _Parser.default(fetcher);
86
65
  await (0, _postcss.default)([...pluginList, parser.plugin()]).process(css, {
87
66
  from: inputFile
88
67
  });
89
68
  const out = loader.finalSource;
90
69
  if (out) css.prepend(out);
91
-
92
70
  if (opts.localsConvention) {
93
71
  const reducer = (0, _localsConvention.makeLocalsConventionReducer)(opts.localsConvention, inputFile);
94
72
  parser.exportTokens = Object.entries(parser.exportTokens).reduce(reducer, {});
95
73
  }
96
-
97
74
  result.messages.push({
98
75
  type: "export",
99
76
  plugin: "postcss-modules",
100
77
  exportTokens: parser.exportTokens
101
- }); // getJSON may return a promise
78
+ });
102
79
 
80
+ // getJSON may return a promise
103
81
  return getJSON(css.source.input.file, parser.exportTokens, result.opts.to);
104
82
  }
105
-
106
83
  };
107
84
  }
package/build/saveJSON.js CHANGED
@@ -4,9 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = saveJSON;
7
-
8
7
  var _fs = require("./fs");
9
-
10
8
  function saveJSON(cssFile, json) {
11
9
  return new Promise((resolve, reject) => {
12
10
  const {
package/build/scoping.js CHANGED
@@ -7,27 +7,17 @@ exports.behaviours = void 0;
7
7
  exports.getDefaultPlugins = getDefaultPlugins;
8
8
  exports.getDefaultScopeBehaviour = getDefaultScopeBehaviour;
9
9
  exports.getScopedNameGenerator = getScopedNameGenerator;
10
-
11
10
  var _postcssModulesExtractImports = _interopRequireDefault(require("postcss-modules-extract-imports"));
12
-
13
11
  var _genericNames = _interopRequireDefault(require("generic-names"));
14
-
15
12
  var _postcssModulesLocalByDefault = _interopRequireDefault(require("postcss-modules-local-by-default"));
16
-
17
13
  var _postcssModulesScope = _interopRequireDefault(require("postcss-modules-scope"));
18
-
19
14
  var _stringHash = _interopRequireDefault(require("string-hash"));
20
-
21
15
  var _postcssModulesValues = _interopRequireDefault(require("postcss-modules-values"));
22
-
23
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
24
-
25
- const behaviours = {
16
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
17
+ const behaviours = exports.behaviours = {
26
18
  LOCAL: "local",
27
19
  GLOBAL: "global"
28
20
  };
29
- exports.behaviours = behaviours;
30
-
31
21
  function getDefaultPlugins({
32
22
  behaviour,
33
23
  generateScopedName,
@@ -47,29 +37,23 @@ function getDefaultPlugins({
47
37
  };
48
38
  return plugins[behaviour];
49
39
  }
50
-
51
40
  function isValidBehaviour(behaviour) {
52
41
  return Object.keys(behaviours).map(key => behaviours[key]).indexOf(behaviour) > -1;
53
42
  }
54
-
55
43
  function getDefaultScopeBehaviour(scopeBehaviour) {
56
44
  return scopeBehaviour && isValidBehaviour(scopeBehaviour) ? scopeBehaviour : behaviours.LOCAL;
57
45
  }
58
-
59
46
  function generateScopedNameDefault(name, filename, css) {
60
47
  const i = css.indexOf(`.${name}`);
61
48
  const lineNumber = css.substr(0, i).split(/[\r\n]/).length;
62
49
  const hash = (0, _stringHash.default)(css).toString(36).substr(0, 5);
63
50
  return `_${name}_${hash}_${lineNumber}`;
64
51
  }
65
-
66
52
  function getScopedNameGenerator(generateScopedName, hashPrefix) {
67
53
  const scopedNameGenerator = generateScopedName || generateScopedNameDefault;
68
-
69
54
  if (typeof scopedNameGenerator === "function") {
70
55
  return scopedNameGenerator;
71
56
  }
72
-
73
57
  return (0, _genericNames.default)(scopedNameGenerator, {
74
58
  context: process.cwd(),
75
59
  hashPrefix: hashPrefix
package/build/unquote.js CHANGED
@@ -5,20 +5,17 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = unquote;
7
7
  // copied from https://github.com/lakenen/node-unquote
8
- const reg = /['"]/;
9
8
 
9
+ const reg = /['"]/;
10
10
  function unquote(str) {
11
11
  if (!str) {
12
12
  return "";
13
13
  }
14
-
15
14
  if (reg.test(str.charAt(0))) {
16
15
  str = str.substr(1);
17
16
  }
18
-
19
17
  if (reg.test(str.charAt(str.length - 1))) {
20
18
  str = str.substr(0, str.length - 1);
21
19
  }
22
-
23
20
  return str;
24
21
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "postcss-modules",
3
- "version": "6.0.0",
3
+ "version": "7.0.0",
4
4
  "description": "PostCSS plugin to use CSS Modules everywhere",
5
5
  "main": "build/index.js",
6
6
  "types": "index.d.ts",
@@ -22,11 +22,11 @@
22
22
  "generic-names": "^4.0.0",
23
23
  "icss-utils": "^5.1.0",
24
24
  "lodash.camelcase": "^4.3.0",
25
- "postcss-modules-extract-imports": "^3.0.0",
26
- "postcss-modules-local-by-default": "^4.0.0",
27
- "postcss-modules-scope": "^3.0.0",
25
+ "postcss-modules-extract-imports": "^3.1.0",
26
+ "postcss-modules-local-by-default": "^4.0.5",
27
+ "postcss-modules-scope": "^3.2.0",
28
28
  "postcss-modules-values": "^4.0.0",
29
- "string-hash": "^1.1.1"
29
+ "string-hash": "^1.1.3"
30
30
  },
31
31
  "peerDependencies": {
32
32
  "postcss": "^8.0.0"
@@ -42,7 +42,7 @@
42
42
  "eslint-plugin-import": "^2.21.2",
43
43
  "eslint-plugin-jest": "^23.17.0",
44
44
  "husky": "^4.2.5",
45
- "jest": "^26.0.1",
45
+ "jest": "^30.4.2",
46
46
  "lint-staged": "^10.2.11",
47
47
  "postcss": "^8.1.9",
48
48
  "prettier": "^2.0.5"
@@ -51,6 +51,9 @@
51
51
  "test": "make test",
52
52
  "precommit": "lint-staged"
53
53
  },
54
+ "overrides": {
55
+ "glob": "^12.0.0"
56
+ },
54
57
  "lint-staged": {
55
58
  "*.{json,md}": [
56
59
  "prettier --write",