Socket
Socket
Sign inDemoInstall

style-loader

Package Overview
Dependencies
Maintainers
7
Versions
76
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

style-loader - npm Package Compare versions

Comparing version 0.17.0 to 0.18.0

lib/addStyles.js

15

CHANGELOG.md

@@ -5,2 +5,17 @@ # Change Log

<a name="0.18.0"></a>
# [0.18.0](https://github.com/webpack/style-loader/compare/v0.17.0...v0.18.0) (2017-05-22)
### Bug Fixes
* stringify the options.transform request ([#230](https://github.com/webpack/style-loader/issues/230)) ([5888095](https://github.com/webpack/style-loader/commit/5888095))
### Features
* add options validation ([#224](https://github.com/webpack/style-loader/issues/224)) ([4b6b70d](https://github.com/webpack/style-loader/commit/4b6b70d))
<a name="0.17.0"></a>

@@ -7,0 +22,0 @@ # [0.17.0](https://github.com/webpack/style-loader/compare/v0.16.1...v0.17.0) (2017-05-01)

33

index.js

@@ -5,8 +5,17 @@ /*

*/
var loaderUtils = require("loader-utils"),
path = require("path");
module.exports = function() {};
module.exports.pitch = function(remainingRequest) {
if(this.cacheable) this.cacheable();
var query = loaderUtils.getOptions(this) || {};
var path = require("path");
var loaderUtils = require("loader-utils");
var validateOptions = require('schema-utils');
module.exports = function () {};
module.exports.pitch = function (request) {
if (this.cacheable) this.cacheable();
var options = loaderUtils.getOptions(this) || {};
validateOptions(require('./options.json'), options, 'Style Loader')
return [

@@ -16,11 +25,11 @@ "// style-loader: Adds some css to the DOM by adding a <style> tag",

"// load the styles",
"var content = require(" + loaderUtils.stringifyRequest(this, "!!" + remainingRequest) + ");",
"var content = require(" + loaderUtils.stringifyRequest(this, "!!" + request) + ");",
"if(typeof content === 'string') content = [[module.id, content, '']];",
"// Prepare cssTransformation",
"var transform;",
query.transform ? "transform = require('" + path.resolve(query.transform) + "');" : "",
"var options = " + JSON.stringify(query),
options.transform ? "transform = require(" + loaderUtils.stringifyRequest(this, "!" + path.resolve(options.transform)) + ");" : "",
"var options = " + JSON.stringify(options),
"options.transform = transform",
"// add the styles to the DOM",
"var update = require(" + loaderUtils.stringifyRequest(this, "!" + path.join(__dirname, "addStyles.js")) + ")(content, options);",
"var update = require(" + loaderUtils.stringifyRequest(this, "!" + path.join(__dirname, "lib", "addStyles.js")) + ")(content, options);",
"if(content.locals) module.exports = content.locals;",

@@ -31,4 +40,4 @@ "// Hot Module Replacement",

" if(!content.locals) {",
" module.hot.accept(" + loaderUtils.stringifyRequest(this, "!!" + remainingRequest) + ", function() {",
" var newContent = require(" + loaderUtils.stringifyRequest(this, "!!" + remainingRequest) + ");",
" module.hot.accept(" + loaderUtils.stringifyRequest(this, "!!" + request) + ", function() {",
" var newContent = require(" + loaderUtils.stringifyRequest(this, "!!" + request) + ");",
" if(typeof newContent === 'string') newContent = [[module.id, newContent, '']];",

@@ -35,0 +44,0 @@ " update(newContent);",

{
"name": "style-loader",
"version": "0.17.0",
"version": "0.18.0",
"author": "Tobias Koppers @sokra",
"description": "style loader module for webpack",
"engines": {
"node": ">= 0.12.0"
},
"main": "index.js",
"files": [
"lib",
"url.js",
"index.js",
"useable.js",
"options.json"
],
"dependencies": {
"loader-utils": "^1.0.2",
"schema-utils": "^0.3.0"
},
"devDependencies": {
"css-loader": "^0.27.3",
"file-loader": "^0.10.1",
"jsdom": "^9.11.0",
"css-loader": "^0.28.1",
"file-loader": "^0.11.1",
"jsdom": "^9.12.0",
"memory-fs": "^0.4.1",

@@ -15,2 +30,7 @@ "mocha": "^3.2.0",

},
"scripts": {
"test": "mocha",
"travis:test": "yarn run test",
"release": "yarn run standard-version"
},
"repository": {

@@ -20,19 +40,3 @@ "type": "git",

},
"license": "MIT",
"dependencies": {
"loader-utils": "^1.0.2"
},
"files": [
"addStyles.js",
"addStyleUrl.js",
"fixUrls.js",
"index.js",
"url.js",
"useable.js"
],
"scripts": {
"release": "yarn run standard-version",
"test": "mocha",
"travis:test": "yarn run test"
}
"license": "MIT"
}

@@ -12,3 +12,3 @@ [![npm][npm]][npm-url]

<h1>Style Loader</h1>
<p>Adds CSS to the DOM by injecting a `<style>` tag</p>
<p>Adds CSS to the DOM by injecting a <code>&lt;style&gt;</code> tag</p>
</div>

@@ -197,3 +197,3 @@

use: [
{ loader: 'style-laoder', options: { attrs: { id: 'id' } } }
{ loader: 'style-loader', options: { attrs: { id: 'id' } } }
{ loader: 'css-loader' }

@@ -200,0 +200,0 @@ ]

@@ -5,17 +5,25 @@ /*

*/
var loaderUtils = require("loader-utils"),
path = require("path");
module.exports = function() {};
module.exports.pitch = function(remainingRequest) {
this.cacheable && this.cacheable();
var query = loaderUtils.getOptions(this) || {};
var path = require('path');
var loaderUtils = require('loader-utils');
var validateOptions = require('schema-utils');
module.exports = function () {};
module.exports.pitch = function (request) {
if (this.cacheable) this.cacheable();
var options = loaderUtils.getOptions(this) || {};
validateOptions(require('./options.json'), options, 'Style Loader (URL)');
return [
"// style-loader: Adds some reference to a css file to the DOM by adding a <link> tag",
"var update = require(" + JSON.stringify("!" + path.join(__dirname, "addStyleUrl.js")) + ")(",
"\trequire(" + loaderUtils.stringifyRequest(this, "!!" + remainingRequest) + ")",
", " + JSON.stringify(query) + ");",
"var update = require(" + JSON.stringify("!" + path.join(__dirname, "lib", "addStyleUrl.js")) + ")(",
"\trequire(" + loaderUtils.stringifyRequest(this, "!!" + request) + ")",
", " + JSON.stringify(options) + ");",
"// Hot Module Replacement",
"if(module.hot) {",
"\tmodule.hot.accept(" + loaderUtils.stringifyRequest(this, "!!" + remainingRequest) + ", function() {",
"\t\tupdate(require(" + loaderUtils.stringifyRequest(this, "!!" + remainingRequest) + "));",
"\tmodule.hot.accept(" + loaderUtils.stringifyRequest(this, "!!" + request) + ", function() {",
"\t\tupdate(require(" + loaderUtils.stringifyRequest(this, "!!" + request) + "));",
"\t});",

@@ -22,0 +30,0 @@ "\tmodule.hot.dispose(function() { update(); });",

@@ -5,12 +5,20 @@ /*

*/
var loaderUtils = require("loader-utils"),
path = require("path");
module.exports = function() {};
module.exports.pitch = function(remainingRequest) {
if(this.cacheable) this.cacheable();
var query = loaderUtils.getOptions(this) || {};
var path = require('path');
var loaderUtils = require("loader-utils");
var validateOptions = require('schema-utils');
module.exports = function () {};
module.exports.pitch = function (request) {
if (this.cacheable) this.cacheable();
var options = loaderUtils.getOptions(this) || {};
validateOptions(require('./options.json'), options, 'Style Loader (Useable)');
return [
"var refs = 0;",
"var dispose;",
"var content = require(" + loaderUtils.stringifyRequest(this, "!!" + remainingRequest) + ");",
"var content = require(" + loaderUtils.stringifyRequest(this, "!!" + request) + ");",
"if(typeof content === 'string') content = [[module.id, content, '']];",

@@ -20,3 +28,3 @@ "if(content.locals) exports.locals = content.locals;",

" if(!(refs++)) {",
" dispose = require(" + loaderUtils.stringifyRequest(this, "!" + path.join(__dirname, "addStyles.js")) + ")(content, " + JSON.stringify(query) + ");",
" dispose = require(" + loaderUtils.stringifyRequest(this, "!" + path.join(__dirname, "lib", "addStyles.js")) + ")(content, " + JSON.stringify(options) + ");",
" }",

@@ -23,0 +31,0 @@ " return exports;",

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