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AkB,cAAlB;AACA;;AAED;AACA;;AAED;AACA;;AAEA,OAAI,oBAAJ;;AAEA;AACA,OAAI,KAAK,OAAL,CAAa,WAAb,IAA4B,KAAK,OAAL,CAAa,IAA7C,EACA;AACC,kBAAc,uBACd;AACC,SACA;AACC,qCAAQ,OAAK,OAAL,CAAa,IAArB;AACA,aAAO,IAAP;AACA,MAJD,CAKA,OAAO,KAAP,EACA;AACC,UAAI,CAAC,0BAAY,MAAM,OAAlB,EAA2B,0EAA3B,CAAD,IACA,CAAC,0BAAY,MAAM,OAAlB,EAA2B,sBAA3B,CADD,IAEA,CAAC,0BAAY,MAAM,OAAlB,EAA2B,yBAA3B,CAFL,EAGA;AACC,cAAK,GAAL,CAAS,KAAT;AACA,cAAK,GAAL,CAAS,KAAT,CAAe,KAAf;AACA;;AAED,aAAO,KAAP;AACA;AACD,KAnBD;AAoBA;AACD;AAvBA,QAyBA;AACC,mBAAc;AAAA,aAAM,aAAG,UAAH,CAAc,OAAK,mBAAnB,CAAN;AAAA,MAAd;AACA;;AAED,+BAAa;AAAA,WAAM,SAAS,WAAT,EAAsB,IAAtB,CAAN;AAAA,IAAb;;AAEA;AACA,UAAO,IAAP;AACA;;;;;AAGF;AACA;AACA;;;kBAz0BqB,wB","file":"index.js","sourcesContent":["import path from 'path'\nimport fs from 'fs'\n\nimport require_hacker from 'require-hacker'\nimport UglifyJS from 'uglify-js'\n\nimport Log from './tools/log'\nimport request from './tools/synchronous http'\n\nimport { exists, clone, convert_from_camel_case, starts_with, ends_with, alias_properties_with_camel_case } from './helpers'\nimport { default_webpack_assets, normalize_options, alias_hook, normalize_asset_path, uniform_path } from './common'\n\n// using ES6 template strings\n// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/template_strings\nexport default class webpack_isomorphic_tools\n{\n\t// require() hooks for assets\n\thooks = []\n\n\t// used to keep track of cached assets and flush their caches on .refresh() call\n\tcached_assets = []\n\n\tconstructor(options)\n\t{\n\t\t// take the passed in options\n\t\tthis.options = convert_from_camel_case(clone(options))\n\n\t\t// add missing fields, etc\n\t\tnormalize_options(this.options)\n\n\t\t// set development mode flag\n\t\tthis.options.development = process.env.NODE_ENV !== 'production'\n\n\t\t// set require-hacker debug mode if run in debug mode\n\t\tif (this.options.debug)\n\t\t{\n\t\t\trequire_hacker.log.options.debug = true\n\t\t}\n\n\t\t// logging\n\t\tthis.log = new Log('webpack-isomorphic-tools', { debug: this.options.debug })\n\n\t\tthis.log.debug(`instantiated webpack-isomorphic-tools v${require('../package.json').version} with options`, this.options)\n\t}\n\n\t// (deprecated)\n\t// sets development mode flag to whatever was passed (or true if nothing was passed)\n\t// (development mode allows asset hot reloading when used with webpack-dev-server)\n\tdevelopment()\n\t{\n\t\t// display deprecation notice\n\t\tthis.log.error('`.development()` method is now deprecated ' +\n\t\t\t'(for server-side instance only, not for webpack plugin instance) ' +\n\t\t\t'and has no effect. Set up a proper `process.env.NODE_ENV` variable instead: ' +\n\t\t\t'it should be \"production\" for production, otherwise it assumes development. ' + \n\t\t\t'The currently used mode is: ' + (this.options.development ? 'development' : 'production') + '. ' +\n\t\t\t'`process.env.NODE_ENV is: ' + process.env.NODE_ENV)\n\n\t\t// allows method chaining\n\t\treturn this\n\t}\n\n\t// returns a mapping to read file paths for all the user specified asset types\n\t// along with a couple of predefined ones: javascripts and styles\n\tassets()\n\t{\n\t\t// when in development mode\n\t\tif (this.options.development)\n\t\t{\n\t\t\t// webpack and node.js start in parallel\n\t\t\t// so webpack-assets.json might not exist on the very first run\n\t\t\t// if a developer chose not to use the .server() method with a callback\n\t\t\t// (or if a developer chose not to wait for a Promise returned by the .server() method)\n\n\t\t\t// either go over a network\n\t\t\tif (this.options.port)\n\t\t\t{\n\t\t\t\ttry\n\t\t\t\t{\n\t\t\t\t\treturn request(this.options.port)\n\t\t\t\t}\n\t\t\t\tcatch (error)\n\t\t\t\t{\n\t\t\t\t\tthis.log.error(`Couldn't contact webpack-isomorphic-tools plugin over HTTP. Using an empty stub for webpack assets map.`)\n\t\t\t\t\tthis.log.error(error)\n\t\t\t\t\treturn default_webpack_assets()\n\t\t\t\t}\n\t\t\t}\n\t\t\t// or read it from disk\n\t\t\telse\n\t\t\t{\n\t\t\t\tif (!fs.existsSync(this.webpack_assets_path))\n\t\t\t\t{\n\t\t\t\t\tthis.log.error(`\"${this.webpack_assets_path}\" not found. Most likely it hasn't yet been generated by Webpack. The most probable cause of this error is that you placed your server code outside of the callback in \"webpack_isomorphic_tools.server(path, callback)\" (or outside of the \".then()\" call if you are using promises API). Using an empty stub instead.`)\n\t\t\t\t\treturn default_webpack_assets()\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// sanity check\n\t\tif (!this.webpack_assets_path)\n\t\t{\n\t\t\tthrow new Error(`You seem to have forgotten to call the .server() method`)\n\t\t}\n\n\t\treturn require(this.webpack_assets_path)\n\t}\n\n\t// clear the require.cache (only used in developer mode with webpack-dev-server)\n\trefresh()\n\t{\n\t\t// ensure this is development mode\n\t\tif (!this.options.development)\n\t\t{\n\t\t\tthrow new Error('.refresh() called in production mode. It shouldn\\'t be called in production mode because that would degrade website performance by discarding caches.')\n\t\t}\n\n\t\tthis.log.debug('flushing require() caches')\n\n\t\t// uncache webpack-assets.json file\n\t\t// this.log.debug(' flushing require() cache for webpack assets json file')\n\t\t// this.log.debug(` (was cached: ${typeof(require.cache[this.webpack_assets_path]) !== 'undefined'})`)\n\t\tdelete require.cache[this.webpack_assets_path]\n\n\t\t// uncache cached assets\n\t\tfor (let path of this.cached_assets)\n\t\t{\n\t\t\tthis.log.debug(` flushing require() cache for ${path}`)\n\t\t\tdelete require.cache[path]\n\t\t}\n\n\t\t// no assets are cached now\n\t\tthis.cached_assets = []\n\t}\n\n\t// Makes `webpack-isomorphic-tools` aware of Webpack aliasing feature.\n\t// https://webpack.github.io/docs/resolving.html#aliasing\n\t// The `aliases` parameter corresponds to `resolve.alias`\n\t// in your Webpack configuration.\n\t// If this method is used it must be called before the `.server()` method.\n\tenable_aliasing()\n\t{\n\t\t// mount require() hook\n\t\tthis.alias_hook = require_hacker.resolver((path, module) =>\n\t\t{\n\t\t\t// returns aliased global filesystem path\n\t\t\treturn alias_hook(path, module, this.options.project_path, this.options.alias, this.log)\n\t\t})\n\n\t\t// allows method chaining\n\t\treturn this\n\t}\n\n\t// Initializes server-side instance of `webpack-isomorphic-tools`\n\t// with the base path for your project, then calls `.register()`,\n\t// and after that calls .wait_for_assets(callback).\n\t//\n\t// The `project_path` parameter must be identical\n\t// to the `context` parameter of your Webpack configuration\n\t// and is needed to locate `webpack-assets.json`\n\t// which is output by Webpack process.\n\t//\n\t// sets up \"project_path\" option\n\t// (this option is required on the server to locate webpack-assets.json)\n\tserver(project_path, callback)\n\t{\n\t\t// project base path, required to locate webpack-assets.json\n\t\tthis.options.project_path = project_path\n\n\t\t// resolve webpack-assets.json file path\n\t\tthis.webpack_assets_path = path.resolve(this.options.project_path, this.options.webpack_assets_file_path)\n\n\t\t// register require() hooks\n\t\tthis.register()\n\n\t\t// if Webpack aliases are supplied, enable aliasing\n\t\tif (this.options.alias)\n\t\t{\n\t\t\tthis.enable_aliasing()\n\t\t}\n\n\t\t// if Webpack `modulesDirectories` are supplied, enable them\n\t\tif (this.options.modules_directories)\n\t\t{\n\t\t\tthis.inject_modules_directories(this.options.modules_directories)\n\t\t}\n\n\t\t// inject helpers like require.context() and require.ensure()\n\t\tif (this.options.patch_require)\n\t\t{\n\t\t\tthis.log.debug('Patching Node.js require() function')\n\t\t\tthis.patch_require()\n\t\t}\n\n\t\t// when ready:\n\n\t\t// if callback is given, call it back\n\t\tif (callback)\n\t\t{\n\t\t\t// call back when ready\n\t\t\treturn this.wait_for_assets(callback)\n\t\t}\n\t\t// otherwise resolve a Promise\n\t\telse\n\t\t{\n\t\t\t// no callback given, return a Promise\n\t\t\treturn new Promise((resolve, reject) => this.wait_for_assets(resolve))\n\t\t}\n\t}\n\n\t// Registers Node.js require() hooks for the assets\n\t//\n\t// This is what makes the `requre()` magic work on server.\n\t// These `require()` hooks must be set before you `require()`\n\t// any of your assets\n\t// (e.g. before you `require()` any React components\n\t// `require()`ing your assets).\n\t//\n\t// read this article if you don't know what a \"require hook\" is\n\t// http://bahmutov.calepin.co/hooking-into-node-loader-for-fun-and-profit.html\n\tregister()\n\t{\n\t\tthis.log.debug('registering require() hooks for assets')\n\n\t\t// // a helper array for extension matching\n\t\t// const extensions = []\n\t\t//\n\t\t// // for each user specified asset type,\n\t\t// // for each file extension,\n\t\t// // create an entry in the extension matching array\n\t\t// for (let asset_type of Object.keys(this.options.assets))\n\t\t// {\n\t\t// \tconst description = this.options.assets[asset_type]\n\t\t//\n\t\t// \tfor (let extension of description.extensions)\n\t\t// \t{\n\t\t// \t\textensions.push([`.${extension}`, description])\n\t\t// \t}\n\t\t// }\n\t\t//\n\t\t// // registers a global require() hook which runs\n\t\t// // before the default Node.js require() logic\n\t\t// this.asset_hook = require_hacker.global_hook('webpack-asset', (path, module) =>\n\t\t// {\n\t\t// \t// for each asset file extension\n\t\t// \tfor (let extension of extensions)\n\t\t// \t{\n\t\t// \t\t// if the require()d path has this file extension\n\t\t// \t\tif (ends_with(path, extension[0]))\n\t\t// \t\t{\n\t\t// \t\t\t// then require() it using webpack-assets.json\n\t\t// \t\t\treturn this.require(require_hacker.resolve(path, module), extension[1])\n\t\t// \t\t}\n\t\t// \t}\n\t\t// })\n\n\t\t// for each user specified asset type,\n\t\t// register a require() hook for each file extension of this asset type\n\t\tfor (let asset_type of Object.keys(this.options.assets))\n\t\t{\n\t\t\tconst description = this.options.assets[asset_type]\n\n\t\t\tfor (let extension of description.extensions)\n\t\t\t{\n\t\t\t\tthis.register_extension(extension, description)\n\t\t\t}\n\t\t}\n\n\t\t// intercepts loader-powered require() paths\n\t\tthis.loaders_hook = require_hacker.global_hook('webpack-loaders', (required_path, module) =>\n\t\t{\n\t\t\t// filter out non-loader paths\n\t\t\t// (ignore filesystem paths (both Linux and Windows)\n\t\t\t// and non-loader paths)\n\t\t\tif (starts_with(required_path, '/')\n\t\t\t\t|| starts_with(required_path, './')\n\t\t\t\t|| starts_with(required_path, '../')\n\t\t\t\t|| required_path.indexOf(':') > 0\n\t\t\t\t|| required_path.indexOf('!') < 0)\n\t\t\t{\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tlet parts = required_path.split('!')\n\t\t\tconst local_asset_path = parts.pop()\n\n\t\t\t// extra measures taken here to not\n\t\t\t// confuse some legit require()d path\n\t\t\t// with a seemingly loader-powered one\n\t\t\tif (!starts_with(local_asset_path, './')\n\t\t\t\t&& !starts_with(local_asset_path, '../'))\n\t\t\t{\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tparts = parts.map(loader =>\n\t\t\t{\n\t\t\t\tlet loader_parts = loader.split('?')\n\n\t\t\t\tif (!ends_with(loader_parts[0], '-loader'))\n\t\t\t\t{\n\t\t\t\t\tloader_parts[0] += '-loader'\n\t\t\t\t}\n\n\t\t\t\treturn `./~/${loader_parts.join('?')}`\n\t\t\t})\n\n\t\t\tconst global_asset_path = require_hacker.resolve(local_asset_path, module)\n\n\t\t\tconst path = parts.join('!') + '!' + this.normalize_asset_path(global_asset_path)\n\n\t\t\tconst asset = this.asset_source(path)\n\n\t\t\tif (asset === undefined)\n\t\t\t{\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\treturn this.require_asset(asset, { require_cache_path: required_path + '.webpack-loaders' })\n\t\t})\n\n\t\t// allows method chaining\n\t\treturn this\n\t}\n\n\t// registers a require hook for a particular file extension\n\tregister_extension(extension, description)\n\t{\n\t\tthis.log.debug(` registering a require() hook for *.${extension}`)\n\n\t\t// place the require() hook for this extension\n\t\tif (extension === 'json')\n\t\t{\n\t\t\tthis.hooks.push(require_hacker.hook(extension, path =>\n\t\t\t{\n\t\t\t\t// special case for require('webpack-assets.json') and 'json' asset extension\n\t\t\t\tif (path === this.webpack_assets_path)\n\t\t\t\t{\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\treturn this.require(path, description)\n\t\t\t}))\n\t\t}\n\t\telse\n\t\t{\n\t\t\tthis.hooks.push(require_hacker.hook(extension, path => this.require(path, description)))\n\t\t}\n\t}\n\n\t// injects Webpack's `modulesDirectories` into Node.js module resolver\n\tinject_modules_directories(modules_directories)\n\t{\n\t\tmodules_directories = modules_directories.filter(x => x !== 'node_modules')\n\n\t\t// instrument Module._nodeModulePaths function\n\t\t// https://github.com/nodejs/node/blob/master/lib/module.js#L202\n\t\t//\n\t\tconst original_find_paths = require('module')._findPath\n\t\t//\n\t\trequire('module')._findPath = function(request, paths)\n\t\t{\n\t\t\tpaths.map(function(a_path)\n\t\t\t{\n\t\t\t\tvar parts = a_path.split(path.sep)\n\t\t\t\tif (parts[parts.length - 1] === 'node_modules')\n\t\t\t\t{\n\t\t\t\t\tparts[parts.length - 1] = ''\n\t\t\t\t\treturn parts.join(path.sep)\n\t\t\t\t}\n\t\t\t})\n\t\t\t.filter(function(a_path)\n\t\t\t{\n\t\t\t\treturn a_path\n\t\t\t})\n\t\t\t.forEach(function(a_path)\n\t\t\t{\n\t\t\t\tmodules_directories.forEach(function(modules_directory)\n\t\t\t\t{\n\t\t\t\t\tpaths.push(a_path + modules_directory)\n\t\t\t\t})\n\t\t\t})\n\n\t\t\treturn original_find_paths(request, paths)\n\t\t}\n\t}\n\n\t// injects helper functions into `require()` function\n\t// (such as `.context()` and `.ensure()`)\n\t// https://github.com/halt-hammerzeit/webpack-isomorphic-tools/issues/48#issuecomment-182878437\n\t// (this is a \"dirty\" way to do it but it works)\n\tpatch_require()\n\t{\n\t\t// a source code of a function that\n\t\t// require()s all modules inside the `base` folder\n\t\t// and puts them into a hash map for further reference\n\t\t//\n\t\t// https://webpack.github.io/docs/context.html\n\t\t//\n\t\tlet require_context = `require.context = function(base, scan_subdirectories, regular_expression)\n\t\t{\n\t\t\tbase = require('path').join(require('path').dirname(module.filename), base)\n\n\t\t\tvar contents = {}\n\n\t\t\t// recursive function\n\t\t\tfunction read_directory(directory)\n\t\t\t{\n\t\t\t\trequire('fs').readdirSync(directory).forEach(function(child)\n\t\t\t\t{\n\t\t\t\t\tvar full_path = require('path').resolve(directory, child)\n\n\t\t\t\t\tif (require('fs').statSync(full_path).isDirectory())\n\t\t\t\t\t{\n\t\t\t\t\t\tif (scan_subdirectories)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tread_directory(full_path)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tvar asset_path = require('path').relative(base, full_path)\n\n\t\t\t\t\t\t// analogous to \"uniform_path\" from \"./common.js\"\n\t\t\t\t\t\tasset_path = (asset_path[0] === '.' ? asset_path : ('./' + asset_path)).replace(/\\\\\\\\/g, '/')\n\n\t\t\t\t\t\tif (regular_expression && !regular_expression.test(asset_path))\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tcontents[asset_path] = full_path\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t}\n\n\t\t\tread_directory(base)\n\n\t\t\tvar result = function(asset_path)\n\t\t\t{\n\t\t\t\treturn require(contents[asset_path])\n\t\t\t}\n\n\t\t\tresult.keys = function()\n\t\t\t{\n\t\t\t\treturn Object.keys(contents)\n\t\t\t}\n\n\t\t\tresult.resolve = function(asset_path)\n\t\t\t{\n\t\t\t\treturn contents[asset_path]\n\t\t\t}\n\n\t\t\treturn result\n\t\t};`\n\n\t\t// some code minification\n\t\trequire_context = UglifyJS.minify(require_context, { fromString: true }).code\n\n\t\t// Source code for `require.ensure()`\n\t\t// https://github.com/halt-hammerzeit/webpack-isomorphic-tools/issues/84\n\t\tconst require_ensure = `require.ensure=function(d,c){c(require)};`\n\n\t\tconst debug = this.log.debug.bind(this.log)\n\n\t\t// instrument Module.prototype._compile function\n\t\t// https://github.com/nodejs/node/blob/master/lib/module.js#L376-L380\n\t\t//\n\t\tconst original_compile = require('module').prototype._compile\n\t\t//\n\t\trequire('module').prototype._compile = function(content, filename)\n\t\t{\n\t\t\t// inject it only in .js files\n\t\t\tif (!ends_with(filename, '.js'))\n\t\t\t{\n\t\t\t\t// (the return value is supposed to be `undefined`)\n\t\t\t\treturn original_compile.call(this, content, filename)\n\t\t\t}\n\n\t\t\t// will be prepended to the module source code\n\t\t\tlet preamble = ''\n\n\t\t\t// inject it only in .js files which\n\t\t\t// might probably have `require.context` reference\n\t\t\tif (content.indexOf('require.context') >= 0)\n\t\t\t{\n\t\t\t\tdebug(`Injecting require.context() into \"${filename}\"`)\n\t\t\t\tpreamble += require_context\n\t\t\t}\n\n\t\t\t// inject it only in .js files which\n\t\t\t// might probably have `require.ensure` reference\n\t\t\tif (content.indexOf('require.ensure') >= 0)\n\t\t\t{\n\t\t\t\tdebug(`Injecting require.ensure() into \"${filename}\"`)\n\t\t\t\tpreamble += require_ensure\n\t\t\t}\n\n\t\t\t// If there is a preamble to prepend\n\t\t\tif (preamble)\n\t\t\t{\n\t\t\t\t// Account for \"use strict\" which is required to be in the beginning of the source code\n\t\t\t\tif (starts_with(content, `'use strict'`) || starts_with(content, `\"use strict\"`))\n\t\t\t\t{\n\t\t\t\t\tpreamble = `\"use strict\";` + preamble\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// the \"dirty\" way\n\t\t\tcontent = preamble + content\n\n\t\t\t// (the return value is supposed to be `undefined`)\n\t\t\treturn original_compile.call(this, content, filename)\n\t\t}\n\t}\n\n\tnormalize_asset_path(global_asset_path)\n\t{\n\t\t// sanity check\n\t\t/* istanbul ignore if */\n\t\tif (!this.options.project_path)\n\t\t{\n\t\t\tthrow new Error(`You forgot to call the .server() method passing it your project's base path`)\n\t\t}\n\n\t\t// convert global asset path to local-to-the-project asset path\n\t\treturn normalize_asset_path(global_asset_path, this.options.project_path)\n\t}\n\n\t// require()s an asset by a global path\n\trequire(global_asset_path, description)\n\t{\n\t\tthis.log.debug(`require() called for ${global_asset_path}`)\n\n\t\t// convert global asset path to local-to-the-project asset path\n\t\tconst asset_path = this.normalize_asset_path(global_asset_path)\n\n\t\t// if this filename is in the user specified exceptions list\n\t\t// (or is not in the user explicitly specified inclusion list)\n\t\t// then fall back to the normal require() behaviour\n\t\tif (!this.includes(asset_path, description) || this.excludes(asset_path, description))\n\t\t{\n\t\t\tthis.log.debug(` skipping require call for ${asset_path}`)\n\t\t\treturn\n\t\t}\n\n\t\t// find this asset in the list\n\t\tconst asset = this.asset_source(asset_path)\n\n\t\t// if the asset was not found in the list, output an error\n\t\tif (asset === undefined)\n\t\t{\n\t\t\tthis.log.error(`asset not found: ${asset_path}`)\n\t\t}\n\n\t\treturn this.require_asset(asset, { require_cache_path: global_asset_path })\n\t}\n\n\t// require()s an asset by it source\n\trequire_asset(asset, options)\n\t{\n\t\t// this.log.debug(`require() called for ${asset_path}`)\n\n\t\t// track cached assets (only in development mode)\n\t\tif (this.options.development)\n\t\t{\n\t\t\t// mark this asset as cached\n\t\t\tthis.cached_assets.push(options.require_cache_path)\n\t\t}\n\n\t\t// return CommonJS module source for this asset\n\t\treturn require_hacker.to_javascript_module_source(asset)\n\t}\n\n\t// returns asset source by path (looks it up in webpack-assets.json)\n\tasset_source(asset_path)\n\t{\n\t\tthis.log.debug(` requiring ${asset_path}`)\n\n\t\t// Webpack replaces `node_modules` with `~`.\n\t\t// I don't know how exactly it decides whether to\n\t\t// replace `node_modules` with `~` or not\n\t\t// so it will be a guess.\n\t\tfunction possible_webpack_paths(asset_path)\n\t\t{\n\t\t\t// Webpack always replaces project's own `node_modules` with `~`\n\t\t\tif (starts_with(asset_path, './node_modules/'))\n\t\t\t{\n\t\t\t\tasset_path = asset_path.replace('./node_modules/', './~/')\n\t\t\t}\n\n\t\t\t// if there are any `node_modules` left,\n\t\t\t// supposing the count is N,\n\t\t\t// then there are 2 to the power of N possible guesses\n\t\t\t// on how webpack path might look like.\n\t\t\tconst parts = asset_path.split('/node_modules/')\n\n\t\t\tfunction construct_guesses(parts)\n\t\t\t{\n\t\t\t\tif (parts.length === 1)\n\t\t\t\t{\n\t\t\t\t\treturn [parts]\n\t\t\t\t}\n\n\t\t\t\tconst last = parts.pop()\n\t\t\t\tconst rest = construct_guesses(parts)\n\n\t\t\t\tconst guesses = []\n\n\t\t\t\tfor (let guess of rest)\n\t\t\t\t{\n\t\t\t\t\tconst one = clone(guess)\n\t\t\t\t\tone.push('/~/')\n\t\t\t\t\tone.push(last)\n\n\t\t\t\t\tconst two = clone(guess)\n\t\t\t\t\ttwo.push('/node_modules/')\n\t\t\t\t\ttwo.push(last)\n\n\t\t\t\t\tguesses.push(one)\n\t\t\t\t\tguesses.push(two)\n\t\t\t\t}\n\n\t\t\t\treturn guesses\n\t\t\t}\n\n\t\t\treturn construct_guesses(parts)\n\t\t}\n\n\t\t// get real file path list\n\t\tconst assets = this.assets().assets\n\n\t\tconst possible_webpack_asset_paths = possible_webpack_paths(asset_path).map(path => path.join(''))\n\n\t\tfor (let webpack_asset_path of possible_webpack_asset_paths)\n\t\t{\n\t\t\tif (possible_webpack_asset_paths.length > 1)\n\t\t\t{\n\t\t\t\tthis.log.debug(` trying \"${webpack_asset_path}\"`)\n\t\t\t}\n\n\t\t\t// find this asset in the real file path list\n\t\t\tconst asset = assets[webpack_asset_path]\n\n\t\t\tif (exists(asset))\n\t\t\t{\n\t\t\t\t// the asset was found in the list - return it\n\t\t\t\treturn asset\n\t\t\t}\n\t\t}\n\n\t\t// if the asset was not found in the list, return nothing\n\t\treturn\n\t}\n\n\t// unregisters require() hooks\n\tundo()\n\t{\n\t\t// for each user specified asset type,\n\t\t// unregister a require() hook for each file extension of this asset type\n\t\tfor (let hook of this.hooks)\n\t\t{\n\t\t\thook.unmount()\n\t\t}\n\n\t\t// this.asset_hook.unmount()\n\n\t\t// unmount the aliasing hook (if mounted)\n\t\tif (this.alias_hook)\n\t\t{\n\t\t\tthis.alias_hook.unmount()\n\t\t}\n\n\t\t// unmount require() hook which intercepts loader-powered require() paths\n\t\tif (this.loaders_hook)\n\t\t{\n\t\t\tthis.loaders_hook.unmount()\n\t\t}\n\t}\n\n\t// Checks if the required path should be excluded from the custom require() hook\n\texcludes(path, options)\n\t{\n\t\t// if \"exclude\" parameter isn't specified, then exclude nothing\n\t\tif (!exists(options.exclude))\n\t\t{\n\t\t\treturn false\n\t\t}\n\n\t\t// for each exclusion case\n\t\tfor (let exclude of options.exclude)\n\t\t{\n\t\t\t// supports regular expressions\n\t\t\tif (exclude instanceof RegExp)\n\t\t\t{\n\t\t\t\tif (exclude.test(path))\n\t\t\t\t{\n\t\t\t\t\treturn true\n\t\t\t\t}\n\t\t\t}\n\t\t\t// check for a compex logic match\n\t\t\telse if (typeof exclude === 'function')\n\t\t\t{\n\t\t\t\tif (exclude(path))\n\t\t\t\t{\n\t\t\t\t\treturn true\n\t\t\t\t}\n\t\t\t}\n\t\t\t// otherwise check for a simple textual match\n\t\t\telse\n\t\t\t{\n\t\t\t\tif (exclude === path)\n\t\t\t\t{\n\t\t\t\t\treturn true\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// no matches found.\n\t\t// returns false so that it isn't undefined (for testing purpose)\n\t\treturn false\n\t}\n\n\t// Checks if the required path should be included in the custom require() hook\n\tincludes(path, options)\n\t{\n\t\t// if \"include\" parameter isn't specified, then include everything\n\t\tif (!exists(options.include))\n\t\t{\n\t\t\treturn true\n\t\t}\n\n\t\t// for each inclusion case\n\t\tfor (let include of options.include)\n\t\t{\n\t\t\t// supports regular expressions\n\t\t\tif (include instanceof RegExp)\n\t\t\t{\n\t\t\t\tif (include.test(path))\n\t\t\t\t{\n\t\t\t\t\treturn true\n\t\t\t\t}\n\t\t\t}\n\t\t\t// check for a compex logic match\n\t\t\telse if (typeof include === 'function')\n\t\t\t{\n\t\t\t\tif (include(path))\n\t\t\t\t{\n\t\t\t\t\treturn true\n\t\t\t\t}\n\t\t\t}\n\t\t\t// otherwise check for a simple textual match\n\t\t\telse\n\t\t\t{\n\t\t\t\tif (include === path)\n\t\t\t\t{\n\t\t\t\t\treturn true\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// no matches found.\n\t\t// returns false so that it isn't undefined (for testing purpose)\n\t\treturn false\n\t}\n\n\t// Waits for webpack-assets.json to be created after Webpack build process finishes\n\t//\n\t// The callback is called when `webpack-assets.json` has been found\n\t// (it's needed for development because `webpack-dev-server`\n\t// and your application server are usually run in parallel).\n\t//\n\twait_for_assets(done)\n\t{\n\t\t// condition check interval\n\t\tconst check_interval = 300 // in milliseconds\n\t\tconst message_interval = 2000 // in milliseconds\n\n\t\t// show the message not too often\n\t\tlet message_timer = 0\n\n\t\t// selfie\n\t\tconst tools = this\n\n\t\t// waits for condition to be met, then proceeds\n\t\tfunction wait_for(condition, proceed)\n\t\t{\n\t\t\tfunction check()\n\t\t\t{\n\t\t\t\t// if the condition is met, then proceed\n\t\t\t\tif (condition())\n\t\t\t\t{\n\t\t\t\t\treturn proceed()\n\t\t\t\t}\n\n\t\t\t\tmessage_timer += check_interval\n\n\t\t\t\tif (message_timer >= message_interval)\n\t\t\t\t{\n\t\t\t\t\tmessage_timer = 0\n\n\t\t\t\t\ttools.log.debug(`(${tools.webpack_assets_path} not found)`)\n\t\t\t\t\ttools.log.info('(waiting for the first Webpack build to finish)')\n\t\t\t\t}\n\n\t\t\t\tsetTimeout(check, check_interval)\n\t\t\t}\n\n\t\t\tcheck()\n\t\t}\n\n\t\t// wait for webpack-assets.json to be written to disk by Webpack\n\t\t// (setTimeout() for global.webpack_isomorphic_tools )\n\n\t\tlet ready_check\n\n\t\t// either go over network\n\t\tif (this.options.development && this.options.port)\n\t\t{\n\t\t\tready_check = () =>\n\t\t\t{\n\t\t\t\ttry\n\t\t\t\t{\n\t\t\t\t\trequest(this.options.port)\n\t\t\t\t\treturn true\n\t\t\t\t}\n\t\t\t\tcatch (error)\n\t\t\t\t{\n\t\t\t\t\tif (!starts_with(error.message, 'Server responded with status code 404:\\nWebpack assets not generated yet')\n\t\t\t\t\t\t&& !starts_with(error.message, 'connect ECONNREFUSED')\n\t\t\t\t\t\t&& !starts_with(error.message, 'Request timed out after'))\n\t\t\t\t\t{\n\t\t\t\t\t\tthis.log.error(`Couldn't contact webpack-isomorphic-tools plugin over HTTP. Using an empty stub for webpack assets map.`)\n\t\t\t\t\t\tthis.log.error(error)\n\t\t\t\t\t}\n\n\t\t\t\t\treturn false\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t// or read it from disk\n\t\telse\n\t\t{\n\t\t\tready_check = () => fs.existsSync(this.webpack_assets_path)\n\t\t}\n\n\t\tsetImmediate(() => wait_for(ready_check, done))\n\n\t\t// allows method chaining\n\t\treturn this\n\t}\n}\n\n// Doesn't work with Babel 6 compiler\n// // alias camel case for those who prefer it\n// alias_properties_with_camel_case(webpack_isomorphic_tools.prototype)"]}
\No newline at end of file