Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

borschik

Package Overview
Dependencies
Maintainers
12
Versions
69
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

borschik - npm Package Compare versions

Comparing version 2.1.0-rc.1 to 2.1.0-rc.2

lib/techs/js/builder.js

20

lib/techs/js/mappings-iterator.js

@@ -22,3 +22,3 @@ var inherit = require('inherit');

/**
* @callback readWhileCallback
* @callback whileCallback
* @param {Mapping} mapping

@@ -28,3 +28,19 @@ * @return {Boolean}

/**
* @param {readWhileCallback} fn
* @param {whileCallback} fn
*/
skipWhile: function(fn) {
var mappings = this.mappings;
var len = mappings.length;
while (this.position < len) {
var mapping = mappings[this.position];
if (!fn(mapping)) {
break;
}
++this.position;
}
},
/**
* @param {whileCallback} fn
* @returns {Mapping[]}

@@ -31,0 +47,0 @@ */

28

lib/techs/js/nodes-serializer.js
var path = require('path');
var inherit = require('inherit');
var Concater = require('./concater');
var Builder = require('./builder');
var SourceMapRegistry = require('./source-map-registry');

@@ -28,3 +28,3 @@ var nodes = require('./nodes');

this.concater = new Concater({
this.builder = new Builder({
generateSourceMap: !!options.sourceMap,

@@ -48,3 +48,3 @@ sourceMapFilename: options.sourceMapFilename,

/**
* @returns {Concater}
* @returns {Builder}
*/

@@ -54,12 +54,13 @@ serialize: function() {

var options = this.options;
var concater = this.concater;
var builder = this.builder;
var inputSourceMap = options.sourceMap && options.inputSourceMap;
this.nodes.forEach(function addToConcater(node) {
if (node instanceof nodes.IncludeNode) {
node.eachChild(addToConcater);
this.nodes.forEach(function append(node, i) {
if (node.hasChildren()) {
node.eachChild(append);
} else {
var resetFile = i === 0;
var mappings = inputSourceMap ? self.getMappingsForNode(node) : null;
concater.concat(path.relative(options.sourceMapRoot, node.path), node, mappings);
builder.append(path.relative(options.sourceMapRoot, node.path), node, mappings, resetFile);
}

@@ -74,3 +75,3 @@

return concater;
return builder;
},

@@ -97,3 +98,3 @@

var lastLine = firstLine + linesCount - 1;
// First column starts after borschik's directives, if any.
// First column starts after borschik's directive.
var firstColumn = mappingsIterator.lastColumn + (passedDirective ? passedDirective.length : 0);

@@ -103,3 +104,3 @@ // One-liners should add the start offset to the end offset. -1 since columns are 0-based;

mappingsIterator.readWhile(function(m) {
mappingsIterator.skipWhile(function(m) {
return m.generatedLine === firstLine && m.generatedColumn < firstColumn;

@@ -111,4 +112,3 @@ });

// Correct mappings – treat every node as a separate file,
// so mappings should starts from the [1, 0] (line, column).
// Correct offsets.
mappings.forEach(function(m) {

@@ -120,3 +120,3 @@ m.generatedColumn = m.generatedColumn - (m.generatedLine === firstLine ? firstColumn : 0);

mappingsIterator.lastLine = lastLine;
mappingsIterator.lastColumn = node instanceof nodes.LinkURLNode ? firstColumn : (lastColumn + 1);
mappingsIterator.lastColumn = node.ignoreMappings() ? firstColumn : (lastColumn + 1);

@@ -123,0 +123,0 @@ return mappings;

@@ -38,2 +38,9 @@ var inherit = require('inherit');

/**
* @returns {Boolean}
*/
hasChildren: function() {
return false;
},
/**
* @returns {String}

@@ -50,2 +57,11 @@ */

return this._lines || (this._lines = this.getContent().split(/\r?\n/));
},
/**
* Whether node should be excluded from mappings.
*
* @returns {Boolean}
*/
ignoreMappings: function() {
return false;
}

@@ -58,5 +74,19 @@ }, {

var LinkURLNode = BaseNode.inherit();
var CommentNode = StringNode.inherit({
ignoreMappings: function() {
return true;
}
});
var LinkURLNode = BaseNode.inherit({
ignoreMappings: function() {
return true;
}
});
var IncludeNode = BaseNode.inherit({
hasChildren: function() {
return true;
},
getContent: function() {

@@ -85,3 +115,3 @@ if (this._serialized !== undefined) {

if (this.commentsWrap) {
fn(new StringNode(commentsWrapBegin(this.commentsWrap), this.path));
fn(new CommentNode(commentsWrapBegin(this.commentsWrap), this.path));
}

@@ -92,3 +122,3 @@

if (this.commentsWrap) {
fn(new StringNode(commentsWrapEnd(this.commentsWrap), this.path));
fn(new CommentNode(commentsWrapEnd(this.commentsWrap), this.path));
}

@@ -118,2 +148,3 @@ },

StringNode: StringNode,
CommentNode: CommentNode,
LinkURLNode: LinkURLNode,

@@ -120,0 +151,0 @@ IncludeNode: IncludeNode,

{
"name": "borschik",
"description": "Extendable builder for text-based file formats",
"version": "2.1.0-rc.1",
"version": "2.1.0-rc.2",
"homepage": "http://github.com/borschik/borschik",

@@ -6,0 +6,0 @@ "author": "Sergey Berezhnoy <veged@ya.ru> (http://github.com/veged)",

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