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AAmB,KAAnB,EAA0B,GAA1B,CAAb;;AAEA;AACA,KAAI,WAAW,OAAX,CAAmB,GAAnB,MAA4B,CAAhC,EACA;AACC,eAAa,OAAO,UAApB;AACA;;AAED,QAAO,UAAP;AACA;;AAEM,IAAM,8CACb;AACC,mBAA+B,kBADhC;AAEC,+BAA+B;AAFhC,CADO","file":"common.js","sourcesContent":["import path from 'path'\r\nimport fs from 'fs'\r\n\r\nimport require_hacker from 'require-hacker'\r\n\r\nimport { is_object, exists, starts_with } from './helpers'\r\n\r\n// returns a stub for webpack-assets.json if it doesn't exist yet\r\n// (because node.js and webpack are being run in parallel in development mode)\r\nexport function default_webpack_assets()\r\n{\r\n\tconst webpack_assets =\r\n\t{\r\n\t\tjavascript: {},\r\n\t\tstyles: {},\r\n\t\tassets: {}\r\n\t}\r\n\r\n\treturn webpack_assets\r\n}\r\n\r\n// adds missing fields, etc\r\nexport function normalize_options(options)\r\n{\r\n\t// parameters check\r\n\tfor (let key of Object.keys(options))\r\n\t{\r\n\t\tswitch (key)\r\n\t\t{\r\n\t\t\tcase 'assets':\r\n\t\t\t\tif (!is_object(options[key]))\r\n\t\t\t\t{\r\n\t\t\t\t\tthrow new Error(`\"${key}\" configuration parameter must be ` + `an object`)\r\n\t\t\t\t}\r\n\t\t\t\tbreak\r\n\r\n\t\t\tcase 'debug':\r\n\t\t\t\tif (typeof options[key] !== 'boolean')\r\n\t\t\t\t{\r\n\t\t\t\t\tthrow new Error(`\"${key}\" configuration parameter must be ` + `a boolean`)\r\n\t\t\t\t}\r\n\t\t\t\tbreak\r\n\r\n\t\t\tcase 'verbose':\r\n\t\t\t\tif (typeof options[key] !== 'boolean')\r\n\t\t\t\t{\r\n\t\t\t\t\tthrow new Error(`\"${key}\" configuration parameter must be ` + `a boolean`)\r\n\t\t\t\t}\r\n\t\t\t\t// Legacy `verbose` option is converted to `verbosity`\r\n\t\t\t\tconsole.log('[webpack-isomorphic-tools] WARNING: `verbose` option is now called `verbosity`')\r\n\t\t\t\tif (options.verbose)\r\n\t\t\t\t{\r\n\t\t\t\t\toptions.verbosity = verbosity_levels.webpack_stats_for_each_build\r\n\t\t\t\t}\r\n\t\t\t\tdelete options.verbose\r\n\t\t\t\tbreak\r\n\r\n\t\t\tcase 'verbosity':\r\n\t\t\t\tif (typeof options[key] !== 'string')\r\n\t\t\t\t{\r\n\t\t\t\t\tthrow new Error(`\"${key}\" configuration parameter must be ` + `a string`)\r\n\t\t\t\t}\r\n\t\t\t\tif (Object.keys(verbosity_levels).map(key => verbosity_levels[key]).indexOf(options[key]) < 0)\r\n\t\t\t\t{\r\n\t\t\t\t\tthrow new Error(`Unknown \"verbosity\" passed: ${options[key]}`)\r\n\t\t\t\t}\r\n\t\t\t\tbreak\r\n\r\n\t\t\tcase 'port':\r\n\t\t\t\tif (typeof options[key] !== 'number')\r\n\t\t\t\t{\r\n\t\t\t\t\tthrow new Error(`\"${key}\" configuration parameter must be ` + `a number`)\r\n\t\t\t\t}\r\n\t\t\t\tbreak\r\n\r\n\t\t\tcase 'webpack_assets_file_path':\r\n\t\t\tcase 'webpack_stats_file_path':\r\n\t\t\t\tif (typeof options[key] !== 'string')\r\n\t\t\t\t{\r\n\t\t\t\t\tthrow new Error(`\"${key}\" configuration parameter must be ` + `a string`)\r\n\t\t\t\t}\r\n\t\t\t\tbreak\r\n\r\n\t\t\tcase 'alias':\r\n\t\t\t\tif (!is_object(options[key]))\r\n\t\t\t\t{\r\n\t\t\t\t\tthrow new Error(`\"${key}\" configuration parameter must be ` + `an object`)\r\n\t\t\t\t}\r\n\t\t\t\tbreak\r\n\r\n\t\t\tcase 'modules_directories':\r\n\t\t\t\tif (!Array.isArray(options[key]))\r\n\t\t\t\t{\r\n\t\t\t\t\tthrow new Error(`\"${key}\" configuration parameter must be ` + `an array`)\r\n\t\t\t\t}\r\n\t\t\t\tbreak\r\n\r\n\t\t\tcase 'require_context':\r\n\t\t\t\tif (typeof options[key] !== 'boolean')\r\n\t\t\t\t{\r\n\t\t\t\t\tthrow new Error(`\"${key}\" configuration parameter must be ` + `a boolean`)\r\n\t\t\t\t}\r\n\t\t\t\t// Legacy `require_context` option is converted to `patch_require`\r\n\t\t\t\tconsole.log('[webpack-isomorphic-tools] WARNING: `require_context` option is now called `patch_require`')\r\n\t\t\t\tdelete options.require_context\r\n\t\t\t\toptions.patch_require = true\r\n\t\t\t\tbreak\r\n\r\n\t\t\tcase 'patch_require':\r\n\t\t\t\tif (typeof options[key] !== 'boolean')\r\n\t\t\t\t{\r\n\t\t\t\t\tthrow new Error(`\"${key}\" configuration parameter must be ` + `a boolean`)\r\n\t\t\t\t}\r\n\t\t\t\tbreak\r\n\r\n\t\t\tdefault:\r\n\t\t\t\tthrow new Error(`Unknown configuration parameter \"${key}\"`)\r\n\t\t}\r\n\t}\r\n\r\n\t// if no assets specified (for whatever reason), make it an empty array\r\n\tif (!options.assets)\r\n\t{\r\n\t\t// options.assets = {}\r\n\t\tthrow new Error('You must specify \"assets\" parameter in webpack-isomorphic-tools configuration')\r\n\t}\r\n\r\n\t// webpack-assets.json path, relative to the project base path\r\n\toptions.webpack_assets_file_path = options.webpack_assets_file_path || 'webpack-assets.json'\r\n\r\n\t// webpack-stats.json path, relative to the project base path\r\n\toptions.webpack_stats_file_path = options.webpack_stats_file_path || 'webpack-stats.json'\r\n\r\n\t// if Webpack aliases are supplied, validate them\r\n\tif (options.alias)\r\n\t{\r\n\t\tfor (let key of Object.keys(options.alias))\r\n\t\t{\r\n\t\t\tif (typeof options.alias[key] !== 'string')\r\n\t\t\t{\r\n\t\t\t\tthrow new Error(`Invalid alias for \"${key}\": \"${options.alias[key]}\"`)\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\t// generate names (if required) for each user defined asset type, normalize extensions\r\n\tfor (let asset_type of Object.keys(options.assets))\r\n\t{\r\n\t\tconst description = options.assets[asset_type]\r\n\r\n\t\t// normalize extensions\r\n\t\tif (description.extension)\r\n\t\t{\r\n\t\t\t// sanity check\r\n\t\t\tif (Array.isArray(description.extension))\r\n\t\t\t{\r\n\t\t\t\tthrow new Error(`Use \"extensions\" key instead of \"extension\" for specifying an array of file extensions for assets of type \"${asset_type}\"`)\r\n\t\t\t}\r\n\r\n\t\t\t// sanity check\r\n\t\t\tif (typeof description.extension !== 'string')\r\n\t\t\t{\r\n\t\t\t\tthrow new Error(`\"extension\" value must be a string for assets of type \"${asset_type}\"`)\r\n\t\t\t}\r\n\r\n\t\t\t// normalize\r\n\t\t\tdescription.extensions = [description.extension]\r\n\t\t\tdelete description.extension\r\n\t\t}\r\n\r\n\t\t// sanity check\r\n\t\tif (!description.extensions)\r\n\t\t{\r\n\t\t\tthrow new Error(`You must specify file extensions for assets of type \"${asset_type}\"`)\r\n\t\t}\r\n\r\n\t\t// parameters check\r\n\t\tfor (let key of Object.keys(description))\r\n\t\t{\r\n\t\t\tswitch (key)\r\n\t\t\t{\r\n\t\t\t\tcase 'extensions':\r\n\t\t\t\t\tbreak\r\n\r\n\t\t\t\tcase 'exclude':\r\n\t\t\t\tcase 'include':\r\n\t\t\t\t\tif (!Array.isArray(description[key]))\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tthrow new Error(`\"${key}\" must be an array for asset type \"${asset_type}\"`)\r\n\t\t\t\t\t}\r\n\t\t\t\t\tfor (let clusion of description[key])\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tif (typeof clusion !== 'string'\r\n\t\t\t\t\t\t\t&& !(clusion instanceof RegExp)\r\n\t\t\t\t\t\t\t&& typeof clusion !== 'function')\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tthrow new Error(`Unsupported object type for exclusion/inclusion \"${clusion}\" for asset type \"${asset_type}\"`)\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\tbreak\r\n\r\n\t\t\t\tcase 'filter':\r\n\t\t\t\tcase 'parser':\r\n\t\t\t\tcase 'path':\r\n\t\t\t\t\tif (typeof description[key] !== 'function')\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tthrow new Error(`\"${key}\" must be a function for asset type \"${asset_type}\"`)\r\n\t\t\t\t\t}\r\n\t\t\t\t\tbreak\r\n\r\n\t\t\t\tcase 'regular_expression':\r\n\t\t\t\t\tif (!(description[key] instanceof RegExp))\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tthrow new Error(`\"${key}\" must be a regular expression for asset type \"${asset_type}\"`)\r\n\t\t\t\t\t}\r\n\t\t\t\t\tbreak\r\n\r\n\t\t\t\tdefault:\r\n\t\t\t\t\tthrow new Error(`Unknown property \"${key}\" for asset type \"${asset_type}\"`)\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\r\n\r\n// alias the path if an alias is found,\r\n// and resolve it to a global filesystem path\r\nexport function alias_hook(path, module, project_path, aliases, log)\r\n{\r\n\t// possibly alias the path\r\n\tconst aliased_path = alias(path, aliases)\r\n\r\n\t// return if an alias not found\r\n\tif (!aliased_path)\r\n\t{\r\n\t\treturn\r\n\t}\r\n\r\n\t// if an alias is found, require() the correct path\r\n\tlog.debug(`require(\"${path}\") was called and an alias was found, so aliasing to module path \"${aliased_path}\"`)\r\n\r\n\t// resolve the path to a real filesystem path (resolves `npm link`, etc)\r\n\tconst global_path = require_hacker.resolve(aliased_path, module)\r\n\tlog.debug(` resolved the path for the aliased module to ${global_path}`)\r\n\r\n\treturn global_path\r\n\r\n\t// const result = require(global_path)\r\n\t// // log.debug(` the path was found`)\r\n\r\n\t// return require_hacker.to_javascript_module_source(result)\r\n}\r\n\r\n// alias the path provided the aliases map\r\nfunction alias(path, aliases)\r\n{\r\n\t// if it's a path to a file - don't interfere\r\n\tif (starts_with(path, '.') || starts_with(path, '/'))\r\n\t{\r\n\t\treturn\r\n\t}\r\n\r\n\t// extract module name from the path\r\n\tconst slash_index = path.indexOf('/')\r\n\tconst module_name = slash_index >= 0 ? path.substring(0, slash_index) : path\r\n\tconst rest = slash_index >= 0 ? path.substring(slash_index) : ''\r\n\r\n\t// find an alias\r\n\tconst alias = aliases[module_name]\r\n\r\n\t// if an alias is found, require() the correct path\r\n\tif (alias)\r\n\t{\r\n\t\treturn alias + rest\r\n\t}\r\n}\r\n\r\n// converts global asset path to local-to-the-project asset path\r\nexport function normalize_asset_path(global_asset_path, project_path)\r\n{\r\n\t// // if this path is outside project folder,\r\n\t// // return it as a global path\r\n\t// if (!starts_with(global_asset_path, project_path + path.sep))\r\n\t// {\r\n\t// \treturn global_asset_path\r\n\t// }\r\n\r\n\t// this path is inside project folder,\r\n\t// convert it to a relative path\r\n\r\n\t// asset path relative to the project folder\r\n\tlet asset_path = path.relative(project_path, global_asset_path)\r\n\r\n\t// for Windows:\r\n\t//\r\n\t// convert Node.js path to a correct Webpack path\r\n\tasset_path = uniform_path(asset_path)\r\n\r\n\treturn asset_path\r\n}\r\n\r\n// for Windows:\r\n//\r\n// converts Node.js path to a correct Webpack path\r\nexport function uniform_path(asset_path)\r\n{\r\n\t// correct slashes\r\n\tasset_path = asset_path.replace(/\\\\/g, '/')\r\n\r\n\t// add './' in the beginning if it's missing (for example, in case of Windows)\r\n\tif (asset_path.indexOf('.') !== 0)\r\n\t{\r\n\t\tasset_path = './' + asset_path\r\n\t}\r\n\r\n\treturn asset_path\r\n}\r\n\r\nexport const verbosity_levels =\r\n{\r\n\tno_webpack_stats : 'no webpack stats',\r\n\twebpack_stats_for_each_build : 'webpack stats for each build'\r\n}"]}
\No newline at end of file