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

@ridi/epub-parser

Package Overview
Dependencies
Maintainers
12
Versions
81
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ridi/epub-parser - npm Package Compare versions

Comparing version 0.6.0 to 0.6.1

46

lib/loader/cssLoader.js

@@ -6,2 +6,7 @@ 'use strict';

});
var _slicedToArray2 = require('babel-runtime/helpers/slicedToArray');
var _slicedToArray3 = _interopRequireDefault(_slicedToArray2);
exports.default = cssLoader;

@@ -30,2 +35,16 @@

function getUnwrappingTagList(namespace, options) {
if ((0, _parserCore.isExists)(namespace)) {
var extractBody = options.extractBody;
if (extractBody === true) {
return ['html'];
}
if ((0, _parserCore.isFunc)(extractBody)) {
return ['html', 'body'];
}
}
return [];
}
function handleRulePrelude(selectorList, options, cssItem) {

@@ -36,5 +55,9 @@ if (!(0, _parserCore.isExists)(selectorList.children)) {

var namespace = cssItem.namespace;
var unwrappingTagList = getUnwrappingTagList(namespace, options);
selectorList.children.each(function (selector, item, list) {
// eslint-disable-line
var shouldRemove = false;
var shouldUnwrap = false;
_cssTree2.default.walk(selector, function (node) {

@@ -58,2 +81,4 @@ // eslint-disable-line

shouldRemove = true;
} else if ((0, _parserCore.stringContains)(unwrappingTagList, name)) {
shouldUnwrap = true;
}

@@ -73,5 +98,22 @@ } else if (type === Types.ID_SELECTOR) {

list.remove(item);
} else if ((0, _parserCore.isExists)(cssItem.namespace)) {
} else if ((0, _parserCore.isExists)(namespace)) {
var namespaceData = { type: Types.CLASS_SELECTOR, name: namespace };
if (shouldUnwrap) {
var array = selector.children.toArray();
if (array.length > 1) {
var _array = (0, _slicedToArray3.default)(array, 1),
head = _array[0];
if ((0, _parserCore.stringContains)(unwrappingTagList, head.name)) {
selector.children.shift();
selector.children.prependData(namespaceData);
return;
}
} else {
selector.children = new _cssTree.List().fromArray([namespaceData]);
return;
}
}
selector.children.prependData({ type: Types.WHITE_SPACE, value: ' ' });
selector.children.prependData({ type: Types.CLASS_SELECTOR, name: cssItem.namespace });
selector.children.prependData(namespaceData);
}

@@ -78,0 +120,0 @@ });

4

package.json
{
"name": "@ridi/epub-parser",
"version": "0.6.0",
"version": "0.6.1",
"description": "Common EPUB2 data parser for Ridibooks services",

@@ -31,3 +31,3 @@ "author": {

"dependencies": {
"@ridi/parser-core": "^0.6.0",
"@ridi/parser-core": "^0.6.1",
"css-tree": "^1.0.0-alpha.29",

@@ -34,0 +34,0 @@ "fast-xml-parser": "^3.12.17",

@@ -9,3 +9,2 @@ # @ridi/epub-parser

[![NPM total downloads](https://img.shields.io/npm/dt/%40ridi%2Fepub-parser.svg)](https://npm.im/%40ridi%2Fepub-parser)
[![Greenkeeper badge](https://badges.greenkeeper.io/ridi/content-parser.svg)](https://greenkeeper.io/)

@@ -12,0 +11,0 @@ ## Features

Sorry, the diff of this file is not supported yet

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