diff --git a/.jshintrc b/.jshintrc new file mode 100644 index 0000000..6d429f3 --- /dev/null +++ b/.jshintrc @@ -0,0 +1,8 @@ +{ + "esnext": true, + "undef": true, + "unused": true, + "globals": { + "process": true + } +} \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..62ebcce --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,10 @@ +# rollup changelog + +## 0.2.0 + +* First release capable of doing anything useful +* Still lots of basic functionality missing + +## 0.1.0 + +* Initial experiment \ No newline at end of file diff --git a/src/Bundle/index.js b/src/Bundle/index.js index a6f573b..64f5fe2 100644 --- a/src/Bundle/index.js +++ b/src/Bundle/index.js @@ -1,9 +1,8 @@ -import { resolve, sep } from 'path'; +import { resolve } from 'path'; import { readFile } from 'sander'; import MagicString from 'magic-string'; import { keys, has } from '../utils/object'; import { sequence } from '../utils/promise'; -import sanitize from '../utils/sanitize'; import Module from '../Module/index'; import finalisers from '../finalisers/index'; import replaceIdentifiers from '../utils/replaceIdentifiers'; @@ -16,7 +15,6 @@ export default class Bundle { this.modulePromises = {}; this.modules = {}; - this.modulesArray = []; // this will store the top-level AST nodes we import this.body = []; @@ -38,16 +36,7 @@ export default class Bundle { bundle: this }); - //const bindingNames = bundle.getBindingNamesFor( module ); - - // we need to ensure that this module's top-level - // declarations don't conflict with the bundle so far - module.definedNames.forEach( name => { - - }); - this.modules[ path ] = module; - this.modulesArray.push( module ); return module; }); } diff --git a/src/ast/analyse.js b/src/ast/analyse.js index 2701550..7e1eb28 100644 --- a/src/ast/analyse.js +++ b/src/ast/analyse.js @@ -2,16 +2,8 @@ import walk from './walk'; import Scope from './Scope'; import { getName } from '../utils/map-helpers'; -function isStatement ( node, parent ) { - return node.type === 'ExportDefaultDeclaration' || - node.type === 'ExpressionStatement' || - node.type === 'VariableDeclaration' || - node.type === 'FunctionDeclaration'; // TODO or any of the other various statement-ish things it could be -} - export default function analyse ( ast, magicString, module ) { let scope = new Scope(); - let topLevelStatements = []; let currentTopLevelStatement; function addToScope ( declarator ) { @@ -51,7 +43,7 @@ export default function analyse ( ast, magicString, module ) { currentTopLevelStatement = statement; // so we can attach scoping info walk( statement, { - enter ( node, parent ) { + enter ( node ) { let newScope; magicString.addSourcemapLocation( node.start ); diff --git a/src/finalisers/umd.js b/src/finalisers/umd.js index c90479c..eed7afa 100644 --- a/src/finalisers/umd.js +++ b/src/finalisers/umd.js @@ -13,7 +13,7 @@ export default function umd ( bundle, magicString, options ) { const exports = bundle.entryModule.exports; const exportBlock = '\n\n' + Object.keys( exports ).map( name => { - return `exports.${name} = ${exports[name].localName};` + return `exports.${name} = ${exports[name].localName};`; }).join( '\n' ); return magicString diff --git a/src/utils/sanitize.js b/src/utils/sanitize.js deleted file mode 100644 index ae75339..0000000 --- a/src/utils/sanitize.js +++ /dev/null @@ -1,6 +0,0 @@ -export default function sanitize ( name ) { - name = name.replace( /[^$_0-9a-zA-Z]/g, '_' ); - if ( !/[$_a-zA-Z]/.test( name ) ) name = `_${name}`; - - return name; -} \ No newline at end of file