{"version":3,"sources":["jsdelivr-header.js","/npm/gobble@0.12.0/www/GOBBLE/gobble/src/builtins/include.js","/npm/gobble@0.12.0/www/GOBBLE/gobble/src/queue/Queue.js","/npm/gobble@0.12.0/www/GOBBLE/gobble/src/config/index.js","/npm/gobble@0.12.0/www/GOBBLE/gobble/src/utils/assign.js","/npm/gobble@0.12.0/www/GOBBLE/gobble/src/utils/extractLocationInfo.js","/npm/gobble@0.12.0/www/GOBBLE/gobble/src/utils/is.js","/npm/gobble@0.12.0/www/GOBBLE/gobble/src/utils/sourcemap.js","/npm/gobble@0.12.0/www/GOBBLE/gobble/src/builtins/map.js","/npm/gobble@0.12.0/www/GOBBLE/gobble/src/builtins/move.js","/npm/gobble@0.12.0/www/GOBBLE/gobble/src/utils/GobbleError.js","/npm/gobble@0.12.0/www/GOBBLE/gobble/src/builtins/grab.js","/npm/gobble@0.12.0/www/GOBBLE/gobble/src/utils/warnOnce.js","/npm/gobble@0.12.0/www/GOBBLE/gobble/src/utils/compareBuffers.js","/npm/gobble@0.12.0/www/GOBBLE/gobble/src/utils/cleanup.js","/npm/gobble@0.12.0/www/GOBBLE/gobble/src/session/index.js","/npm/gobble@0.12.0/www/GOBBLE/gobble/src/nodes/serve/serveFile.js","/npm/gobble@0.12.0/www/GOBBLE/gobble/src/nodes/serve/templates/compile.js","/npm/gobble@0.12.0/www/GOBBLE/gobble/src/nodes/serve/serveDir.js","/npm/gobble@0.12.0/www/GOBBLE/gobble/node_modules/vlq/src/vlq.js","/npm/gobble@0.12.0/www/GOBBLE/gobble/node_modules/sorcery/src/utils/decodeMappings.js","/npm/gobble@0.12.0/www/GOBBLE/gobble/node_modules/sorcery/src/utils/atob.js","/npm/gobble@0.12.0/www/GOBBLE/gobble/node_modules/sorcery/src/utils/sourceMappingURL.js","/npm/gobble@0.12.0/www/GOBBLE/gobble/node_modules/sorcery/src/utils/getMapFromUrl.js","/npm/gobble@0.12.0/www/GOBBLE/gobble/node_modules/sorcery/src/utils/getSourceMappingUrl.js","/npm/gobble@0.12.0/www/GOBBLE/gobble/node_modules/sorcery/src/utils/getMap.js","/npm/gobble@0.12.0/www/GOBBLE/gobble/node_modules/sorcery/src/Node.js","/npm/gobble@0.12.0/www/GOBBLE/gobble/node_modules/sorcery/src/utils/btoa.js","/npm/gobble@0.12.0/www/GOBBLE/gobble/node_modules/sorcery/src/SourceMap.js","/npm/gobble@0.12.0/www/GOBBLE/gobble/node_modules/sorcery/src/utils/encodeMappings.js","/npm/gobble@0.12.0/www/GOBBLE/gobble/node_modules/sorcery/src/Chain.js","/npm/gobble@0.12.0/www/GOBBLE/gobble/node_modules/sorcery/src/utils/slash.js","/npm/gobble@0.12.0/www/GOBBLE/gobble/node_modules/sorcery/src/index.js","/npm/gobble@0.12.0/www/GOBBLE/gobble/src/nodes/serve/serveSourcemap.js","/npm/gobble@0.12.0/www/GOBBLE/gobble/src/nodes/serve/serveError.js","/npm/gobble@0.12.0/www/GOBBLE/gobble/src/nodes/serve/handleRequest.js","/npm/gobble@0.12.0/www/GOBBLE/gobble/src/nodes/serve/index.js","/npm/gobble@0.12.0/www/GOBBLE/gobble/src/utils/flattenSourcemaps.js","/npm/gobble@0.12.0/www/GOBBLE/gobble/src/nodes/build/index.js","/npm/gobble@0.12.0/www/GOBBLE/gobble/src/nodes/watch/index.js","/npm/gobble@0.12.0/www/GOBBLE/gobble/src/nodes/Node.js"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA,onBCFe,KAAS,K,GACjB,UAAc,EAAQ,EAAS,SAAM,I,8OAWjC,SAAO,G,eAEZ,KAAA,KAAA,CAAA,UAAA,I,oBCXK,I,yBDeR,EAAC,OAAA,G,OAEM,W,IACH,EAAG,EAAA,OAAW,Q,GAEb,E,WAKM,KAAA,K,4BC7BO,MAAK,G,cAAL,KAAK,QACV,G,sBDwBD,C,WChBN,UAAY,OAAO,OAAQ,KAAA,W,sCAG1B,IAAW,SAAK,G,4CAIlB,CAAA,GAAQ,EAAI,OAAE,EA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,YAGC,E,CAER,G,kEASG,MAAM,kB,gMAYT,MAAM,U,mHAOE,SAAE,GAAA,iBAAA,GAAA,KAAA,QAAA,EAAA,KAAA,CAAA,I,SACJ,SAAe,GAAE,OAAA,OAAA,WAAA,EAAA,EAAA,G,EAGzB,C,iBAGK,O,UAAyC,MAAK,8KAAU,MAAA,KAAA,6D,KAE7D,QAAA,G,SAxFuB,QA0FxB,EAAU,G,mBAGJ,QAAM,I,EACL,EAAM,IAAG,YACT,IAAA,OAAa,EAAE,I,SAGd,I,EACJ,KAAA,QAAA,OAAA,IAAA,G,+DAKG,WAAc,G,eAAkB,E,UAAoE,OAAA,EAAA,G,iBAC5D,OAAM,GAAS,IAAM,iBAAA,KAAA,W,2BAEM,IAAA,SAAA,G,iCAErE,IAAO,GAGN,OAAQ,G,aAGH,W,iBACH,S,sDAIM,G,SAxHU,OA2HxB,O,eAEY","file":"/npm/gobble@0.12.0/dist/gobble.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.37.0.\n * Original file: /npm/gobble@0.12.0/dist/gobble.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","import { dirname } from 'path';\nimport { lsr, mkdir, symlinkOrCopy, Promise } from 'sander';\nimport *  as minimatch from 'minimatch';\n\nexport default function include ( inputdir, outputdir, options ) {\n\tconst numPatterns = options.patterns.length;\n\n\treturn lsr( inputdir )\n\t\t.then( files => {\n\t\t\treturn files.filter( file => {\n\t\t\t\tconst isIncluded = matches( file );\n\t\t\t\treturn options.exclude ? !isIncluded : isIncluded;\n\t\t\t});\n\t\t})\n\t\t.then( files => {\n\t\t\tconst promises = files.map( file => {\n\t\t\t\treturn mkdir( outputdir, dirname( file ) ).then( () => {\n\t\t\t\t\treturn symlinkOrCopy( inputdir, file ).to( outputdir, file );\n\t\t\t\t});\n\t\t\t});\n\n\t\t\treturn Promise.all( promises );\n\t\t});\n\n\tfunction matches ( filename ) {\n\t\tlet i = numPatterns;\n\t\twhile ( i-- ) {\n\t\t\tif ( minimatch( filename, options.patterns[i] ) ) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\n\t\treturn false;\n\t}\n}\n","import { EventEmitter2 } from 'eventemitter2';\nimport { Promise } from 'sander';\n\nexport default class Queue extends EventEmitter2 {\n\tconstructor () {\n\t\tsuper({ wildcard: true });\n\n\t\tvar queue = this;\n\n\t\tqueue._tasks = [];\n\n\t\tqueue._run = () => {\n\t\t\tconst task = queue._tasks.shift();\n\n\t\t\tif ( !task ) {\n\t\t\t\tqueue._running = false;\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\ttask.promise.then( runOnNextTick, runOnNextTick );\n\n\t\t\ttry {\n\t\t\t\ttask.fn( task.fulfil, task.reject );\n\t\t\t} catch ( err ) {\n\t\t\t\ttask.reject( err );\n\n\t\t\t\tqueue.emit( 'error', err );\n\t\t\t\trunOnNextTick();\n\t\t\t}\n\t\t};\n\n\t\tfunction runOnNextTick () {\n\t\t\tprocess.nextTick( queue._run );\n\t\t}\n\t}\n\n\tadd ( fn ) {\n\t\tlet task;\n\n\t\tconst promise = new Promise( ( fulfil, reject ) => {\n\t\t\ttask = { fn, fulfil, reject };\n\t\t});\n\n\t\ttask.promise = promise;\n\t\tthis._tasks.push( task );\n\n\t\tif ( !this._running ) {\n\t\t\tthis._running = true;\n\t\t\tthis._run();\n\t\t}\n\n\t\treturn promise;\n\t}\n\n\tabort () {\n\t\tthis._tasks = [];\n\t\tthis._running = false;\n\t}\n}\n","export default {\n\tenv: process.env.GOBBLE_ENV || 'development',\n\tcwd: process.env.GOBBLE_CWD || process.cwd()\n};\n","export default function assign ( target, ...sources ) {\n\tsources.forEach( source => {\n\t\tlet key;\n\n\t\tfor ( key in source ) {\n\t\t\tif ( source.hasOwnProperty( key ) ) {\n\t\t\t\ttarget[ key ] = source[ key ];\n\t\t\t}\n\t\t}\n\t});\n\n\treturn target;\n}\n","/**\n * Extracts location info from error objects using a set of heuristics\n   based on real-world examples\n * @param {object} err - an error object thrown by a transpiler\n * @returns {file, line, column}\n */\nexport default function extractLocationInfo ( err ) {\n\tlet { file, line, column, message, loc } = err;\n\n\tif ( !file && err.filename ) {\n\t\tfile = err.filename;\n\t}\n\n\tif ( line === undefined && column === undefined && loc ) {\n\t\tline = loc.line;\n\t\tcolumn = loc.column;\n\t}\n\n\tlet match;\n\n\tif ( line === undefined ) {\n\t\tif ( match = /line (\\d+)/.exec( message ) ) {\n\t\t\tline = +match[1];\n\t\t}\n\t}\n\n\tif ( column === undefined ) {\n\t\tif ( match = /column (\\d+)/.exec( message ) ) {\n\t\t\tcolumn = +match[1];\n\t\t}\n\t}\n\n\t// Handle errors from e.g. browserify\n\t// Unexpected token (123:456) while parsing /path/to/.gobble/12-derequire/1/app.js\n\tif ( line === undefined && column === undefined ) {\n\t\tconst match = /(\\d+):(\\d+)/.exec( message );\n\n\t\tif ( match ) {\n\t\t\tline = match[1];\n\t\t\tcolumn = match[2];\n\t\t}\n\t}\n\n\treturn { file, line, column };\n}\n","const toString = Object.prototype.toString;\n\nexport function isRegExp ( what ) {\n\treturn toString.call( what ) === '[object RegExp]';\n}\n\nexport function isArray( thing ) {\n\treturn toString.call( thing ) === '[object Array]';\n}\n\nexport function isString ( thing ) {\n\treturn typeof thing === 'string';\n}\n","let SOURCEMAPPING_URL = 'sourceMa';\nSOURCEMAPPING_URL += 'ppingURL';\n\nconst SOURCEMAP_COMMENT = new RegExp( `\\n*(?:` +\n\t`\\\\/\\\\/[@#]\\\\s*${SOURCEMAPPING_URL}=([^'\"]+)|` +      // js\n\t`\\\\/\\\\*#?\\\\s*${SOURCEMAPPING_URL}=([^'\"]+)\\\\s\\\\+\\\\/)` + // css\n`\\\\s*$`, 'g' );\n\nfunction getSourcemapComment ( url, ext ) {\n\tif ( ext === '.css' ) {\n\t\treturn `\\n/*# ${SOURCEMAPPING_URL}=${url} */\\n`;\n\t}\n\n\treturn `\\n//# ${SOURCEMAPPING_URL}=${url}\\n`;\n}\n\nexport { getSourcemapComment, SOURCEMAP_COMMENT, SOURCEMAPPING_URL };","import { extname, join, resolve } from 'path';\nimport * as chalk from 'chalk';\nimport Queue from '../queue/Queue.js';\nimport { lsr, readFile, symlinkOrCopy, writeFile, Promise } from 'sander';\nimport assign from '../utils/assign';\nimport config from '../config/index.js';\nimport extractLocationInfo from '../utils/extractLocationInfo';\nimport { isRegExp } from '../utils/is';\nimport { ABORTED } from '../utils/signals';\nimport { getSourcemapComment, SOURCEMAP_COMMENT } from '../utils/sourcemap';\n\nexport default function map ( inputdir, outputdir, options ) {\n\tlet changed = {};\n\tthis.changes.forEach( change => {\n\t\tif ( !change.removed ) {\n\t\t\tchanged[ change.file ] = true;\n\t\t}\n\t});\n\n\treturn new Promise( ( fulfil, reject ) => {\n\t\tconst queue = new Queue();\n\n\t\tqueue.once( 'error', reject );\n\n\t\tlsr( inputdir ).then( files => {\n\t\t\tconst promises = files.map( filename => {\n\t\t\t\tif ( this.aborted ) return;\n\n\t\t\t\tconst ext = extname( filename );\n\n\t\t\t\t// change extension if necessary, e.g. foo.coffee -> foo.js\n\t\t\t\tconst destname = ( options.ext && ~options.accept.indexOf( ext ) ) ? filename.substr( 0, filename.length - ext.length ) + options.ext : filename;\n\n\t\t\t\tconst src = join( inputdir, filename );\n\t\t\t\tconst dest = join( outputdir, destname );\n\n\t\t\t\t// If this mapper only accepts certain extensions, and this isn't\n\t\t\t\t// one of them, just copy the file\n\t\t\t\tif ( shouldSkip( options, ext, filename ) ) {\n\t\t\t\t\treturn symlinkOrCopy( src ).to( dest );\n\t\t\t\t}\n\n\t\t\t\t// If this file *does* fall within this transformer's remit, but\n\t\t\t\t// hasn't changed, we just copy the cached file\n\t\t\t\tif ( !changed[ filename ] && options.cache.hasOwnProperty( filename ) ) {\n\t\t\t\t\treturn symlinkOrCopy( options.cache[ filename ] ).to( dest );\n\t\t\t\t}\n\n\t\t\t\t// Otherwise, we queue up a transformation\n\t\t\t\treturn queue.add( ( fulfil, reject ) => {\n\t\t\t\t\tif ( this.aborted ) {\n\t\t\t\t\t\treturn reject( ABORTED );\n\t\t\t\t\t}\n\n\t\t\t\t\t// Create context object - this will be passed to transformers\n\t\t\t\t\tconst context = {\n\t\t\t\t\t\tlog: this.log,\n\t\t\t\t\t\tenv: config.env,\n\t\t\t\t\t\tsrc, dest, filename\n\t\t\t\t\t};\n\n\t\t\t\t\tconst transformOptions = assign( {}, options.fn.defaults, options.userOptions );\n\n\t\t\t\t\tdelete transformOptions.accept;\n\t\t\t\t\tdelete transformOptions.ext;\n\n\t\t\t\t\treturn readFile( src )\n\t\t\t\t\t\t.then( buffer => buffer.toString( transformOptions.sourceEncoding ) )\n\t\t\t\t\t\t.then( data => {\n\t\t\t\t\t\t\tif ( this.aborted ) return reject( ABORTED );\n\n\t\t\t\t\t\t\tlet result;\n\n\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\tresult = options.fn.call( context, data, transformOptions );\n\t\t\t\t\t\t\t} catch ( e ) {\n\t\t\t\t\t\t\t\tlet err = createTransformError( e, src, filename, this.node );\n\t\t\t\t\t\t\t\treturn reject( err );\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif ( result === null ) return fulfil();\n\n\t\t\t\t\t\t\tconst codepath = resolve( this.cachedir, filename );\n\n\t\t\t\t\t\t\tconst { code, map } = processResult( result, data, src, dest, codepath );\n\n\t\t\t\t\t\t\twriteToCacheDir( code, map, codepath, dest )\n\t\t\t\t\t\t\t\t.then( () => symlinkOrCopy( codepath ).to( dest ) )\n\t\t\t\t\t\t\t\t.then( () => options.cache[ filename ] = codepath )\n\t\t\t\t\t\t\t\t.then( fulfil );\n\t\t\t\t\t\t})\n\t\t\t\t\t\t.catch( reject );\n\t\t\t\t}).catch( err => {\n\t\t\t\t\tqueue.abort();\n\t\t\t\t\tthrow err;\n\t\t\t\t});\n\t\t\t});\n\n\t\t\treturn Promise.all( promises );\n\t\t}).then( () => {\n\t\t\tqueue.off( 'error', reject );\n\t\t\tfulfil();\n\t\t}, reject );\n\t});\n}\n\nfunction processResult ( result, original, src, dest, codepath ) {\n\tif ( typeof result === 'object' && 'code' in result ) {\n\t\t// if a sourcemap was returned, use it\n\t\tif ( result.map ) {\n\t\t\treturn {\n\t\t\t\tcode: result.code.replace( SOURCEMAP_COMMENT, '' ) + getSourcemapComment( encodeURI( codepath + '.map' ), extname( codepath ) ),\n\t\t\t\tmap: processSourcemap( result.map, src, dest, original )\n\t\t\t};\n\t\t}\n\n\t\t// otherwise we might have an inline sourcemap\n\t\telse {\n\t\t\treturn processInlineSourceMap( result.code, src, dest, original, codepath );\n\t\t}\n\t}\n\n\tif ( typeof result === 'string' ) {\n\t\treturn processInlineSourceMap( result, src, dest, original, codepath );\n\t}\n\n\treturn { code: result, map: null };\n}\n\nfunction isDataURI ( str ) {\n\treturn /^data:/.test( str ); // TODO beef this up\n}\n\nfunction processInlineSourceMap ( code, src, dest, original, codepath ) {\n\t// if there's an inline sourcemap, process it\n\tlet match = SOURCEMAP_COMMENT.exec( code );\n\tlet map = null;\n\n\tif ( match && isDataURI( match[1] ) ) {\n\t\tmatch = /base64,(.+)$/.exec( match[1] );\n\n\t\tif ( !match ) {\n\t\t\tthrow new Error( 'sourceMappingURL is not base64-encoded' );\n\t\t}\n\n\t\tlet json = atob( match[1] );\n\n\t\tmap = processSourcemap( json, src, dest, original );\n\t\tcode = code.replace( SOURCEMAP_COMMENT, '' ) + getSourcemapComment( encodeURI( codepath + '.map' ), extname( codepath ) );\n\t}\n\n\treturn { code, map };\n}\n\nfunction writeToCacheDir ( code, map, codepath ) {\n\tif ( map ) {\n\t\treturn Promise.all([\n\t\t\twriteFile( codepath, code ),\n\t\t\twriteFile( codepath + '.map', JSON.stringify( map ) )\n\t\t]);\n\t} else {\n\t\treturn writeFile( codepath, code );\n\t}\n}\n\nfunction createTransformError ( original, src, filename, node ) {\n\tconst err = typeof original === 'string' ? new Error( original ) : original;\n\n\tlet message = 'An error occurred while processing ' + chalk.magenta( src );\n\tlet creator;\n\n\tif ( creator = node.input._findCreator( filename ) ) {\n\t\tmessage += ` (this file was created by the ${creator.id} transformation)`;\n\t}\n\n\tconst { line, column } = extractLocationInfo( err );\n\n\terr.file = src;\n\terr.line = line;\n\terr.column = column;\n\n\treturn err;\n}\n\nfunction processSourcemap ( map, src, dest, data ) {\n\tif ( typeof map === 'string' ) {\n\t\tmap = JSON.parse( map );\n\t}\n\n\tif ( !map ) {\n\t\treturn null;\n\t}\n\n\tmap.file = dest;\n\tmap.sources = [ src ];\n\tmap.sourcesContent = [ data ];\n\treturn map;\n}\n\nfunction shouldSkip ( options, ext, filename ) {\n\tlet filter;\n\n\tif ( filter = options.accept ) {\n\t\tlet i;\n\n\t\tfor ( i=0; i<filter.length; i++ ) {\n\t\t\tconst flt = filter[i];\n\n\t\t\tif ( typeof flt === 'string' && flt === ext ) {\n\t\t\t\treturn false;\n\t\t\t} else if ( isRegExp( flt ) && flt.test( filename ) ) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\n\t\treturn true;\n\t}\n\n\treturn false;\n}\n\nfunction atob ( base64 ) {\n\treturn new Buffer( base64, 'base64' ).toString( 'utf8' );\n}\n","import { symlinkOrCopy } from 'sander';\n\nexport default function moveTo ( inputdir, outputdir, options ) {\n\treturn symlinkOrCopy( inputdir ).to( outputdir, options.dest );\n}\n","function GobbleError ( data ) {\n\tvar prop;\n\n\tthis.stack = (new Error()).stack;\n\n\tfor ( prop in data ) {\n\t\tif ( data.hasOwnProperty( prop ) ) {\n\t\t\tthis[ prop ] = data[ prop ];\n\t\t}\n\t}\n}\n\nGobbleError.prototype = Object.create( Error.prototype );\nGobbleError.prototype.constructor = GobbleError;\nGobbleError.prototype.gobble = true;\nGobbleError.prototype.name = 'GobbleError';\n\nexport default GobbleError;\n","import { symlinkOrCopy } from 'sander';\n\nexport default function grab ( inputdir, outputdir, options ) {\n\treturn symlinkOrCopy( inputdir, options.src ).to( outputdir );\n}\n","/*global console */\nimport { format } from 'util';\n\nlet alreadyWarned = {};\n\nexport default function warnOnce () {\n\tconst warning = format.apply( null, arguments );\n\n\tif ( !alreadyWarned[ warning ] ) {\n\t\tconsole.log( warning );\n\t\talreadyWarned[ warning ] = true;\n\t}\n}\n","export default function compareBuffers ( a, b ) {\n\tlet i = a.length;\n\n\tif ( b.length !== i ) {\n\t\treturn false;\n\t}\n\n\twhile ( i-- ) {\n\t\tif ( a[i] !== b[i] ) {\n\t\t\treturn false;\n\t\t}\n\t}\n\n\treturn true;\n}\n","import { mkdir, readdir, rimraf, Promise } from 'sander' ;\n\nexport default function cleanup ( dir ) {\n\treturn mkdir( dir ).then( () => {\n\t\treturn readdir( dir ).then( files => {\n\t\t\tvar promises = files.map( filename => rimraf( dir, filename ) );\n\t\t\treturn Promise.all( promises );\n\t\t});\n\t});\n}\n","import { EventEmitter2 } from 'eventemitter2';\n\nlet currentSession;\n\nconst session = {\n\tconfig: null, // mutable\n\n\tcreate ( options ) {\n\t\tif ( currentSession ) {\n\t\t\tthrow new Error( 'Gobble is already running. You can only run one build/serve task per process' );\n\t\t}\n\n\t\tsession.config = {\n\t\t\tgobbledir: options.gobbledir\n\t\t};\n\n\t\tcurrentSession = new EventEmitter2({ wildcard: true });\n\t\treturn currentSession;\n\t},\n\n\tdestroy () {\n\t\tcurrentSession = session.config = null;\n\t}\n};\n\nexport default session;\n","import { basename, extname } from 'path';\nimport * as mime from 'mime';\nimport { readFile, stat, createReadStream } from 'sander';\nimport { getSourcemapComment, SOURCEMAP_COMMENT } from '../../utils/sourcemap';\n\nexport default function serveFile ( filepath, request, response ) {\n\tconst ext = extname( filepath );\n\n\t// this might be turn out to be a really bad idea. But let's try it and see\n\tif ( ext === '.js' || ext === '.css' ) {\n\t\treturn readFile( filepath ).then( data => {\n\t\t\t// this takes the auto-generated absolute sourcemap path, and turns\n\t\t\t// it into what you'd get with `gobble build` or `gobble watch`\n\t\t\tconst sourcemapComment = getSourcemapComment( basename( filepath ) + '.map', ext );\n\t\t\tdata = data.toString().replace( SOURCEMAP_COMMENT, sourcemapComment );\n\n\t\t\tresponse.statusCode = 200;\n\t\t\tresponse.setHeader( 'Content-Type', mime.lookup( filepath ) );\n\n\t\t\tresponse.write( data );\n\t\t\tresponse.end();\n\t\t});\n\t}\n\n\treturn stat( filepath ).then( stats => {\n\t\tresponse.statusCode = 200;\n\t\tresponse.setHeader( 'Content-Type', mime.lookup( filepath ) );\n\t\tresponse.setHeader( 'Content-Length', stats.size );\n\n\t\tcreateReadStream( filepath ).pipe( response );\n\t});\n}\n","export default function compile ( string ) {\n\treturn data => {\n\t\treturn string.replace( /\\{\\{([^\\}]+)\\}\\}/g, ( match, $1 ) => {\n\t\t\treturn data.hasOwnProperty( $1 ) ? data[ $1 ] : match;\n\t\t});\n\t};\n}\n","import { extname, resolve } from 'path';\nimport { statSync } from 'graceful-fs';\nimport { lookup } from 'mime';\nimport { exists, readdir } from 'sander';\nimport serveFile from './serveFile';\nimport dirTemplate from './templates/dir';\n\nexport default function serveDir ( filepath, request, response ) {\n\tconst index = resolve( filepath, 'index.html' );\n\n\treturn exists( index ).then( exists => {\n\t\tif ( exists ) {\n\t\t\treturn serveFile( index, request, response );\n\t\t}\n\n\t\treturn readdir( filepath ).then( files => {\n\t\t\tlet items = files.map( href => {\n\t\t\t\tconst stats = statSync( resolve( filepath, href ) );\n\t\t\t\tconst isDir = stats.isDirectory();\n\n\t\t\t\treturn {\n\t\t\t\t\tisDir,\n\t\t\t\t\thref,\n\t\t\t\t\ttype: isDir ? 'dir' : extname( href )\n\t\t\t\t};\n\t\t\t});\n\n\t\t\titems.sort( ( a, b ) => {\n\t\t\t\tif ( ( a.isDir && b.isDir ) || ( !a.isDir && !b.isDir ) ) {\n\t\t\t\t\treturn a.href < b.href ? 1 : -1;\n\t\t\t\t}\n\n\t\t\t\treturn a.isDir ? -1 : 1;\n\t\t\t});\n\n\t\t\tconst html = dirTemplate({\n\t\t\t\turl: request.url,\n\t\t\t\titems: items\n\t\t\t\t\t.map( item => `<li class=\"${item.type}\"><a href=\"${item.href}\">${item.href}</a></li>` )\n\t\t\t\t\t.join( '' )\n\t\t\t});\n\n\t\t\tresponse.statusCode = 200;\n\t\t\tresponse.setHeader( 'Content-Type', lookup( 'html' ) );\n\t\t\tresponse.setHeader( 'Content-Length', html.length );\n\n\t\t\tresponse.write( html );\n\t\t\tresponse.end();\n\t\t});\n\t});\n}\n","var charToInteger = {};\nvar integerToChar = {};\n\n'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='.split( '' ).forEach( function ( char, i ) {\n\tcharToInteger[ char ] = i;\n\tintegerToChar[ i ] = char;\n});\n\nexport function decode ( string ) {\n\tvar result = [],\n\t\tlen = string.length,\n\t\ti,\n\t\thasContinuationBit,\n\t\tshift = 0,\n\t\tvalue = 0,\n\t\tinteger,\n\t\tshouldNegate;\n\n\tfor ( i = 0; i < len; i += 1 ) {\n\t\tinteger = charToInteger[ string[i] ];\n\n\t\tif ( integer === undefined ) {\n\t\t\tthrow new Error( 'Invalid character (' + string[i] + ')' );\n\t\t}\n\n\t\thasContinuationBit = integer & 32;\n\n\t\tinteger &= 31;\n\t\tvalue += integer << shift;\n\n\t\tif ( hasContinuationBit ) {\n\t\t\tshift += 5;\n\t\t} else {\n\t\t\tshouldNegate = value & 1;\n\t\t\tvalue >>= 1;\n\n\t\t\tresult.push( shouldNegate ? -value : value );\n\n\t\t\t// reset\n\t\t\tvalue = shift = 0;\n\t\t}\n\t}\n\n\treturn result;\n}\n\nexport function encode ( value ) {\n\tvar result, i;\n\n\tif ( typeof value === 'number' ) {\n\t\tresult = encodeInteger( value );\n\t} else {\n\t\tresult = '';\n\t\tfor ( i = 0; i < value.length; i += 1 ) {\n\t\t\tresult += encodeInteger( value[i] );\n\t\t}\n\t}\n\n\treturn result;\n}\n\nfunction encodeInteger ( num ) {\n\tvar result = '', clamped;\n\n\tif ( num < 0 ) {\n\t\tnum = ( -num << 1 ) | 1;\n\t} else {\n\t\tnum <<= 1;\n\t}\n\n\tdo {\n\t\tclamped = num & 31;\n\t\tnum >>= 5;\n\n\t\tif ( num > 0 ) {\n\t\t\tclamped |= 32;\n\t\t}\n\n\t\tresult += integerToChar[ clamped ];\n\t} while ( num > 0 );\n\n\treturn result;\n}\n","import crc32 from 'buffer-crc32';\nimport { decode } from 'vlq';\n\nlet cache = {};\n\nfunction decodeSegments ( encodedSegments ) {\n\tlet i = encodedSegments.length;\n\tlet segments = new Array( i);\n\n\twhile ( i-- ) {\n\t\tsegments[i] = decode( encodedSegments[i] );\n\t}\n\n\treturn segments;\n}\n\nexport default function decodeMappings ( mappings ) {\n\tlet checksum = crc32( mappings );\n\n\tif ( !cache[ checksum ] ) {\n\t\tlet sourceFileIndex = 0;   // second field\n\t\tlet sourceCodeLine = 0;    // third field\n\t\tlet sourceCodeColumn = 0;  // fourth field\n\t\tlet nameIndex = 0;         // fifth field\n\n\t\tlet lines = mappings.split( ';' );\n\t\tlet numLines = lines.length;\n\t\tlet decoded = new Array( numLines );\n\n\t\tlet i, j, line, generatedCodeColumn, decodedLine, segments, segment, result;\n\n\t\tfor ( i = 0; i < numLines; i += 1 ) {\n\t\t\tline = lines[i];\n\n\t\t\tgeneratedCodeColumn = 0; // first field - reset each time\n\t\t\tdecodedLine = [];\n\n\t\t\tsegments = decodeSegments( line.split( ',' ) );\n\n\t\t\tfor ( j = 0; j < segments.length; j += 1 ) {\n\t\t\t\tsegment = segments[j];\n\n\t\t\t\tif ( !segment.length ) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tgeneratedCodeColumn += segment[0];\n\n\t\t\t\tresult = [ generatedCodeColumn ];\n\t\t\t\tdecodedLine.push( result );\n\n\t\t\t\tif ( segment.length === 1 ) {\n\t\t\t\t\t// only one field!\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tsourceFileIndex  += segment[1];\n\t\t\t\tsourceCodeLine   += segment[2];\n\t\t\t\tsourceCodeColumn += segment[3];\n\n\t\t\t\tresult.push( sourceFileIndex, sourceCodeLine, sourceCodeColumn );\n\n\t\t\t\tif ( segment.length === 5 ) {\n\t\t\t\t\tnameIndex += segment[4];\n\t\t\t\t\tresult.push( nameIndex );\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tdecoded[i] = decodedLine;\n\t\t}\n\n\t\tcache[ checksum ] = decoded;\n\t}\n\n\treturn cache[ checksum ];\n}\n","/**\n * Decodes a base64 string\n * @param {string} base64 - the string to decode\n * @returns {string}\n */\nexport default function atob ( base64 ) {\n\treturn new Buffer( base64, 'base64' ).toString( 'utf8' );\n}","// this looks ridiculous, but it prevents sourcemap tooling from mistaking\n// this for an actual sourceMappingURL\nlet SOURCEMAPPING_URL = 'sourceMa';\nSOURCEMAPPING_URL += 'ppingURL';\n\nexport default SOURCEMAPPING_URL;\n","import { dirname, resolve } from 'path';\nimport { readFile, readFileSync, Promise } from 'sander';\nimport atob from './atob';\nimport SOURCEMAPPING_URL from './sourceMappingURL';\n\n/**\n * Turns a sourceMappingURL into a sourcemap\n * @param {string} url - the sourceMappingURL. Can be a\n   base64-encoded data URI\n * @param {string} base - the URL against which relative URLS\n   should be resolved\n * @param {boolean} sync - if `true`, return a promise, otherwise\n   return the sourcemap\n * @returns {object} - a version 3 sourcemap\n */\nexport default function getMapFromUrl ( url, base, sync ) {\n\tif ( /^data:/.test( url ) ) { // TODO beef this up\n\t\tconst match = /base64,(.+)$/.exec( url );\n\n\t\tif ( !match ) {\n\t\t\tthrow new Error( `${SOURCEMAPPING_URL} is not base64-encoded` );\n\t\t}\n\n\t\tconst json = atob( match[1] );\n\t\tconst map = JSON.parse( json );\n\t\treturn sync ? map : Promise.resolve( map );\n\t}\n\n\turl = resolve( dirname( base ), decodeURI( url ) );\n\n\tif ( sync ) {\n\t\treturn JSON.parse( readFileSync( url ).toString() );\n\t} else {\n\t\treturn readFile( url ).then( String ).then( JSON.parse );\n\t}\n}\n","import SOURCEMAPPING_URL from './sourceMappingURL';\n\nexport default function getSourceMappingUrl ( str ) {\n\tvar index, substring, url, match;\n\n\t// assume we want the last occurence\n\tindex = str.lastIndexOf( `${SOURCEMAPPING_URL}=` );\n\n\tif ( index === -1 ) {\n\t\treturn null;\n\t}\n\n\tsubstring = str.substring( index + 17 );\n\tmatch = /^[^\\r\\n]+/.exec( substring );\n\n\turl = match ? match[0] : null;\n\n\t// possibly a better way to do this, but we don't want to exclude whitespace\n\t// from the sourceMappingURL because it might not have been correctly encoded\n\tif ( url && url.slice( -2 ) === '*/' ) {\n\t\turl = url.slice( 0, -2 ).trim();\n\t}\n\n\treturn url;\n}\n","import getMapFromUrl from './getMapFromUrl';\nimport getSourceMappingUrl from './getSourceMappingUrl';\nimport { Promise } from 'sander';\n\nexport default function getMap ( node, sourceMapByPath, sync ) {\n\tif ( node.file in sourceMapByPath ) {\n\t\tconst map = sourceMapByPath[ node.file ];\n\t\treturn sync ? map : Promise.resolve( map );\n\t}\n\n\telse {\n\t\tconst url = getSourceMappingUrl( node.content );\n\n\t\tif ( !url ) {\n\t\t\tnode.isOriginalSource = true;\n\t\t\treturn sync ? null : Promise.resolve( null );\n\t\t}\n\n\t\treturn getMapFromUrl( url, node.file, sync );\n\t}\n}","import { dirname, resolve } from 'path';\nimport { readFile, readFileSync, Promise } from 'sander';\nimport decodeMappings from './utils/decodeMappings';\nimport getMap from './utils/getMap';\n\nexport default class Node {\n\tconstructor ({ file, content }) {\n\t\tthis.file = file ? resolve( file ) : null;\n\t\tthis.content = content || null; // sometimes exists in sourcesContent, sometimes doesn't\n\n\t\tif ( !this.file && this.content === null ) {\n\t\t\tthrow new Error( 'A source must specify either file or content' );\n\t\t}\n\n\t\t// these get filled in later\n\t\tthis.map = null;\n\t\tthis.mappings = null;\n\t\tthis.sources = null;\n\t\tthis.isOriginalSource = null;\n\n\t\tthis._stats = {\n\t\t\tdecodingTime: 0,\n\t\t\tencodingTime: 0,\n\t\t\ttracingTime: 0,\n\n\t\t\tuntraceable: 0\n\t\t};\n\t}\n\n\tload ( sourcesContentByPath, sourceMapByPath ) {\n\t\treturn getContent( this, sourcesContentByPath ).then( content => {\n\t\t\tthis.content = sourcesContentByPath[ this.file ] = content;\n\n\t\t\treturn getMap( this, sourceMapByPath ).then( map => {\n\t\t\t\tif ( !map ) return null;\n\n\t\t\t\tthis.map = map;\n\n\t\t\t\tlet decodingStart = process.hrtime();\n\t\t\t\tthis.mappings = decodeMappings( map.mappings );\n\t\t\t\tlet decodingTime = process.hrtime( decodingStart );\n\t\t\t\tthis._stats.decodingTime = 1e9 * decodingTime[0] + decodingTime[1];\n\n\t\t\t\tconst sourcesContent = map.sourcesContent || [];\n\n\t\t\t\tconst sourceRoot = resolve( dirname( this.file ), map.sourceRoot || '' );\n\n\t\t\t\tthis.sources = map.sources.map( ( source, i ) => {\n\t\t\t\t\treturn new Node({\n\t\t\t\t\t\tfile: source ? resolve( sourceRoot, source ) : null,\n\t\t\t\t\t\tcontent: sourcesContent[i]\n\t\t\t\t\t});\n\t\t\t\t});\n\n\t\t\t\tconst promises = this.sources.map( node => node.load( sourcesContentByPath, sourceMapByPath ) );\n\t\t\t\treturn Promise.all( promises );\n\t\t\t});\n\t\t});\n\t}\n\n\tloadSync ( sourcesContentByPath, sourceMapByPath ) {\n\t\tif ( !this.content ) {\n\t\t\tif ( !sourcesContentByPath[ this.file ] ) {\n\t\t\t\tsourcesContentByPath[ this.file ] = readFileSync( this.file ).toString();\n\t\t\t}\n\n\t\t\tthis.content = sourcesContentByPath[ this.file ];\n\t\t}\n\n\t\tconst map = getMap( this, sourceMapByPath, true );\n\t\tlet sourcesContent;\n\n\t\tif ( !map ) {\n\t\t\tthis.isOriginalSource = true;\n\t\t} else {\n\t\t\tthis.map = map;\n\t\t\tthis.mappings = decodeMappings( map.mappings );\n\n\t\t\tsourcesContent = map.sourcesContent || [];\n\n\t\t\tconst sourceRoot = resolve( dirname( this.file ), map.sourceRoot || '' );\n\n\t\t\tthis.sources = map.sources.map( ( source, i ) => {\n\t\t\t\tconst node = new Node({\n\t\t\t\t\tfile: resolve( sourceRoot, source ),\n\t\t\t\t\tcontent: sourcesContent[i]\n\t\t\t\t});\n\n\t\t\t\tnode.loadSync( sourcesContentByPath, sourceMapByPath );\n\t\t\t\treturn node;\n\t\t\t});\n\t\t}\n\t}\n\n\t/**\n\t * Traces a segment back to its origin\n\t * @param {number} lineIndex - the zero-based line index of the\n\t   segment as found in `this`\n\t * @param {number} columnIndex - the zero-based column index of the\n\t   segment as found in `this`\n\t * @param {string || null} - if specified, the name that should be\n\t   (eventually) returned, as it is closest to the generated code\n\t * @returns {object}\n\t     @property {string} source - the filepath of the source\n\t     @property {number} line - the one-based line index\n\t     @property {number} column - the zero-based column index\n\t     @property {string || null} name - the name corresponding\n\t     to the segment being traced\n\t */\n\ttrace ( lineIndex, columnIndex, name ) {\n\t\t// If this node doesn't have a source map, we have\n\t\t// to assume it is the original source\n\t\tif ( this.isOriginalSource ) {\n\t\t\treturn {\n\t\t\t\tsource: this.file,\n\t\t\t\tline: lineIndex + 1,\n\t\t\t\tcolumn: columnIndex || 0,\n\t\t\t\tname: name\n\t\t\t};\n\t\t}\n\n\t\t// Otherwise, we need to figure out what this position in\n\t\t// the intermediate file corresponds to in *its* source\n\t\tconst segments = this.mappings[ lineIndex ];\n\n\t\tif ( !segments || segments.length === 0 ) {\n\t\t\treturn null;\n\t\t}\n\n\t\tif ( columnIndex != null ) {\n\t\t\tlet len = segments.length;\n\t\t\tlet i;\n\n\t\t\tfor ( i = 0; i < len; i += 1 ) {\n\t\t\t\tlet generatedCodeColumn = segments[i][0];\n\n\t\t\t\tif ( generatedCodeColumn > columnIndex ) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tif ( generatedCodeColumn === columnIndex ) {\n\t\t\t\t\tif ( segments[i].length < 4 ) return null;\n\n\t\t\t\t\tlet sourceFileIndex = segments[i][1];\n\t\t\t\t\tlet sourceCodeLine = segments[i][2];\n\t\t\t\t\tlet sourceCodeColumn = segments[i][3];\n\t\t\t\t\tlet nameIndex = segments[i][4];\n\n\t\t\t\t\tlet parent = this.sources[ sourceFileIndex ];\n\t\t\t\t\treturn parent.trace( sourceCodeLine, sourceCodeColumn, this.map.names[ nameIndex ] || name );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// fall back to a line mapping\n\t\tlet sourceFileIndex = segments[0][1];\n\t\tlet sourceCodeLine = segments[0][2];\n\t\tlet nameIndex = segments[0][4];\n\n\t\tlet parent = this.sources[ sourceFileIndex ];\n\t\treturn parent.trace( sourceCodeLine, null, this.map.names[ nameIndex ] || name );\n\t}\n}\n\nfunction getContent ( node, sourcesContentByPath ) {\n\tif ( node.file in sourcesContentByPath ) {\n\t\tnode.content = sourcesContentByPath[ node.file ];\n\t}\n\n\tif ( !node.content ) {\n\t\treturn readFile( node.file ).then( String );\n\t}\n\n\treturn Promise.resolve( node.content );\n}\n","/**\n * Encodes a string as base64\n * @param {string} str - the string to encode\n * @returns {string}\n */\nexport default function btoa ( str ) {\n\treturn new Buffer( str ).toString( 'base64' );\n}","import btoa from './utils/btoa';\n\nexport default class SourceMap {\n\tconstructor ( properties ) {\n\t\tthis.version = 3;\n\n\t\tthis.file           = properties.file;\n\t\tthis.sources        = properties.sources;\n\t\tthis.sourcesContent = properties.sourcesContent;\n\t\tthis.names          = properties.names;\n\t\tthis.mappings       = properties.mappings;\n\t}\n\n\ttoString () {\n\t\treturn JSON.stringify( this );\n\t}\n\n\ttoUrl () {\n\t\treturn 'data:application/json;charset=utf-8;base64,' + btoa( this.toString() );\n\t}\n}","import { encode } from 'vlq';\n\nexport default function encodeMappings ( decoded ) {\n\tlet offsets = {\n\t\tgeneratedCodeColumn: 0,\n\t\tsourceFileIndex: 0,   // second field\n\t\tsourceCodeLine: 0,    // third field\n\t\tsourceCodeColumn: 0,  // fourth field\n\t\tnameIndex: 0          // fifth field\n\t};\n\n\treturn decoded.map( function ( line ) {\n\t\toffsets.generatedCodeColumn = 0; // first field - reset each time\n\t\treturn line.map( encodeSegment ).join( ',' );\n\t}).join( ';' );\n\n\tfunction encodeSegment ( segment ) {\n\t\tif ( !segment.length ) {\n\t\t\treturn segment;\n\t\t}\n\n\t\tlet result = new Array( segment.length );\n\n\t\tresult[0] = segment[0] - offsets.generatedCodeColumn;\n\t\toffsets.generatedCodeColumn = segment[0];\n\n\t\tif ( segment.length === 1 ) {\n\t\t\t// only one field!\n\t\t\treturn result;\n\t\t}\n\n\t\tresult[1] = segment[1] - offsets.sourceFileIndex;\n\t\tresult[2] = segment[2] - offsets.sourceCodeLine;\n\t\tresult[3] = segment[3] - offsets.sourceCodeColumn;\n\n\t\toffsets.sourceFileIndex  = segment[1];\n\t\toffsets.sourceCodeLine   = segment[2];\n\t\toffsets.sourceCodeColumn = segment[3];\n\n\t\tif ( segment.length === 5 ) {\n\t\t\tresult[4] = segment[4] - offsets.nameIndex;\n\t\t\toffsets.nameIndex = segment[4];\n\t\t}\n\n\t\treturn encode( result );\n\t}\n}\n","import { basename, dirname, extname, relative, resolve } from 'path';\nimport { writeFile, writeFileSync } from 'sander';\nimport SourceMap from './SourceMap';\nimport encodeMappings from './utils/encodeMappings';\nimport slash from './utils/slash';\n\nlet SOURCEMAPPING_URL = 'sourceMa';\nSOURCEMAPPING_URL += 'ppingURL';\n\nconst SOURCEMAP_COMMENT = new RegExp( `\\n*(?:` +\n\t`\\\\/\\\\/[@#]\\\\s*${SOURCEMAPPING_URL}=([^'\"]+)|` +      // js\n\t`\\\\/\\\\*#?\\\\s*${SOURCEMAPPING_URL}=([^'\"]+)\\\\s\\\\*\\\\/)` + // css\n`\\\\s*$`, 'g' );\n\nexport default class Chain {\n\tconstructor ( node, sourcesContentByPath ) {\n\t\tthis.node = node;\n\t\tthis.sourcesContentByPath = sourcesContentByPath;\n\n\t\tthis._stats = {};\n\t}\n\n\tstat () {\n\t\treturn {\n\t\t\tselfDecodingTime: this._stats.decodingTime / 1e6,\n\t\t\ttotalDecodingTime: ( this._stats.decodingTime + tally( this.node.sources, 'decodingTime' ) ) / 1e6,\n\n\t\t\tencodingTime: this._stats.encodingTime / 1e6,\n\t\t\ttracingTime: this._stats.tracingTime / 1e6,\n\n\t\t\tuntraceable: this._stats.untraceable\n\t\t};\n\t}\n\n\tapply ( options = {} ) {\n\t\tlet allNames = [];\n\t\tlet allSources = [];\n\n\t\tconst applySegment = ( segment, result ) => {\n\t\t\tif ( segment.length < 4 ) return;\n\n\t\t\tconst traced = this.node.sources[ segment[1] ].trace( // source\n\t\t\t\tsegment[2], // source code line\n\t\t\t\tsegment[3], // source code column\n\t\t\t\tthis.node.map.names[ segment[4] ]\n\t\t\t);\n\n\t\t\tif ( !traced ) {\n\t\t\t\tthis._stats.untraceable += 1;\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tlet sourceIndex = allSources.indexOf( traced.source );\n\t\t\tif ( !~sourceIndex ) {\n\t\t\t\tsourceIndex = allSources.length;\n\t\t\t\tallSources.push( traced.source );\n\t\t\t}\n\n\t\t\tlet newSegment = [\n\t\t\t\tsegment[0], // generated code column\n\t\t\t\tsourceIndex,\n\t\t\t\ttraced.line - 1,\n\t\t\t\ttraced.column\n\t\t\t];\n\n\t\t\tif ( traced.name ) {\n\t\t\t\tlet nameIndex = allNames.indexOf( traced.name );\n\t\t\t\tif ( !~nameIndex ) {\n\t\t\t\t\tnameIndex = allNames.length;\n\t\t\t\t\tallNames.push( traced.name );\n\t\t\t\t}\n\n\t\t\t\tnewSegment[4] = nameIndex;\n\t\t\t}\n\n\t\t\tresult[ result.length ] = newSegment;\n\t\t};\n\n\t\t// Trace mappings\n\t\tlet tracingStart = process.hrtime();\n\n\t\tlet i = this.node.mappings.length;\n\t\tlet resolved = new Array( i );\n\n\t\tlet j, line, result;\n\n\t\twhile ( i-- ) {\n\t\t\tline = this.node.mappings[i];\n\t\t\tresolved[i] = result = [];\n\n\t\t\tfor ( j = 0; j < line.length; j += 1 ) {\n\t\t\t\tapplySegment( line[j], result );\n\t\t\t}\n\t\t}\n\n\t\tlet tracingTime = process.hrtime( tracingStart );\n\t\tthis._stats.tracingTime = 1e9 * tracingTime[0] + tracingTime[1];\n\n\t\t// Encode mappings\n\t\tlet encodingStart = process.hrtime();\n\t\tlet mappings = encodeMappings( resolved );\n\t\tlet encodingTime = process.hrtime( encodingStart );\n\t\tthis._stats.encodingTime = 1e9 * encodingTime[0] + encodingTime[1];\n\n\t\tlet includeContent = options.includeContent !== false;\n\n\t\treturn new SourceMap({\n\t\t\tfile: basename( this.node.file ),\n\t\t\tsources: allSources.map( source => slash( relative( options.base || dirname( this.node.file ), source ) ) ),\n\t\t\tsourcesContent: allSources.map( source => includeContent ? this.sourcesContentByPath[ source ] : null ),\n\t\t\tnames: allNames,\n\t\t\tmappings\n\t\t});\n\t}\n\n\ttrace ( oneBasedLineIndex, zeroBasedColumnIndex ) {\n\t\treturn this.node.trace( oneBasedLineIndex - 1, zeroBasedColumnIndex, null );\n\t}\n\n\twrite ( dest, options ) {\n\t\tif ( typeof dest !== 'string' ) {\n\t\t\toptions = dest;\n\t\t\tdest = this.node.file;\n\t\t}\n\n\t\toptions = options || {};\n\n\t\tconst { resolved, content, map } = processWriteOptions( dest, this, options );\n\n\t\tlet promises = [ writeFile( resolved, content ) ];\n\n\t\tif ( !options.inline ) {\n\t\t\tpromises.push( writeFile( resolved + '.map', map.toString() ) );\n\t\t}\n\n\t\treturn Promise.all( promises );\n\t}\n\n\twriteSync ( dest, options ) {\n\t\tif ( typeof dest !== 'string' ) {\n\t\t\toptions = dest;\n\t\t\tdest = this.node.file;\n\t\t}\n\n\t\toptions = options || {};\n\n\t\tconst { resolved, content, map } = processWriteOptions( dest, this, options );\n\n\t\twriteFileSync( resolved, content );\n\n\t\tif ( !options.inline ) {\n\t\t\twriteFileSync( resolved + '.map', map.toString() );\n\t\t}\n\t}\n}\n\nfunction processWriteOptions ( dest, chain, options ) {\n\tconst resolved = resolve( dest );\n\n\tconst map = chain.apply({\n\t\tincludeContent: options.includeContent,\n\t\tbase: options.base ? resolve( options.base ) : dirname( resolved )\n\t});\n\n\tconst url = options.inline ? map.toUrl() : ( options.absolutePath ? resolved : basename( resolved ) ) + '.map';\n\n\t// TODO shouldn't url be relative?\n\tconst content = chain.node.content.replace( SOURCEMAP_COMMENT, '' ) + sourcemapComment( url, resolved );\n\n\treturn { resolved, content, map };\n}\n\nfunction tally ( nodes, stat ) {\n\treturn nodes.reduce( ( total, node ) => {\n\t\treturn total + node._stats[ stat ];\n\t}, 0 );\n}\n\nfunction sourcemapComment ( url, dest ) {\n\tconst ext = extname( dest );\n\turl = encodeURI( url );\n\n\tif ( ext === '.css' ) {\n\t\treturn `\\n/*# ${SOURCEMAPPING_URL}=${url} */\\n`;\n\t}\n\n\treturn `\\n//# ${SOURCEMAPPING_URL}=${url}\\n`;\n}\n","export default function slash ( path ) {\n\treturn typeof path === 'string' ?\n\t\tpath.replace( /\\\\/g, '/' ) :\n\t\tpath;\n}\n","import { resolve } from 'path';\nimport Node from './Node';\nimport Chain from './Chain';\n\nexport function load ( file, options ) {\n\tconst { node, sourcesContentByPath, sourceMapByPath } = init( file, options );\n\n\treturn node.load( sourcesContentByPath, sourceMapByPath )\n\t\t.then( () => node.isOriginalSource ? null : new Chain( node, sourcesContentByPath ) );\n}\n\nexport function loadSync ( file, options = {} ) {\n\tconst { node, sourcesContentByPath, sourceMapByPath } = init( file, options );\n\n\tnode.loadSync( sourcesContentByPath, sourceMapByPath );\n\treturn node.isOriginalSource ? null : new Chain( node, sourcesContentByPath );\n}\n\nfunction init ( file, options = {} ) {\n\tconst node = new Node({ file });\n\n\tlet sourcesContentByPath = {};\n\tlet sourceMapByPath = {};\n\n\tif ( options.content ) {\n\t\tObject.keys( options.content ).forEach( key => {\n\t\t\tsourcesContentByPath[ resolve( key ) ] = options.content[ key ];\n\t\t});\n\t}\n\n\tif ( options.sourcemaps ) {\n\t\tObject.keys( options.sourcemaps ).forEach( key => {\n\t\t\tsourceMapByPath[ resolve( key ) ] = options.sourcemaps[ key ];\n\t\t});\n\t}\n\n\treturn { node, sourcesContentByPath, sourceMapByPath };\n}\n","import { load } from 'sorcery';\n\nexport default function serveSourcemap ( filepath, sourcemapPromises, request, response ) {\n\tconst owner = filepath.slice( 0, -4 );\n\n\tif ( !sourcemapPromises[ filepath ] ) {\n\t\tsourcemapPromises[ filepath ] = load( owner )\n\t\t\t.then( chain => {\n\t\t\t\tif ( !chain ) {\n\t\t\t\t\tthrow new Error( 'Could not resolve sourcemap for ' + owner );\n\t\t\t\t}\n\n\t\t\t\treturn chain.apply().toString();\n\t\t\t});\n\t}\n\n\treturn sourcemapPromises[ filepath ].then( map => {\n\t\tresponse.statusCode = 200;\n\t\tresponse.setHeader( 'Content-Type', 'application/json' );\n\n\t\tresponse.write( map );\n\t\tresponse.end();\n\t});\n}","import errTemplate from './templates/err';\nimport waitingTemplate from './templates/waiting';\nimport notfoundTemplate from './templates/notfound';\n\nconst entities = {\n\t'&': '&amp;',\n\t'<': '&lt;',\n\t'>': '&gt;',\n\t'\"': '&quot;',\n\t\"'\": '&#39;',\n\t'/': '&#x2F;'\n};\n\nconst colors = {\n\t37: 'white',\n\t90: 'grey',\n\t30: 'black',\n\t34: 'blue',\n\t36: 'cyan',\n\t32: 'green',\n\t35: 'magenta',\n\t31: 'red',\n\t33: 'yellow'\n};\n\nexport default function serveError ( error, request, response ) {\n\tlet html; // should be a block-scoped const, but jshint...\n\n\tif ( error.gobble === 'WAITING' ) {\n\t\tresponse.statusCode = 420;\n\t\tresponse.write( waitingTemplate() );\n\n\t\tresponse.end();\n\t}\n\n\telse if ( error.code === 'ENOENT' ) {\n\t\thtml = notfoundTemplate({\n\t\t\tpath: error.path\n\t\t});\n\n\t\tresponse.statusCode = 404;\n\t\tresponse.write( html );\n\n\t\tresponse.end();\n\t}\n\n\telse {\n\t\tconst message = escape( error.original ? error.original.message || error.original : error.message || error );\n\t\tconst filename = error.original ? error.original.filename : error.filename;\n\n\t\thtml = errTemplate({\n\t\t\tid: error.id,\n\t\t\tmessage: message.replace( /\\[(\\d+)m/g, ( match, $1 ) => {\n\t\t\t\tlet color;\n\n\t\t\t\tif ( match === '[39m' ) {\n\t\t\t\t\treturn '</span>';\n\t\t\t\t}\n\n\t\t\t\tif ( color = colors[ $1 ] ) {\n\t\t\t\t\treturn `<span style=\"color:${color};\">`;\n\t\t\t\t}\n\n\t\t\t\treturn '';\n\t\t\t}), // remove colors\n\t\t\tstack: prepareStack( error.stack ),\n\t\t\tfilemessage: filename ? `<p>The error occurred while processing <strong>${filename}</strong>.</p>` : ''\n\t\t});\n\n\t\t// turn filepaths into links\n\t\thtml = html.replace( /([>\\s\\(])(&#x2F[^\\s\\):<]+)/g, ( match, $1, $2 ) => {\n\t\t\treturn `${$1}<a href=\"/__gobble__${$2}\">${$2}</a>`;\n\t\t});\n\n\t\tresponse.statusCode = 500;\n\t\tresponse.write( html );\n\n\t\tresponse.end();\n\t}\n}\n\nfunction prepareStack ( stack ) {\n\treturn stack.split( '\\n' )\n\t\t.filter( line => line !== 'Error' )\n\t\t.map( line => `<li>${escape( line.trim() )}</li>` )\n\t\t.join( '' );\n}\n\nfunction escape ( str ) {\n\treturn ( str || '' ).replace( /[&<>\"'\\/]/g, char => entities[ char ] );\n}\n","import { extname, join } from 'path';\nimport { parse } from 'url';\nimport { stat, Promise } from 'sander';\nimport serveFile from './serveFile';\nimport serveDir from './serveDir';\nimport serveSourcemap from './serveSourcemap';\nimport serveError from './serveError';\n\nexport default function handleRequest ( srcDir, error, sourcemapPromises, request, response ) {\n\tconst parsedUrl = parse( request.url );\n\tconst pathname = parsedUrl.pathname;\n\n\tlet filepath;\n\n\tif ( error ) {\n\t\tif ( pathname.substr( 0, 11 ) === '/__gobble__' ) {\n\t\t\tconst message = ( error.original && error.original.message ) || error.message || '';\n\t\t\tfilepath = pathname.substring( 11 );\n\n\t\t\t// only allow links to files that we're actually interested in, not\n\t\t\t// the whole damn filesystem\n\t\t\tif ( ~message.indexOf( filepath ) || ~error.stack.indexOf( filepath ) ) {\n\t\t\t\treturn serveFile( pathname.substring( 11 ), request, response );\n\t\t\t}\n\t\t}\n\n\t\tserveError( error, request, response );\n\t\treturn Promise.resolve();\n\t}\n\n\tfilepath = join( srcDir, pathname );\n\n\tif ( extname( filepath ) === '.map' ) {\n\t\treturn serveSourcemap( filepath, sourcemapPromises, request, response )\n\t\t\t.catch( err => serveError( err, request, response ) );\n\t}\n\n\treturn stat( filepath ).then( stats => {\n\t\tif ( stats.isDirectory() ) {\n\t\t\t// might need to redirect from `foo` to `foo/`\n\t\t\tif ( pathname.slice( -1 ) !== '/' ) {\n\t\t\t\tresponse.setHeader( 'Location', pathname + '/' + ( parsedUrl.search || '' ) );\n\t\t\t\tresponse.writeHead( 301 );\n\n\t\t\t\tresponse.end();\n\t\t\t} else {\n\t\t\t\treturn serveDir( filepath, request, response );\n\t\t\t}\n\t\t}\n\n\t\telse {\n\t\t\treturn serveFile( filepath, request, response );\n\t\t}\n\t}, err => serveError( err, request, response ) );\n}\n","import { createServer } from 'http';\nimport { resolve } from 'path';\nimport { Promise } from 'sander';\nimport * as tinyLr from 'tiny-lr';\nimport cleanup from '../../utils/cleanup';\nimport session from '../../session/index.js';\nimport GobbleError from '../../utils/GobbleError';\nimport handleRequest from './handleRequest';\n\nexport default function serve ( node, options = {} ) {\n\tconst port = options.port || 4567;\n\tconst gobbledir = resolve( options.gobbledir || process.env.GOBBLE_TMP_DIR || '.gobble' );\n\tconst task = session.create({ gobbledir });\n\n\tlet buildStarted = Date.now();\n\tlet watchTask;\n\tlet srcDir;\n\tlet sourcemapPromises;\n\tlet server;\n\tlet serverReady;\n\tlet lrServer;\n\tlet lrServerReady;\n\tlet built = false;\n\tlet firedReadyEvent = false;\n\tlet error = { gobble: 'WAITING' };\n\n\ttask.resume = n => {\n\t\tnode = n;\n\t\twatchTask = node.createWatchTask();\n\n\t\twatchTask.on( 'info', details => task.emit( 'info', details ) );\n\n\t\twatchTask.on( 'error', err => {\n\t\t\terror = err;\n\t\t\ttask.emit( 'error', err );\n\t\t});\n\n\t\tlet buildStart;\n\t\twatchTask.on( 'build:start', () => buildStart = Date.now() );\n\n\t\twatchTask.on( 'build:end', dir => {\n\t\t\terror = null;\n\t\t\tsourcemapPromises = {};\n\t\t\tsrcDir = dir;\n\n\t\t\tbuilt = true;\n\n\t\t\ttask.emit( 'built' );\n\n\t\t\ttask.emit( 'info', {\n\t\t\t\tcode: 'BUILD_COMPLETE',\n\t\t\t\tduration: Date.now() - buildStart\n\t\t\t});\n\n\t\t\tif ( !firedReadyEvent && serverReady ) {\n\t\t\t\ttask.emit( 'ready' );\n\t\t\t\tfiredReadyEvent = true;\n\t\t\t}\n\n\t\t\tif ( !lrServerReady ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tlrServer.changed({ body: { files: '*' } });\n\t\t});\n\t};\n\n\ttask.close = () => {\n\t\tif ( node ) {\n\t\t\tnode.stop();\n\t\t}\n\n\t\treturn new Promise( fulfil => {\n\t\t\tsession.destroy();\n\t\t\tserver.removeAllListeners();\n\t\t\tserver.close( fulfil );\n\t\t});\n\t};\n\n\ttask.pause = () => {\n\t\terror = { gobble: 'WAITING' };\n\n\t\tbuildStarted = Date.now();\n\n\t\tif ( node ) {\n\t\t\tnode.stop();\n\t\t}\n\n\t\tnode = null;\n\n\t\treturn cleanup( gobbledir );\n\t};\n\n\tserver = createServer();\n\n\tserver.on( 'error', err => {\n\t\tif ( err.code === 'EADDRINUSE' ) {\n\t\t\t// We need to create our own error, so we can pass along port info\n\t\t\terr = new GobbleError({\n\t\t\t\tport,\n\t\t\t\tcode: 'PORT_IN_USE',\n\t\t\t\tmessage: `port ${port} is already in use`\n\t\t\t});\n\t\t}\n\n\t\ttask.emit( 'error', err );\n\n\t\tprocess.exit( 1 );\n\t});\n\n\tserver.listen( port, () => {\n\t\tserverReady = true;\n\n\t\tif ( !firedReadyEvent && built ) {\n\t\t\ttask.emit( 'ready' );\n\t\t\tfiredReadyEvent = true;\n\t\t}\n\n\t\ttask.emit( 'info', {\n\t\t\tport,\n\t\t\tcode: 'SERVER_LISTENING'\n\t\t});\n\t});\n\n\tserver.on( 'request', ( request, response ) => {\n\t\thandleRequest( srcDir, error, sourcemapPromises, request, response )\n\t\t\t.catch( err => task.emit( 'error', err ) );\n\t});\n\n\tlrServer = tinyLr();\n\tlrServer.error = err => {\n\t\tif ( err.code === 'EADDRINUSE' ) {\n\t\t\ttask.emit( 'warning', 'a livereload server is already running (perhaps in a separate gobble process?). Livereload will not be available for this session' );\n\t\t} else {\n\t\t\ttask.emit( 'error', err );\n\t\t}\n\t};\n\n\tlrServer.listen( 35729, () => {\n\t\tlrServerReady = true;\n\t\ttask.emit( 'info', {\n\t\t\tcode: 'LIVERELOAD_RUNNING'\n\t\t});\n\t});\n\n\n\tcleanup( gobbledir ).then(\n\t\t() => task.resume( node ),\n\t\terr => task.emit( 'error', err )\n\t);\n\n\treturn task;\n}\n","import { extname, resolve } from 'path';\nimport { lsr } from 'sander';\nimport * as mapSeries from 'promise-map-series';\nimport { load } from 'sorcery';\n\nconst whitelist = { '.js': true, '.css': true };\n\nexport default function flattenSourcemaps ( inputdir, outputdir, base, task ) {\n\treturn lsr( inputdir ).then( files => {\n\t\tconst jsAndCss = files.filter( file => whitelist[ extname( file ) ] );\n\n\t\treturn mapSeries( jsAndCss, file => {\n\t\t\treturn load( resolve( inputdir, file ) )\n\t\t\t\t.then( chain => {\n\t\t\t\t\tif ( chain ) {\n\t\t\t\t\t\treturn chain.write( resolve( outputdir, file ), { base });\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t\t.catch( err => {\n\t\t\t\t\ttask.emit( 'error', err );\n\t\t\t\t});\n\t\t});\n\t})\n\t.then( () => inputdir );\n}\n","import { resolve } from 'path';\nimport { copydir ,readdir } from 'sander';\nimport cleanup from '../../utils/cleanup';\nimport session from '../../session/index.js';\nimport GobbleError from '../../utils/GobbleError';\nimport flattenSourcemaps from '../../utils/flattenSourcemaps';\n\nexport default function ( node, options ) {\n\tif ( !options || !options.dest ) {\n\t\tthrow new GobbleError({\n\t\t\tcode: 'MISSING_DEST_DIR',\n\t\t\ttask: 'build'\n\t\t});\n\t}\n\n\tconst gobbledir = resolve( options.gobbledir || process.env.GOBBLE_TMP_DIR || '.gobble-build' );\n\tconst dest = options.dest;\n\n\t// the return value is an EventEmitter...\n\tconst task = session.create({ gobbledir });\n\tlet promise;\n\tlet previousDetails;\n\n\tfunction build () {\n\t\ttask.emit( 'info', {\n\t\t\tcode: 'BUILD_START'\n\t\t});\n\t\tnode.start();\n\n\t\tnode.on( 'info', details => {\n\t\t\tif ( details === previousDetails ) return;\n\t\t\tpreviousDetails = details;\n\t\t\ttask.emit( 'info', details );\n\t\t});\n\n\t\treturn node.ready()\n\t\t\t.then( inputdir => {\n\t\t\t\treturn copydir( inputdir ).to( dest )\n\t\t\t\t\t.then( () => flattenSourcemaps( inputdir, dest, dest, task ) );\n\t\t\t})\n\t\t\t.then( () => node.stop() ); // TODO should not need to stop...\n\t}\n\n\tpromise = cleanup( gobbledir )\n\t\t.then( () => {\n\t\t\treturn readdir( dest ).then( files => {\n\t\t\t\tif ( files.length && !options.force ) {\n\t\t\t\t\tthrow new GobbleError({\n\t\t\t\t\t\tmessage: `destination folder (${dest}) is not empty`,\n\t\t\t\t\t\tcode: 'DIR_NOT_EMPTY',\n\t\t\t\t\t\tpath: dest\n\t\t\t\t\t});\n\t\t\t\t}\n\n\t\t\t\treturn cleanup( dest ).then( build );\n\t\t\t}, build );\n\t\t})\n\t\t.then(\n\t\t\t() => {\n\t\t\t\ttask.emit( 'complete' );\n\t\t\t\tsession.destroy();\n\t\t\t},\n\t\t\terr => {\n\t\t\t\tsession.destroy();\n\t\t\t\ttask.emit( 'error', err );\n\t\t\t\tthrow err;\n\t\t\t}\n\t\t);\n\n\t// that does double duty as a promise\n\ttask.then = function () {\n\t\treturn promise.then.apply( promise, arguments );\n\t};\n\n\ttask.catch = function () {\n\t\treturn promise.catch.apply( promise, arguments );\n\t};\n\n\treturn task;\n}\n","import { copydir, rimraf, Promise } from 'sander';\nimport cleanup from '../../utils/cleanup';\nimport session from '../../session/index.js';\nimport GobbleError from '../../utils/GobbleError';\nimport flattenSourcemaps from '../../utils/flattenSourcemaps';\n\nexport default function watch ( node, options ) {\n\tif ( !options || !options.dest ) {\n\t\tthrow new GobbleError({\n\t\t\tcode: 'MISSING_DEST_DIR',\n\t\t\ttask: 'watch'\n\t\t});\n\t}\n\n\tconst gobbledir = require( 'path' ).resolve( options.gobbledir || process.env.GOBBLE_TMP_DIR || '.gobble-watch' );\n\tconst task = session.create({ gobbledir });\n\n\tlet watchTask;\n\n\ttask.resume = n => {\n\t\tnode = n;\n\t\twatchTask = node.createWatchTask();\n\n\t\twatchTask.on( 'info', details => task.emit( 'info', details ) );\n\t\twatchTask.on( 'error', err => task.emit( 'error', err ) );\n\n\t\tlet buildStart;\n\t\twatchTask.on( 'build:start', () => buildStart = Date.now() );\n\n\t\twatchTask.on( 'build:end', dir => {\n\t\t\tconst dest = options.dest;\n\n\t\t\trimraf( dest )\n\t\t\t\t.then( () => copydir( dir ).to( dest ) )\n\t\t\t\t.then( () => {\n\t\t\t\t\tconst sourcemapProcessStart = Date.now();\n\n\t\t\t\t\ttask.emit( 'info', {\n\t\t\t\t\t\tcode: 'SOURCEMAP_PROCESS_START',\n\t\t\t\t\t\tprogressIndicator: true\n\t\t\t\t\t});\n\n\t\t\t\t\treturn flattenSourcemaps( dir, dest, dest, task ).then( () => {\n\t\t\t\t\t\ttask.emit( 'info', {\n\t\t\t\t\t\t\tcode: 'SOURCEMAP_PROCESS_COMPLETE',\n\t\t\t\t\t\t\tduration: Date.now() - sourcemapProcessStart\n\t\t\t\t\t\t});\n\n\t\t\t\t\t\ttask.emit( 'info', {\n\t\t\t\t\t\t\tcode: 'BUILD_COMPLETE',\n\t\t\t\t\t\t\tduration: Date.now() - buildStart,\n\t\t\t\t\t\t\twatch: true\n\t\t\t\t\t\t});\n\t\t\t\t\t});\n\t\t\t\t})\n\t\t\t\t.then( () => task.emit( 'built', dest ) )\n\t\t\t\t.catch( err => task.emit( 'error', err ) );\n\t\t});\n\t};\n\n\ttask.close = () => {\n\t\twatchTask.close();\n\t\tsession.destroy();\n\n\t\treturn Promise.resolve(); // for consistency with serve task\n\t};\n\n\ttask.pause = () => {\n\t\tif ( watchTask ) {\n\t\t\twatchTask.close();\n\t\t}\n\n\t\twatchTask = null;\n\t\treturn cleanup( gobbledir );\n\t};\n\n\tcleanup( gobbledir ).then(\n\t\t() => task.resume( node ),\n\t\terr => task.emit( 'error', err )\n\t);\n\n\treturn task;\n}\n","import { EventEmitter2 } from 'eventemitter2';\nimport * as crc32 from 'buffer-crc32';\nimport { lsrSync, readFileSync, rimraf } from 'sander';\nimport { resolve } from 'path';\nimport * as requireRelative from 'require-relative';\nimport { grab, include, map as mapTransform, move } from '../builtins/index.js';\nimport { Observer, Transformer } from './index.js';\nimport config from '../config/index.js';\nimport GobbleError from '../utils/GobbleError.js';\nimport assign from '../utils/assign.js';\nimport warnOnce from '../utils/warnOnce.js';\nimport compareBuffers from '../utils/compareBuffers.js';\nimport serve from './serve/index.js';\nimport build from './build/index.js';\nimport watch from './watch/index.js';\nimport { isRegExp } from '../utils/is.js';\nimport { ABORTED } from '../utils/signals.js';\n\n// TODO remove this in a future version\nfunction enforceCorrectArguments ( options ) {\n\tif ( options !== undefined && typeof options !== 'object' ) {\n\t\tthrow new Error( 'As of gobble 0.9.0, you cannot pass multiple strings to .grab() and .moveTo(). Use path.join() instead' );\n\t}\n}\n\nexport default class Node extends EventEmitter2 {\n\tconstructor () {\n\t\t// initialise event emitter\n\t\tsuper({ wildcard: true });\n\n\t\tthis._gobble = true; // makes life easier for e.g. gobble-cli\n\n\t\tthis.counter = 1;\n\t\tthis.inspectTargets = [];\n\t}\n\n\t// This gets overwritten each time this.ready is overwritten. Until\n\t// the first time that happens, it's a noop\n\t_abort () {}\n\n\t_findCreator () {\n\t\treturn this;\n\t}\n\n\tbuild ( options ) {\n\t\treturn build( this, options );\n\t}\n\n\tcreateWatchTask () {\n\t\tconst node = this;\n\t\tconst watchTask = new EventEmitter2({ wildcard: true });\n\n\t\t// TODO is this the best place to handle this stuff? or is it better\n\t\t// to pass off the info to e.g. gobble-cli?\n\t\tlet previousDetails;\n\n\t\tnode.on( 'info', details => {\n\t\t\tif ( details === previousDetails ) return;\n\t\t\tpreviousDetails = details;\n\t\t\twatchTask.emit( 'info', details );\n\t\t});\n\n\t\tlet buildScheduled;\n\n\t\tnode.on( 'invalidate', changes => {\n\t\t\t// A node can depend on the same source twice, which will result in\n\t\t\t// simultaneous rebuilds unless we defer it to the next tick\n\t\t\tif ( !buildScheduled ) {\n\t\t\t\tbuildScheduled = true;\n\t\t\t\twatchTask.emit( 'info', {\n\t\t\t\t\tchanges,\n\t\t\t\t\tcode: 'BUILD_INVALIDATED'\n\t\t\t\t});\n\n\t\t\t\tprocess.nextTick( build );\n\t\t\t}\n\t\t});\n\n\t\tnode.on( 'error', handleError );\n\n\t\tfunction build () {\n\t\t\tbuildScheduled = false;\n\n\t\t\twatchTask.emit( 'build:start' );\n\n\t\t\tnode.ready()\n\t\t\t\t.then( outputdir => {\n\t\t\t\t\twatchTask.emit( 'build:end', outputdir );\n\t\t\t\t})\n\t\t\t\t.catch( handleError );\n\t\t}\n\n\t\tfunction handleError ( e ) {\n\t\t\tif ( e === ABORTED ) {\n\t\t\t\t// these happen shortly after an invalidation,\n\t\t\t\t// we can ignore them\n\t\t\t\treturn;\n\t\t\t} else {\n\t\t\t\twatchTask.emit( 'error', e );\n\t\t\t}\n\t\t}\n\n\t\twatchTask.close = () => node.stop();\n\n\t\tthis.start();\n\t\tprocess.nextTick( build );\n\n\t\treturn watchTask;\n\t}\n\n\texclude ( patterns, options ) {\n\t\tif ( typeof patterns === 'string' ) { patterns = [ patterns ]; }\n\t\treturn new Transformer( this, include, { patterns, exclude: true, id: options && options.id });\n\t}\n\n\tgetChanges ( inputdir ) {\n\t\tconst files = lsrSync( inputdir );\n\n\t\tif ( !this._files ) {\n\t\t\tthis._files = files;\n\t\t\tthis._checksums = {};\n\n\t\t\tfiles.forEach( file => {\n\t\t\t\tthis._checksums[ file ] = crc32( readFileSync( inputdir, file ) );\n\t\t\t});\n\n\t\t\treturn files.map( file => ({ file, added: true }) );\n\t\t}\n\n\t\tconst added = files.filter( file => !~this._files.indexOf( file ) ).map( file => ({ file, added: true }) );\n\t\tconst removed = this._files.filter( file => !~files.indexOf( file ) ).map( file => ({ file, removed: true }) );\n\n\t\tconst maybeChanged = files.filter( file => ~this._files.indexOf( file ) );\n\n\t\tlet changed = [];\n\n\t\tmaybeChanged.forEach( file => {\n\t\t\tlet checksum = crc32( readFileSync( inputdir, file ) );\n\n\t\t\tif ( !compareBuffers( checksum, this._checksums[ file ] ) ) {\n\t\t\t\tchanged.push({ file, changed: true });\n\t\t\t\tthis._checksums[ file ] = checksum;\n\t\t\t}\n\t\t});\n\n\t\treturn added.concat( removed ).concat( changed );\n\t}\n\n\tgrab ( src, options ) {\n\t\tenforceCorrectArguments( options );\n\t\treturn new Transformer( this, grab, { src, id: options && options.id });\n\t}\n\n\t// Built-in transformers\n\tinclude ( patterns, options ) {\n\t\tif ( typeof patterns === 'string' ) { patterns = [ patterns ]; }\n\t\treturn new Transformer( this, include, { patterns, id: options && options.id });\n\t}\n\n\tinspect ( target, options ) {\n\t\ttarget = resolve( config.cwd, target );\n\n\t\tif ( options && options.clean ) {\n\t\t\trimraf( target );\n\t\t}\n\n\t\tthis.inspectTargets.push( target );\n\t\treturn this; // chainable\n\t}\n\n\tmap ( fn, userOptions ) {\n\t\twarnOnce( 'node.map() is deprecated. You should use node.transform() instead for both file and directory transforms' );\n\t\treturn this.transform( fn, userOptions );\n\t}\n\n\tmoveTo ( dest, options ) {\n\t\tenforceCorrectArguments( options );\n\t\treturn new Transformer( this, move, { dest, id: options && options.id });\n\t}\n\n\tobserve ( fn, userOptions ) {\n\t\tif ( typeof fn === 'string' ) {\n\t\t\tfn = tryToLoad( fn );\n\t\t}\n\n\t\treturn new Observer( this, fn, userOptions );\n\t}\n\n\tobserveIf ( condition, fn, userOptions ) {\n\t\treturn condition ? this.observe( fn, userOptions ) : this;\n\t}\n\n\tserve ( options ) {\n\t\treturn serve( this, options );\n\t}\n\n\ttransform ( fn, userOptions ) {\n\t\tif ( typeof fn === 'string' ) {\n\t\t\t// TODO remove this for 0.9.0\n\t\t\tif ( fn === 'sorcery' ) {\n\t\t\t\twarnOnce( 'Sourcemaps are flattened automatically as of gobble 0.8.0. You should remove the sorcery transformation from your build definition' );\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tfn = tryToLoad( fn );\n\t\t}\n\n\t\t// If function takes fewer than 3 arguments, it's a file transformer\n\t\tif ( fn.length < 3 ) {\n\t\t\tconst options = assign( {}, fn.defaults, userOptions, {\n\t\t\t\tfn,\n\t\t\t\tcache: {},\n\t\t\t\tuserOptions: assign( {}, userOptions )\n\t\t\t});\n\n\t\t\tif ( typeof options.accept === 'string' || isRegExp( options.accept ) ) {\n\t\t\t\toptions.accept = [ options.accept ];\n\t\t\t}\n\n\t\t\treturn new Transformer( this, mapTransform, options, fn.id || fn.name );\n\t\t}\n\n\t\t// Otherwise it's a directory transformer\n\t\treturn new Transformer( this, fn, userOptions );\n\t}\n\n\ttransformIf ( condition, fn, userOptions ) {\n\t\treturn condition ? this.transform( fn, userOptions ) : this;\n\t}\n\n\twatch ( options ) {\n\t\treturn watch( this, options );\n\t}\n}\n\nfunction tryToLoad ( plugin ) {\n\ttry {\n\t\treturn requireRelative( `gobble-${plugin}`, process.cwd() );\n\t} catch ( err ) {\n\t\tif ( err.message === `Cannot find module 'gobble-${plugin}'` ) {\n\t\t\tthrow new GobbleError({\n\t\t\t\tmessage: `Could not load gobble-${plugin} plugin`,\n\t\t\t\tcode: 'PLUGIN_NOT_FOUND',\n\t\t\t\tplugin: plugin\n\t\t\t});\n\t\t} else {\n\t\t\tthrow err;\n\t\t}\n\t}\n}\n"]}