mirror of https://github.com/lukechilds/rollup.git
Rich-Harris
9 years ago
29 changed files with 162 additions and 49 deletions
@ -0,0 +1,16 @@ |
|||
import Promise from 'es6-promise/lib/es6-promise/promise.js'; |
|||
|
|||
export function mapSequence ( array, fn ) { |
|||
let results = []; |
|||
let promise = Promise.resolve(); |
|||
|
|||
function next ( member, i ) { |
|||
return fn( member ).then( value => results[i] = value ); |
|||
} |
|||
|
|||
for ( let i = 0; i < array.length; i += 1 ) { |
|||
promise = promise.then( () => next( array[i], i ) ); |
|||
} |
|||
|
|||
return promise.then( () => results ); |
|||
} |
@ -1,9 +1,19 @@ |
|||
define(['exports'], function (exports) { 'use strict'; |
|||
|
|||
var foo = 'foo'; |
|||
var bar = 'bar'; |
|||
var baz = 'baz'; |
|||
var bam = 'bam'; |
|||
|
|||
var x = {[foo]: 'bar'}; |
|||
var x = { [foo]: 'bar' }; |
|||
|
|||
class X { |
|||
[bar] () {} |
|||
get [baz] () {} |
|||
set [bam] ( value ) {} |
|||
} |
|||
|
|||
exports.x = x; |
|||
exports.X = X; |
|||
|
|||
}); |
@ -1,7 +1,17 @@ |
|||
'use strict'; |
|||
|
|||
var foo = 'foo'; |
|||
var bar = 'bar'; |
|||
var baz = 'baz'; |
|||
var bam = 'bam'; |
|||
|
|||
var x = {[foo]: 'bar'}; |
|||
var x = { [foo]: 'bar' }; |
|||
|
|||
exports.x = x; |
|||
class X { |
|||
[bar] () {} |
|||
get [baz] () {} |
|||
set [bam] ( value ) {} |
|||
} |
|||
|
|||
exports.x = x; |
|||
exports.X = X; |
@ -1,5 +1,14 @@ |
|||
var foo = 'foo'; |
|||
var bar = 'bar'; |
|||
var baz = 'baz'; |
|||
var bam = 'bam'; |
|||
|
|||
var x = {[foo]: 'bar'}; |
|||
var x = { [foo]: 'bar' }; |
|||
|
|||
export { x }; |
|||
class X { |
|||
[bar] () {} |
|||
get [baz] () {} |
|||
set [bam] ( value ) {} |
|||
} |
|||
|
|||
export { x, X }; |
@ -1,13 +1,23 @@ |
|||
(function (global, factory) { |
|||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : |
|||
typeof define === 'function' && define.amd ? define(['exports'], factory) : |
|||
(factory((global.computedProperties = {}))); |
|||
(factory((global.computedProperties = global.computedProperties || {}))); |
|||
}(this, function (exports) { 'use strict'; |
|||
|
|||
var foo = 'foo'; |
|||
var bar = 'bar'; |
|||
var baz = 'baz'; |
|||
var bam = 'bam'; |
|||
|
|||
var x = {[foo]: 'bar'}; |
|||
var x = { [foo]: 'bar' }; |
|||
|
|||
class X { |
|||
[bar] () {} |
|||
get [baz] () {} |
|||
set [bam] ( value ) {} |
|||
} |
|||
|
|||
exports.x = x; |
|||
exports.X = X; |
|||
|
|||
})); |
@ -1,3 +1,12 @@ |
|||
var foo = 'foo'; |
|||
var bar = 'bar'; |
|||
var baz = 'baz'; |
|||
var bam = 'bam'; |
|||
|
|||
export var x = {[foo]: 'bar'}; |
|||
export var x = { [foo]: 'bar' }; |
|||
|
|||
export class X { |
|||
[bar] () {} |
|||
get [baz] () {} |
|||
set [bam] ( value ) {} |
|||
} |
|||
|
@ -0,0 +1,17 @@ |
|||
var assert = require( 'assert' ); |
|||
|
|||
var warned = false; |
|||
|
|||
module.exports = { |
|||
description: 'warns on export {}, but does not fail', |
|||
options: { |
|||
onwarn: function ( msg ) { |
|||
warned = true; |
|||
assert.ok( /main\.js has an empty export declaration/.test( msg ) ); |
|||
} |
|||
}, |
|||
exports: function ( exports ) { |
|||
assert.equal( Object.keys( exports ).length, 0 ); |
|||
assert.ok( warned, 'did not warn' ); |
|||
} |
|||
}; |
@ -0,0 +1 @@ |
|||
export {}; |
@ -0,0 +1,10 @@ |
|||
var assert = require( 'assert' ); |
|||
|
|||
module.exports = { |
|||
description: 'detect side effect in member expression assignment when not top level', |
|||
code: function ( code ) { |
|||
assert.equal( code.indexOf( 'function set(key, value) { foo[key] = value; }' ) >= 0, true, code ); |
|||
assert.equal( code.indexOf( 'set("bar", 2);' ) >= 0, true, code ); |
|||
assert.equal( code.indexOf( 'set("qux", 3);' ) >= 0, true, code ); |
|||
} |
|||
} |
@ -0,0 +1,9 @@ |
|||
var foo = {}; |
|||
|
|||
function set(key, value) { foo[key] = value; } |
|||
|
|||
set("bar", 2); |
|||
set("qux", 3); |
|||
|
|||
console.log(foo); |
|||
|
Loading…
Reference in new issue