mirror of https://github.com/lukechilds/rollup.git
Rich-Harris
9 years ago
20 changed files with 134 additions and 18 deletions
@ -0,0 +1,9 @@ |
|||
export default function error ( props ) { |
|||
const err = new Error( props.message ); |
|||
|
|||
Object.keys( props ).forEach( key => { |
|||
err[ key ] = props[ key ]; |
|||
}); |
|||
|
|||
throw err; |
|||
} |
@ -1,8 +1,9 @@ |
|||
'use strict'; |
|||
|
|||
var $ = require('jquery'); |
|||
$ = 'default' in $ ? $['default'] : $; |
|||
function _interopDefault (ex) { return 'default' in ex ? ex['default'] : ex; } |
|||
|
|||
var $ = _interopDefault(require('jquery')); |
|||
|
|||
$( function () { |
|||
$( 'body' ).html( '<h1>hello world!</h1>' ); |
|||
}); |
|||
}); |
@ -1,14 +1,15 @@ |
|||
'use strict'; |
|||
|
|||
var factory = require('factory'); |
|||
factory = 'default' in factory ? factory['default'] : factory; |
|||
function _interopDefault (ex) { return 'default' in ex ? ex['default'] : ex; } |
|||
|
|||
var factory = _interopDefault(require('factory')); |
|||
var baz = require('baz'); |
|||
var containers = require('shipping-port'); |
|||
var alphabet = require('alphabet'); |
|||
var alphabet__default = 'default' in alphabet ? alphabet['default'] : alphabet; |
|||
var alphabet__default = _interopDefault(alphabet); |
|||
|
|||
factory( null ); |
|||
baz.foo( baz.bar, containers.port ); |
|||
containers.forEach( console.log, console ); |
|||
console.log( alphabet.a ); |
|||
console.log( alphabet__default.length ); |
|||
console.log( alphabet__default.length ); |
@ -0,0 +1,12 @@ |
|||
var path = require( 'path' ); |
|||
var assert = require( 'assert' ); |
|||
|
|||
module.exports = { |
|||
description: 'errors if code calls an external namespace', |
|||
error: function ( err ) { |
|||
assert.equal( err.message, 'Cannot call a namespace (\'foo\')' ); |
|||
assert.equal( err.file.replace( /\//g, path.sep ), path.resolve( __dirname, 'main.js' ) ); |
|||
assert.equal( err.pos, 28 ); |
|||
assert.deepEqual( err.loc, { line: 2, column: 0 }); |
|||
} |
|||
}; |
@ -0,0 +1,2 @@ |
|||
import * as foo from 'foo'; |
|||
foo(); |
@ -0,0 +1,12 @@ |
|||
var path = require( 'path' ); |
|||
var assert = require( 'assert' ); |
|||
|
|||
module.exports = { |
|||
description: 'errors if code calls an internal namespace', |
|||
error: function ( err ) { |
|||
assert.equal( err.message, 'Cannot call a namespace (\'foo\')' ); |
|||
assert.equal( err.file.replace( /\//g, path.sep ), path.resolve( __dirname, 'main.js' ) ); |
|||
assert.equal( err.pos, 33 ); |
|||
assert.deepEqual( err.loc, { line: 2, column: 0 }); |
|||
} |
|||
}; |
@ -0,0 +1 @@ |
|||
export const a = 1; |
@ -0,0 +1,2 @@ |
|||
import * as foo from './foo.js'; |
|||
foo(); |
@ -0,0 +1,3 @@ |
|||
module.exports = { |
|||
description: 'does not stack overflow on crazy cyclical dependencies' |
|||
}; |
@ -0,0 +1,11 @@ |
|||
import { C } from './c.js'; |
|||
|
|||
export function B () {}; |
|||
|
|||
B.prototype = { |
|||
c: function () { |
|||
return function () { |
|||
new C(); |
|||
}; |
|||
}() |
|||
}; |
@ -0,0 +1,13 @@ |
|||
import { D } from './d.js'; |
|||
|
|||
export function C () { |
|||
this.x = 'x'; |
|||
} |
|||
|
|||
C.prototype = { |
|||
d: function () { |
|||
return function () { |
|||
new D(); |
|||
}; |
|||
}() |
|||
}; |
@ -0,0 +1,12 @@ |
|||
import { B } from './b.js'; |
|||
import { C } from './c.js'; |
|||
|
|||
export function D () {}; |
|||
|
|||
D.prototype = { |
|||
c: function () { |
|||
return function () { |
|||
new C(); |
|||
}; |
|||
}() |
|||
}; |
@ -0,0 +1,3 @@ |
|||
import { C } from './c.js'; |
|||
|
|||
assert.equal( new C().x, 'x' ); |
Loading…
Reference in new issue