Socket
Socket
Sign inDemoInstall

stylecow-core

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

stylecow-core - npm Package Compare versions

Comparing version 2.4.2 to 2.5.0

lib/css/track.js

22

lib/coder.js
"use strict";
let SourceMapGenerator = require('source-map').SourceMapGenerator;
let sourceMapTransfer = require('multi-stage-sourcemap').transfer;
let fs = require('fs');
let path = require('path');
let stylecow = require('./index');
const SourceMapGenerator = require('source-map').SourceMapGenerator;
const sourceMapTransfer = require('multi-stage-sourcemap').transfer;
const fs = require('fs');
const path = require('path');
const stylecow = require('./index');

@@ -61,3 +61,3 @@ stylecow.Coder = class {

let prev = extractSourceMap(css);
const prev = extractSourceMap(css);

@@ -142,3 +142,3 @@ // map destination (false|true|string)

if (original) {
let file = original.getData('file');
const file = original.getData('file');

@@ -180,3 +180,3 @@ if (file) {

popIndentation () {
let indent = this.indent.pop();
const indent = this.indent.pop();

@@ -192,3 +192,3 @@ if (this.code.substr(-indent.length) === indent) {

function extractSourceMap (css) {
let comment = css.getChild({
const comment = css.getChild({
type: 'Comment',

@@ -199,3 +199,3 @@ name: /^[#@]\ssourceMappingURL=/

if (comment) {
let inlineSourceMap = comment.name.split('sourceMappingURL=')[1].trim();
const inlineSourceMap = comment.name.split('sourceMappingURL=')[1].trim();
comment.remove();

@@ -210,3 +210,3 @@

let sourceFile = path.resolve((path.dirname(css.getData('file')) || ''), inlineSourceMap);
const sourceFile = path.resolve((path.dirname(css.getData('file')) || ''), inlineSourceMap);

@@ -213,0 +213,0 @@ return {

@@ -126,4 +126,4 @@ "use strict";

function createUrlFromString(reader) {
let element = (new stylecow.Function(reader.data())).setName('url');
let value = new stylecow.Value(reader.data());
const element = (new stylecow.Function(reader.data())).setName('url');
const value = new stylecow.Value(reader.data());
element.push(value);

@@ -130,0 +130,0 @@ value.push(stylecow.String.create(reader, value) || reader.error());

@@ -15,3 +15,3 @@ "use strict";

let element = new stylecow.AttributeSelector(reader.data());
const element = new stylecow.AttributeSelector(reader.data());

@@ -18,0 +18,0 @@ //Attribute name

@@ -18,3 +18,3 @@ "use strict";

if (reader.currToken === OPEN_CURLY_BRACKET) {
let element = new stylecow.Block(reader.data());
const element = new stylecow.Block(reader.data());

@@ -107,3 +107,3 @@ reader.move();

//It's a declaration or a nested rule?
let token = reader.searchNext([SEMICOLON, CLOSE_CURLY_BRACKET, OPEN_CURLY_BRACKET, EOF]);
const token = reader.searchNext([SEMICOLON, CLOSE_CURLY_BRACKET, OPEN_CURLY_BRACKET, EOF]);

@@ -110,0 +110,0 @@ //It's a declaration

@@ -9,3 +9,3 @@ "use strict";

getChildren (match) {
let result = new Collection();
const result = new Collection();

@@ -12,0 +12,0 @@ for (let i = 0, t = this.length; i < t; ++i) {

@@ -9,3 +9,3 @@ "use strict";

clone (data) {
let clone = super.clone(data);
const clone = super.clone(data);

@@ -12,0 +12,0 @@ clone.name = this.name;

@@ -11,3 +11,3 @@ "use strict";

clone (data) {
let clone = super.clone(data);
const clone = super.clone(data);

@@ -14,0 +14,0 @@ clone.vendor = this.vendor;

@@ -18,3 +18,3 @@ "use strict";

clone (data) {
let clone = super.clone(data);
const clone = super.clone(data);

@@ -21,0 +21,0 @@ for (let i = 0, t = this.length; i < t; ++i) {

@@ -9,3 +9,3 @@ "use strict";

clone (data) {
let clone = super.clone(data);
const clone = super.clone(data);

@@ -12,0 +12,0 @@ clone.name = this.name;

@@ -10,3 +10,3 @@ "use strict";

if (name[0] === '-') {
let match = name.match(/^(-(\w+)-)?(.+)$/);
const match = name.match(/^(-(\w+)-)?(.+)$/);
this.vendor = match[2] || null;

@@ -37,3 +37,3 @@ this.name = match[3];

clone (data) {
let clone = super.clone(data);
const clone = super.clone(data);

@@ -40,0 +40,0 @@ clone.vendor = this.vendor;

@@ -31,3 +31,3 @@ "use strict";

cloneBefore () {
let clone = this.clone();
const clone = this.clone();
this.before(clone);

@@ -38,3 +38,3 @@ return clone;

cloneAfter () {
let clone = this.clone();
const clone = this.clone();
this.after(clone);

@@ -133,4 +133,4 @@ return clone;

getSiblings (match) {
let parent = this[_parent];
let result = new Collection();
const parent = this[_parent];
const result = new Collection();

@@ -151,3 +151,3 @@ if (!parent) {

hasSibling (match) {
let parent = this[_parent];
const parent = this[_parent];

@@ -168,3 +168,3 @@ if (!parent) {

getSibling (match) {
let parent = this[_parent];
const parent = this[_parent];

@@ -219,3 +219,3 @@ if (parent) {

next () {
let index = this.index();
const index = this.index();

@@ -228,3 +228,3 @@ if (index !== -1) {

prev () {
let index = this.index();
const index = this.index();

@@ -237,3 +237,3 @@ if (index > 0) {

before (child) {
let index = this.index();
const index = this.index();

@@ -250,3 +250,3 @@ if (index !== -1) {

after (child) {
let index = this.index();
const index = this.index();

@@ -267,6 +267,6 @@ if (index !== -1) {

replaceWith (child) {
let index = this.index();
const index = this.index();
if (index !== -1) {
let parent = this[_parent];
const parent = this[_parent];
this.remove();

@@ -288,3 +288,3 @@

if (this[_parent]) {
let index = this.index();
const index = this.index();

@@ -301,3 +301,3 @@ if (index !== -1) {

toAst () {
let object = {
const object = {
type: this.type

@@ -351,3 +351,3 @@ };

while (this[k]) {
let child = this[k];
const child = this[k];

@@ -354,0 +354,0 @@ if (child.type === 'Block') {

@@ -25,3 +25,3 @@ "use strict";

toCode (code) {
let comments = code.get('comments');
const comments = code.get('comments');

@@ -28,0 +28,0 @@ if (comments === 'all' || (comments === 'important' && this.name[0] === '!')) {

@@ -25,3 +25,3 @@ "use strict";

if (reader.currToken === TILDE) {
let element = (new stylecow.Comparator(reader.data())).setName('~=');
const element = (new stylecow.Comparator(reader.data())).setName('~=');

@@ -35,3 +35,3 @@ reader.move();

if (reader.currToken === VERTICAL_LINE) {
let element = (new stylecow.Comparator(reader.data())).setName('|=');
const element = (new stylecow.Comparator(reader.data())).setName('|=');

@@ -45,3 +45,3 @@ reader.move();

if (reader.currToken === CARET) {
let element = (new stylecow.Comparator(reader.data())).setName('^=');
const element = (new stylecow.Comparator(reader.data())).setName('^=');

@@ -55,3 +55,3 @@ reader.move();

if (reader.currToken === DOLLAR) {
let element = (new stylecow.Comparator(reader.data())).setName('$=');
const element = (new stylecow.Comparator(reader.data())).setName('$=');

@@ -65,3 +65,3 @@ reader.move();

if (reader.currToken === ASTERISK) {
let element = (new stylecow.Comparator(reader.data())).setName('*=');
const element = (new stylecow.Comparator(reader.data())).setName('*=');

@@ -77,3 +77,3 @@ reader.move();

if (reader.nextToken === EQUALS) {
let element = (new stylecow.Comparator(reader.data())).setName('<=');
const element = (new stylecow.Comparator(reader.data())).setName('<=');

@@ -84,7 +84,7 @@ reader.move();

return element;
} else {
reader.move();
}
return (new stylecow.Comparator(reader.data())).setName('<');
}
reader.move();
return (new stylecow.Comparator(reader.data())).setName('<');
}

@@ -94,3 +94,3 @@

if (reader.nextToken === EQUALS) {
let element = (new stylecow.Comparator(reader.data())).setName('>=');
const element = (new stylecow.Comparator(reader.data())).setName('>=');

@@ -101,7 +101,7 @@ reader.move();

return element;
} else {
reader.move();
}
reader.move();
return (new stylecow.Comparator(reader.data())).setName('>');
}
return (new stylecow.Comparator(reader.data())).setName('>');
}

@@ -108,0 +108,0 @@ }

@@ -17,3 +17,3 @@ "use strict";

let element = new stylecow.ConditionalExpression(reader.data());
const element = new stylecow.ConditionalExpression(reader.data());

@@ -67,3 +67,3 @@ //not|only

let latest = this.length - 1;
const latest = this.length - 1;

@@ -70,0 +70,0 @@ this.forEach(function (child, k) {

@@ -11,3 +11,3 @@ "use strict";

static create (reader, parent) {
let element = new stylecow.ConditionalFeatureRange(reader.data());
const element = new stylecow.ConditionalFeatureRange(reader.data());

@@ -14,0 +14,0 @@ do {

@@ -13,3 +13,3 @@ "use strict";

if (reader.currToken === NAME && reader.nextToken === COLON) {
let element = (new stylecow.ConditionalFeature(reader.data()))
const element = (new stylecow.ConditionalFeature(reader.data()))
.setNameWithVendor(reader.getStringAndMove());

@@ -42,3 +42,3 @@

let latest = this.length - 1;
const latest = this.length - 1;

@@ -45,0 +45,0 @@ this.forEach(function (child, k) {

@@ -11,3 +11,3 @@ "use strict";

static create (reader, parent) {
let element = new stylecow.ConditionalSelector(reader.data());
const element = new stylecow.ConditionalSelector(reader.data());

@@ -42,3 +42,3 @@ // not|only operators

toCode (code) {
let latest = this.length - 1;
const latest = this.length - 1;

@@ -45,0 +45,0 @@ this.forEach(function (child, k) {

@@ -16,3 +16,3 @@ "use strict";

if (reader.currToken === NAME && reader.currStr.substr(0, 2) === '--') {
let element = (new stylecow.CustomProperty(reader.data())).setName(reader.getStringAndMove().substr(2));
const element = (new stylecow.CustomProperty(reader.data())).setName(reader.getStringAndMove().substr(2));

@@ -60,4 +60,4 @@ reader.skipAll(COMMENT);

let values = this.getChildren('Value');
let latest = values.length - 1;
const values = this.getChildren('Value');
const latest = values.length - 1;

@@ -64,0 +64,0 @@ values.forEach(function (child, k) {

@@ -38,3 +38,3 @@ "use strict";

let value = new stylecow.Value(reader.data());
const value = new stylecow.Value(reader.data());
element.push(value);

@@ -45,3 +45,3 @@

} else {
let filter = (new stylecow.String(reader.data())).setName('');
const filter = (new stylecow.String(reader.data())).setName('');

@@ -93,4 +93,4 @@ value.push(filter);

let values = this.getChildren('Value');
let latest = values.length - 1;
const values = this.getChildren('Value');
const latest = values.length - 1;

@@ -97,0 +97,0 @@ values.forEach(function (child, k) {

@@ -13,3 +13,3 @@ "use strict";

if (reader.currToken === OPEN_PARENTHESIS) {
let element = new stylecow.Expression(reader.data());
const element = new stylecow.Expression(reader.data());

@@ -45,3 +45,3 @@ reader.move();

let latest = this.length - 1;
const latest = this.length - 1;

@@ -48,0 +48,0 @@ this.forEach(function (child, k) {

@@ -15,3 +15,3 @@ "use strict";

if (reader.currToken === NAME && reader.nextToken === OPEN_PARENTHESIS) {
let element = (new stylecow.Function(reader.data())).setNameWithVendor(reader.getStringAndMove());
const element = (new stylecow.Function(reader.data())).setNameWithVendor(reader.getStringAndMove());
let value;

@@ -69,3 +69,3 @@

if (fromString && reader.currToken === STRING) {
let element = (new stylecow.Function(reader.data())).setName('url');
const element = (new stylecow.Function(reader.data())).setName('url');

@@ -90,3 +90,3 @@ element.push(stylecow.String.create(reader, element) || reader.error());

let latest = this.length - 1;
const latest = this.length - 1;

@@ -93,0 +93,0 @@ this.forEach(function (child, k) {

@@ -12,3 +12,3 @@ "use strict";

static create (reader, parent) {
let element = new stylecow.KeyframeSelector(reader.data());
const element = new stylecow.KeyframeSelector(reader.data());

@@ -37,3 +37,3 @@ do {

toCode (code) {
let latest = this.length - 1;
const latest = this.length - 1;

@@ -40,0 +40,0 @@ this.forEach(function (child, k) {

@@ -8,3 +8,3 @@ "use strict";

static create (reader, parent) {
let element = new stylecow.Keyframe(reader.data());
const element = new stylecow.Keyframe(reader.data());

@@ -11,0 +11,0 @@ element.push(stylecow.KeyframeSelector.create(reader, element) || reader.error());

@@ -10,3 +10,3 @@ "use strict";

static create (reader, parent) {
let element = new stylecow.MediaQueries(reader.data());
const element = new stylecow.MediaQueries(reader.data());

@@ -29,3 +29,3 @@ do {

toCode (code) {
let latest = this.length - 1;
const latest = this.length - 1;

@@ -32,0 +32,0 @@ this.forEach(function (child, k) {

@@ -11,3 +11,3 @@ "use strict";

static create (reader, parent) {
let element = new stylecow.MediaQuery(reader.data());
const element = new stylecow.MediaQuery(reader.data());

@@ -57,3 +57,3 @@ // not|only operators

toCode (code) {
let latest = this.length - 1;
const latest = this.length - 1;

@@ -60,0 +60,0 @@ this.forEach(function (child, k) {

@@ -17,3 +17,3 @@ "use strict";

let element = (new stylecow.NestedAtRule(reader.data())).setNameWithVendor(reader.getStringAndMove());
const element = (new stylecow.NestedAtRule(reader.data())).setNameWithVendor(reader.getStringAndMove());

@@ -84,4 +84,4 @@ switch (element.name) {

if (this.name === 'document') {
let values = this.getChildren('Value');
let latest = values.length - 1;
const values = this.getChildren('Value');
const latest = values.length - 1;

@@ -88,0 +88,0 @@ values.forEach(function (child, k) {

@@ -18,3 +18,3 @@ "use strict";

let element = (new stylecow.PseudoClassFunction(reader.data())).setNameWithVendor(reader.getStringAndMove());
const element = (new stylecow.PseudoClassFunction(reader.data())).setNameWithVendor(reader.getStringAndMove());

@@ -32,3 +32,3 @@ reader.skip(OPEN_PARENTHESIS) || reader.error();

else if (element.is({ name: /^(-(\w+)-)?(nth-.+)$/ })) {
let value = new stylecow.Value(reader.data());
const value = new stylecow.Value(reader.data());
element.push(value);

@@ -44,3 +44,3 @@

} else if (reader.currToken === NAME && reader.currStr === 'n') {
let unit = (new stylecow.Unit(reader.data())).setName(reader.getStringAndMove());
const unit = (new stylecow.Unit(reader.data())).setName(reader.getStringAndMove());

@@ -59,3 +59,3 @@ unit.push((new stylecow.Number(reader.data())).setName(1));

} else {
let child = stylecow.Operator.create(reader, element);
const child = stylecow.Operator.create(reader, element);

@@ -95,3 +95,3 @@ if (child) {

let latest = this.length - 1;
const latest = this.length - 1;

@@ -98,0 +98,0 @@ this.forEach(function (child, k) {

@@ -13,3 +13,3 @@ "use strict";

if (reader.currToken === NUMBER && reader.nextToken === SOLIDUS) {
let element = new stylecow.Ratio(reader.data());
const element = new stylecow.Ratio(reader.data());

@@ -16,0 +16,0 @@ element.push(stylecow.Number.create(reader, element) || reader.error());

@@ -10,3 +10,3 @@ "use strict";

static create (reader, parent) {
let element = new stylecow.Root(reader.data());
const element = new stylecow.Root(reader.data());

@@ -13,0 +13,0 @@ while (reader.currToken !== EOF) {

@@ -8,3 +8,3 @@ "use strict";

static create (reader, parent) {
let element = new stylecow.Rule(reader.data());
const element = new stylecow.Rule(reader.data());

@@ -11,0 +11,0 @@ element.push(stylecow.Selectors.create(reader, element) || reader.error());

@@ -19,3 +19,3 @@ "use strict";

static create (reader, parent) {
let element = new stylecow.Selector(reader.data());
const element = new stylecow.Selector(reader.data());
let child;

@@ -22,0 +22,0 @@

@@ -12,3 +12,3 @@ "use strict";

static create (reader, parent) {
let element = new stylecow.Selectors(reader.data());
const element = new stylecow.Selectors(reader.data());

@@ -35,3 +35,3 @@ do {

toCode (code) {
let latest = this.length - 1;
const latest = this.length - 1;

@@ -38,0 +38,0 @@ this.forEach(function (child, k) {

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

toCode (code) {
let q = code.get('string-quotes');
const q = code.get('string-quotes');

@@ -27,0 +27,0 @@ code.append(q + this.name.replace(new RegExp('([' + q + '])', 'g'), '\\$1') + q, this);

@@ -18,3 +18,3 @@ "use strict";

static create (reader, parent) {
let element = new stylecow.Value(reader.data());
const element = new stylecow.Value(reader.data());

@@ -41,2 +41,3 @@ do {

|| stylecow.Operator.create(reader, element)
|| stylecow.Track.create(reader, element)
|| reader.error()

@@ -59,3 +60,3 @@ );

toCode (code) {
let latest = this.length - 1;
const latest = this.length - 1;

@@ -62,0 +63,0 @@ this.forEach(function (child, k) {

@@ -30,2 +30,3 @@ "use strict";

require('./css/nested-at-rule');
require('./css/track');

@@ -70,3 +71,3 @@ // Selectors

stylecow.parseFile = function (file) {
let fs = require('fs');
const fs = require('fs');

@@ -77,3 +78,3 @@ return stylecow.parse(fs.readFileSync(file, 'utf8'), 'Root', null, file);

stylecow.cssError = function (error) {
let css = stylecow.parse(`
const css = stylecow.parse(`
html, body {

@@ -95,3 +96,3 @@ color: red !important;

let content = css.get({
const content = css.get({
type: 'String',

@@ -98,0 +99,0 @@ name: 'message'

@@ -6,5 +6,4 @@ "use strict";

const path = require('path');
const stylecow = require('./index');
let stylecow = require('./index');
stylecow.Reader = class {

@@ -79,3 +78,3 @@

getStringAndMove () {
let str = this.currStr;
const str = this.currStr;
this.move();

@@ -99,3 +98,3 @@ return str;

error () {
let file = path.relative(process.cwd(), this.file);
const file = path.relative(process.cwd(), this.file);

@@ -102,0 +101,0 @@ throw new Error(`

@@ -44,3 +44,3 @@ "use strict";

this.logs = [];
let tasks = prepareTasks(this.tasks, this.support);
const tasks = prepareTasks(this.tasks, this.support);
executeRootTasks(root, tasks);

@@ -52,3 +52,3 @@

log (message, node) {
let log = {
const log = {
message: message

@@ -74,6 +74,7 @@ };

function prepareTasks (allTasks, support) {
let tasks = {before: {}, after: {}}, i;
const tasks = {before: {}, after: {}};
let i;
for (i = allTasks.length - 1; i >= 0; i--) {
let task = allTasks[i];
const task = allTasks[i];

@@ -120,3 +121,3 @@ //browser compatibility

function needFix (stylecowSupport, task, method) {
let taskSupport = task[method];
const taskSupport = task[method];

@@ -123,0 +124,0 @@ if (!taskSupport || !stylecowSupport) {

"use strict";
let path = require('path');
let fs = require('fs');
let assert = require('assert');
const path = require('path');
const fs = require('fs');
const assert = require('assert');
const stylecow = require('./index');

@@ -122,7 +121,6 @@

run(callback) {
let self = this;
let cases = this.cases || fs.readdirSync(this.cwd);
let ignore = this.ignored || [];
const cases = this.cases || fs.readdirSync(this.cwd);
const ignore = this.ignored || [];
cases.forEach(function(name) {
cases.forEach(name => {
if (name[0] === '.' || ignore.indexOf(name) !== -1) {

@@ -132,5 +130,5 @@ return;

callback(new TestCase(self.cwd, name, self.errors));
callback(new TestCase(this.cwd, name, this.errors));
});
}
}

@@ -37,3 +37,3 @@ "use strict";

let specialChars = new Map();
const specialChars = new Map();

@@ -66,3 +66,3 @@ specialChars.set(':', COLON);

let stylecow = require('./index');
const stylecow = require('./index');

@@ -152,3 +152,3 @@ stylecow.Tokens = class {

if (this.currChar === '/' && this.nextChar === '*') {
let token = [COMMENT, this.line, this.col, ''];
const token = [COMMENT, this.line, this.col, ''];

@@ -173,3 +173,3 @@ this.next();

) {
let token = [NUMBER, this.line, this.col, this.currChar];
const token = [NUMBER, this.line, this.col, this.currChar];

@@ -196,4 +196,4 @@ while ((this.nextChar === '.' || isDigit(this.nextChar)) && this.next()) {

if (this.currChar === '"' || this.currChar === "'") {
let quote = this.currChar;
let token = [STRING, this.line, this.col, ''];
const quote = this.currChar;
const token = [STRING, this.line, this.col, ''];

@@ -219,3 +219,3 @@ while (this.next() && this.currChar !== quote) {

if (isEscaped(this.currChar, this.nextChar) || (isName(this.currChar) && (this.currChar !== '-' || (isName(this.nextChar) && !isDigit(this.nextChar))))) {
let token = [NAME, this.line, this.col, this.currChar];
const token = [NAME, this.line, this.col, this.currChar];

@@ -242,3 +242,3 @@ if (this.currChar === '\\') {

if (this.currChar === '#') {
let token = [HASH, this.line, this.col, '#'];
const token = [HASH, this.line, this.col, '#'];

@@ -260,3 +260,3 @@ while ((isEscaped(this.nextChar, this.nextNextChar) || isName(this.nextChar)) && this.next()) {

function isName(code) {
let n = code.charCodeAt(0);
const n = code.charCodeAt(0);

@@ -272,3 +272,3 @@ return n === 0x2d //-

function isDigit(code) {
let n = code.charCodeAt(0);
const n = code.charCodeAt(0);

@@ -279,3 +279,3 @@ return n >= 0x30 && n <= 0x39;

function isLetter(code) {
let n = code.charCodeAt(0);
const n = code.charCodeAt(0);

@@ -282,0 +282,0 @@ //upper or lowercase

@@ -10,3 +10,3 @@ {

],
"version": "2.4.2",
"version": "2.5.0",
"engines": {

@@ -32,4 +32,4 @@ "node": ">=4.0"

"devDependencies": {
"mocha": "^3.1.2"
"mocha": "^3.5.0"
}
}

@@ -15,3 +15,2 @@ var assert = require('assert');

var code = coder.run(test.css);
it('should match output.normal.css', function() {

@@ -18,0 +17,0 @@ //test.write('output.normal.css', code.css);

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