mirror of https://github.com/lukechilds/rollup.git
Rich Harris
9 years ago
17 changed files with 145 additions and 0 deletions
@ -0,0 +1,3 @@ |
|||
module.exports = { |
|||
description: 'side-effects to non-globals are not blindly included' |
|||
}; |
@ -0,0 +1,7 @@ |
|||
define(function () { 'use strict'; |
|||
|
|||
var foo = 42; |
|||
|
|||
assert.equal( foo, 42 ); |
|||
|
|||
}); |
@ -0,0 +1,5 @@ |
|||
'use strict'; |
|||
|
|||
var foo = 42; |
|||
|
|||
assert.equal( foo, 42 ); |
@ -0,0 +1,3 @@ |
|||
var foo = 42; |
|||
|
|||
assert.equal( foo, 42 ); |
@ -0,0 +1,7 @@ |
|||
(function () { 'use strict'; |
|||
|
|||
var foo = 42; |
|||
|
|||
assert.equal( foo, 42 ); |
|||
|
|||
})(); |
@ -0,0 +1,11 @@ |
|||
(function (global, factory) { |
|||
typeof exports === 'object' && typeof module !== 'undefined' ? factory() : |
|||
typeof define === 'function' && define.amd ? define(factory) : |
|||
factory(); |
|||
}(this, function () { 'use strict'; |
|||
|
|||
var foo = 42; |
|||
|
|||
assert.equal( foo, 42 ); |
|||
|
|||
})); |
@ -0,0 +1,13 @@ |
|||
var uid = 0; |
|||
uid = 1; |
|||
uid += 1; |
|||
uid++; |
|||
|
|||
// ensure identifiers aren't treated as globals just because
|
|||
// var declaration hasn't been encountered yet...
|
|||
uid2 = 1; |
|||
uid2 += 1; |
|||
uid2++; |
|||
var uid2; |
|||
|
|||
export var foo = 42; |
@ -0,0 +1,2 @@ |
|||
import { foo } from './foo'; |
|||
assert.equal( foo, 42 ); |
@ -0,0 +1,3 @@ |
|||
module.exports = { |
|||
description: 'globally called function should be included if it modifies an exported value (#112)' |
|||
}; |
@ -0,0 +1,3 @@ |
|||
import value from './module.js'; |
|||
|
|||
assert.equal( value, 3 ); |
@ -0,0 +1,17 @@ |
|||
var value = 1; |
|||
|
|||
function change () { |
|||
value = 2; |
|||
} |
|||
|
|||
function changeAgain () { |
|||
value += 1; |
|||
} |
|||
|
|||
change(); |
|||
|
|||
if ( true ) { |
|||
changeAgain(); |
|||
} |
|||
|
|||
export default value; |
@ -0,0 +1,14 @@ |
|||
var assert = require( 'assert' ); |
|||
|
|||
var Math = {}; |
|||
|
|||
module.exports = { |
|||
description: 'side-effects to assumed globals are included', |
|||
context: { |
|||
Math: Math |
|||
}, |
|||
exports: function ( exports ) { |
|||
assert.equal( Math.square( 3 ), 9 ); |
|||
assert.equal( Math.cube( 3 ), 27 ); |
|||
} |
|||
}; |
@ -0,0 +1,3 @@ |
|||
import { square } from './math'; |
|||
|
|||
assert.equal( square( 2 ), 4 ); |
@ -0,0 +1,15 @@ |
|||
function square ( x ) { |
|||
return x * x; |
|||
} |
|||
|
|||
function cube ( x ) { |
|||
return x * x * x; |
|||
} |
|||
|
|||
Math.square = square; |
|||
|
|||
if ( true ) { |
|||
Math.cube = cube; |
|||
} |
|||
|
|||
export { square }; |
Loading…
Reference in new issue