mirror of https://github.com/lukechilds/rollup.git
Rich-Harris
9 years ago
4 changed files with 46 additions and 16 deletions
@ -0,0 +1,25 @@ |
|||||
|
var assert = require( 'assert' ); |
||||
|
var MagicString = require( 'magic-string' ); |
||||
|
|
||||
|
module.exports = { |
||||
|
description: 'allows sourcemap chains with some untransformed modules (#404)', |
||||
|
options: { |
||||
|
plugins: [{ |
||||
|
transform: function ( code, id ) { |
||||
|
if ( /untransformed-modules\/foo/.test( id ) ) { |
||||
|
var s = new MagicString( code ); |
||||
|
var index = code.indexOf( '1' ); |
||||
|
s.overwrite( index, index + 1, '2' ); |
||||
|
|
||||
|
return { |
||||
|
code: s.toString(), |
||||
|
map: s.generateMap({ hires: true }) |
||||
|
}; |
||||
|
} |
||||
|
} |
||||
|
}] |
||||
|
}, |
||||
|
test: function () { |
||||
|
assert.ok( true ); |
||||
|
} |
||||
|
}; |
@ -0,0 +1 @@ |
|||||
|
export var foo = 1; |
@ -0,0 +1,2 @@ |
|||||
|
import { foo } from './foo.js'; |
||||
|
assert.equal( foo, 2 ); |
Loading…
Reference in new issue