diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 00000000000..a3095d303f5 --- /dev/null +++ b/.prettierignore @@ -0,0 +1,2 @@ +src/builtins +test/integration diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 00000000000..8cfb46ec898 --- /dev/null +++ b/.prettierrc @@ -0,0 +1,4 @@ +{ + "singleQuote": true, + "bracketSpacing": false, +} diff --git a/bin/cli.js b/bin/cli.js index 05bc1bba3e9..fe8bfb5b49d 100755 --- a/bin/cli.js +++ b/bin/cli.js @@ -7,41 +7,67 @@ const version = require('../package.json').version; program.version(version); -program.command('serve [input]') +program + .command('serve [input]') .description('starts a development server') .option('-p, --port ', 'set the port to serve on. defaults to 1234') - .option('-d, --out-dir ', 'set the output directory. defaults to "dist"') - .option('--public-url ', 'set the public URL to serve on. defaults to the same as the --out-dir option') + .option( + '-d, --out-dir ', + 'set the output directory. defaults to "dist"' + ) + .option( + '--public-url ', + 'set the public URL to serve on. defaults to the same as the --out-dir option' + ) .option('--no-hmr', 'disable hot module replacement') .option('--no-cache', 'disable the filesystem cache') .action(bundle); -program.command('watch [input]') +program + .command('watch [input]') .description('starts the bundler in watch mode') - .option('-d, --out-dir ', 'set the output directory. defaults to "dist"') - .option('--public-url ', 'set the public URL to serve on. defaults to the same as the --out-dir option') + .option( + '-d, --out-dir ', + 'set the output directory. defaults to "dist"' + ) + .option( + '--public-url ', + 'set the public URL to serve on. defaults to the same as the --out-dir option' + ) .option('--no-hmr', 'disable hot module replacement') .option('--no-cache', 'disable the filesystem cache') .action(bundle); -program.command('build [input]') +program + .command('build [input]') .description('bundles for production') - .option('-d, --out-dir ', 'set the output directory. defaults to "dist"') - .option('--public-url ', 'set the public URL to serve on. defaults to the same as the --out-dir option') + .option( + '-d, --out-dir ', + 'set the output directory. defaults to "dist"' + ) + .option( + '--public-url ', + 'set the public URL to serve on. defaults to the same as the --out-dir option' + ) .option('--no-minify', 'disable minification') .option('--no-cache', 'disable the filesystem cache') .action(bundle); -program.command('help [command]') +program + .command('help [command]') .description('display help information for a command') - .action(function (command) { + .action(function(command) { let cmd = program.commands.find(c => c.name() === command) || program; cmd.help(); }); -program.on('--help', function () { +program.on('--help', function() { console.log(''); - console.log(' Run `' + chalk.bold('parcel help ') + '` for more information on specific commands'); + console.log( + ' Run `' + + chalk.bold('parcel help ') + + '` for more information on specific commands' + ); console.log(''); }); diff --git a/package.json b/package.json index bf6981640bd..b2e9afc4258 100644 --- a/package.json +++ b/package.json @@ -42,7 +42,9 @@ "babel-cli": "^6.26.0", "babel-preset-env": "^1.6.1", "cross-env": "^5.1.1", + "husky": "^0.14.3", "less": "^2.7.2", + "lint-staged": "^6.0.0", "mocha": "^3.5.0", "ncp": "^2.0.0", "nib": "^1.1.2", @@ -50,19 +52,25 @@ "nyc": "^11.1.0", "postcss-modules": "^0.8.0", "posthtml-include": "^1.1.0", + "prettier": "^1.9.1", "rimraf": "^2.6.1", "stylus": "^0.54.5", "typescript": "^2.6.2" }, "scripts": { "test": "cross-env NODE_ENV=test mocha", + "format": "prettier --write './{src,bin,test}/**/*.{js,json,md}'", "build": "babel src -d lib", - "prepublish": "yarn build" + "prepublish": "yarn build", + "precommit": "lint-staged" }, "bin": { "parcel": "bin/cli.js" }, "engines": { "node": ">= 6.0.0" + }, + "lint-staged": { + "*.{js,json,md}": ["prettier --write", "git add"] } } diff --git a/src/Asset.js b/src/Asset.js index ca4e1614a2e..d74aa6ad71f 100644 --- a/src/Asset.js +++ b/src/Asset.js @@ -28,11 +28,11 @@ class Asset { this.ast = null; this.generated = null; this.hash = null; - this.parentDeps = new Set; - this.dependencies = new Map; - this.depAssets = new Map; + this.parentDeps = new Set(); + this.dependencies = new Map(); + this.depAssets = new Map(); this.parentBundle = null; - this.bundles = new Set; + this.bundles = new Set(); } async loadIfNeeded() { @@ -71,9 +71,16 @@ class Asset { from = this.name; } - let resolved = path.resolve(path.dirname(from), url).replace(/[\?#].*$/, ''); - this.addDependency('./' + path.relative(path.dirname(this.name), resolved), Object.assign({dynamic: true}, opts)); - return this.options.parser.getAsset(resolved, this.package, this.options).generateBundleName(); + let resolved = path + .resolve(path.dirname(from), url) + .replace(/[\?#].*$/, ''); + this.addDependency( + './' + path.relative(path.dirname(this.name), resolved), + Object.assign({dynamic: true}, opts) + ); + return this.options.parser + .getAsset(resolved, this.package, this.options) + .generateBundleName(); } mightHaveDependencies() { @@ -139,7 +146,10 @@ class Asset { generateBundleName(isMainAsset) { // Resolve the main file of the package.json - let main = this.package && this.package.main ? path.resolve(path.dirname(this.package.pkgfile), this.package.main) : null; + let main = + this.package && this.package.main + ? path.resolve(path.dirname(this.package.pkgfile), this.package.main) + : null; let ext = '.' + this.type; // If this asset is main file of the package, use the package name diff --git a/src/Bundle.js b/src/Bundle.js index 3bfa0fbd5e5..501400780b4 100644 --- a/src/Bundle.js +++ b/src/Bundle.js @@ -14,9 +14,9 @@ class Bundle { this.name = name; this.parentBundle = parent; this.entryAsset = null; - this.assets = new Set; - this.childBundles = new Set; - this.siblingBundles = new Map; + this.assets = new Set(); + this.childBundles = new Set(); + this.siblingBundles = new Map(); } addAsset(asset) { @@ -35,7 +35,13 @@ class Bundle { } if (!this.siblingBundles.has(type)) { - let bundle = this.createChildBundle(type, Path.join(Path.dirname(this.name), Path.basename(this.name, Path.extname(this.name)) + '.' + type)); + let bundle = this.createChildBundle( + type, + Path.join( + Path.dirname(this.name), + Path.basename(this.name, Path.extname(this.name)) + '.' + type + ) + ); this.siblingBundles.set(type, bundle); } @@ -52,7 +58,7 @@ class Bundle { return this.assets.size === 0; } - async package(bundler, oldHashes, newHashes = new Map) { + async package(bundler, oldHashes, newHashes = new Map()) { if (this.isEmpty) { return newHashes; } @@ -79,7 +85,7 @@ class Bundle { await packager.start(); - let included = new Set; + let included = new Set(); for (let asset of this.assets) { await this._addDeps(asset, packager, included); } @@ -128,7 +134,8 @@ class Bundle { b = theirParents.pop(); } - if (a === b) { // One bundle descended from the other + if (a === b) { + // One bundle descended from the other return a; } diff --git a/src/Bundler.js b/src/Bundler.js index c2a7cb60b46..d757162768a 100644 --- a/src/Bundler.js +++ b/src/Bundler.js @@ -26,35 +26,42 @@ class Bundler extends EventEmitter { this.resolver = new Resolver(this.options); this.parser = new Parser(this.options); - this.packagers = new PackagerRegistry; + this.packagers = new PackagerRegistry(); this.cache = this.options.cache ? new FSCache(this.options) : null; this.logger = new Logger(this.options); this.delegate = options.delegate || {}; this.pending = false; - this.loadedAssets = new Map; + this.loadedAssets = new Map(); this.farm = null; this.watcher = null; this.hmr = null; this.bundleHashes = null; this.errored = false; - this.buildQueue = new Set; + this.buildQueue = new Set(); this.rebuildTimeout = null; this.loadPlugins(); } normalizeOptions(options) { - const isProduction = options.production || process.env.NODE_ENV === 'production'; - const publicURL = options.publicUrl || options.publicURL || '/' + Path.basename(options.outDir || 'dist'); - const watch = typeof options.watch === 'boolean' ? options.watch : !isProduction; + const isProduction = + options.production || process.env.NODE_ENV === 'production'; + const publicURL = + options.publicUrl || + options.publicURL || + '/' + Path.basename(options.outDir || 'dist'); + const watch = + typeof options.watch === 'boolean' ? options.watch : !isProduction; return { outDir: Path.resolve(options.outDir || 'dist'), publicURL: publicURL, watch: watch, cache: typeof options.cache === 'boolean' ? options.cache : true, - killWorkers: typeof options.killWorkers === 'boolean' ? options.killWorkers : true, - minify: typeof options.minify === 'boolean' ? options.minify : isProduction, + killWorkers: + typeof options.killWorkers === 'boolean' ? options.killWorkers : true, + minify: + typeof options.minify === 'boolean' ? options.minify : isProduction, hmr: typeof options.hmr === 'boolean' ? options.hmr : watch, logLevel: typeof options.logLevel === 'number' ? options.logLevel : 3 }; @@ -126,7 +133,10 @@ class Bundler extends EventEmitter { let bundle = await this.buildQueuedAssets(isInitialBundle); let buildTime = Date.now() - startTime; - let time = buildTime < 1000 ? `${buildTime}ms` : `${(buildTime / 1000).toFixed(2)}s`; + let time = + buildTime < 1000 + ? `${buildTime}ms` + : `${(buildTime / 1000).toFixed(2)}s`; this.logger.status('✨', `Built in ${time}.`, 'green'); return bundle; @@ -166,7 +176,7 @@ class Bundler extends EventEmitter { } if (this.options.hmr) { - this.hmr = new HMRServer; + this.hmr = new HMRServer(); this.options.hmrPort = await this.hmr.start(); } } @@ -187,7 +197,7 @@ class Bundler extends EventEmitter { async buildQueuedAssets(isInitialBundle = false) { // Consume the rebuild queue until it is empty. - let loadedAssets = new Set; + let loadedAssets = new Set(); while (this.buildQueue.size > 0) { let promises = []; for (let asset of this.buildQueue) { @@ -280,7 +290,7 @@ class Bundler extends EventEmitter { asset.processed = true; // First try the cache, otherwise load and compile in the background - let processed = this.cache && await this.cache.read(asset.name); + let processed = this.cache && (await this.cache.read(asset.name)); if (!processed) { processed = await this.farm.run(asset.name, asset.package, this.options); if (this.cache) { @@ -301,19 +311,21 @@ class Bundler extends EventEmitter { } // Process asset dependencies - await Promise.all(dependencies.map(async dep => { - let assetDep = await this.resolveDep(asset, dep); - if (dep.includedInParent) { - // This dependency is already included in the parent's generated output, - // so no need to load it. We map the name back to the parent asset so - // that changing it triggers a recompile of the parent. - this.loadedAssets.set(dep.name, asset); - } else { - asset.dependencies.set(dep.name, dep); - asset.depAssets.set(dep.name, assetDep); - await this.loadAsset(assetDep); - } - })); + await Promise.all( + dependencies.map(async dep => { + let assetDep = await this.resolveDep(asset, dep); + if (dep.includedInParent) { + // This dependency is already included in the parent's generated output, + // so no need to load it. We map the name back to the parent asset so + // that changing it triggers a recompile of the parent. + this.loadedAssets.set(dep.name, asset); + } else { + asset.dependencies.set(dep.name, dep); + asset.depAssets.set(dep.name, assetDep); + await this.loadAsset(assetDep); + } + }) + ); this.buildQueue.delete(asset); } @@ -327,7 +339,10 @@ class Bundler extends EventEmitter { // If the asset is already in a bundle, it is shared. Move it to the lowest common ancestor. if (asset.parentBundle !== bundle) { let commonBundle = bundle.findCommonAncestor(asset.parentBundle); - if (asset.parentBundle !== commonBundle && asset.parentBundle.type === commonBundle.type) { + if ( + asset.parentBundle !== commonBundle && + asset.parentBundle.type === commonBundle.type + ) { this.moveAssetToBundle(asset, commonBundle); } } @@ -337,13 +352,19 @@ class Bundler extends EventEmitter { // Create the root bundle if it doesn't exist if (!bundle) { - bundle = new Bundle(asset.type, Path.join(this.options.outDir, asset.generateBundleName(true))); + bundle = new Bundle( + asset.type, + Path.join(this.options.outDir, asset.generateBundleName(true)) + ); bundle.entryAsset = asset; } // Create a new bundle for dynamic imports if (dep && dep.dynamic) { - bundle = bundle.createChildBundle(asset.type, Path.join(this.options.outDir, asset.generateBundleName())); + bundle = bundle.createChildBundle( + asset.type, + Path.join(this.options.outDir, asset.generateBundleName()) + ); bundle.entryAsset = asset; } @@ -426,7 +447,9 @@ class Bundler extends EventEmitter { } serve(port = 1234) { - this.logger.persistent('Server running at ' + this.logger.chalk.cyan(`http://localhost:${port}`)); + this.logger.persistent( + 'Server running at ' + this.logger.chalk.cyan(`http://localhost:${port}`) + ); this.bundle(); return Server.serve(this, port); } diff --git a/src/FSCache.js b/src/FSCache.js index 90e46ca4048..71db7f3d8d9 100644 --- a/src/FSCache.js +++ b/src/FSCache.js @@ -15,7 +15,7 @@ class FSCache { this.invalidated = new Set(); this.optionsHash = objectHash( OPTION_KEYS.reduce((p, k) => ((p[k] = options[k]), p), { - version: pkg.version, + version: pkg.version }) ); } diff --git a/src/HMRServer.js b/src/HMRServer.js index 69c86a57c54..2fba6d92cd8 100644 --- a/src/HMRServer.js +++ b/src/HMRServer.js @@ -3,13 +3,13 @@ const prettyError = require('./utils/prettyError'); class HMRServer { async start() { - await new Promise((resolve) => { + await new Promise(resolve => { this.wss = new WebSocket.Server({port: 0}, resolve); }); - this.wss.on('connection', (ws) => { + this.wss.on('connection', ws => { if (this.unresolvedError) { - ws.send(JSON.stringify(this.unresolvedError)) + ws.send(JSON.stringify(this.unresolvedError)); } }); @@ -33,12 +33,12 @@ class HMRServer { } }; - this.broadcast(this.unresolvedError) + this.broadcast(this.unresolvedError); } emitUpdate(assets) { if (this.unresolvedError) { - this.unresolvedError = null + this.unresolvedError = null; this.broadcast({ type: 'error-resolved' }); @@ -63,7 +63,7 @@ class HMRServer { } broadcast(msg) { - const json = JSON.stringify(msg) + const json = JSON.stringify(msg); for (let ws of this.wss.clients) { ws.send(json); } diff --git a/src/Logger.js b/src/Logger.js index 32a784f769b..3425b27b698 100644 --- a/src/Logger.js +++ b/src/Logger.js @@ -5,7 +5,8 @@ const prettyError = require('./utils/prettyError'); class Logger { constructor(options) { this.logLevel = typeof options.logLevel === 'number' ? options.logLevel : 3; - this.color = typeof options.color === 'boolean' ? options.color : chalk.supportsColor; + this.color = + typeof options.color === 'boolean' ? options.color : chalk.supportsColor; this.chalk = new chalk.constructor({enabled: this.color}); this.lines = 0; this.statusLine = null; @@ -96,7 +97,10 @@ class Logger { this.statusLine = this.lines; } - this.writeLine(this.statusLine, this.chalk[color].bold(`${emoji} ${message}`)); + this.writeLine( + this.statusLine, + this.chalk[color].bold(`${emoji} ${message}`) + ); if (!hasStatusLine) { process.stdout.write('\n'); diff --git a/src/Resolver.js b/src/Resolver.js index 0c894252fdd..a3bf39d3ee9 100644 --- a/src/Resolver.js +++ b/src/Resolver.js @@ -8,7 +8,7 @@ const glob = require('glob'); class Resolver { constructor(options = {}) { this.options = options; - this.cache = new Map; + this.cache = new Map(); } async resolve(filename, parent) { diff --git a/src/Server.js b/src/Server.js index c74a9a0684a..5bb97782d5a 100644 --- a/src/Server.js +++ b/src/Server.js @@ -6,7 +6,7 @@ const serveStatic = require('serve-static'); function middleware(bundler) { const serve = serveStatic(bundler.options.outDir, {index: false}); - return function (req, res, next) { + return function(req, res, next) { // Wait for the bundler to finish bundling if needed if (bundler.pending) { bundler.once('bundled', respond); diff --git a/src/assets/CSSAsset.js b/src/assets/CSSAsset.js index 81c1e194dcc..03cc15ece6a 100644 --- a/src/assets/CSSAsset.js +++ b/src/assets/CSSAsset.js @@ -17,7 +17,11 @@ class CSSAsset extends Asset { } mightHaveDependencies() { - return !/\.css$/.test(this.name) || IMPORT_RE.test(this.contents) || URL_RE.test(this.contents); + return ( + !/\.css$/.test(this.name) || + IMPORT_RE.test(this.contents) || + URL_RE.test(this.contents) + ); } parse(code) { @@ -32,7 +36,11 @@ class CSSAsset extends Asset { let dep; if (name.type === 'string') { dep = name.value; - } else if (name.type === 'function' && name.value === 'url' && name.nodes.length) { + } else if ( + name.type === 'function' && + name.value === 'url' && + name.nodes.length + ) { dep = name.nodes[0].value; } @@ -57,8 +65,14 @@ class CSSAsset extends Asset { let dirty = false; parsed.walk(node => { - if (node.type === 'function' && node.value === 'url' && node.nodes.length) { - let url = this.addURLDependency(node.nodes[0].value, {loc: decl.source.start}); + if ( + node.type === 'function' && + node.value === 'url' && + node.nodes.length + ) { + let url = this.addURLDependency(node.nodes[0].value, { + loc: decl.source.start + }); dirty = node.nodes[0].value !== url; node.nodes[0].value = url; } @@ -100,7 +114,8 @@ class CSSAsset extends Asset { } if (this.cssModules) { - js += 'module.exports = ' + JSON.stringify(this.cssModules, false, 2) + ';'; + js += + 'module.exports = ' + JSON.stringify(this.cssModules, false, 2) + ';'; } return {css, js}; @@ -109,7 +124,12 @@ class CSSAsset extends Asset { generateErrorMessage(err) { // Wrap the error in a CssSyntaxError if needed so we can generate a code frame if (err.loc && !err.showSourceCode) { - err = new CssSyntaxError(err.message, err.loc.line, err.loc.column, this.contents); + err = new CssSyntaxError( + err.message, + err.loc.line, + err.loc.column, + this.contents + ); } err.message = err.reason || err.message; @@ -137,7 +157,7 @@ class CSSAst { render() { if (this.dirty) { this.css = ''; - postcss.stringify(this.root, c => this.css += c); + postcss.stringify(this.root, c => (this.css += c)); } return this.css; diff --git a/src/assets/GlobAsset.js b/src/assets/GlobAsset.js index 7f19e700eaa..a3ece17f97b 100644 --- a/src/assets/GlobAsset.js +++ b/src/assets/GlobAsset.js @@ -18,7 +18,10 @@ class GlobAsset extends Asset { for (let file of files) { let match = file.match(re); - let parts = match.slice(1).filter(Boolean).reduce((a, p) => a.concat(p.split('/')), []); + let parts = match + .slice(1) + .filter(Boolean) + .reduce((a, p) => a.concat(p.split('/')), []); let relative = './' + path.relative(path.dirname(this.name), file); set(matches, parts, relative); this.addDependency(relative); @@ -47,7 +50,10 @@ function generate(matches, indent = '') { res += ','; } - res += `\n${indent} ${JSON.stringify(key)}: ${generate(matches[key], indent + ' ')}`; + res += `\n${indent} ${JSON.stringify(key)}: ${generate( + matches[key], + indent + ' ' + )}`; first = false; } diff --git a/src/assets/HTMLAsset.js b/src/assets/HTMLAsset.js index 68adbda7522..446ba8c0fd7 100644 --- a/src/assets/HTMLAsset.js +++ b/src/assets/HTMLAsset.js @@ -11,7 +11,16 @@ const isURL = require('../utils/is-url'); // A list of all attributes that should produce a dependency // Based on https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes const ATTRS = { - src: ['script', 'img', 'audio', 'video', 'source', 'track', 'iframe', 'embed'], + src: [ + 'script', + 'img', + 'audio', + 'video', + 'source', + 'track', + 'iframe', + 'embed' + ], href: ['link', 'a'], poster: ['video'] }; diff --git a/src/assets/JSAsset.js b/src/assets/JSAsset.js index 449fc38f9ca..38094301081 100644 --- a/src/assets/JSAsset.js +++ b/src/assets/JSAsset.js @@ -20,14 +20,18 @@ class JSAsset extends Asset { constructor(name, pkg, options) { super(name, pkg, options); this.type = 'js'; - this.globals = new Map; + this.globals = new Map(); this.isAstDirty = false; this.isES6Module = false; this.outputCode = null; } mightHaveDependencies() { - return !/.js$/.test(this.name) || IMPORT_RE.test(this.contents) || GLOBAL_RE.test(this.contents); + return ( + !/.js$/.test(this.name) || + IMPORT_RE.test(this.contents) || + GLOBAL_RE.test(this.contents) + ); } async parse(code) { @@ -40,14 +44,13 @@ class JSAsset extends Asset { strictMode: false, sourceType: 'module', locations: true, - plugins: [ - 'exportExtensions', - 'dynamicImport' - ] + plugins: ['exportExtensions', 'dynamicImport'] }; // Check if there is a babel config file. If so, determine which parser plugins to enable - this.babelConfig = (this.package && this.package.babel) || await config.load(this.name, ['.babelrc', '.babelrc.js']); + this.babelConfig = + (this.package && this.package.babel) || + (await config.load(this.name, ['.babelrc', '.babelrc.js'])); if (this.babelConfig) { const file = new BabelFile({filename: this.name}); options.plugins.push(...file.parserOpts.plugins); @@ -94,7 +97,9 @@ class JSAsset extends Asset { generate() { // TODO: source maps - let code = this.isAstDirty ? generate(this.ast).code : (this.outputCode || this.contents); + let code = this.isAstDirty + ? generate(this.ast).code + : this.outputCode || this.contents; if (this.globals.size > 0) { code = Array.from(this.globals.values()).join('\n') + '\n' + code; } @@ -108,7 +113,12 @@ class JSAsset extends Asset { const loc = err.loc; if (loc) { err.codeFrame = codeFrame(this.contents, loc.line, loc.column + 1); - err.highlightedCodeFrame = codeFrame(this.contents, loc.line, loc.column + 1, {highlightCode: true}); + err.highlightedCodeFrame = codeFrame( + this.contents, + loc.line, + loc.column + 1, + {highlightCode: true} + ); } return err; diff --git a/src/assets/JSONAsset.js b/src/assets/JSONAsset.js index 61b84dfb13c..7766dbb6847 100644 --- a/src/assets/JSONAsset.js +++ b/src/assets/JSONAsset.js @@ -2,7 +2,7 @@ const JSAsset = require('./JSAsset'); class JSONAsset extends JSAsset { async load() { - return 'module.exports = ' + await super.load() + ';'; + return 'module.exports = ' + (await super.load()) + ';'; } parse() {} diff --git a/src/assets/LESSAsset.js b/src/assets/LESSAsset.js index c8d890f495b..85bcea9b0c5 100644 --- a/src/assets/LESSAsset.js +++ b/src/assets/LESSAsset.js @@ -9,7 +9,10 @@ class LESSAsset extends CSSAsset { let less = localRequire('less', this.name); let render = promisify(less.render.bind(less)); - let opts = this.package.less || await config.load(this.name, ['.lessrc', '.lessrc.js']) || {}; + let opts = + this.package.less || + (await config.load(this.name, ['.lessrc', '.lessrc.js'])) || + {}; opts.filename = this.name; opts.plugins = (opts.plugins || []).concat(urlPlugin(this)); @@ -30,7 +33,10 @@ function urlPlugin(asset) { install: (less, pluginManager) => { let visitor = new less.visitors.Visitor({ visitUrl: (node, args) => { - node.value.value = asset.addURLDependency(node.value.value, node.currentFileInfo.filename); + node.value.value = asset.addURLDependency( + node.value.value, + node.currentFileInfo.filename + ); return node; } }); diff --git a/src/assets/SASSAsset.js b/src/assets/SASSAsset.js index 5da4ca58db7..17f3b7a531b 100644 --- a/src/assets/SASSAsset.js +++ b/src/assets/SASSAsset.js @@ -10,15 +10,21 @@ class SASSAsset extends CSSAsset { let sass = localRequire('node-sass', this.name); let render = promisify(sass.render.bind(sass)); - let opts = this.package.sass || await config.load(this.name, ['.sassrc', '.sassrc.js']) || {}; - opts.includePaths = (opts.includePaths || []).concat(path.dirname(this.name)); + let opts = + this.package.sass || + (await config.load(this.name, ['.sassrc', '.sassrc.js'])) || + {}; + opts.includePaths = (opts.includePaths || []).concat( + path.dirname(this.name) + ); opts.data = code; - opts.indentedSyntax = typeof opts.indentedSyntax === 'boolean' - ? opts.indentedSyntax - : path.extname(this.name).toLowerCase() === '.sass'; + opts.indentedSyntax = + typeof opts.indentedSyntax === 'boolean' + ? opts.indentedSyntax + : path.extname(this.name).toLowerCase() === '.sass'; opts.functions = Object.assign({}, opts.functions, { - url: (node) => { + url: node => { let filename = this.addURLDependency(node.getValue()); return new sass.types.String(`url(${JSON.stringify(filename)})`); } diff --git a/src/assets/StylusAsset.js b/src/assets/StylusAsset.js index 5eb61b5a620..4afd3884c8d 100644 --- a/src/assets/StylusAsset.js +++ b/src/assets/StylusAsset.js @@ -9,7 +9,9 @@ class StylusAsset extends CSSAsset { async parse(code) { // stylus should be installed locally in the module that's being required let stylus = localRequire('stylus', this.name); - let opts = this.package.stylus || await config.load(this.name, ['.stylusrc', '.stylusrc.js']); + let opts = + this.package.stylus || + (await config.load(this.name, ['.stylusrc', '.stylusrc.js'])); let style = stylus(code, opts); style.set('filename', this.name); style.set('include css', true); @@ -71,7 +73,9 @@ function createEvaluator(asset) { if (!found) { let nodeName = imported.once ? 'require' : 'import'; - throw new Error('failed to locate @' + nodeName + ' file ' + node.string); + throw new Error( + 'failed to locate @' + nodeName + ' file ' + node.string + ); } for (let file of found) { diff --git a/src/assets/TypeScriptAsset.js b/src/assets/TypeScriptAsset.js index f6ddb1c3ae6..d74e8bdab03 100644 --- a/src/assets/TypeScriptAsset.js +++ b/src/assets/TypeScriptAsset.js @@ -21,7 +21,10 @@ class TypeScriptAsset extends JSAsset { transpilerOptions.compilerOptions.noEmit = false; // Transpile Module using TypeScript and parse result as ast format through babylon - this.contents = typescript.transpileModule(code, transpilerOptions).outputText; + this.contents = typescript.transpileModule( + code, + transpilerOptions + ).outputText; return await super.parse(this.contents); } } diff --git a/src/packagers/HTMLPackager.js b/src/packagers/HTMLPackager.js index b7a6eb1670b..a2e8677b176 100644 --- a/src/packagers/HTMLPackager.js +++ b/src/packagers/HTMLPackager.js @@ -13,8 +13,10 @@ class HTMLPackager extends Packager { .filter(Boolean); if (cssBundles.length > 0) { - html = posthtml(this.insertCSSBundles.bind(this, cssBundles)) - .process(html, {sync: true}).html; + html = posthtml(this.insertCSSBundles.bind(this, cssBundles)).process( + html, + {sync: true} + ).html; } await this.dest.write(html); diff --git a/src/packagers/JSPackager.js b/src/packagers/JSPackager.js index 0fc548d1134..924cc1a9cd3 100644 --- a/src/packagers/JSPackager.js +++ b/src/packagers/JSPackager.js @@ -2,13 +2,17 @@ const fs = require('fs'); const {basename} = require('path'); const Packager = require('./Packager'); -const prelude = fs.readFileSync(__dirname + '/../builtins/prelude.js', 'utf8').trim(); -const hmr = fs.readFileSync(__dirname + '/../builtins/hmr-runtime.js', 'utf8').trim(); +const prelude = fs + .readFileSync(__dirname + '/../builtins/prelude.js', 'utf8') + .trim(); +const hmr = fs + .readFileSync(__dirname + '/../builtins/hmr-runtime.js', 'utf8') + .trim(); class JSPackager extends Packager { async start() { this.first = true; - this.dedupe = new Map; + this.dedupe = new Map(); await this.dest.write(prelude + '({'); } @@ -48,7 +52,8 @@ class JSPackager extends Packager { async writeModule(id, code, deps = {}) { let wrapped = this.first ? '' : ','; - wrapped += id + ':[function(require,module,exports) {\n' + (code || '') + '\n},'; + wrapped += + id + ':[function(require,module,exports) {\n' + (code || '') + '\n},'; wrapped += JSON.stringify(deps); wrapped += ']'; @@ -62,7 +67,10 @@ class JSPackager extends Packager { // Add the HMR runtime if needed. if (this.options.hmr) { // Asset ids normally start at 1, so this should be safe. - await this.writeModule(0, hmr.replace('{{HMR_PORT}}', this.options.hmrPort)); + await this.writeModule( + 0, + hmr.replace('{{HMR_PORT}}', this.options.hmrPort) + ); entry.push(0); } diff --git a/src/packagers/RawPackager.js b/src/packagers/RawPackager.js index 776dd120f37..08ac88c40f6 100644 --- a/src/packagers/RawPackager.js +++ b/src/packagers/RawPackager.js @@ -11,10 +11,14 @@ class RawPackager extends Packager { // Use the bundle name if this is the entry asset, otherwise generate one. let name = this.bundle.name; if (asset !== this.bundle.entryAsset) { - name = path.join(path.dirname(this.bundle.name), asset.generateBundleName()); + name = path.join( + path.dirname(this.bundle.name), + asset.generateBundleName() + ); } - let contents = asset.generated[asset.type] || await fs.readFile(asset.name); + let contents = + asset.generated[asset.type] || (await fs.readFile(asset.name)); await fs.writeFile(name, contents); } diff --git a/src/packagers/index.js b/src/packagers/index.js index 9cafbae6bcc..4792f77579e 100644 --- a/src/packagers/index.js +++ b/src/packagers/index.js @@ -5,7 +5,7 @@ const RawPackager = require('./RawPackager'); class PackagerRegistry { constructor() { - this.packagers = new Map; + this.packagers = new Map(); this.add('js', JSPackager); this.add('css', CSSPackager); diff --git a/src/transforms/babel.js b/src/transforms/babel.js index 0e150004fe7..2621f7cc190 100644 --- a/src/transforms/babel.js +++ b/src/transforms/babel.js @@ -2,8 +2,8 @@ const babel = require('babel-core'); const path = require('path'); const config = require('../utils/config'); -module.exports = async function (asset) { - if (!(await shouldTransform(asset))) { +module.exports = async function(asset) { + if (!await shouldTransform(asset)) { return; } @@ -15,7 +15,9 @@ module.exports = async function (asset) { }; if (asset.isES6Module) { - config.plugins = [require('babel-plugin-transform-es2015-modules-commonjs')]; + config.plugins = [ + require('babel-plugin-transform-es2015-modules-commonjs') + ]; } let res = babel.transformFromAst(asset.ast, asset.contents, config); @@ -38,4 +40,4 @@ async function shouldTransform(asset) { let babelrc = await config.resolve(asset.name, ['.babelrc', '.babelrc.js']); return !!babelrc; -} \ No newline at end of file +} diff --git a/src/transforms/postcss.js b/src/transforms/postcss.js index 59dbcd60561..d50e64ecb73 100644 --- a/src/transforms/postcss.js +++ b/src/transforms/postcss.js @@ -4,7 +4,7 @@ const postcss = require('postcss'); const Config = require('../utils/config'); const cssnano = require('cssnano'); -module.exports = async function (asset) { +module.exports = async function(asset) { let config = await getConfig(asset); if (!config) { return; @@ -15,10 +15,16 @@ module.exports = async function (asset) { asset.ast.css = res.css; asset.ast.dirty = false; -} +}; async function getConfig(asset) { - let config = asset.package.postcss || await Config.load(asset.name, ['.postcssrc', '.postcssrc.js', 'postcss.config.js']); + let config = + asset.package.postcss || + (await Config.load(asset.name, [ + '.postcssrc', + '.postcssrc.js', + 'postcss.config.js' + ])); if (!config && !asset.options.minify) { return; } @@ -30,14 +36,19 @@ async function getConfig(asset) { }; if (config.plugins && config.plugins['postcss-modules']) { - postcssModulesConfig = Object.assign(config.plugins['postcss-modules'], postcssModulesConfig); + postcssModulesConfig = Object.assign( + config.plugins['postcss-modules'], + postcssModulesConfig + ); delete config.plugins['postcss-modules']; } config.plugins = loadPlugins(config.plugins, asset.name); if (config.modules) { - config.plugins.push(localRequire('postcss-modules', asset.name)(postcssModulesConfig)); + config.plugins.push( + localRequire('postcss-modules', asset.name)(postcssModulesConfig) + ); } if (asset.options.minify) { diff --git a/src/transforms/posthtml.js b/src/transforms/posthtml.js index c6b7a2662b1..54bbdf93067 100644 --- a/src/transforms/posthtml.js +++ b/src/transforms/posthtml.js @@ -3,7 +3,7 @@ const posthtml = require('posthtml'); const Config = require('../utils/config'); const htmlnano = require('htmlnano'); -module.exports = async function (asset) { +module.exports = async function(asset) { let config = await getConfig(asset); if (!config) { return; @@ -14,10 +14,16 @@ module.exports = async function (asset) { asset.ast = res.tree; asset.isAstDirty = true; -} +}; async function getConfig(asset) { - let config = asset.package.posthtml || await Config.load(asset.name, ['.posthtmlrc', '.posthtmlrc.js', 'posthtml.config.js']); + let config = + asset.package.posthtml || + (await Config.load(asset.name, [ + '.posthtmlrc', + '.posthtmlrc.js', + 'posthtml.config.js' + ])); if (!config && !asset.options.minify) { return; } diff --git a/src/transforms/uglify.js b/src/transforms/uglify.js index 1ac58ea9777..c32187aa865 100644 --- a/src/transforms/uglify.js +++ b/src/transforms/uglify.js @@ -3,7 +3,7 @@ const {toEstree} = require('babel-to-estree'); const types = require('babel-types'); const walk = require('babylon-walk'); -module.exports = async function (asset) { +module.exports = async function(asset) { await asset.parseIfNeeded(); // Convert to UglifyJS AST diff --git a/src/utils/config.js b/src/utils/config.js index ea520188017..e9a9354ceb2 100644 --- a/src/utils/config.js +++ b/src/utils/config.js @@ -2,7 +2,7 @@ const fs = require('./fs'); const path = require('path'); const parseJson = require('parse-json'); -const existsCache = new Map; +const existsCache = new Map(); async function resolve(filepath, filenames, root = path.parse(filepath).root) { filepath = path.dirname(filepath); @@ -14,7 +14,9 @@ async function resolve(filepath, filenames, root = path.parse(filepath).root) { for (const filename of filenames) { let file = path.join(filepath, filename); - let exists = existsCache.has(file) ? existsCache.get(file) : await fs.exists(file); + let exists = existsCache.has(file) + ? existsCache.get(file) + : await fs.exists(file); if (exists) { existsCache.set(file, true); return file; diff --git a/src/utils/fs.js b/src/utils/fs.js index c0188f06220..f71707664b8 100644 --- a/src/utils/fs.js +++ b/src/utils/fs.js @@ -6,8 +6,8 @@ exports.readFile = promisify(fs.readFile); exports.writeFile = promisify(fs.writeFile); exports.stat = promisify(fs.stat); -exports.exists = function (filename) { - return new Promise((resolve) => { +exports.exists = function(filename) { + return new Promise(resolve => { fs.exists(filename, resolve); }); }; diff --git a/src/utils/is-url.js b/src/utils/is-url.js index aea81f9e151..f5f955c78a5 100644 --- a/src/utils/is-url.js +++ b/src/utils/is-url.js @@ -6,6 +6,6 @@ const ANCHOR_REGEXP = /^#/; // Matches scheme (ie: tel:, mailto:, data:) const SCHEME_REGEXP = /^[a-z]*\:/i; -module.exports = function (url) { +module.exports = function(url) { return isURL(url) || ANCHOR_REGEXP.test(url) || SCHEME_REGEXP.test(url); }; diff --git a/src/utils/loadPlugins.js b/src/utils/loadPlugins.js index 9c87998772b..976a22e0ed8 100644 --- a/src/utils/loadPlugins.js +++ b/src/utils/loadPlugins.js @@ -4,11 +4,13 @@ module.exports = function loadPlugins(plugins, relative) { if (Array.isArray(plugins)) { return plugins.map(p => loadPlugin(p, relative)).filter(Boolean); } else if (typeof plugins === 'object') { - return Object.keys(plugins).map(p => loadPlugin(p, relative, plugins[p])).filter(Boolean); + return Object.keys(plugins) + .map(p => loadPlugin(p, relative, plugins[p])) + .filter(Boolean); } else { return []; } -} +}; function loadPlugin(plugin, relative, options) { if (typeof plugin === 'string') { diff --git a/src/utils/localRequire.js b/src/utils/localRequire.js index 0e15c1def65..80eae41ce1f 100644 --- a/src/utils/localRequire.js +++ b/src/utils/localRequire.js @@ -1,9 +1,9 @@ const {dirname} = require('path'); const resolve = require('resolve'); -const cache = new Map; +const cache = new Map(); -module.exports = function (name, path) { +module.exports = function(name, path) { let basedir = dirname(path); let key = basedir + ':' + name; let resolved = cache.get(key); diff --git a/src/utils/md5.js b/src/utils/md5.js index aa4469631ff..9733a64c25d 100644 --- a/src/utils/md5.js +++ b/src/utils/md5.js @@ -1,7 +1,10 @@ const crypto = require('crypto'); function md5(string) { - return crypto.createHash('md5').update(string).digest('hex'); + return crypto + .createHash('md5') + .update(string) + .digest('hex'); } module.exports = md5; diff --git a/src/utils/objectHash.js b/src/utils/objectHash.js index 8f5bf444248..fb7574b59e7 100644 --- a/src/utils/objectHash.js +++ b/src/utils/objectHash.js @@ -1,6 +1,6 @@ const crypto = require('crypto'); -module.exports = function (object) { +module.exports = function(object) { let hash = crypto.createHash('md5'); for (let key of Object.keys(object).sort()) { hash.update(key + object[key]); diff --git a/src/utils/prettyError.js b/src/utils/prettyError.js index 26493afd963..909faf76ba1 100644 --- a/src/utils/prettyError.js +++ b/src/utils/prettyError.js @@ -1,4 +1,4 @@ -module.exports = function (err, opts = {}) { +module.exports = function(err, opts = {}) { let message = typeof err === 'string' ? err : err.message; if (!message) { message = 'Unknown error'; diff --git a/src/utils/promisify.js b/src/utils/promisify.js index 23f0d9e3354..ca5ed744963 100644 --- a/src/utils/promisify.js +++ b/src/utils/promisify.js @@ -2,14 +2,12 @@ module.exports = function(fn) { return function(...args) { return new Promise(function(resolve, reject) { fn(...args, function(err, ...res) { - if (err) - return reject(err); + if (err) return reject(err); - if (res.length === 1) - return resolve(res[0]); + if (res.length === 1) return resolve(res[0]); resolve(res); }); }); }; -} +}; diff --git a/src/visitors/dependencies.js b/src/visitors/dependencies.js index a19b3801e45..e2ceef71fa3 100644 --- a/src/visitors/dependencies.js +++ b/src/visitors/dependencies.js @@ -30,18 +30,20 @@ module.exports = { CallExpression(node, asset) { let {callee, arguments: args} = node; - let isRequire = types.isIdentifier(callee) - && callee.name === 'require' - && args.length === 1 - && types.isStringLiteral(args[0]); + let isRequire = + types.isIdentifier(callee) && + callee.name === 'require' && + args.length === 1 && + types.isStringLiteral(args[0]); if (isRequire) { addDependency(asset, args[0]); } - let isDynamicImport = callee.type === 'Import' - && args.length === 1 - && types.isStringLiteral(args[0]); + let isDynamicImport = + callee.type === 'Import' && + args.length === 1 && + types.isStringLiteral(args[0]); if (isDynamicImport) { asset.addDependency('_bundle_loader'); diff --git a/src/visitors/fs.js b/src/visitors/fs.js index ebeb003ce45..555e764b4f3 100644 --- a/src/visitors/fs.js +++ b/src/visitors/fs.js @@ -22,8 +22,13 @@ module.exports = { CallExpression(path, asset) { let callee = path.node.callee; if (referencesImport(path, 'fs', 'readFileSync')) { - let vars = {__dirname: Path.dirname(asset.name), __filename: asset.basename}; - let [filename, ...args] = path.get('arguments').map(arg => evaluate(arg, vars)); + let vars = { + __dirname: Path.dirname(asset.name), + __filename: asset.basename + }; + let [filename, ...args] = path + .get('arguments') + .map(arg => evaluate(arg, vars)); filename = Path.resolve(filename); let res = fs.readFileSync(filename, ...args); @@ -55,10 +60,11 @@ function isRequire(node, name, method) { } let {callee, arguments: args} = node; - let isRequire = t.isIdentifier(callee) - && callee.name === 'require' - && args.length === 1 - && t.isStringLiteral(args[0]); + let isRequire = + t.isIdentifier(callee) && + callee.name === 'require' && + args.length === 1 && + t.isStringLiteral(args[0]); if (!isRequire) { return false; @@ -87,7 +93,7 @@ function referencesImport(path, name, method) { if (t.isIdentifier(callee.object)) { bindingPath = getBindingPath(path, callee.object.name); - // require('fs').readFileSync() + // require('fs').readFileSync() } else if (isRequire(callee.object, name)) { return true; } @@ -104,14 +110,20 @@ function referencesImport(path, name, method) { // e.g. import fs from 'fs'; if (parent.isImportDeclaration()) { - if (bindingPath.isImportSpecifier() && bindingPath.node.imported.name !== method) { + if ( + bindingPath.isImportSpecifier() && + bindingPath.node.imported.name !== method + ) { return false; } return parent.node.source.value === name; - // e.g. var fs = require('fs'); - } else if (t.isVariableDeclarator(bindingNode) || t.isAssignmentExpression(bindingNode)) { + // e.g. var fs = require('fs'); + } else if ( + t.isVariableDeclarator(bindingNode) || + t.isAssignmentExpression(bindingNode) + ) { let left = bindingNode.id || bindingNode.left; let right = bindingNode.init || bindingNode.right; @@ -139,7 +151,7 @@ function getBindingPath(path, name) { function evaluate(path, vars) { // Inline variables path.traverse({ - Identifier: function (ident) { + Identifier: function(ident) { let key = ident.node.name; if (key in vars) { ident.replaceWith(t.valueToNode(vars[key])); diff --git a/src/visitors/globals.js b/src/visitors/globals.js index 72564326eae..349500febce 100644 --- a/src/visitors/globals.js +++ b/src/visitors/globals.js @@ -3,14 +3,15 @@ const Path = require('path'); const types = require('babel-types'); const VARS = { - process: (asset) => { + process: asset => { asset.addDependency('process'); return 'var process = require("process");'; }, global: () => 'var global = (1,eval)("this");', - __dirname: (asset) => `var __dirname = ${JSON.stringify(Path.dirname(asset.name))};`, - __filename: (asset) => `var __filename = ${JSON.stringify(asset.name)};`, - Buffer: (asset) => { + __dirname: asset => + `var __dirname = ${JSON.stringify(Path.dirname(asset.name))};`, + __filename: asset => `var __filename = ${JSON.stringify(asset.name)};`, + Buffer: asset => { asset.addDependency('buffer'); return 'var Buffer = require("buffer").Buffer;'; } @@ -32,7 +33,11 @@ module.exports = { Identifier(node, asset, ancestors) { let parent = ancestors[ancestors.length - 2]; - if (VARS.hasOwnProperty(node.name) && !asset.globals.has(node.name) && types.isReferenced(node, parent)) { + if ( + VARS.hasOwnProperty(node.name) && + !asset.globals.has(node.name) && + types.isReferenced(node, parent) + ) { asset.globals.set(node.name, VARS[node.name](asset)); } }, @@ -67,7 +72,7 @@ function matchesPattern(member, match) { return false; } - const parts = Array.isArray(match) ? match : match.split("."); + const parts = Array.isArray(match) ? match : match.split('.'); const nodes = []; let node; diff --git a/src/worker.js b/src/worker.js index b3521ee6365..fe898dde8eb 100644 --- a/src/worker.js +++ b/src/worker.js @@ -9,12 +9,12 @@ function emit(event, ...args) { process.send({event, args}); } -exports.init = function (options, callback) { +exports.init = function(options, callback) { parser = new Parser(options || {}); callback(); }; -exports.run = async function (path, pkg, options, callback) { +exports.run = async function(path, pkg, options, callback) { try { var asset = parser.getAsset(path, pkg, options); await asset.process(); diff --git a/test/css.js b/test/css.js index 6286d937a2b..1af4bfac0b9 100644 --- a/test/css.js +++ b/test/css.js @@ -2,18 +2,20 @@ const assert = require('assert'); const fs = require('fs'); const {bundle, run, assertBundleTree} = require('./utils'); -describe('css', function () { - it('should produce two bundles when importing a CSS file', async function () { +describe('css', function() { + it('should produce two bundles when importing a CSS file', async function() { let b = await bundle(__dirname + '/integration/css/index.js'); assertBundleTree(b, { name: 'index.js', assets: ['index.js', 'index.css', 'local.js', 'local.css'], - childBundles: [{ - name: 'index.css', - assets: ['index.css', 'local.css'], - childBundles: [] - }] + childBundles: [ + { + name: 'index.css', + assets: ['index.css', 'local.css'], + childBundles: [] + } + ] }); let output = run(b); @@ -21,25 +23,30 @@ describe('css', function () { assert.equal(output(), 3); }); - it('should support loading a CSS bundle along side dynamic imports', async function () { + it('should support loading a CSS bundle along side dynamic imports', async function() { let b = await bundle(__dirname + '/integration/dynamic-css/index.js'); assertBundleTree(b, { name: 'index.js', assets: ['index.js', 'index.css', 'bundle-loader.js', 'bundle-url.js'], - childBundles: [{ - name: 'index.css', - assets: ['index.css'], - childBundles: [] - }, { - type: 'js', - assets: ['local.js', 'local.css'], - childBundles: [{ - type: 'css', - assets: ['local.css'], + childBundles: [ + { + name: 'index.css', + assets: ['index.css'], childBundles: [] - }] - }] + }, + { + type: 'js', + assets: ['local.js', 'local.css'], + childBundles: [ + { + type: 'css', + assets: ['local.css'], + childBundles: [] + } + ] + } + ] }); let output = run(b); @@ -47,17 +54,19 @@ describe('css', function () { assert.equal(await output(), 3); }); - it('should support importing CSS from a CSS file', async function () { + it('should support importing CSS from a CSS file', async function() { let b = await bundle(__dirname + '/integration/css-import/index.js'); assertBundleTree(b, { name: 'index.js', assets: ['index.js', 'index.css', 'other.css', 'local.css'], - childBundles: [{ - name: 'index.css', - assets: ['index.css', 'other.css', 'local.css'], - childBundles: [] - }] + childBundles: [ + { + name: 'index.css', + assets: ['index.css', 'other.css', 'local.css'], + childBundles: [] + } + ] }); let output = run(b); @@ -71,21 +80,24 @@ describe('css', function () { assert(css.includes('.index')); }); - it('should support linking to assets with url() from CSS', async function () { + it('should support linking to assets with url() from CSS', async function() { let b = await bundle(__dirname + '/integration/css-url/index.js'); assertBundleTree(b, { name: 'index.js', assets: ['index.js', 'index.css'], - childBundles: [{ - name: 'index.css', - assets: ['index.css'], - childBundles: [] - }, { - type: 'woff2', - assets: ['test.woff2'], - childBundles: [] - }] + childBundles: [ + { + name: 'index.css', + assets: ['index.css'], + childBundles: [] + }, + { + type: 'woff2', + assets: ['test.woff2'], + childBundles: [] + } + ] }); let output = run(b); @@ -101,20 +113,26 @@ describe('css', function () { assert(css.includes('url(data:image/gif;base64,no-quote)')); assert(css.includes('.no-quote')); - assert(fs.existsSync(__dirname + '/dist/' + css.match(/url\("([0-9a-f]+\.woff2)"\)/)[1])); + assert( + fs.existsSync( + __dirname + '/dist/' + css.match(/url\("([0-9a-f]+\.woff2)"\)/)[1] + ) + ); }); - it('should support transforming with postcss', async function () { + it('should support transforming with postcss', async function() { let b = await bundle(__dirname + '/integration/postcss/index.js'); assertBundleTree(b, { name: 'index.js', assets: ['index.js', 'index.css'], - childBundles: [{ - name: 'index.css', - assets: ['index.css'], - childBundles: [] - }] + childBundles: [ + { + name: 'index.css', + assets: ['index.css'], + childBundles: [] + } + ] }); let output = run(b); @@ -125,8 +143,10 @@ describe('css', function () { assert(css.includes('._index_1ezyc_1')); }); - it('should minify CSS in production mode', async function () { - let b = await bundle(__dirname + '/integration/cssnano/index.js', {production: true}); + it('should minify CSS in production mode', async function() { + let b = await bundle(__dirname + '/integration/cssnano/index.js', { + production: true + }); let output = run(b); assert.equal(typeof output, 'function'); diff --git a/test/fs.js b/test/fs.js index 96e0a7a846c..a435064c724 100644 --- a/test/fs.js +++ b/test/fs.js @@ -2,52 +2,54 @@ const assert = require('assert'); const fs = require('fs'); const {bundle, run, assertBundleTree} = require('./utils'); -describe('fs', function () { - it('should inline a file as a string', async function () { +describe('fs', function() { + it('should inline a file as a string', async function() { let b = await bundle(__dirname + '/integration/fs/index.js'); let output = run(b); assert.equal(output, 'hello'); }); - it('should inline a file as a buffer', async function () { + it('should inline a file as a buffer', async function() { let b = await bundle(__dirname + '/integration/fs-buffer/index.js'); let output = run(b); assert.equal(output.constructor.name, 'Buffer'); assert.equal(output.length, 5); }); - it('should inline a file with fs require alias', async function () { + it('should inline a file with fs require alias', async function() { let b = await bundle(__dirname + '/integration/fs-alias/index.js'); let output = run(b); assert.equal(output, 'hello'); }); - it('should inline a file with fs require inline', async function () { + it('should inline a file with fs require inline', async function() { let b = await bundle(__dirname + '/integration/fs-inline/index.js'); let output = run(b); assert.equal(output, 'hello'); }); - it('should inline a file with fs require assignment', async function () { + it('should inline a file with fs require assignment', async function() { let b = await bundle(__dirname + '/integration/fs-assign/index.js'); let output = run(b); assert.equal(output, 'hello'); }); - it('should inline a file with fs require assignment alias', async function () { + it('should inline a file with fs require assignment alias', async function() { let b = await bundle(__dirname + '/integration/fs-assign-alias/index.js'); let output = run(b); assert.equal(output, 'hello'); }); - it('should inline a file with fs require destructure', async function () { + it('should inline a file with fs require destructure', async function() { let b = await bundle(__dirname + '/integration/fs-destructure/index.js'); let output = run(b); assert.equal(output, 'hello'); }); - it('should inline a file with fs require destructure assignment', async function () { - let b = await bundle(__dirname + '/integration/fs-destructure-assign/index.js'); + it('should inline a file with fs require destructure assignment', async function() { + let b = await bundle( + __dirname + '/integration/fs-destructure-assign/index.js' + ); let output = run(b); assert.equal(output, 'hello'); }); diff --git a/test/glob.js b/test/glob.js index 6f2431538a1..6c893437489 100644 --- a/test/glob.js +++ b/test/glob.js @@ -2,8 +2,8 @@ const assert = require('assert'); const fs = require('fs'); const {bundle, run, assertBundleTree} = require('./utils'); -describe('glob', function () { - it('should require a glob of files', async function () { +describe('glob', function() { + it('should require a glob of files', async function() { let b = await bundle(__dirname + '/integration/glob/index.js'); assertBundleTree(b, { @@ -17,7 +17,7 @@ describe('glob', function () { assert.equal(await output(), 3); }); - it('should require nested directories with a glob', async function () { + it('should require nested directories with a glob', async function() { let b = await bundle(__dirname + '/integration/glob-deep/index.js'); assertBundleTree(b, { @@ -31,17 +31,19 @@ describe('glob', function () { assert.equal(await output(), 13); }); - it('should support importing a glob of CSS files', async function () { + it('should support importing a glob of CSS files', async function() { let b = await bundle(__dirname + '/integration/glob-css/index.js'); assertBundleTree(b, { name: 'index.js', assets: ['index.js', 'index.css', '*.css', 'other.css', 'local.css'], - childBundles: [{ - name: 'index.css', - assets: ['index.css', 'other.css', 'local.css'], - childBundles: [] - }] + childBundles: [ + { + name: 'index.css', + assets: ['index.css', 'other.css', 'local.css'], + childBundles: [] + } + ] }); let output = run(b); diff --git a/test/hmr.js b/test/hmr.js index 69342d66499..fdaf3baba5f 100644 --- a/test/hmr.js +++ b/test/hmr.js @@ -7,13 +7,13 @@ const ncp = promisify(require('ncp')); const WebSocket = require('ws'); const parseJson = require('parse-json'); -describe('hmr', function () { +describe('hmr', function() { let b, ws; - beforeEach(function () { + beforeEach(function() { rimraf.sync(__dirname + '/input'); }); - afterEach(function () { + afterEach(function() { if (b) { b.stop(); b = null; @@ -35,7 +35,7 @@ describe('hmr', function () { return new Promise(resolve => setTimeout(resolve, ms)); } - it('should emit an HMR update for the file that changed', async function () { + it('should emit an HMR update for the file that changed', async function() { await ncp(__dirname + '/integration/commonjs', __dirname + '/input'); b = bundler(__dirname + '/input/index.js', {watch: true, hmr: true}); @@ -43,7 +43,10 @@ describe('hmr', function () { ws = new WebSocket('ws://localhost:' + b.options.hmrPort); - fs.writeFileSync(__dirname + '/input/local.js', 'exports.a = 5; exports.b = 5;'); + fs.writeFileSync( + __dirname + '/input/local.js', + 'exports.a = 5; exports.b = 5;' + ); let msg = parseJson(await nextEvent(ws, 'message')); assert.equal(msg.type, 'update'); @@ -52,7 +55,7 @@ describe('hmr', function () { assert.deepEqual(msg.assets[0].deps, {}); }); - it('should emit an HMR update for all new dependencies along with the changed file', async function () { + it('should emit an HMR update for all new dependencies along with the changed file', async function() { await ncp(__dirname + '/integration/commonjs', __dirname + '/input'); b = bundler(__dirname + '/input/index.js', {watch: true, hmr: true}); @@ -60,14 +63,17 @@ describe('hmr', function () { ws = new WebSocket('ws://localhost:' + b.options.hmrPort); - fs.writeFileSync(__dirname + '/input/local.js', 'require("fs"); exports.a = 5; exports.b = 5;'); + fs.writeFileSync( + __dirname + '/input/local.js', + 'require("fs"); exports.a = 5; exports.b = 5;' + ); let msg = parseJson(await nextEvent(ws, 'message')); assert.equal(msg.type, 'update'); assert.equal(msg.assets.length, 2); }); - it('should emit an HMR error on bundle failure', async function () { + it('should emit an HMR error on bundle failure', async function() { await ncp(__dirname + '/integration/commonjs', __dirname + '/input'); b = bundler(__dirname + '/input/index.js', {watch: true, hmr: true}); @@ -75,21 +81,33 @@ describe('hmr', function () { ws = new WebSocket('ws://localhost:' + b.options.hmrPort); - fs.writeFileSync(__dirname + '/input/local.js', 'require("fs"; exports.a = 5; exports.b = 5;'); + fs.writeFileSync( + __dirname + '/input/local.js', + 'require("fs"; exports.a = 5; exports.b = 5;' + ); let msg = JSON.parse(await nextEvent(ws, 'message')); assert.equal(msg.type, 'error'); - assert.equal(msg.error.message, __dirname + '/input/local.js:1:12: Unexpected token, expected , (1:12)'); - assert.equal(msg.error.stack, '> 1 | require("fs"; exports.a = 5; exports.b = 5;\n | ^'); + assert.equal( + msg.error.message, + __dirname + '/input/local.js:1:12: Unexpected token, expected , (1:12)' + ); + assert.equal( + msg.error.stack, + '> 1 | require("fs"; exports.a = 5; exports.b = 5;\n | ^' + ); }); - it('should emit an HMR error to new connections after a bundle failure', async function () { + it('should emit an HMR error to new connections after a bundle failure', async function() { await ncp(__dirname + '/integration/commonjs', __dirname + '/input'); b = bundler(__dirname + '/input/index.js', {watch: true, hmr: true}); let bundle = await b.bundle(); - fs.writeFileSync(__dirname + '/input/local.js', 'require("fs"; exports.a = 5; exports.b = 5;'); + fs.writeFileSync( + __dirname + '/input/local.js', + 'require("fs"; exports.a = 5; exports.b = 5;' + ); await nextEvent(b, 'buildEnd'); await sleep(50); @@ -98,7 +116,7 @@ describe('hmr', function () { assert.equal(msg.type, 'error'); }); - it('should emit an HMR error-resolved on build after error', async function () { + it('should emit an HMR error-resolved on build after error', async function() { await ncp(__dirname + '/integration/commonjs', __dirname + '/input'); b = bundler(__dirname + '/input/index.js', {watch: true, hmr: true}); @@ -106,18 +124,24 @@ describe('hmr', function () { ws = new WebSocket('ws://localhost:' + b.options.hmrPort); - fs.writeFileSync(__dirname + '/input/local.js', 'require("fs"; exports.a = 5; exports.b = 5;'); + fs.writeFileSync( + __dirname + '/input/local.js', + 'require("fs"; exports.a = 5; exports.b = 5;' + ); let msg = JSON.parse(await nextEvent(ws, 'message')); assert.equal(msg.type, 'error'); - fs.writeFileSync(__dirname + '/input/local.js', 'require("fs"); exports.a = 5; exports.b = 5;'); + fs.writeFileSync( + __dirname + '/input/local.js', + 'require("fs"); exports.a = 5; exports.b = 5;' + ); let msg2 = JSON.parse(await nextEvent(ws, 'message')); assert.equal(msg2.type, 'error-resolved'); }); - it('should accept HMR updates in the runtime', async function () { + it('should accept HMR updates in the runtime', async function() { await ncp(__dirname + '/integration/hmr', __dirname + '/input'); b = bundler(__dirname + '/input/index.js', {watch: true, hmr: true}); @@ -132,13 +156,16 @@ describe('hmr', function () { assert.deepEqual(outputs, [3]); - fs.writeFileSync(__dirname + '/input/local.js', 'exports.a = 5; exports.b = 5;'); + fs.writeFileSync( + __dirname + '/input/local.js', + 'exports.a = 5; exports.b = 5;' + ); await nextEvent(b, 'bundled'); assert.deepEqual(outputs, [3, 10]); }); - it('should call dispose and accept callbacks', async function () { + it('should call dispose and accept callbacks', async function() { await ncp(__dirname + '/integration/hmr-callbacks', __dirname + '/input'); b = bundler(__dirname + '/input/index.js', {watch: true, hmr: true}); @@ -153,13 +180,16 @@ describe('hmr', function () { assert.deepEqual(outputs, [3]); - fs.writeFileSync(__dirname + '/input/local.js', 'exports.a = 5; exports.b = 5;'); + fs.writeFileSync( + __dirname + '/input/local.js', + 'exports.a = 5; exports.b = 5;' + ); await nextEvent(b, 'bundled'); assert.deepEqual(outputs, [3, 'dispose', 10, 'accept']); }); - it('should work across bundles', async function () { + it('should work across bundles', async function() { await ncp(__dirname + '/integration/hmr-dynamic', __dirname + '/input'); b = bundler(__dirname + '/input/index.js', {watch: true, hmr: true}); @@ -175,14 +205,17 @@ describe('hmr', function () { await sleep(50); assert.deepEqual(outputs, [3]); - fs.writeFileSync(__dirname + '/input/local.js', 'exports.a = 5; exports.b = 5;'); + fs.writeFileSync( + __dirname + '/input/local.js', + 'exports.a = 5; exports.b = 5;' + ); await nextEvent(b, 'bundled'); await sleep(50); assert.deepEqual(outputs, [3, 10]); }); - it('should log emitted errors', async function () { + it('should log emitted errors', async function() { await ncp(__dirname + '/integration/commonjs', __dirname + '/input'); b = bundler(__dirname + '/input/index.js', {watch: true, hmr: true}); @@ -191,19 +224,24 @@ describe('hmr', function () { let logs = []; run(bundle, { console: { - error(msg) { logs.push(msg) }, + error(msg) { + logs.push(msg); + } } }); - fs.writeFileSync(__dirname + '/input/local.js', 'require("fs"; exports.a = 5; exports.b = 5;'); + fs.writeFileSync( + __dirname + '/input/local.js', + 'require("fs"; exports.a = 5; exports.b = 5;' + ); await nextEvent(b, 'buildEnd'); await sleep(50); - assert.equal(logs.length, 1) + assert.equal(logs.length, 1); assert(logs[0].trim().startsWith('[parcel] 🚨')); }); - it('should log when errors resolve', async function () { + it('should log when errors resolve', async function() { await ncp(__dirname + '/integration/commonjs', __dirname + '/input'); b = bundler(__dirname + '/input/index.js', {watch: true, hmr: true}); @@ -212,20 +250,30 @@ describe('hmr', function () { let logs = []; run(bundle, { console: { - error(msg) { logs.push(msg) }, - log(msg) { logs.push(msg) }, + error(msg) { + logs.push(msg); + }, + log(msg) { + logs.push(msg); + } } }); - fs.writeFileSync(__dirname + '/input/local.js', 'require("fs"; exports.a = 5; exports.b = 5;'); + fs.writeFileSync( + __dirname + '/input/local.js', + 'require("fs"; exports.a = 5; exports.b = 5;' + ); await nextEvent(b, 'buildEnd'); - fs.writeFileSync(__dirname + '/input/local.js', 'require("fs"); exports.a = 5; exports.b = 5;'); + fs.writeFileSync( + __dirname + '/input/local.js', + 'require("fs"); exports.a = 5; exports.b = 5;' + ); await nextEvent(b, 'buildEnd'); await sleep(50); - assert.equal(logs.length, 2) + assert.equal(logs.length, 2); assert(logs[0].trim().startsWith('[parcel] 🚨')); assert(logs[1].trim().startsWith('[parcel] ✨')); }); -}); \ No newline at end of file +}); diff --git a/test/html.js b/test/html.js index 87cb4e8e78d..c82fb842994 100644 --- a/test/html.js +++ b/test/html.js @@ -2,26 +2,31 @@ const assert = require('assert'); const fs = require('fs'); const {bundle, run, assertBundleTree} = require('./utils'); -describe('html', function () { - it('should support bundling HTML', async function () { +describe('html', function() { + it('should support bundling HTML', async function() { let b = await bundle(__dirname + '/integration/html/index.html'); assertBundleTree(b, { name: 'index.html', assets: ['index.html'], - childBundles: [{ - type: 'css', - assets: ['index.css'], - childBundles: [] - }, { - type: 'html', - assets: ['other.html'], - childBundles: [{ - type: 'js', - assets: ['index.js'], + childBundles: [ + { + type: 'css', + assets: ['index.css'], childBundles: [] - }] - }] + }, + { + type: 'html', + assets: ['other.html'], + childBundles: [ + { + type: 'js', + assets: ['index.js'], + childBundles: [] + } + ] + } + ] }); let files = fs.readdirSync(__dirname + '/dist'); @@ -33,7 +38,7 @@ describe('html', function () { } }); - it('should support transforming HTML with posthtml', async function () { + it('should support transforming HTML with posthtml', async function() { let b = await bundle(__dirname + '/integration/posthtml/index.html'); assertBundleTree(b, { @@ -46,64 +51,80 @@ describe('html', function () { assert(html.includes('

Other page

')); }); - it('should insert sibling CSS bundles for JS files in the HEAD', async function () { + it('should insert sibling CSS bundles for JS files in the HEAD', async function() { let b = await bundle(__dirname + '/integration/html-css/index.html'); assertBundleTree(b, { name: 'index.html', assets: ['index.html'], - childBundles: [{ - type: 'js', - assets: ['index.js', 'index.css'], - childBundles: [{ - type: 'css', - assets: ['index.css'], - childBundles: [] - }] - }] + childBundles: [ + { + type: 'js', + assets: ['index.js', 'index.css'], + childBundles: [ + { + type: 'css', + assets: ['index.css'], + childBundles: [] + } + ] + } + ] }); let html = fs.readFileSync(__dirname + '/dist/index.html'); assert(//.test(html)); }); - it('should insert a HEAD element if needed when adding CSS bundles', async function () { + it('should insert a HEAD element if needed when adding CSS bundles', async function() { let b = await bundle(__dirname + '/integration/html-css-head/index.html'); assertBundleTree(b, { name: 'index.html', assets: ['index.html'], - childBundles: [{ - type: 'js', - assets: ['index.js', 'index.css'], - childBundles: [{ - type: 'css', - assets: ['index.css'], - childBundles: [] - }] - }] + childBundles: [ + { + type: 'js', + assets: ['index.js', 'index.css'], + childBundles: [ + { + type: 'css', + assets: ['index.css'], + childBundles: [] + } + ] + } + ] }); let html = fs.readFileSync(__dirname + '/dist/index.html'); - assert(/<\/head>/.test(html)); + assert( + /<\/head>/.test( + html + ) + ); }); - it('should minify HTML in production mode', async function () { - let b = await bundle(__dirname + '/integration/htmlnano/index.html', {production: true}); + it('should minify HTML in production mode', async function() { + let b = await bundle(__dirname + '/integration/htmlnano/index.html', { + production: true + }); let css = fs.readFileSync(__dirname + '/dist/index.html', 'utf8'); assert(css.includes('Other page')); assert(!css.includes('\n')); }); - it('should not prepend the public path to assets with remote URLs', async function () { + it('should not prepend the public path to assets with remote URLs', async function() { let b = await bundle(__dirname + '/integration/html/index.html'); let html = fs.readFileSync(__dirname + '/dist/index.html', 'utf8'); - assert(html.includes('')); + assert( + html.includes('') + ); }); - it('should not prepend the public path to hash links', async function () { + it('should not prepend the public path to hash links', async function() { let b = await bundle(__dirname + '/integration/html/index.html'); let html = fs.readFileSync(__dirname + '/dist/index.html', 'utf8'); diff --git a/test/javascript.js b/test/javascript.js index 002f548acfa..fd82ea26b82 100644 --- a/test/javascript.js +++ b/test/javascript.js @@ -2,8 +2,8 @@ const assert = require('assert'); const fs = require('fs'); const {bundle, run, assertBundleTree} = require('./utils'); -describe('javascript', function () { - it('should produce a basic JS bundle with CommonJS requires', async function () { +describe('javascript', function() { + it('should produce a basic JS bundle with CommonJS requires', async function() { let b = await bundle(__dirname + '/integration/commonjs/index.js'); assert.equal(b.assets.size, 8); @@ -14,7 +14,7 @@ describe('javascript', function () { assert.equal(output(), 3); }); - it('should produce a basic JS bundle with ES6 imports', async function () { + it('should produce a basic JS bundle with ES6 imports', async function() { let b = await bundle(__dirname + '/integration/es6/index.js'); assert.equal(b.assets.size, 8); @@ -26,7 +26,7 @@ describe('javascript', function () { assert.equal(output.default(), 3); }); - it('should produce a JS bundle with default exorts and no imports', async function () { + it('should produce a JS bundle with default exorts and no imports', async function() { let b = await bundle(__dirname + '/integration/es6-default-only/index.js'); assert.equal(b.assets.size, 1); @@ -38,16 +38,18 @@ describe('javascript', function () { assert.equal(output.default(), 3); }); - it('should split bundles when a dynamic import is used', async function () { + it('should split bundles when a dynamic import is used', async function() { let b = await bundle(__dirname + '/integration/dynamic/index.js'); assertBundleTree(b, { name: 'index.js', assets: ['index.js', 'bundle-loader.js', 'bundle-url.js'], - childBundles: [{ - assets: ['local.js'], - childBundles: [] - }] + childBundles: [ + { + assets: ['local.js'], + childBundles: [] + } + ] }); let output = run(b); @@ -55,19 +57,28 @@ describe('javascript', function () { assert.equal(await output(), 3); }); - it('should hoist common dependencies into a parent bundle', async function () { + it('should hoist common dependencies into a parent bundle', async function() { let b = await bundle(__dirname + '/integration/dynamic-hoist/index.js'); assertBundleTree(b, { name: 'index.js', - assets: ['index.js', 'common.js', 'common-dep.js', 'bundle-loader.js', 'bundle-url.js'], - childBundles: [{ - assets: ['a.js'], - childBundles: [] - }, { - assets: ['b.js'], - childBundles: [] - }] + assets: [ + 'index.js', + 'common.js', + 'common-dep.js', + 'bundle-loader.js', + 'bundle-url.js' + ], + childBundles: [ + { + assets: ['a.js'], + childBundles: [] + }, + { + assets: ['b.js'], + childBundles: [] + } + ] }); let output = run(b); @@ -75,7 +86,7 @@ describe('javascript', function () { assert.equal(await output(), 7); }); - it('should support requiring JSON files', async function () { + it('should support requiring JSON files', async function() { let b = await bundle(__dirname + '/integration/json/index.js'); assertBundleTree(b, { @@ -89,17 +100,19 @@ describe('javascript', function () { assert.equal(output(), 3); }); - it('should support importing a URL to a raw asset', async function () { + it('should support importing a URL to a raw asset', async function() { let b = await bundle(__dirname + '/integration/import-raw/index.js'); assertBundleTree(b, { name: 'index.js', assets: ['index.js', 'test.txt'], - childBundles: [{ - type: 'txt', - assets: ['test.txt'], - childBundles: [] - }] + childBundles: [ + { + type: 'txt', + assets: ['test.txt'], + childBundles: [] + } + ] }); let output = run(b); @@ -108,8 +121,10 @@ describe('javascript', function () { assert(fs.existsSync(__dirname + '/dist/' + output())); }); - it('should minify JS in production mode', async function () { - let b = await bundle(__dirname + '/integration/uglify/index.js', {production: true}); + it('should minify JS in production mode', async function() { + let b = await bundle(__dirname + '/integration/uglify/index.js', { + production: true + }); let output = run(b); assert.equal(typeof output, 'function'); @@ -119,7 +134,7 @@ describe('javascript', function () { assert(!js.includes('local.a')); }); - it('should insert global variables when needed', async function () { + it('should insert global variables when needed', async function() { let b = await bundle(__dirname + '/integration/globals/index.js'); let output = run(b); @@ -131,14 +146,14 @@ describe('javascript', function () { }); }); - it('should insert environment variables', async function () { + it('should insert environment variables', async function() { let b = await bundle(__dirname + '/integration/env/index.js'); let output = run(b); assert.equal(output(), 'test'); }); - it('should support adding implicit dependencies', async function () { + it('should support adding implicit dependencies', async function() { let b = await bundle(__dirname + '/integration/json/index.js', { delegate: { getImplicitDependencies(asset) { @@ -152,10 +167,12 @@ describe('javascript', function () { assertBundleTree(b, { name: 'index.js', assets: ['index.js', 'local.json', 'index.css'], - childBundles: [{ - type: 'css', - assets: ['index.css'] - }] + childBundles: [ + { + type: 'css', + assets: ['index.css'] + } + ] }); let output = run(b); @@ -163,7 +180,7 @@ describe('javascript', function () { assert.equal(output(), 3); }); - it('should support requiring YAML files', async function () { + it('should support requiring YAML files', async function() { let b = await bundle(__dirname + '/integration/yaml/index.js'); assertBundleTree(b, { diff --git a/test/less.js b/test/less.js index ea29af48c16..d987ba76fa6 100644 --- a/test/less.js +++ b/test/less.js @@ -2,18 +2,20 @@ const assert = require('assert'); const fs = require('fs'); const {bundle, run, assertBundleTree} = require('./utils'); -describe('less', function () { - it('should support requiring less files', async function () { +describe('less', function() { + it('should support requiring less files', async function() { let b = await bundle(__dirname + '/integration/less/index.js'); assertBundleTree(b, { name: 'index.js', assets: ['index.js', 'index.less'], - childBundles: [{ - name: 'index.css', - assets: ['index.less'], - childBundles: [] - }] + childBundles: [ + { + name: 'index.css', + assets: ['index.less'], + childBundles: [] + } + ] }); let output = run(b); @@ -24,17 +26,19 @@ describe('less', function () { assert(css.includes('.index')); }); - it('should support less imports', async function () { + it('should support less imports', async function() { let b = await bundle(__dirname + '/integration/less-import/index.js'); assertBundleTree(b, { name: 'index.js', assets: ['index.js', 'index.less'], - childBundles: [{ - name: 'index.css', - assets: ['index.less'], - childBundles: [] - }] + childBundles: [ + { + name: 'index.css', + assets: ['index.less'], + childBundles: [] + } + ] }); let output = run(b); @@ -46,21 +50,24 @@ describe('less', function () { assert(css.includes('.base')); }); - it('should support linking to assets with url() from less', async function () { + it('should support linking to assets with url() from less', async function() { let b = await bundle(__dirname + '/integration/less-url/index.js'); assertBundleTree(b, { name: 'index.js', assets: ['index.js', 'index.less'], - childBundles: [{ - name: 'index.css', - assets: ['index.less'], - childBundles: [] - }, { - type: 'woff2', - assets: ['test.woff2'], - childBundles: [] - }] + childBundles: [ + { + name: 'index.css', + assets: ['index.less'], + childBundles: [] + }, + { + type: 'woff2', + assets: ['test.woff2'], + childBundles: [] + } + ] }); let output = run(b); @@ -72,20 +79,26 @@ describe('less', function () { assert(css.includes('url("http://google.com")')); assert(css.includes('.index')); - assert(fs.existsSync(__dirname + '/dist/' + css.match(/url\("([0-9a-f]+\.woff2)"\)/)[1])); + assert( + fs.existsSync( + __dirname + '/dist/' + css.match(/url\("([0-9a-f]+\.woff2)"\)/)[1] + ) + ); }); - it('should support transforming less with postcss', async function () { + it('should support transforming less with postcss', async function() { let b = await bundle(__dirname + '/integration/less-postcss/index.js'); assertBundleTree(b, { name: 'index.js', assets: ['index.js', 'index.less'], - childBundles: [{ - name: 'index.css', - assets: ['index.less'], - childBundles: [] - }] + childBundles: [ + { + name: 'index.css', + assets: ['index.less'], + childBundles: [] + } + ] }); let output = run(b); diff --git a/test/plugins.js b/test/plugins.js index 00e217cb1a2..4c6e89a6475 100644 --- a/test/plugins.js +++ b/test/plugins.js @@ -1,8 +1,8 @@ const assert = require('assert'); const {bundle, run, assertBundleTree} = require('./utils'); -describe('plugins', function () { - it('should load plugins and apply custom asset type', async function () { +describe('plugins', function() { + it('should load plugins and apply custom asset type', async function() { let b = await bundle(__dirname + '/integration/plugins/index.js'); assertBundleTree(b, { diff --git a/test/sass.js b/test/sass.js index f52bce47f3c..91e1ff2724a 100644 --- a/test/sass.js +++ b/test/sass.js @@ -2,18 +2,20 @@ const assert = require('assert'); const fs = require('fs'); const {bundle, run, assertBundleTree} = require('./utils'); -describe('sass', function () { - it('should support requiring sass files', async function () { +describe('sass', function() { + it('should support requiring sass files', async function() { let b = await bundle(__dirname + '/integration/sass/index.js'); assertBundleTree(b, { name: 'index.js', assets: ['index.js', 'index.sass'], - childBundles: [{ - name: 'index.css', - assets: ['index.sass'], - childBundles: [] - }] + childBundles: [ + { + name: 'index.css', + assets: ['index.sass'], + childBundles: [] + } + ] }); let output = run(b); @@ -24,17 +26,19 @@ describe('sass', function () { assert(css.includes('.index')); }); - it('should support requiring scss files', async function () { + it('should support requiring scss files', async function() { let b = await bundle(__dirname + '/integration/scss/index.js'); assertBundleTree(b, { name: 'index.js', assets: ['index.js', 'index.scss'], - childBundles: [{ - name: 'index.css', - assets: ['index.scss'], - childBundles: [] - }] + childBundles: [ + { + name: 'index.css', + assets: ['index.scss'], + childBundles: [] + } + ] }); let output = run(b); @@ -45,17 +49,19 @@ describe('sass', function () { assert(css.includes('.index')); }); - it('should support scss imports', async function () { + it('should support scss imports', async function() { let b = await bundle(__dirname + '/integration/scss-import/index.js'); assertBundleTree(b, { name: 'index.js', assets: ['index.js', 'index.scss'], - childBundles: [{ - name: 'index.css', - assets: ['index.scss'], - childBundles: [] - }] + childBundles: [ + { + name: 'index.css', + assets: ['index.scss'], + childBundles: [] + } + ] }); let output = run(b); @@ -67,21 +73,24 @@ describe('sass', function () { assert(css.includes('.base')); }); - it('should support linking to assets with url() from scss', async function () { + it('should support linking to assets with url() from scss', async function() { let b = await bundle(__dirname + '/integration/scss-url/index.js'); assertBundleTree(b, { name: 'index.js', assets: ['index.js', 'index.scss'], - childBundles: [{ - name: 'index.css', - assets: ['index.scss'], - childBundles: [] - }, { - type: 'woff2', - assets: ['test.woff2'], - childBundles: [] - }] + childBundles: [ + { + name: 'index.css', + assets: ['index.scss'], + childBundles: [] + }, + { + type: 'woff2', + assets: ['test.woff2'], + childBundles: [] + } + ] }); let output = run(b); @@ -93,20 +102,26 @@ describe('sass', function () { assert(css.includes('url("http://google.com")')); assert(css.includes('.index')); - assert(fs.existsSync(__dirname + '/dist/' + css.match(/url\("([0-9a-f]+\.woff2)"\)/)[1])); + assert( + fs.existsSync( + __dirname + '/dist/' + css.match(/url\("([0-9a-f]+\.woff2)"\)/)[1] + ) + ); }); - it('should support transforming scss with postcss', async function () { + it('should support transforming scss with postcss', async function() { let b = await bundle(__dirname + '/integration/scss-postcss/index.js'); assertBundleTree(b, { name: 'index.js', assets: ['index.js', 'index.scss'], - childBundles: [{ - name: 'index.css', - assets: ['index.scss'], - childBundles: [] - }] + childBundles: [ + { + name: 'index.css', + assets: ['index.scss'], + childBundles: [] + } + ] }); let output = run(b); diff --git a/test/server.js b/test/server.js index 8d14eb8a62e..d8a04a478b7 100644 --- a/test/server.js +++ b/test/server.js @@ -3,9 +3,9 @@ const fs = require('fs'); const {bundler, run, assertBundleTree} = require('./utils'); const http = require('http'); -describe('server', function () { +describe('server', function() { let server; - afterEach(function () { + afterEach(function() { if (server) { server.close(); server = null; @@ -21,7 +21,7 @@ describe('server', function () { res.setEncoding('utf8'); let data = ''; - res.on('data', c => data += c); + res.on('data', c => (data += c)); res.on('end', () => { resolve(data); }); @@ -29,7 +29,7 @@ describe('server', function () { }); } - it('should serve files', async function () { + it('should serve files', async function() { let b = bundler(__dirname + '/integration/commonjs/index.js'); server = b.serve(0); @@ -37,7 +37,7 @@ describe('server', function () { assert.equal(data, fs.readFileSync(__dirname + '/dist/index.js', 'utf8')); }); - it('should serve a default page if the main bundle is an HTML asset', async function () { + it('should serve a default page if the main bundle is an HTML asset', async function() { let b = bundler(__dirname + '/integration/html/index.html'); server = b.serve(0); @@ -48,7 +48,7 @@ describe('server', function () { assert.equal(data, fs.readFileSync(__dirname + '/dist/index.html', 'utf8')); }); - it('should serve a 404 if the file does not exist', async function () { + it('should serve a 404 if the file does not exist', async function() { let b = bundler(__dirname + '/integration/commonjs/index.js'); server = b.serve(0); @@ -62,19 +62,19 @@ describe('server', function () { assert(threw); }); - it('should serve a 500 if the bundler errored', async function () { + it('should serve a 500 if the bundler errored', async function() { let b = bundler(__dirname + '/integration/html/index.html'); server = b.serve(0); - + b.errored = true; - + try { await get('/'); - throw new Error('GET / responded with 200') + throw new Error('GET / responded with 200'); } catch (err) { assert.equal(err.message, 'Request failed: 500'); } - + b.errored = false; await get('/'); }); diff --git a/test/stylus.js b/test/stylus.js index 9c263ef6a4a..82546a6fdb5 100644 --- a/test/stylus.js +++ b/test/stylus.js @@ -2,18 +2,20 @@ const assert = require('assert'); const fs = require('fs'); const {bundle, run, assertBundleTree} = require('./utils'); -describe('stylus', function () { - it('should support requiring stylus files', async function () { +describe('stylus', function() { + it('should support requiring stylus files', async function() { let b = await bundle(__dirname + '/integration/stylus/index.js'); assertBundleTree(b, { name: 'index.js', assets: ['index.js', 'index.styl'], - childBundles: [{ - name: 'index.css', - assets: ['index.styl'], - childBundles: [] - }] + childBundles: [ + { + name: 'index.css', + assets: ['index.styl'], + childBundles: [] + } + ] }); let output = run(b); @@ -24,7 +26,7 @@ describe('stylus', function () { assert(css.includes('.index')); }); - it('should support requiring stylus files with dependencies', async function () { + it('should support requiring stylus files with dependencies', async function() { let b = await bundle(__dirname + '/integration/stylus-deps/index.js'); // a.styl shouldn't be included as a dependency that we can see. @@ -32,11 +34,13 @@ describe('stylus', function () { assertBundleTree(b, { name: 'index.js', assets: ['index.js', 'index.styl'], - childBundles: [{ - name: 'index.css', - assets: ['index.styl'], - childBundles: [] - }] + childBundles: [ + { + name: 'index.css', + assets: ['index.styl'], + childBundles: [] + } + ] }); let output = run(b); @@ -49,21 +53,24 @@ describe('stylus', function () { assert(css.includes('-webkit-box')); }); - it('should support linking to assets with url() from stylus', async function () { + it('should support linking to assets with url() from stylus', async function() { let b = await bundle(__dirname + '/integration/stylus-url/index.js'); assertBundleTree(b, { name: 'index.js', assets: ['index.js', 'index.styl'], - childBundles: [{ - name: 'index.css', - assets: ['index.styl'], - childBundles: [] - }, { - type: 'woff2', - assets: ['test.woff2'], - childBundles: [] - }] + childBundles: [ + { + name: 'index.css', + assets: ['index.styl'], + childBundles: [] + }, + { + type: 'woff2', + assets: ['test.woff2'], + childBundles: [] + } + ] }); let output = run(b); @@ -75,20 +82,26 @@ describe('stylus', function () { assert(css.includes('url("http://google.com")')); assert(css.includes('.index')); - assert(fs.existsSync(__dirname + '/dist/' + css.match(/url\("([0-9a-f]+\.woff2)"\)/)[1])); + assert( + fs.existsSync( + __dirname + '/dist/' + css.match(/url\("([0-9a-f]+\.woff2)"\)/)[1] + ) + ); }); - it('should support transforming stylus with postcss', async function () { + it('should support transforming stylus with postcss', async function() { let b = await bundle(__dirname + '/integration/stylus-postcss/index.js'); assertBundleTree(b, { name: 'index.js', assets: ['index.js', 'index.styl'], - childBundles: [{ - name: 'index.css', - assets: ['index.styl'], - childBundles: [] - }] + childBundles: [ + { + name: 'index.css', + assets: ['index.styl'], + childBundles: [] + } + ] }); let output = run(b); diff --git a/test/typescript.js b/test/typescript.js index 01c595b9260..a9ad60e8140 100644 --- a/test/typescript.js +++ b/test/typescript.js @@ -2,8 +2,8 @@ const assert = require('assert'); const fs = require('fs'); const {bundle, run, assertBundleTree} = require('./utils'); -describe('typescript', function () { - it('should produce a ts bundle using ES6 imports', async function () { +describe('typescript', function() { + it('should produce a ts bundle using ES6 imports', async function() { let b = await bundle(__dirname + '/integration/typescript/index.ts'); assert.equal(b.assets.size, 2); @@ -14,8 +14,10 @@ describe('typescript', function () { assert.equal(output.count(), 3); }); - it('should produce a ts bundle using commonJS require', async function () { - let b = await bundle(__dirname + '/integration/typescript-require/index.ts'); + it('should produce a ts bundle using commonJS require', async function() { + let b = await bundle( + __dirname + '/integration/typescript-require/index.ts' + ); assert.equal(b.assets.size, 2); assert.equal(b.childBundles.size, 0); @@ -25,7 +27,7 @@ describe('typescript', function () { assert.equal(output.count(), 3); }); - it('should support json require', async function () { + it('should support json require', async function() { let b = await bundle(__dirname + '/integration/typescript-json/index.ts'); assert.equal(b.assets.size, 2); @@ -36,7 +38,7 @@ describe('typescript', function () { assert.equal(output.count(), 3); }); - it('should support env variables', async function () { + it('should support env variables', async function() { let b = await bundle(__dirname + '/integration/typescript-env/index.ts'); assert.equal(b.assets.size, 1); @@ -47,17 +49,19 @@ describe('typescript', function () { assert.equal(output.env(), 'test'); }); - it('should support importing a URL to a raw asset', async function () { + it('should support importing a URL to a raw asset', async function() { let b = await bundle(__dirname + '/integration/typescript-raw/index.ts'); assertBundleTree(b, { name: 'index.js', assets: ['index.ts', 'test.txt'], - childBundles: [{ - type: 'txt', - assets: ['test.txt'], - childBundles: [] - }] + childBundles: [ + { + type: 'txt', + assets: ['test.txt'], + childBundles: [] + } + ] }); let output = run(b); @@ -66,8 +70,11 @@ describe('typescript', function () { assert(fs.existsSync(__dirname + '/dist/' + output.getRaw())); }); - it('should minify in production mode', async function () { - let b = await bundle(__dirname + '/integration/typescript-require/index.ts', { production: true }); + it('should minify in production mode', async function() { + let b = await bundle( + __dirname + '/integration/typescript-require/index.ts', + {production: true} + ); assert.equal(b.assets.size, 2); assert.equal(b.childBundles.size, 0); @@ -80,7 +87,7 @@ describe('typescript', function () { assert(!js.includes('local.a')); }); - it('should support loading tsconfig.json', async function () { + it('should support loading tsconfig.json', async function() { let b = await bundle(__dirname + '/integration/typescript-config/index.ts'); let output = run(b); diff --git a/test/utils.js b/test/utils.js index d1d45e9dcbe..87bab9b7779 100644 --- a/test/utils.js +++ b/test/utils.js @@ -6,19 +6,25 @@ const fs = require('fs'); const path = require('path'); const WebSocket = require('ws'); -beforeEach(function () { +beforeEach(function() { rimraf.sync(path.join(__dirname, 'dist')); }); function bundler(file, opts) { - return new Bundler(file, Object.assign({ - outDir: path.join(__dirname, 'dist'), - watch: false, - cache: false, - killWorkers: false, - hmr: false, - logLevel: 0 - }, opts)); + return new Bundler( + file, + Object.assign( + { + outDir: path.join(__dirname, 'dist'), + watch: false, + cache: false, + killWorkers: false, + hmr: false, + logLevel: 0 + }, + opts + ) + ); } function bundle(file, opts) { @@ -33,25 +39,33 @@ function run(bundle, globals) { }, getElementsByTagName() { - return [{ - appendChild(el) { - setTimeout(function () { - if (el.tag === 'script') { - vm.runInContext(fs.readFileSync(path.join(__dirname, 'dist', el.src)), ctx); - } + return [ + { + appendChild(el) { + setTimeout(function() { + if (el.tag === 'script') { + vm.runInContext( + fs.readFileSync(path.join(__dirname, 'dist', el.src)), + ctx + ); + } - el.onload(); - }, 0); + el.onload(); + }, 0); + } } - }] + ]; } }; - var ctx = Object.assign({ - document: fakeDocument, - WebSocket, - console - }, globals); + var ctx = Object.assign( + { + document: fakeDocument, + WebSocket, + console + }, + globals + ); vm.createContext(ctx); vm.runInContext(fs.readFileSync(bundle.name), ctx); @@ -68,11 +82,22 @@ function assertBundleTree(bundle, tree) { } if (tree.assets) { - assert.deepEqual(Array.from(bundle.assets).map(a => a.basename).sort(), tree.assets.sort()); + assert.deepEqual( + Array.from(bundle.assets) + .map(a => a.basename) + .sort(), + tree.assets.sort() + ); } if (tree.childBundles) { - let children = Array.from(bundle.childBundles).sort((a, b) => Array.from(a.assets).sort()[0].basename < Array.from(b.assets).sort()[0].basename ? -1 : 1); + let children = Array.from(bundle.childBundles).sort( + (a, b) => + Array.from(a.assets).sort()[0].basename < + Array.from(b.assets).sort()[0].basename + ? -1 + : 1 + ); assert.equal(bundle.childBundles.size, tree.childBundles.length); tree.childBundles.forEach((b, i) => assertBundleTree(children[i], b)); } diff --git a/test/watcher.js b/test/watcher.js index bf141f8e739..944feac8627 100644 --- a/test/watcher.js +++ b/test/watcher.js @@ -5,13 +5,13 @@ const rimraf = require('rimraf'); const promisify = require('../src/utils/promisify'); const ncp = promisify(require('ncp')); -describe('watcher', function () { +describe('watcher', function() { let b; - beforeEach(function () { + beforeEach(function() { rimraf.sync(__dirname + '/input'); }); - afterEach(function () { + afterEach(function() { if (b) { b.stop(); } @@ -27,7 +27,7 @@ describe('watcher', function () { return new Promise(resolve => setTimeout(resolve, ms)); } - it('should rebuild on file change', async function () { + it('should rebuild on file change', async function() { await ncp(__dirname + '/integration/commonjs', __dirname + '/input'); b = bundler(__dirname + '/input/index.js', {watch: true}); @@ -35,14 +35,17 @@ describe('watcher', function () { let output = run(bundle); assert.equal(output(), 3); - fs.writeFileSync(__dirname + '/input/local.js', 'exports.a = 5; exports.b = 5;'); + fs.writeFileSync( + __dirname + '/input/local.js', + 'exports.a = 5; exports.b = 5;' + ); bundle = await nextBundle(b); output = run(bundle); assert.equal(output(), 10); }); - it('should re-generate bundle tree when files change', async function () { + it('should re-generate bundle tree when files change', async function() { await ncp(__dirname + '/integration/dynamic-hoist', __dirname + '/input'); b = bundler(__dirname + '/input/index.js', {watch: true}); @@ -50,14 +53,23 @@ describe('watcher', function () { assertBundleTree(bundle, { name: 'index.js', - assets: ['index.js', 'common.js', 'common-dep.js', 'bundle-loader.js', 'bundle-url.js'], - childBundles: [{ - assets: ['a.js'], - childBundles: [] - }, { - assets: ['b.js'], - childBundles: [] - }] + assets: [ + 'index.js', + 'common.js', + 'common-dep.js', + 'bundle-loader.js', + 'bundle-url.js' + ], + childBundles: [ + { + assets: ['a.js'], + childBundles: [] + }, + { + assets: ['b.js'], + childBundles: [] + } + ] }); let output = run(bundle); @@ -71,50 +83,73 @@ describe('watcher', function () { assertBundleTree(bundle, { name: 'index.js', assets: ['index.js', 'bundle-loader.js', 'bundle-url.js'], - childBundles: [{ - assets: ['a.js', 'common.js', 'common-dep.js'], - childBundles: [] - }, { - assets: ['b.js'], - childBundles: [] - }] + childBundles: [ + { + assets: ['a.js', 'common.js', 'common-dep.js'], + childBundles: [] + }, + { + assets: ['b.js'], + childBundles: [] + } + ] }); output = run(bundle); assert.equal(await output(), 8); }); - it('should only re-package bundles that changed', async function () { + it('should only re-package bundles that changed', async function() { await ncp(__dirname + '/integration/dynamic-hoist', __dirname + '/input'); b = bundler(__dirname + '/input/index.js', {watch: true}); let bundle = await b.bundle(); - let mtimes = fs.readdirSync(__dirname + '/dist').map(f => fs.statSync(__dirname + '/dist/' + f).mtime.getTime() / 1000 | 0); + let mtimes = fs + .readdirSync(__dirname + '/dist') + .map( + f => (fs.statSync(__dirname + '/dist/' + f).mtime.getTime() / 1000) | 0 + ); await sleep(1000); // mtime only has second level precision - fs.writeFileSync(__dirname + '/input/b.js', 'module.exports = require("./common")'); + fs.writeFileSync( + __dirname + '/input/b.js', + 'module.exports = require("./common")' + ); bundle = await nextBundle(b); - let newMtimes = fs.readdirSync(__dirname + '/dist').map(f => fs.statSync(__dirname + '/dist/' + f).mtime.getTime() / 1000 | 0); + let newMtimes = fs + .readdirSync(__dirname + '/dist') + .map( + f => (fs.statSync(__dirname + '/dist/' + f).mtime.getTime() / 1000) | 0 + ); assert.deepEqual(mtimes.sort().slice(0, 2), newMtimes.sort().slice(0, 2)); assert.notEqual(mtimes[mtimes.length - 1], newMtimes[newMtimes.length - 1]); }); - it('should unload assets that are orphaned', async function () { + it('should unload assets that are orphaned', async function() { await ncp(__dirname + '/integration/dynamic-hoist', __dirname + '/input'); b = bundler(__dirname + '/input/index.js', {watch: true}); let bundle = await b.bundle(); assertBundleTree(bundle, { name: 'index.js', - assets: ['index.js', 'common.js', 'common-dep.js', 'bundle-loader.js', 'bundle-url.js'], - childBundles: [{ - assets: ['a.js'], - childBundles: [] - }, { - assets: ['b.js'], - childBundles: [] - }] + assets: [ + 'index.js', + 'common.js', + 'common-dep.js', + 'bundle-loader.js', + 'bundle-url.js' + ], + childBundles: [ + { + assets: ['a.js'], + childBundles: [] + }, + { + assets: ['b.js'], + childBundles: [] + } + ] }); let output = run(bundle); @@ -129,13 +164,16 @@ describe('watcher', function () { assertBundleTree(bundle, { name: 'index.js', assets: ['index.js', 'common.js', 'bundle-loader.js', 'bundle-url.js'], - childBundles: [{ - assets: ['a.js'], - childBundles: [] - }, { - assets: ['b.js'], - childBundles: [] - }] + childBundles: [ + { + assets: ['a.js'], + childBundles: [] + }, + { + assets: ['b.js'], + childBundles: [] + } + ] }); output = run(bundle); diff --git a/yarn.lock b/yarn.lock index 5f44f8619de..782d0b2ecb1 100644 --- a/yarn.lock +++ b/yarn.lock @@ -38,6 +38,10 @@ amdefine@>=0.0.4: version "1.0.1" resolved "https://registry.yarnpkg.com/amdefine/-/amdefine-1.0.1.tgz#4a5282ac164729e93619bcfd3ad151f817ce91f5" +ansi-escapes@^1.0.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-1.4.0.tgz#d3a8a83b319aa67793662b13e761c7911422306e" + ansi-regex@^2.0.0: version "2.1.1" resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-2.1.1.tgz#c3b33ab5ee360d86e0e628f0468ae7ef27d654df" @@ -50,12 +54,16 @@ ansi-styles@^2.2.1: version "2.2.1" resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-2.2.1.tgz#b432dd3358b634cf75e1e4664368240533c1ddbe" -ansi-styles@^3.1.0: +ansi-styles@^3.1.0, ansi-styles@^3.2.0: version "3.2.0" resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-3.2.0.tgz#c159b8d5be0f9e5a6f346dab94f16ce022161b88" dependencies: color-convert "^1.9.0" +any-observable@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/any-observable/-/any-observable-0.2.0.tgz#c67870058003579009083f54ac0abafb5c33d242" + anymatch@^1.3.0: version "1.3.2" resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-1.3.2.tgz#553dcb8f91e3c889845dfdba34c77721b90b9d7a" @@ -63,6 +71,10 @@ anymatch@^1.3.0: micromatch "^2.1.5" normalize-path "^2.0.0" +app-root-path@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/app-root-path/-/app-root-path-2.0.1.tgz#cd62dcf8e4fd5a417efc664d2e5b10653c651b46" + append-transform@^0.4.0: version "0.4.0" resolved "https://registry.yarnpkg.com/append-transform/-/append-transform-0.4.0.tgz#d76ebf8ca94d276e247a36bad44a4b74ab611991" @@ -978,7 +990,7 @@ center-align@^0.1.1: align-text "^0.1.3" lazy-cache "^1.0.3" -chalk@^1.1.1, chalk@^1.1.3: +chalk@^1.0.0, chalk@^1.1.1, chalk@^1.1.3: version "1.1.3" resolved "https://registry.yarnpkg.com/chalk/-/chalk-1.1.3.tgz#a8115c55e4a702fe4d150abd3872822a7e09fc98" dependencies: @@ -988,7 +1000,7 @@ chalk@^1.1.1, chalk@^1.1.3: strip-ansi "^3.0.0" supports-color "^2.0.0" -chalk@^2.1.0, chalk@^2.3.0: +chalk@^2.0.1, chalk@^2.1.0, chalk@^2.3.0: version "2.3.0" resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.3.0.tgz#b5ea48efc9c1793dccc9b4767c93914d3f2d52ba" dependencies: @@ -1011,6 +1023,10 @@ chokidar@^1.6.1, chokidar@^1.7.0: optionalDependencies: fsevents "^1.0.0" +ci-info@^1.0.0: + version "1.1.2" + resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-1.1.2.tgz#03561259db48d0474c8bdc90f5b47b068b6bbfb4" + cipher-base@^1.0.0, cipher-base@^1.0.1, cipher-base@^1.0.3: version "1.0.4" resolved "https://registry.yarnpkg.com/cipher-base/-/cipher-base-1.0.4.tgz#8760e4ecc272f4c363532f926d874aae2c1397de" @@ -1034,6 +1050,23 @@ class-utils@^0.3.5: lazy-cache "^2.0.2" static-extend "^0.1.1" +cli-cursor@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/cli-cursor/-/cli-cursor-1.0.2.tgz#64da3f7d56a54412e59794bd62dc35295e8f2987" + dependencies: + restore-cursor "^1.0.1" + +cli-spinners@^0.1.2: + version "0.1.2" + resolved "https://registry.yarnpkg.com/cli-spinners/-/cli-spinners-0.1.2.tgz#bb764d88e185fb9e1e6a2a1f19772318f605e31c" + +cli-truncate@^0.2.1: + version "0.2.1" + resolved "https://registry.yarnpkg.com/cli-truncate/-/cli-truncate-0.2.1.tgz#9f15cfbb0705005369216c626ac7d05ab90dd574" + dependencies: + slice-ansi "0.0.4" + string-width "^1.0.1" + cliui@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/cliui/-/cliui-2.1.0.tgz#4b475760ff80264c762c3a1719032e91c7fea0d1" @@ -1169,6 +1202,15 @@ core-util-is@1.0.2, core-util-is@~1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7" +cosmiconfig@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/cosmiconfig/-/cosmiconfig-3.1.0.tgz#640a94bf9847f321800403cd273af60665c73397" + dependencies: + is-directory "^0.3.1" + js-yaml "^3.9.0" + parse-json "^3.0.0" + require-from-string "^2.0.1" + create-ecdh@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/create-ecdh/-/create-ecdh-4.0.0.tgz#888c723596cdf7612f6498233eebd7a35301737d" @@ -1340,6 +1382,10 @@ dashdash@^1.12.0: dependencies: assert-plus "^1.0.0" +date-fns@^1.27.2: + version "1.29.0" + resolved "https://registry.yarnpkg.com/date-fns/-/date-fns-1.29.0.tgz#12e609cdcb935127311d04d33334e2960a2a54e6" + date-now@^0.1.4: version "0.1.4" resolved "https://registry.yarnpkg.com/date-now/-/date-now-0.1.4.tgz#eaf439fd4d4848ad74e5cc7dbef200672b9e345b" @@ -1374,6 +1420,10 @@ decode-uri-component@^0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/decode-uri-component/-/decode-uri-component-0.2.0.tgz#eb3913333458775cb84cd1a1fae062106bb87545" +dedent@^0.7.0: + version "0.7.0" + resolved "https://registry.yarnpkg.com/dedent/-/dedent-0.7.0.tgz#2495ddbaf6eb874abb0e1be9df22d2e5a544326c" + deep-extend@~0.4.0: version "0.4.2" resolved "https://registry.yarnpkg.com/deep-extend/-/deep-extend-0.4.2.tgz#48b699c27e334bf89f10892be432f6e4c7d34a7f" @@ -1491,6 +1541,10 @@ electron-to-chromium@^1.2.7, electron-to-chromium@^1.3.27: version "1.3.28" resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.28.tgz#8dd4e6458086644e9f9f0a1cf32e2a1f9dffd9ee" +elegant-spinner@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/elegant-spinner/-/elegant-spinner-1.0.1.tgz#db043521c95d7e303fd8f345bedc3349cfb0729e" + elliptic@^6.0.0: version "6.4.0" resolved "https://registry.yarnpkg.com/elliptic/-/elliptic-6.4.0.tgz#cac9af8762c85836187003c8dfe193e5e2eae5df" @@ -1574,6 +1628,22 @@ execa@^0.7.0: signal-exit "^3.0.0" strip-eof "^1.0.0" +execa@^0.8.0: + version "0.8.0" + resolved "https://registry.yarnpkg.com/execa/-/execa-0.8.0.tgz#d8d76bbc1b55217ed190fd6dd49d3c774ecfc8da" + dependencies: + cross-spawn "^5.0.1" + get-stream "^3.0.0" + is-stream "^1.1.0" + npm-run-path "^2.0.0" + p-finally "^1.0.0" + signal-exit "^3.0.0" + strip-eof "^1.0.0" + +exit-hook@^1.0.0: + version "1.1.1" + resolved "https://registry.yarnpkg.com/exit-hook/-/exit-hook-1.1.1.tgz#f05ca233b48c05d54fff07765df8507e95c02ff8" + expand-brackets@^0.1.4: version "0.1.5" resolved "https://registry.yarnpkg.com/expand-brackets/-/expand-brackets-0.1.5.tgz#df07284e342a807cd733ac5af72411e581d1177b" @@ -1653,6 +1723,13 @@ fastparse@^1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/fastparse/-/fastparse-1.1.1.tgz#d1e2643b38a94d7583b479060e6c4affc94071f8" +figures@^1.7.0: + version "1.7.0" + resolved "https://registry.yarnpkg.com/figures/-/figures-1.7.0.tgz#cbe1e3affcf1cd44b80cadfed28dc793a9701d2e" + dependencies: + escape-string-regexp "^1.0.5" + object-assign "^4.1.0" + filename-regex@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/filename-regex/-/filename-regex-2.0.1.tgz#c1c4b9bee3e09725ddb106b75c1e301fe2f18b26" @@ -1684,6 +1761,10 @@ find-cache-dir@^0.1.1: mkdirp "^0.5.1" pkg-dir "^1.0.0" +find-parent-dir@^0.3.0: + version "0.3.0" + resolved "https://registry.yarnpkg.com/find-parent-dir/-/find-parent-dir-0.3.0.tgz#33c44b429ab2b2f0646299c5f9f718f376ff8d54" + find-up@^1.0.0: version "1.1.2" resolved "https://registry.yarnpkg.com/find-up/-/find-up-1.1.2.tgz#6b2e9822b1a2ce0a60ab64d610eccad53cb24d0f" @@ -1823,6 +1904,10 @@ get-caller-file@^1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-1.0.2.tgz#f702e63127e7e231c160a80c1554acb70d5047e5" +get-own-enumerable-property-symbols@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/get-own-enumerable-property-symbols/-/get-own-enumerable-property-symbols-2.0.1.tgz#5c4ad87f2834c4b9b4e84549dc1e0650fb38c24b" + get-stdin@^4.0.1: version "4.0.1" resolved "https://registry.yarnpkg.com/get-stdin/-/get-stdin-4.0.1.tgz#b968c6b0a04384324902e8bf1a5df32579a450fe" @@ -2137,6 +2222,14 @@ https-browserify@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/https-browserify/-/https-browserify-1.0.0.tgz#ec06c10e0a34c0f2faf199f7fd7fc78fffd03c73" +husky@^0.14.3: + version "0.14.3" + resolved "https://registry.yarnpkg.com/husky/-/husky-0.14.3.tgz#c69ed74e2d2779769a17ba8399b54ce0b63c12c3" + dependencies: + is-ci "^1.0.10" + normalize-path "^1.0.0" + strip-indent "^2.0.0" + icss-replace-symbols@1.1.0, icss-replace-symbols@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/icss-replace-symbols/-/icss-replace-symbols-1.1.0.tgz#06ea6f83679a7749e386cfe1fe812ae5db223ded" @@ -2163,6 +2256,10 @@ indent-string@^2.1.0: dependencies: repeating "^2.0.0" +indent-string@^3.0.0: + version "3.2.0" + resolved "https://registry.yarnpkg.com/indent-string/-/indent-string-3.2.0.tgz#4a5fd6d27cc332f37e5419a504dbb837105c9289" + indexes-of@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/indexes-of/-/indexes-of-1.0.1.tgz#f30f716c8e2bd346c7b67d3df3915566a7c05607" @@ -2230,6 +2327,12 @@ is-builtin-module@^1.0.0: dependencies: builtin-modules "^1.0.0" +is-ci@^1.0.10: + version "1.0.10" + resolved "https://registry.yarnpkg.com/is-ci/-/is-ci-1.0.10.tgz#f739336b2632365061a9d48270cd56ae3369318e" + dependencies: + ci-info "^1.0.0" + is-data-descriptor@^0.1.4: version "0.1.4" resolved "https://registry.yarnpkg.com/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz#0b5ee648388e2c860282e793f1856fec3f301b56" @@ -2252,6 +2355,10 @@ is-descriptor@^1.0.0: is-data-descriptor "^0.1.4" kind-of "^5.0.0" +is-directory@^0.3.1: + version "0.3.1" + resolved "https://registry.yarnpkg.com/is-directory/-/is-directory-0.3.1.tgz#61339b6f2475fc772fd9c9d83f5c8575dc154ae1" + is-dotfile@^1.0.0: version "1.0.3" resolved "https://registry.yarnpkg.com/is-dotfile/-/is-dotfile-1.0.3.tgz#a6a2f32ffd2dfb04f5ca25ecd0f6b83cf798a1e1" @@ -2276,6 +2383,10 @@ is-extglob@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/is-extglob/-/is-extglob-1.0.0.tgz#ac468177c4943405a092fc8f29760c6ffc6206c0" +is-extglob@^2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/is-extglob/-/is-extglob-2.1.1.tgz#a88c02535791f02ed37c76a1b9ea9773c833f8c2" + is-finite@^1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/is-finite/-/is-finite-1.0.2.tgz#cc6677695602be550ef11e8b4aa6305342b6d0aa" @@ -2298,6 +2409,12 @@ is-glob@^2.0.0, is-glob@^2.0.1: dependencies: is-extglob "^1.0.0" +is-glob@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-4.0.0.tgz#9521c76845cc2610a85203ddf080a958c2ffabc0" + dependencies: + is-extglob "^2.1.1" + is-my-json-valid@^2.12.4: version "2.16.1" resolved "https://registry.yarnpkg.com/is-my-json-valid/-/is-my-json-valid-2.16.1.tgz#5a846777e2c2620d1e69104e5d3a03b1f6088f11" @@ -2319,6 +2436,16 @@ is-number@^3.0.0: dependencies: kind-of "^3.0.2" +is-obj@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/is-obj/-/is-obj-1.0.1.tgz#3e4729ac1f5fde025cd7d83a896dab9f4f67db0f" + +is-observable@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/is-observable/-/is-observable-0.2.0.tgz#b361311d83c6e5d726cabf5e250b0237106f5ae2" + dependencies: + symbol-observable "^0.2.2" + is-odd@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/is-odd/-/is-odd-1.0.0.tgz#3b8a932eb028b3775c39bb09e91767accdb69088" @@ -2343,10 +2470,18 @@ is-primitive@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/is-primitive/-/is-primitive-2.0.0.tgz#207bab91638499c07b2adf240a41a87210034575" +is-promise@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/is-promise/-/is-promise-2.1.0.tgz#79a2a9ece7f096e80f36d2b2f3bc16c1ff4bf3fa" + is-property@^1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/is-property/-/is-property-1.0.2.tgz#57fe1c4e48474edd65b09911f26b1cd4095dda84" +is-regexp@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-regexp/-/is-regexp-1.0.0.tgz#fd2d883545c46bac5a633e7b9a09e87fa2cb5069" + is-stream@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-1.1.0.tgz#12d4a3dd4e68e0b79ceb8dbc84173ae80d91ca44" @@ -2442,6 +2577,19 @@ istanbul-reports@^1.1.3: dependencies: handlebars "^4.0.3" +jest-get-type@^21.2.0: + version "21.2.0" + resolved "https://registry.yarnpkg.com/jest-get-type/-/jest-get-type-21.2.0.tgz#f6376ab9db4b60d81e39f30749c6c466f40d4a23" + +jest-validate@^21.1.0: + version "21.2.1" + resolved "https://registry.yarnpkg.com/jest-validate/-/jest-validate-21.2.1.tgz#cc0cbca653cd54937ba4f2a111796774530dd3c7" + dependencies: + chalk "^2.0.1" + jest-get-type "^21.2.0" + leven "^2.1.0" + pretty-format "^21.2.1" + js-base64@^2.1.8, js-base64@^2.1.9: version "2.4.0" resolved "https://registry.yarnpkg.com/js-base64/-/js-base64-2.4.0.tgz#9e566fee624751a1d720c966cd6226d29d4025aa" @@ -2450,7 +2598,7 @@ js-tokens@^3.0.0, js-tokens@^3.0.2: version "3.0.2" resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-3.0.2.tgz#9866df395102130e38f7f996bceb65443209c25b" -js-yaml@^3.10.0: +js-yaml@^3.10.0, js-yaml@^3.9.0: version "3.10.0" resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.10.0.tgz#2e78441646bd4682e963f22b6e92823c309c62dc" dependencies: @@ -2572,6 +2720,83 @@ less@^2.7.2: request "2.81.0" source-map "^0.5.3" +leven@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/leven/-/leven-2.1.0.tgz#c2e7a9f772094dee9d34202ae8acce4687875580" + +lint-staged@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/lint-staged/-/lint-staged-6.0.0.tgz#7ab7d345f2fe302ff196f1de6a005594ace03210" + dependencies: + app-root-path "^2.0.0" + chalk "^2.1.0" + commander "^2.11.0" + cosmiconfig "^3.1.0" + debug "^3.1.0" + dedent "^0.7.0" + execa "^0.8.0" + find-parent-dir "^0.3.0" + is-glob "^4.0.0" + jest-validate "^21.1.0" + listr "^0.13.0" + lodash "^4.17.4" + log-symbols "^2.0.0" + minimatch "^3.0.0" + npm-which "^3.0.1" + p-map "^1.1.1" + path-is-inside "^1.0.2" + pify "^3.0.0" + staged-git-files "0.0.4" + stringify-object "^3.2.0" + +listr-silent-renderer@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/listr-silent-renderer/-/listr-silent-renderer-1.1.1.tgz#924b5a3757153770bf1a8e3fbf74b8bbf3f9242e" + +listr-update-renderer@^0.4.0: + version "0.4.0" + resolved "https://registry.yarnpkg.com/listr-update-renderer/-/listr-update-renderer-0.4.0.tgz#344d980da2ca2e8b145ba305908f32ae3f4cc8a7" + dependencies: + chalk "^1.1.3" + cli-truncate "^0.2.1" + elegant-spinner "^1.0.1" + figures "^1.7.0" + indent-string "^3.0.0" + log-symbols "^1.0.2" + log-update "^1.0.2" + strip-ansi "^3.0.1" + +listr-verbose-renderer@^0.4.0: + version "0.4.1" + resolved "https://registry.yarnpkg.com/listr-verbose-renderer/-/listr-verbose-renderer-0.4.1.tgz#8206f4cf6d52ddc5827e5fd14989e0e965933a35" + dependencies: + chalk "^1.1.3" + cli-cursor "^1.0.2" + date-fns "^1.27.2" + figures "^1.7.0" + +listr@^0.13.0: + version "0.13.0" + resolved "https://registry.yarnpkg.com/listr/-/listr-0.13.0.tgz#20bb0ba30bae660ee84cc0503df4be3d5623887d" + dependencies: + chalk "^1.1.3" + cli-truncate "^0.2.1" + figures "^1.7.0" + indent-string "^2.1.0" + is-observable "^0.2.0" + is-promise "^2.1.0" + is-stream "^1.1.0" + listr-silent-renderer "^1.1.1" + listr-update-renderer "^0.4.0" + listr-verbose-renderer "^0.4.0" + log-symbols "^1.0.2" + log-update "^1.0.2" + ora "^0.2.3" + p-map "^1.1.1" + rxjs "^5.4.2" + stream-to-observable "^0.2.0" + strip-ansi "^3.0.1" + load-json-file@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/load-json-file/-/load-json-file-1.1.0.tgz#956905708d58b4bab4c2261b04f59f31c99374c0" @@ -2673,6 +2898,25 @@ lodash@^4.0.0, lodash@^4.17.4, lodash@~4.17.4: version "4.17.4" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.4.tgz#78203a4d1c328ae1d86dca6460e369b57f4055ae" +log-symbols@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/log-symbols/-/log-symbols-1.0.2.tgz#376ff7b58ea3086a0f09facc74617eca501e1a18" + dependencies: + chalk "^1.0.0" + +log-symbols@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/log-symbols/-/log-symbols-2.1.0.tgz#f35fa60e278832b538dc4dddcbb478a45d3e3be6" + dependencies: + chalk "^2.0.1" + +log-update@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/log-update/-/log-update-1.0.2.tgz#19929f64c4093d2d2e7075a1dad8af59c296b8d1" + dependencies: + ansi-escapes "^1.0.0" + cli-cursor "^1.0.2" + longest@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/longest/-/longest-1.0.1.tgz#30a0b2da38f73770e8294a0d22e6625ed77d0097" @@ -3026,6 +3270,10 @@ normalize-package-data@^2.3.2, normalize-package-data@^2.3.4: semver "2 || 3 || 4 || 5" validate-npm-package-license "^3.0.1" +normalize-path@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-1.0.0.tgz#32d0e472f91ff345701c15a8311018d3b0a90379" + normalize-path@^2.0.0, normalize-path@^2.0.1: version "2.1.1" resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-2.1.1.tgz#1ab28b556e198363a8c1a6f7e6fa20137fe6aed9" @@ -3045,12 +3293,26 @@ normalize-url@^1.4.0: query-string "^4.1.0" sort-keys "^1.0.0" +npm-path@^2.0.2: + version "2.0.3" + resolved "https://registry.yarnpkg.com/npm-path/-/npm-path-2.0.3.tgz#15cff4e1c89a38da77f56f6055b24f975dfb2bbe" + dependencies: + which "^1.2.10" + npm-run-path@^2.0.0: version "2.0.2" resolved "https://registry.yarnpkg.com/npm-run-path/-/npm-run-path-2.0.2.tgz#35a9232dfa35d7067b4cb2ddf2357b1871536c5f" dependencies: path-key "^2.0.0" +npm-which@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/npm-which/-/npm-which-3.0.1.tgz#9225f26ec3a285c209cae67c3b11a6b4ab7140aa" + dependencies: + commander "^2.9.0" + npm-path "^2.0.2" + which "^1.2.10" + "npmlog@0 || 1 || 2 || 3 || 4", npmlog@^4.0.0, npmlog@^4.0.2: version "4.1.2" resolved "https://registry.yarnpkg.com/npmlog/-/npmlog-4.1.2.tgz#08a7f2a8bf734604779a9efa4ad5cc717abb954b" @@ -3147,6 +3409,10 @@ once@^1.3.0, once@^1.3.3: dependencies: wrappy "1" +onetime@^1.0.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/onetime/-/onetime-1.1.0.tgz#a1f7838f8314c516f05ecefcbc4ccfe04b4ed789" + optimist@^0.6.1: version "0.6.1" resolved "https://registry.yarnpkg.com/optimist/-/optimist-0.6.1.tgz#da3ea74686fa21a19a111c326e90eb15a0196686" @@ -3154,6 +3420,15 @@ optimist@^0.6.1: minimist "~0.0.1" wordwrap "~0.0.2" +ora@^0.2.3: + version "0.2.3" + resolved "https://registry.yarnpkg.com/ora/-/ora-0.2.3.tgz#37527d220adcd53c39b73571d754156d5db657a4" + dependencies: + chalk "^1.1.1" + cli-cursor "^1.0.2" + cli-spinners "^0.1.2" + object-assign "^4.0.1" + os-browserify@^0.3.0: version "0.3.0" resolved "https://registry.yarnpkg.com/os-browserify/-/os-browserify-0.3.0.tgz#854373c7f5c2315914fc9bfc6bd8238fdda1ec27" @@ -3209,6 +3484,10 @@ p-locate@^2.0.0: dependencies: p-limit "^1.1.0" +p-map@^1.1.1: + version "1.2.0" + resolved "https://registry.yarnpkg.com/p-map/-/p-map-1.2.0.tgz#e4e94f311eabbc8633a1e79908165fca26241b6b" + pako@~1.0.5: version "1.0.6" resolved "https://registry.yarnpkg.com/pako/-/pako-1.0.6.tgz#0101211baa70c4bca4a0f63f2206e97b7dfaf258" @@ -3238,6 +3517,12 @@ parse-json@^2.2.0: dependencies: error-ex "^1.2.0" +parse-json@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/parse-json/-/parse-json-3.0.0.tgz#fa6f47b18e23826ead32f263e744d0e1e847fb13" + dependencies: + error-ex "^1.3.1" + parse-json@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/parse-json/-/parse-json-4.0.0.tgz#be35f5425be1f7f6c747184f98a788cb99477ee0" @@ -3271,6 +3556,10 @@ path-is-absolute@^1.0.0, path-is-absolute@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f" +path-is-inside@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/path-is-inside/-/path-is-inside-1.0.2.tgz#365417dede44430d1c11af61027facf074bdfc53" + path-key@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/path-key/-/path-key-2.0.1.tgz#411cadb574c5a140d3a4b1910d40d80cc9f40b40" @@ -3313,6 +3602,10 @@ pify@^2.0.0: version "2.3.0" resolved "https://registry.yarnpkg.com/pify/-/pify-2.3.0.tgz#ed141a6ac043a849ea588498e7dca8b15330e90c" +pify@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/pify/-/pify-3.0.0.tgz#e5a4acd2c101fdf3d9a4d07f0dbc4db49dd28176" + pinkie-promise@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/pinkie-promise/-/pinkie-promise-2.0.1.tgz#2135d6dfa7a358c069ac9b178776288228450ffa" @@ -3641,6 +3934,17 @@ preserve@^0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/preserve/-/preserve-0.2.0.tgz#815ed1f6ebc65926f865b310c0713bcb3315ce4b" +prettier@^1.9.1: + version "1.9.1" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.9.1.tgz#41638a0d47c1efbd1b7d5a742aaa5548eab86d70" + +pretty-format@^21.2.1: + version "21.2.1" + resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-21.2.1.tgz#ae5407f3cf21066cd011aa1ba5fce7b6a2eddb36" + dependencies: + ansi-regex "^3.0.0" + ansi-styles "^3.2.0" + private@^0.1.6, private@^0.1.7: version "0.1.8" resolved "https://registry.yarnpkg.com/private/-/private-0.1.8.tgz#2381edb3689f7a53d653190060fcf822d2f368ff" @@ -3965,6 +4269,10 @@ require-directory@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/require-directory/-/require-directory-2.1.1.tgz#8c64ad5fd30dab1c976e2344ffe7f792a6a6df42" +require-from-string@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/require-from-string/-/require-from-string-2.0.1.tgz#c545233e9d7da6616e9d59adfb39fc9f588676ff" + require-main-filename@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/require-main-filename/-/require-main-filename-1.0.1.tgz#97f717b69d48784f5f526a6c5aa8ffdda055a4d1" @@ -3987,6 +4295,13 @@ resolve@^1.4.0: dependencies: path-parse "^1.0.5" +restore-cursor@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/restore-cursor/-/restore-cursor-1.0.1.tgz#34661f46886327fed2991479152252df92daa541" + dependencies: + exit-hook "^1.0.0" + onetime "^1.0.0" + right-align@^0.1.1: version "0.1.3" resolved "https://registry.yarnpkg.com/right-align/-/right-align-0.1.3.tgz#61339b722fe6a3515689210d24e14c96148613ef" @@ -4006,6 +4321,12 @@ ripemd160@^2.0.0, ripemd160@^2.0.1: hash-base "^2.0.0" inherits "^2.0.1" +rxjs@^5.4.2: + version "5.5.5" + resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-5.5.5.tgz#e164f11d38eaf29f56f08c3447f74ff02dd84e97" + dependencies: + symbol-observable "1.0.1" + safe-buffer@^5.0.1, safe-buffer@^5.1.0, safe-buffer@^5.1.1, safe-buffer@~5.1.0, safe-buffer@~5.1.1: version "5.1.1" resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.1.tgz#893312af69b2123def71f57889001671eeb2c853" @@ -4134,6 +4455,10 @@ slash@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/slash/-/slash-1.0.0.tgz#c41f2f6c39fc16d1cd17ad4b5d896114ae470d55" +slice-ansi@0.0.4: + version "0.0.4" + resolved "https://registry.yarnpkg.com/slice-ansi/-/slice-ansi-0.0.4.tgz#edbf8903f66f7ce2f8eafd6ceed65e264c831b35" + slide@^1.1.5: version "1.1.6" resolved "https://registry.yarnpkg.com/slide/-/slide-1.1.6.tgz#56eb027d65b4d2dce6cb2e2d32c4d4afc9e1d707" @@ -4272,6 +4597,10 @@ sshpk@^1.7.0: jsbn "~0.1.0" tweetnacl "~0.14.0" +staged-git-files@0.0.4: + version "0.0.4" + resolved "https://registry.yarnpkg.com/staged-git-files/-/staged-git-files-0.0.4.tgz#d797e1b551ca7a639dec0237dc6eb4bb9be17d35" + static-extend@^0.1.1: version "0.1.2" resolved "https://registry.yarnpkg.com/static-extend/-/static-extend-0.1.2.tgz#60809c39cbff55337226fd5e0b520f341f1fb5c6" @@ -4310,6 +4639,12 @@ stream-http@^2.7.2: to-arraybuffer "^1.0.0" xtend "^4.0.0" +stream-to-observable@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/stream-to-observable/-/stream-to-observable-0.2.0.tgz#59d6ea393d87c2c0ddac10aa0d561bc6ba6f0e10" + dependencies: + any-observable "^0.2.0" + strict-uri-encode@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/strict-uri-encode/-/strict-uri-encode-1.1.0.tgz#279b225df1d582b1f54e65addd4352e18faa0713" @@ -4339,6 +4674,14 @@ string_decoder@^1.0.0, string_decoder@~1.0.3: dependencies: safe-buffer "~5.1.0" +stringify-object@^3.2.0: + version "3.2.1" + resolved "https://registry.yarnpkg.com/stringify-object/-/stringify-object-3.2.1.tgz#2720c2eff940854c819f6ee252aaeb581f30624d" + dependencies: + get-own-enumerable-property-symbols "^2.0.1" + is-obj "^1.0.1" + is-regexp "^1.0.0" + stringstream@~0.0.4, stringstream@~0.0.5: version "0.0.5" resolved "https://registry.yarnpkg.com/stringstream/-/stringstream-0.0.5.tgz#4e484cd4de5a0bbbee18e46307710a8a81621878" @@ -4371,6 +4714,10 @@ strip-indent@^1.0.1: dependencies: get-stdin "^4.0.1" +strip-indent@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/strip-indent/-/strip-indent-2.0.0.tgz#5ef8db295d01e6ed6cbf7aab96998d7822527b68" + strip-json-comments@~2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-2.0.1.tgz#3c531942e908c2697c0ec344858c286c7ca0a60a" @@ -4420,6 +4767,14 @@ svgo@^0.7.0, svgo@^0.7.2: sax "~1.2.1" whet.extend "~0.9.9" +symbol-observable@1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/symbol-observable/-/symbol-observable-1.0.1.tgz#8340fc4702c3122df5d22288f88283f513d3fdd4" + +symbol-observable@^0.2.2: + version "0.2.4" + resolved "https://registry.yarnpkg.com/symbol-observable/-/symbol-observable-0.2.4.tgz#95a83db26186d6af7e7a18dbd9760a2f86d08f40" + tar-pack@^3.4.0: version "3.4.1" resolved "https://registry.yarnpkg.com/tar-pack/-/tar-pack-3.4.1.tgz#e1dbc03a9b9d3ba07e896ad027317eb679a10a1f" @@ -4670,7 +5025,7 @@ which-module@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/which-module/-/which-module-2.0.0.tgz#d9ef07dce77b9902b8a3a8fa4b31c3e3f7e6e87a" -which@1, which@^1.2.9, which@^1.3.0: +which@1, which@^1.2.10, which@^1.2.9, which@^1.3.0: version "1.3.0" resolved "https://registry.yarnpkg.com/which/-/which-1.3.0.tgz#ff04bdfc010ee547d780bec38e1ac1c2777d253a" dependencies: