How to use the source-map-resolve.resolveSourceMapSync function in source-map-resolve

To help you get started, we’ve selected a few source-map-resolve 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 manse / stylus-css-modules / lib / index.js View on Github external
style.on('end', function(err, css) {
            var sourceMap = sourceMapResolve.resolveSourceMapSync(css, null, fs.readFile);
            var mangled = mangle(css, sourceMap.map, {
                camelCase: pluginOptions.camelCase,
                projection: pluginOptions.projection
            });
            if (typeof pluginOptions.target === 'function') {
                pluginOptions.target(style.options.filename, mangled.map);
            } else {
                for (var i in mangled.map) {
                    var relativePath = path.relative(srcDir, path.resolve(destDir, i));
                    if (~relativePath.indexOf('..')) {
                        console.log(color.yellow('Traversal path "' + relativePath + '" is not output.'));
                        continue;
                    }
                    var styl = path.parse(relativePath);
                    var variableName = camelCase(styl.name);
                    var outputPath = path.resolve(scriptDir, relativePath.replace(new RegExp(styl.ext + '$'), '.' + target));

source-map-resolve

Resolve the source map and/or sources for a generated file.

MIT
Latest version published 5 years ago

Package Health Score

55 / 100
Full package analysis