Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

mapcat

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mapcat - npm Package Compare versions

Comparing version
0.3.0
to
0.4.0
License

Sorry, the diff of this file is not supported yet

+16
-13

@@ -1,12 +0,12 @@

// Generated by CoffeeScript 1.8.0
var SourceMapConsumer, SourceMapGenerator, path, readFileSync, writeFileSync, _ref, _ref1;
// Generated by CoffeeScript 2.0.2
var SourceMapConsumer, SourceMapGenerator, path, readFileSync, writeFileSync;
_ref = require('fs'), readFileSync = _ref.readFileSync, writeFileSync = _ref.writeFileSync;
({readFileSync, writeFileSync} = require('fs'));
path = require('path');
_ref1 = require('source-map'), SourceMapConsumer = _ref1.SourceMapConsumer, SourceMapGenerator = _ref1.SourceMapGenerator;
({SourceMapConsumer, SourceMapGenerator} = require('source-map'));
exports.cat = function(inputMapFiles, outJSFile, outMapFile, maproot) {
var buffer, f, generator, lineOffset, map, src, srcPath, _i, _len;
var buffer, f, generator, i, len, lineOffset, map, src, srcPath;
buffer = [];

@@ -17,5 +17,6 @@ generator = new SourceMapGenerator({

lineOffset = 0;
for (_i = 0, _len = inputMapFiles.length; _i < _len; _i++) {
f = inputMapFiles[_i];
for (i = 0, len = inputMapFiles.length; i < len; i++) {
f = inputMapFiles[i];
map = new SourceMapConsumer(readFileSync(f, 'utf-8'));
// concatenate the file
srcPath = path.join(path.dirname(f), map.file);

@@ -25,5 +26,6 @@ src = readFileSync(srcPath, 'utf-8');

buffer.push(src);
// add all mappings in this file
map.eachMapping(function(mapping) {
var origSrc;
origSrc = path.join(path.dirname(f), mapping.source);
origSrc = mapping.source && path.join(path.dirname(f), mapping.source);
mapping = {

@@ -35,15 +37,16 @@ generated: {

original: {
line: mapping.originalLine,
column: mapping.originalColumn
line: mapping.originalLine || "1",
column: mapping.originalColumn || "1"
},
source: path.relative(path.dirname(outMapFile), origSrc)
source: origSrc ? path.relative(path.dirname(outMapFile), origSrc) : 'unknown:/'
};
return generator.addMapping(mapping);
});
// update line offset so we could start working with the next file
lineOffset += src.split('\n').length;
}
if (maproot === null) {
buffer.push("//# sourceMappingURL=" + (path.relative(path.dirname(outJSFile), outMapFile)));
buffer.push(`//# sourceMappingURL=${path.relative(path.dirname(outJSFile), outMapFile)}`);
} else {
buffer.push("//# sourceMappingURL=" + (maproot + path.relative(path.dirname(outJSFile), outMapFile)));
buffer.push(`//# sourceMappingURL=${maproot + path.relative(path.dirname(outJSFile), outMapFile)}`);
}

@@ -50,0 +53,0 @@ writeFileSync(outJSFile, buffer.join('\n'), 'utf-8');

@@ -5,21 +5,32 @@ {

"main": "lib",
"version": "0.3.0",
"engines": { "node" : ">=0.4.0" },
"maintainers": [{
"name": "Eddie Cao",
"email": "cao.yiqun@gmail.com",
"web": "http://github.com/edc"
}],
"repositories": [{
"type": "git",
"url": "https://github.com/edc/mapcat.git"
}],
"version": "0.4.0",
"engines": {
"node": ">=0.4.0"
},
"maintainers": [
{
"name": "Eddie Cao",
"email": "cao.yiqun@gmail.com",
"web": "http://github.com/edc"
}
],
"repositories": [
{
"type": "git",
"url": "https://github.com/edc/mapcat.git"
}
],
"dependencies": {
"source-map" : "~0.1.3",
"optimist" : "~0.3.5"
"optimist": "~0.3.5",
"source-map": "~0.1.3"
},
"bin": {
"mapcat" : "bin/mapcat"
"mapcat": "bin/mapcat"
},
"scripts": {"test": "node test/run-tests.js"}
"scripts": {
"test": "node test/run-tests.js"
},
"devDependencies": {
"coffeescript": "^2.0.2"
}
}

@@ -22,3 +22,3 @@ {readFileSync, writeFileSync} = require('fs')

map.eachMapping (mapping) ->
origSrc = path.join(path.dirname(f), mapping.source)
origSrc = mapping.source and path.join(path.dirname(f), mapping.source)
mapping =

@@ -29,5 +29,5 @@ generated:

original:
line: mapping.originalLine
column: mapping.originalColumn
source: path.relative(path.dirname(outMapFile), origSrc)
line: mapping.originalLine or "1"
column: mapping.originalColumn or "1"
source: if origSrc then path.relative(path.dirname(outMapFile), origSrc) else 'unknown:/'
generator.addMapping mapping

@@ -34,0 +34,0 @@

Sorry, the diff of this file is not supported yet