You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

grunt-rollup

Package Overview
Dependencies
Maintainers
1
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

grunt-rollup - npm Package Compare versions

Comparing version

to
0.1.0

test/expected/source_map.js

19

Gruntfile.js

@@ -34,7 +34,24 @@ /*

default_options: {
options: {},
files: {
'tmp/default_options.js': ['test/fixtures/entry.js']
}
},
sourceMap: {
options: {
sourceMap: true,
banner: '// Top',
footer: '// Bottom'
},
files: {
'tmp/default_options.js': ['test/fixtures/entry.js']
'tmp/source_map.js': ['test/fixtures/entry.js']
}
},
sourceMapInline: {
options: {
sourceMap: 'inline'
},
files: {
'tmp/source_map_inline.js': ['test/fixtures/entry.js']
}
}

@@ -41,0 +58,0 @@ },

2

package.json
{
"name": "grunt-rollup",
"description": "Grunt plugin for rollup - next-generation ES6 module bundler",
"version": "0.0.1",
"version": "0.1.0",
"homepage": "https://github.com/chrisprice/grunt-rollup",

@@ -6,0 +6,0 @@ "author": {

@@ -40,4 +40,8 @@ # grunt-rollup

Supports all the options from [rollup's JavaScript API](https://github.com/rollup/rollup/wiki/JavaScript-API) apart from sourcemaps.
Supports all the options from [rollup's JavaScript API](https://github.com/rollup/rollup/wiki/JavaScript-API).
### Sourcemaps
A value of `true` for `sourceMap` will output the map to a file with the same name as the JavaScript with `.map` appended. A value of `inline` for `sourceMap` will inline the sourcemap into the source file.
### Usage Examples

@@ -44,0 +48,0 @@

@@ -28,3 +28,7 @@ /*

indent: true,
useStrict: true
useStrict: true,
banner: null,
footer: null,
sourceMap: false,
sourceMapFile: null
});

@@ -59,6 +63,18 @@

indent: options.indent,
useStrict: options.useStrict
useStrict: options.useStrict,
banner: options.banner,
footer: options.footer,
sourceMap: options.sourceMap,
sourceMapFile: options.sourceMapFile
});
grunt.file.write(f.dest, result.code);
var code = result.code;
if (options.sourceMap === true) {
grunt.file.write(f.dest + '.map', result.map.toString());
} else if (options.sourceMap === "inline") {
code += "\n//# sourceMappingURL=" + result.map.toUrl();
}
grunt.file.write(f.dest, code);
});

@@ -65,0 +81,0 @@ });

var foo = {};
console.log(foo);
import foo from './bar';
console.log(foo);

@@ -5,2 +5,11 @@ 'use strict';

function assertFilesSame(test, actual, expected, msg) {
var actualContents = grunt.file.read(actual);
var expectedContents = grunt.file.read(expected)
// see https://github.com/rollup/rollup/issues/125
.replace(/\{cwd\}/ig, process.cwd().replace(/\\/ig, "/"));
test.equal(actualContents, expectedContents, msg);
}
exports.rollup = {

@@ -10,8 +19,32 @@ default_options: function(test) {

var actual = grunt.file.read('tmp/default_options.js');
var expected = grunt.file.read('test/expected/default_options.js');
test.equal(actual, expected, 'should describe what the default behavior is.');
assertFilesSame(test, 'tmp/default_options.js',
'test/expected/default_options.js',
'should describe what the default behavior is.');
test.done();
},
source_map: function(test) {
test.expect(2);
assertFilesSame(test, 'tmp/source_map.js',
'test/expected/source_map.js',
'should describe behaviour with sourcemap and banner/footer.');
assertFilesSame(test, 'tmp/source_map.js.map',
'test/expected/source_map.js.map',
'should write a map file.');
test.done();
},
source_map_inline: function(test) {
test.expect(1);
// need https://github.com/rollup/rollup/issues/125
// to compare with expected
var output = grunt.file.read("tmp/source_map_inline.js");
test.ok(Boolean(output.match(/\/\/# sourceMappingURL=data:application\/json;charset=utf-8;base64,/)));
test.done();
}
};

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet