Comparing version 7.3.3 to 7.4.0
@@ -7,3 +7,2 @@ const cssPrefix = require('postcss-prefix') | ||
const crypto = require('crypto') | ||
const xtend = require('xtend') | ||
const stackTrace = require('stack-trace') | ||
@@ -35,3 +34,3 @@ const cssResolve = require('style-resolve').sync | ||
if (!isTemplate && (!filename || typeof filename === 'object')) { | ||
// module or file name via tagged template call w or w/out options | ||
// module or file name via tagged template call w or w/out options | ||
const callerDirname = path.dirname(stackTrace.get()[1].getFileName()) | ||
@@ -69,3 +68,3 @@ const resolved = cssResolve(src, { basedir: callerDirname }) | ||
applyTransforms(filename, String(src), xtend(options), function (err, result) { | ||
applyTransforms(filename, String(src), Object.assign({}, options), function (err, result) { | ||
if (err) return done(err) | ||
@@ -72,0 +71,0 @@ var p = postcss() |
{ | ||
"name": "sheetify", | ||
"version": "7.3.3", | ||
"version": "7.4.0", | ||
"description": "Modular CSS bundler", | ||
@@ -10,3 +10,3 @@ "repository": "stackcss/sheetify", | ||
"test": "standard && npm run deps && tape test/index.js", | ||
"test:cov": "standard && npm run deps && NODE_ENV=test istanbul cover test/index.js", | ||
"test:cov": "standard && npm run deps && NODE_ENV=test nyc node test/index.js", | ||
"format": "standard --format" | ||
@@ -17,2 +17,7 @@ }, | ||
}, | ||
"standard": { | ||
"ignore": [ | ||
"test/fixtures" | ||
] | ||
}, | ||
"keywords": [ | ||
@@ -32,11 +37,10 @@ "modular", | ||
"map-limit": "0.0.1", | ||
"postcss": "^5.0.10", | ||
"postcss": "^6.0.23", | ||
"postcss-prefix": "^2.0.0", | ||
"resolve": "^1.1.7", | ||
"stack-trace": "0.0.9", | ||
"stack-trace": "0.0.10", | ||
"static-eval": "^2.0.0", | ||
"style-resolve": "^1.1.0", | ||
"through2": "^2.0.0", | ||
"transform-ast": "^2.4.0", | ||
"xtend": "^4.0.1" | ||
"transform-ast": "^2.4.0" | ||
}, | ||
@@ -47,3 +51,3 @@ "devDependencies": { | ||
"babelify": "^8.0.0", | ||
"browserify": "^13.0.0", | ||
"browserify": "^16.2.3", | ||
"bubleify": "^1.1.0", | ||
@@ -58,8 +62,7 @@ "codecov.io": "^0.1.6", | ||
"from2-string": "^1.1.0", | ||
"istanbul": "^0.4.5", | ||
"jsdom": "^9.4.2", | ||
"npm-check-updates": "^2.2.0", | ||
"nyc": "^11.9.0", | ||
"rimraf": "^2.5.1", | ||
"sheetify-cssnext": "^2.0.0", | ||
"standard": "^8.0.0", | ||
"sheetify-cssnext": "^2.0.1", | ||
"standard": "^11.0.1", | ||
"subarg": "^1.0.0", | ||
@@ -66,0 +69,0 @@ "tape": "^4.2.0" |
@@ -22,3 +22,3 @@ # sheetify | ||
const css = require('sheetify') | ||
const html = require('bel') | ||
const html = require('nanohtml') | ||
@@ -64,3 +64,3 @@ const prefix = css` | ||
const css = require('sheetify') | ||
const html = require('bel') | ||
const html = require('nanohtml') | ||
@@ -109,3 +109,3 @@ const prefix = css` | ||
const css = require('sheetify') | ||
const html = require('bel') | ||
const html = require('nanohtml') | ||
@@ -159,3 +159,3 @@ const sectionWidth = '100px'; | ||
const css = require('sheetify') | ||
const html = require('bel') | ||
const html = require('nanohtml') | ||
@@ -202,3 +202,3 @@ const prefix = css('./my-styles.css') | ||
const css = require('sheetify') | ||
const html = require('bel') | ||
const html = require('nanohtml') | ||
@@ -205,0 +205,0 @@ const prefix = css` |
@@ -8,1 +8,2 @@ require('./prefix') | ||
require('./transpilers') | ||
require('./cleanup') |
@@ -9,3 +9,2 @@ const isMemberExpression = require('estree-is-member-expression') | ||
const through = require('through2') | ||
const xtend = require('xtend') | ||
const path = require('path') | ||
@@ -35,3 +34,3 @@ const fs = require('fs') | ||
const opts = xtend(options || { | ||
const opts = Object.assign({}, options || { | ||
basedir: process.cwd(), | ||
@@ -73,4 +72,4 @@ transform: [], | ||
const nodes = [] | ||
const babelTemplateObjects = {} | ||
const bubleTemplateObjects = {} | ||
const babelTemplateDeclarations = {} | ||
const bubleTemplateDeclarations = {} | ||
const src = Buffer.concat(bufs).toString('utf8') | ||
@@ -137,7 +136,7 @@ var mname = null | ||
// we only keep the "cooked" part | ||
babelTemplateObjects[node.id.name] = node.init.arguments[0] | ||
babelTemplateDeclarations[node.id.name] = node | ||
} else if (isBubleTemplateDefinition(node.init)) { | ||
// Buble generates helper calls like | ||
// Object.freeze([":host .class { color: hotpink; }"]) | ||
bubleTemplateObjects[node.id.name] = node.init.arguments[0] | ||
bubleTemplateDeclarations[node.id.name] = node | ||
} | ||
@@ -155,3 +154,3 @@ } | ||
filename: filename, | ||
opts: xtend(opts), | ||
opts: Object.assign({}, opts), | ||
node: node.parent | ||
@@ -170,6 +169,16 @@ }) | ||
var arg = node.arguments[0].name | ||
if (babelTemplateObjects[arg]) { | ||
elements = babelTemplateObjects[arg].elements | ||
} else if (bubleTemplateObjects[arg]) { | ||
elements = bubleTemplateObjects[arg].elements | ||
var templateDeclaration = | ||
babelTemplateDeclarations[arg] || bubleTemplateDeclarations[arg] | ||
if (templateDeclaration) { | ||
var template = templateDeclaration.init.arguments[0] | ||
elements = template.elements | ||
/* | ||
We want to remove transpiled var declaration for minification to work. | ||
var ..., | ||
_templateObject2 = _taggedTemplateLiteral(['.foo { color: blue; }'], ['.foo { color: blue; }']), | ||
...; | ||
*/ | ||
removeVariableDeclarator(templateDeclaration) | ||
} | ||
@@ -182,3 +191,3 @@ } | ||
filename: filename, | ||
opts: xtend(opts), | ||
opts: Object.assign({}, opts), | ||
node: node | ||
@@ -190,2 +199,35 @@ }) | ||
function removeVariableDeclarator (node) { | ||
/* | ||
Remove `a` declaration from compound `var` statement: | ||
var ..., | ||
a = B, | ||
... | ||
*/ | ||
var parent = node.parent | ||
var offset = parent.start | ||
var at = parent.declarations.indexOf(node) | ||
var total = parent.declarations.length | ||
var str = parent.getSource() | ||
var prevNode, nextNode | ||
var stripped | ||
if (total === 1) { | ||
stripped = ' '.repeat(str.length) // remove whole "var ...;" statement | ||
} else if (at < total - 1) { // not last | ||
nextNode = parent.declarations[at + 1] | ||
stripped = | ||
str.slice(0, node.start - offset) + | ||
' '.repeat(nextNode.start - node.start) + | ||
str.slice(nextNode.start - offset) | ||
} else { // last one | ||
prevNode = parent.declarations[at - 1] | ||
stripped = | ||
str.slice(0, prevNode.end - offset) + | ||
' '.repeat(node.end - prevNode.end) + | ||
str.slice(node.end - offset) | ||
} | ||
parent.update(stripped) | ||
} | ||
function extractImportNodes (node) { | ||
@@ -204,3 +246,3 @@ if (node.type !== 'CallExpression') return | ||
const iOpts = node.arguments[1] | ||
? xtend(opts, staticEval(node.arguments[1])) | ||
? Object.assign({}, opts, staticEval(node.arguments[1])) | ||
: opts | ||
@@ -207,0 +249,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
55598
14
20
44
1222
22
+ Addedansi-styles@3.2.1(transitive)
+ Addedchalk@2.4.2(transitive)
+ Addedcolor-convert@1.9.3(transitive)
+ Addedcolor-name@1.1.3(transitive)
+ Addedhas-flag@3.0.0(transitive)
+ Addedpostcss@6.0.23(transitive)
+ Addedstack-trace@0.0.10(transitive)
+ Addedsupports-color@5.5.0(transitive)
- Removedxtend@^4.0.1
- Removedstack-trace@0.0.9(transitive)
Updatedpostcss@^6.0.23
Updatedstack-trace@0.0.10