New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

css-as-json-loader

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

css-as-json-loader - npm Package Compare versions

Comparing version 0.2.1 to 0.2.2-wip.1

33

lib/loader.js

@@ -24,3 +24,3 @@ 'use strict';

var file = this.resourcePath;
// console.log('file: ' + file);
var opts = {

@@ -32,12 +32,13 @@ from: file,

if (this.sourceMap) {
var actual_map = new _sourceMap.SourceMapConsumer(JSON.parse(map.toString()));
opts.map = {
inline: false,
annotation: false,
prev: actual_map
};
}
// if (this.sourceMap) {
// console.log(map);
// let actual_map = new SourceMapConsumer(JSON.parse(map.toString()));
// opts.map = {
// inline: false,
// annotation: false,
// prev: actual_map,
// };
// }
(0, _postcss2.default)().process(source, opts).then(function (result) {
function handleResult(result) {
result.warnings().forEach(function (msg) {

@@ -48,10 +49,18 @@ loader.emitWarning(msg.toString());

var json = (0, _postcssToJSON2.default)(result.root);
var json_map = undefined;
done(undefined, JSON.stringify(json, undefined, "\t"), undefined);
}).catch(function (error) {
if (result.map !== undefined) {
json_map = JSON.parse(result.map);
}
done(undefined, JSON.stringify(json, undefined, "\t"), json_map);
}
(0, _postcss2.default)().process(source, opts).then(handleResult, function (error) {
if (error.name === 'CssSyntaxError') {
loader.emitError(error.toString());
}
// console.log(error);
done(error);
});
}; // import path from 'path';
{
"name": "css-as-json-loader",
"version": "0.2.1",
"version": "0.2.2-wip.1",
"description": "Webpack loader that loads CSS and emits it as JSON (conformant with PostCSS API)",

@@ -29,16 +29,17 @@ "main": "lib/loader.js",

"dependencies": {
"babel-generator": "^6.3.26",
"babel-types": "^6.3.24",
"postcss": "^5.0.10"
"babel-generator": "^6.6.0",
"babel-types": "^6.6.0",
"postcss": "^5.0.18",
"source-map": "^0.5.3"
},
"devDependencies": {
"babel-cli": "^6.4.0",
"babel-core": "^6.3.26",
"babel-loader": "^6.2.0",
"babel-preset-es2015": "^6.3.13",
"chai": "^3.4.1",
"babel-cli": "^6.6.0",
"babel-core": "^6.6.0",
"babel-loader": "^6.2.4",
"babel-preset-es2015": "^6.6.0",
"chai": "^3.5.0",
"memory-fs": "^0.3.0",
"mocha": "^2.3.4",
"webpack": "^1.12.9"
"mocha": "^2.4.5",
"webpack": "^1.12.14"
}
}
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