UNPKG

79 kBSource Map (JSON)View Raw
1{"version":3,"file":"rollup.js","sources":["../src/rollup.js","../src/Bundle.js","../src/utils/load.js","../src/utils/resolvePath.js","../src/utils/ensureArray.js","../src/finalisers/index.js","../src/finalisers/umd.js","../src/finalisers/iife.js","../src/finalisers/es6.js","../src/finalisers/cjs.js","../src/finalisers/amd.js","../src/ExternalModule.js","../src/Module.js","../src/utils/makeLegalIdentifier.js","../src/ast/analyse.js","../src/Statement.js","../src/ast/Scope.js","../src/ast/walk.js","../src/utils/getLocation.js","../src/utils/map-helpers.js","../src/utils/promise.js","../src/utils/object.js"],"sourcesContent":["import { basename } from 'path';\nimport { writeFile } from 'sander';\nimport Bundle from './Bundle';\n\nlet SOURCEMAPPING_URL = 'sourceMa';\nSOURCEMAPPING_URL += 'ppingURL';\n\nexport function rollup ( options ) {\n\tif ( !options || !options.entry ) {\n\t\tthrow new Error( 'You must supply options.entry to rollup' );\n\t}\n\n\tconst bundle = new Bundle( options );\n\n\treturn bundle.build().then( () => {\n\t\treturn {\n\t\t\tgenerate: options => bundle.generate( options ),\n\t\t\twrite: options => {\n\t\t\t\tif ( !options || !options.dest ) {\n\t\t\t\t\tthrow new Error( 'You must supply options.dest to bundle.write' );\n\t\t\t\t}\n\n\t\t\t\tconst dest = options.dest;\n\t\t\t\tlet { code, map } = bundle.generate( options );\n\n\t\t\t\tlet promises = [ writeFile( dest, code ) ];\n\n\t\t\t\tif ( options.sourceMap ) {\n\t\t\t\t\tlet url;\n\n\t\t\t\t\tif ( options.sourceMap === 'inline' ) {\n\t\t\t\t\t\turl = map.toUrl();\n\t\t\t\t\t} else {\n\t\t\t\t\t\turl = `${basename( dest )}.map`;\n\t\t\t\t\t\tpromises.push( writeFile( dest + '.map', map.toString() ) );\n\t\t\t\t\t}\n\n\t\t\t\t\tcode += `\\n//# ${SOURCEMAPPING_URL}=${url}`;\n\t\t\t\t}\n\n\t\t\t\treturn Promise.all( promises );\n\t\t\t}\n\t\t};\n\t});\n}\n","import { basename, dirname, extname, relative, resolve } from 'path';\nimport { readFile, Promise } from 'sander';\nimport MagicString from 'magic-string';\nimport { keys, has } from './utils/object';\nimport Module from './Module';\nimport ExternalModule from './ExternalModule';\nimport finalisers from './finalisers/index';\nimport makeLegalIdentifier from './utils/makeLegalIdentifier';\nimport ensureArray from './utils/ensureArray';\nimport { defaultResolver, defaultExternalResolver } from './utils/resolvePath';\nimport { defaultLoader } from './utils/load';\n\nfunction badExports ( option, keys ) {\n\tthrow new Error( `'${option}' was specified for options.exports, but entry module has following exports: ${keys.join(', ')}` );\n}\n\nexport default class Bundle {\n\tconstructor ( options ) {\n\t\tthis.entryPath = resolve( options.entry ).replace( /\\.js$/, '' ) + '.js';\n\t\tthis.base = dirname( this.entryPath );\n\n\t\tthis.resolvePath = options.resolvePath || defaultResolver;\n\t\tthis.load = options.load || defaultLoader;\n\n\t\tthis.resolvePathOptions = {\n\t\t\texternal: ensureArray( options.external ),\n\t\t\tresolveExternal: options.resolveExternal || defaultExternalResolver\n\t\t};\n\n\t\tthis.loadOptions = {\n\t\t\ttransform: ensureArray( options.transform )\n\t\t};\n\n\t\tthis.entryModule = null;\n\t\tthis.modulePromises = {};\n\t\tthis.statements = [];\n\t\tthis.externalModules = [];\n\t\tthis.defaultExportName = null;\n\t\tthis.internalNamespaceModules = [];\n\t}\n\n\tfetchModule ( importee, importer ) {\n\t\treturn Promise.resolve( importer === null ? importee : this.resolvePath( importee, importer, this.resolvePathOptions ) )\n\t\t\t.then( path => {\n\t\t\t\tif ( !path ) {\n\t\t\t\t\t// external module\n\t\t\t\t\tif ( !has( this.modulePromises, importee ) ) {\n\t\t\t\t\t\tconst module = new ExternalModule( importee );\n\t\t\t\t\t\tthis.externalModules.push( module );\n\t\t\t\t\t\tthis.modulePromises[ importee ] = Promise.resolve( module );\n\t\t\t\t\t}\n\n\t\t\t\t\treturn this.modulePromises[ importee ];\n\t\t\t\t}\n\n\t\t\t\tif ( !has( this.modulePromises, path ) ) {\n\t\t\t\t\tthis.modulePromises[ path ] = Promise.resolve( this.load( path, this.loadOptions ) )\n\t\t\t\t\t\t.then( source => {\n\t\t\t\t\t\t\tconst module = new Module({\n\t\t\t\t\t\t\t\tpath,\n\t\t\t\t\t\t\t\tsource,\n\t\t\t\t\t\t\t\tbundle: this\n\t\t\t\t\t\t\t});\n\n\t\t\t\t\t\t\treturn module;\n\t\t\t\t\t\t});\n\t\t\t\t}\n\n\t\t\t\treturn this.modulePromises[ path ];\n\t\t\t});\n\t}\n\n\tbuild () {\n\t\t// bring in top-level AST nodes from the entry module\n\t\treturn this.fetchModule( this.entryPath, null )\n\t\t\t.then( entryModule => {\n\t\t\t\tthis.entryModule = entryModule;\n\n\t\t\t\tif ( entryModule.exports.default ) {\n\t\t\t\t\tlet defaultExportName = makeLegalIdentifier( basename( this.entryPath ).slice( 0, -extname( this.entryPath ).length ) );\n\n\t\t\t\t\tlet topLevelNames = [];\n\t\t\t\t\tentryModule.statements.forEach( statement => {\n\t\t\t\t\t\tkeys( statement.defines ).forEach( name => topLevelNames.push( name ) );\n\t\t\t\t\t});\n\n\t\t\t\t\twhile ( ~topLevelNames.indexOf( defaultExportName ) ) {\n\t\t\t\t\t\tdefaultExportName = `_${defaultExportName}`;\n\t\t\t\t\t}\n\n\t\t\t\t\tentryModule.suggestName( 'default', defaultExportName );\n\t\t\t\t}\n\n\t\t\t\treturn entryModule.expandAllStatements( true );\n\t\t\t})\n\t\t\t.then( statements => {\n\t\t\t\tthis.statements = statements;\n\t\t\t\tthis.deconflict();\n\t\t\t});\n\t}\n\n\tdeconflict () {\n\t\tlet definers = {};\n\t\tlet conflicts = {};\n\n\t\t// Discover conflicts (i.e. two statements in separate modules both define `foo`)\n\t\tthis.statements.forEach( statement => {\n\t\t\tconst module = statement.module;\n\t\t\tconst names = keys( statement.defines );\n\n\t\t\t// with default exports that are expressions (`export default 42`),\n\t\t\t// we need to ensure that the name chosen for the expression does\n\t\t\t// not conflict\n\t\t\tif ( statement.node.type === 'ExportDefaultDeclaration' ) {\n\t\t\t\tconst name = module.getCanonicalName( 'default' );\n\n\t\t\t\tconst isProxy = statement.node.declaration && statement.node.declaration.type === 'Identifier';\n\t\t\t\tconst shouldDeconflict = !isProxy || ( module.getCanonicalName( statement.node.declaration.name ) !== name );\n\n\t\t\t\tif ( shouldDeconflict && !~names.indexOf( name ) ) {\n\t\t\t\t\tnames.push( name );\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tnames.forEach( name => {\n\t\t\t\tif ( has( definers, name ) ) {\n\t\t\t\t\tconflicts[ name ] = true;\n\t\t\t\t} else {\n\t\t\t\t\tdefiners[ name ] = [];\n\t\t\t\t}\n\n\t\t\t\t// TODO in good js, there shouldn't be duplicate definitions\n\t\t\t\t// per module... but some people write bad js\n\t\t\t\tdefiners[ name ].push( module );\n\t\t\t});\n\t\t});\n\n\t\t// Assign names to external modules\n\t\tthis.externalModules.forEach( module => {\n\t\t\t// TODO is this right?\n\t\t\tlet name = makeLegalIdentifier( module.suggestedNames['*'] || module.suggestedNames.default || module.id );\n\n\t\t\tif ( has( definers, name ) ) {\n\t\t\t\tconflicts[ name ] = true;\n\t\t\t} else {\n\t\t\t\tdefiners[ name ] = [];\n\t\t\t}\n\n\t\t\tdefiners[ name ].push( module );\n\t\t\tmodule.name = name;\n\t\t});\n\n\t\t// Rename conflicting identifiers so they can live in the same scope\n\t\tkeys( conflicts ).forEach( name => {\n\t\t\tconst modules = definers[ name ];\n\n\t\t\tmodules.pop(); // the module closest to the entryModule gets away with keeping things as they are\n\n\t\t\tmodules.forEach( module => {\n\t\t\t\tconst replacement = getSafeName( name );\n\t\t\t\tmodule.rename( name, replacement );\n\t\t\t});\n\t\t});\n\n\t\tfunction getSafeName ( name ) {\n\t\t\twhile ( has( conflicts, name ) ) {\n\t\t\t\tname = `_${name}`;\n\t\t\t}\n\n\t\t\tconflicts[ name ] = true;\n\t\t\treturn name;\n\t\t}\n\t}\n\n\tgenerate ( options = {} ) {\n\t\tlet magicString = new MagicString.Bundle({ separator: '' });\n\n\t\t// Determine export mode - 'default', 'named', 'none'\n\t\tlet exportMode = this.getExportMode( options.exports );\n\n\t\tlet previousMargin = 0;\n\n\t\t// Apply new names and add to the output bundle\n\t\tthis.statements.forEach( statement => {\n\t\t\tlet replacements = {};\n\n\t\t\tkeys( statement.dependsOn )\n\t\t\t\t.concat( keys( statement.defines ) )\n\t\t\t\t.forEach( name => {\n\t\t\t\t\tconst canonicalName = statement.module.getCanonicalName( name );\n\n\t\t\t\t\tif ( name !== canonicalName ) {\n\t\t\t\t\t\treplacements[ name ] = canonicalName;\n\t\t\t\t\t}\n\t\t\t\t});\n\n\t\t\tconst source = statement.replaceIdentifiers( replacements );\n\n\t\t\t// modify exports as necessary\n\t\t\tif ( statement.isExportDeclaration ) {\n\t\t\t\t// skip `export { foo, bar, baz }`\n\t\t\t\tif ( statement.node.type === 'ExportNamedDeclaration' && statement.node.specifiers.length ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// remove `export` from `export var foo = 42`\n\t\t\t\tif ( statement.node.type === 'ExportNamedDeclaration' && statement.node.declaration.type === 'VariableDeclaration' ) {\n\t\t\t\t\tsource.remove( statement.node.start, statement.node.declaration.start );\n\t\t\t\t}\n\n\t\t\t\t// remove `export` from `export class Foo {...}` or `export default Foo`\n\t\t\t\t// TODO default exports need different treatment\n\t\t\t\telse if ( statement.node.declaration.id ) {\n\t\t\t\t\tsource.remove( statement.node.start, statement.node.declaration.start );\n\t\t\t\t}\n\n\t\t\t\telse if ( statement.node.type === 'ExportDefaultDeclaration' ) {\n\t\t\t\t\tconst module = statement.module;\n\t\t\t\t\tconst canonicalName = module.getCanonicalName( 'default' );\n\n\t\t\t\t\tif ( statement.node.declaration.type === 'Identifier' && canonicalName === module.getCanonicalName( statement.node.declaration.name ) ) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\tsource.overwrite( statement.node.start, statement.node.declaration.start, `var ${canonicalName} = ` );\n\t\t\t\t}\n\n\t\t\t\telse {\n\t\t\t\t\tthrow new Error( 'Unhandled export' );\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// add leading comments\n\t\t\tif ( statement.leadingComments.length ) {\n\t\t\t\tconst commentBlock = statement.leadingComments.map( comment => {\n\t\t\t\t\treturn comment.block ?\n\t\t\t\t\t\t`/*${comment.text}*/` :\n\t\t\t\t\t\t`//${comment.text}`;\n\t\t\t\t}).join( '\\n' );\n\n\t\t\t\tmagicString.addSource( new MagicString( commentBlock ) );\n\t\t\t}\n\n\t\t\t// add margin\n\t\t\tconst margin = Math.max( statement.margin[0], previousMargin );\n\t\t\tconst newLines = new Array( margin ).join( '\\n' );\n\n\t\t\t// add the statement itself\n\t\t\tmagicString.addSource({\n\t\t\t\tcontent: source,\n\t\t\t\tseparator: newLines\n\t\t\t});\n\n\t\t\t// add trailing comments\n\t\t\tconst comment = statement.trailingComment;\n\t\t\tif ( comment ) {\n\t\t\t\tconst commentBlock = comment.block ?\n\t\t\t\t\t` /*${comment.text}*/` :\n\t\t\t\t\t` //${comment.text}`;\n\n\t\t\t\tmagicString.append( commentBlock );\n\t\t\t}\n\n\t\t\tpreviousMargin = statement.margin[1];\n\t\t});\n\n\t\t// prepend bundle with internal namespaces\n\t\tconst indentString = magicString.getIndentString();\n\t\tconst namespaceBlock = this.internalNamespaceModules.map( module => {\n\t\t\tconst exportKeys = keys( module.exports );\n\n\t\t\treturn `var ${module.getCanonicalName('*')} = {\\n` +\n\t\t\t\texportKeys.map( key => `${indentString}get ${key} () { return ${module.getCanonicalName(key)}; }` ).join( ',\\n' ) +\n\t\t\t`\\n};\\n\\n`;\n\t\t}).join( '' );\n\n\t\tmagicString.prepend( namespaceBlock );\n\n\t\tconst finalise = finalisers[ options.format || 'es6' ];\n\n\t\tif ( !finalise ) {\n\t\t\tthrow new Error( `You must specify an output type - valid options are ${keys( finalisers ).join( ', ' )}` );\n\t\t}\n\n\t\tmagicString = finalise( this, magicString.trim(), exportMode, options );\n\n\t\tconst code = magicString.toString();\n\t\tlet map = null;\n\n\t\tif ( options.sourceMap ) {\n\t\t\tmap = magicString.generateMap({\n\t\t\t\tincludeContent: true,\n\t\t\t\tfile: options.sourceMapFile || options.dest\n\t\t\t\t// TODO\n\t\t\t});\n\n\t\t\t// make sources relative. TODO fix this upstream?\n\t\t\tconst dir = dirname( map.file );\n\t\t\tmap.sources = map.sources.map( source => {\n\t\t\t\treturn source ? relative( dir, source ) : null\n\t\t\t});\n\t\t}\n\n\t\treturn { code, map };\n\t}\n\n\tgetExportMode ( exportMode ) {\n\t\tconst exportKeys = keys( this.entryModule.exports );\n\n\t\tif ( exportMode === 'default' ) {\n\t\t\tif ( exportKeys.length !== 1 || exportKeys[0] !== 'default' ) {\n\t\t\t\tbadExports( 'default', exportKeys );\n\t\t\t}\n\t\t} else if ( exportMode === 'none' && exportKeys.length ) {\n\t\t\tbadExports( 'none', exportKeys );\n\t\t}\n\n\t\tif ( !exportMode || exportMode === 'auto' ) {\n\t\t\tif ( exportKeys.length === 0 ) {\n\t\t\t\texportMode = 'none';\n\t\t\t} else if ( exportKeys.length === 1 && exportKeys[0] === 'default' ) {\n\t\t\t\texportMode = 'default';\n\t\t\t} else {\n\t\t\t\texportMode = 'named';\n\t\t\t}\n\t\t}\n\n\t\tif ( !/(?:default|named|none)/.test( exportMode ) ) {\n\t\t\tthrow new Error( `options.exports must be 'default', 'named', 'none', 'auto', or left unspecified (defaults to 'auto')` );\n\t\t}\n\n\t\treturn exportMode;\n\t}\n}\n","import { readFileSync } from 'sander';\n\nexport function defaultLoader ( path, options ) {\n\t// TODO support plugins e.g. !css and !json?\n\tconst source = readFileSync( path, { encoding: 'utf-8' });\n\n\treturn options.transform.reduce( ( source, transformer ) => {\n\t\treturn transformer( source, path );\n\t}, source );\n}\n","import { dirname, isAbsolute, resolve, parse } from 'path';\nimport { readFileSync } from 'sander';\n\nexport function defaultResolver ( importee, importer, options ) {\n\t// absolute paths are left untouched\n\tif ( isAbsolute( importee ) ) return importee;\n\n\t// we try to resolve external modules\n\tif ( importee[0] !== '.' ) {\n\t\t// unless we want to keep it external, that is\n\t\tif ( ~options.external.indexOf( importee ) ) return null;\n\n\t\treturn options.resolveExternal( importee, importer, options );\n\t}\n\n\treturn resolve( dirname( importer ), importee ).replace( /\\.js$/, '' ) + '.js';\n}\n\nexport function defaultExternalResolver ( id, importer, options ) {\n\t// for now, only node_modules is supported, and only jsnext:main\n\tlet parsed = parse( importer );\n\tlet dir = parsed.dir;\n\n\twhile ( dir !== parsed.root ) {\n\t\tconst pkgPath = resolve( dir, 'node_modules', id, 'package.json' );\n\t\tlet pkgJson;\n\n\t\ttry {\n\t\t\tpkgJson = readFileSync( pkgPath ).toString();\n\t\t} catch ( err ) {\n\t\t\t// noop\n\t\t}\n\n\t\tif ( pkgJson ) {\n\t\t\tlet pkg;\n\n\t\t\ttry {\n\t\t\t\tpkg = JSON.parse( pkgJson );\n\t\t\t} catch ( err ) {\n\t\t\t\tthrow new Error( `Malformed JSON: ${pkgPath}` );\n\t\t\t}\n\n\t\t\tconst main = pkg[ 'jsnext:main' ];\n\n\t\t\tif ( !main ) {\n\t\t\t\tthrow new Error( `Package ${id} does not have a jsnext:main field, and so cannot be included in your rollup. Try adding it as an external module instead (e.g. options.external = ['${id}']). See https://github.com/rollup/rollup/wiki/jsnext:main for more info` );\n\t\t\t}\n\n\t\t\treturn resolve( dirname( pkgPath ), main ).replace( /\\.js$/, '' ) + '.js';\n\t\t}\n\n\t\tdir = dirname( dir );\n\t}\n\n\tthrow new Error( `Could not find package ${id} (required by ${importer})` );\n}\n","export default function ensureArray ( thing ) {\n\tif ( Array.isArray( thing ) ) return thing;\n\tif ( thing == undefined ) return [];\n\treturn [ thing ];\n}\n","import amd from './amd';\nimport cjs from './cjs';\nimport es6 from './es6';\nimport iife from './iife';\nimport umd from './umd';\n\nexport default { amd, cjs, es6, iife, umd };\n","import { has } from '../utils/object';\nimport { getName, quoteId, req } from '../utils/map-helpers';\n\nexport default function umd ( bundle, magicString, exportMode, options ) {\n\tconst indentStr = magicString.getIndentString();\n\n\tconst globalNames = options.globals || {};\n\n\tlet amdDeps = bundle.externalModules.map( quoteId );\n\tlet cjsDeps = bundle.externalModules.map( req );\n\tlet globalDeps = bundle.externalModules.map( module => {\n\t\treturn has( globalNames, module.id ) ? globalNames[ module.id ] : module.name;\n\t});\n\n\tlet args = bundle.externalModules.map( getName );\n\n\tif ( exportMode === 'named' ) {\n\t\tamdDeps.unshift( `'exports'` );\n\t\tcjsDeps.unshift( `'exports'` );\n\t\tglobalDeps.unshift( `(global.${options.moduleName} = {})` );\n\n\t\targs.unshift( 'exports' );\n\t}\n\n\tconst amdParams =\n\t\t( has( options, 'moduleId' ) ? `['${options.moduleId}'], ` : `` ) +\n\t\t( amdDeps.length ? `[${amdDeps.join( ', ' )}], ` : `` );\n\n\tconst defaultExport = exportMode === 'default' ? `global.${options.moduleName} = ` : '';\n\n\tconst intro =\n\t\t`(function (global, factory) {\n\t\t\ttypeof exports === 'object' && typeof module !== 'undefined' ? factory(${cjsDeps.join( ', ' )}) :\n\t\t\ttypeof define === 'function' && define.amd ? define(${amdParams}factory) :\n\t\t\t${defaultExport}factory(${globalDeps});\n\t\t}(this, function (${args}) { 'use strict';\n\n\t\t`.replace( /^\\t\\t/gm, '' ).replace( /^\\t/gm, indentStr );\n\n\tconst exports = bundle.entryModule.exports;\n\n\tlet exportBlock;\n\n\tif ( exportMode === 'default' ) {\n\t\tconst canonicalName = bundle.entryModule.getCanonicalName( 'default' );\n\t\texportBlock = `return ${canonicalName};`;\n\t} else {\n\t\texportBlock = Object.keys( exports ).map( name => {\n\t\t\tconst canonicalName = bundle.entryModule.getCanonicalName( exports[ name ].localName );\n\t\t\treturn `exports.${name} = ${canonicalName};`;\n\t\t}).join( '\\n' );\n\t}\n\n\tif ( exportBlock ) {\n\t\tmagicString.append( '\\n\\n' + exportBlock );\n\t}\n\n\treturn magicString\n\t\t.trim()\n\t\t.indent()\n\t\t.append( '\\n\\n}));' )\n\t\t.prepend( intro );\n}\n","import { has } from '../utils/object';\nimport { getName } from '../utils/map-helpers';\n\nexport default function iife ( bundle, magicString, exportMode, options ) {\n\tconst globalNames = options.globals || {};\n\n\tlet dependencies = bundle.externalModules.map( module => {\n\t\treturn has( globalNames, module.id ) ? globalNames[ module.id ] : module.name;\n\t});\n\n\tlet args = bundle.externalModules.map( getName );\n\n\tif ( exportMode !== 'none' && !options.moduleName ) {\n\t\tthrow new Error( 'You must supply options.moduleName for IIFE bundles' );\n\t}\n\n\tif ( exportMode === 'named' ) {\n\t\tdependencies.unshift( `(window.${options.moduleName} = {})` );\n\t\targs.unshift( 'exports' );\n\t}\n\n\tlet intro = `(function (${args}) { 'use strict';\\n\\n`;\n\tlet outro = `\\n\\n})(${dependencies});`;\n\n\tif ( exportMode === 'default' ) {\n\t\tintro = `var ${options.moduleName} = ${intro}`;\n\t\tmagicString.append( `\\n\\nreturn ${bundle.entryModule.getCanonicalName('default')};` );\n\t}\n\n\treturn magicString\n\t\t.indent()\n\t\t.prepend( intro )\n\t\t.append( outro );\n}\n","import { keys } from '../utils/object';\n\nexport default function es6 ( bundle, magicString, exportMode, options ) {\n\tconst introBlock = ''; // TODO...\n\n\tconst exports = bundle.entryModule.exports;\n\tconst exportBlock = keys( exports ).map( exportedName => {\n\t\tconst specifier = exports[ exportedName ];\n\n\t\tconst canonicalName = bundle.entryModule.getCanonicalName( specifier.localName );\n\n\t\tif ( exportedName === 'default' ) {\n\t\t\treturn `export default ${canonicalName};`;\n\t\t}\n\n\t\treturn exportedName === canonicalName ?\n\t\t\t`export { ${exportedName} };` :\n\t\t\t`export { ${canonicalName} as ${exportedName} };`;\n\t}).join( '\\n' );\n\n\tif ( exportBlock ) {\n\t\tmagicString.append( '\\n\\n' + exportBlock );\n\t}\n\n\treturn magicString.trim();\n}\n","import { keys } from '../utils/object';\n\nexport default function cjs ( bundle, magicString, exportMode ) {\n\tlet intro = `'use strict';\\n\\n`;\n\n\t// TODO handle empty imports, once they're supported\n\tconst importBlock = bundle.externalModules\n\t\t.map( module => {\n\t\t\tlet requireStatement = `var ${module.name} = require('${module.id}');`;\n\n\t\t\tif ( module.needsDefault ) {\n\t\t\t\trequireStatement += '\\n' + ( module.needsNamed ? `var ${module.name}__default = ` : `${module.name} = ` ) +\n\t\t\t\t\t`'default' in ${module.name} ? ${module.name}['default'] : ${module.name};`;\n\t\t\t}\n\n\t\t\treturn requireStatement;\n\t\t})\n\t\t.join( '\\n' );\n\n\tif ( importBlock ) {\n\t\tintro += importBlock + '\\n\\n';\n\t}\n\n\tmagicString.prepend( intro );\n\n\tlet exportBlock;\n\tif ( exportMode === 'default' && bundle.entryModule.exports.default ) {\n\t\texportBlock = `module.exports = ${bundle.entryModule.getCanonicalName('default')};`;\n\t} else if ( exportMode === 'named' ) {\n\t\texportBlock = keys( bundle.entryModule.exports )\n\t\t\t.map( key => {\n\t\t\t\tconst specifier = bundle.entryModule.exports[ key ];\n\t\t\t\tconst name = bundle.entryModule.getCanonicalName( specifier.localName );\n\n\t\t\t\treturn `exports.${key} = ${name};`;\n\t\t\t})\n\t\t\t.join( '\\n' );\n\t}\n\n\tif ( exportBlock ) {\n\t\tmagicString.append( '\\n\\n' + exportBlock );\n\t}\n\n\treturn magicString;\n}\n","import { has } from '../utils/object';\nimport { getName, quoteId } from '../utils/map-helpers';\n\nexport default function amd ( bundle, magicString, exportMode, options ) {\n\tlet deps = bundle.externalModules.map( quoteId );\n\tlet args = bundle.externalModules.map( getName );\n\n\tif ( exportMode === 'named' ) {\n\t\targs.unshift( `exports` );\n\t\tdeps.unshift( `'exports'` );\n\t}\n\n\tconst params =\n\t\t( has( options, 'moduleId' ) ? `['${options.moduleId}'], ` : `` ) +\n\t\t( deps.length ? `[${deps.join( ', ' )}], ` : `` );\n\n\tconst intro = `define(${params}function (${args.join( ', ' )}) { 'use strict';\\n\\n`;\n\n\tconst exports = bundle.entryModule.exports;\n\n\tlet exportBlock;\n\n\tif ( exportMode === 'default' ) {\n\t\texportBlock = `return ${bundle.entryModule.getCanonicalName('default')};`;\n\t} else {\n\t\texportBlock = Object.keys( exports ).map( name => {\n\t\t\treturn `exports.${name} = ${exports[name].localName};`;\n\t\t}).join( '\\n' );\n\t}\n\n\tif ( exportBlock ) {\n\t\tmagicString.append( '\\n\\n' + exportBlock );\n\t}\n\n\treturn magicString\n\t\t.trim()\n\t\t.indent()\n\t\t.append( '\\n\\n});' )\n\t\t.prepend( intro );\n}\n","export default class ExternalModule {\n\tconstructor ( id ) {\n\t\tthis.id = id;\n\t\tthis.name = null;\n\n\t\tthis.isExternal = true;\n\t\tthis.importedByBundle = [];\n\n\t\tthis.canonicalNames = {};\n\t\tthis.suggestedNames = {};\n\n\t\tthis.needsDefault = false;\n\t\tthis.needsNamed = false;\n\t}\n\n\tgetCanonicalName ( name ) {\n\t\tif ( name === 'default' ) {\n\t\t\treturn this.needsNamed ? `${this.name}__default` : this.name;\n\t\t}\n\n\t\tif ( name === '*' ) {\n\t\t\treturn this.name;\n\t\t}\n\n\t\t// TODO this depends on the output format... works for CJS etc but not ES6\n\t\treturn `${this.name}.${name}`;\n\t}\n\n\trename ( name, replacement ) {\n\t\tthis.canonicalNames[ name ] = replacement;\n\t}\n\n\tsuggestName ( exportName, suggestion ) {\n\t\tif ( !this.suggestedNames[ exportName ] ) {\n\t\t\tthis.suggestedNames[ exportName ] = suggestion;\n\t\t}\n\t}\n}\n","import { relative } from 'path';\nimport { Promise } from 'sander';\nimport { parse } from 'acorn';\nimport MagicString from 'magic-string';\nimport Statement from './Statement';\nimport walk from './ast/walk';\nimport analyse from './ast/analyse';\nimport { blank, has, keys } from './utils/object';\nimport { sequence } from './utils/promise';\nimport { isImportDeclaration, isExportDeclaration } from './utils/map-helpers';\nimport getLocation from './utils/getLocation';\nimport makeLegalIdentifier from './utils/makeLegalIdentifier';\n\nconst emptyArrayPromise = Promise.resolve([]);\n\nexport default class Module {\n\tconstructor ({ path, source, bundle }) {\n\t\tthis.source = source;\n\n\t\tthis.bundle = bundle;\n\t\tthis.path = path;\n\t\tthis.relativePath = relative( bundle.base, path ).slice( 0, -3 ); // remove .js\n\n\t\tthis.magicString = new MagicString( source, {\n\t\t\tfilename: path\n\t\t});\n\n\t\tthis.suggestedNames = {};\n\t\tthis.comments = [];\n\n\t\t// Try to extract a list of top-level statements/declarations. If\n\t\t// the parse fails, attach file info and abort\n\t\ttry {\n\t\t\tconst ast = parse( source, {\n\t\t\t\tecmaVersion: 6,\n\t\t\t\tsourceType: 'module',\n\t\t\t\tonComment: ( block, text, start, end ) => this.comments.push({ block, text, start, end })\n\t\t\t});\n\n\t\t\twalk( ast, {\n\t\t\t\tenter: node => {\n\t\t\t\t\tthis.magicString.addSourcemapLocation( node.start );\n\t\t\t\t}\n\t\t\t});\n\n\t\t\tthis.statements = ast.body.map( node => {\n\t\t\t\tconst magicString = this.magicString.snip( node.start, node.end );\n\t\t\t\treturn new Statement( node, magicString, this );\n\t\t\t});\n\t\t} catch ( err ) {\n\t\t\terr.code = 'PARSE_ERROR';\n\t\t\terr.file = path;\n\t\t\tthrow err;\n\t\t}\n\n\t\tthis.importDeclarations = this.statements.filter( isImportDeclaration );\n\t\tthis.exportDeclarations = this.statements.filter( isExportDeclaration );\n\n\t\tthis.analyse();\n\t}\n\n\tanalyse () {\n\t\t// imports and exports, indexed by ID\n\t\tthis.imports = {};\n\t\tthis.exports = {};\n\n\t\tthis.importDeclarations.forEach( statement => {\n\t\t\tconst node = statement.node;\n\t\t\tconst source = node.source.value;\n\n\t\t\tnode.specifiers.forEach( specifier => {\n\t\t\t\tconst isDefault = specifier.type === 'ImportDefaultSpecifier';\n\t\t\t\tconst isNamespace = specifier.type === 'ImportNamespaceSpecifier';\n\n\t\t\t\tconst localName = specifier.local.name;\n\t\t\t\tconst name = isDefault ? 'default' : isNamespace ? '*' : specifier.imported.name;\n\n\t\t\t\tif ( has( this.imports, localName ) ) {\n\t\t\t\t\tconst err = new Error( `Duplicated import '${localName}'` );\n\t\t\t\t\terr.file = this.path;\n\t\t\t\t\terr.loc = getLocation( this.source, specifier.start );\n\t\t\t\t\tthrow err;\n\t\t\t\t}\n\n\t\t\t\tthis.imports[ localName ] = {\n\t\t\t\t\tsource,\n\t\t\t\t\tname,\n\t\t\t\t\tlocalName\n\t\t\t\t};\n\t\t\t});\n\t\t});\n\n\t\tthis.exportDeclarations.forEach( statement => {\n\t\t\tconst node = statement.node;\n\t\t\tconst source = node.source && node.source.value;\n\n\t\t\t// export default function foo () {}\n\t\t\t// export default foo;\n\t\t\t// export default 42;\n\t\t\tif ( node.type === 'ExportDefaultDeclaration' ) {\n\t\t\t\tconst isDeclaration = /Declaration$/.test( node.declaration.type );\n\n\t\t\t\tthis.exports.default = {\n\t\t\t\t\tstatement,\n\t\t\t\t\tname: 'default',\n\t\t\t\t\tlocalName: isDeclaration ? node.declaration.id.name : 'default',\n\t\t\t\t\tisDeclaration\n\t\t\t\t};\n\t\t\t}\n\n\t\t\t// export { foo, bar, baz }\n\t\t\t// export var foo = 42;\n\t\t\t// export function foo () {}\n\t\t\telse if ( node.type === 'ExportNamedDeclaration' ) {\n\t\t\t\tif ( node.specifiers.length ) {\n\t\t\t\t\t// export { foo, bar, baz }\n\t\t\t\t\tnode.specifiers.forEach( specifier => {\n\t\t\t\t\t\tconst localName = specifier.local.name;\n\t\t\t\t\t\tconst exportedName = specifier.exported.name;\n\n\t\t\t\t\t\tthis.exports[ exportedName ] = {\n\t\t\t\t\t\t\tlocalName,\n\t\t\t\t\t\t\texportedName\n\t\t\t\t\t\t};\n\n\t\t\t\t\t\t// export { foo } from './foo';\n\t\t\t\t\t\tif ( source ) {\n\t\t\t\t\t\t\tthis.imports[ localName ] = {\n\t\t\t\t\t\t\t\tsource,\n\t\t\t\t\t\t\t\tlocalName,\n\t\t\t\t\t\t\t\tname: localName\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t}\n\n\t\t\t\telse {\n\t\t\t\t\tlet declaration = node.declaration;\n\n\t\t\t\t\tlet name;\n\n\t\t\t\t\tif ( declaration.type === 'VariableDeclaration' ) {\n\t\t\t\t\t\t// export var foo = 42\n\t\t\t\t\t\tname = declaration.declarations[0].id.name;\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// export function foo () {}\n\t\t\t\t\t\tname = declaration.id.name;\n\t\t\t\t\t}\n\n\t\t\t\t\tthis.exports[ name ] = {\n\t\t\t\t\t\tstatement,\n\t\t\t\t\t\tlocalName: name,\n\t\t\t\t\t\texpression: declaration\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\n\t\tanalyse( this.magicString, this );\n\n\t\tthis.canonicalNames = {};\n\n\t\tthis.definitions = {};\n\t\tthis.definitionPromises = {};\n\t\tthis.modifications = {};\n\n\t\tthis.statements.forEach( statement => {\n\t\t\tObject.keys( statement.defines ).forEach( name => {\n\t\t\t\tthis.definitions[ name ] = statement;\n\t\t\t});\n\n\t\t\tObject.keys( statement.modifies ).forEach( name => {\n\t\t\t\tif ( !has( this.modifications, name ) ) {\n\t\t\t\t\tthis.modifications[ name ] = [];\n\t\t\t\t}\n\n\t\t\t\tthis.modifications[ name ].push( statement );\n\t\t\t});\n\t\t});\n\t}\n\n\tgetCanonicalName ( localName ) {\n\t\tif ( has( this.suggestedNames, localName ) ) {\n\t\t\tlocalName = this.suggestedNames[ localName ];\n\t\t}\n\n\t\tif ( !has( this.canonicalNames, localName ) ) {\n\t\t\tlet canonicalName;\n\n\t\t\tif ( has( this.imports, localName ) ) {\n\t\t\t\tconst importDeclaration = this.imports[ localName ];\n\t\t\t\tconst module = importDeclaration.module;\n\n\t\t\t\tif ( importDeclaration.name === '*' ) {\n\t\t\t\t\tcanonicalName = module.suggestedNames[ '*' ];\n\t\t\t\t} else {\n\t\t\t\t\tlet exporterLocalName;\n\n\t\t\t\t\tif ( module.isExternal ) {\n\t\t\t\t\t\texporterLocalName = importDeclaration.name;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tconst exportDeclaration = module.exports[ importDeclaration.name ];\n\t\t\t\t\t\texporterLocalName = exportDeclaration.localName;\n\t\t\t\t\t}\n\n\t\t\t\t\tcanonicalName = module.getCanonicalName( exporterLocalName );\n\t\t\t\t}\n\t\t\t}\n\n\t\t\telse {\n\t\t\t\tcanonicalName = localName;\n\t\t\t}\n\n\t\t\tthis.canonicalNames[ localName ] = canonicalName;\n\t\t}\n\n\t\treturn this.canonicalNames[ localName ];\n\t}\n\n\tdefine ( name ) {\n\t\t// shortcut cycles. TODO this won't work everywhere...\n\t\tif ( has( this.definitionPromises, name ) ) {\n\t\t\treturn emptyArrayPromise;\n\t\t}\n\n\t\tlet promise;\n\n\t\t// The definition for this name is in a different module\n\t\tif ( has( this.imports, name ) ) {\n\t\t\tconst importDeclaration = this.imports[ name ];\n\n\t\t\tpromise = this.bundle.fetchModule( importDeclaration.source, this.path )\n\t\t\t\t.then( module => {\n\t\t\t\t\timportDeclaration.module = module;\n\n\t\t\t\t\t// suggest names. TODO should this apply to non default/* imports?\n\t\t\t\t\tif ( importDeclaration.name === 'default' ) {\n\t\t\t\t\t\t// TODO this seems ropey\n\t\t\t\t\t\tconst localName = importDeclaration.localName;\n\t\t\t\t\t\tlet suggestion = has( this.suggestedNames, localName ) ? this.suggestedNames[ localName ] : localName;\n\n\t\t\t\t\t\t// special case - the module has its own import by this name\n\t\t\t\t\t\twhile ( !module.isExternal && has( module.imports, suggestion ) ) {\n\t\t\t\t\t\t\tsuggestion = `_${suggestion}`;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tmodule.suggestName( 'default', suggestion );\n\t\t\t\t\t} else if ( importDeclaration.name === '*' ) {\n\t\t\t\t\t\tconst localName = importDeclaration.localName;\n\t\t\t\t\t\tconst suggestion = has( this.suggestedNames, localName ) ? this.suggestedNames[ localName ] : localName;\n\t\t\t\t\t\tmodule.suggestName( '*', suggestion );\n\t\t\t\t\t\tmodule.suggestName( 'default', `${suggestion}__default` );\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( module.isExternal ) {\n\t\t\t\t\t\tif ( importDeclaration.name === 'default' ) {\n\t\t\t\t\t\t\tmodule.needsDefault = true;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tmodule.needsNamed = true;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tmodule.importedByBundle.push( importDeclaration );\n\t\t\t\t\t\treturn emptyArrayPromise;\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( importDeclaration.name === '*' ) {\n\t\t\t\t\t\t// we need to create an internal namespace\n\t\t\t\t\t\tif ( !~this.bundle.internalNamespaceModules.indexOf( module ) ) {\n\t\t\t\t\t\t\tthis.bundle.internalNamespaceModules.push( module );\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\treturn module.expandAllStatements();\n\t\t\t\t\t}\n\n\t\t\t\t\tconst exportDeclaration = module.exports[ importDeclaration.name ];\n\n\t\t\t\t\tif ( !exportDeclaration ) {\n\t\t\t\t\t\tthrow new Error( `Module ${module.path} does not export ${importDeclaration.name} (imported by ${this.path})` );\n\t\t\t\t\t}\n\n\t\t\t\t\treturn module.define( exportDeclaration.localName );\n\t\t\t\t});\n\t\t}\n\n\t\t// The definition is in this module\n\t\telse if ( name === 'default' && this.exports.default.isDeclaration ) {\n\t\t\t// We have something like `export default foo` - so we just start again,\n\t\t\t// searching for `foo` instead of default\n\t\t\tpromise = this.define( this.exports.default.name );\n\t\t}\n\n\t\telse {\n\t\t\tlet statement;\n\n\t\t\tif ( name === 'default' ) {\n\t\t\t\tstatement = this.exports.default.statement;\n\t\t\t} else {\n\t\t\t\tstatement = this.definitions[ name ];\n\t\t\t}\n\n\t\t\tif ( statement && !statement.isIncluded ) {\n\t\t\t\tpromise = statement.expand();\n\t\t\t}\n\t\t}\n\n\t\tthis.definitionPromises[ name ] = promise || emptyArrayPromise;\n\t\treturn this.definitionPromises[ name ];\n\t}\n\n\texpandAllStatements ( isEntryModule ) {\n\t\tlet allStatements = [];\n\n\t\treturn sequence( this.statements, statement => {\n\t\t\t// A statement may have already been included, in which case we need to\n\t\t\t// curb rollup's enthusiasm and move it down here. It remains to be seen\n\t\t\t// if this approach is bulletproof\n\t\t\tif ( statement.isIncluded ) {\n\t\t\t\tconst index = allStatements.indexOf( statement );\n\t\t\t\tif ( ~index ) {\n\t\t\t\t\tallStatements.splice( index, 1 );\n\t\t\t\t\tallStatements.push( statement );\n\t\t\t\t}\n\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// skip import declarations...\n\t\t\tif ( statement.isImportDeclaration ) {\n\t\t\t\t// ...unless they're empty, in which case assume we're importing them for the side-effects\n\t\t\t\t// THIS IS NOT FOOLPROOF. Probably need /*rollup: include */ or similar\n\t\t\t\tif ( !statement.node.specifiers.length ) {\n\t\t\t\t\treturn this.bundle.fetchModule( statement.node.source.value, this.path )\n\t\t\t\t\t\t.then( module => {\n\t\t\t\t\t\t\tstatement.module = module; // TODO what is this for? what does it do? why not _module?\n\t\t\t\t\t\t\treturn module.expandAllStatements();\n\t\t\t\t\t\t})\n\t\t\t\t\t\t.then( statements => {\n\t\t\t\t\t\t\tallStatements.push.apply( allStatements, statements );\n\t\t\t\t\t\t});\n\t\t\t\t}\n\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// skip `export { foo, bar, baz }`...\n\t\t\tif ( statement.node.type === 'ExportNamedDeclaration' && statement.node.specifiers.length ) {\n\t\t\t\t// ...but ensure they are defined, if this is the entry module\n\t\t\t\tif ( isEntryModule ) {\n\t\t\t\t\treturn statement.expand().then( statements => {\n\t\t\t\t\t\tallStatements.push.apply( allStatements, statements );\n\t\t\t\t\t});\n\t\t\t\t}\n\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// include everything else\n\t\t\treturn statement.expand().then( statements => {\n\t\t\t\tallStatements.push.apply( allStatements, statements );\n\t\t\t});\n\t\t}).then( () => {\n\t\t\treturn allStatements;\n\t\t});\n\t}\n\n\trename ( name, replacement ) {\n\t\tthis.canonicalNames[ name ] = replacement;\n\t}\n\n\tsuggestName ( exportName, suggestion ) {\n\t\tif ( !this.suggestedNames[ exportName ] ) {\n\t\t\tthis.suggestedNames[ exportName ] = makeLegalIdentifier( suggestion );\n\t\t}\n\t}\n}\n","const reservedWords = 'break case class catch const continue debugger default delete do else export extends finally for function if import in instanceof let new return super switch this throw try typeof var void while with yield enum await implements package protected static interface private public'.split( ' ' );\nconst builtins = 'Infinity NaN undefined null true false eval uneval isFinite isNaN parseFloat parseInt decodeURI decodeURIComponent encodeURI encodeURIComponent escape unescape Object Function Boolean Symbol Error EvalError InternalError RangeError ReferenceError SyntaxError TypeError URIError Number Math Date String RegExp Array Int8Array Uint8Array Uint8ClampedArray Int16Array Uint16Array Int32Array Uint32Array Float32Array Float64Array Map Set WeakMap WeakSet SIMD ArrayBuffer DataView JSON Promise Generator GeneratorFunction Reflect Proxy Intl'.split( ' ' );\n\nlet blacklisted = {};\nreservedWords.concat( builtins ).forEach( word => blacklisted[ word ] = true );\n\n\nexport default function makeLegalIdentifier ( str ) {\n\tstr = str.replace( /[^$_a-zA-Z0-9]/g, '_' );\n\tif ( /\\d/.test( str[0] ) || blacklisted[ str ] ) str = `_${str}`;\n\n\treturn str;\n}\n","export default function analyse ( magicString, module ) {\n\t// first we need to generate comprehensive scope info\n\tlet previousStatement = null;\n\tlet commentIndex = 0;\n\n\tmodule.statements.forEach( statement => {\n\t\tconst node = statement.node;\n\n\t\tlet trailing = !!previousStatement;\n\n\t\t// TODO surely this can be neater\n\t\t// attach leading comment\n\t\tdo {\n\t\t\tlet comment = module.comments[ commentIndex ];\n\n\t\t\t// prevent comments inside the previous statement being\n\t\t\t// appended to it\n\t\t\tif ( previousStatement ) {\n\t\t\t\twhile ( comment && comment.start < previousStatement.node.end ) {\n\t\t\t\t\tcommentIndex += 1;\n\t\t\t\t\tcomment = module.comments[ commentIndex ];\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif ( !comment || ( comment.end > node.start ) ) break;\n\n\t\t\t// attach any trailing comment to the previous statement\n\t\t\tif ( trailing && !/\\n/.test( module.source.slice( previousStatement.node.end, comment.start ) ) ) {\n\t\t\t\tpreviousStatement.trailingComment = comment;\n\t\t\t}\n\n\t\t\t// then attach leading comments to this statement\n\t\t\telse {\n\t\t\t\tstatement.leadingComments.push( comment );\n\t\t\t}\n\n\t\t\tcommentIndex += 1;\n\t\t\ttrailing = false;\n\t\t} while ( module.comments[ commentIndex ] );\n\n\t\t// determine margin\n\t\tconst previousEnd = previousStatement ? ( previousStatement.trailingComment || previousStatement.node ).end : 0;\n\t\tconst start = ( statement.leadingComments[0] || node ).start;\n\n\t\tconst gap = magicString.original.slice( previousEnd, start );\n\t\tconst margin = gap.split( '\\n' ).length;\n\n\t\tif ( previousStatement ) previousStatement.margin[1] = margin;\n\t\tstatement.margin[0] = margin;\n\n\t\tstatement.analyse();\n\n\t\tpreviousStatement = statement;\n\t});\n}\n","import { has, keys } from './utils/object';\nimport { sequence } from './utils/promise';\nimport { getName } from './utils/map-helpers';\nimport getLocation from './utils/getLocation';\nimport walk from './ast/walk';\nimport Scope from './ast/Scope';\n\nconst emptyArrayPromise = Promise.resolve([]);\n\nexport default class Statement {\n\tconstructor ( node, magicString, module ) {\n\t\tthis.node = node;\n\t\tthis.module = module;\n\t\tthis.magicString = magicString;\n\n\t\tthis.scope = new Scope();\n\t\tthis.defines = {};\n\t\tthis.modifies = {};\n\t\tthis.dependsOn = {};\n\n\t\tthis.isIncluded = false;\n\n\t\tthis.leadingComments = [];\n\t\tthis.trailingComment = null;\n\t\tthis.margin = [ 0, 0 ];\n\n\t\t// some facts about this statement...\n\t\tthis.isImportDeclaration = node.type === 'ImportDeclaration';\n\t\tthis.isExportDeclaration = /^Export/.test( node.type );\n\t}\n\n\tanalyse () {\n\t\tif ( this.isImportDeclaration ) return; // nothing to analyse\n\n\t\tconst statement = this; // TODO use arrow functions instead\n\t\tconst magicString = this.magicString;\n\n\t\tlet scope = this.scope;\n\n\t\tfunction addToScope ( declarator ) {\n\t\t\tvar name = declarator.id.name;\n\t\t\tscope.add( name, false );\n\n\t\t\tif ( !scope.parent ) {\n\t\t\t\tstatement.defines[ name ] = true;\n\t\t\t}\n\t\t}\n\n\t\tfunction addToBlockScope ( declarator ) {\n\t\t\tvar name = declarator.id.name;\n\t\t\tscope.add( name, true );\n\n\t\t\tif ( !scope.parent ) {\n\t\t\t\tstatement.defines[ name ] = true;\n\t\t\t}\n\t\t}\n\n\t\twalk( this.node, {\n\t\t\tenter ( node ) {\n\t\t\t\tlet newScope;\n\n\t\t\t\tmagicString.addSourcemapLocation( node.start );\n\n\t\t\t\tswitch ( node.type ) {\n\t\t\t\t\tcase 'FunctionExpression':\n\t\t\t\t\tcase 'FunctionDeclaration':\n\t\t\t\t\tcase 'ArrowFunctionExpression':\n\t\t\t\t\t\tlet names = node.params.map( getName );\n\n\t\t\t\t\t\tif ( node.type === 'FunctionDeclaration' ) {\n\t\t\t\t\t\t\taddToScope( node );\n\t\t\t\t\t\t} else if ( node.type === 'FunctionExpression' && node.id ) {\n\t\t\t\t\t\t\tnames.push( node.id.name );\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tnewScope = new Scope({\n\t\t\t\t\t\t\tparent: scope,\n\t\t\t\t\t\t\tparams: names, // TODO rest params?\n\t\t\t\t\t\t\tblock: false\n\t\t\t\t\t\t});\n\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'BlockStatement':\n\t\t\t\t\t\tnewScope = new Scope({\n\t\t\t\t\t\t\tparent: scope,\n\t\t\t\t\t\t\tblock: true\n\t\t\t\t\t\t});\n\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'CatchClause':\n\t\t\t\t\t\tnewScope = new Scope({\n\t\t\t\t\t\t\tparent: scope,\n\t\t\t\t\t\t\tparams: [ node.param.name ],\n\t\t\t\t\t\t\tblock: true\n\t\t\t\t\t\t});\n\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'VariableDeclaration':\n\t\t\t\t\t\tnode.declarations.forEach( node.kind === 'let' ? addToBlockScope : addToScope ); // TODO const?\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'ClassDeclaration':\n\t\t\t\t\t\taddToScope( node );\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tif ( newScope ) {\n\t\t\t\t\tObject.defineProperty( node, '_scope', { value: newScope });\n\t\t\t\t\tscope = newScope;\n\t\t\t\t}\n\t\t\t},\n\t\t\tleave ( node ) {\n\t\t\t\tif ( node._scope ) {\n\t\t\t\t\tscope = scope.parent;\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\n\t\tif ( !this.isImportDeclaration ) {\n\t\t\twalk( this.node, {\n\t\t\t\tenter: ( node, parent ) => {\n\t\t\t\t\tif ( node._scope ) scope = node._scope;\n\n\t\t\t\t\tthis.checkForReads( scope, node, parent );\n\t\t\t\t\tthis.checkForWrites( scope, node );\n\t\t\t\t},\n\t\t\t\tleave: ( node ) => {\n\t\t\t\t\tif ( node._scope ) scope = scope.parent;\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t}\n\n\tcheckForReads ( scope, node, parent ) {\n\t\tif ( node.type === 'Identifier' ) {\n\t\t\t// disregard the `bar` in `foo.bar` - these appear as Identifier nodes\n\t\t\tif ( parent.type === 'MemberExpression' && node !== parent.object ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// disregard the `bar` in { bar: foo }\n\t\t\tif ( parent.type === 'Property' && node !== parent.value ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst definingScope = scope.findDefiningScope( node.name );\n\n\t\t\tif ( ( !definingScope || definingScope.depth === 0 ) && !this.defines[ node.name ] ) {\n\t\t\t\tthis.dependsOn[ node.name ] = true;\n\t\t\t}\n\t\t}\n\t}\n\n\tcheckForWrites ( scope, node ) {\n\t\tconst addNode = ( node, disallowImportReassignments ) => {\n\t\t\tlet depth = 0; // determine whether we're illegally modifying a binding or namespace\n\n\t\t\twhile ( node.type === 'MemberExpression' ) {\n\t\t\t\tnode = node.object;\n\t\t\t\tdepth += 1;\n\t\t\t}\n\n\t\t\t// disallow assignments/updates to imported bindings and namespaces\n\t\t\tif ( disallowImportReassignments ) {\n\t\t\t\tconst importSpecifier = this.module.imports[ node.name ];\n\n\t\t\t\tif ( importSpecifier && !scope.contains( node.name ) ) {\n\t\t\t\t\tconst minDepth = importSpecifier.name === '*' ?\n\t\t\t\t\t\t2 : // cannot do e.g. `namespace.foo = bar`\n\t\t\t\t\t\t1; // cannot do e.g. `foo = bar`, but `foo.bar = bar` is fine\n\n\t\t\t\t\tif ( depth < minDepth ) {\n\t\t\t\t\t\tconst err = new Error( `Illegal reassignment to import '${node.name}'` );\n\t\t\t\t\t\terr.file = this.module.path;\n\t\t\t\t\t\terr.loc = getLocation( this.module.magicString.toString(), node.start );\n\t\t\t\t\t\tthrow err;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif ( node.type !== 'Identifier' ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tthis.modifies[ node.name ] = true;\n\t\t};\n\n\t\tif ( node.type === 'AssignmentExpression' ) {\n\t\t\taddNode( node.left, true );\n\t\t}\n\n\t\telse if ( node.type === 'UpdateExpression' ) {\n\t\t\taddNode( node.argument, true );\n\t\t}\n\n\t\telse if ( node.type === 'CallExpression' ) {\n\t\t\tnode.arguments.forEach( arg => addNode( arg, false ) );\n\t\t}\n\t}\n\n\texpand () {\n\t\tif ( this.isIncluded ) return emptyArrayPromise;\n\t\tthis.isIncluded = true;\n\n\t\tlet result = [];\n\n\t\t// We have a statement, and it hasn't been included yet. First, include\n\t\t// the statements it depends on\n\t\tconst dependencies = Object.keys( this.dependsOn );\n\n\t\treturn sequence( dependencies, name => {\n\t\t\treturn this.module.define( name ).then( definition => {\n\t\t\t\tresult.push.apply( result, definition );\n\t\t\t});\n\t\t})\n\n\t\t// then include the statement itself\n\t\t\t.then( () => {\n\t\t\t\tresult.push( this );\n\t\t\t})\n\n\t\t// then include any statements that could modify the\n\t\t// thing(s) this statement defines\n\t\t\t.then( () => {\n\t\t\t\treturn sequence( keys( this.defines ), name => {\n\t\t\t\t\tconst modifications = has( this.module.modifications, name ) && this.module.modifications[ name ];\n\n\t\t\t\t\tif ( modifications ) {\n\t\t\t\t\t\treturn sequence( modifications, statement => {\n\t\t\t\t\t\t\tif ( !statement.isIncluded ) {\n\t\t\t\t\t\t\t\treturn statement.expand()\n\t\t\t\t\t\t\t\t\t.then( statements => {\n\t\t\t\t\t\t\t\t\t\tresult.push.apply( result, statements );\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t})\n\n\t\t// the `result` is an array of statements needed to define `name`\n\t\t\t.then( () => {\n\t\t\t\treturn result;\n\t\t\t});\n\t}\n\n\treplaceIdentifiers ( names ) {\n\t\tconst magicString = this.magicString.clone().trim();\n\t\tconst replacementStack = [ names ];\n\t\tconst nameList = keys( names );\n\n\t\tlet deshadowList = [];\n\t\tnameList.forEach( name => {\n\t\t\tconst replacement = names[ name ];\n\t\t\tdeshadowList.push( replacement.split( '.' )[0] );\n\t\t});\n\n\t\tif ( nameList.length > 0 ) {\n\t\t\twalk( this.node, {\n\t\t\t\tenter ( node, parent ) {\n\t\t\t\t\tconst scope = node._scope;\n\n\t\t\t\t\tif ( scope ) {\n\t\t\t\t\t\tlet newNames = {};\n\t\t\t\t\t\tlet hasReplacements;\n\n\t\t\t\t\t\tkeys( names ).forEach( key => {\n\t\t\t\t\t\t\tif ( !~scope.names.indexOf( key ) ) {\n\t\t\t\t\t\t\t\tnewNames[ key ] = names[ key ];\n\t\t\t\t\t\t\t\thasReplacements = true;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\n\t\t\t\t\t\tdeshadowList.forEach( name => {\n\t\t\t\t\t\t\tif ( ~scope.names.indexOf( name ) ) {\n\t\t\t\t\t\t\t\tnewNames[ name ] = name + '$$'; // TODO better mechanism\n\t\t\t\t\t\t\t\thasReplacements = true;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\n\t\t\t\t\t\tif ( !hasReplacements ) {\n\t\t\t\t\t\t\treturn this.skip();\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tnames = newNames;\n\t\t\t\t\t\treplacementStack.push( newNames );\n\t\t\t\t\t}\n\n\t\t\t\t\t// We want to rewrite identifiers (that aren't property names)\n\t\t\t\t\tif ( node.type !== 'Identifier' ) return;\n\t\t\t\t\tif ( parent.type === 'MemberExpression' && !parent.computed && node !== parent.object ) return;\n\t\t\t\t\tif ( parent.type === 'Property' && node !== parent.value ) return;\n\t\t\t\t\t// TODO others...?\n\n\t\t\t\t\tconst name = has( names, node.name ) && names[ node.name ];\n\n\t\t\t\t\tif ( name && name !== node.name ) {\n\t\t\t\t\t\tmagicString.overwrite( node.start, node.end, name );\n\t\t\t\t\t}\n\t\t\t\t},\n\n\t\t\t\tleave ( node ) {\n\t\t\t\t\tif ( node._scope ) {\n\t\t\t\t\t\treplacementStack.pop();\n\t\t\t\t\t\tnames = replacementStack[ replacementStack.length - 1 ];\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\n\t\treturn magicString;\n\t}\n}\n","export default class Scope {\n\tconstructor ( options ) {\n\t\toptions = options || {};\n\n\t\tthis.parent = options.parent;\n\t\tthis.depth = this.parent ? this.parent.depth + 1 : 0;\n\t\tthis.names = options.params || [];\n\t\tthis.isBlockScope = !!options.block;\n\t}\n\n\tadd ( name, isBlockDeclaration ) {\n\t\tif ( !isBlockDeclaration && this.isBlockScope ) {\n\t\t\t// it's a `var` or function declaration, and this\n\t\t\t// is a block scope, so we need to go up\n\t\t\tthis.parent.add( name, isBlockDeclaration );\n\t\t} else {\n\t\t\tthis.names.push( name );\n\t\t}\n\t}\n\n\tcontains ( name ) {\n\t\treturn !!this.findDefiningScope( name );\n\t}\n\n\tfindDefiningScope ( name ) {\n\t\tif ( ~this.names.indexOf( name ) ) {\n\t\t\treturn this;\n\t\t}\n\n\t\tif ( this.parent ) {\n\t\t\treturn this.parent.findDefiningScope( name );\n\t\t}\n\n\t\treturn null;\n\t}\n}","let shouldSkip;\nlet shouldAbort;\n\nexport default function walk ( ast, { enter, leave }) {\n\tshouldAbort = false;\n\tvisit( ast, null, enter, leave );\n}\n\nlet context = {\n\tskip: () => shouldSkip = true,\n\tabort: () => shouldAbort = true\n};\n\nlet childKeys = {};\n\nlet toString = Object.prototype.toString;\n\nfunction isArray ( thing ) {\n\treturn toString.call( thing ) === '[object Array]';\n}\n\nfunction visit ( node, parent, enter, leave ) {\n\tif ( !node || shouldAbort ) return;\n\n\tif ( enter ) {\n\t\tshouldSkip = false;\n\t\tenter.call( context, node, parent );\n\t\tif ( shouldSkip || shouldAbort ) return;\n\t}\n\n\tlet keys = childKeys[ node.type ] || (\n\t\tchildKeys[ node.type ] = Object.keys( node ).filter( key => typeof node[ key ] === 'object' )\n\t);\n\n\tlet key, value, i, j;\n\n\ti = keys.length;\n\twhile ( i-- ) {\n\t\tkey = keys[i];\n\t\tvalue = node[ key ];\n\n\t\tif ( isArray( value ) ) {\n\t\t\tj = value.length;\n\t\t\twhile ( j-- ) {\n\t\t\t\tvisit( value[j], node, enter, leave );\n\t\t\t}\n\t\t}\n\n\t\telse if ( value && value.type ) {\n\t\t\tvisit( value, node, enter, leave );\n\t\t}\n\t}\n\n\tif ( leave && !shouldAbort ) {\n\t\tleave( node, parent );\n\t}\n}","export default function getLocation ( source, charIndex ) {\n\tconst lines = source.split( '\\n' );\n\tconst len = lines.length;\n\n\tlet lineStart = 0;\n\tlet i;\n\n\tfor ( i = 0; i < len; i += 1 ) {\n\t\tconst line = lines[i];\n\t\tconst lineEnd = lineStart + line.length + 1; // +1 for newline\n\n\t\tif ( lineEnd > charIndex ) {\n\t\t\treturn { line: i + 1, column: charIndex - lineStart };\n\t\t}\n\n\t\tlineStart = lineEnd;\n\t}\n\n\tthrow new Error( 'Could not determine location of character' );\n}\n","export function getName ( x ) {\n\treturn x.name;\n}\n\nexport function quoteId ( x ) {\n\treturn `'${x.id}'`;\n}\n\nexport function req ( x ) {\n\treturn `require('${x.id}')`;\n}\n\nexport function isImportDeclaration ( statement ) {\n\treturn statement.isImportDeclaration;\n}\n\nexport function isExportDeclaration ( statement ) {\n\treturn statement.isExportDeclaration;\n}\n","import { Promise } from 'sander';\n\nexport function sequence ( arr, callback ) {\n\tconst len = arr.length;\n\tlet results = new Array( len );\n\n\tlet promise = Promise.resolve();\n\n\tfunction next ( i ) {\n\t\treturn promise\n\t\t\t.then( () => callback( arr[i], i ) )\n\t\t\t.then( result => results[i] = result );\n\t}\n\n\tlet i;\n\n\tfor ( i = 0; i < len; i += 1 ) {\n\t\tpromise = next( i );\n\t}\n\n\treturn promise.then( () => results );\n}","export const keys = Object.keys;\n\nexport const hasOwnProp = Object.prototype.hasOwnProperty;\n\nexport function has ( obj, prop ) {\n\treturn hasOwnProp.call( obj, prop );\n}\n\nexport function blank () {\n\treturn Object.create( null );\n}\n"],"names":[],"mappings":";;;;;;;;AqBAO,IAAM,OAAO,OAAO;;AAEpB,IAAM,aAAa,OAAO,UAAU,eAEpC,SAAS,IAAM,KAAK,MAAO;AACjC,CAAD,OAAQ,WAAW,KAAM,KAAK;AAC9B;;AAEO,SAAS,QAAS;AACxB,CAAD,OAAQ,OAAO,OAAQ;AACvB;;ADRO,SAAS,SAAW,KAAK,UAAW;AAC1C,CAAD,IAAO,MAAM,IAAI;AAChB,CAAD,IAAK,UAAU,IAAI,MAAO;;AAEzB,CAAD,IAAK,wBAAiB,CAAC;;AAEtB,CAAD,SAAU,KAAO,GAAI;AACnB,EAAF,OAAS,QACL,KAAM,YADV;AACA,GAAA,OAAgB,SAAU,IAAI,IAAI;AAAlC,KACI,KAAM,UAAA,QADV;AACA,GAAA,OAAoB,QAAQ,KAAK;AAAjC;AACA;;AAEC,CAAD,IAAK,IAAL;;AAEC,CAAD,KAAO,IAAI,GAAG,IAAI,KAAK,KAAK,GAAI;AAC9B,EAAF,UAAY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