How to use combine-source-map - 10 common examples

To help you get started, we’ve selected a few combine-source-map examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jamesshore / automatopia / node_modules / browserify / node_modules / insert-module-globals / index.js View on Github external
);
      wrappedSource = '(function (' + names.join(',') + '){\n'
        + src + '\n}).call(this,' + values.join(',') + ')';
    }

    // Generate source maps if wanted. Including the right offset for
    // the wrapped source.
    if (!opts.debug) {
        return wrappedSource;
    }
    var sourceFile = path.relative(opts.basedir, file)
        .replace(/\\/g, '/');
    var sourceMap = combineSourceMap.create().addFile(
        { sourceFile: sourceFile, source: src},
        { line: 1 });
    return combineSourceMap.removeComments(wrappedSource) + "\n"
        + sourceMap.comment();
}
github jamesshore / lets_code_javascript / node_modules / browserify / node_modules / insert-module-globals / index.js View on Github external
);
      wrappedSource = '(function (' + names.join(',') + '){\n'
        + src + '\n}).call(this,' + values.join(',') + ')';
    }

    // Generate source maps if wanted. Including the right offset for
    // the wrapped source.
    if (!opts.debug) {
        return wrappedSource;
    }
    var sourceFile = path.relative(opts.basedir, file)
        .replace(/\\/g, '/');
    var sourceMap = combineSourceMap.create().addFile(
        { sourceFile: sourceFile, source: src},
        { line: 1 });
    return combineSourceMap.removeComments(wrappedSource) + "\n"
        + sourceMap.comment();
}
github stolksdorf / vitreum / node_modules / browserify / node_modules / insert-module-globals / index.js View on Github external
values.splice(3, 0,
          'arguments[3]','arguments[4]',
          'arguments[5]','arguments[6]'
      );
      wrappedSource = '(function (' + names.join(',') + '){\n'
        + src + '\n}).call(this,' + values.join(',') + ')';
    }

    // Generate source maps if wanted. Including the right offset for
    // the wrapped source.
    if (!opts.debug) {
        return wrappedSource;
    }
    var sourceFile = path.relative(opts.basedir, file)
        .replace(/\\/g, '/');
    var sourceMap = combineSourceMap.create().addFile(
        { sourceFile: sourceFile, source: src},
        { line: 1 });
    return combineSourceMap.removeComments(wrappedSource) + "\n"
        + sourceMap.comment();
}
github jamesshore / lets_code_javascript / node_modules / browserify / node_modules / insert-module-globals / index.js View on Github external
values.splice(3, 0,
          'arguments[3]','arguments[4]',
          'arguments[5]','arguments[6]'
      );
      wrappedSource = '(function (' + names.join(',') + '){\n'
        + src + '\n}).call(this,' + values.join(',') + ')';
    }

    // Generate source maps if wanted. Including the right offset for
    // the wrapped source.
    if (!opts.debug) {
        return wrappedSource;
    }
    var sourceFile = path.relative(opts.basedir, file)
        .replace(/\\/g, '/');
    var sourceMap = combineSourceMap.create().addFile(
        { sourceFile: sourceFile, source: src},
        { line: 1 });
    return combineSourceMap.removeComments(wrappedSource) + "\n"
        + sourceMap.comment();
}
github jamesshore / automatopia / node_modules / browserify / node_modules / insert-module-globals / index.js View on Github external
values.splice(3, 0,
          'arguments[3]','arguments[4]',
          'arguments[5]','arguments[6]'
      );
      wrappedSource = '(function (' + names.join(',') + '){\n'
        + src + '\n}).call(this,' + values.join(',') + ')';
    }

    // Generate source maps if wanted. Including the right offset for
    // the wrapped source.
    if (!opts.debug) {
        return wrappedSource;
    }
    var sourceFile = path.relative(opts.basedir, file)
        .replace(/\\/g, '/');
    var sourceMap = combineSourceMap.create().addFile(
        { sourceFile: sourceFile, source: src},
        { line: 1 });
    return combineSourceMap.removeComments(wrappedSource) + "\n"
        + sourceMap.comment();
}
github Jam3 / devtool / lib / require-hook.js View on Github external
].join('\n');
        hasComment = true; // now we have base64 comment
      } catch (err) {
        // Don't attempt to handle source maps for this file,
        // it is most likely a comment about source maps and not
        // a *real* source map comment!
      }
    }

    var wrapScript = moduleWrap(script);

    // do not make any more alterations to the source maps
    if (hasComment || hasMapFile) return wrapScript;

    // Otherwise, if no source maps exist, we can generate a new one
    var sourceMap = combineSourceMap.create(sourceFileName, basedir)
        .addFile({ sourceFile: sourceFile, source: original });
    return [
      combineSourceMap.removeComments(wrapScript),
      sourceMap.comment()
    ].join('\n');
  };
github MiguelCastillo / bit-bundler / test / spec / bundler / chunkedBundleBuilder.js View on Github external
it("then the bundler generates the correct result", function() {
      var expected = (
`require=_bb$iter=(${BUNDLE_MODULE_LOADER})({
${wrapModule(input, 1, {"./X": 2})},
${wrapModule(dep1, 2)}
},[1]);

`);

      expect(combineSourceMap.removeComments(result)).to.equal(expected);
    });
  });
github Truebase-com / TruthStack / Makets / sample / example.js View on Github external
source: "function b()\n{\n\tconsole.log(\"b1\");\n\tconsole.log(\"b2\");\n\tconsole.log(\"b3\");\n}" + "\n" + bComment
	, sourceFile: "b.js"
};

var cFile = {
	source: "function c()\n{\n\tconsole.log(\"c1\");\n\tconsole.log(\"c2\");\n\tconsole.log(\"c3\");\n}" + "\n" + cComment
	, sourceFile: "c.js"
};

var dFile = {
	source: "function d()\n{\n\tconsole.log(\"d1\");\n\tconsole.log(\"d2\");\n\tconsole.log(\"d3\");\n}" + "\n" + dComment
	, sourceFile: "d.js"
};

var offset = { line: 2 };
var base64 = combine
	.create("bundle.js")
	.addFile(aFile, offset)
	.addFile(bFile, { line: offset.line + 8 })
	//.addFile(cFile, { line: offset.line + 16 })
	//.addFile(dFile, { line: offset.line + 24 })
	.base64();

console.log(base64);

//var sm = convert.fromBase64(base64).toObject();
//console.log("Combined source maps:\n", sm);
//console.log("\nMappings:\n", sm.mappings);
github browserify / browser-pack / index.js View on Github external
function wrapSimple(src) {
    return 'function(require,module,exports){\n'
        + combineSourceMap.removeComments(src)
        + '\n}';
}
github monounity / karma-typescript / src / bundler / source-map.ts View on Github external
public removeSourceMapComment(queued: Queued): string {
        return queued.emitOutput.sourceMapText ?
            combineSourceMap.removeComments(queued.emitOutput.outputText) :
            queued.emitOutput.outputText;
    }

combine-source-map

Add source maps of multiple files, offset them and then combine them into one source map

MIT
Latest version published 7 years ago

Package Health Score

71 / 100
Full package analysis