mirror of https://github.com/lukechilds/rollup.git
Rich-Harris
10 years ago
23 changed files with 123 additions and 11 deletions
@ -1,3 +1,6 @@ |
|||
module.exports = { |
|||
description: 'imports external modules from nested internal modules' |
|||
description: 'imports external modules from nested internal modules', |
|||
options: { |
|||
external: [ 'path' ] |
|||
} |
|||
}; |
|||
|
@ -0,0 +1,15 @@ |
|||
var path = require( 'path' ); |
|||
var assert = require( 'assert' ); |
|||
var Promise = require( 'sander' ).Promise; |
|||
|
|||
module.exports = { |
|||
description: 'uses a custom external path resolver (asynchronous)', |
|||
options: { |
|||
resolveExternal: function ( id, importer, options ) { |
|||
return Promise.resolve( path.resolve( __dirname, 'js_modules', id + '.js' ) ); |
|||
} |
|||
}, |
|||
exports: function ( exports ) { |
|||
assert.ok( exports.success ); |
|||
} |
|||
}; |
@ -0,0 +1 @@ |
|||
export default { isExternal: true }; |
@ -0,0 +1,3 @@ |
|||
import external from 'external'; |
|||
|
|||
export default { success: external.isExternal }; |
@ -0,0 +1,14 @@ |
|||
var path = require( 'path' ); |
|||
var assert = require( 'assert' ); |
|||
|
|||
module.exports = { |
|||
description: 'uses a custom external path resolver (synchronous)', |
|||
options: { |
|||
resolveExternal: function ( id, importer, options ) { |
|||
return path.resolve( __dirname, 'js_modules', id + '.js' ); |
|||
} |
|||
}, |
|||
exports: function ( exports ) { |
|||
assert.ok( exports.success ); |
|||
} |
|||
}; |
@ -0,0 +1 @@ |
|||
export default { isExternal: true }; |
@ -0,0 +1,3 @@ |
|||
import external from 'external'; |
|||
|
|||
export default { success: external.isExternal }; |
@ -1,3 +1,6 @@ |
|||
module.exports = { |
|||
description: 'imports default from external module' |
|||
}; |
|||
description: 'imports default from external module', |
|||
options: { |
|||
external: [ 'path' ] |
|||
} |
|||
}; |
|||
|
@ -1,3 +1,6 @@ |
|||
module.exports = { |
|||
description: 'imports names from an external module' |
|||
}; |
|||
description: 'imports names from an external module', |
|||
options: { |
|||
external: [ 'path' ] |
|||
} |
|||
}; |
|||
|
@ -1,3 +1,6 @@ |
|||
module.exports = { |
|||
description: 'imports a namespace from an external module and renames it' |
|||
description: 'imports a namespace from an external module and renames it', |
|||
options: { |
|||
external: [ 'path' ] |
|||
} |
|||
}; |
|||
|
@ -1,3 +1,6 @@ |
|||
module.exports = { |
|||
description: 'imports a namespace from an external module' |
|||
}; |
|||
description: 'imports a namespace from an external module', |
|||
options: { |
|||
external: [ 'path' ] |
|||
} |
|||
}; |
|||
|
@ -1,3 +1,6 @@ |
|||
module.exports = { |
|||
description: 'deconflicts imports (redux)' |
|||
description: 'deconflicts imports (redux)', |
|||
options: { |
|||
external: [ 'path' ] |
|||
} |
|||
}; |
|||
|
@ -1,3 +1,6 @@ |
|||
module.exports = { |
|||
description: 'deconflicts imports' |
|||
description: 'deconflicts imports', |
|||
options: { |
|||
external: [ 'path' ] |
|||
} |
|||
}; |
|||
|
@ -0,0 +1,3 @@ |
|||
module.exports = { |
|||
description: 'assigning to properties of imported bindings is permitted' |
|||
}; |
@ -0,0 +1 @@ |
|||
export default {}; |
@ -0,0 +1,5 @@ |
|||
import foo from './foo'; |
|||
|
|||
foo.modified = true; |
|||
|
|||
export default foo; |
@ -1,3 +1,6 @@ |
|||
module.exports = { |
|||
description: 'external modules are not shadowed' |
|||
description: 'external modules are not shadowed', |
|||
options: { |
|||
external: [ 'path' ] |
|||
} |
|||
}; |
|||
|
@ -0,0 +1,21 @@ |
|||
var assert = require( 'assert' ); |
|||
|
|||
module.exports = { |
|||
description: 'accepts multiple transformer functions', |
|||
options: { |
|||
transform: [ |
|||
function ( code, path ) { |
|||
return code.replace( /MAGIC_NUMBER/g, 3 ); |
|||
}, |
|||
|
|||
function ( code, path ) { |
|||
return code.replace( /\d+/g, function ( match ) { |
|||
return 2 * +match; |
|||
}); |
|||
} |
|||
] |
|||
}, |
|||
exports: function ( exports ) { |
|||
assert.equal( exports.magicNumber, 6 ); |
|||
} |
|||
} |
@ -0,0 +1 @@ |
|||
export default MAGIC_NUMBER; |
@ -0,0 +1,3 @@ |
|||
import foo from './foo'; |
|||
|
|||
export var magicNumber = foo; |
@ -0,0 +1,13 @@ |
|||
var assert = require( 'assert' ); |
|||
|
|||
module.exports = { |
|||
description: 'accepts a single transformer function', |
|||
options: { |
|||
transform: function ( code, path ) { |
|||
return code.replace( /MAGIC_NUMBER/g, 3 ); |
|||
} |
|||
}, |
|||
exports: function ( exports ) { |
|||
assert.equal( exports.magicNumber, 3 ); |
|||
} |
|||
} |
@ -0,0 +1 @@ |
|||
export default MAGIC_NUMBER; |
@ -0,0 +1,3 @@ |
|||
import foo from './foo'; |
|||
|
|||
export var magicNumber = foo; |
Loading…
Reference in new issue