Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@dr.pogodin/postcss-modules-parser

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@dr.pogodin/postcss-modules-parser - npm Package Compare versions

Comparing version 1.2.3 to 1.2.4

babel.config.js

52

lib/index.js

@@ -1,2 +0,2 @@

'use strict';
"use strict";

@@ -6,16 +6,22 @@ Object.defineProperty(exports, "__esModule", {

});
exports["default"] = void 0;
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
var _icssUtils = require("icss-utils");
var _lodash = require('lodash.foreach');
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
var _lodash2 = _interopRequireDefault(_lodash);
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
var _icssUtils = require('icss-utils');
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
var importRegexp = /^:import\((.+)\)$/;
var exportRegexp = /^:export$/;
/**

@@ -25,6 +31,6 @@ * @param {object} promise

*/
function isPromise(promise) {
return (typeof promise === 'undefined' ? 'undefined' : _typeof(promise)) === 'object' && typeof promise.then === 'function';
return _typeof(promise) === 'object' && typeof promise.then === 'function';
}
/**

@@ -34,21 +40,22 @@ * @param {object} css

*/
function proceed(css, translations) {
var exportTokens = {};
(0, _icssUtils.replaceSymbols)(css, translations);
css.walkRules(exportRegexp, function (rule) {
rule.walkDecls(function (decl) {
(0, _lodash2.default)(translations, function (value, key) {
return decl.value = decl.value.replace(key, value);
Object.entries(translations).forEach(function (_ref) {
var _ref2 = _slicedToArray(_ref, 2),
key = _ref2[0],
value = _ref2[1];
decl.value = decl.value.replace(key, value);
});
exportTokens[decl.prop] = decl.value;
});
rule.remove();
});
css.tokens = exportTokens;
}
/**

@@ -58,7 +65,9 @@ * @param {function} options.fetch

*/
'parser';
function parser() {
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
fetch = _ref.fetch;
var _ref3 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
fetch = _ref3.fetch;

@@ -70,8 +79,5 @@ return {

var file = css.source.input.file;
var translations = {};
var promises = [];
var iteration = 0;
css.walkRules(importRegexp, function (rule) {

@@ -88,3 +94,2 @@ var dependency = RegExp.$1.replace(/^["']|["']$/g, '');

});
promises.push(result);

@@ -111,2 +116,3 @@ } else {

parser.postcss = true;
exports.default = parser;
var _default = parser;
exports["default"] = _default;
{
"name": "@dr.pogodin/postcss-modules-parser",
"version": "1.2.3",
"version": "1.2.4",
"description": "A CSS Modules parser to extract tokens from the css file",

@@ -8,3 +8,3 @@ "main": "index.js",

"build": "babel src --out-dir lib",
"test": "mocha --require babel-core/register"
"test": "mocha --require @babel/register"
},

@@ -31,15 +31,15 @@ "engines": {

"dependencies": {
"icss-utils": "^5.1.0",
"lodash.foreach": "^4.5.0"
"icss-utils": "^5.1.0"
},
"devDependencies": {
"babel-cli": "^6.0.15",
"babel-core": "^6.0.17",
"babel-preset-es2015": "^6.0.15",
"mocha": "^8.3.2",
"postcss": "^8.2.10"
"@babel/cli": "^7.15.7",
"@babel/core": "^7.15.8",
"@babel/preset-env": "^7.15.8",
"@babel/register": "^7.15.3",
"mocha": "^9.1.2",
"postcss": "^8.3.9"
},
"peerDependencies": {
"postcss": "^8.1.4"
"postcss": "^8.3.9"
}
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc