From fb23f14a5575563ea9a340f0a266704fddf5189f Mon Sep 17 00:00:00 2001 From: Ryan Domingue Date: Wed, 13 Dec 2017 09:20:19 -0800 Subject: [PATCH 1/8] Bumps Webpack and webpack-dev-server versions --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 6322eeb..13791bb 100644 --- a/package.json +++ b/package.json @@ -51,8 +51,8 @@ "lodash": "^4.17.4", "opn": "^5.1.0", "style-loader": "0.13.1", - "webpack": "^2.6.1", - "webpack-dev-server": "^2.9.1" + "webpack": "^3.7.1", + "webpack-dev-server": "^2.9.3" }, "devDependencies": { "babel-cli": "6.24.0", From 9d7124e993b1ed8db92fba16b58c0b74f60b0ed7 Mon Sep 17 00:00:00 2001 From: Ryan Domingue Date: Tue, 26 Dec 2017 10:59:43 -0800 Subject: [PATCH 2/8] Testing a version range --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 13791bb..d33bca2 100644 --- a/package.json +++ b/package.json @@ -51,7 +51,7 @@ "lodash": "^4.17.4", "opn": "^5.1.0", "style-loader": "0.13.1", - "webpack": "^3.7.1", + "webpack": "^2.6.1 || ^3.7.1", "webpack-dev-server": "^2.9.3" }, "devDependencies": { From db032b25f8a06159686739aa8fb5e683960ba85d Mon Sep 17 00:00:00 2001 From: Owen Stowe Date: Fri, 5 Jan 2018 12:44:38 -0500 Subject: [PATCH 3/8] Remove contentBase as it was causing conflicts with file locations - Switch publicPath to be just huron.root config setting --- config/devServer.config.js | 8 +- dist/cli/index.js | 2148 +++------------------------ dist/cli/index.js.map | 1 - package-lock.json | 18 +- src/cli/generateConfig.js | 6 +- src/defaultConfig/webpack.config.js | 2 +- 6 files changed, 204 insertions(+), 1979 deletions(-) delete mode 100644 dist/cli/index.js.map diff --git a/config/devServer.config.js b/config/devServer.config.js index 581be70..241c8eb 100644 --- a/config/devServer.config.js +++ b/config/devServer.config.js @@ -1,7 +1,11 @@ +// import path from 'path'; + export default (huron) => ({ hot: true, + host: 'localhost', quiet: false, noInfo: false, + overlay: true, stats: { colors: true, hash: false, @@ -13,7 +17,5 @@ export default (huron) => ({ children: false, source: false, }, - contentBase: huron.root, - overlay: true, - publicPath: `http://localhost:${huron.port}/${huron.root}`, + publicPath: `/${huron.root}`, }); diff --git a/dist/cli/index.js b/dist/cli/index.js index 5bcf4ba..db14d93 100644 --- a/dist/cli/index.js +++ b/dist/cli/index.js @@ -68,2134 +68,360 @@ /************************************************************************/ /******/ ([ /* 0 */ +/* no static exports found */ +/* all exports used */ +/*!***********************!*\ + !*** external "path" ***! + \***********************/ /***/ (function(module, exports) { -module.exports = require("path"); +eval("module.exports = require(\"path\");//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMC5qcyIsInNvdXJjZXMiOlsid2VicGFjazovLy9leHRlcm5hbCBcInBhdGhcIj81YjJhIl0sInNvdXJjZXNDb250ZW50IjpbIm1vZHVsZS5leHBvcnRzID0gcmVxdWlyZShcInBhdGhcIik7XG5cblxuLy8vLy8vLy8vLy8vLy8vLy8vXG4vLyBXRUJQQUNLIEZPT1RFUlxuLy8gZXh0ZXJuYWwgXCJwYXRoXCJcbi8vIG1vZHVsZSBpZCA9IDBcbi8vIG1vZHVsZSBjaHVua3MgPSAwIl0sIm1hcHBpbmdzIjoiQUFBQSIsInNvdXJjZVJvb3QiOiIifQ=="); /***/ }), /* 1 */ +/* no static exports found */ +/* all exports used */ +/*!**************************!*\ + !*** ./src/cli/utils.js ***! + \**************************/ /***/ (function(module, exports, __webpack_require__) { "use strict"; - - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.normalizeSectionData = normalizeSectionData; -exports.writeSectionData = writeSectionData; -exports.getTemplateDataPair = getTemplateDataPair; -exports.normalizeHeader = normalizeHeader; -exports.wrapMarkup = wrapMarkup; -exports.generateFilename = generateFilename; -exports.writeFile = writeFile; -exports.removeFile = removeFile; -exports.writeSectionTemplate = writeSectionTemplate; -exports.getSection = getSection; -exports.matchKssDir = matchKssDir; -exports.mergeClassnameJSON = mergeClassnameJSON; -exports.removeTrailingSlash = removeTrailingSlash; - -var _path = __webpack_require__(0); - -var _path2 = _interopRequireDefault(_path); - -var _fsExtra = __webpack_require__(3); - -var _fsExtra2 = _interopRequireDefault(_fsExtra); - -var _chalk = __webpack_require__(2); - -var _chalk2 = _interopRequireDefault(_chalk); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -const cwd = process.cwd(); // Current working directory - -/** - * Ensure predictable data structure for KSS section data - * - * @function normalizeSectionData - * @param {object} section - section data - * @return {object} section data - */ -/** @module cli/utilities */ -function normalizeSectionData(section) { - const data = section.data || section; - - if (!data.referenceURI || '' === data.referenceURI) { - data.referenceURI = section.referenceURI(); - } - - return data; -} - -/** - * Ensure predictable data structure for KSS section data - * - * @function writeSectionData - * @param {object} store - data store - * @param {object} section - section data - * @param {string} sectionPath - output destination for section data file - */ -function writeSectionData(store, section, sectionPath = false) { - let outputPath = sectionPath; - let sectionFileInfo; - - if (!outputPath && {}.hasOwnProperty.call(section, 'kssPath')) { - sectionFileInfo = _path2.default.parse(section.kssPath); - outputPath = _path2.default.join(sectionFileInfo.dir, `${sectionFileInfo.name}.json`); - } - - // Output section data - if (outputPath) { - return writeFile(section.referenceURI, 'section', outputPath, JSON.stringify(section), store); - } - - console.warn( // eslint-disable-line no-console - _chalk2.default.red(`Failed to write section data for ${section.referenceURI}`)); - return false; -} - -/** - * Find .json from a template file or vice versa - * - * @function getTemplateDataPair - * @param {object} file - file object from path.parse() - * @param {object} section - KSS section data - * @return {string} relative path to module JSON file - */ -function getTemplateDataPair(file, section, store) { - const huron = store.get('config'); - const kssDir = matchKssDir(file.dir, huron); - - if (kssDir) { - const componentPath = _path2.default.relative(_path2.default.resolve(cwd, kssDir), file.dir); - const partnerType = '.json' === file.ext ? 'template' : 'data'; - const partnerExt = '.json' === file.ext ? huron.get('templates').extension : '.json'; - - const pairPath = _path2.default.join(componentPath, generateFilename(section.referenceURI, partnerType, partnerExt, store)); - - return `./${pairPath}`; - } - - return false; -} - -/** - * Normalize a section title for use as a filename - * - * @function normalizeHeader - * @param {string} header - section header extracted from KSS documentation - * @return {string} modified header, lowercase and words separated by dash - */ -function normalizeHeader(header) { - return header.toLowerCase().replace(/\s?\W\s?/g, '-'); -} - -/** - * Wrap html in required template tags - * - * @function wrapMarkup - * @param {string} content - html or template markup - * @param {string} templateId - id of template (should be section reference) - * @return {string} modified HTML - */ -function wrapMarkup(content, templateId) { - return ` - -\n`; -} - -/** - * Generate a filename based on referenceURI, type and file object - * - * @function generateFilename - * @param {string} id - The name of the file (with extension). - * @param {string} type - the type of file output - * @param {object} ext - file extension - * @param {store} store - data store - * @return {string} Path to output file, relative to ouput dir (can be use in require statements) - */ -function generateFilename(id, type, ext, store) { - // Type of file and its corresponding extension(s) - const types = store.get('types'); - const outputExt = '.scss' !== ext ? ext : '.html'; - - /* eslint-disable */ - if (-1 === types.indexOf(type)) { - console.log(`Huron data ${type} does not exist`); - return false; - } - /* eslint-enable */ - - return `${id}-${type}${outputExt}`; -} - -/** - * Copy an HTML file into the huron output directory. - * - * @function writeFile - * @param {string} id - The name of the file (with extension). - * @param {string} content - The content of the file to write. - * @param {string} type - the type of file output - * @param {object} store - The data store - * @return {string} Path to output file, relative to ouput dir (can be use in require statements) - */ -function writeFile(id, type, filepath, content, store) { - const huron = store.get('config'); - const file = _path2.default.parse(filepath); - const filename = generateFilename(id, type, file.ext, store); - const kssDir = matchKssDir(filepath, huron); - - if (kssDir) { - const componentPath = _path2.default.relative(_path2.default.resolve(cwd, kssDir), file.dir); - const outputRelative = _path2.default.join(huron.get('output'), componentPath, `${filename}`); - const outputPath = _path2.default.resolve(cwd, huron.get('root'), outputRelative); - let newContent = content; - - if ('data' !== type && 'section' !== type) { - newContent = wrapMarkup(content, id); - } - - try { - _fsExtra2.default.outputFileSync(outputPath, newContent); - console.log(_chalk2.default.green(`Writing ${outputRelative}`)); // eslint-disable-line no-console - } catch (e) { - console.log(_chalk2.default.red(`Failed to write ${outputRelative}`)); // eslint-disable-line no-console - } - - return `./${outputRelative.replace(`${huron.get('output')}/`, '')}`; - } - - return false; -} - -/** - * Delete a file in the huron output directory - * - * @function removeFile - * @param {string} filename - The name of the file (with extension). - * @param {object} store - The data store - * @return {string} Path to output file, relative to ouput dir (can be use in require statements) - */ -function removeFile(id, type, filepath, store) { - const huron = store.get('config'); - const file = _path2.default.parse(filepath); - const filename = generateFilename(id, type, file.ext, store); - const kssDir = matchKssDir(filepath, huron); - - if (kssDir) { - const componentPath = _path2.default.relative(_path2.default.resolve(cwd, kssDir), file.dir); - const outputRelative = _path2.default.join(huron.get('output'), componentPath, `${filename}`); - const outputPath = _path2.default.resolve(cwd, huron.get('root'), outputRelative); - - try { - _fsExtra2.default.removeSync(outputPath); - console.log(_chalk2.default.green(`Removing ${outputRelative}`)); // eslint-disable-line no-console - } catch (e) { - console.log( // eslint-disable-line no-console - _chalk2.default.red(`${outputRelative} does not exist or cannot be deleted`)); - } - - return `./${outputRelative.replace(`${huron.get('output')}/`, '')}`; - } - - return false; -} - -/** - * Write a template for sections - * - * @function writeSectionTemplate - * @param {string} filepath - the original template file - * @param {object} store - data store - * @return {object} updated store - */ -function writeSectionTemplate(filepath, store) { - const huron = store.get('config'); - const sectionTemplate = wrapMarkup(_fsExtra2.default.readFileSync(filepath, 'utf8')); - const componentPath = './huron-assets/section.hbs'; - const output = _path2.default.join(cwd, huron.get('root'), componentPath); - - // Move huron script and section template into huron root - _fsExtra2.default.outputFileSync(output, sectionTemplate); - console.log(_chalk2.default.green(`writing section template to ${output}`)); // eslint-disable-line no-console - - return store.set('sectionTemplatePath', componentPath); -} - -/** - * Request for section data based on section reference - * - * @function writeSectionTemplate - * @param {string} search - key on which to match section - * @param {field} string - field in which to look to determine section - * @param {obj} store - sections memory store - */ -function getSection(search, field, store) { - const sectionValues = store.getIn(['sections', 'sectionsByPath']).valueSeq(); - let selectedSection = false; - - if (field) { - selectedSection = sectionValues.filter(value => value[field] === search).get(0); - } else { - selectedSection = store.getIn(['sections', 'sectionsByPath', search]); - } - - return selectedSection; -} - -/** - * Find which configured KSS directory a filepath exists in - * - * @function matchKssDir - * @param {string} filepath - filepath to search for - * @param {object} huron - huron configuration - * @return {string} kssMatch - relative path to KSS directory - */ -function matchKssDir(filepath, huron) { - const kssSource = huron.get('kss'); - // Include forward slash in our test to make sure we're matchin a directory, not a file extension - const kssMatch = kssSource.filter(dir => filepath.includes(`/${dir}`)); - - if (kssMatch.length) { - return kssMatch[0]; - } - - return false; -} - -/** - * Merge JSON files for css modules classnames in a provided directory - * - * @function mergeClassnameJSON - * @param {string} directory - directory containing classname JSON files - * - * @return {object} classnamesMerged - merged classnames. contents of each JSON file is nested within - * the returned object by filename. (e.g. article.json -> { article: {...json contents}}) - */ -function mergeClassnameJSON(directory) { - let files; - - // If no config is provided, return immediately - if (!directory) { - return {}; - } - - // Try to read through classnames directory - try { - files = _fsExtra2.default.readdirSync(directory); - } catch (e) { - console.warn(_chalk2.default.red(e)); - } - - // Merge classname json files - const classNamesMerged = files.reduce((acc, file) => { - const fileInfo = _path2.default.parse(file); - let classNames = {}; - - if ('.json' === fileInfo.ext) { - try { - const contents = _fsExtra2.default.readFileSync(_path2.default.join(directory, file), 'utf8'); - classNames = JSON.parse(contents); - } catch (e) { - console.warn(_chalk2.default.red(e)); - } - } - - return Object.assign({}, acc, { [fileInfo.name]: classNames }); - }, {}); - - return classNamesMerged; -} - -/** - * Remove the trailing slash from a provided directory - * - * @function removeTrailingSlash - * @param {string} directory - directory path - * @return {string} directory - directory path with trailing slash removed - */ -function removeTrailingSlash(directory) { - if ('/' === directory.slice(-1)) { - return directory.slice(0, -1); - } - - return directory; -} +eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.normalizeSectionData = normalizeSectionData;\nexports.writeSectionData = writeSectionData;\nexports.getTemplateDataPair = getTemplateDataPair;\nexports.normalizeHeader = normalizeHeader;\nexports.wrapMarkup = wrapMarkup;\nexports.generateFilename = generateFilename;\nexports.writeFile = writeFile;\nexports.removeFile = removeFile;\nexports.writeSectionTemplate = writeSectionTemplate;\nexports.getSection = getSection;\nexports.matchKssDir = matchKssDir;\nexports.mergeClassnameJSON = mergeClassnameJSON;\nexports.removeTrailingSlash = removeTrailingSlash;\n\nvar _path = __webpack_require__(/*! path */ 0);\n\nvar _path2 = _interopRequireDefault(_path);\n\nvar _fsExtra = __webpack_require__(/*! fs-extra */ 3);\n\nvar _fsExtra2 = _interopRequireDefault(_fsExtra);\n\nvar _chalk = __webpack_require__(/*! chalk */ 2);\n\nvar _chalk2 = _interopRequireDefault(_chalk);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nconst cwd = process.cwd(); // Current working directory\n\n/**\n * Ensure predictable data structure for KSS section data\n *\n * @function normalizeSectionData\n * @param {object} section - section data\n * @return {object} section data\n */\n/** @module cli/utilities */\nfunction normalizeSectionData(section) {\n const data = section.data || section;\n\n if (!data.referenceURI || '' === data.referenceURI) {\n data.referenceURI = section.referenceURI();\n }\n\n return data;\n}\n\n/**\n * Ensure predictable data structure for KSS section data\n *\n * @function writeSectionData\n * @param {object} store - data store\n * @param {object} section - section data\n * @param {string} sectionPath - output destination for section data file\n */\nfunction writeSectionData(store, section, sectionPath = false) {\n let outputPath = sectionPath;\n let sectionFileInfo;\n\n if (!outputPath && {}.hasOwnProperty.call(section, 'kssPath')) {\n sectionFileInfo = _path2.default.parse(section.kssPath);\n outputPath = _path2.default.join(sectionFileInfo.dir, `${sectionFileInfo.name}.json`);\n }\n\n // Output section data\n if (outputPath) {\n return writeFile(section.referenceURI, 'section', outputPath, JSON.stringify(section), store);\n }\n\n console.warn( // eslint-disable-line no-console\n _chalk2.default.red(`Failed to write section data for ${section.referenceURI}`));\n return false;\n}\n\n/**\n * Find .json from a template file or vice versa\n *\n * @function getTemplateDataPair\n * @param {object} file - file object from path.parse()\n * @param {object} section - KSS section data\n * @return {string} relative path to module JSON file\n */\nfunction getTemplateDataPair(file, section, store) {\n const huron = store.get('config');\n const kssDir = matchKssDir(file.dir, huron);\n\n if (kssDir) {\n const componentPath = _path2.default.relative(_path2.default.resolve(cwd, kssDir), file.dir);\n const partnerType = '.json' === file.ext ? 'template' : 'data';\n const partnerExt = '.json' === file.ext ? huron.get('templates').extension : '.json';\n\n const pairPath = _path2.default.join(componentPath, generateFilename(section.referenceURI, partnerType, partnerExt, store));\n\n return `./${pairPath}`;\n }\n\n return false;\n}\n\n/**\n * Normalize a section title for use as a filename\n *\n * @function normalizeHeader\n * @param {string} header - section header extracted from KSS documentation\n * @return {string} modified header, lowercase and words separated by dash\n */\nfunction normalizeHeader(header) {\n return header.toLowerCase().replace(/\\s?\\W\\s?/g, '-');\n}\n\n/**\n * Wrap html in required template tags\n *\n * @function wrapMarkup\n * @param {string} content - html or template markup\n * @param {string} templateId - id of template (should be section reference)\n * @return {string} modified HTML\n */\nfunction wrapMarkup(content, templateId) {\n return `\n\n\\n`;\n}\n\n/**\n * Generate a filename based on referenceURI, type and file object\n *\n * @function generateFilename\n * @param {string} id - The name of the file (with extension).\n * @param {string} type - the type of file output\n * @param {object} ext - file extension\n * @param {store} store - data store\n * @return {string} Path to output file, relative to ouput dir (can be use in require statements)\n */\nfunction generateFilename(id, type, ext, store) {\n // Type of file and its corresponding extension(s)\n const types = store.get('types');\n const outputExt = '.scss' !== ext ? ext : '.html';\n\n /* eslint-disable */\n if (-1 === types.indexOf(type)) {\n console.log(`Huron data ${type} does not exist`);\n return false;\n }\n /* eslint-enable */\n\n return `${id}-${type}${outputExt}`;\n}\n\n/**\n * Copy an HTML file into the huron output directory.\n *\n * @function writeFile\n * @param {string} id - The name of the file (with extension).\n * @param {string} content - The content of the file to write.\n * @param {string} type - the type of file output\n * @param {object} store - The data store\n * @return {string} Path to output file, relative to ouput dir (can be use in require statements)\n */\nfunction writeFile(id, type, filepath, content, store) {\n const huron = store.get('config');\n const file = _path2.default.parse(filepath);\n const filename = generateFilename(id, type, file.ext, store);\n const kssDir = matchKssDir(filepath, huron);\n\n if (kssDir) {\n const componentPath = _path2.default.relative(_path2.default.resolve(cwd, kssDir), file.dir);\n const outputRelative = _path2.default.join(huron.get('output'), componentPath, `${filename}`);\n const outputPath = _path2.default.resolve(cwd, huron.get('root'), outputRelative);\n let newContent = content;\n\n if ('data' !== type && 'section' !== type) {\n newContent = wrapMarkup(content, id);\n }\n\n try {\n _fsExtra2.default.outputFileSync(outputPath, newContent);\n console.log(_chalk2.default.green(`Writing ${outputRelative}`)); // eslint-disable-line no-console\n } catch (e) {\n console.log(_chalk2.default.red(`Failed to write ${outputRelative}`)); // eslint-disable-line no-console\n }\n\n return `./${outputRelative.replace(`${huron.get('output')}/`, '')}`;\n }\n\n return false;\n}\n\n/**\n * Delete a file in the huron output directory\n *\n * @function removeFile\n * @param {string} filename - The name of the file (with extension).\n * @param {object} store - The data store\n * @return {string} Path to output file, relative to ouput dir (can be use in require statements)\n */\nfunction removeFile(id, type, filepath, store) {\n const huron = store.get('config');\n const file = _path2.default.parse(filepath);\n const filename = generateFilename(id, type, file.ext, store);\n const kssDir = matchKssDir(filepath, huron);\n\n if (kssDir) {\n const componentPath = _path2.default.relative(_path2.default.resolve(cwd, kssDir), file.dir);\n const outputRelative = _path2.default.join(huron.get('output'), componentPath, `${filename}`);\n const outputPath = _path2.default.resolve(cwd, huron.get('root'), outputRelative);\n\n try {\n _fsExtra2.default.removeSync(outputPath);\n console.log(_chalk2.default.green(`Removing ${outputRelative}`)); // eslint-disable-line no-console\n } catch (e) {\n console.log( // eslint-disable-line no-console\n _chalk2.default.red(`${outputRelative} does not exist or cannot be deleted`));\n }\n\n return `./${outputRelative.replace(`${huron.get('output')}/`, '')}`;\n }\n\n return false;\n}\n\n/**\n * Write a template for sections\n *\n * @function writeSectionTemplate\n * @param {string} filepath - the original template file\n * @param {object} store - data store\n * @return {object} updated store\n */\nfunction writeSectionTemplate(filepath, store) {\n const huron = store.get('config');\n const sectionTemplate = wrapMarkup(_fsExtra2.default.readFileSync(filepath, 'utf8'));\n const componentPath = './huron-assets/section.hbs';\n const output = _path2.default.join(cwd, huron.get('root'), componentPath);\n\n // Move huron script and section template into huron root\n _fsExtra2.default.outputFileSync(output, sectionTemplate);\n console.log(_chalk2.default.green(`writing section template to ${output}`)); // eslint-disable-line no-console\n\n return store.set('sectionTemplatePath', componentPath);\n}\n\n/**\n * Request for section data based on section reference\n *\n * @function writeSectionTemplate\n * @param {string} search - key on which to match section\n * @param {field} string - field in which to look to determine section\n * @param {obj} store - sections memory store\n */\nfunction getSection(search, field, store) {\n const sectionValues = store.getIn(['sections', 'sectionsByPath']).valueSeq();\n let selectedSection = false;\n\n if (field) {\n selectedSection = sectionValues.filter(value => value[field] === search).get(0);\n } else {\n selectedSection = store.getIn(['sections', 'sectionsByPath', search]);\n }\n\n return selectedSection;\n}\n\n/**\n * Find which configured KSS directory a filepath exists in\n *\n * @function matchKssDir\n * @param {string} filepath - filepath to search for\n * @param {object} huron - huron configuration\n * @return {string} kssMatch - relative path to KSS directory\n */\nfunction matchKssDir(filepath, huron) {\n const kssSource = huron.get('kss');\n // Include forward slash in our test to make sure we're matchin a directory, not a file extension\n const kssMatch = kssSource.filter(dir => filepath.includes(`/${dir}`));\n\n if (kssMatch.length) {\n return kssMatch[0];\n }\n\n return false;\n}\n\n/**\n * Merge JSON files for css modules classnames in a provided directory\n *\n * @function mergeClassnameJSON\n * @param {string} directory - directory containing classname JSON files\n *\n * @return {object} classnamesMerged - merged classnames. contents of each JSON file is nested within\n * the returned object by filename. (e.g. article.json -> { article: {...json contents}})\n */\nfunction mergeClassnameJSON(directory) {\n let files;\n\n // If no config is provided, return immediately\n if (!directory) {\n return {};\n }\n\n // Try to read through classnames directory\n try {\n files = _fsExtra2.default.readdirSync(directory);\n } catch (e) {\n console.warn(_chalk2.default.red(e));\n }\n\n // Merge classname json files\n const classNamesMerged = files.reduce((acc, file) => {\n const fileInfo = _path2.default.parse(file);\n let classNames = {};\n\n if ('.json' === fileInfo.ext) {\n try {\n const contents = _fsExtra2.default.readFileSync(_path2.default.join(directory, file), 'utf8');\n classNames = JSON.parse(contents);\n } catch (e) {\n console.warn(_chalk2.default.red(e));\n }\n }\n\n return Object.assign({}, acc, { [fileInfo.name]: classNames });\n }, {});\n\n return classNamesMerged;\n}\n\n/**\n * Remove the trailing slash from a provided directory\n *\n * @function removeTrailingSlash\n * @param {string} directory - directory path\n * @return {string} directory - directory path with trailing slash removed\n */\nfunction removeTrailingSlash(directory) {\n if ('/' === directory.slice(-1)) {\n return directory.slice(0, -1);\n }\n\n return directory;\n}//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMS5qcyIsInNvdXJjZXMiOlsid2VicGFjazovLy9zcmMvY2xpL3V0aWxzLmpzP2U3MWMiXSwic291cmNlc0NvbnRlbnQiOlsiLyoqIEBtb2R1bGUgY2xpL3V0aWxpdGllcyAqL1xuaW1wb3J0IHBhdGggZnJvbSAncGF0aCc7XG5pbXBvcnQgZnMgZnJvbSAnZnMtZXh0cmEnO1xuaW1wb3J0IGNoYWxrIGZyb20gJ2NoYWxrJztcblxuY29uc3QgY3dkID0gcHJvY2Vzcy5jd2QoKTsgLy8gQ3VycmVudCB3b3JraW5nIGRpcmVjdG9yeVxuXG4vKipcbiAqIEVuc3VyZSBwcmVkaWN0YWJsZSBkYXRhIHN0cnVjdHVyZSBmb3IgS1NTIHNlY3Rpb24gZGF0YVxuICpcbiAqIEBmdW5jdGlvbiBub3JtYWxpemVTZWN0aW9uRGF0YVxuICogQHBhcmFtIHtvYmplY3R9IHNlY3Rpb24gLSBzZWN0aW9uIGRhdGFcbiAqIEByZXR1cm4ge29iamVjdH0gc2VjdGlvbiBkYXRhXG4gKi9cbmV4cG9ydCBmdW5jdGlvbiBub3JtYWxpemVTZWN0aW9uRGF0YShzZWN0aW9uKSB7XG4gIGNvbnN0IGRhdGEgPSBzZWN0aW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Q0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUtBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7Ozs7Ozs7O0FBUUE7QUFDQTtBQUdBO0FBQ0E7QUFDQTtBQUNBO0FBR0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTs7Ozs7Ozs7QUFRQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTs7Ozs7Ozs7O0FBU0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUlBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOzs7Ozs7O0FBT0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0EiLCJzb3VyY2VSb290IjoiIn0="); /***/ }), /* 2 */ +/* no static exports found */ +/* all exports used */ +/*!************************!*\ + !*** external "chalk" ***! + \************************/ /***/ (function(module, exports) { -module.exports = require("chalk"); +eval("module.exports = require(\"chalk\");//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMi5qcyIsInNvdXJjZXMiOlsid2VicGFjazovLy9leHRlcm5hbCBcImNoYWxrXCI/NTNmNyJdLCJzb3VyY2VzQ29udGVudCI6WyJtb2R1bGUuZXhwb3J0cyA9IHJlcXVpcmUoXCJjaGFsa1wiKTtcblxuXG4vLy8vLy8vLy8vLy8vLy8vLy9cbi8vIFdFQlBBQ0sgRk9PVEVSXG4vLyBleHRlcm5hbCBcImNoYWxrXCJcbi8vIG1vZHVsZSBpZCA9IDJcbi8vIG1vZHVsZSBjaHVua3MgPSAwIl0sIm1hcHBpbmdzIjoiQUFBQSIsInNvdXJjZVJvb3QiOiIifQ=="); /***/ }), /* 3 */ +/* no static exports found */ +/* all exports used */ +/*!***************************!*\ + !*** external "fs-extra" ***! + \***************************/ /***/ (function(module, exports) { -module.exports = require("fs-extra"); +eval("module.exports = require(\"fs-extra\");//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMy5qcyIsInNvdXJjZXMiOlsid2VicGFjazovLy9leHRlcm5hbCBcImZzLWV4dHJhXCI/N2NhNiJdLCJzb3VyY2VzQ29udGVudCI6WyJtb2R1bGUuZXhwb3J0cyA9IHJlcXVpcmUoXCJmcy1leHRyYVwiKTtcblxuXG4vLy8vLy8vLy8vLy8vLy8vLy9cbi8vIFdFQlBBQ0sgRk9PVEVSXG4vLyBleHRlcm5hbCBcImZzLWV4dHJhXCJcbi8vIG1vZHVsZSBpZCA9IDNcbi8vIG1vZHVsZSBjaHVua3MgPSAwIl0sIm1hcHBpbmdzIjoiQUFBQSIsInNvdXJjZVJvb3QiOiIifQ=="); /***/ }), /* 4 */ +/* no static exports found */ +/* all exports used */ +/*!******************************!*\ + !*** ./src/cli/parseArgs.js ***! + \******************************/ /***/ (function(module, exports, __webpack_require__) { "use strict"; - - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _commander = __webpack_require__(21); - -var _commander2 = _interopRequireDefault(_commander); - -var _path = __webpack_require__(0); - -var _path2 = _interopRequireDefault(_path); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -// Requires -/** @global */ - -/** - * Process huron CLI arguments - * - * @function parseArgs - * @example node huron/dist/cli/huron-cli.js --config 'client/config/webpack.config.js' --production - */ -/** @module cli/parse-arguments */ -/* eslint-disable space-unary-ops */ - -function parseArgs() { - const envArg = {}; - - process.argv = process.argv.filter(arg => { - if (-1 !== arg.indexOf('--env')) { - const envParts = arg.split('.')[1].split('='); - - envArg[envParts[0]] = envParts[1] || true; - return false; - } - - return true; - }); - - _commander2.default.version('1.0.1').option('-c, --huron-config [huronConfig]', '[huronConfig] for all huron options', _path2.default.resolve(__dirname, '../defaultConfig/huron.config.js')).option('-w, --webpack-config [webpackConfig]', '[webpackConfig] for all webpack options', _path2.default.resolve(__dirname, '../defaultConfig/webpack.config.js')).option('-p, --production', 'compile assets once for production'); - - _commander2.default.env = envArg; - - // Only parse if we're not running tests - if (!process.env.npm_lifecycle_event || 'test' !== process.env.npm_lifecycle_event) { - _commander2.default.parse(process.argv); - } -} - -parseArgs(); -/* eslint-enable */ - -exports.default = _commander2.default; +eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _commander = __webpack_require__(/*! commander */ 21);\n\nvar _commander2 = _interopRequireDefault(_commander);\n\nvar _path = __webpack_require__(/*! path */ 0);\n\nvar _path2 = _interopRequireDefault(_path);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n// Requires\n/** @global */\n\n/**\n * Process huron CLI arguments\n *\n * @function parseArgs\n * @example node huron/dist/cli/huron-cli.js --config 'client/config/webpack.config.js' --production\n */\n/** @module cli/parse-arguments */\n/* eslint-disable space-unary-ops */\n\nfunction parseArgs() {\n const envArg = {};\n\n process.argv = process.argv.filter(arg => {\n if (-1 !== arg.indexOf('--env')) {\n const envParts = arg.split('.')[1].split('=');\n\n envArg[envParts[0]] = envParts[1] || true;\n return false;\n }\n\n return true;\n });\n\n _commander2.default.version('1.0.1').option('-c, --huron-config [huronConfig]', '[huronConfig] for all huron options', _path2.default.resolve(__dirname, '../defaultConfig/huron.config.js')).option('-w, --webpack-config [webpackConfig]', '[webpackConfig] for all webpack options', _path2.default.resolve(__dirname, '../defaultConfig/webpack.config.js')).option('-p, --production', 'compile assets once for production');\n\n _commander2.default.env = envArg;\n\n // Only parse if we're not running tests\n if (!process.env.npm_lifecycle_event || 'test' !== process.env.npm_lifecycle_event) {\n _commander2.default.parse(process.argv);\n }\n}\n\nparseArgs();\n/* eslint-enable */\n\nexports.default = _commander2.default;//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiNC5qcyIsInNvdXJjZXMiOlsid2VicGFjazovLy9zcmMvY2xpL3BhcnNlQXJncy5qcz9iYTdmIl0sInNvdXJjZXNDb250ZW50IjpbIi8qKiBAbW9kdWxlIGNsaS9wYXJzZS1hcmd1bWVudHMgKi9cbi8qIGVzbGludC1kaXNhYmxlIHNwYWNlLXVuYXJ5LW9wcyAqL1xuXG5pbXBvcnQgcHJvZ3JhbSBmcm9tICdjb21tYW5kZXInO1xuaW1wb3J0IHBhdGggZnJvbSAncGF0aCc7XG5cbi8vIFJlcXVpcmVzXG4vKiogQGdsb2JhbCAqL1xuXG4vKipcbiAqIFByb2Nlc3MgaHVyb24gQ0xJIGFyZ3VtZW50c1xuICpcbiAqIEBmdW5jdGlvbiBwYXJzZUFyZ3NcbiAqIEBleGFtcGxlIG5vZGUgaHVyb24vZGlzdC9jbGkvaHVyb24tY2xpLmpzIC0tY29uZmlnICdjbGllbnQvY29uZmlnL3dlYnBhY2suY29uZmlnLmpzJyAtLXByb2R1Y3Rpb25cbiAqL1xuZnVuY3Rpb24gcGFyc2VBcmdzKCkge1xuICBjb25zdCBlbnZBcmcgPSB7fTtcblxuICBwcm9jZXNzLmFyZ3YgPSBwcm9jZXNzLmFyZ3YuZmlsdGVyKChhcmcpID0+IHtcbiAgICBpZiAoLTEgIT09IGFyZy5pbmRleE9mKCctLWVudicpKSB7XG4gICAgICBjb25zdCBlbnZQYXJ0cyA9IGFyZ1xuICAgICAgICAuc3BsaXQoJy4nKVsxXVxuICAgICAgICAuc3BsaXQoJz0nKTtcblxuICAgICAgZW52QXJnW2VudlBhcnRzWzBdXSA9IGVudlBhcnRzWzFdIHx8IHRydWU7XG4gICAgICByZXR1cm4gZmFsc2U7XG4g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VBcmdzLmpzIl0sIm1hcHBpbmdzIjoiOzs7Ozs7QUFHQTtBQUNBOzs7QUFBQTtBQUNBOzs7OztBQUNBO0FBQ0E7QUFDQTtBQUNBOzs7Ozs7QUFUQTtBQUNBO0FBQ0E7QUFhQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUdBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQVlBO0FBQ0E7QUFDQTtBQUNBO0FBSUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QSIsInNvdXJjZVJvb3QiOiIifQ=="); /***/ }), /* 5 */ +/* no static exports found */ +/* all exports used */ +/*!**************************!*\ + !*** external "webpack" ***! + \**************************/ /***/ (function(module, exports) { -module.exports = require("webpack"); +eval("module.exports = require(\"webpack\");//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiNS5qcyIsInNvdXJjZXMiOlsid2VicGFjazovLy9leHRlcm5hbCBcIndlYnBhY2tcIj8zOTNkIl0sInNvdXJjZXNDb250ZW50IjpbIm1vZHVsZS5leHBvcnRzID0gcmVxdWlyZShcIndlYnBhY2tcIik7XG5cblxuLy8vLy8vLy8vLy8vLy8vLy8vXG4vLyBXRUJQQUNLIEZPT1RFUlxuLy8gZXh0ZXJuYWwgXCJ3ZWJwYWNrXCJcbi8vIG1vZHVsZSBpZCA9IDVcbi8vIG1vZHVsZSBjaHVua3MgPSAwIl0sIm1hcHBpbmdzIjoiQUFBQSIsInNvdXJjZVJvb3QiOiIifQ=="); /***/ }), /* 6 */ +/* no static exports found */ +/* all exports used */ +/*!*********************************!*\ + !*** ./src/cli/defaultStore.js ***! + \*********************************/ /***/ (function(module, exports, __webpack_require__) { "use strict"; - - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.config = exports.defaultStore = undefined; - -var _immutable = __webpack_require__(24); - -var _generateConfig = __webpack_require__(13); - -var _generateConfig2 = _interopRequireDefault(_generateConfig); - -var _utils = __webpack_require__(1); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -// Create initial data structure - -// Merge Huron default webpack config with user config -const config = (0, _generateConfig2.default)(); - -// Make sure the kss option is represented as an array -config.huron.kss = [].concat(config.huron.kss); - -/* eslint-disable */ -/** - * Initial structure for immutable data store - * - * @global - */ -const defaultStore = (0, _immutable.Map)({ - types: ['template', 'data', 'description', 'section', 'prototype', 'sections-template'], - config: (0, _immutable.Map)(config.huron), - classNames: (0, _utils.mergeClassnameJSON)(config.huron.classNames), - sections: (0, _immutable.Map)({ - sectionsByPath: (0, _immutable.Map)({}), - sectionsByURI: (0, _immutable.Map)({}), - sorted: {} - }), - templates: (0, _immutable.Map)({}), - prototypes: (0, _immutable.Map)({}), - sectionTemplatePath: '', - referenceDelimiter: '.' -}); -/* eslint-enable */ - -exports.defaultStore = defaultStore; -exports.config = config; +eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.config = exports.defaultStore = undefined;\n\nvar _immutable = __webpack_require__(/*! immutable */ 24);\n\nvar _generateConfig = __webpack_require__(/*! ./generateConfig */ 13);\n\nvar _generateConfig2 = _interopRequireDefault(_generateConfig);\n\nvar _utils = __webpack_require__(/*! ./utils */ 1);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n// Create initial data structure\n\n// Merge Huron default webpack config with user config\nconst config = (0, _generateConfig2.default)();\n\n// Make sure the kss option is represented as an array\nconfig.huron.kss = [].concat(config.huron.kss);\n\n/* eslint-disable */\n/**\n * Initial structure for immutable data store\n *\n * @global\n */\nconst defaultStore = (0, _immutable.Map)({\n types: ['template', 'data', 'description', 'section', 'prototype', 'sections-template'],\n config: (0, _immutable.Map)(config.huron),\n classNames: (0, _utils.mergeClassnameJSON)(config.huron.classNames),\n sections: (0, _immutable.Map)({\n sectionsByPath: (0, _immutable.Map)({}),\n sectionsByURI: (0, _immutable.Map)({}),\n sorted: {}\n }),\n templates: (0, _immutable.Map)({}),\n prototypes: (0, _immutable.Map)({}),\n sectionTemplatePath: '',\n referenceDelimiter: '.'\n});\n/* eslint-enable */\n\nexports.defaultStore = defaultStore;\nexports.config = config;//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiNi5qcyIsInNvdXJjZXMiOlsid2VicGFjazovLy9zcmMvY2xpL2RlZmF1bHRTdG9yZS5qcz8zNzBmIl0sInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IE1hcCB9IGZyb20gJ2ltbXV0YWJsZSc7XG5cbmltcG9ydCBnZW5lcmF0ZUNvbmZpZyBmcm9tICcuL2dlbmVyYXRlQ29uZmlnJztcbmltcG9ydCB7IG1lcmdlQ2xhc3NuYW1lSlNPTiB9IGZyb20gJy4vdXRpbHMnO1xuLy8gQ3JlYXRlIGluaXRpYWwgZGF0YSBzdHJ1Y3R1cmVcblxuLy8gTWVyZ2UgSHVyb24gZGVmYXVsdCB3ZWJwYWNrIGNvbmZpZyB3aXRoIHVzZXIgY29uZmlnXG5jb25zdCBjb25maWcgPSBnZW5lcmF0ZUNvbmZpZygpO1xuXG4vLyBNYWtlIHN1cmUgdGhlIGtzcyBvcHRpb24gaXMgcmVwcmVzZW50ZWQgYXMgYW4gYXJyYXlcbmNvbmZpZy5odXJvbi5rc3MgPSBbXS5jb25jYXQoY29uZmlnLmh1cm9uLmtzcyk7XG5cbi8qIGVzbGludC1kaXNhYmxlICovXG4vKipcbiAqIEluaXRpYWwgc3RydWN0dXJlIGZvciBpbW11dGFibGUgZGF0YSBzdG9yZVxuICpcbiAqIEBnbG9iYWxcbiAqL1xuY29uc3QgZGVmYXVsdFN0b3JlID0gTWFwKHtcbiAgdHlwZXM6IFtcbiAgICAndGVtcGxhdGUnLFxuICAgICdkYXRhJyxcbiAgICAnZGVzY3JpcHRpb24nLFxuICAgICdzZWN0aW9uJyxcbiAgICAncHJvdG90eXBlJyxcbiAgICAnc2VjdGlvbnMtdGVtcGxhdGUnLFxuICBdLFxuICBjb25maWc6IE1hcChjb25maWcuaHVyb24pLFxuICBjbGFzc05hbWVzOiBtZXJnZUNsYXNzbmFtZUpTT04oY29uZmlnLmh1cm9uLmNsYXNzTmFtZXMpLFxuICBzZWN0aW9uczogTWFwKHtcbiAgICBzZWN0aW9uc0J5UGF0aDogTWFwKHt9KSxcbiAgICBzZWN0aW9uc0J5VVJJOiBNYXAoe30pLFxuICAgIHNvcnRlZDoge30sXG4gIH0pLFxuICB0ZW1wbGF0ZXM6IE1hcCh7fSksXG4gIHByb3RvdHlwZXM6IE1hcCh7fSksXG4gIHNlY3Rpb25UZW1wbGF0ZVBhdGg6ICcnLFxuICByZWZlcmVuY2VEZWxpbWl0ZXI6ICcuJyxcbn0pO1xuLyogZXNsaW50LWVuYWJsZSAqL1xuXG5leHBvcnQgeyBkZWZhdWx0U3RvcmUsIGNvbmZpZyB9O1xuXG5cblxuLy8gV0VCUEFDSyBGT09URVIgLy9cbi8vIHNyYy9jbGkvZGVmYXVsdFN0b3JlLmpzIl0sIm1hcHBpbmdzIjoiOzs7Ozs7O0FBQUE7QUFDQTtBQUNBO0FBQ0E7OztBQUFBO0FBQ0E7OztBQUFBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOzs7OztBQUtBO0FBQ0E7QUFRQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFIQTtBQUtBO0FBQ0E7QUFDQTtBQUNBO0FBbkJBO0FBcUJBO0FBQ0E7QUFDQTtBQUFBIiwic291cmNlUm9vdCI6IiJ9"); /***/ }), /* 7 */ +/* no static exports found */ +/* all exports used */ +/*!************************************!*\ + !*** ./src/cli/handleTemplates.js ***! + \************************************/ /***/ (function(module, exports, __webpack_require__) { "use strict"; - - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.updateTemplate = updateTemplate; -exports.deleteTemplate = deleteTemplate; - -var _path = __webpack_require__(0); - -var _path2 = _interopRequireDefault(_path); - -var _fsExtra = __webpack_require__(3); - -var _fsExtra2 = _interopRequireDefault(_fsExtra); - -var _chalk = __webpack_require__(2); - -var _chalk2 = _interopRequireDefault(_chalk); - -var _utils = __webpack_require__(1); - -var utils = _interopRequireWildcard(_utils); - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/** - * Handle update of a template or data (json) file - * - * @function updateTemplate - * @param {string} filepath - filepath of changed file (comes from gaze) - * @param {object} section - contains KSS section data - * @param {object} store - memory store - * @return {object} updated memory store - */ -/** @module cli/template-handler */ -function updateTemplate(filepath, section, store) { - const file = _path2.default.parse(filepath); - const pairPath = utils.getTemplateDataPair(file, section, store); - const type = '.json' === file.ext ? 'data' : 'template'; - const newSection = section; - const newStore = store; - let content = false; - - try { - content = _fsExtra2.default.readFileSync(filepath, 'utf8'); - } catch (e) { - console.log(_chalk2.default.red(`${filepath} does not exist`)); - } - - if (content) { - const requirePath = utils.writeFile(newSection.referenceURI, type, filepath, content, newStore); - newSection[`${type}Path`] = requirePath; - - if ('template' === type) { - newSection.templateContent = content; - - // Rewrite section data with template content - newSection.sectionPath = utils.writeSectionData(newStore, newSection); - } - - return newStore.setIn(['templates', requirePath], pairPath).setIn(['sections', 'sectionsByPath', newSection.kssPath], newSection).setIn(['sections', 'sectionsByURI', newSection.referenceURI], newSection); - } - - return newStore; -} - -/** - * Handle removal of a template or data (json) file - * - * @function deleteTemplate - * @param {string} filepath - filepath of changed file (comes from gaze) - * @param {object} section - contains KSS section data - * @param {object} store - memory store - * @return {object} updated memory store - */ -function deleteTemplate(filepath, section, store) { - const file = _path2.default.parse(filepath); - const type = '.json' === file.ext ? 'data' : 'template'; - const newSection = section; - const newStore = store; - - // Remove partner - const requirePath = utils.removeFile(newSection.referenceURI, type, filepath, newStore); - delete newSection[`${type}Path`]; - - return newStore.deleteIn(['templates', requirePath]).setIn(['sections', 'sectionsByPath', newSection.kssPath], newSection).setIn(['sections', 'sectionsByURI', newSection.referenceURI], newSection); -} +eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.updateTemplate = updateTemplate;\nexports.deleteTemplate = deleteTemplate;\n\nvar _path = __webpack_require__(/*! path */ 0);\n\nvar _path2 = _interopRequireDefault(_path);\n\nvar _fsExtra = __webpack_require__(/*! fs-extra */ 3);\n\nvar _fsExtra2 = _interopRequireDefault(_fsExtra);\n\nvar _chalk = __webpack_require__(/*! chalk */ 2);\n\nvar _chalk2 = _interopRequireDefault(_chalk);\n\nvar _utils = __webpack_require__(/*! ./utils */ 1);\n\nvar utils = _interopRequireWildcard(_utils);\n\nfunction _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n/**\n * Handle update of a template or data (json) file\n *\n * @function updateTemplate\n * @param {string} filepath - filepath of changed file (comes from gaze)\n * @param {object} section - contains KSS section data\n * @param {object} store - memory store\n * @return {object} updated memory store\n */\n/** @module cli/template-handler */\nfunction updateTemplate(filepath, section, store) {\n const file = _path2.default.parse(filepath);\n const pairPath = utils.getTemplateDataPair(file, section, store);\n const type = '.json' === file.ext ? 'data' : 'template';\n const newSection = section;\n const newStore = store;\n let content = false;\n\n try {\n content = _fsExtra2.default.readFileSync(filepath, 'utf8');\n } catch (e) {\n console.log(_chalk2.default.red(`${filepath} does not exist`));\n }\n\n if (content) {\n const requirePath = utils.writeFile(newSection.referenceURI, type, filepath, content, newStore);\n newSection[`${type}Path`] = requirePath;\n\n if ('template' === type) {\n newSection.templateContent = content;\n\n // Rewrite section data with template content\n newSection.sectionPath = utils.writeSectionData(newStore, newSection);\n }\n\n return newStore.setIn(['templates', requirePath], pairPath).setIn(['sections', 'sectionsByPath', newSection.kssPath], newSection).setIn(['sections', 'sectionsByURI', newSection.referenceURI], newSection);\n }\n\n return newStore;\n}\n\n/**\n * Handle removal of a template or data (json) file\n *\n * @function deleteTemplate\n * @param {string} filepath - filepath of changed file (comes from gaze)\n * @param {object} section - contains KSS section data\n * @param {object} store - memory store\n * @return {object} updated memory store\n */\nfunction deleteTemplate(filepath, section, store) {\n const file = _path2.default.parse(filepath);\n const type = '.json' === file.ext ? 'data' : 'template';\n const newSection = section;\n const newStore = store;\n\n // Remove partner\n const requirePath = utils.removeFile(newSection.referenceURI, type, filepath, newStore);\n delete newSection[`${type}Path`];\n\n return newStore.deleteIn(['templates', requirePath]).setIn(['sections', 'sectionsByPath', newSection.kssPath], newSection).setIn(['sections', 'sectionsByURI', newSection.referenceURI], newSection);\n}//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiNy5qcyIsInNvdXJjZXMiOlsid2VicGFjazovLy9zcmMvY2xpL2hhbmRsZVRlbXBsYXRlcy5qcz8yYzdmIl0sInNvdXJjZXNDb250ZW50IjpbIi8qKiBAbW9kdWxlIGNsaS90ZW1wbGF0ZS1oYW5kbGVyICovXG5pbXBvcnQgcGF0aCBmcm9tICdwYXRoJztcbmltcG9ydCBmcyBmcm9tICdmcy1leHRyYSc7XG5pbXBvcnQgY2hhbGsgZnJvbSAnY2hhbGsnO1xuXG5pbXBvcnQgKiBhcyB1dGlscyBmcm9tICcuL3V0aWxzJztcblxuLyoqXG4gKiBIYW5kbGUgdXBkYXRlIG9mIGEgdGVtcGxhdGUgb3IgZGF0YSAoanNvbikgZmlsZVxuICpcbiAqIEBmdW5jdGlvbiB1cGRhdGVUZW1wbGF0ZVxuICogQHBhcmFtIHtzdHJpb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ZGxlVGVtcGxhdGVzLmpzIl0sIm1hcHBpbmdzIjoiOzs7OztBQWdCQTtBQTBEQTtBQUNBO0FBMUVBO0FBQ0E7OztBQUFBO0FBQ0E7OztBQUFBO0FBQ0E7OztBQUNBO0FBQ0E7QUFEQTtBQUNBOzs7OztBQUNBOzs7Ozs7Ozs7QUFQQTtBQWdCQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQU9BO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBYUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOzs7Ozs7Ozs7QUFTQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBTUE7QUFDQTtBQUNBO0FBVUEiLCJzb3VyY2VSb290IjoiIn0="); /***/ }), /* 8 */ +/* no static exports found */ +/* all exports used */ +/*!*************************************!*\ + !*** ./src/cli/requireTemplates.js ***! + \*************************************/ /***/ (function(module, exports, __webpack_require__) { "use strict"; - - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.writeStore = exports.requireTemplates = undefined; - -var _path = __webpack_require__(0); - -var _path2 = _interopRequireDefault(_path); - -var _fsExtra = __webpack_require__(3); - -var _fsExtra2 = _interopRequireDefault(_fsExtra); - -var _hotTemplate = __webpack_require__(20); - -var _hotTemplate2 = _interopRequireDefault(_hotTemplate); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/* eslint-enable */ - -const cwd = process.cwd(); - -// We need to prepend this to the browser script as a string but still want to transpile it, -// hence loading it using `raw-loader` so we receive a string from webpack -/* eslint-disable */ -/** @module cli/require-templates */ - -const huronScript = _fsExtra2.default.readFileSync(_path2.default.join(__dirname, '../web/index.js'), 'utf8'); - -/** - * Write code for requiring all generated huron assets - * - * @function requireTemplates - * @param {object} store - memory store - */ -const requireTemplates = exports.requireTemplates = function requireTemplates(store) { - const huron = store.get('config'); - const outputPath = _path2.default.join(cwd, huron.get('root'), 'huron-assets'); - // These will be used to replace strings in the hotTemplate. - // In order to accurately replace strings but still keep things parseable by eslint and babel, - // each replaceable value should be referenced in `hotTemplate.js` under the `hotScope` object. - // For example, if you need to replace a string with a value passed in from the CLI called `userVariable`, - // you would reference that string in `hotTemplate.js` with `hotScope.userVariable`. - const hotVariableScope = { - sectionTemplatePath: `'${huron.get('sectionTemplate')}'`, - requireRegex: new RegExp(`\\.html|\\.json|\\${huron.get('templates').extension}$`), - requirePath: `'../${huron.get('output')}'` - }; - const hotTemplateTransformed = Object.keys(hotVariableScope).reduce((acc, curr) => acc.replace(new RegExp(`hotScope.${curr}`, 'g'), hotVariableScope[curr]), _hotTemplate2.default); - - // Write the contents of this script. - _fsExtra2.default.outputFileSync(_path2.default.join(outputPath, 'index.js'), hotTemplateTransformed); - _fsExtra2.default.outputFileSync(_path2.default.join(outputPath, 'insertNodes.js'), huronScript); -}; - -/** - * Output entire data store to a JS object and handle if any KSS data has changed - * - * @function writeStore - * @param {object} store - memory store - * @param {string} changed - filepath of changed KSS section, if applicable - */ -const writeStore = exports.writeStore = function writeStore(store, newStore = false) { - const updatedStore = newStore || store; - const huron = updatedStore.get('config'); - const outputPath = _path2.default.join(cwd, huron.get('root'), 'huron-assets'); - - // Write updated data store - _fsExtra2.default.outputFileSync(_path2.default.join(outputPath, 'huron-store.js'), `module.exports = ${JSON.stringify(updatedStore.toJSON())}`); -}; +eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.writeStore = exports.requireTemplates = undefined;\n\nvar _path = __webpack_require__(/*! path */ 0);\n\nvar _path2 = _interopRequireDefault(_path);\n\nvar _fsExtra = __webpack_require__(/*! fs-extra */ 3);\n\nvar _fsExtra2 = _interopRequireDefault(_fsExtra);\n\nvar _hotTemplate = __webpack_require__(/*! raw-loader!babel-loader!../../templates/hotTemplate */ 20);\n\nvar _hotTemplate2 = _interopRequireDefault(_hotTemplate);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n/* eslint-enable */\n\nconst cwd = process.cwd();\n\n// We need to prepend this to the browser script as a string but still want to transpile it,\n// hence loading it using `raw-loader` so we receive a string from webpack\n/* eslint-disable */\n/** @module cli/require-templates */\n\nconst huronScript = _fsExtra2.default.readFileSync(_path2.default.join(__dirname, '../web/index.js'), 'utf8');\n\n/**\n * Write code for requiring all generated huron assets\n *\n * @function requireTemplates\n * @param {object} store - memory store\n */\nconst requireTemplates = exports.requireTemplates = function requireTemplates(store) {\n const huron = store.get('config');\n const outputPath = _path2.default.join(cwd, huron.get('root'), 'huron-assets');\n // These will be used to replace strings in the hotTemplate.\n // In order to accurately replace strings but still keep things parseable by eslint and babel,\n // each replaceable value should be referenced in `hotTemplate.js` under the `hotScope` object.\n // For example, if you need to replace a string with a value passed in from the CLI called `userVariable`,\n // you would reference that string in `hotTemplate.js` with `hotScope.userVariable`.\n const hotVariableScope = {\n sectionTemplatePath: `'${huron.get('sectionTemplate')}'`,\n requireRegex: new RegExp(`\\\\.html|\\\\.json|\\\\${huron.get('templates').extension}$`),\n requirePath: `'../${huron.get('output')}'`\n };\n const hotTemplateTransformed = Object.keys(hotVariableScope).reduce((acc, curr) => acc.replace(new RegExp(`hotScope.${curr}`, 'g'), hotVariableScope[curr]), _hotTemplate2.default);\n\n // Write the contents of this script.\n _fsExtra2.default.outputFileSync(_path2.default.join(outputPath, 'index.js'), hotTemplateTransformed);\n _fsExtra2.default.outputFileSync(_path2.default.join(outputPath, 'insertNodes.js'), huronScript);\n};\n\n/**\n * Output entire data store to a JS object and handle if any KSS data has changed\n *\n * @function writeStore\n * @param {object} store - memory store\n * @param {string} changed - filepath of changed KSS section, if applicable\n */\nconst writeStore = exports.writeStore = function writeStore(store, newStore = false) {\n const updatedStore = newStore || store;\n const huron = updatedStore.get('config');\n const outputPath = _path2.default.join(cwd, huron.get('root'), 'huron-assets');\n\n // Write updated data store\n _fsExtra2.default.outputFileSync(_path2.default.join(outputPath, 'huron-store.js'), `module.exports = ${JSON.stringify(updatedStore.toJSON())}`);\n};//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiOC5qcyIsInNvdXJjZXMiOlsid2VicGFjazovLy9zcmMvY2xpL3JlcXVpcmVUZW1wbGF0ZXMuanM/ZmViYSJdLCJzb3VyY2VzQ29udGVudCI6WyIvKiogQG1vZHVsZSBjbGkvcmVxdWlyZS10ZW1wbGF0ZXMgKi9cbmltcG9ydCBwYXRoIGZyb20gJ3BhdGgnO1xuaW1wb3J0IGZzIGZyb20gJ2ZzLWV4dHJhJztcblxuLy8gV2UgbmVlZCB0byBwcmVwZW5kIHRoaXMgdG8gdGhlIGJyb3dzZXIgc2NyaXB0IGFzIGEgc3RyaW5nIGJ1dCBzdGlsbCB3YW50IHRvIHRyYW5zcGlsZSBpdCxcbi8vIGhlbmNlIGxvYWRpbmcgaXQgdXNpbmcgYHJhdy1sb2FkZXJgIHNvIHdlIHJlY2VpdmUgYSBzdHJpbmcgZnJvbSB3ZWJwYWNrXG4vKiBlc2xpbnQtZGlzYWJsZSAqL1xuaW1wb3J0IGhvdFRlbXBsYXRlIGZyb20gJyFyYXctbG9hZGVyIWJhYmVsLWxvYWRlciEuLi8uLi90ZW1wbGF0ZXMvaG90VGVtcGxhdGUnO1xuLyogZXNsaW50LWVuYWJsZSAqL1xuXG5jb25zdCBjd2QgPSBwcm9jZXNzLmN3ZCgpO1xuY29uc3QgaHVyb25TY3JpcHQgPSBmcy5yZWFkRmlsZVN5bmMoXG4gIHBhdGguam9pbihfX2Rpcm5hbWUsICcuLi93ZWIvaW5kZXguanMnKSxcbiAgJ3V0ZjgnXG4pO1xuXG4vKipcbiAqIFdyaXRlIGNvZGUgZm9yIHJlcXVpcmluZyBhbGwgZ2VuZXJhdGVkIGh1cm9u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BOzs7Ozs7O0FBT0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFJQSIsInNvdXJjZVJvb3QiOiIifQ=="); /***/ }), /* 9 */ +/* no static exports found */ +/* all exports used */ +/*!**************************!*\ + !*** ./src/cli/index.js ***! + \**************************/ /***/ (function(module, exports, __webpack_require__) { "use strict"; - - -var _chalk = __webpack_require__(2); - -var _chalk2 = _interopRequireDefault(_chalk); - -var _actions = __webpack_require__(11); - -var _requireTemplates = __webpack_require__(8); - -var _utils = __webpack_require__(1); - -var _parseArgs = __webpack_require__(4); - -var _parseArgs2 = _interopRequireDefault(_parseArgs); - -var _server = __webpack_require__(17); - -var _server2 = _interopRequireDefault(_server); - -var _defaultStore = __webpack_require__(6); - -var _fileWatcher = __webpack_require__(12); - -var _fileWatcher2 = _interopRequireDefault(_fileWatcher); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/** - * Initialize data store with files from gaze and original data structure - * - * @global - */ -// Local imports -const huron = _defaultStore.defaultStore.get('config'); -let store = (0, _actions.initFiles)(_fileWatcher2.default.watched(), _defaultStore.defaultStore); - -(0, _requireTemplates.requireTemplates)(store); -(0, _requireTemplates.writeStore)(store); - -// If building for production, close gaze and exit process once initFiles is done. -if (_parseArgs2.default.production) { - _fileWatcher2.default.close(); -} - -/** @module cli/gaze */ -_fileWatcher2.default.on('all', (event, filepath) => { - store = (0, _actions.updateClassNames)(filepath, store); - (0, _requireTemplates.writeStore)(store); -}); - -/** - * Anonymous handler for Gaze 'changed' event indicating a file has changed - * - * @callback changed - * @listens gaze:changed - * @param {string} filepath - absolute path of changed file - */ -_fileWatcher2.default.on('changed', filepath => { - if ((0, _utils.matchKssDir)(filepath, huron)) { - store = (0, _actions.updateFile)(filepath, store); - } - - console.log(_chalk2.default.green(`${filepath} updated!`)); -}); - -/** - * Anonymous handler for Gaze 'added' event indicating a file has been added to the watched directories - * - * @callback added - * @listens gaze:added - * @param {string} filepath - absolute path of changed file - */ -_fileWatcher2.default.on('added', filepath => { - if ((0, _utils.matchKssDir)(filepath, huron)) { - store = (0, _actions.updateFile)(filepath, store); - (0, _requireTemplates.writeStore)(store); - } - - console.log(_chalk2.default.blue(`${filepath} added!`)); -}); - -/** - * Anonymous handler for Gaze 'renamed' event indicating a file has been renamed - * - * @callback renamed - * @listens gaze:renamed - * @param {string} filepath - absolute path of changed file - */ -_fileWatcher2.default.on('renamed', (newPath, oldPath) => { - if ((0, _utils.matchKssDir)(newPath, huron)) { - store = (0, _actions.deleteFile)(oldPath, store); - store = (0, _actions.updateFile)(newPath, store); - (0, _requireTemplates.writeStore)(store); - } - - console.log(_chalk2.default.blue(`${newPath} added!`)); -}); - -/** - * Anonymous handler for Gaze 'deleted' event indicating a file has been removed - * - * @callback deleted - * @listens gaze:deleted - * @param {string} filepath - absolute path of changed file - */ -_fileWatcher2.default.on('deleted', filepath => { - if ((0, _utils.matchKssDir)(filepath, huron)) { - store = (0, _actions.deleteFile)(filepath, store); - (0, _requireTemplates.writeStore)(store); - } - - console.log(_chalk2.default.red(`${filepath} deleted`)); -}); - -// Start webpack or build for production -(0, _server2.default)(_defaultStore.config); +eval("\n\nvar _chalk = __webpack_require__(/*! chalk */ 2);\n\nvar _chalk2 = _interopRequireDefault(_chalk);\n\nvar _actions = __webpack_require__(/*! ./actions */ 11);\n\nvar _requireTemplates = __webpack_require__(/*! ./requireTemplates */ 8);\n\nvar _utils = __webpack_require__(/*! ./utils */ 1);\n\nvar _parseArgs = __webpack_require__(/*! ./parseArgs */ 4);\n\nvar _parseArgs2 = _interopRequireDefault(_parseArgs);\n\nvar _server = __webpack_require__(/*! ./server */ 17);\n\nvar _server2 = _interopRequireDefault(_server);\n\nvar _defaultStore = __webpack_require__(/*! ./defaultStore */ 6);\n\nvar _fileWatcher = __webpack_require__(/*! ./fileWatcher */ 12);\n\nvar _fileWatcher2 = _interopRequireDefault(_fileWatcher);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n/**\n * Initialize data store with files from gaze and original data structure\n *\n * @global\n */\n// Local imports\nconst huron = _defaultStore.defaultStore.get('config');\nlet store = (0, _actions.initFiles)(_fileWatcher2.default.watched(), _defaultStore.defaultStore);\n\n(0, _requireTemplates.requireTemplates)(store);\n(0, _requireTemplates.writeStore)(store);\n\n// If building for production, close gaze and exit process once initFiles is done.\nif (_parseArgs2.default.production) {\n _fileWatcher2.default.close();\n}\n\n/** @module cli/gaze */\n_fileWatcher2.default.on('all', (event, filepath) => {\n store = (0, _actions.updateClassNames)(filepath, store);\n (0, _requireTemplates.writeStore)(store);\n});\n\n/**\n * Anonymous handler for Gaze 'changed' event indicating a file has changed\n *\n * @callback changed\n * @listens gaze:changed\n * @param {string} filepath - absolute path of changed file\n */\n_fileWatcher2.default.on('changed', filepath => {\n if ((0, _utils.matchKssDir)(filepath, huron)) {\n store = (0, _actions.updateFile)(filepath, store);\n }\n\n console.log(_chalk2.default.green(`${filepath} updated!`));\n});\n\n/**\n * Anonymous handler for Gaze 'added' event indicating a file has been added to the watched directories\n *\n * @callback added\n * @listens gaze:added\n * @param {string} filepath - absolute path of changed file\n */\n_fileWatcher2.default.on('added', filepath => {\n if ((0, _utils.matchKssDir)(filepath, huron)) {\n store = (0, _actions.updateFile)(filepath, store);\n (0, _requireTemplates.writeStore)(store);\n }\n\n console.log(_chalk2.default.blue(`${filepath} added!`));\n});\n\n/**\n * Anonymous handler for Gaze 'renamed' event indicating a file has been renamed\n *\n * @callback renamed\n * @listens gaze:renamed\n * @param {string} filepath - absolute path of changed file\n */\n_fileWatcher2.default.on('renamed', (newPath, oldPath) => {\n if ((0, _utils.matchKssDir)(newPath, huron)) {\n store = (0, _actions.deleteFile)(oldPath, store);\n store = (0, _actions.updateFile)(newPath, store);\n (0, _requireTemplates.writeStore)(store);\n }\n\n console.log(_chalk2.default.blue(`${newPath} added!`));\n});\n\n/**\n * Anonymous handler for Gaze 'deleted' event indicating a file has been removed\n *\n * @callback deleted\n * @listens gaze:deleted\n * @param {string} filepath - absolute path of changed file\n */\n_fileWatcher2.default.on('deleted', filepath => {\n if ((0, _utils.matchKssDir)(filepath, huron)) {\n store = (0, _actions.deleteFile)(filepath, store);\n (0, _requireTemplates.writeStore)(store);\n }\n\n console.log(_chalk2.default.red(`${filepath} deleted`));\n});\n\n// Start webpack or build for production\n(0, _server2.default)(_defaultStore.config);//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiOS5qcyIsInNvdXJjZXMiOlsid2VicGFjazovLy9zcmMvY2xpL2luZGV4LmpzPzg2N2IiXSwic291cmNlc0NvbnRlbnQiOlsiLy8gTG9jYWwgaW1wb3J0c1xuaW1wb3J0IGNoYWxrIGZyb20gJ2NoYWxrJztcblxuaW1wb3J0IHtcbiAgaW5pdEZpbGVzLFxuICB1cGRhdGVGaWxlLFxuICBkZWxldGVGaWxlLFxuICB1cGRhdGVDbGFzc05hbWVzLFxufSBmcm9tICcuL2FjdGlvbnMnO1xuaW1wb3J0IHsgcmVxdWlyZVRlbXBsYXRlcywgd3JpdGVTdG9yZSB9IGZyb20gJy4vcmVxdWlyZVRlbXBsYXRlcyc7XG5pbXBvcnQgeyBtYXRjaEtzc0RpciB9IGZyb20gJy4vdXRpbHMnO1xuaW1wb3J0IHByb2dyYW0gZnJvbSAnLi9wYXJzZUFyZ3MnO1xuaW1wb3J0IHN0YXJ0V2VicGFjayBmcm9tICcuL3NlcnZlcic7XG5pbXBvcnQgeyBkZWZhdWx0U3RvcmUsIGNvbmZpZyB9IGZyb20gJy4vZGVmYXVsdFN0b3JlJztcbmltcG9ydCBnYXplIGZyb20gJy4vZmlsZVdhdGNoZXInO1xuXG4vKipcbiAqIEluaXRpYWxpemUgZGF0YSBzdG9yZSB3aXRoIGZpbGVzIGZyb20gZ2F6ZSBhbmQgb3JpZ2luYWwgZGF0YSBzdHJ1Y3R1cmVcbiAqXG4gKiBAZ2xvYmFsXG4gKi9cbmNvbnN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FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOzs7Ozs7O0FBT0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOzs7Ozs7O0FBT0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7Ozs7Ozs7QUFPQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOzs7Ozs7O0FBT0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQSIsInNvdXJjZVJvb3QiOiIifQ=="); /***/ }), /* 10 */ +/* no static exports found */ +/* all exports used */ +/*!************************************!*\ + !*** ./config/devServer.config.js ***! + \************************************/ /***/ (function(module, exports, __webpack_require__) { "use strict"; - - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -exports.default = huron => ({ - hot: true, - quiet: false, - noInfo: false, - stats: { - colors: true, - hash: false, - version: false, - assets: false, - chunks: false, - modules: false, - reasons: false, - children: false, - source: false - }, - contentBase: huron.root, - overlay: true, - publicPath: `http://localhost:${huron.port}/${huron.root}` -}); +eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\n// import path from 'path';\n\nexports.default = huron => ({\n hot: true,\n host: 'localhost',\n quiet: false,\n noInfo: false,\n overlay: true,\n stats: {\n colors: true,\n hash: false,\n version: false,\n assets: false,\n chunks: false,\n modules: false,\n reasons: false,\n children: false,\n source: false\n },\n publicPath: `/${huron.root}`\n});//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMTAuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vY29uZmlnL2RldlNlcnZlci5jb25maWcuanM/YzhlNCJdLCJzb3VyY2VzQ29udGVudCI6WyIvLyBpbXBvcnQgcGF0aCBmcm9tICdwYXRoJztcblxuZXhwb3J0IGRlZmF1bHQgKGh1cm9uKSA9PiAoe1xuICBob3Q6IHRydWUsXG4gIGhvc3Q6ICdsb2NhbGhvc3QnLFxuICBxdWlldDogZmFsc2UsXG4gIG5vSW5mbzogZmFsc2UsXG4gIG92ZXJsYXk6IHRydWUsXG4gIHN0YXRzOiB7XG4gICAgY29sb3JzOiB0cnVlLFxuICAgIGhhc2g6IGZhbHNlLFxuICAgIHZlcnNpb246IGZhbHNlLFxuICAgIGFzc2V0czogZmFsc2UsXG4gICAgY2h1bmtzOiBmYWxzZSxcbiAgICBtb2R1bGVzOiBmYWxzZSxcbiAgICByZWFzb25zOiBmYWxzZSxcbiAgICBjaGlsZHJlbjogZmFsc2UsXG4gICAgc291cmNlOiBmYWxzZSxcbiAgfSxcbiAgcHVibGljUGF0aDogYC8ke2h1cm9uLnJvb3R9YCxcbn0pO1xuXG5cblxuLy8gV0VCUEFDSyBGT09URVIgLy9cbi8vIGNvbmZpZy9kZXZTZXJ2ZXIuY29uZmlnLmpzIl0sIm1hcHBpbmdzIjoiOzs7Ozs7QUFBQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFUQTtBQVdBO0FBakJBIiwic291cmNlUm9vdCI6IiJ9"); /***/ }), /* 11 */ +/* no static exports found */ +/* all exports used */ +/*!****************************!*\ + !*** ./src/cli/actions.js ***! + \****************************/ /***/ (function(module, exports, __webpack_require__) { "use strict"; - - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.initFiles = initFiles; -exports.updateFile = updateFile; -exports.deleteFile = deleteFile; -exports.updateClassNames = updateClassNames; - -var _path = __webpack_require__(0); - -var _path2 = _interopRequireDefault(_path); - -var _chalk = __webpack_require__(2); - -var _chalk2 = _interopRequireDefault(_chalk); - -var _isEqual = __webpack_require__(26); - -var _isEqual2 = _interopRequireDefault(_isEqual); - -var _handleHTML = __webpack_require__(14); - -var _handleTemplates = __webpack_require__(7); - -var _handleKSS = __webpack_require__(15); - -var _utils = __webpack_require__(1); - -var utils = _interopRequireWildcard(_utils); - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/** - * Recursively loop through initial watched files list from Gaze. - * - * @param {object} data - object containing directory and file paths - * @param {object} store - memory store - * @return {object} newStore - map object of entire data store - */ -function initFiles(data, store, depth = 0) { - const type = Object.prototype.toString.call(data); - const huron = store.get('config'); - let newStore = store; - let info; - let files; - - switch (type) { - case '[object Object]': - files = Object.keys(data); - newStore = files.reduce((prevStore, file) => initFiles(data[file], prevStore, depth), newStore); - break; - - case '[object Array]': - newStore = data.reduce((prevStore, file) => initFiles(file, prevStore, depth), newStore); - break; - - case '[object String]': - info = _path2.default.parse(data); - - // Only call update if data is a filepath and it's within the KSS source directory - if (info.ext && !data.includes(huron.get('classNames'))) { - newStore = updateFile(data, store); - } - break; - - default: - break; - } - - return newStore; -} - -/** - * Logic for updating and writing file information based on file type (extension) - * - * @param {string} filepath - path to updated file. usually passed in from Gaze - * @param {object} store - memory store - * @return {object} store - map object of map object of entire data store - */ -/** @module cli/actions */ - -// Imports -function updateFile(filepath, store) { - const huron = store.get('config'); - const file = _path2.default.parse(filepath); - let field; - let section; - - if (filepath.includes(huron.get('sectionTemplate'))) { - return utils.writeSectionTemplate(filepath, store); - } - - switch (file.ext) { - // Plain HTML template, external - case '.html': - section = utils.getSection(file.base, 'markup', store); - - if (section) { - return (0, _handleHTML.updateHTML)(filepath, section, store); - } else if (file.dir.includes('prototypes') && file.name.includes('prototype-')) { - return (0, _handleHTML.updatePrototype)(filepath, store); - } - - console.log(_chalk2.default.red(`Failed to write file: ${file.name}`)); - break; - - // Handlebars template, external - case huron.get('templates').extension: - case '.json': - field = '.json' === file.ext ? 'data' : 'markup'; - section = utils.getSection(file.base, field, store); - - if (section) { - return (0, _handleTemplates.updateTemplate)(filepath, section, store); - } - - console.log( // eslint-disable-line no-console - _chalk2.default.red(`Could not find associated KSS section for ${filepath}`)); - break; - - // KSS documentation (default extension is `.css`) - // Will also output a template if markup is inline - // Note: inline markup does _not_ support handlebars currently - case huron.get('kssExtension'): - return (0, _handleKSS.updateKSS)(filepath, store); - - // This should never happen if Gaze is working properly - default: - return store; - } - - return store; -} - -/** - * Logic for deleting file information and files based on file type (extension) - * - * @param {string} filepath - path to updated file. usually passed in from Gaze - * @param {object} store - memory store - * @return {object} newStore - map object of map object of entire data store - */ -function deleteFile(filepath, store) { - const huron = store.get('config'); - const file = _path2.default.parse(filepath); - let field = ''; - let section = null; - let newStore = store; - - switch (file.ext) { - // Plain HTML template, external - case '.html': - section = utils.getSection(file.base, 'markup', store); - - if (section) { - newStore = (0, _handleHTML.deleteHTML)(filepath, section, store); - } else if (file.dir.includes('prototypes') && file.name.includes('prototype-')) { - newStore = (0, _handleHTML.deletePrototype)(filepath, store); - } - break; - - case huron.get('templates').extension: - case '.json': - field = '.json' === file.ext ? 'data' : 'markup'; - section = utils.getSection(file.base, field, store); - - if (section) { - newStore = (0, _handleTemplates.deleteTemplate)(filepath, section, store); - } - break; - - case huron.get('kssExtension'): - section = utils.getSection(filepath, false, store); - - if (section) { - newStore = (0, _handleKSS.deleteKSS)(filepath, section, store); - } - break; - - default: - console.warn( // eslint-disable-line no-console - _chalk2.default.red(`Could not delete: ${file.name}`)); - break; - } - - return newStore; -} - -/** - * Logic for updating localized classnames from CSS modules - * - * @param {string} filepath - path to updated file. usually passed in from Gaze - * @param {object} store - memory store - * - * @return void - */ -function updateClassNames(filepath, store) { - const classNamesPath = store.getIn(['config', 'classNames']); - - if (filepath.includes(classNamesPath)) { - const oldClassnames = store.get('classNames'); - const newClassnames = utils.mergeClassnameJSON(classNamesPath); - - if (!(0, _isEqual2.default)(oldClassnames, newClassnames)) { - return store.set('classNames', newClassnames); - } - } - - return store; -} +eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.initFiles = initFiles;\nexports.updateFile = updateFile;\nexports.deleteFile = deleteFile;\nexports.updateClassNames = updateClassNames;\n\nvar _path = __webpack_require__(/*! path */ 0);\n\nvar _path2 = _interopRequireDefault(_path);\n\nvar _chalk = __webpack_require__(/*! chalk */ 2);\n\nvar _chalk2 = _interopRequireDefault(_chalk);\n\nvar _isEqual = __webpack_require__(/*! lodash/isEqual */ 26);\n\nvar _isEqual2 = _interopRequireDefault(_isEqual);\n\nvar _handleHTML = __webpack_require__(/*! ./handleHTML */ 14);\n\nvar _handleTemplates = __webpack_require__(/*! ./handleTemplates */ 7);\n\nvar _handleKSS = __webpack_require__(/*! ./handleKSS */ 15);\n\nvar _utils = __webpack_require__(/*! ./utils */ 1);\n\nvar utils = _interopRequireWildcard(_utils);\n\nfunction _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n/**\n * Recursively loop through initial watched files list from Gaze.\n *\n * @param {object} data - object containing directory and file paths\n * @param {object} store - memory store\n * @return {object} newStore - map object of entire data store\n */\nfunction initFiles(data, store, depth = 0) {\n const type = Object.prototype.toString.call(data);\n const huron = store.get('config');\n let newStore = store;\n let info;\n let files;\n\n switch (type) {\n case '[object Object]':\n files = Object.keys(data);\n newStore = files.reduce((prevStore, file) => initFiles(data[file], prevStore, depth), newStore);\n break;\n\n case '[object Array]':\n newStore = data.reduce((prevStore, file) => initFiles(file, prevStore, depth), newStore);\n break;\n\n case '[object String]':\n info = _path2.default.parse(data);\n\n // Only call update if data is a filepath and it's within the KSS source directory\n if (info.ext && !data.includes(huron.get('classNames'))) {\n newStore = updateFile(data, store);\n }\n break;\n\n default:\n break;\n }\n\n return newStore;\n}\n\n/**\n * Logic for updating and writing file information based on file type (extension)\n *\n * @param {string} filepath - path to updated file. usually passed in from Gaze\n * @param {object} store - memory store\n * @return {object} store - map object of map object of entire data store\n */\n/** @module cli/actions */\n\n// Imports\nfunction updateFile(filepath, store) {\n const huron = store.get('config');\n const file = _path2.default.parse(filepath);\n let field;\n let section;\n\n if (filepath.includes(huron.get('sectionTemplate'))) {\n return utils.writeSectionTemplate(filepath, store);\n }\n\n switch (file.ext) {\n // Plain HTML template, external\n case '.html':\n section = utils.getSection(file.base, 'markup', store);\n\n if (section) {\n return (0, _handleHTML.updateHTML)(filepath, section, store);\n } else if (file.dir.includes('prototypes') && file.name.includes('prototype-')) {\n return (0, _handleHTML.updatePrototype)(filepath, store);\n }\n\n console.log(_chalk2.default.red(`Failed to write file: ${file.name}`));\n break;\n\n // Handlebars template, external\n case huron.get('templates').extension:\n case '.json':\n field = '.json' === file.ext ? 'data' : 'markup';\n section = utils.getSection(file.base, field, store);\n\n if (section) {\n return (0, _handleTemplates.updateTemplate)(filepath, section, store);\n }\n\n console.log( // eslint-disable-line no-console\n _chalk2.default.red(`Could not find associated KSS section for ${filepath}`));\n break;\n\n // KSS documentation (default extension is `.css`)\n // Will also output a template if markup is inline\n // Note: inline markup does _not_ support handlebars currently\n case huron.get('kssExtension'):\n return (0, _handleKSS.updateKSS)(filepath, store);\n\n // This should never happen if Gaze is working properly\n default:\n return store;\n }\n\n return store;\n}\n\n/**\n * Logic for deleting file information and files based on file type (extension)\n *\n * @param {string} filepath - path to updated file. usually passed in from Gaze\n * @param {object} store - memory store\n * @return {object} newStore - map object of map object of entire data store\n */\nfunction deleteFile(filepath, store) {\n const huron = store.get('config');\n const file = _path2.default.parse(filepath);\n let field = '';\n let section = null;\n let newStore = store;\n\n switch (file.ext) {\n // Plain HTML template, external\n case '.html':\n section = utils.getSection(file.base, 'markup', store);\n\n if (section) {\n newStore = (0, _handleHTML.deleteHTML)(filepath, section, store);\n } else if (file.dir.includes('prototypes') && file.name.includes('prototype-')) {\n newStore = (0, _handleHTML.deletePrototype)(filepath, store);\n }\n break;\n\n case huron.get('templates').extension:\n case '.json':\n field = '.json' === file.ext ? 'data' : 'markup';\n section = utils.getSection(file.base, field, store);\n\n if (section) {\n newStore = (0, _handleTemplates.deleteTemplate)(filepath, section, store);\n }\n break;\n\n case huron.get('kssExtension'):\n section = utils.getSection(filepath, false, store);\n\n if (section) {\n newStore = (0, _handleKSS.deleteKSS)(filepath, section, store);\n }\n break;\n\n default:\n console.warn( // eslint-disable-line no-console\n _chalk2.default.red(`Could not delete: ${file.name}`));\n break;\n }\n\n return newStore;\n}\n\n/**\n * Logic for updating localized classnames from CSS modules\n *\n * @param {string} filepath - path to updated file. usually passed in from Gaze\n * @param {object} store - memory store\n *\n * @return void\n */\nfunction updateClassNames(filepath, store) {\n const classNamesPath = store.getIn(['config', 'classNames']);\n\n if (filepath.includes(classNamesPath)) {\n const oldClassnames = store.get('classNames');\n const newClassnames = utils.mergeClassnameJSON(classNamesPath);\n\n if (!(0, _isEqual2.default)(oldClassnames, newClassnames)) {\n return store.set('classNames', newClassnames);\n }\n }\n\n return store;\n}//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMTEuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vc3JjL2NsaS9hY3Rpb25zLmpzPzVlNWEiXSwic291cmNlc0NvbnRlbnQiOlsiLyoqIEBtb2R1bGUgY2xpL2FjdGlvbnMgKi9cblxuLy8gSW1wb3J0c1xuaW1wb3J0IHBhdGggZnJvbSAncGF0aCc7XG5pbXBvcnQgY2hhbGsgZnJvbSAnY2hhbGsnO1xuaW1wb3J0IGlzRXF1YWwgZnJvbSAnbG9kYXNoL2lzRXF1YWwnO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FDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFFQTtBQXJDQTtBQUNBO0FBdUNBO0FBQ0E7QUFDQTtBQUNBOzs7Ozs7OztBQVFBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0EiLCJzb3VyY2VSb290IjoiIn0="); /***/ }), /* 12 */ +/* no static exports found */ +/* all exports used */ +/*!********************************!*\ + !*** ./src/cli/fileWatcher.js ***! + \********************************/ /***/ (function(module, exports, __webpack_require__) { "use strict"; - - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.watchedFiles = exports.extensions = undefined; - -var _gaze = __webpack_require__(22); - -var _path = __webpack_require__(0); - -var _path2 = _interopRequireDefault(_path); - -var _utils = __webpack_require__(1); - -var _defaultStore = __webpack_require__(6); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/** - * Huron configuration object - * - * @global - */ -const huron = _defaultStore.defaultStore.get('config'); - -/** - * Available file extensions. Extensions should not include the leading '.' - * - * @global - */ -const extensions = exports.extensions = [huron.get('kssExtension'), huron.get('templates').extension, 'html', 'json'].map(extension => extension.replace('.', '')); - -// Generate watch list for Gaze, start gaze -const watchedFiles = exports.watchedFiles = []; - -// Watch section template -watchedFiles.push(_path2.default.resolve(huron.get('sectionTemplate'))); - -// Watch cssmodules classname files (if they exist) -if (huron.get('classNames')) { - watchedFiles.push(`${_path2.default.resolve(huron.get('classNames'))}/*.json`); -} - -// Watch all provided kss directories -huron.get('kss').forEach(dir => { - watchedFiles.push(`${(0, _utils.removeTrailingSlash)(dir)}/**/*.+(${extensions.join('|')})`); -}); - -/** - * Gaze instance for watching all files, including KSS, html, hbs/template, and JSON - * - * @global - */ -const gaze = new _gaze.Gaze(watchedFiles); - -exports.default = gaze; +eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.watchedFiles = exports.extensions = undefined;\n\nvar _gaze = __webpack_require__(/*! gaze */ 22);\n\nvar _path = __webpack_require__(/*! path */ 0);\n\nvar _path2 = _interopRequireDefault(_path);\n\nvar _utils = __webpack_require__(/*! ./utils */ 1);\n\nvar _defaultStore = __webpack_require__(/*! ./defaultStore */ 6);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n/**\n * Huron configuration object\n *\n * @global\n */\nconst huron = _defaultStore.defaultStore.get('config');\n\n/**\n * Available file extensions. Extensions should not include the leading '.'\n *\n * @global\n */\nconst extensions = exports.extensions = [huron.get('kssExtension'), huron.get('templates').extension, 'html', 'json'].map(extension => extension.replace('.', ''));\n\n// Generate watch list for Gaze, start gaze\nconst watchedFiles = exports.watchedFiles = [];\n\n// Watch section template\nwatchedFiles.push(_path2.default.resolve(huron.get('sectionTemplate')));\n\n// Watch cssmodules classname files (if they exist)\nif (huron.get('classNames')) {\n watchedFiles.push(`${_path2.default.resolve(huron.get('classNames'))}/*.json`);\n}\n\n// Watch all provided kss directories\nhuron.get('kss').forEach(dir => {\n watchedFiles.push(`${(0, _utils.removeTrailingSlash)(dir)}/**/*.+(${extensions.join('|')})`);\n});\n\n/**\n * Gaze instance for watching all files, including KSS, html, hbs/template, and JSON\n *\n * @global\n */\nconst gaze = new _gaze.Gaze(watchedFiles);\n\nexports.default = gaze;//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMTIuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vc3JjL2NsaS9maWxlV2F0Y2hlci5qcz80ZGI4Il0sInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IEdhemUgfSBmcm9tICdnYXplJztcbmltcG9ydCBwYXRoIGZyb20gJ3BhdGgnO1xuXG5pbXBvcnQgeyByZW1vdmVUcmFpbGluZ1NsYXNoIH0gZnJvbSAnLi91dGlscyc7XG5pbXBvcnQgeyBkZ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mllc1xuaHVyb24uZ2V0KCdrc3MnKS5mb3JFYWNoKChkaXIpID0+IHtcbiAgd2F0Y2hlZEZpbGVzLnB1c2goXG4gICAgYCR7cmVtb3ZlVHJhaWxpbmdTbGFzaChkaXIpfS8qKi8qLisoJHtleHRlbnNpb25zLmpvaW4oJ3wnKX0pYFxuICApO1xufSk7XG5cbi8qKlxuICogR2F6ZSBpbnN0YW5jZSBmb3Igd2F0Y2hpbmcgYWxsIGZpbGVzLCBpbmNsdWRpbmcgS1NTLCBodG1sLCBoYnMvdGVtcGxhdGUsIGFuZCBKU09OXG4gKlxuICogQGdsb2JhbFxuICovXG5jb25zdCBnYXplID0gbmV3IEdhemUod2F0Y2hlZEZpbGVzKTtcblxuZXhwb3J0IGRlZmF1bHQgZ2F6ZTtcblxuXG5cbi8vIFdFQlBBQ0sgRk9PVEVSIC8vXG4vLyBzcmMvY2xpL2ZpbGVXYXRjaGVyLmpzIl0sIm1hcHBpbmdzIjoiOzs7Ozs7O0FBQUE7QUFDQTtBQUFBO0FBQ0E7OztBQUNBO0FBQ0E7QUFBQTtBQUNBOzs7QUFDQTs7Ozs7QUFLQTtBQUNBO0FBQ0E7Ozs7O0FBS0E7QUFDQTtBQU1BO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUdBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFHQTtBQUNBO0FBQ0E7Ozs7O0FBS0E7QUFDQTtBQUNBIiwic291cmNlUm9vdCI6IiJ9"); /***/ }), /* 13 */ +/* no static exports found */ +/* all exports used */ +/*!***********************************!*\ + !*** ./src/cli/generateConfig.js ***! + \***********************************/ /***/ (function(module, exports, __webpack_require__) { "use strict"; - - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = generateConfig; - -var _path = __webpack_require__(0); - -var _path2 = _interopRequireDefault(_path); - -var _url = __webpack_require__(28); - -var _url2 = _interopRequireDefault(_url); - -var _fsExtra = __webpack_require__(3); - -var _fsExtra2 = _interopRequireDefault(_fsExtra); - -var _webpack = __webpack_require__(5); - -var _webpack2 = _interopRequireDefault(_webpack); - -var _htmlWebpackPlugin = __webpack_require__(23); - -var _htmlWebpackPlugin2 = _interopRequireDefault(_htmlWebpackPlugin); - -var _parseArgs = __webpack_require__(4); - -var _parseArgs2 = _interopRequireDefault(_parseArgs); - -var _requireExternal = __webpack_require__(16); - -var _requireExternal2 = _interopRequireDefault(_requireExternal); - -var _webpack3 = __webpack_require__(19); - -var _webpack4 = _interopRequireDefault(_webpack3); - -var _huron = __webpack_require__(18); - -var _huron2 = _interopRequireDefault(_huron); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -const cwd = process.cwd(); - -// Require configs passed in by user from CLI -/** @module cli/generate-config */ -let defaultConfig = false; -const localConfig = (0, _requireExternal2.default)(_path2.default.resolve(_parseArgs2.default.webpackConfig)); -const localHuron = (0, _requireExternal2.default)(_path2.default.resolve(_parseArgs2.default.huronConfig)); - -/** - * Generate a mutant hybrid of the huron default webpack config and your local webpack config - * - * @function generateConfig - * @param {object} config - local webpack config - * @return {object} newConfig - updated data store - */ -function generateConfig() { - let newConfig = localConfig; - let newHuron = localHuron; - - // Execute config function, if provided - if ('function' === typeof newConfig) { - newConfig = newConfig(_parseArgs2.default.env); - } - - // Execute huron config function, if provided - if ('function' === typeof newHuron) { - newHuron = newHuron(_parseArgs2.default.env); - } - - // Merge huron defaults with user settings - newHuron = Object.assign({}, _huron2.default, newHuron); - // Use user huron config to modify webpack defaults - defaultConfig = (0, _webpack4.default)(newHuron); - - // Set ouput options - newConfig.output = Object.assign({}, defaultConfig.output, newConfig.output); - newConfig.output.path = defaultConfig.output.path; - newConfig.output.publicPath = defaultConfig.output.publicPath; - - // configure entries - newConfig = configureEntries(newHuron, newConfig); - - // configure plugins - newConfig = configurePlugins(newHuron, newConfig); - - // configure loaders - newConfig = configureLoaders(newHuron, newConfig); - - // Add HTMLWebpackPlugin for each configured prototype - newConfig = configurePrototypes(newHuron, newConfig); - - // Remove existing devServer settings - delete newConfig.devServer; - - return { - huron: newHuron, - webpack: newConfig - }; -} - -/** - * Configure and manage webpack entry points - * - * @param {object} huron - huron configuration object - * @param {object} config - webpack configuration object - * @return {object} newConfig - updated data store - */ -function configureEntries(huron, config) { - const entry = config.entry[huron.entry]; - const newConfig = config; - - newConfig.entry = {}; - if (!_parseArgs2.default.production) { - newConfig.entry[huron.entry] = [`webpack-dev-server/client?http://localhost:${huron.port}`, 'webpack/hot/dev-server', _path2.default.join(cwd, huron.root, 'huron-assets/index')].concat(entry); - } else { - newConfig.entry[huron.entry] = [_path2.default.join(cwd, huron.root, 'huron-assets/index')].concat(entry); - } - - return newConfig; -} - -/** - * Configure and manage webpack plugins - * - * @param {object} huron - huron configuration object - * @param {object} config - webpack configuration object - * @return {object} newConfig - updated data store - */ -function configurePlugins(huron, config) { - const newConfig = config; - - newConfig.plugins = config.plugins || []; - - if (!_parseArgs2.default.production) { - if (newConfig.plugins && newConfig.plugins.length) { - newConfig.plugins = newConfig.plugins.filter(plugin => 'HotModuleReplacementPlugin' !== plugin.constructor.name && 'NamedModulesPlugin' !== plugin.constructor.name); - } - newConfig.plugins = newConfig.plugins.concat([new _webpack2.default.HotModuleReplacementPlugin(), new _webpack2.default.NamedModulesPlugin()]); - } - - return newConfig; -} - -/** - * Configure and manage webpack loaders - * - * @param {object} huron - huron configuration object - * @param {object} config - webpack configuration object - * @return {object} newConfig - updated data store - */ -function configureLoaders(huron, config) { - // Manage loaders - const templatesLoader = huron.templates.rule || {}; - const newConfig = config; - - // Make sure we're only using templates loader for files in huron root - templatesLoader.include = [_path2.default.join(cwd, huron.root, huron.output)]; - - // Normalize module and module.rules - newConfig.module = newConfig.module || {}; - newConfig.module.rules = newConfig.module.rules || newConfig.module.loaders || []; - - // Add default loaders - newConfig.module.rules = defaultConfig.module.rules.concat(newConfig.module.rules, templatesLoader); - - return newConfig; -} - -/** - * Create an HTML webpack plugin for each configured prototype - * - * @param {object} huron - huron configuration object - * @param {object} config - webpack configuration object - * @return {object} newConfig - updated data store - */ -function configurePrototypes(huron, config) { - const wrapperTemplate = _fsExtra2.default.readFileSync(_path2.default.join(__dirname, '../../templates/prototypeTemplate.hbs'), 'utf8'); - - const defaultHTMLPluginOptions = { - title: 'Huron', - window: huron.window, - js: [], - css: [], - filename: 'index.html', - template: _path2.default.join(cwd, huron.root, 'huron-assets/prototypeTemplate.hbs'), - inject: false, - chunks: [huron.entry] - }; - const newConfig = config; - - // Write prototype template file for HTML webpack plugin - _fsExtra2.default.outputFileSync(_path2.default.join(cwd, huron.root, 'huron-assets/prototypeTemplate.hbs'), wrapperTemplate); - - huron.prototypes.forEach(prototype => { - const newPrototype = prototype; - let opts = {}; - - // Merge configured settings with default settings - if ('string' === typeof prototype) { - opts = Object.assign({}, defaultHTMLPluginOptions, { - title: prototype, - filename: `${prototype}.html` - }); - } else if ('object' === typeof prototype && {}.hasOwnProperty.call(prototype, 'title')) { - // Create filename based on configured title if not provided - if (!prototype.filename) { - newPrototype.filename = `${prototype.title}.html`; - } - - // Move css assets for this prototype, - // reset css option with new file paths - if (prototype.css) { - newPrototype.css = moveAdditionalAssets(prototype.css, 'css', huron); - } - - // Move js assets for this prototype, - // reset js option with new file paths - if (prototype.js) { - newPrototype.js = moveAdditionalAssets(prototype.js, 'js', huron); - } - - opts = Object.assign({}, defaultHTMLPluginOptions, newPrototype); - } - - // Move global css assets, - // reset css option with new file paths - if (huron.css.length) { - opts.css = opts.css.concat(moveAdditionalAssets(huron.css, 'css', huron)); - } - - // Move global js assets, - // reset js option with new file paths - if (huron.js.length) { - opts.js = opts.js.concat(moveAdditionalAssets(huron.js, 'js', huron)); - } - - // Push a new plugin for each configured prototype - if (Object.keys(opts).length) { - newConfig.plugins.push(new _htmlWebpackPlugin2.default(opts)); - } - }); - - return newConfig; -} - -/** - * Move relative (and local) js and css assets provided in huron options - * - * @param {array|string} assets - array of assets or single asset - * @param {string} subdir - subdirectory in huron root from which to load additional asset - * @param {object} huron - huron configuration object - * @return {array} assetResults - paths to js and css assets - */ -function moveAdditionalAssets(assets, subdir = '', huron) { - const currentAssets = [].concat(assets); - const assetResults = []; - - currentAssets.forEach(asset => { - const assetInfo = _path2.default.parse(asset); - const assetURL = _url2.default.parse(asset); - const sourcePath = _path2.default.join(cwd, asset); - const outputPath = _path2.default.resolve(cwd, huron.root, subdir, assetInfo.base); - const loadPath = _parseArgs2.default.production ? _path2.default.join(subdir, assetInfo.base) : _path2.default.join('/', subdir, assetInfo.base); // Use absolute path in development - let contents = false; - - if (!_path2.default.isAbsolute(asset) && !assetURL.protocol) { - try { - contents = _fsExtra2.default.readFileSync(sourcePath); - } catch (e) { - console.warn(`could not read ${sourcePath}`); - } - - if (contents) { - _fsExtra2.default.outputFileSync(outputPath, contents); - assetResults.push(loadPath); - } - } else { - assetResults.push(asset); - } - }); - - return assetResults; -} +eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = generateConfig;\n\nvar _path = __webpack_require__(/*! path */ 0);\n\nvar _path2 = _interopRequireDefault(_path);\n\nvar _url = __webpack_require__(/*! url */ 28);\n\nvar _url2 = _interopRequireDefault(_url);\n\nvar _fsExtra = __webpack_require__(/*! fs-extra */ 3);\n\nvar _fsExtra2 = _interopRequireDefault(_fsExtra);\n\nvar _webpack = __webpack_require__(/*! webpack */ 5);\n\nvar _webpack2 = _interopRequireDefault(_webpack);\n\nvar _htmlWebpackPlugin = __webpack_require__(/*! html-webpack-plugin */ 23);\n\nvar _htmlWebpackPlugin2 = _interopRequireDefault(_htmlWebpackPlugin);\n\nvar _parseArgs = __webpack_require__(/*! ./parseArgs */ 4);\n\nvar _parseArgs2 = _interopRequireDefault(_parseArgs);\n\nvar _requireExternal = __webpack_require__(/*! ./requireExternal */ 16);\n\nvar _requireExternal2 = _interopRequireDefault(_requireExternal);\n\nvar _webpack3 = __webpack_require__(/*! ../defaultConfig/webpack.config */ 19);\n\nvar _webpack4 = _interopRequireDefault(_webpack3);\n\nvar _huron = __webpack_require__(/*! ../defaultConfig/huron.config */ 18);\n\nvar _huron2 = _interopRequireDefault(_huron);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nconst cwd = process.cwd();\n\n// Require configs passed in by user from CLI\n/** @module cli/generate-config */\nlet defaultConfig = false;\nconst localConfig = (0, _requireExternal2.default)(_path2.default.resolve(_parseArgs2.default.webpackConfig));\nconst localHuron = (0, _requireExternal2.default)(_path2.default.resolve(_parseArgs2.default.huronConfig));\n\n/**\n * Generate a mutant hybrid of the huron default webpack config and your local webpack config\n *\n * @function generateConfig\n * @param {object} config - local webpack config\n * @return {object} newConfig - updated data store\n */\nfunction generateConfig() {\n let newConfig = localConfig;\n let newHuron = localHuron;\n\n // Execute config function, if provided\n if ('function' === typeof newConfig) {\n newConfig = newConfig(_parseArgs2.default.env);\n }\n\n // Execute huron config function, if provided\n if ('function' === typeof newHuron) {\n newHuron = newHuron(_parseArgs2.default.env);\n }\n\n // Merge huron defaults with user settings\n newHuron = Object.assign({}, _huron2.default, newHuron);\n // Use user huron config to modify webpack defaults\n defaultConfig = (0, _webpack4.default)(newHuron);\n\n // Set ouput options\n newConfig.output = Object.assign({}, defaultConfig.output, newConfig.output);\n newConfig.output.path = defaultConfig.output.path;\n newConfig.output.publicPath = defaultConfig.output.publicPath;\n\n // configure entries\n newConfig = configureEntries(newHuron, newConfig);\n\n // configure plugins\n newConfig = configurePlugins(newHuron, newConfig);\n\n // configure loaders\n newConfig = configureLoaders(newHuron, newConfig);\n\n // Add HTMLWebpackPlugin for each configured prototype\n newConfig = configurePrototypes(newHuron, newConfig);\n\n // Remove existing devServer settings\n delete newConfig.devServer;\n\n return {\n huron: newHuron,\n webpack: newConfig\n };\n}\n\n/**\n * Configure and manage webpack entry points\n *\n * @param {object} huron - huron configuration object\n * @param {object} config - webpack configuration object\n * @return {object} newConfig - updated data store\n */\nfunction configureEntries(huron, config) {\n const entry = config.entry[huron.entry];\n const newConfig = config;\n\n newConfig.entry = {};\n if (!_parseArgs2.default.production) {\n newConfig.entry[huron.entry] = [`webpack-dev-server/client/index.js?http://localhost:${huron.port}/`, 'webpack/hot/dev-server', _path2.default.join(cwd, huron.root, 'huron-assets/index')].concat(entry);\n } else {\n newConfig.entry[huron.entry] = [_path2.default.join(cwd, huron.root, 'huron-assets/index')].concat(entry);\n }\n\n return newConfig;\n}\n\n/**\n * Configure and manage webpack plugins\n *\n * @param {object} huron - huron configuration object\n * @param {object} config - webpack configuration object\n * @return {object} newConfig - updated data store\n */\nfunction configurePlugins(huron, config) {\n const newConfig = config;\n\n newConfig.plugins = config.plugins || [];\n\n if (!_parseArgs2.default.production) {\n if (newConfig.plugins && newConfig.plugins.length) {\n newConfig.plugins = newConfig.plugins.filter(plugin => 'HotModuleReplacementPlugin' !== plugin.constructor.name && 'NamedModulesPlugin' !== plugin.constructor.name);\n }\n newConfig.plugins = newConfig.plugins.concat([new _webpack2.default.HotModuleReplacementPlugin(), new _webpack2.default.NamedModulesPlugin()]);\n }\n\n return newConfig;\n}\n\n/**\n * Configure and manage webpack loaders\n *\n * @param {object} huron - huron configuration object\n * @param {object} config - webpack configuration object\n * @return {object} newConfig - updated data store\n */\nfunction configureLoaders(huron, config) {\n // Manage loaders\n const templatesLoader = huron.templates.rule || {};\n const newConfig = config;\n\n // Make sure we're only using templates loader for files in huron root\n templatesLoader.include = [_path2.default.join(cwd, huron.root, huron.output)];\n\n // Normalize module and module.rules\n newConfig.module = newConfig.module || {};\n newConfig.module.rules = newConfig.module.rules || newConfig.module.loaders || [];\n\n // Add default loaders\n newConfig.module.rules = defaultConfig.module.rules.concat(newConfig.module.rules, templatesLoader);\n\n return newConfig;\n}\n\n/**\n * Create an HTML webpack plugin for each configured prototype\n *\n * @param {object} huron - huron configuration object\n * @param {object} config - webpack configuration object\n * @return {object} newConfig - updated data store\n */\nfunction configurePrototypes(huron, config) {\n const wrapperTemplate = _fsExtra2.default.readFileSync(_path2.default.join(__dirname, '../../templates/prototypeTemplate.hbs'), 'utf8');\n\n const defaultHTMLPluginOptions = {\n title: 'Huron',\n window: huron.window,\n js: [],\n css: [],\n filename: 'index.html',\n template: _path2.default.join(cwd, huron.root, 'huron-assets/prototypeTemplate.hbs'),\n inject: false,\n chunks: [huron.entry]\n };\n const newConfig = config;\n\n // Write prototype template file for HTML webpack plugin\n _fsExtra2.default.outputFileSync(_path2.default.join(cwd, huron.root, 'huron-assets/prototypeTemplate.hbs'), wrapperTemplate);\n\n huron.prototypes.forEach(prototype => {\n const newPrototype = prototype;\n let opts = {};\n\n // Merge configured settings with default settings\n if ('string' === typeof prototype) {\n opts = Object.assign({}, defaultHTMLPluginOptions, {\n title: prototype,\n filename: `${prototype}.html`\n });\n } else if ('object' === typeof prototype && {}.hasOwnProperty.call(prototype, 'title')) {\n // Create filename based on configured title if not provided\n if (!prototype.filename) {\n newPrototype.filename = `${prototype.title}.html`;\n }\n\n // Move css assets for this prototype,\n // reset css option with new file paths\n if (prototype.css) {\n newPrototype.css = moveAdditionalAssets(prototype.css, 'css', huron);\n }\n\n // Move js assets for this prototype,\n // reset js option with new file paths\n if (prototype.js) {\n newPrototype.js = moveAdditionalAssets(prototype.js, 'js', huron);\n }\n\n opts = Object.assign({}, defaultHTMLPluginOptions, newPrototype);\n }\n\n // Move global css assets,\n // reset css option with new file paths\n if (huron.css.length) {\n opts.css = opts.css.concat(moveAdditionalAssets(huron.css, 'css', huron));\n }\n\n // Move global js assets,\n // reset js option with new file paths\n if (huron.js.length) {\n opts.js = opts.js.concat(moveAdditionalAssets(huron.js, 'js', huron));\n }\n\n // Push a new plugin for each configured prototype\n if (Object.keys(opts).length) {\n newConfig.plugins.push(new _htmlWebpackPlugin2.default(opts));\n }\n });\n\n return newConfig;\n}\n\n/**\n * Move relative (and local) js and css assets provided in huron options\n *\n * @param {array|string} assets - array of assets or single asset\n * @param {string} subdir - subdirectory in huron root from which to load additional asset\n * @param {object} huron - huron configuration object\n * @return {array} assetResults - paths to js and css assets\n */\nfunction moveAdditionalAssets(assets, subdir = '', huron) {\n const currentAssets = [].concat(assets);\n const assetResults = [];\n\n currentAssets.forEach(asset => {\n const assetInfo = _path2.default.parse(asset);\n const assetURL = _url2.default.parse(asset);\n const sourcePath = _path2.default.join(cwd, asset);\n const outputPath = _path2.default.resolve(cwd, huron.root, subdir, assetInfo.base);\n const loadPath = _path2.default.join(subdir, assetInfo.base);\n let contents = false;\n\n if (!_path2.default.isAbsolute(asset) && !assetURL.protocol) {\n try {\n contents = _fsExtra2.default.readFileSync(sourcePath);\n } catch (e) {\n console.warn(`could not read ${sourcePath}`);\n }\n\n if (contents) {\n _fsExtra2.default.outputFileSync(outputPath, contents);\n assetResults.push(loadPath);\n }\n } else {\n assetResults.push(asset);\n }\n });\n\n return assetResults;\n}//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMTMuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vc3JjL2NsaS9nZW5lcmF0ZUNvbmZpZy5qcz9lZGUwIl0sInNvdXJjZXNDb250ZW50IjpbIi8qKiBAbW9kdWxlIGNsaS9nZW5lcmF0ZS1jb25maWcgKi9cbmltcG9ydCBwYXRoIGZyb20gJ3BhdGgnO1xuaW1wb3J0IHVybCBmcm9tICd1cmwnO1xuaW1wb3J0IGZzIGZyb20gJ2ZzLWV4dHJhJztcbmltcG9ydCB3ZWJwYWNrIGZyb20gJ3dlYnBhY2snO1xuaW1wb3J0IEhUTUxXZWJwYWNrUGx1Z2luIGZyb20gJ2h0bWwtd2VicGFjay1wbHVnaW4nO1xuXG5pbXBvcnQgcHJvZ3JhbSBmcm9tICcuL3BhcnNlQXJncyc7XG5pbXBvcnQgcmVxdWlyZUV4dGVybmFsIGZyb20gJy4vcmVxdWlyZUV4dGVybmFsJztcbmltcG9ydCBkZWZhdWx0V2VicGFjayBmcm9tICcuLi9kZWZhdWx0Q29uZmlnL3dlYnBhY2suY29uZmlnJztcbmlt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***! + \*******************************/ /***/ (function(module, exports, __webpack_require__) { "use strict"; - - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.updateHTML = updateHTML; -exports.deleteHTML = deleteHTML; -exports.updatePrototype = updatePrototype; -exports.deletePrototype = deletePrototype; - -var _path = __webpack_require__(0); - -var _path2 = _interopRequireDefault(_path); - -var _fsExtra = __webpack_require__(3); - -var _fsExtra2 = _interopRequireDefault(_fsExtra); - -var _utils = __webpack_require__(1); - -var utils = _interopRequireWildcard(_utils); - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/** - * Handle update of an HMTL template - * - * @function updateHTML - * @param {string} filepath - filepath of changed file (comes from gaze) - * @param {object} section - contains KSS section data - * @param {object} store - memory store - * @return {object} updated data store - */ -function updateHTML(filepath, section, store) { - const file = _path2.default.parse(filepath); - const content = _fsExtra2.default.readFileSync(filepath, 'utf8'); - const newSection = section; - - if (content) { - newSection.templatePath = utils.writeFile(section.referenceURI, 'template', filepath, content, store); - newSection.templateContent = content; - - // Rewrite section data with template content - newSection.sectionPath = utils.writeSectionData(store, newSection); - - return store.setIn(['sections', 'sectionsByPath', section.kssPath], newSection).setIn(['sections', 'sectionsByURI', section.referenceURI], newSection); - } - - console.log(`File ${file.base} could not be read`); - return store; -} - -/** - * Handle removal of an HMTL template - * - * @function deleteHTML - * @param {string} filepath - filepath of changed file (comes from gaze) - * @param {object} section - contains KSS section data - * @param {object} store - memory store - * @return {object} updated data store - */ -/** @module cli/html-handler */ -function deleteHTML(filepath, section, store) { - const newSection = section; - - utils.removeFile(newSection.referenceURI, 'template', filepath, store); - - delete newSection.templatePath; - - return store.setIn(['sections', 'sectionsByPath', section.kssPath], newSection).setIn(['sections', 'sectionsByURI', section.referenceURI], newSection); -} - -/** - * Handle update for a prototype file - * - * @function updatePrototype - * @param {string} filepath - filepath of changed file (comes from gaze) - * @param {object} store - memory store - * @return {object} updated data store - */ -function updatePrototype(filepath, store) { - const file = _path2.default.parse(filepath); - const content = _fsExtra2.default.readFileSync(filepath, 'utf8'); - - if (content) { - const requirePath = utils.writeFile(file.name, 'prototype', filepath, content, store); - - return store.setIn(['prototypes', file.name], requirePath); - } - - console.log(`File ${file.base} could not be read`); - return store; -} - -/** - * Handle removal of a prototype file - * - * @function deletePrototype - * @param {string} filepath - filepath of changed file (comes from gaze) - * @param {object} store - memory store - * @return {object} updated data store - */ -function deletePrototype(filepath, store) { - const file = _path2.default.parse(filepath); - const requirePath = utils.removeFile(file.name, 'prototype', filepath, store); - - return store.setIn(['prototypes', file.name], requirePath); -} +eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.updateHTML = updateHTML;\nexports.deleteHTML = deleteHTML;\nexports.updatePrototype = updatePrototype;\nexports.deletePrototype = deletePrototype;\n\nvar _path = __webpack_require__(/*! path */ 0);\n\nvar _path2 = _interopRequireDefault(_path);\n\nvar _fsExtra = __webpack_require__(/*! fs-extra */ 3);\n\nvar _fsExtra2 = _interopRequireDefault(_fsExtra);\n\nvar _utils = __webpack_require__(/*! ./utils */ 1);\n\nvar utils = _interopRequireWildcard(_utils);\n\nfunction _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n/**\n * Handle update of an HMTL template\n *\n * @function updateHTML\n * @param {string} filepath - filepath of changed file (comes from gaze)\n * @param {object} section - contains KSS section data\n * @param {object} store - memory store\n * @return {object} updated data store\n */\nfunction updateHTML(filepath, section, store) {\n const file = _path2.default.parse(filepath);\n const content = _fsExtra2.default.readFileSync(filepath, 'utf8');\n const newSection = section;\n\n if (content) {\n newSection.templatePath = utils.writeFile(section.referenceURI, 'template', filepath, content, store);\n newSection.templateContent = content;\n\n // Rewrite section data with template content\n newSection.sectionPath = utils.writeSectionData(store, newSection);\n\n return store.setIn(['sections', 'sectionsByPath', section.kssPath], newSection).setIn(['sections', 'sectionsByURI', section.referenceURI], newSection);\n }\n\n console.log(`File ${file.base} could not be read`);\n return store;\n}\n\n/**\n * Handle removal of an HMTL template\n *\n * @function deleteHTML\n * @param {string} filepath - filepath of changed file (comes from gaze)\n * @param {object} section - contains KSS section data\n * @param {object} store - memory store\n * @return {object} updated data store\n */\n/** @module cli/html-handler */\nfunction deleteHTML(filepath, section, store) {\n const newSection = section;\n\n utils.removeFile(newSection.referenceURI, 'template', filepath, store);\n\n delete newSection.templatePath;\n\n return store.setIn(['sections', 'sectionsByPath', section.kssPath], newSection).setIn(['sections', 'sectionsByURI', section.referenceURI], newSection);\n}\n\n/**\n * Handle update for a prototype file\n *\n * @function updatePrototype\n * @param {string} filepath - filepath of changed file (comes from gaze)\n * @param {object} store - memory store\n * @return {object} updated data store\n */\nfunction updatePrototype(filepath, store) {\n const file = _path2.default.parse(filepath);\n const content = _fsExtra2.default.readFileSync(filepath, 'utf8');\n\n if (content) {\n const requirePath = utils.writeFile(file.name, 'prototype', filepath, content, store);\n\n return store.setIn(['prototypes', file.name], requirePath);\n }\n\n console.log(`File ${file.base} could not be read`);\n return store;\n}\n\n/**\n * Handle removal of a prototype file\n *\n * @function deletePrototype\n * @param {string} filepath - filepath of changed file (comes from gaze)\n * @param {object} store - memory store\n * @return {object} updated data store\n */\nfunction deletePrototype(filepath, store) {\n const file = _path2.default.parse(filepath);\n const requirePath = utils.removeFile(file.name, 'prototype', filepath, store);\n\n return store.setIn(['prototypes', file.name], requirePath);\n}//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMTQuanMiLCJzb3VyY2VzIjpbIndlYnBhY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YW1lXSxcbiAgICAgIHJlcXVpcmVQYXRoXG4gICAgKTtcbn1cblxuXG5cbi8vIFdFQlBBQ0sgRk9PVEVSIC8vXG4vLyBzcmMvY2xpL2hhbmRsZUhUTUwuanMiXSwibWFwcGluZ3MiOiI7Ozs7O0FBZUE7QUEwQ0E7QUErQkE7QUErQkE7QUFDQTtBQXZIQTtBQUNBOzs7QUFBQTtBQUNBOzs7QUFDQTtBQUNBO0FBREE7QUFDQTs7Ozs7QUFDQTs7Ozs7Ozs7O0FBU0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFPQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFTQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTs7Ozs7Ozs7O0FBaERBO0FBeURBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFNQTtBQUNBO0FBQ0E7QUFTQTtBQUNBO0FBQ0E7Ozs7Ozs7O0FBUUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFPQTtBQUlBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOzs7Ozs7OztBQVFBO0FBQ0E7QUFDQTtBQUNBO0FBTUE7QUFJQSIsInNvdXJjZVJvb3QiOiIifQ=="); /***/ }), /* 15 */ +/* no static exports found */ +/* all exports used */ +/*!******************************!*\ + !*** ./src/cli/handleKSS.js ***! + \******************************/ /***/ (function(module, exports, __webpack_require__) { "use strict"; - - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.updateKSS = updateKSS; -exports.deleteKSS = deleteKSS; - -var _path = __webpack_require__(0); - -var _path2 = _interopRequireDefault(_path); - -var _fsExtra = __webpack_require__(3); - -var _fsExtra2 = _interopRequireDefault(_fsExtra); - -var _kss = __webpack_require__(25); - -var _chalk = __webpack_require__(2); - -var _chalk2 = _interopRequireDefault(_chalk); - -var _utils = __webpack_require__(1); - -var utils = _interopRequireWildcard(_utils); - -var _handleTemplates = __webpack_require__(7); - -var _requireTemplates = __webpack_require__(8); - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/** - * Handle update of a KSS section - * - * @function updateKSS - * @param {string} filepath - filepath of changed file (comes from gaze) - * @param {object} store - memory store - * @return {object} updated data store - */ -function updateKSS(filepath, store) { - const kssSource = _fsExtra2.default.readFileSync(filepath, 'utf8'); - const huron = store.get('config'); - const oldSection = utils.getSection(filepath, false, store) || {}; - const file = _path2.default.parse(filepath); - let newStore = store; - - if (kssSource) { - const styleguide = (0, _kss.parse)(kssSource, huron.get('kssOptions')); - - if (styleguide.data.sections.length) { - const section = utils.normalizeSectionData(styleguide.data.sections[0]); - - if (section.reference && section.referenceURI) { - // Update or add section data - newStore = updateSectionData(filepath, section, oldSection, newStore); - - // Remove old section data if reference URI has changed - if (oldSection && oldSection.referenceURI && oldSection.referenceURI !== section.referenceURI) { - newStore = unsetSection(oldSection, file, newStore, false); - } - - (0, _requireTemplates.writeStore)(newStore); - console.log(_chalk2.default.green(`KSS source in ${filepath} changed or added`)); - return newStore; - } - - console.log(_chalk2.default.magenta(`KSS section in ${filepath} is missing a section reference`)); - return newStore; - } - - console.log(_chalk2.default.magenta(`No KSS found in ${filepath}`)); - return newStore; - } - - if (oldSection) { - newStore = deleteKSS(filepath, oldSection, newStore); - } - - console.log(_chalk2.default.red(`${filepath} not found or empty`)); // eslint-disable-line no-console - return newStore; -} - -/** - * Handle removal of a KSS section - * - * @function deleteKSS - * @param {string} filepath - filepath of changed file (comes from gaze) - * @param {object} section - KSS section data - * @param {object} store - memory store - * @return {object} updated data store - */ -/** @module cli/kss-handler */ - -function deleteKSS(filepath, section, store) { - const file = _path2.default.parse(filepath); - - if (section.reference && section.referenceURI) { - // Remove section data from memory store - return unsetSection(section, file, store, true); - } - - return store; -} - -/** - * Update the sections store with new data for a specific section - * - * @function updateSectionData - * @param {object} section - contains updated section data - * @param {string} kssPath - path to KSS section - * @param {object} store - memory store - * @return {object} updated data store - */ -function updateSectionData(kssPath, section, oldSection, store) { - const sectionFileInfo = _path2.default.parse(kssPath); - const dataFilepath = _path2.default.join(sectionFileInfo.dir, `${sectionFileInfo.name}.json`); - const isInline = null !== section.markup.match(/<\/[^>]*>/); - const newSort = sortSection(store.getIn(['sections', 'sorted']), section.reference, store.get('referenceDelimiter')); - const newSection = Object.assign({}, oldSection, section); - let newStore = store; - - // Required for reference from templates and data - newSection.kssPath = kssPath; - - if (isInline) { - // Set section value if inlineTempalte() returned a path - newStore = updateInlineTemplate(kssPath, oldSection, newSection, newStore); - } else { - // Remove inline template, if it exists - utils.removeFile(newSection.referenceURI, 'template', kssPath, store); - // Update markup and data fields - newStore = updateTemplateFields(sectionFileInfo, oldSection, newSection, newStore); - } - - // Output section description - newStore = updateDescription(kssPath, oldSection, newSection, newStore); - - // Output section data to a JSON file - newSection.sectionPath = utils.writeSectionData(newStore, newSection, dataFilepath); - - // Update section sorting - return newStore.setIn(['sections', 'sorted'], newSort).setIn(['sections', 'sectionsByPath', kssPath], newSection).setIn(['sections', 'sectionsByURI', section.referenceURI], newSection); -} - -/** - * Handle detection and output of inline templates, which is markup written - * in the KSS documentation itself as opposed to an external file - * - * @function updateInlineTemplate - * @param {string} oldSection - previous iteration of KSS data, if updated - * @param {object} section - KSS section data - * @return {object} updated data store with new template path info - */ -function updateInlineTemplate(filepath, oldSection, section, store) { - const newSection = section; - const newStore = store; - - // If we have inline markup - if (fieldShouldOutput(oldSection, section, 'markup')) { - newSection.templatePath = utils.writeFile(section.referenceURI, 'template', filepath, section.markup, store); - newSection.templateContent = section.markup; - - return newStore.setIn(['sections', 'sectionsByPath', filepath], newSection).setIn(['sections', 'sectionsByURI', section.referenceURI], newSection); - } - - return newStore; -} - -/** - * Handle output of section description - * - * @function updateDescription - * @param {string} oldSection - previous iteration of KSS data, if updated - * @param {object} section - KSS section data - * @return {object} updated data store with new descripton path info - */ -function updateDescription(filepath, oldSection, section, store) { - const newSection = section; - const newStore = store; - - // If we don't have previous KSS or the KSS has been updated - if (fieldShouldOutput(oldSection, section, 'description')) { - // Write new description - newSection.descriptionPath = utils.writeFile(section.referenceURI, 'description', filepath, section.description, store); - - return newStore.setIn(['sections', 'sectionsByPath', filepath], newSection).setIn(['sections', 'sectionsByURI', section.referenceURI], newSection); - } - - return newStore; -} - -/** - * Handle Data and Markup fields - * - * @function updateTemplateFields - * @param {string} file - File data for KSS file from path.parse() - * @param {object} oldSection - outdated KSS data - * @param {object} section - KSS section data - * @param {object} store - memory store - * @return {object} KSS section data with updated asset paths - */ -function updateTemplateFields(file, oldSection, section, store) { - const kssPath = _path2.default.format(file); - const newSection = section; - let filepath = ''; - let oldFilepath = ''; - let newStore = store; - - ['data', 'markup'].forEach(field => { - if (newSection[field]) { - if (oldSection[field]) { - oldFilepath = _path2.default.join(file.dir, oldSection[field]); - newStore = (0, _handleTemplates.deleteTemplate)(oldFilepath, oldSection, newStore); - } - - filepath = _path2.default.join(file.dir, newSection[field]); - newStore = (0, _handleTemplates.updateTemplate)(filepath, newSection, newStore); - } else { - delete newSection[field]; - newStore = newStore.setIn(['sections', 'sectionsByPath', kssPath], newSection).setIn(['sections', 'sectionsByURI', newSection.referenceURI], newSection); - } - }); - - return newStore; -} - -/** - * Remove a section from the memory store - * - * @function unsetSection - * @param {object} section - contains updated section data - * @param {string} file - file object from path.parse() - * @param {object} store - memory store - * @param {bool} removed - has the file been removed or just the section information changed? - * @return {object} updated data store with new descripton path info - */ -function unsetSection(section, file, store, removed) { - const sorted = store.getIn(['sections', 'sorted']); - const kssPath = _path2.default.format(file); - const dataFilepath = _path2.default.join(file.dir, `${file.name}.json`); - const isInline = section.markup && null !== section.markup.match(/<\/[^>]*>/); - const newSort = unsortSection(sorted, section.reference, store.get('referenceDelimiter')); - let newStore = store; - - // Remove old section data - utils.removeFile(section.referenceURI, 'section', dataFilepath, newStore); - - // Remove associated inline template - if (isInline) { - utils.removeFile(section.referenceURI, 'template', kssPath, newStore); - } - - // Remove description template - utils.removeFile(section.referenceURI, 'description', kssPath, newStore); - - // Remove data from sectionsByPath if file has been removed - if (removed) { - newStore = newStore.deleteIn(['sections', 'sectionsByPath', kssPath]); - } - - return newStore.deleteIn(['sections', 'sectionsByURI', section.referenceURI]).setIn(['sections', 'sorted'], newSort); -} - -/** - * Sort sections and subsections - * - * @function sortSection - * @param {object} sorted - currently sorted sections - * @param {string} reference - reference URI of section to sort - * @return {object} updated data store with new descripton path info - */ -function sortSection(sorted, reference, delimiter) { - const parts = reference.split(delimiter); - const newSort = sorted[parts[0]] || {}; - const newSorted = sorted; - - if (1 < parts.length) { - const newParts = parts.filter((part, idx) => 0 !== idx); - newSorted[parts[0]] = sortSection(newSort, newParts.join(delimiter), delimiter); - } else { - newSorted[parts[0]] = newSort; - } - - return newSorted; -} - -/** - * Remove a section from the sorted sections - * - * @function unsortSection - * @param {object} sorted - currently sorted sections - * @param {string} reference - reference URI of section to sort - * @return {object} updated data store with new descripton path info - */ -function unsortSection(sorted, reference, delimiter) { - const parts = reference.split(delimiter); - const subsections = Object.keys(sorted[parts[0]]); - const newSorted = sorted; - - if (subsections.length) { - if (1 < parts.length) { - const newParts = parts.filter((part, idx) => 0 !== idx); - newSorted[parts[0]] = unsortSection(newSorted[parts[0]], newParts.join(delimiter), delimiter); - } - } else { - delete newSorted[parts[0]]; - } - - return newSorted; -} - -/** - * Compare a KSS field between old and new KSS data to see if we need to output - * a new module for that field - * - * @function fieldShouldOutput - * @param {object} oldSection - currently sorted sections - * @param {object} newSection - reference URI of section to sort - * @param {string} field - KSS field to check - * @return {bool} output a new module for the KSS field - */ -function fieldShouldOutput(oldSection, newSection, field) { - return oldSection && (oldSection[field] !== newSection[field] || oldSection.referenceURI !== newSection.referenceURI) || !oldSection; -} +eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.updateKSS = updateKSS;\nexports.deleteKSS = deleteKSS;\n\nvar _path = __webpack_require__(/*! path */ 0);\n\nvar _path2 = _interopRequireDefault(_path);\n\nvar _fsExtra = __webpack_require__(/*! fs-extra */ 3);\n\nvar _fsExtra2 = _interopRequireDefault(_fsExtra);\n\nvar _kss = __webpack_require__(/*! kss */ 25);\n\nvar _chalk = __webpack_require__(/*! chalk */ 2);\n\nvar _chalk2 = _interopRequireDefault(_chalk);\n\nvar _utils = __webpack_require__(/*! ./utils */ 1);\n\nvar utils = _interopRequireWildcard(_utils);\n\nvar _handleTemplates = __webpack_require__(/*! ./handleTemplates */ 7);\n\nvar _requireTemplates = __webpack_require__(/*! ./requireTemplates */ 8);\n\nfunction _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n/**\n * Handle update of a KSS section\n *\n * @function updateKSS\n * @param {string} filepath - filepath of changed file (comes from gaze)\n * @param {object} store - memory store\n * @return {object} updated data store\n */\nfunction updateKSS(filepath, store) {\n const kssSource = _fsExtra2.default.readFileSync(filepath, 'utf8');\n const huron = store.get('config');\n const oldSection = utils.getSection(filepath, false, store) || {};\n const file = _path2.default.parse(filepath);\n let newStore = store;\n\n if (kssSource) {\n const styleguide = (0, _kss.parse)(kssSource, huron.get('kssOptions'));\n\n if (styleguide.data.sections.length) {\n const section = utils.normalizeSectionData(styleguide.data.sections[0]);\n\n if (section.reference && section.referenceURI) {\n // Update or add section data\n newStore = updateSectionData(filepath, section, oldSection, newStore);\n\n // Remove old section data if reference URI has changed\n if (oldSection && oldSection.referenceURI && oldSection.referenceURI !== section.referenceURI) {\n newStore = unsetSection(oldSection, file, newStore, false);\n }\n\n (0, _requireTemplates.writeStore)(newStore);\n console.log(_chalk2.default.green(`KSS source in ${filepath} changed or added`));\n return newStore;\n }\n\n console.log(_chalk2.default.magenta(`KSS section in ${filepath} is missing a section reference`));\n return newStore;\n }\n\n console.log(_chalk2.default.magenta(`No KSS found in ${filepath}`));\n return newStore;\n }\n\n if (oldSection) {\n newStore = deleteKSS(filepath, oldSection, newStore);\n }\n\n console.log(_chalk2.default.red(`${filepath} not found or empty`)); // eslint-disable-line no-console\n return newStore;\n}\n\n/**\n * Handle removal of a KSS section\n *\n * @function deleteKSS\n * @param {string} filepath - filepath of changed file (comes from gaze)\n * @param {object} section - KSS section data\n * @param {object} store - memory store\n * @return {object} updated data store\n */\n/** @module cli/kss-handler */\n\nfunction deleteKSS(filepath, section, store) {\n const file = _path2.default.parse(filepath);\n\n if (section.reference && section.referenceURI) {\n // Remove section data from memory store\n return unsetSection(section, file, store, true);\n }\n\n return store;\n}\n\n/**\n * Update the sections store with new data for a specific section\n *\n * @function updateSectionData\n * @param {object} section - contains updated section data\n * @param {string} kssPath - path to KSS section\n * @param {object} store - memory store\n * @return {object} updated data store\n */\nfunction updateSectionData(kssPath, section, oldSection, store) {\n const sectionFileInfo = _path2.default.parse(kssPath);\n const dataFilepath = _path2.default.join(sectionFileInfo.dir, `${sectionFileInfo.name}.json`);\n const isInline = null !== section.markup.match(/<\\/[^>]*>/);\n const newSort = sortSection(store.getIn(['sections', 'sorted']), section.reference, store.get('referenceDelimiter'));\n const newSection = Object.assign({}, oldSection, section);\n let newStore = store;\n\n // Required for reference from templates and data\n newSection.kssPath = kssPath;\n\n if (isInline) {\n // Set section value if inlineTempalte() returned a path\n newStore = updateInlineTemplate(kssPath, oldSection, newSection, newStore);\n } else {\n // Remove inline template, if it exists\n utils.removeFile(newSection.referenceURI, 'template', kssPath, store);\n // Update markup and data fields\n newStore = updateTemplateFields(sectionFileInfo, oldSection, newSection, newStore);\n }\n\n // Output section description\n newStore = updateDescription(kssPath, oldSection, newSection, newStore);\n\n // Output section data to a JSON file\n newSection.sectionPath = utils.writeSectionData(newStore, newSection, dataFilepath);\n\n // Update section sorting\n return newStore.setIn(['sections', 'sorted'], newSort).setIn(['sections', 'sectionsByPath', kssPath], newSection).setIn(['sections', 'sectionsByURI', section.referenceURI], newSection);\n}\n\n/**\n * Handle detection and output of inline templates, which is markup written\n * in the KSS documentation itself as opposed to an external file\n *\n * @function updateInlineTemplate\n * @param {string} oldSection - previous iteration of KSS data, if updated\n * @param {object} section - KSS section data\n * @return {object} updated data store with new template path info\n */\nfunction updateInlineTemplate(filepath, oldSection, section, store) {\n const newSection = section;\n const newStore = store;\n\n // If we have inline markup\n if (fieldShouldOutput(oldSection, section, 'markup')) {\n newSection.templatePath = utils.writeFile(section.referenceURI, 'template', filepath, section.markup, store);\n newSection.templateContent = section.markup;\n\n return newStore.setIn(['sections', 'sectionsByPath', filepath], newSection).setIn(['sections', 'sectionsByURI', section.referenceURI], newSection);\n }\n\n return newStore;\n}\n\n/**\n * Handle output of section description\n *\n * @function updateDescription\n * @param {string} oldSection - previous iteration of KSS data, if updated\n * @param {object} section - KSS section data\n * @return {object} updated data store with new descripton path info\n */\nfunction updateDescription(filepath, oldSection, section, store) {\n const newSection = section;\n const newStore = store;\n\n // If we don't have previous KSS or the KSS has been updated\n if (fieldShouldOutput(oldSection, section, 'description')) {\n // Write new description\n newSection.descriptionPath = utils.writeFile(section.referenceURI, 'description', filepath, section.description, store);\n\n return newStore.setIn(['sections', 'sectionsByPath', filepath], newSection).setIn(['sections', 'sectionsByURI', section.referenceURI], newSection);\n }\n\n return newStore;\n}\n\n/**\n * Handle Data and Markup fields\n *\n * @function updateTemplateFields\n * @param {string} file - File data for KSS file from path.parse()\n * @param {object} oldSection - outdated KSS data\n * @param {object} section - KSS section data\n * @param {object} store - memory store\n * @return {object} KSS section data with updated asset paths\n */\nfunction updateTemplateFields(file, oldSection, section, store) {\n const kssPath = _path2.default.format(file);\n const newSection = section;\n let filepath = '';\n let oldFilepath = '';\n let newStore = store;\n\n ['data', 'markup'].forEach(field => {\n if (newSection[field]) {\n if (oldSection[field]) {\n oldFilepath = _path2.default.join(file.dir, oldSection[field]);\n newStore = (0, _handleTemplates.deleteTemplate)(oldFilepath, oldSection, newStore);\n }\n\n filepath = _path2.default.join(file.dir, newSection[field]);\n newStore = (0, _handleTemplates.updateTemplate)(filepath, newSection, newStore);\n } else {\n delete newSection[field];\n newStore = newStore.setIn(['sections', 'sectionsByPath', kssPath], newSection).setIn(['sections', 'sectionsByURI', newSection.referenceURI], newSection);\n }\n });\n\n return newStore;\n}\n\n/**\n * Remove a section from the memory store\n *\n * @function unsetSection\n * @param {object} section - contains updated section data\n * @param {string} file - file object from path.parse()\n * @param {object} store - memory store\n * @param {bool} removed - has the file been removed or just the section information changed?\n * @return {object} updated data store with new descripton path info\n */\nfunction unsetSection(section, file, store, removed) {\n const sorted = store.getIn(['sections', 'sorted']);\n const kssPath = _path2.default.format(file);\n const dataFilepath = _path2.default.join(file.dir, `${file.name}.json`);\n const isInline = section.markup && null !== section.markup.match(/<\\/[^>]*>/);\n const newSort = unsortSection(sorted, section.reference, store.get('referenceDelimiter'));\n let newStore = store;\n\n // Remove old section data\n utils.removeFile(section.referenceURI, 'section', dataFilepath, newStore);\n\n // Remove associated inline template\n if (isInline) {\n utils.removeFile(section.referenceURI, 'template', kssPath, newStore);\n }\n\n // Remove description template\n utils.removeFile(section.referenceURI, 'description', kssPath, newStore);\n\n // Remove data from sectionsByPath if file has been removed\n if (removed) {\n newStore = newStore.deleteIn(['sections', 'sectionsByPath', kssPath]);\n }\n\n return newStore.deleteIn(['sections', 'sectionsByURI', section.referenceURI]).setIn(['sections', 'sorted'], newSort);\n}\n\n/**\n * Sort sections and subsections\n *\n * @function sortSection\n * @param {object} sorted - currently sorted sections\n * @param {string} reference - reference URI of section to sort\n * @return {object} updated data store with new descripton path info\n */\nfunction sortSection(sorted, reference, delimiter) {\n const parts = reference.split(delimiter);\n const newSort = sorted[parts[0]] || {};\n const newSorted = sorted;\n\n if (1 < parts.length) {\n const newParts = parts.filter((part, idx) => 0 !== idx);\n newSorted[parts[0]] = sortSection(newSort, newParts.join(delimiter), delimiter);\n } else {\n newSorted[parts[0]] = newSort;\n }\n\n return newSorted;\n}\n\n/**\n * Remove a section from the sorted sections\n *\n * @function unsortSection\n * @param {object} sorted - currently sorted sections\n * @param {string} reference - reference URI of section to sort\n * @return {object} updated data store with new descripton path info\n */\nfunction unsortSection(sorted, reference, delimiter) {\n const parts = reference.split(delimiter);\n const subsections = Object.keys(sorted[parts[0]]);\n const newSorted = sorted;\n\n if (subsections.length) {\n if (1 < parts.length) {\n const newParts = parts.filter((part, idx) => 0 !== idx);\n newSorted[parts[0]] = unsortSection(newSorted[parts[0]], newParts.join(delimiter), delimiter);\n }\n } else {\n delete newSorted[parts[0]];\n }\n\n return newSorted;\n}\n\n/**\n * Compare a KSS field between old and new KSS data to see if we need to output\n * a new module for that field\n *\n * @function fieldShouldOutput\n * @param {object} oldSection - currently sorted sections\n * @param {object} newSection - reference URI of section to sort\n * @param {string} field - KSS field to check\n * @return {bool} output a new module for the KSS field\n */\nfunction fieldShouldOutput(oldSection, newSection, field) {\n return oldSection && (oldSection[field] !== newSection[field] || oldSection.referenceURI !== newSection.referenceURI) || !oldSection;\n}//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMTUuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vc3JjL2NsaS9oYW5kbGVLU1MuanM/MzJmZCJdLCJzb3VyY2VzQ29udGVudCI6WyIvKiogQG1vZHVsZSBjbGkva3NzLWhhbmRsZXIgKi9cblxuaW1wb3J0IHBhdGggZnJvbSAncGF0aCc7XG5pbXBvcnQgZnMgZnJvbSAnZnMtZXh0cmEnO1xuaW1wb3J0IHsgcGFyc2UgfSBmcm9tICdrc3MnO1xuaW1wb3J0IGNoYWxrIGZyb20gJ2NoYWxrJztcblxuaW1wb3J0ICogYXMg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O0FBQ0E7QUFNQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBR0E7QUFDQTtBQUNBOzs7Ozs7OztBQVFBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFLQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOzs7Ozs7OztBQVFBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUtBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTs7Ozs7Ozs7OztBQVVBO0FBQ0E7QUFLQSIsInNvdXJjZVJvb3QiOiIifQ=="); /***/ }), /* 16 */ +/* no static exports found */ +/* all exports used */ +/*!************************************!*\ + !*** ./src/cli/requireExternal.js ***! + \************************************/ /***/ (function(module, exports) { -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = requireExternal; -// Necessary to remove require statement from Webpack processing preserve it in output -/* eslint-disable import/no-dynamic-require, global-require */ -function requireExternal(requirePath) { - return require(requirePath); -} -/* eslint-enable */ +eval("\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = requireExternal;\n// Necessary to remove require statement from Webpack processing preserve it in output\n/* eslint-disable import/no-dynamic-require, global-require */\nfunction requireExternal(requirePath) {\n return require(requirePath);\n}\n/* eslint-enable *///# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMTYuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vc3JjL2NsaS9yZXF1aXJlRXh0ZXJuYWwuanM/OWM3MCJdLCJzb3VyY2VzQ29udGVudCI6WyIvLyBOZWNlc3NhcnkgdG8gcmVtb3ZlIHJlcXVpcmUgc3RhdGVtZW50IGZyb20gV2VicGFjayBwcm9jZXNzaW5nIHByZXNlcnZlIGl0IGluIG91dHB1dFxuLyogZXNsaW50LWRpc2FibGUgaW1wb3J0L25vLWR5bmFtaWMtcmVxdWlyZSwgZ2xvYmFsLXJlcXVpcmUgKi9cbmV4cG9ydCBkZWZhdWx0IGZ1bmN0aW9uIHJlcXVpcmVFeHRlcm5hbChyZXF1aXJlUGF0aCkge1xuICByZXR1cm4gcmVxdWlyZShyZXF1aXJlUGF0aCk7XG59XG4vKiBlc2xpbnQtZW5hYmxlICovXG5cblxuXG4vLyBXRUJQQUNLIEZPT1RFUiAvL1xuLy8gc3JjL2NsaS9yZXF1aXJlRXh0ZXJuYWwuanMiXSwibWFwcGluZ3MiOiI7Ozs7O0FBRUE7QUFGQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0EiLCJzb3VyY2VSb290IjoiIn0="); /***/ }), /* 17 */ +/* no static exports found */ +/* all exports used */ +/*!***************************!*\ + !*** ./src/cli/server.js ***! + \***************************/ /***/ (function(module, exports, __webpack_require__) { "use strict"; - - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = startWebpack; - -var _webpack = __webpack_require__(5); - -var _webpack2 = _interopRequireDefault(_webpack); - -var _webpackDevServer = __webpack_require__(29); - -var _webpackDevServer2 = _interopRequireDefault(_webpackDevServer); - -var _chalk = __webpack_require__(2); - -var _chalk2 = _interopRequireDefault(_chalk); - -var _opn = __webpack_require__(27); - -var _opn2 = _interopRequireDefault(_opn); - -var _devServer = __webpack_require__(10); - -var _devServer2 = _interopRequireDefault(_devServer); - -var _parseArgs = __webpack_require__(4); - -var _parseArgs2 = _interopRequireDefault(_parseArgs); - -var _utils = __webpack_require__(1); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/** - * Spin up webpack-dev-server or, if production flag is set, run webpack a single time - * - * @function startWebpack - * @param {object} config - webpack configuration, preprocessed by {@link module:cli/generate-config generateConfig} - * @see {@link module:cli/generate-config generateConfig} - */ -function startWebpack(config) { - const huron = config.huron; - const webpackConfig = config.webpack; - const compiler = (0, _webpack2.default)(webpackConfig); - - if (_parseArgs2.default.progress) { - compiler.apply(new _webpack2.default.ProgressPlugin((percentage, msg) => { - console.log(`${percentage * 100}% `, msg); - })); - } - - if (_parseArgs2.default.production) { - compiler.run((err, stats) => { - const info = stats.toJson(); - - if (err) { - console.log(err); - } - - if (stats.hasErrors()) { - console.error(_chalk2.default.red('Webpack encountered errors during compile: ', info.errors)); - } - - if (stats.hasWarnings()) { - console.error(_chalk2.default.yellow('Webpack encountered warnings during compile: ', info.warnings)); - } - }); - } else { - const server = new _webpackDevServer2.default(compiler, (0, _devServer2.default)(huron)); - const prototypeName = huron.prototypes[0].title || huron.prototypes[0]; - - server.listen(huron.port, 'localhost', err => { - if (err) { - return console.log(err); - } - - console.log(`Listening at http://localhost:${huron.port}/`); - (0, _opn2.default)(`http://localhost:${huron.port}/${(0, _utils.removeTrailingSlash)(huron.root)}/${prototypeName}.html`); - return true; - }); - } -} /** @module cli/webpack-server */ +eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = startWebpack;\n\nvar _webpack = __webpack_require__(/*! webpack */ 5);\n\nvar _webpack2 = _interopRequireDefault(_webpack);\n\nvar _webpackDevServer = __webpack_require__(/*! webpack-dev-server */ 29);\n\nvar _webpackDevServer2 = _interopRequireDefault(_webpackDevServer);\n\nvar _chalk = __webpack_require__(/*! chalk */ 2);\n\nvar _chalk2 = _interopRequireDefault(_chalk);\n\nvar _opn = __webpack_require__(/*! opn */ 27);\n\nvar _opn2 = _interopRequireDefault(_opn);\n\nvar _devServer = __webpack_require__(/*! ../../config/devServer.config */ 10);\n\nvar _devServer2 = _interopRequireDefault(_devServer);\n\nvar _parseArgs = __webpack_require__(/*! ./parseArgs */ 4);\n\nvar _parseArgs2 = _interopRequireDefault(_parseArgs);\n\nvar _utils = __webpack_require__(/*! ./utils */ 1);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n/**\n * Spin up webpack-dev-server or, if production flag is set, run webpack a single time\n *\n * @function startWebpack\n * @param {object} config - webpack configuration, preprocessed by {@link module:cli/generate-config generateConfig}\n * @see {@link module:cli/generate-config generateConfig}\n */\nfunction startWebpack(config) {\n const huron = config.huron;\n const webpackConfig = config.webpack;\n const compiler = (0, _webpack2.default)(webpackConfig);\n\n if (_parseArgs2.default.progress) {\n compiler.apply(new _webpack2.default.ProgressPlugin((percentage, msg) => {\n console.log(`${percentage * 100}% `, msg);\n }));\n }\n\n if (_parseArgs2.default.production) {\n compiler.run((err, stats) => {\n const info = stats.toJson();\n\n if (err) {\n console.log(err);\n }\n\n if (stats.hasErrors()) {\n console.error(_chalk2.default.red('Webpack encountered errors during compile: ', info.errors));\n }\n\n if (stats.hasWarnings()) {\n console.error(_chalk2.default.yellow('Webpack encountered warnings during compile: ', info.warnings));\n }\n });\n } else {\n const server = new _webpackDevServer2.default(compiler, (0, _devServer2.default)(huron));\n const prototypeName = huron.prototypes[0].title || huron.prototypes[0];\n\n server.listen(huron.port, 'localhost', err => {\n if (err) {\n return console.log(err);\n }\n\n console.log(`Listening at http://localhost:${huron.port}/`);\n (0, _opn2.default)(`http://localhost:${huron.port}/${(0, _utils.removeTrailingSlash)(huron.root)}/${prototypeName}.html`);\n return true;\n });\n }\n} /** @module cli/webpack-server *///# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMTcuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vc3JjL2NsaS9zZXJ2ZXIuanM/ODJlMSJdLCJzb3VyY2VzQ29udGVudCI6WyIvKiogQG1vZHVsZSBjbGkvd2VicGFjay1zZXJ2ZXIgKi9cbmltcG9ydCB3ZWJwYWNrIGZyb20gJ3dlYnBhY2snO1xuaW1wb3J0IFdlYnBhY2tEZXZTZXJ2ZXIgZnJvbSAnd2VicGFjay1kZXYtc2VydmVyJztcbmltcG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cbiAgICAgICdsb2NhbGhvc3QnLFxuICAgICAgKGVycikgPT4ge1xuICAgICAgICBpZiAoZXJyKSB7XG4gICAgICAgICAgcmV0dXJuIGNvbnNvbGUubG9nKGVycik7XG4gICAgICAgIH1cblxuICAgICAgICBjb25zb2xlLmxvZyhgTGlzdGVuaW5nIGF0IGh0dHA6Ly9sb2NhbGhvc3Q6JHtodXJvbi5wb3J0fS9gKTtcbiAgICAgICAgb3BlbihgaHR0cDovL2xvY2FsaG9zdDoke2h1cm9uLnBvcnR9LyR7XG4gICAgICAgICAgcmVtb3ZlVHJhaWxpbmdTbGFzaChodXJvbi5yb290KVxuICAgICAgICB9LyR7cHJvdG90eXBlTmFtZX0uaHRtbGApO1xuICAgICAgICByZXR1cm4gdHJ1ZTtcbiAgICAgIH1cbiAgICApO1xuICB9XG59XG5cblxuXG4vLyBXRUJQQUNLIEZPT1RFUiAvL1xuLy8gc3JjL2NsaS9zZXJ2ZXIuanMiXSwibWFwcGluZ3MiOiI7Ozs7O0FBaUJBO0FBQ0E7QUFqQkE7QUFDQTs7O0FBQUE7QUFDQTs7O0FBQUE7QUFDQTs7O0FBQUE7QUFDQTs7O0FBQ0E7QUFDQTs7O0FBQUE7QUFDQTs7O0FBQUE7QUFDQTs7O0FBQ0E7Ozs7Ozs7QUFPQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUdBO0FBQ0E7QUFHQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFNQTtBQUNBO0FBQ0E7QUFDQTtBQUtBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBSUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBR0E7QUFDQTtBQUVBO0FBQ0EiLCJzb3VyY2VSb290IjoiIn0="); /***/ }), /* 18 */ +/* no static exports found */ +/* all exports used */ +/*!*******************************************!*\ + !*** ./src/defaultConfig/huron.config.js ***! + \*******************************************/ /***/ (function(module, exports, __webpack_require__) { "use strict"; - - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _path = __webpack_require__(0); - -var _path2 = _interopRequireDefault(_path); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -exports.default = { - css: [], - entry: 'huron', - js: [], - kss: 'css/', - kssExtension: '.css', - kssOptions: { - multiline: true, - markdown: true, - custom: ['data'] - }, - output: 'partials', - port: 8080, - prototypes: ['index'], - root: 'dist/', - sectionTemplate: _path2.default.join(__dirname, '../../templates/section.hbs'), - classNames: false, - templates: { - rule: { - test: /\.(hbs|handlebars)$/, - use: 'handlebars-loader' - }, - extension: '.hbs' - }, - window: {} -}; +eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _path = __webpack_require__(/*! path */ 0);\n\nvar _path2 = _interopRequireDefault(_path);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nexports.default = {\n css: [],\n entry: 'huron',\n js: [],\n kss: 'css/',\n kssExtension: '.css',\n kssOptions: {\n multiline: true,\n markdown: true,\n custom: ['data']\n },\n output: 'partials',\n port: 8080,\n prototypes: ['index'],\n root: 'dist/',\n sectionTemplate: _path2.default.join(__dirname, '../../templates/section.hbs'),\n classNames: false,\n templates: {\n rule: {\n test: /\\.(hbs|handlebars)$/,\n use: 'handlebars-loader'\n },\n extension: '.hbs'\n },\n window: {}\n};//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMTguanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vc3JjL2RlZmF1bHRDb25maWcvaHVyb24uY29uZmlnLmpzP2I1MjYiXSwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHBhdGggZnJvbSAncGF0aCc7XG5cbmV4cG9ydCBkZWZhdWx0IHtcbiAgY3NzOiBbXSxcbiAgZW50cnk6ICdodXJvbicsXG4gIGpzOiBbXSxcbiAga3NzOiAnY3NzLycsXG4gIGtzc0V4dGVuc2lvbjogJy5jc3MnLFxuICBrc3NPcHRpb25zOiB7XG4gICAgbXVsdGlsaW5lOiB0cnVlLFxuICAgIG1hcmtkb3duOiB0cnVlLFxuICAgIGN1c3RvbTogWydkYXRhJ10sXG4gIH0sXG4gIG91dHB1dDogJ3BhcnRpYWxzJyxcbiAgcG9ydDogODA4MCxcbiAgcHJvdG90eXBlczogWydpbmRleCddLFxuICByb290OiAnZGlzdC8nLFxuICBzZWN0aW9uVGVtcGxhdGU6IHBhdGguam9pbihfX2Rpcm5hbWUsICcuLi8uLi90ZW1wbGF0ZXMvc2VjdGlvbi5oYnMnKSxcbiAgY2xhc3NOYW1lczogZmFsc2UsXG4gIHRlbXBsYXRlczoge1xuICAgIHJ1bGU6IHtcbiAgICAgIHRlc3Q6IC9cXC4oaGJzfGhhbmRsZWJhcnMpJC8sXG4gICAgICB1c2U6ICdoYW5kbGViYXJzLWxvYWRlcicsXG4gICAgfSxcbiAgICBleHRlbnNpb246ICcuaGJzJyxcbiAgfSxcbiAgd2luZG93OiB7fSxcbn07XG5cblxuXG4vLyBXRUJQQUNLIEZPT1RFUiAvL1xuLy8gc3JjL2RlZmF1bHRDb25maWcvaHVyb24uY29uZmlnLmpzIl0sIm1hcHBpbmdzIjoiOzs7Ozs7QUFBQTtBQUNBOzs7OztBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBSEE7QUFLQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUZBO0FBSUE7QUFMQTtBQU9BO0FBeEJBIiwic291cmNlUm9vdCI6IiJ9"); /***/ }), /* 19 */ +/* no static exports found */ +/* all exports used */ +/*!*********************************************!*\ + !*** ./src/defaultConfig/webpack.config.js ***! + \*********************************************/ /***/ (function(module, exports, __webpack_require__) { "use strict"; - - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _webpack = __webpack_require__(5); - -var _webpack2 = _interopRequireDefault(_webpack); - -var _path = __webpack_require__(0); - -var _path2 = _interopRequireDefault(_path); - -var _parseArgs = __webpack_require__(4); - -var _parseArgs2 = _interopRequireDefault(_parseArgs); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -exports.default = huron => { - const cwd = process.cwd(); - - return { - entry: {}, - output: { - path: _path2.default.join(cwd, huron.root), - publicPath: _parseArgs2.default.production ? '' : `http://localhost:${huron.port}/${huron.root}`, - filename: '[name].js', - chunkFilename: '[name].chunk.min.js' - }, - plugins: [new _webpack2.default.HotModuleReplacementPlugin(), new _webpack2.default.NamedModulesPlugin()], - resolve: { - modulesDirectories: [_path2.default.resolve(__dirname, '../src/js')] - }, - resolveLoader: { - modulesDirectories: ['web_loaders', 'web_modules', 'node_loaders', 'node_modules', _path2.default.resolve(__dirname, '../node_modules')] - }, - module: { - rules: [{ - test: /\.html$/, - include: [_path2.default.join(cwd, huron.root, huron.output)], - use: 'html-loader' - }, { - test: /\.(hbs|handlebars)$/, - include: [_path2.default.join(cwd, huron.root, 'huron-assets')], - use: { - loader: 'handlebars-loader', - options: { - helperDirs: [_path2.default.join(__dirname, '../../', 'templates/handlebarsHelpers')] - } - } - }] - } - }; -}; +eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _webpack = __webpack_require__(/*! webpack */ 5);\n\nvar _webpack2 = _interopRequireDefault(_webpack);\n\nvar _path = __webpack_require__(/*! path */ 0);\n\nvar _path2 = _interopRequireDefault(_path);\n\nvar _parseArgs = __webpack_require__(/*! ../cli/parseArgs */ 4);\n\nvar _parseArgs2 = _interopRequireDefault(_parseArgs);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nexports.default = huron => {\n const cwd = process.cwd();\n\n return {\n entry: {},\n output: {\n path: _path2.default.join(cwd, huron.root),\n publicPath: _parseArgs2.default.production ? '' : `/${huron.root}`,\n filename: '[name].js',\n chunkFilename: '[name].chunk.min.js'\n },\n plugins: [new _webpack2.default.HotModuleReplacementPlugin(), new _webpack2.default.NamedModulesPlugin()],\n resolve: {\n modulesDirectories: [_path2.default.resolve(__dirname, '../src/js')]\n },\n resolveLoader: {\n modulesDirectories: ['web_loaders', 'web_modules', 'node_loaders', 'node_modules', _path2.default.resolve(__dirname, '../node_modules')]\n },\n module: {\n rules: [{\n test: /\\.html$/,\n include: [_path2.default.join(cwd, huron.root, huron.output)],\n use: 'html-loader'\n }, {\n test: /\\.(hbs|handlebars)$/,\n include: [_path2.default.join(cwd, huron.root, 'huron-assets')],\n use: {\n loader: 'handlebars-loader',\n options: {\n helperDirs: [_path2.default.join(__dirname, '../../', 'templates/handlebarsHelpers')]\n }\n }\n }]\n }\n };\n};//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMTkuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vc3JjL2RlZmF1bHRDb25maWcvd2VicGFjay5jb25maWcuanM/M2Q3YyJdLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgd2VicGFjayBmcm9tICd3ZWJwYWNrJztcbmltcG9ydCBwYXRoIGZyb20gJ3BhdGgnO1xuXG5pbXBvcnQgcHJvZ3JhbSBmcm9tICcuLi9jbGkvcGFyc2VBcmdzJztcblxuZXhwb3J0IGRlZmF1bHQgKGh1cm9uKSA9PiB7XG4gIGNvbnN0IGN3ZCA9IHByb2Nlc3MuY3dkKCk7XG5cbiAgcmV0dXJuIHtcbiAgICBlbnRyeToge30sXG4gICAgb3V0cHV0OiB7XG4gICAgICBwYXRoOiBwYXRoLmpvaW4oY3dkLCBodXJvbi5yb290KSxcbiAgICAgIHB1YmxpY1BhdGg6IHByb2dyYW0ucHJvZHVjdGlvbiA/ICcnIDpcbiAgICAgICAgYC8ke2h1cm9uLnJvb3R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iB7XG4gICAgICAgICAgICBsb2FkZXI6ICdoYW5kbGViYXJzLWxvYWRlcicsXG4gICAgICAgICAgICBvcHRpb25zOiB7XG4gICAgICAgICAgICAgIGhlbHBlckRpcnM6IFtwYXRoLmpvaW4oXG4gICAgICAgICAgICAgICAgX19kaXJuYW1lLFxuICAgICAgICAgICAgICAgICcuLi8uLi8nLFxuICAgICAgICAgICAgICAgICd0ZW1wbGF0ZXMvaGFuZGxlYmFyc0hlbHBlcnMnXG4gICAgICAgICAgICAgICldLFxuICAgICAgICAgICAgfSxcbiAgICAgICAgICB9LFxuICAgICAgICB9LFxuICAgICAgXSxcbiAgICB9LFxuICB9O1xufTtcblxuXG5cbi8vIFdFQlBBQ0sgRk9PVEVSIC8vXG4vLyBzcmMvZGVmYXVsdENvbmZpZy93ZWJwYWNrLmNvbmZpZy5qcyJdLCJtYXBwaW5ncyI6Ijs7Ozs7O0FBQUE7QUFDQTs7O0FBQUE7QUFDQTs7O0FBQ0E7QUFDQTs7Ozs7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBRUE7QUFDQTtBQUxBO0FBT0E7QUFJQTtBQUNBO0FBREE7QUFLQTtBQUNBO0FBREE7QUFTQTtBQUNBO0FBRUE7QUFDQTtBQUNBO0FBSEE7QUFNQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFEQTtBQUZBO0FBSEE7QUFQQTtBQTNCQTtBQW1EQSIsInNvdXJjZVJvb3QiOiIifQ=="); /***/ }), /* 20 */ +/* no static exports found */ +/* all exports used */ +/*!**********************************************************************!*\ + !*** ./~/raw-loader!./~/babel-loader/lib!./templates/hotTemplate.js ***! + \**********************************************************************/ /***/ (function(module, exports) { -module.exports = "'use strict';\n\nvar _huronStore = require('./huron-store');\n\nvar _huronStore2 = _interopRequireDefault(_huronStore);\n\nvar _insertNodes = require('./insertNodes');\n\nvar _insertNodes2 = _interopRequireDefault(_insertNodes);\n\nvar _section = require('./section.hbs');\n\nvar _section2 = _interopRequireDefault(_section);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n/* eslint-enable */\n\nconst assets = require.context(hotScope.requirePath, true, hotScope.requireRegex); /* globals hotScope */\n\n// NOTE: This is not a normal JS file! It is pulled in by the CLI as a string\n// and prepended to the browser script after replacing anything referenced via `hotScope[variable]`\n// with CLI arguments or config properties passed in by the user.\n\n/* eslint-disable */\n\nconst modules = {};\n\nmodules[hotScope.sectionTemplatePath] = _section2.default;\n\nassets.keys().forEach(key => {\n modules[key] = assets(key);\n});\n\nconst insert = new _insertNodes2.default(modules, _huronStore2.default);\n\nif (module.hot) {\n // Hot Module Replacement for huron components (json, hbs, html)\n module.hot.accept(assets.id, () => {\n const newAssets = require.context(hotScope.requirePath, true, hotScope.requireRegex);\n const newModules = newAssets.keys().map(key => [key, newAssets(key)]).filter(newModule => modules[newModule[0]] !== newModule[1]);\n\n updateStore(require('./huron-store.js')); // eslint-disable-line global-require, import/no-unresolved\n newModules.forEach(module => {\n modules[module[0]] = module[1];\n hotReplace(module[0], module[1], modules);\n });\n });\n\n // Hot Module Replacement for sections template\n module.hot.accept('./section.hbs', () => {\n const newSectionTemplate = require('./section.hbs'); // eslint-disable-line global-require, import/no-unresolved\n\n modules[hotScope.sectionTemplatePath] = newSectionTemplate;\n hotReplace('./huron-assets/section.hbs', newSectionTemplate, modules);\n });\n\n // Hot Module Replacement for data store\n module.hot.accept('./huron-store.js', () => {\n updateStore(require('./huron-store.js')); // eslint-disable-line global-require, import/no-unresolved\n });\n}\n\nfunction hotReplace(key, module, newModules) {\n insert.modules = newModules;\n if (key === _huronStore2.default.sectionTemplatePath) {\n insert.cycleSections();\n } else {\n insert.inserted = [];\n insert.loadModule(key, module, false);\n }\n}\n\nfunction updateStore(newStore) {\n insert.store = newStore;\n}" +eval("module.exports = \"'use strict';\\n\\nvar _huronStore = require('./huron-store');\\n\\nvar _huronStore2 = _interopRequireDefault(_huronStore);\\n\\nvar _insertNodes = require('./insertNodes');\\n\\nvar _insertNodes2 = _interopRequireDefault(_insertNodes);\\n\\nvar _section = require('./section.hbs');\\n\\nvar _section2 = _interopRequireDefault(_section);\\n\\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\\n\\n/* eslint-enable */\\n\\nconst assets = require.context(hotScope.requirePath, true, hotScope.requireRegex); /* globals hotScope */\\n\\n// NOTE: This is not a normal JS file! It is pulled in by the CLI as a string\\n// and prepended to the browser script after replacing anything referenced via `hotScope[variable]`\\n// with CLI arguments or config properties passed in by the user.\\n\\n/* eslint-disable */\\n\\nconst modules = {};\\n\\nmodules[hotScope.sectionTemplatePath] = _section2.default;\\n\\nassets.keys().forEach(key => {\\n modules[key] = assets(key);\\n});\\n\\nconst insert = new _insertNodes2.default(modules, _huronStore2.default);\\n\\nif (module.hot) {\\n // Hot Module Replacement for huron components (json, hbs, html)\\n module.hot.accept(assets.id, () => {\\n const newAssets = require.context(hotScope.requirePath, true, hotScope.requireRegex);\\n const newModules = newAssets.keys().map(key => [key, newAssets(key)]).filter(newModule => modules[newModule[0]] !== newModule[1]);\\n\\n updateStore(require('./huron-store.js')); // eslint-disable-line global-require, import/no-unresolved\\n newModules.forEach(module => {\\n modules[module[0]] = module[1];\\n hotReplace(module[0], module[1], modules);\\n });\\n });\\n\\n // Hot Module Replacement for sections template\\n module.hot.accept('./section.hbs', () => {\\n const newSectionTemplate = require('./section.hbs'); // eslint-disable-line global-require, import/no-unresolved\\n\\n modules[hotScope.sectionTemplatePath] = newSectionTemplate;\\n hotReplace('./huron-assets/section.hbs', newSectionTemplate, modules);\\n });\\n\\n // Hot Module Replacement for data store\\n module.hot.accept('./huron-store.js', () => {\\n updateStore(require('./huron-store.js')); // eslint-disable-line global-require, import/no-unresolved\\n });\\n}\\n\\nfunction hotReplace(key, module, newModules) {\\n insert.modules = newModules;\\n if (key === _huronStore2.default.sectionTemplatePath) {\\n insert.cycleSections();\\n } else {\\n insert.inserted = [];\\n insert.loadModule(key, module, false);\\n }\\n}\\n\\nfunction updateStore(newStore) {\\n insert.store = newStore;\\n}\"//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMjAuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi90ZW1wbGF0ZXMvaG90VGVtcGxhdGUuanM/YzA4MiJdLCJzb3VyY2VzQ29udGVudCI6WyJtb2R1bGUuZXhwb3J0cyA9IFwiJ3VzZSBzdHJpY3QnO1xcblxcbnZhciBfaHVyb25TdG9yZSA9IHJlcXVpcmUoJy4vaHVyb24tc3RvcmUnKTtcXG5cXG52YXIgX2h1cm9uU3RvcmUyID0gX2ludGVyb3BSZXF1aXJlRGVmYXVsdChfaHVyb25TdG9yZSk7XFxuXFxudmFyIF9pbnNlcnROb2RlcyA9IHJlcXVpcmUoJy4vaW5zZXJ0Tm9kZXMnKTtcXG5cXG52YXIgX2luc2VydE5vZGVzMiA9IF9pbnRlcm9wUmVxdWlyZURlZmF1bHQoX2luc2VydE5vZGVzKTtcXG5cXG52YXIgX3NlY3Rpb24gPSByZXF1aXJlKCcuL3NlY3Rpb24uaGJzJyk7XFxuXFxudmFyIF9zZWN0aW9uMiA9IF9pbnRlcm9wUmVxdWlyZURlZmF1bHQoX3NlY3Rpb24pO1xcblxcbmZ1bmN0aW9uIF9pbnRlcm9wUmVxdWlyZURlZmF1bHQob2JqKSB7IHJldHVybiBvYmogJiYgb2JqLl9fZXNNb2R1bGUgPyBvYmogOiB7IGRlZmF1bHQ6IG9iaiB9OyB9XFxuXFxuLyogZXNsaW50LWVuYWJsZSAqL1xcblxcbmNvbnN0IGFzc2V0cyA9IHJlcXVpcmUuY29udGV4dChob3RTY29wZS5yZXF1aXJlUGF0aCwgdHJ1ZSwgaG90U2NvcGUucmVxdWlyZVJlZ2V4KTsgLyogZ2xvYmFscyBob3RTY29wZSAqL1xcblxcbi8vIE5PVEU6IFRoaXMgaXMgbm90I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BkYXRlU3RvcmUocmVxdWlyZSgnLi9odXJvbi1zdG9yZS5qcycpKTsgLy8gZXNsaW50LWRpc2FibGUtbGluZSBnbG9iYWwtcmVxdWlyZSwgaW1wb3J0L25vLXVucmVzb2x2ZWRcXG4gIH0pO1xcbn1cXG5cXG5mdW5jdGlvbiBob3RSZXBsYWNlKGtleSwgbW9kdWxlLCBuZXdNb2R1bGVzKSB7XFxuICBpbnNlcnQubW9kdWxlcyA9IG5ld01vZHVsZXM7XFxuICBpZiAoa2V5ID09PSBfaHVyb25TdG9yZTIuZGVmYXVsdC5zZWN0aW9uVGVtcGxhdGVQYXRoKSB7XFxuICAgIGluc2VydC5jeWNsZVNlY3Rpb25zKCk7XFxuICB9IGVsc2Uge1xcbiAgICBpbnNlcnQuaW5zZXJ0ZWQgPSBbXTtcXG4gICAgaW5zZXJ0LmxvYWRNb2R1bGUoa2V5LCBtb2R1bGUsIGZhbHNlKTtcXG4gIH1cXG59XFxuXFxuZnVuY3Rpb24gdXBkYXRlU3RvcmUobmV3U3RvcmUpIHtcXG4gIGluc2VydC5zdG9yZSA9IG5ld1N0b3JlO1xcbn1cIlxuXG5cbi8vLy8vLy8vLy8vLy8vLy8vL1xuLy8gV0VCUEFDSyBGT09URVJcbi8vIC4vfi9yYXctbG9hZGVyIS4vfi9iYWJlbC1sb2FkZXIvbGliIS4vdGVtcGxhdGVzL2hvdFRlbXBsYXRlLmpzXG4vLyBtb2R1bGUgaWQgPSAyMFxuLy8gbW9kdWxlIGNodW5rcyA9IDAiXSwibWFwcGluZ3MiOiJBQUFBIiwic291cmNlUm9vdCI6IiJ9"); /***/ }), /* 21 */ +/* no static exports found */ +/* all exports used */ +/*!****************************!*\ + !*** external "commander" ***! + \****************************/ /***/ (function(module, exports) { -module.exports = require("commander"); +eval("module.exports = require(\"commander\");//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMjEuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vZXh0ZXJuYWwgXCJjb21tYW5kZXJcIj83NTczIl0sInNvdXJjZXNDb250ZW50IjpbIm1vZHVsZS5leHBvcnRzID0gcmVxdWlyZShcImNvbW1hbmRlclwiKTtcblxuXG4vLy8vLy8vLy8vLy8vLy8vLy9cbi8vIFdFQlBBQ0sgRk9PVEVSXG4vLyBleHRlcm5hbCBcImNvbW1hbmRlclwiXG4vLyBtb2R1bGUgaWQgPSAyMVxuLy8gbW9kdWxlIGNodW5rcyA9IDAiXSwibWFwcGluZ3MiOiJBQUFBIiwic291cmNlUm9vdCI6IiJ9"); /***/ }), /* 22 */ +/* no static exports found */ +/* all exports used */ +/*!***********************!*\ + !*** external "gaze" ***! + \***********************/ /***/ (function(module, exports) { -module.exports = require("gaze"); +eval("module.exports = require(\"gaze\");//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMjIuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vZXh0ZXJuYWwgXCJnYXplXCI/ZjIxOCJdLCJzb3VyY2VzQ29udGVudCI6WyJtb2R1bGUuZXhwb3J0cyA9IHJlcXVpcmUoXCJnYXplXCIpO1xuXG5cbi8vLy8vLy8vLy8vLy8vLy8vL1xuLy8gV0VCUEFDSyBGT09URVJcbi8vIGV4dGVybmFsIFwiZ2F6ZVwiXG4vLyBtb2R1bGUgaWQgPSAyMlxuLy8gbW9kdWxlIGNodW5rcyA9IDAiXSwibWFwcGluZ3MiOiJBQUFBIiwic291cmNlUm9vdCI6IiJ9"); /***/ }), /* 23 */ +/* no static exports found */ +/* all exports used */ +/*!**************************************!*\ + !*** external "html-webpack-plugin" ***! + \**************************************/ /***/ (function(module, exports) { -module.exports = require("html-webpack-plugin"); +eval("module.exports = require(\"html-webpack-plugin\");//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMjMuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vZXh0ZXJuYWwgXCJodG1sLXdlYnBhY2stcGx1Z2luXCI/MThlYyJdLCJzb3VyY2VzQ29udGVudCI6WyJtb2R1bGUuZXhwb3J0cyA9IHJlcXVpcmUoXCJodG1sLXdlYnBhY2stcGx1Z2luXCIpO1xuXG5cbi8vLy8vLy8vLy8vLy8vLy8vL1xuLy8gV0VCUEFDSyBGT09URVJcbi8vIGV4dGVybmFsIFwiaHRtbC13ZWJwYWNrLXBsdWdpblwiXG4vLyBtb2R1bGUgaWQgPSAyM1xuLy8gbW9kdWxlIGNodW5rcyA9IDAiXSwibWFwcGluZ3MiOiJBQUFBIiwic291cmNlUm9vdCI6IiJ9"); /***/ }), /* 24 */ +/* no static exports found */ +/* all exports used */ +/*!****************************!*\ + !*** external "immutable" ***! + \****************************/ /***/ (function(module, exports) { -module.exports = require("immutable"); +eval("module.exports = require(\"immutable\");//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMjQuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vZXh0ZXJuYWwgXCJpbW11dGFibGVcIj8xZDIwIl0sInNvdXJjZXNDb250ZW50IjpbIm1vZHVsZS5leHBvcnRzID0gcmVxdWlyZShcImltbXV0YWJsZVwiKTtcblxuXG4vLy8vLy8vLy8vLy8vLy8vLy9cbi8vIFdFQlBBQ0sgRk9PVEVSXG4vLyBleHRlcm5hbCBcImltbXV0YWJsZVwiXG4vLyBtb2R1bGUgaWQgPSAyNFxuLy8gbW9kdWxlIGNodW5rcyA9IDAiXSwibWFwcGluZ3MiOiJBQUFBIiwic291cmNlUm9vdCI6IiJ9"); /***/ }), /* 25 */ +/* no static exports found */ +/* all exports used */ +/*!**********************!*\ + !*** external "kss" ***! + \**********************/ /***/ (function(module, exports) { -module.exports = require("kss"); +eval("module.exports = require(\"kss\");//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMjUuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vZXh0ZXJuYWwgXCJrc3NcIj9jZDAyIl0sInNvdXJjZXNDb250ZW50IjpbIm1vZHVsZS5leHBvcnRzID0gcmVxdWlyZShcImtzc1wiKTtcblxuXG4vLy8vLy8vLy8vLy8vLy8vLy9cbi8vIFdFQlBBQ0sgRk9PVEVSXG4vLyBleHRlcm5hbCBcImtzc1wiXG4vLyBtb2R1bGUgaWQgPSAyNVxuLy8gbW9kdWxlIGNodW5rcyA9IDAiXSwibWFwcGluZ3MiOiJBQUFBIiwic291cmNlUm9vdCI6IiJ9"); /***/ }), /* 26 */ +/* no static exports found */ +/* all exports used */ +/*!*********************************!*\ + !*** external "lodash/isEqual" ***! + \*********************************/ /***/ (function(module, exports) { -module.exports = require("lodash/isEqual"); +eval("module.exports = require(\"lodash/isEqual\");//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMjYuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vZXh0ZXJuYWwgXCJsb2Rhc2gvaXNFcXVhbFwiP2NiNTIiXSwic291cmNlc0NvbnRlbnQiOlsibW9kdWxlLmV4cG9ydHMgPSByZXF1aXJlKFwibG9kYXNoL2lzRXF1YWxcIik7XG5cblxuLy8vLy8vLy8vLy8vLy8vLy8vXG4vLyBXRUJQQUNLIEZPT1RFUlxuLy8gZXh0ZXJuYWwgXCJsb2Rhc2gvaXNFcXVhbFwiXG4vLyBtb2R1bGUgaWQgPSAyNlxuLy8gbW9kdWxlIGNodW5rcyA9IDAiXSwibWFwcGluZ3MiOiJBQUFBIiwic291cmNlUm9vdCI6IiJ9"); /***/ }), /* 27 */ +/* no static exports found */ +/* all exports used */ +/*!**********************!*\ + !*** external "opn" ***! + \**********************/ /***/ (function(module, exports) { -module.exports = require("opn"); +eval("module.exports = require(\"opn\");//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMjcuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vZXh0ZXJuYWwgXCJvcG5cIj82MDBmIl0sInNvdXJjZXNDb250ZW50IjpbIm1vZHVsZS5leHBvcnRzID0gcmVxdWlyZShcIm9wblwiKTtcblxuXG4vLy8vLy8vLy8vLy8vLy8vLy9cbi8vIFdFQlBBQ0sgRk9PVEVSXG4vLyBleHRlcm5hbCBcIm9wblwiXG4vLyBtb2R1bGUgaWQgPSAyN1xuLy8gbW9kdWxlIGNodW5rcyA9IDAiXSwibWFwcGluZ3MiOiJBQUFBIiwic291cmNlUm9vdCI6IiJ9"); /***/ }), /* 28 */ +/* no static exports found */ +/* all exports used */ +/*!**********************!*\ + !*** external "url" ***! + \**********************/ /***/ (function(module, exports) { -module.exports = require("url"); +eval("module.exports = require(\"url\");//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMjguanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vZXh0ZXJuYWwgXCJ1cmxcIj9jYWVjIl0sInNvdXJjZXNDb250ZW50IjpbIm1vZHVsZS5leHBvcnRzID0gcmVxdWlyZShcInVybFwiKTtcblxuXG4vLy8vLy8vLy8vLy8vLy8vLy9cbi8vIFdFQlBBQ0sgRk9PVEVSXG4vLyBleHRlcm5hbCBcInVybFwiXG4vLyBtb2R1bGUgaWQgPSAyOFxuLy8gbW9kdWxlIGNodW5rcyA9IDAiXSwibWFwcGluZ3MiOiJBQUFBIiwic291cmNlUm9vdCI6IiJ9"); /***/ }), /* 29 */ +/* no static exports found */ +/* all exports used */ +/*!*************************************!*\ + !*** external "webpack-dev-server" ***! + \*************************************/ /***/ (function(module, exports) { -module.exports = require("webpack-dev-server"); +eval("module.exports = require(\"webpack-dev-server\");//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMjkuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vZXh0ZXJuYWwgXCJ3ZWJwYWNrLWRldi1zZXJ2ZXJcIj8xYmVhIl0sInNvdXJjZXNDb250ZW50IjpbIm1vZHVsZS5leHBvcnRzID0gcmVxdWlyZShcIndlYnBhY2stZGV2LXNlcnZlclwiKTtcblxuXG4vLy8vLy8vLy8vLy8vLy8vLy9cbi8vIFdFQlBBQ0sgRk9PVEVSXG4vLyBleHRlcm5hbCBcIndlYnBhY2stZGV2LXNlcnZlclwiXG4vLyBtb2R1bGUgaWQgPSAyOVxuLy8gbW9kdWxlIGNodW5rcyA9IDAiXSwibWFwcGluZ3MiOiJBQUFBIiwic291cmNlUm9vdCI6IiJ9"); /***/ }), /* 30 */ +/* no static exports found */ +/* all exports used */ +/*!*****************************!*\ + !*** multi ./src/cli/index ***! + \*****************************/ /***/ (function(module, exports, __webpack_require__) { -module.exports = __webpack_require__(9); +module.exports = __webpack_require__(/*! ./src/cli/index */9); /***/ }) -/******/ ]); -//# sourceMappingURL=index.js.map \ No newline at end of file +/******/ ]); \ No newline at end of file diff --git a/dist/cli/index.js.map b/dist/cli/index.js.map deleted file mode 100644 index 81b2b5d..0000000 --- a/dist/cli/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sources":["webpack:///webpack/bootstrap d325e4bb1751af827cca","webpack:///external \"path\"","webpack:///src/cli/utils.js","webpack:///external \"chalk\"","webpack:///external \"fs-extra\"","webpack:///src/cli/parseArgs.js","webpack:///external \"webpack\"","webpack:///src/cli/defaultStore.js","webpack:///src/cli/handleTemplates.js","webpack:///src/cli/requireTemplates.js","webpack:///src/cli/index.js","webpack:///config/devServer.config.js","webpack:///src/cli/actions.js","webpack:///src/cli/fileWatcher.js","webpack:///src/cli/generateConfig.js","webpack:///src/cli/handleHTML.js","webpack:///src/cli/handleKSS.js","webpack:///src/cli/requireExternal.js","webpack:///src/cli/server.js","webpack:///src/defaultConfig/huron.config.js","webpack:///src/defaultConfig/webpack.config.js","webpack:///./templates/hotTemplate.js","webpack:///external \"commander\"","webpack:///external \"gaze\"","webpack:///external \"html-webpack-plugin\"","webpack:///external \"immutable\"","webpack:///external \"kss\"","webpack:///external \"lodash/isEqual\"","webpack:///external \"opn\"","webpack:///external \"url\"","webpack:///external \"webpack-dev-server\""],"sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// identity function for calling harmony imports with the correct context\n \t__webpack_require__.i = function(value) { return value; };\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"../\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 30);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap d325e4bb1751af827cca","module.exports = require(\"path\");\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"path\"\n// module id = 0\n// module chunks = 0","/** @module cli/utilities */\nimport path from 'path';\nimport fs from 'fs-extra';\nimport chalk from 'chalk';\n\nconst cwd = process.cwd(); // Current working directory\n\n/**\n * Ensure predictable data structure for KSS section data\n *\n * @function normalizeSectionData\n * @param {object} section - section data\n * @return {object} section data\n */\nexport function normalizeSectionData(section) {\n const data = section.data || section;\n\n if (!data.referenceURI || '' === data.referenceURI) {\n data.referenceURI = section.referenceURI();\n }\n\n return data;\n}\n\n/**\n * Ensure predictable data structure for KSS section data\n *\n * @function writeSectionData\n * @param {object} store - data store\n * @param {object} section - section data\n * @param {string} sectionPath - output destination for section data file\n */\nexport function writeSectionData(store, section, sectionPath = false) {\n let outputPath = sectionPath;\n let sectionFileInfo;\n\n if (!outputPath && {}.hasOwnProperty.call(section, 'kssPath')) {\n sectionFileInfo = path.parse(section.kssPath);\n outputPath = path.join(\n sectionFileInfo.dir,\n `${sectionFileInfo.name}.json`\n );\n }\n\n // Output section data\n if (outputPath) {\n return writeFile(\n section.referenceURI,\n 'section',\n outputPath,\n JSON.stringify(section),\n store\n );\n }\n\n console.warn( // eslint-disable-line no-console\n chalk.red(`Failed to write section data for ${section.referenceURI}`)\n );\n return false;\n}\n\n/**\n * Find .json from a template file or vice versa\n *\n * @function getTemplateDataPair\n * @param {object} file - file object from path.parse()\n * @param {object} section - KSS section data\n * @return {string} relative path to module JSON file\n */\nexport function getTemplateDataPair(file, section, store) {\n const huron = store.get('config');\n const kssDir = matchKssDir(file.dir, huron);\n\n if (kssDir) {\n const componentPath = path.relative(\n path.resolve(cwd, kssDir),\n file.dir\n );\n const partnerType = '.json' === file.ext ? 'template' : 'data';\n const partnerExt = '.json' === file.ext ?\n huron.get('templates').extension :\n '.json';\n\n const pairPath = path.join(\n componentPath,\n generateFilename(\n section.referenceURI,\n partnerType,\n partnerExt,\n store\n )\n );\n\n return `./${pairPath}`;\n }\n\n return false;\n}\n\n/**\n * Normalize a section title for use as a filename\n *\n * @function normalizeHeader\n * @param {string} header - section header extracted from KSS documentation\n * @return {string} modified header, lowercase and words separated by dash\n */\nexport function normalizeHeader(header) {\n return header\n .toLowerCase()\n .replace(/\\s?\\W\\s?/g, '-');\n}\n\n/**\n * Wrap html in required template tags\n *\n * @function wrapMarkup\n * @param {string} content - html or template markup\n * @param {string} templateId - id of template (should be section reference)\n * @return {string} modified HTML\n */\nexport function wrapMarkup(content, templateId) {\n return `\n\n\\n`;\n}\n\n/**\n * Generate a filename based on referenceURI, type and file object\n *\n * @function generateFilename\n * @param {string} id - The name of the file (with extension).\n * @param {string} type - the type of file output\n * @param {object} ext - file extension\n * @param {store} store - data store\n * @return {string} Path to output file, relative to ouput dir (can be use in require statements)\n */\nexport function generateFilename(id, type, ext, store) {\n // Type of file and its corresponding extension(s)\n const types = store.get('types');\n const outputExt = '.scss' !== ext ? ext : '.html';\n\n /* eslint-disable */\n if (-1 === types.indexOf(type)) {\n console.log(`Huron data ${type} does not exist`);\n return false;\n }\n /* eslint-enable */\n\n return `${id}-${type}${outputExt}`;\n}\n\n/**\n * Copy an HTML file into the huron output directory.\n *\n * @function writeFile\n * @param {string} id - The name of the file (with extension).\n * @param {string} content - The content of the file to write.\n * @param {string} type - the type of file output\n * @param {object} store - The data store\n * @return {string} Path to output file, relative to ouput dir (can be use in require statements)\n */\nexport function writeFile(id, type, filepath, content, store) {\n const huron = store.get('config');\n const file = path.parse(filepath);\n const filename = generateFilename(id, type, file.ext, store);\n const kssDir = matchKssDir(filepath, huron);\n\n if (kssDir) {\n const componentPath = path.relative(\n path.resolve(cwd, kssDir),\n file.dir\n );\n const outputRelative = path.join(\n huron.get('output'),\n componentPath,\n `${filename}`\n );\n const outputPath = path.resolve(cwd, huron.get('root'), outputRelative);\n let newContent = content;\n\n if ('data' !== type && 'section' !== type) {\n newContent = wrapMarkup(content, id);\n }\n\n try {\n fs.outputFileSync(outputPath, newContent);\n console.log(chalk.green(`Writing ${outputRelative}`)); // eslint-disable-line no-console\n } catch (e) {\n console.log(chalk.red(`Failed to write ${outputRelative}`)); // eslint-disable-line no-console\n }\n\n return `./${outputRelative.replace(`${huron.get('output')}/`, '')}`;\n }\n\n return false;\n}\n\n/**\n * Delete a file in the huron output directory\n *\n * @function removeFile\n * @param {string} filename - The name of the file (with extension).\n * @param {object} store - The data store\n * @return {string} Path to output file, relative to ouput dir (can be use in require statements)\n */\nexport function removeFile(id, type, filepath, store) {\n const huron = store.get('config');\n const file = path.parse(filepath);\n const filename = generateFilename(id, type, file.ext, store);\n const kssDir = matchKssDir(filepath, huron);\n\n if (kssDir) {\n const componentPath = path.relative(\n path.resolve(cwd, kssDir),\n file.dir\n );\n const outputRelative = path.join(\n huron.get('output'),\n componentPath,\n `${filename}`\n );\n const outputPath = path.resolve(cwd, huron.get('root'), outputRelative);\n\n try {\n fs.removeSync(outputPath);\n console.log(chalk.green(`Removing ${outputRelative}`)); // eslint-disable-line no-console\n } catch (e) {\n console.log( // eslint-disable-line no-console\n chalk.red(`${outputRelative} does not exist or cannot be deleted`)\n );\n }\n\n return `./${outputRelative.replace(`${huron.get('output')}/`, '')}`;\n }\n\n return false;\n}\n\n/**\n * Write a template for sections\n *\n * @function writeSectionTemplate\n * @param {string} filepath - the original template file\n * @param {object} store - data store\n * @return {object} updated store\n */\nexport function writeSectionTemplate(filepath, store) {\n const huron = store.get('config');\n const sectionTemplate = wrapMarkup(fs.readFileSync(filepath, 'utf8'));\n const componentPath = './huron-assets/section.hbs';\n const output = path.join(\n cwd,\n huron.get('root'),\n componentPath\n );\n\n // Move huron script and section template into huron root\n fs.outputFileSync(output, sectionTemplate);\n console.log(chalk.green(`writing section template to ${output}`)); // eslint-disable-line no-console\n\n return store.set('sectionTemplatePath', componentPath);\n}\n\n/**\n * Request for section data based on section reference\n *\n * @function writeSectionTemplate\n * @param {string} search - key on which to match section\n * @param {field} string - field in which to look to determine section\n * @param {obj} store - sections memory store\n */\nexport function getSection(search, field, store) {\n const sectionValues = store\n .getIn(['sections', 'sectionsByPath'])\n .valueSeq();\n let selectedSection = false;\n\n if (field) {\n selectedSection = sectionValues\n .filter((value) => value[field] === search)\n .get(0);\n } else {\n selectedSection = store.getIn(['sections', 'sectionsByPath', search]);\n }\n\n return selectedSection;\n}\n\n/**\n * Find which configured KSS directory a filepath exists in\n *\n * @function matchKssDir\n * @param {string} filepath - filepath to search for\n * @param {object} huron - huron configuration\n * @return {string} kssMatch - relative path to KSS directory\n */\nexport function matchKssDir(filepath, huron) {\n const kssSource = huron.get('kss');\n // Include forward slash in our test to make sure we're matchin a directory, not a file extension\n const kssMatch = kssSource.filter((dir) => filepath.includes(`/${dir}`));\n\n if (kssMatch.length) {\n return kssMatch[0];\n }\n\n return false;\n}\n\n/**\n * Merge JSON files for css modules classnames in a provided directory\n *\n * @function mergeClassnameJSON\n * @param {string} directory - directory containing classname JSON files\n *\n * @return {object} classnamesMerged - merged classnames. contents of each JSON file is nested within\n * the returned object by filename. (e.g. article.json -> { article: {...json contents}})\n */\nexport function mergeClassnameJSON(directory) {\n let files;\n\n // If no config is provided, return immediately\n if (!directory) {\n return {};\n }\n\n // Try to read through classnames directory\n try {\n files = fs.readdirSync(directory);\n } catch (e) {\n console.warn(chalk.red(e));\n }\n\n // Merge classname json files\n const classNamesMerged = files.reduce((acc, file) => {\n const fileInfo = path.parse(file);\n let classNames = {};\n\n if ('.json' === fileInfo.ext) {\n try {\n const contents = fs.readFileSync(\n path.join(directory, file),\n 'utf8'\n );\n classNames = JSON.parse(contents);\n } catch (e) {\n console.warn(chalk.red(e));\n }\n }\n\n return Object.assign({}, acc, { [fileInfo.name]: classNames });\n }, {});\n\n return classNamesMerged;\n}\n\n/**\n * Remove the trailing slash from a provided directory\n *\n * @function removeTrailingSlash\n * @param {string} directory - directory path\n * @return {string} directory - directory path with trailing slash removed\n */\nexport function removeTrailingSlash(directory) {\n if ('/' === directory.slice(-1)) {\n return directory.slice(0, -1);\n }\n\n return directory;\n}\n\n\n\n// WEBPACK FOOTER //\n// src/cli/utils.js","module.exports = require(\"chalk\");\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"chalk\"\n// module id = 2\n// module chunks = 0","module.exports = require(\"fs-extra\");\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"fs-extra\"\n// module id = 3\n// module chunks = 0","/** @module cli/parse-arguments */\n/* eslint-disable space-unary-ops */\n\nimport program from 'commander';\nimport path from 'path';\n\n// Requires\n/** @global */\n\n/**\n * Process huron CLI arguments\n *\n * @function parseArgs\n * @example node huron/dist/cli/huron-cli.js --config 'client/config/webpack.config.js' --production\n */\nfunction parseArgs() {\n const envArg = {};\n\n process.argv = process.argv.filter((arg) => {\n if (-1 !== arg.indexOf('--env')) {\n const envParts = arg\n .split('.')[1]\n .split('=');\n\n envArg[envParts[0]] = envParts[1] || true;\n return false;\n }\n\n return true;\n });\n\n program.version('1.0.1')\n .option(\n '-c, --huron-config [huronConfig]',\n '[huronConfig] for all huron options',\n path.resolve(__dirname, '../defaultConfig/huron.config.js')\n )\n .option(\n '-w, --webpack-config [webpackConfig]',\n '[webpackConfig] for all webpack options',\n path.resolve(__dirname, '../defaultConfig/webpack.config.js')\n )\n .option('-p, --production', 'compile assets once for production');\n\n program.env = envArg;\n\n // Only parse if we're not running tests\n if (\n ! process.env.npm_lifecycle_event ||\n 'test' !== process.env.npm_lifecycle_event\n ) {\n program.parse(process.argv);\n }\n}\n\nparseArgs();\n/* eslint-enable */\n\nexport default program;\n\n\n\n// WEBPACK FOOTER //\n// src/cli/parseArgs.js","module.exports = require(\"webpack\");\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"webpack\"\n// module id = 5\n// module chunks = 0","import { Map } from 'immutable';\n\nimport generateConfig from './generateConfig';\nimport { mergeClassnameJSON } from './utils';\n// Create initial data structure\n\n// Merge Huron default webpack config with user config\nconst config = generateConfig();\n\n// Make sure the kss option is represented as an array\nconfig.huron.kss = [].concat(config.huron.kss);\n\n/* eslint-disable */\n/**\n * Initial structure for immutable data store\n *\n * @global\n */\nconst defaultStore = Map({\n types: [\n 'template',\n 'data',\n 'description',\n 'section',\n 'prototype',\n 'sections-template',\n ],\n config: Map(config.huron),\n classNames: mergeClassnameJSON(config.huron.classNames),\n sections: Map({\n sectionsByPath: Map({}),\n sectionsByURI: Map({}),\n sorted: {},\n }),\n templates: Map({}),\n prototypes: Map({}),\n sectionTemplatePath: '',\n referenceDelimiter: '.',\n});\n/* eslint-enable */\n\nexport { defaultStore, config };\n\n\n\n// WEBPACK FOOTER //\n// src/cli/defaultStore.js","/** @module cli/template-handler */\nimport path from 'path';\nimport fs from 'fs-extra';\nimport chalk from 'chalk';\n\nimport * as utils from './utils';\n\n/**\n * Handle update of a template or data (json) file\n *\n * @function updateTemplate\n * @param {string} filepath - filepath of changed file (comes from gaze)\n * @param {object} section - contains KSS section data\n * @param {object} store - memory store\n * @return {object} updated memory store\n */\nexport function updateTemplate(filepath, section, store) {\n const file = path.parse(filepath);\n const pairPath = utils.getTemplateDataPair(file, section, store);\n const type = '.json' === file.ext ? 'data' : 'template';\n const newSection = section;\n const newStore = store;\n let content = false;\n\n try {\n content = fs.readFileSync(filepath, 'utf8');\n } catch (e) {\n console.log(chalk.red(`${filepath} does not exist`));\n }\n\n if (content) {\n const requirePath = utils.writeFile(\n newSection.referenceURI,\n type,\n filepath,\n content,\n newStore\n );\n newSection[`${type}Path`] = requirePath;\n\n if ('template' === type) {\n newSection.templateContent = content;\n\n // Rewrite section data with template content\n newSection.sectionPath = utils.writeSectionData(newStore, newSection);\n }\n\n return newStore\n .setIn(\n ['templates', requirePath],\n pairPath\n )\n .setIn(\n ['sections', 'sectionsByPath', newSection.kssPath],\n newSection\n )\n .setIn(\n ['sections', 'sectionsByURI', newSection.referenceURI],\n newSection\n );\n }\n\n return newStore;\n}\n\n/**\n * Handle removal of a template or data (json) file\n *\n * @function deleteTemplate\n * @param {string} filepath - filepath of changed file (comes from gaze)\n * @param {object} section - contains KSS section data\n * @param {object} store - memory store\n * @return {object} updated memory store\n */\nexport function deleteTemplate(filepath, section, store) {\n const file = path.parse(filepath);\n const type = '.json' === file.ext ? 'data' : 'template';\n const newSection = section;\n const newStore = store;\n\n // Remove partner\n const requirePath = utils.removeFile(\n newSection.referenceURI,\n type,\n filepath,\n newStore\n );\n delete newSection[`${type}Path`];\n\n return newStore\n .deleteIn(['templates', requirePath])\n .setIn(\n ['sections', 'sectionsByPath', newSection.kssPath],\n newSection\n )\n .setIn(\n ['sections', 'sectionsByURI', newSection.referenceURI],\n newSection\n );\n}\n\n\n\n// WEBPACK FOOTER //\n// src/cli/handleTemplates.js","/** @module cli/require-templates */\nimport path from 'path';\nimport fs from 'fs-extra';\n\n// We need to prepend this to the browser script as a string but still want to transpile it,\n// hence loading it using `raw-loader` so we receive a string from webpack\n/* eslint-disable */\nimport hotTemplate from '!raw-loader!babel-loader!../../templates/hotTemplate';\n/* eslint-enable */\n\nconst cwd = process.cwd();\nconst huronScript = fs.readFileSync(\n path.join(__dirname, '../web/index.js'),\n 'utf8'\n);\n\n/**\n * Write code for requiring all generated huron assets\n *\n * @function requireTemplates\n * @param {object} store - memory store\n */\nexport const requireTemplates = function requireTemplates(store) {\n const huron = store.get('config');\n const outputPath = path.join(cwd, huron.get('root'), 'huron-assets');\n // These will be used to replace strings in the hotTemplate.\n // In order to accurately replace strings but still keep things parseable by eslint and babel,\n // each replaceable value should be referenced in `hotTemplate.js` under the `hotScope` object.\n // For example, if you need to replace a string with a value passed in from the CLI called `userVariable`,\n // you would reference that string in `hotTemplate.js` with `hotScope.userVariable`.\n const hotVariableScope = {\n sectionTemplatePath: `'${huron.get('sectionTemplate')}'`,\n requireRegex: new RegExp(`\\\\.html|\\\\.json|\\\\${\n huron.get('templates').extension\n }$`),\n requirePath: `'../${huron.get('output')}'`,\n };\n const hotTemplateTransformed = Object.keys(hotVariableScope)\n .reduce(\n (acc, curr) => acc.replace(\n new RegExp(`hotScope.${curr}`, 'g'),\n hotVariableScope[curr]\n ), hotTemplate\n );\n\n // Write the contents of this script.\n fs.outputFileSync(\n path.join(outputPath, 'index.js'),\n hotTemplateTransformed\n );\n fs.outputFileSync(\n path.join(outputPath, 'insertNodes.js'),\n huronScript\n );\n};\n\n/**\n * Output entire data store to a JS object and handle if any KSS data has changed\n *\n * @function writeStore\n * @param {object} store - memory store\n * @param {string} changed - filepath of changed KSS section, if applicable\n */\nexport const writeStore = function writeStore(store, newStore = false) {\n const updatedStore = newStore || store;\n const huron = updatedStore.get('config');\n const outputPath = path.join(cwd, huron.get('root'), 'huron-assets');\n\n // Write updated data store\n fs.outputFileSync(\n path.join(outputPath, 'huron-store.js'),\n `module.exports = ${JSON.stringify(updatedStore.toJSON())}`\n );\n};\n\n\n\n\n// WEBPACK FOOTER //\n// src/cli/requireTemplates.js","// Local imports\nimport chalk from 'chalk';\n\nimport {\n initFiles,\n updateFile,\n deleteFile,\n updateClassNames,\n} from './actions';\nimport { requireTemplates, writeStore } from './requireTemplates';\nimport { matchKssDir } from './utils';\nimport program from './parseArgs';\nimport startWebpack from './server';\nimport { defaultStore, config } from './defaultStore';\nimport gaze from './fileWatcher';\n\n/**\n * Initialize data store with files from gaze and original data structure\n *\n * @global\n */\nconst huron = defaultStore.get('config');\nlet store = initFiles(gaze.watched(), defaultStore);\n\nrequireTemplates(store);\nwriteStore(store);\n\n// If building for production, close gaze and exit process once initFiles is done.\nif (program.production) {\n gaze.close();\n}\n\n/** @module cli/gaze */\ngaze.on('all', (event, filepath) => {\n store = updateClassNames(filepath, store);\n writeStore(store);\n});\n\n/**\n * Anonymous handler for Gaze 'changed' event indicating a file has changed\n *\n * @callback changed\n * @listens gaze:changed\n * @param {string} filepath - absolute path of changed file\n */\ngaze.on('changed', (filepath) => {\n if (matchKssDir(filepath, huron)) {\n store = updateFile(filepath, store);\n }\n\n console.log(chalk.green(`${filepath} updated!`));\n});\n\n/**\n * Anonymous handler for Gaze 'added' event indicating a file has been added to the watched directories\n *\n * @callback added\n * @listens gaze:added\n * @param {string} filepath - absolute path of changed file\n */\ngaze.on('added', (filepath) => {\n if (matchKssDir(filepath, huron)) {\n store = updateFile(filepath, store);\n writeStore(store);\n }\n\n console.log(chalk.blue(`${filepath} added!`));\n});\n\n/**\n * Anonymous handler for Gaze 'renamed' event indicating a file has been renamed\n *\n * @callback renamed\n * @listens gaze:renamed\n * @param {string} filepath - absolute path of changed file\n */\ngaze.on('renamed', (newPath, oldPath) => {\n if (matchKssDir(newPath, huron)) {\n store = deleteFile(oldPath, store);\n store = updateFile(newPath, store);\n writeStore(store);\n }\n\n console.log(chalk.blue(`${newPath} added!`));\n});\n\n/**\n * Anonymous handler for Gaze 'deleted' event indicating a file has been removed\n *\n * @callback deleted\n * @listens gaze:deleted\n * @param {string} filepath - absolute path of changed file\n */\ngaze.on('deleted', (filepath) => {\n if (matchKssDir(filepath, huron)) {\n store = deleteFile(filepath, store);\n writeStore(store);\n }\n\n console.log(chalk.red(`${filepath} deleted`));\n});\n\n// Start webpack or build for production\nstartWebpack(config);\n\n\n\n// WEBPACK FOOTER //\n// src/cli/index.js","export default (huron) => ({\n hot: true,\n quiet: false,\n noInfo: false,\n stats: {\n colors: true,\n hash: false,\n version: false,\n assets: false,\n chunks: false,\n modules: false,\n reasons: false,\n children: false,\n source: false,\n },\n contentBase: huron.root,\n overlay: true,\n publicPath: `http://localhost:${huron.port}/${huron.root}`,\n});\n\n\n\n// WEBPACK FOOTER //\n// config/devServer.config.js","/** @module cli/actions */\n\n// Imports\nimport path from 'path';\nimport chalk from 'chalk';\nimport isEqual from 'lodash/isEqual';\n\nimport {\n updateHTML,\n deleteHTML,\n updatePrototype,\n deletePrototype,\n} from './handleHTML';\nimport { updateTemplate, deleteTemplate } from './handleTemplates';\nimport { updateKSS, deleteKSS } from './handleKSS';\nimport * as utils from './utils';\n\n/**\n * Recursively loop through initial watched files list from Gaze.\n *\n * @param {object} data - object containing directory and file paths\n * @param {object} store - memory store\n * @return {object} newStore - map object of entire data store\n */\nexport function initFiles(data, store, depth = 0) {\n const type = Object.prototype.toString.call(data);\n const huron = store.get('config');\n let newStore = store;\n let info;\n let files;\n\n switch (type) {\n case '[object Object]':\n files = Object.keys(data);\n newStore = files.reduce(\n (prevStore, file) => initFiles(data[file], prevStore, depth),\n newStore\n );\n break;\n\n case '[object Array]':\n newStore = data.reduce(\n (prevStore, file) => initFiles(file, prevStore, depth),\n newStore\n );\n break;\n\n case '[object String]':\n info = path.parse(data);\n\n // Only call update if data is a filepath and it's within the KSS source directory\n if (info.ext && !data.includes(huron.get('classNames'))) {\n newStore = updateFile(data, store);\n }\n break;\n\n default:\n break;\n }\n\n return newStore;\n}\n\n/**\n * Logic for updating and writing file information based on file type (extension)\n *\n * @param {string} filepath - path to updated file. usually passed in from Gaze\n * @param {object} store - memory store\n * @return {object} store - map object of map object of entire data store\n */\nexport function updateFile(filepath, store) {\n const huron = store.get('config');\n const file = path.parse(filepath);\n let field;\n let section;\n\n if (filepath.includes(huron.get('sectionTemplate'))) {\n return utils.writeSectionTemplate(filepath, store);\n }\n\n switch (file.ext) {\n // Plain HTML template, external\n case '.html':\n section = utils.getSection(file.base, 'markup', store);\n\n if (section) {\n return updateHTML(filepath, section, store);\n } else if (\n file.dir.includes('prototypes') &&\n file.name.includes('prototype-')\n ) {\n return updatePrototype(filepath, store);\n }\n\n console.log(chalk.red(`Failed to write file: ${file.name}`));\n break;\n\n // Handlebars template, external\n case huron.get('templates').extension:\n case '.json':\n field = ('.json' === file.ext) ? 'data' : 'markup';\n section = utils.getSection(file.base, field, store);\n\n if (section) {\n return updateTemplate(filepath, section, store);\n }\n\n console.log( // eslint-disable-line no-console\n chalk.red(`Could not find associated KSS section for ${filepath}`)\n );\n break;\n\n // KSS documentation (default extension is `.css`)\n // Will also output a template if markup is inline\n // Note: inline markup does _not_ support handlebars currently\n case huron.get('kssExtension'):\n return updateKSS(filepath, store);\n\n // This should never happen if Gaze is working properly\n default:\n return store;\n }\n\n return store;\n}\n\n/**\n * Logic for deleting file information and files based on file type (extension)\n *\n * @param {string} filepath - path to updated file. usually passed in from Gaze\n * @param {object} store - memory store\n * @return {object} newStore - map object of map object of entire data store\n */\nexport function deleteFile(filepath, store) {\n const huron = store.get('config');\n const file = path.parse(filepath);\n let field = '';\n let section = null;\n let newStore = store;\n\n switch (file.ext) {\n // Plain HTML template, external\n case '.html':\n section = utils.getSection(file.base, 'markup', store);\n\n if (section) {\n newStore = deleteHTML(filepath, section, store);\n } else if (\n file.dir.includes('prototypes') &&\n file.name.includes('prototype-')\n ) {\n newStore = deletePrototype(filepath, store);\n }\n break;\n\n case huron.get('templates').extension:\n case '.json':\n field = ('.json' === file.ext) ? 'data' : 'markup';\n section = utils.getSection(file.base, field, store);\n\n if (section) {\n newStore = deleteTemplate(filepath, section, store);\n }\n break;\n\n case huron.get('kssExtension'):\n section = utils.getSection(filepath, false, store);\n\n if (section) {\n newStore = deleteKSS(filepath, section, store);\n }\n break;\n\n default:\n console.warn( // eslint-disable-line no-console\n chalk.red(`Could not delete: ${file.name}`)\n );\n break;\n }\n\n return newStore;\n}\n\n/**\n * Logic for updating localized classnames from CSS modules\n *\n * @param {string} filepath - path to updated file. usually passed in from Gaze\n * @param {object} store - memory store\n *\n * @return void\n */\nexport function updateClassNames(filepath, store) {\n const classNamesPath = store.getIn(['config', 'classNames']);\n\n if (filepath.includes(classNamesPath)) {\n const oldClassnames = store.get('classNames');\n const newClassnames = utils.mergeClassnameJSON(classNamesPath);\n\n if (!isEqual(oldClassnames, newClassnames)) {\n return store.set('classNames', newClassnames);\n }\n }\n\n return store;\n}\n\n\n\n// WEBPACK FOOTER //\n// src/cli/actions.js","import { Gaze } from 'gaze';\nimport path from 'path';\n\nimport { removeTrailingSlash } from './utils';\nimport { defaultStore } from './defaultStore';\n\n/**\n * Huron configuration object\n *\n * @global\n */\nconst huron = defaultStore.get('config');\n\n/**\n * Available file extensions. Extensions should not include the leading '.'\n *\n * @global\n */\nexport const extensions = [\n huron.get('kssExtension'),\n huron.get('templates').extension,\n 'html',\n 'json',\n].map((extension) => extension.replace('.', ''));\n\n// Generate watch list for Gaze, start gaze\nexport const watchedFiles = [];\n\n// Watch section template\nwatchedFiles.push(path.resolve(huron.get('sectionTemplate')));\n\n// Watch cssmodules classname files (if they exist)\nif (huron.get('classNames')) {\n watchedFiles.push(\n `${path.resolve(huron.get('classNames'))}/*.json`\n );\n}\n\n// Watch all provided kss directories\nhuron.get('kss').forEach((dir) => {\n watchedFiles.push(\n `${removeTrailingSlash(dir)}/**/*.+(${extensions.join('|')})`\n );\n});\n\n/**\n * Gaze instance for watching all files, including KSS, html, hbs/template, and JSON\n *\n * @global\n */\nconst gaze = new Gaze(watchedFiles);\n\nexport default gaze;\n\n\n\n// WEBPACK FOOTER //\n// src/cli/fileWatcher.js","/** @module cli/generate-config */\nimport path from 'path';\nimport url from 'url';\nimport fs from 'fs-extra';\nimport webpack from 'webpack';\nimport HTMLWebpackPlugin from 'html-webpack-plugin';\n\nimport program from './parseArgs';\nimport requireExternal from './requireExternal';\nimport defaultWebpack from '../defaultConfig/webpack.config';\nimport defaultHuron from '../defaultConfig/huron.config';\n\nconst cwd = process.cwd();\n\n// Require configs passed in by user from CLI\nlet defaultConfig = false;\nconst localConfig = requireExternal(\n path.resolve(program.webpackConfig)\n);\nconst localHuron = requireExternal(\n path.resolve(program.huronConfig)\n);\n\n/**\n * Generate a mutant hybrid of the huron default webpack config and your local webpack config\n *\n * @function generateConfig\n * @param {object} config - local webpack config\n * @return {object} newConfig - updated data store\n */\nexport default function generateConfig() {\n let newConfig = localConfig;\n let newHuron = localHuron;\n\n // Execute config function, if provided\n if ('function' === typeof newConfig) {\n newConfig = newConfig(program.env);\n }\n\n // Execute huron config function, if provided\n if ('function' === typeof newHuron) {\n newHuron = newHuron(program.env);\n }\n\n // Merge huron defaults with user settings\n newHuron = Object.assign({}, defaultHuron, newHuron);\n // Use user huron config to modify webpack defaults\n defaultConfig = defaultWebpack(newHuron);\n\n // Set ouput options\n newConfig.output = Object.assign({}, defaultConfig.output, newConfig.output);\n newConfig.output.path = defaultConfig.output.path;\n newConfig.output.publicPath = defaultConfig.output.publicPath;\n\n // configure entries\n newConfig = configureEntries(newHuron, newConfig);\n\n // configure plugins\n newConfig = configurePlugins(newHuron, newConfig);\n\n // configure loaders\n newConfig = configureLoaders(newHuron, newConfig);\n\n // Add HTMLWebpackPlugin for each configured prototype\n newConfig = configurePrototypes(newHuron, newConfig);\n\n // Remove existing devServer settings\n delete newConfig.devServer;\n\n return {\n huron: newHuron,\n webpack: newConfig,\n };\n}\n\n/**\n * Configure and manage webpack entry points\n *\n * @param {object} huron - huron configuration object\n * @param {object} config - webpack configuration object\n * @return {object} newConfig - updated data store\n */\nfunction configureEntries(huron, config) {\n const entry = config.entry[huron.entry];\n const newConfig = config;\n\n newConfig.entry = {};\n if (!program.production) {\n newConfig.entry[huron.entry] = [\n `webpack-dev-server/client?http://localhost:${huron.port}`,\n 'webpack/hot/dev-server',\n path.join(cwd, huron.root, 'huron-assets/index'),\n ].concat(entry);\n } else {\n newConfig.entry[huron.entry] = [\n path.join(cwd, huron.root, 'huron-assets/index'),\n ].concat(entry);\n }\n\n return newConfig;\n}\n\n/**\n * Configure and manage webpack plugins\n *\n * @param {object} huron - huron configuration object\n * @param {object} config - webpack configuration object\n * @return {object} newConfig - updated data store\n */\nfunction configurePlugins(huron, config) {\n const newConfig = config;\n\n newConfig.plugins = config.plugins || [];\n\n if (!program.production) {\n if (newConfig.plugins && newConfig.plugins.length) {\n newConfig.plugins = newConfig.plugins.filter(\n (plugin) => 'HotModuleReplacementPlugin' !== plugin.constructor.name &&\n 'NamedModulesPlugin' !== plugin.constructor.name\n );\n }\n newConfig.plugins = newConfig.plugins\n .concat([\n new webpack.HotModuleReplacementPlugin(),\n new webpack.NamedModulesPlugin(),\n ]);\n }\n\n return newConfig;\n}\n\n/**\n * Configure and manage webpack loaders\n *\n * @param {object} huron - huron configuration object\n * @param {object} config - webpack configuration object\n * @return {object} newConfig - updated data store\n */\nfunction configureLoaders(huron, config) {\n // Manage loaders\n const templatesLoader = huron.templates.rule || {};\n const newConfig = config;\n\n // Make sure we're only using templates loader for files in huron root\n templatesLoader.include = [path.join(cwd, huron.root, huron.output)];\n\n // Normalize module and module.rules\n newConfig.module = newConfig.module || {};\n newConfig.module.rules = newConfig.module.rules ||\n newConfig.module.loaders ||\n [];\n\n // Add default loaders\n newConfig.module.rules = defaultConfig.module.rules\n .concat(\n newConfig.module.rules,\n templatesLoader\n );\n\n return newConfig;\n}\n\n/**\n * Create an HTML webpack plugin for each configured prototype\n *\n * @param {object} huron - huron configuration object\n * @param {object} config - webpack configuration object\n * @return {object} newConfig - updated data store\n */\nfunction configurePrototypes(huron, config) {\n const wrapperTemplate = fs.readFileSync(\n path.join(__dirname, '../../templates/prototypeTemplate.hbs'),\n 'utf8'\n );\n\n const defaultHTMLPluginOptions = {\n title: 'Huron',\n window: huron.window,\n js: [],\n css: [],\n filename: 'index.html',\n template: path.join(\n cwd,\n huron.root,\n 'huron-assets/prototypeTemplate.hbs'\n ),\n inject: false,\n chunks: [huron.entry],\n };\n const newConfig = config;\n\n // Write prototype template file for HTML webpack plugin\n fs.outputFileSync(\n path.join(cwd, huron.root, 'huron-assets/prototypeTemplate.hbs'),\n wrapperTemplate\n );\n\n huron.prototypes.forEach((prototype) => {\n const newPrototype = prototype;\n let opts = {};\n\n // Merge configured settings with default settings\n if ('string' === typeof prototype) {\n opts = Object.assign({}, defaultHTMLPluginOptions, {\n title: prototype,\n filename: `${prototype}.html`,\n });\n } else if (\n 'object' === typeof prototype &&\n {}.hasOwnProperty.call(prototype, 'title')\n ) {\n // Create filename based on configured title if not provided\n if (!prototype.filename) {\n newPrototype.filename = `${prototype.title}.html`;\n }\n\n // Move css assets for this prototype,\n // reset css option with new file paths\n if (prototype.css) {\n newPrototype.css = moveAdditionalAssets(prototype.css, 'css', huron);\n }\n\n // Move js assets for this prototype,\n // reset js option with new file paths\n if (prototype.js) {\n newPrototype.js = moveAdditionalAssets(prototype.js, 'js', huron);\n }\n\n opts = Object.assign({}, defaultHTMLPluginOptions, newPrototype);\n }\n\n // Move global css assets,\n // reset css option with new file paths\n if (huron.css.length) {\n opts.css = opts.css.concat(\n moveAdditionalAssets(huron.css, 'css', huron)\n );\n }\n\n // Move global js assets,\n // reset js option with new file paths\n if (huron.js.length) {\n opts.js = opts.js.concat(\n moveAdditionalAssets(huron.js, 'js', huron)\n );\n }\n\n // Push a new plugin for each configured prototype\n if (Object.keys(opts).length) {\n newConfig.plugins.push(\n new HTMLWebpackPlugin(opts)\n );\n }\n });\n\n return newConfig;\n}\n\n/**\n * Move relative (and local) js and css assets provided in huron options\n *\n * @param {array|string} assets - array of assets or single asset\n * @param {string} subdir - subdirectory in huron root from which to load additional asset\n * @param {object} huron - huron configuration object\n * @return {array} assetResults - paths to js and css assets\n */\nfunction moveAdditionalAssets(assets, subdir = '', huron) {\n const currentAssets = [].concat(assets);\n const assetResults = [];\n\n currentAssets.forEach((asset) => {\n const assetInfo = path.parse(asset);\n const assetURL = url.parse(asset);\n const sourcePath = path.join(cwd, asset);\n const outputPath = path.resolve(cwd, huron.root, subdir, assetInfo.base);\n const loadPath = program.production ?\n path.join(subdir, assetInfo.base) :\n path.join('/', subdir, assetInfo.base); // Use absolute path in development\n let contents = false;\n\n if (\n !path.isAbsolute(asset) &&\n !assetURL.protocol\n ) {\n try {\n contents = fs.readFileSync(sourcePath);\n } catch (e) {\n console.warn(`could not read ${sourcePath}`);\n }\n\n if (contents) {\n fs.outputFileSync(outputPath, contents);\n assetResults.push(loadPath);\n }\n } else {\n assetResults.push(asset);\n }\n });\n\n return assetResults;\n}\n\n\n\n// WEBPACK FOOTER //\n// src/cli/generateConfig.js","/** @module cli/html-handler */\nimport path from 'path';\nimport fs from 'fs-extra';\n\nimport * as utils from './utils';\n\n/**\n * Handle update of an HMTL template\n *\n * @function updateHTML\n * @param {string} filepath - filepath of changed file (comes from gaze)\n * @param {object} section - contains KSS section data\n * @param {object} store - memory store\n * @return {object} updated data store\n */\nexport function updateHTML(filepath, section, store) {\n const file = path.parse(filepath);\n const content = fs.readFileSync(filepath, 'utf8');\n const newSection = section;\n\n if (content) {\n newSection.templatePath = utils.writeFile(\n section.referenceURI,\n 'template',\n filepath,\n content,\n store\n );\n newSection.templateContent = content;\n\n // Rewrite section data with template content\n newSection.sectionPath = utils.writeSectionData(store, newSection);\n\n return store\n .setIn(\n ['sections', 'sectionsByPath', section.kssPath],\n newSection\n )\n .setIn(\n ['sections', 'sectionsByURI', section.referenceURI],\n newSection\n );\n }\n\n console.log(`File ${file.base} could not be read`);\n return store;\n}\n\n/**\n * Handle removal of an HMTL template\n *\n * @function deleteHTML\n * @param {string} filepath - filepath of changed file (comes from gaze)\n * @param {object} section - contains KSS section data\n * @param {object} store - memory store\n * @return {object} updated data store\n */\nexport function deleteHTML(filepath, section, store) {\n const newSection = section;\n\n utils.removeFile(\n newSection.referenceURI,\n 'template',\n filepath,\n store\n );\n\n delete newSection.templatePath;\n\n return store\n .setIn(\n ['sections', 'sectionsByPath', section.kssPath],\n newSection\n )\n .setIn(\n ['sections', 'sectionsByURI', section.referenceURI],\n newSection\n );\n}\n\n/**\n * Handle update for a prototype file\n *\n * @function updatePrototype\n * @param {string} filepath - filepath of changed file (comes from gaze)\n * @param {object} store - memory store\n * @return {object} updated data store\n */\nexport function updatePrototype(filepath, store) {\n const file = path.parse(filepath);\n const content = fs.readFileSync(filepath, 'utf8');\n\n if (content) {\n const requirePath = utils.writeFile(\n file.name,\n 'prototype',\n filepath,\n content,\n store\n );\n\n return store.setIn(\n ['prototypes', file.name],\n requirePath\n );\n }\n\n console.log(`File ${file.base} could not be read`);\n return store;\n}\n\n/**\n * Handle removal of a prototype file\n *\n * @function deletePrototype\n * @param {string} filepath - filepath of changed file (comes from gaze)\n * @param {object} store - memory store\n * @return {object} updated data store\n */\nexport function deletePrototype(filepath, store) {\n const file = path.parse(filepath);\n const requirePath = utils.removeFile(\n file.name,\n 'prototype',\n filepath,\n store\n );\n\n return store.setIn(\n ['prototypes', file.name],\n requirePath\n );\n}\n\n\n\n// WEBPACK FOOTER //\n// src/cli/handleHTML.js","/** @module cli/kss-handler */\n\nimport path from 'path';\nimport fs from 'fs-extra';\nimport { parse } from 'kss';\nimport chalk from 'chalk';\n\nimport * as utils from './utils';\nimport { updateTemplate, deleteTemplate } from './handleTemplates';\nimport { writeStore } from './requireTemplates';\n\n/**\n * Handle update of a KSS section\n *\n * @function updateKSS\n * @param {string} filepath - filepath of changed file (comes from gaze)\n * @param {object} store - memory store\n * @return {object} updated data store\n */\nexport function updateKSS(filepath, store) {\n const kssSource = fs.readFileSync(filepath, 'utf8');\n const huron = store.get('config');\n const oldSection = utils.getSection(filepath, false, store) || {};\n const file = path.parse(filepath);\n let newStore = store;\n\n if (kssSource) {\n const styleguide = parse(kssSource, huron.get('kssOptions'));\n\n if (styleguide.data.sections.length) {\n const section = utils.normalizeSectionData(\n styleguide.data.sections[0]\n );\n\n if (section.reference && section.referenceURI) {\n // Update or add section data\n newStore = updateSectionData(\n filepath,\n section,\n oldSection,\n newStore\n );\n\n // Remove old section data if reference URI has changed\n if (oldSection &&\n oldSection.referenceURI &&\n oldSection.referenceURI !== section.referenceURI\n ) {\n newStore = unsetSection(oldSection, file, newStore, false);\n }\n\n writeStore(newStore);\n console.log(\n chalk.green(\n `KSS source in ${filepath} changed or added`\n )\n );\n return newStore;\n }\n\n console.log(\n chalk.magenta(\n `KSS section in ${filepath} is missing a section reference`\n )\n );\n return newStore;\n }\n\n console.log(chalk.magenta(`No KSS found in ${filepath}`));\n return newStore;\n }\n\n if (oldSection) {\n newStore = deleteKSS(filepath, oldSection, newStore);\n }\n\n console.log(chalk.red(`${filepath} not found or empty`)); // eslint-disable-line no-console\n return newStore;\n}\n\n/**\n * Handle removal of a KSS section\n *\n * @function deleteKSS\n * @param {string} filepath - filepath of changed file (comes from gaze)\n * @param {object} section - KSS section data\n * @param {object} store - memory store\n * @return {object} updated data store\n */\nexport function deleteKSS(filepath, section, store) {\n const file = path.parse(filepath);\n\n if (section.reference && section.referenceURI) {\n // Remove section data from memory store\n return unsetSection(section, file, store, true);\n }\n\n return store;\n}\n\n/**\n * Update the sections store with new data for a specific section\n *\n * @function updateSectionData\n * @param {object} section - contains updated section data\n * @param {string} kssPath - path to KSS section\n * @param {object} store - memory store\n * @return {object} updated data store\n */\nfunction updateSectionData(kssPath, section, oldSection, store) {\n const sectionFileInfo = path.parse(kssPath);\n const dataFilepath = path.join(\n sectionFileInfo.dir,\n `${sectionFileInfo.name}.json`\n );\n const isInline = null !== section.markup.match(/<\\/[^>]*>/);\n const newSort = sortSection(\n store.getIn(['sections', 'sorted']),\n section.reference,\n store.get('referenceDelimiter')\n );\n const newSection = Object.assign({}, oldSection, section);\n let newStore = store;\n\n // Required for reference from templates and data\n newSection.kssPath = kssPath;\n\n if (isInline) {\n // Set section value if inlineTempalte() returned a path\n newStore = updateInlineTemplate(\n kssPath,\n oldSection,\n newSection,\n newStore\n );\n } else {\n // Remove inline template, if it exists\n utils.removeFile(\n newSection.referenceURI,\n 'template',\n kssPath,\n store\n );\n // Update markup and data fields\n newStore = updateTemplateFields(\n sectionFileInfo,\n oldSection,\n newSection,\n newStore\n );\n }\n\n // Output section description\n newStore = updateDescription(\n kssPath,\n oldSection,\n newSection,\n newStore\n );\n\n // Output section data to a JSON file\n newSection.sectionPath = utils.writeSectionData(\n newStore,\n newSection,\n dataFilepath\n );\n\n // Update section sorting\n return newStore\n .setIn(\n ['sections', 'sorted'],\n newSort\n )\n .setIn(\n ['sections', 'sectionsByPath', kssPath],\n newSection\n )\n .setIn(\n ['sections', 'sectionsByURI', section.referenceURI],\n newSection\n );\n}\n\n/**\n * Handle detection and output of inline templates, which is markup written\n * in the KSS documentation itself as opposed to an external file\n *\n * @function updateInlineTemplate\n * @param {string} oldSection - previous iteration of KSS data, if updated\n * @param {object} section - KSS section data\n * @return {object} updated data store with new template path info\n */\nfunction updateInlineTemplate(filepath, oldSection, section, store) {\n const newSection = section;\n const newStore = store;\n\n // If we have inline markup\n if (fieldShouldOutput(oldSection, section, 'markup')) {\n newSection.templatePath = utils.writeFile(\n section.referenceURI,\n 'template',\n filepath,\n section.markup,\n store\n );\n newSection.templateContent = section.markup;\n\n return newStore\n .setIn(\n ['sections', 'sectionsByPath', filepath],\n newSection\n )\n .setIn(\n ['sections', 'sectionsByURI', section.referenceURI],\n newSection\n );\n }\n\n return newStore;\n}\n\n/**\n * Handle output of section description\n *\n * @function updateDescription\n * @param {string} oldSection - previous iteration of KSS data, if updated\n * @param {object} section - KSS section data\n * @return {object} updated data store with new descripton path info\n */\nfunction updateDescription(filepath, oldSection, section, store) {\n const newSection = section;\n const newStore = store;\n\n // If we don't have previous KSS or the KSS has been updated\n if (fieldShouldOutput(oldSection, section, 'description')) {\n // Write new description\n newSection.descriptionPath = utils.writeFile(\n section.referenceURI,\n 'description',\n filepath,\n section.description,\n store\n );\n\n return newStore\n .setIn(\n ['sections', 'sectionsByPath', filepath],\n newSection\n )\n .setIn(\n ['sections', 'sectionsByURI', section.referenceURI],\n newSection\n );\n }\n\n return newStore;\n}\n\n/**\n * Handle Data and Markup fields\n *\n * @function updateTemplateFields\n * @param {string} file - File data for KSS file from path.parse()\n * @param {object} oldSection - outdated KSS data\n * @param {object} section - KSS section data\n * @param {object} store - memory store\n * @return {object} KSS section data with updated asset paths\n */\nfunction updateTemplateFields(file, oldSection, section, store) {\n const kssPath = path.format(file);\n const newSection = section;\n let filepath = '';\n let oldFilepath = '';\n let newStore = store;\n\n ['data', 'markup'].forEach((field) => {\n if (newSection[field]) {\n if (oldSection[field]) {\n oldFilepath = path.join(file.dir, oldSection[field]);\n newStore = deleteTemplate(\n oldFilepath,\n oldSection,\n newStore\n );\n }\n\n filepath = path.join(file.dir, newSection[field]);\n newStore = updateTemplate(\n filepath,\n newSection,\n newStore\n );\n } else {\n delete newSection[field];\n newStore = newStore\n .setIn(\n ['sections', 'sectionsByPath', kssPath],\n newSection\n )\n .setIn(\n ['sections', 'sectionsByURI', newSection.referenceURI],\n newSection\n );\n }\n });\n\n return newStore;\n}\n\n/**\n * Remove a section from the memory store\n *\n * @function unsetSection\n * @param {object} section - contains updated section data\n * @param {string} file - file object from path.parse()\n * @param {object} store - memory store\n * @param {bool} removed - has the file been removed or just the section information changed?\n * @return {object} updated data store with new descripton path info\n */\nfunction unsetSection(section, file, store, removed) {\n const sorted = store.getIn(['sections', 'sorted']);\n const kssPath = path.format(file);\n const dataFilepath = path.join(file.dir, `${file.name}.json`);\n const isInline = section.markup &&\n null !== section.markup.match(/<\\/[^>]*>/);\n const newSort = unsortSection(\n sorted,\n section.reference,\n store.get('referenceDelimiter')\n );\n let newStore = store;\n\n // Remove old section data\n utils.removeFile(\n section.referenceURI,\n 'section',\n dataFilepath,\n newStore\n );\n\n // Remove associated inline template\n if (isInline) {\n utils.removeFile(section.referenceURI, 'template', kssPath, newStore);\n }\n\n // Remove description template\n utils.removeFile(section.referenceURI, 'description', kssPath, newStore);\n\n // Remove data from sectionsByPath if file has been removed\n if (removed) {\n newStore = newStore.deleteIn(['sections', 'sectionsByPath', kssPath]);\n }\n\n return newStore\n .deleteIn(['sections', 'sectionsByURI', section.referenceURI])\n .setIn(['sections', 'sorted'], newSort);\n}\n\n/**\n * Sort sections and subsections\n *\n * @function sortSection\n * @param {object} sorted - currently sorted sections\n * @param {string} reference - reference URI of section to sort\n * @return {object} updated data store with new descripton path info\n */\nfunction sortSection(sorted, reference, delimiter) {\n const parts = reference.split(delimiter);\n const newSort = sorted[parts[0]] || {};\n const newSorted = sorted;\n\n if (1 < parts.length) {\n const newParts = parts.filter((part, idx) => 0 !== idx);\n newSorted[parts[0]] = sortSection(\n newSort,\n newParts.join(delimiter),\n delimiter\n );\n } else {\n newSorted[parts[0]] = newSort;\n }\n\n return newSorted;\n}\n\n/**\n * Remove a section from the sorted sections\n *\n * @function unsortSection\n * @param {object} sorted - currently sorted sections\n * @param {string} reference - reference URI of section to sort\n * @return {object} updated data store with new descripton path info\n */\nfunction unsortSection(sorted, reference, delimiter) {\n const parts = reference.split(delimiter);\n const subsections = Object.keys(sorted[parts[0]]);\n const newSorted = sorted;\n\n if (subsections.length) {\n if (1 < parts.length) {\n const newParts = parts.filter((part, idx) => 0 !== idx);\n newSorted[parts[0]] = unsortSection(\n newSorted[parts[0]],\n newParts.join(delimiter),\n delimiter\n );\n }\n } else {\n delete newSorted[parts[0]];\n }\n\n return newSorted;\n}\n\n/**\n * Compare a KSS field between old and new KSS data to see if we need to output\n * a new module for that field\n *\n * @function fieldShouldOutput\n * @param {object} oldSection - currently sorted sections\n * @param {object} newSection - reference URI of section to sort\n * @param {string} field - KSS field to check\n * @return {bool} output a new module for the KSS field\n */\nfunction fieldShouldOutput(oldSection, newSection, field) {\n return (oldSection &&\n (oldSection[field] !== newSection[field] ||\n oldSection.referenceURI !== newSection.referenceURI)\n ) ||\n !oldSection;\n}\n\n\n\n// WEBPACK FOOTER //\n// src/cli/handleKSS.js","// Necessary to remove require statement from Webpack processing preserve it in output\n/* eslint-disable import/no-dynamic-require, global-require */\nexport default function requireExternal(requirePath) {\n return require(requirePath);\n}\n/* eslint-enable */\n\n\n\n// WEBPACK FOOTER //\n// src/cli/requireExternal.js","/** @module cli/webpack-server */\nimport webpack from 'webpack';\nimport WebpackDevServer from 'webpack-dev-server';\nimport chalk from 'chalk';\nimport open from 'opn';\n\nimport createDevServerConfig from '../../config/devServer.config';\nimport program from './parseArgs';\nimport { removeTrailingSlash } from './utils';\n\n/**\n * Spin up webpack-dev-server or, if production flag is set, run webpack a single time\n *\n * @function startWebpack\n * @param {object} config - webpack configuration, preprocessed by {@link module:cli/generate-config generateConfig}\n * @see {@link module:cli/generate-config generateConfig}\n */\nexport default function startWebpack(config) {\n const huron = config.huron;\n const webpackConfig = config.webpack;\n const compiler = webpack(webpackConfig);\n\n if (program.progress) {\n compiler.apply(\n new webpack.ProgressPlugin(\n (percentage, msg) => {\n console.log(`${(percentage * 100)}% `, msg);\n }\n )\n );\n }\n\n if (program.production) {\n compiler.run((err, stats) => {\n const info = stats.toJson();\n\n if (err) {\n console.log(err);\n }\n\n if (stats.hasErrors()) {\n console.error(\n chalk.red(\n 'Webpack encountered errors during compile: ',\n info.errors\n )\n );\n }\n\n if (stats.hasWarnings()) {\n console.error(\n chalk.yellow(\n 'Webpack encountered warnings during compile: ', info.warnings\n )\n );\n }\n });\n } else {\n const server = new WebpackDevServer(compiler, createDevServerConfig(huron));\n const prototypeName = huron.prototypes[0].title || huron.prototypes[0];\n\n server.listen(\n huron.port,\n 'localhost',\n (err) => {\n if (err) {\n return console.log(err);\n }\n\n console.log(`Listening at http://localhost:${huron.port}/`);\n open(`http://localhost:${huron.port}/${\n removeTrailingSlash(huron.root)\n }/${prototypeName}.html`);\n return true;\n }\n );\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// src/cli/server.js","import path from 'path';\n\nexport default {\n css: [],\n entry: 'huron',\n js: [],\n kss: 'css/',\n kssExtension: '.css',\n kssOptions: {\n multiline: true,\n markdown: true,\n custom: ['data'],\n },\n output: 'partials',\n port: 8080,\n prototypes: ['index'],\n root: 'dist/',\n sectionTemplate: path.join(__dirname, '../../templates/section.hbs'),\n classNames: false,\n templates: {\n rule: {\n test: /\\.(hbs|handlebars)$/,\n use: 'handlebars-loader',\n },\n extension: '.hbs',\n },\n window: {},\n};\n\n\n\n// WEBPACK FOOTER //\n// src/defaultConfig/huron.config.js","import webpack from 'webpack';\nimport path from 'path';\n\nimport program from '../cli/parseArgs';\n\nexport default (huron) => {\n const cwd = process.cwd();\n\n return {\n entry: {},\n output: {\n path: path.join(cwd, huron.root),\n publicPath: program.production ? '' :\n `http://localhost:${huron.port}/${huron.root}`,\n filename: '[name].js',\n chunkFilename: '[name].chunk.min.js',\n },\n plugins: [\n new webpack.HotModuleReplacementPlugin(),\n new webpack.NamedModulesPlugin(),\n ],\n resolve: {\n modulesDirectories: [\n path.resolve(__dirname, '../src/js'),\n ],\n },\n resolveLoader: {\n modulesDirectories: [\n 'web_loaders',\n 'web_modules',\n 'node_loaders',\n 'node_modules',\n path.resolve(__dirname, '../node_modules'),\n ],\n },\n module: {\n rules: [\n {\n test: /\\.html$/,\n include: [path.join(cwd, huron.root, huron.output)],\n use: 'html-loader',\n },\n {\n test: /\\.(hbs|handlebars)$/,\n include: [path.join(cwd, huron.root, 'huron-assets')],\n use: {\n loader: 'handlebars-loader',\n options: {\n helperDirs: [path.join(\n __dirname,\n '../../',\n 'templates/handlebarsHelpers'\n )],\n },\n },\n },\n ],\n },\n };\n};\n\n\n\n// WEBPACK FOOTER //\n// src/defaultConfig/webpack.config.js","module.exports = \"'use strict';\\n\\nvar _huronStore = require('./huron-store');\\n\\nvar _huronStore2 = _interopRequireDefault(_huronStore);\\n\\nvar _insertNodes = require('./insertNodes');\\n\\nvar _insertNodes2 = _interopRequireDefault(_insertNodes);\\n\\nvar _section = require('./section.hbs');\\n\\nvar _section2 = _interopRequireDefault(_section);\\n\\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\\n\\n/* eslint-enable */\\n\\nconst assets = require.context(hotScope.requirePath, true, hotScope.requireRegex); /* globals hotScope */\\n\\n// NOTE: This is not a normal JS file! It is pulled in by the CLI as a string\\n// and prepended to the browser script after replacing anything referenced via `hotScope[variable]`\\n// with CLI arguments or config properties passed in by the user.\\n\\n/* eslint-disable */\\n\\nconst modules = {};\\n\\nmodules[hotScope.sectionTemplatePath] = _section2.default;\\n\\nassets.keys().forEach(key => {\\n modules[key] = assets(key);\\n});\\n\\nconst insert = new _insertNodes2.default(modules, _huronStore2.default);\\n\\nif (module.hot) {\\n // Hot Module Replacement for huron components (json, hbs, html)\\n module.hot.accept(assets.id, () => {\\n const newAssets = require.context(hotScope.requirePath, true, hotScope.requireRegex);\\n const newModules = newAssets.keys().map(key => [key, newAssets(key)]).filter(newModule => modules[newModule[0]] !== newModule[1]);\\n\\n updateStore(require('./huron-store.js')); // eslint-disable-line global-require, import/no-unresolved\\n newModules.forEach(module => {\\n modules[module[0]] = module[1];\\n hotReplace(module[0], module[1], modules);\\n });\\n });\\n\\n // Hot Module Replacement for sections template\\n module.hot.accept('./section.hbs', () => {\\n const newSectionTemplate = require('./section.hbs'); // eslint-disable-line global-require, import/no-unresolved\\n\\n modules[hotScope.sectionTemplatePath] = newSectionTemplate;\\n hotReplace('./huron-assets/section.hbs', newSectionTemplate, modules);\\n });\\n\\n // Hot Module Replacement for data store\\n module.hot.accept('./huron-store.js', () => {\\n updateStore(require('./huron-store.js')); // eslint-disable-line global-require, import/no-unresolved\\n });\\n}\\n\\nfunction hotReplace(key, module, newModules) {\\n insert.modules = newModules;\\n if (key === _huronStore2.default.sectionTemplatePath) {\\n insert.cycleSections();\\n } else {\\n insert.inserted = [];\\n insert.loadModule(key, module, false);\\n }\\n}\\n\\nfunction updateStore(newStore) {\\n insert.store = newStore;\\n}\"\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/raw-loader!./~/babel-loader/lib!./templates/hotTemplate.js\n// module id = 20\n// module chunks = 0","module.exports = require(\"commander\");\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"commander\"\n// module id = 21\n// module chunks = 0","module.exports = require(\"gaze\");\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"gaze\"\n// module id = 22\n// module chunks = 0","module.exports = require(\"html-webpack-plugin\");\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"html-webpack-plugin\"\n// module id = 23\n// module chunks = 0","module.exports = require(\"immutable\");\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"immutable\"\n// module id = 24\n// module chunks = 0","module.exports = require(\"kss\");\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"kss\"\n// module id = 25\n// module chunks = 0","module.exports = require(\"lodash/isEqual\");\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"lodash/isEqual\"\n// module id = 26\n// module chunks = 0","module.exports = require(\"opn\");\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"opn\"\n// module id = 27\n// module chunks = 0","module.exports = require(\"url\");\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"url\"\n// module id = 28\n// module chunks = 0","module.exports = require(\"webpack-dev-server\");\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"webpack-dev-server\"\n// module id = 29\n// module chunks = 0"],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;A;;;;AChEA;;;;;;;;;;;;ACcA;AAkBA;AAqCA;AAqCA;AAcA;AAkBA;AAyBA;AA4CA;AAyCA;AAyBA;AAyBA;AAqBA;AA6CA;AACA;AA5WA;AACA;;;AAAA;AACA;;;AAAA;AACA;;;;;AACA;AACA;AACA;;;;;;;AAPA;AAcA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;AAQA;AACA;AACA;AACA;AACA;AACA;AACA;AAIA;AACA;AACA;AACA;AACA;AAOA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;;;;;;;;AAQA;AACA;AACA;AACA;AACA;AACA;AAIA;AACA;AACA;AAGA;AACA;AASA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;AAOA;AACA;AAGA;AACA;AACA;;;;;;;;AAQA;AACA;AACA;AACA;;AAFA;AAKA;AACA;AACA;;;;;;;;;;AAUA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;AAUA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAIA;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;AAQA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAIA;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;AAQA;AACA;AACA;AACA;AACA;AACA;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;AAQA;AACA;AAGA;AACA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;AAQA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;AASA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;AAOA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;AClXA;;;;;;ACAA;;;;;;;;;;;;;ACGA;AACA;;;AAAA;AACA;;;;;AACA;AACA;AACA;AACA;;;;;;AATA;AACA;AACA;AAaA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAYA;AACA;AACA;AACA;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;ACzDA;;;;;;;;;;;;;;ACAA;AACA;AACA;AACA;;;AAAA;AACA;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;AAKA;AACA;AAQA;AACA;AACA;AACA;AACA;AACA;AAHA;AAKA;AACA;AACA;AACA;AAnBA;AAqBA;AACA;AACA;AAAA;;;;;;;;;;;;ACzBA;AA0DA;AACA;AA1EA;AACA;;;AAAA;AACA;;;AAAA;AACA;;;AACA;AACA;AADA;AACA;;;;;AACA;;;;;;;;;AAPA;AAgBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAOA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAaA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;AASA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAMA;AACA;AACA;AAUA;;;;;;;;;;;;;;AClGA;AACA;;;AAAA;AACA;;;AAIA;AACA;;;;;AAAA;AACA;AACA;AACA;AAPA;AACA;AACA;AANA;AACA;AAUA;AACA;AAIA;;;;;;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA;AALA;AAOA;AACA;AAOA;AACA;AAIA;AAIA;AACA;AACA;;;;;;;AAOA;AACA;AACA;AACA;AACA;AACA;AACA;AAIA;;;;;;;;;ACxEA;AACA;;;AACA;AACA;AAKA;AACA;AAAA;AACA;AAAA;AACA;;;AAAA;AACA;;;AAAA;AACA;AAAA;AACA;;;;;AACA;;;;;AAhBA;AAqBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;AAOA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;AAOA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;AAOA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;AAOA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;ACvGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AATA;AAWA;AACA;AACA;AAjBA;;;;;;;;;;;;ACwBA;AA8CA;AA+DA;AA0DA;AACA;AA7LA;AACA;;;AAAA;AACA;;;AAAA;AACA;;;AACA;AACA;AAKA;AACA;AAAA;AACA;AAAA;AACA;AADA;AACA;;;;;AACA;;;;;;;AAOA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAIA;AACA;AACA;AACA;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA1BA;AACA;AA4BA;AACA;AACA;AACA;;;;;;;AA/DA;AACA;AACA;AAoEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAxCA;AACA;AA0CA;AACA;AACA;AACA;;;;;;;AAOA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AArCA;AACA;AAuCA;AACA;AACA;AACA;;;;;;;;AAQA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;AC5MA;AACA;AAAA;AACA;;;AACA;AACA;AAAA;AACA;;;AACA;;;;;AAKA;AACA;AACA;;;;;AAKA;AACA;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AAGA;AACA;AACA;;;;;AAKA;AACA;AACA;;;;;;;;;;;;ACtBA;AACA;AA9BA;AACA;;;AAAA;AACA;;;AAAA;AACA;;;AAAA;AACA;;;AAAA;AACA;;;AACA;AACA;;;AAAA;AACA;;;AAAA;AACA;;;AAAA;AACA;;;;;AACA;AACA;AACA;AAdA;AAeA;AACA;AAGA;AACA;AAGA;;;;;;;AAOA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAFA;AAIA;AACA;AACA;;;;;;;AAOA;AACA;AACA;AACA;AACA;AACA;AACA;AAKA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;;;;;;;AAOA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAIA;AACA;AAKA;AACA;AACA;AACA;AACA;AACA;;;;;;;AAOA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA;AACA;AACA;AAKA;AACA;AACA;AACA;;;;;;;AAOA;AACA;AACA;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AAKA;AACA;AAZA;AAcA;AACA;AACA;AACA;AACA;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAFA;AAIA;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;AAQA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA;AACA;AACA;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;AC7RA;AA0CA;AA+BA;AA+BA;AACA;AAvHA;AACA;;;AAAA;AACA;;;AACA;AACA;AADA;AACA;;;;;AACA;;;;;;;;;AASA;AACA;AACA;AACA;AACA;AACA;AACA;AAOA;AACA;AACA;AACA;AACA;AACA;AASA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;AAhDA;AAyDA;AACA;AACA;AACA;AACA;AAMA;AACA;AACA;AASA;AACA;AACA;;;;;;;;AAQA;AACA;AACA;AACA;AACA;AACA;AACA;AAOA;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;AAQA;AACA;AACA;AACA;AAMA;AAIA;;;;;;;;;;;;ACjHA;AAsEA;AACA;AAxFA;AACA;;;AAAA;AACA;;;AAAA;AACA;AAAA;AACA;;;AACA;AACA;AADA;AACA;AAAA;AACA;AAAA;AACA;;;;;AACA;;;;;;;;AAQA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA;AACA;AACA;AACA;AAMA;AACA;AAIA;AACA;AACA;AACA;AACA;AAKA;AACA;AACA;AACA;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;AAhFA;AACA;AAwFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;AASA;AACA;AACA;AAIA;AACA;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAMA;AACA;AACA;AAMA;AACA;AAMA;AACA;AACA;AACA;AACA;AAMA;AACA;AACA;AAKA;AACA;AAaA;AACA;AACA;;;;;;;;;AASA;AACA;AACA;AACA;AACA;AACA;AACA;AAOA;AACA;AACA;AASA;AACA;AACA;AACA;AACA;AACA;;;;;;;;AAQA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAOA;AASA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;AAUA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAKA;AACA;AACA;AACA;AAKA;AACA;AACA;AASA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;AAUA;AACA;AACA;AACA;AACA;AAEA;AAKA;AACA;AACA;AACA;AACA;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA;AACA;AACA;;;;;;;;AAQA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;AAQA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;AAUA;AACA;AAKA;;;;;;;;;;;AC5aA;AAFA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;ACYA;AACA;AAjBA;AACA;;;AAAA;AACA;;;AAAA;AACA;;;AAAA;AACA;;;AACA;AACA;;;AAAA;AACA;;;AAAA;AACA;;;AACA;;;;;;;AAOA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAMA;AACA;AACA;AACA;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AAIA;AACA;AACA;AACA;AACA;AACA;AAGA;AACA;AAEA;AACA;;;;;;;;;;;;;AC7EA;AACA;;;;;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAHA;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAFA;AAIA;AALA;AAOA;AAxBA;;;;;;;;;;;;;ACFA;AACA;;;AAAA;AACA;;;AACA;AACA;;;;;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AALA;AAOA;AAIA;AACA;AADA;AAKA;AACA;AADA;AASA;AACA;AAEA;AACA;AACA;AAHA;AAMA;AACA;AACA;AACA;AACA;AACA;AADA;AAFA;AAHA;AAPA;AA3BA;AAmDA;;;;;;AC3DA;;;;;;ACAA;;;;;;ACAA;;;;;;ACAA;;;;;;ACAA;;;;;;ACAA;;;;;;ACAA;;;;;;ACAA;;;;;;ACAA;;;;;;ACAA;;;;;;;;;;A","sourceRoot":""} \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 3d0f524..3995d35 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "huron", - "version": "2.3.1", + "version": "2.3.2", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -8743,7 +8743,7 @@ "acorn-dynamic-import": "2.0.2", "ajv": "4.11.8", "ajv-keywords": "1.5.1", - "async": "2.5.0", + "async": "2.6.0", "enhanced-resolve": "3.4.1", "interpret": "1.0.4", "json-loader": "0.5.4", @@ -8763,9 +8763,9 @@ }, "dependencies": { "async": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/async/-/async-2.5.0.tgz", - "integrity": "sha512-e+lJAJeNWuPCNyxZKOBdaJGyLGHugXVQtrAwtuAe2vhxTYxFTKE73p8JuTmdH0qdQZtDvI4dhJwjZc5zsfIsYw==", + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/async/-/async-2.6.0.tgz", + "integrity": "sha512-xAfGg1/NTLBBKlHFmnd7PlmUW9KhVQIUuSrYem9xzFUZy13ScvtyGGejaae9iAVRiRq9+Cx7DPFaAAhCpyxyPw==", "requires": { "lodash": "4.17.4" } @@ -8865,7 +8865,7 @@ "sockjs-client": "1.1.4", "spdy": "3.4.7", "strip-ansi": "3.0.1", - "supports-color": "4.4.0", + "supports-color": "4.5.0", "webpack-dev-middleware": "1.12.0", "yargs": "6.6.0" }, @@ -8928,9 +8928,9 @@ "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=" }, "supports-color": { - "version": "4.4.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.4.0.tgz", - "integrity": "sha512-rKC3+DyXWgK0ZLKwmRsrkyHVZAjNkfzeehuFWdGGcqGDTZFH73+RH6S/RDAAxl9GusSjZSUWYLmT9N5pzXFOXQ==", + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.5.0.tgz", + "integrity": "sha1-vnoN5ITexcXN34s9WRJQRJEvY1s=", "requires": { "has-flag": "2.0.0" } diff --git a/src/cli/generateConfig.js b/src/cli/generateConfig.js index 83133c2..7649333 100644 --- a/src/cli/generateConfig.js +++ b/src/cli/generateConfig.js @@ -87,7 +87,7 @@ function configureEntries(huron, config) { newConfig.entry = {}; if (!program.production) { newConfig.entry[huron.entry] = [ - `webpack-dev-server/client?http://localhost:${huron.port}`, + `webpack-dev-server/client/index.js?http://localhost:${huron.port}/`, 'webpack/hot/dev-server', path.join(cwd, huron.root, 'huron-assets/index'), ].concat(entry); @@ -273,9 +273,7 @@ function moveAdditionalAssets(assets, subdir = '', huron) { const assetURL = url.parse(asset); const sourcePath = path.join(cwd, asset); const outputPath = path.resolve(cwd, huron.root, subdir, assetInfo.base); - const loadPath = program.production ? - path.join(subdir, assetInfo.base) : - path.join('/', subdir, assetInfo.base); // Use absolute path in development + const loadPath = path.join(subdir, assetInfo.base); let contents = false; if ( diff --git a/src/defaultConfig/webpack.config.js b/src/defaultConfig/webpack.config.js index a819183..f2f62b2 100644 --- a/src/defaultConfig/webpack.config.js +++ b/src/defaultConfig/webpack.config.js @@ -11,7 +11,7 @@ export default (huron) => { output: { path: path.join(cwd, huron.root), publicPath: program.production ? '' : - `http://localhost:${huron.port}/${huron.root}`, + `/${huron.root}`, filename: '[name].js', chunkFilename: '[name].chunk.min.js', }, From bab7c9f44ec21a73e99ad269f43b04f12724f6b9 Mon Sep 17 00:00:00 2001 From: Owen Stowe Date: Fri, 5 Jan 2018 12:47:03 -0500 Subject: [PATCH 4/8] Remove commented code, build --- config/devServer.config.js | 2 - dist/cli/index.js | 2148 ++++++++++++++++++++++++++++++++---- dist/cli/index.js.map | 1 + 3 files changed, 1962 insertions(+), 189 deletions(-) create mode 100644 dist/cli/index.js.map diff --git a/config/devServer.config.js b/config/devServer.config.js index 241c8eb..9b42f01 100644 --- a/config/devServer.config.js +++ b/config/devServer.config.js @@ -1,5 +1,3 @@ -// import path from 'path'; - export default (huron) => ({ hot: true, host: 'localhost', diff --git a/dist/cli/index.js b/dist/cli/index.js index db14d93..256039e 100644 --- a/dist/cli/index.js +++ b/dist/cli/index.js @@ -68,360 +68,2134 @@ /************************************************************************/ /******/ ([ /* 0 */ -/* no static exports found */ -/* all exports used */ -/*!***********************!*\ - !*** external "path" ***! - \***********************/ /***/ (function(module, exports) { -eval("module.exports = require(\"path\");//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMC5qcyIsInNvdXJjZXMiOlsid2VicGFjazovLy9leHRlcm5hbCBcInBhdGhcIj81YjJhIl0sInNvdXJjZXNDb250ZW50IjpbIm1vZHVsZS5leHBvcnRzID0gcmVxdWlyZShcInBhdGhcIik7XG5cblxuLy8vLy8vLy8vLy8vLy8vLy8vXG4vLyBXRUJQQUNLIEZPT1RFUlxuLy8gZXh0ZXJuYWwgXCJwYXRoXCJcbi8vIG1vZHVsZSBpZCA9IDBcbi8vIG1vZHVsZSBjaHVua3MgPSAwIl0sIm1hcHBpbmdzIjoiQUFBQSIsInNvdXJjZVJvb3QiOiIifQ=="); +module.exports = require("path"); /***/ }), /* 1 */ -/* no static exports found */ -/* all exports used */ -/*!**************************!*\ - !*** ./src/cli/utils.js ***! - \**************************/ /***/ (function(module, exports, __webpack_require__) { "use strict"; -eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.normalizeSectionData = normalizeSectionData;\nexports.writeSectionData = writeSectionData;\nexports.getTemplateDataPair = getTemplateDataPair;\nexports.normalizeHeader = normalizeHeader;\nexports.wrapMarkup = wrapMarkup;\nexports.generateFilename = generateFilename;\nexports.writeFile = writeFile;\nexports.removeFile = removeFile;\nexports.writeSectionTemplate = writeSectionTemplate;\nexports.getSection = getSection;\nexports.matchKssDir = matchKssDir;\nexports.mergeClassnameJSON = mergeClassnameJSON;\nexports.removeTrailingSlash = removeTrailingSlash;\n\nvar _path = __webpack_require__(/*! path */ 0);\n\nvar _path2 = _interopRequireDefault(_path);\n\nvar _fsExtra = __webpack_require__(/*! fs-extra */ 3);\n\nvar _fsExtra2 = _interopRequireDefault(_fsExtra);\n\nvar _chalk = __webpack_require__(/*! chalk */ 2);\n\nvar _chalk2 = _interopRequireDefault(_chalk);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nconst cwd = process.cwd(); // Current working directory\n\n/**\n * Ensure predictable data structure for KSS section data\n *\n * @function normalizeSectionData\n * @param {object} section - section data\n * @return {object} section data\n */\n/** @module cli/utilities */\nfunction normalizeSectionData(section) {\n const data = section.data || section;\n\n if (!data.referenceURI || '' === data.referenceURI) {\n data.referenceURI = section.referenceURI();\n }\n\n return data;\n}\n\n/**\n * Ensure predictable data structure for KSS section data\n *\n * @function writeSectionData\n * @param {object} store - data store\n * @param {object} section - section data\n * @param {string} sectionPath - output destination for section data file\n */\nfunction writeSectionData(store, section, sectionPath = false) {\n let outputPath = sectionPath;\n let sectionFileInfo;\n\n if (!outputPath && {}.hasOwnProperty.call(section, 'kssPath')) {\n sectionFileInfo = _path2.default.parse(section.kssPath);\n outputPath = _path2.default.join(sectionFileInfo.dir, `${sectionFileInfo.name}.json`);\n }\n\n // Output section data\n if (outputPath) {\n return writeFile(section.referenceURI, 'section', outputPath, JSON.stringify(section), store);\n }\n\n console.warn( // eslint-disable-line no-console\n _chalk2.default.red(`Failed to write section data for ${section.referenceURI}`));\n return false;\n}\n\n/**\n * Find .json from a template file or vice versa\n *\n * @function getTemplateDataPair\n * @param {object} file - file object from path.parse()\n * @param {object} section - KSS section data\n * @return {string} relative path to module JSON file\n */\nfunction getTemplateDataPair(file, section, store) {\n const huron = store.get('config');\n const kssDir = matchKssDir(file.dir, huron);\n\n if (kssDir) {\n const componentPath = _path2.default.relative(_path2.default.resolve(cwd, kssDir), file.dir);\n const partnerType = '.json' === file.ext ? 'template' : 'data';\n const partnerExt = '.json' === file.ext ? huron.get('templates').extension : '.json';\n\n const pairPath = _path2.default.join(componentPath, generateFilename(section.referenceURI, partnerType, partnerExt, store));\n\n return `./${pairPath}`;\n }\n\n return false;\n}\n\n/**\n * Normalize a section title for use as a filename\n *\n * @function normalizeHeader\n * @param {string} header - section header extracted from KSS documentation\n * @return {string} modified header, lowercase and words separated by dash\n */\nfunction normalizeHeader(header) {\n return header.toLowerCase().replace(/\\s?\\W\\s?/g, '-');\n}\n\n/**\n * Wrap html in required template tags\n *\n * @function wrapMarkup\n * @param {string} content - html or template markup\n * @param {string} templateId - id of template (should be section reference)\n * @return {string} modified HTML\n */\nfunction wrapMarkup(content, templateId) {\n return `\n\n\\n`;\n}\n\n/**\n * Generate a filename based on referenceURI, type and file object\n *\n * @function generateFilename\n * @param {string} id - The name of the file (with extension).\n * @param {string} type - the type of file output\n * @param {object} ext - file extension\n * @param {store} store - data store\n * @return {string} Path to output file, relative to ouput dir (can be use in require statements)\n */\nfunction generateFilename(id, type, ext, store) {\n // Type of file and its corresponding extension(s)\n const types = store.get('types');\n const outputExt = '.scss' !== ext ? ext : '.html';\n\n /* eslint-disable */\n if (-1 === types.indexOf(type)) {\n console.log(`Huron data ${type} does not exist`);\n return false;\n }\n /* eslint-enable */\n\n return `${id}-${type}${outputExt}`;\n}\n\n/**\n * Copy an HTML file into the huron output directory.\n *\n * @function writeFile\n * @param {string} id - The name of the file (with extension).\n * @param {string} content - The content of the file to write.\n * @param {string} type - the type of file output\n * @param {object} store - The data store\n * @return {string} Path to output file, relative to ouput dir (can be use in require statements)\n */\nfunction writeFile(id, type, filepath, content, store) {\n const huron = store.get('config');\n const file = _path2.default.parse(filepath);\n const filename = generateFilename(id, type, file.ext, store);\n const kssDir = matchKssDir(filepath, huron);\n\n if (kssDir) {\n const componentPath = _path2.default.relative(_path2.default.resolve(cwd, kssDir), file.dir);\n const outputRelative = _path2.default.join(huron.get('output'), componentPath, `${filename}`);\n const outputPath = _path2.default.resolve(cwd, huron.get('root'), outputRelative);\n let newContent = content;\n\n if ('data' !== type && 'section' !== type) {\n newContent = wrapMarkup(content, id);\n }\n\n try {\n _fsExtra2.default.outputFileSync(outputPath, newContent);\n console.log(_chalk2.default.green(`Writing ${outputRelative}`)); // eslint-disable-line no-console\n } catch (e) {\n console.log(_chalk2.default.red(`Failed to write ${outputRelative}`)); // eslint-disable-line no-console\n }\n\n return `./${outputRelative.replace(`${huron.get('output')}/`, '')}`;\n }\n\n return false;\n}\n\n/**\n * Delete a file in the huron output directory\n *\n * @function removeFile\n * @param {string} filename - The name of the file (with extension).\n * @param {object} store - The data store\n * @return {string} Path to output file, relative to ouput dir (can be use in require statements)\n */\nfunction removeFile(id, type, filepath, store) {\n const huron = store.get('config');\n const file = _path2.default.parse(filepath);\n const filename = generateFilename(id, type, file.ext, store);\n const kssDir = matchKssDir(filepath, huron);\n\n if (kssDir) {\n const componentPath = _path2.default.relative(_path2.default.resolve(cwd, kssDir), file.dir);\n const outputRelative = _path2.default.join(huron.get('output'), componentPath, `${filename}`);\n const outputPath = _path2.default.resolve(cwd, huron.get('root'), outputRelative);\n\n try {\n _fsExtra2.default.removeSync(outputPath);\n console.log(_chalk2.default.green(`Removing ${outputRelative}`)); // eslint-disable-line no-console\n } catch (e) {\n console.log( // eslint-disable-line no-console\n _chalk2.default.red(`${outputRelative} does not exist or cannot be deleted`));\n }\n\n return `./${outputRelative.replace(`${huron.get('output')}/`, '')}`;\n }\n\n return false;\n}\n\n/**\n * Write a template for sections\n *\n * @function writeSectionTemplate\n * @param {string} filepath - the original template file\n * @param {object} store - data store\n * @return {object} updated store\n */\nfunction writeSectionTemplate(filepath, store) {\n const huron = store.get('config');\n const sectionTemplate = wrapMarkup(_fsExtra2.default.readFileSync(filepath, 'utf8'));\n const componentPath = './huron-assets/section.hbs';\n const output = _path2.default.join(cwd, huron.get('root'), componentPath);\n\n // Move huron script and section template into huron root\n _fsExtra2.default.outputFileSync(output, sectionTemplate);\n console.log(_chalk2.default.green(`writing section template to ${output}`)); // eslint-disable-line no-console\n\n return store.set('sectionTemplatePath', componentPath);\n}\n\n/**\n * Request for section data based on section reference\n *\n * @function writeSectionTemplate\n * @param {string} search - key on which to match section\n * @param {field} string - field in which to look to determine section\n * @param {obj} store - sections memory store\n */\nfunction getSection(search, field, store) {\n const sectionValues = store.getIn(['sections', 'sectionsByPath']).valueSeq();\n let selectedSection = false;\n\n if (field) {\n selectedSection = sectionValues.filter(value => value[field] === search).get(0);\n } else {\n selectedSection = store.getIn(['sections', 'sectionsByPath', search]);\n }\n\n return selectedSection;\n}\n\n/**\n * Find which configured KSS directory a filepath exists in\n *\n * @function matchKssDir\n * @param {string} filepath - filepath to search for\n * @param {object} huron - huron configuration\n * @return {string} kssMatch - relative path to KSS directory\n */\nfunction matchKssDir(filepath, huron) {\n const kssSource = huron.get('kss');\n // Include forward slash in our test to make sure we're matchin a directory, not a file extension\n const kssMatch = kssSource.filter(dir => filepath.includes(`/${dir}`));\n\n if (kssMatch.length) {\n return kssMatch[0];\n }\n\n return false;\n}\n\n/**\n * Merge JSON files for css modules classnames in a provided directory\n *\n * @function mergeClassnameJSON\n * @param {string} directory - directory containing classname JSON files\n *\n * @return {object} classnamesMerged - merged classnames. contents of each JSON file is nested within\n * the returned object by filename. (e.g. article.json -> { article: {...json contents}})\n */\nfunction mergeClassnameJSON(directory) {\n let files;\n\n // If no config is provided, return immediately\n if (!directory) {\n return {};\n }\n\n // Try to read through classnames directory\n try {\n files = _fsExtra2.default.readdirSync(directory);\n } catch (e) {\n console.warn(_chalk2.default.red(e));\n }\n\n // Merge classname json files\n const classNamesMerged = files.reduce((acc, file) => {\n const fileInfo = _path2.default.parse(file);\n let classNames = {};\n\n if ('.json' === fileInfo.ext) {\n try {\n const contents = _fsExtra2.default.readFileSync(_path2.default.join(directory, file), 'utf8');\n classNames = JSON.parse(contents);\n } catch (e) {\n console.warn(_chalk2.default.red(e));\n }\n }\n\n return Object.assign({}, acc, { [fileInfo.name]: classNames });\n }, {});\n\n return classNamesMerged;\n}\n\n/**\n * Remove the trailing slash from a provided directory\n *\n * @function removeTrailingSlash\n * @param {string} directory - directory path\n * @return {string} directory - directory path with trailing slash removed\n */\nfunction removeTrailingSlash(directory) {\n if ('/' === directory.slice(-1)) {\n return directory.slice(0, -1);\n }\n\n return directory;\n}//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMS5qcyIsInNvdXJjZXMiOlsid2VicGFjazovLy9zcmMvY2xpL3V0aWxzLmpzP2U3MWMiXSwic291cmNlc0NvbnRlbnQiOlsiLyoqIEBtb2R1bGUgY2xpL3V0aWxpdGllcyAqL1xuaW1wb3J0IHBhdGggZnJvbSAncGF0aCc7XG5pbXBvcnQgZnMgZnJvbSAnZnMtZXh0cmEnO1xuaW1wb3J0IGNoYWxrIGZyb20gJ2NoYWxrJztcblxuY29uc3QgY3dkID0gcHJvY2Vzcy5jd2QoKTsgLy8gQ3VycmVudCB3b3JraW5nIGRpcmVjdG9yeVxuXG4vKipcbiAqIEVuc3VyZSBwcmVkaWN0YWJsZSBkYXRhIHN0cnVjdHVyZSBmb3IgS1NTIHNlY3Rpb24gZGF0YVxuICpcbiAqIEBmdW5jdGlvbiBub3JtYWxpemVTZWN0aW9uRGF0YVxuICogQHBhcmFtIHtvYmplY3R9IHNlY3Rpb24gLSBzZWN0aW9uIGRhdGFcbiAqIEByZXR1cm4ge29iamVjdH0gc2VjdGlvbiBkYXRhXG4gKi9cbmV4cG9ydCBmdW5jdGlvbiBub3JtYWxpemVTZWN0aW9uRGF0YShzZWN0aW9uKSB7XG4gIGNvbnN0IGRhdGEgPSBzZWN0aW9uLmRhdGEgfHwgc2VjdGlvbjtcblxuICBpZiAoIWRhdGEucmVmZXJlbmNlVVJJIHx8ICcnID09PSBkYXRhLnJlZmVyZW5jZVVSSSkge1xuICAgIGRhdGEucmVmZXJlbmNlVVJJID0gc2VjdGlvbi5yZWZlcmVuY2VVUkkoKTtcbiAgfVxuXG4gIHJldHVybiBkYXRhO1xufVxuXG4vKipcbiAqIEVuc3VyZSBwcmVkaWN0YWJsZSBkYXRhIHN0cnVjdHVyZSBmb3IgS1NTIHNlY3Rpb24gZGF0Y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BQUNBO0FBQ0E7QUFDQTs7Ozs7Ozs7O0FBU0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUlBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOzs7Ozs7O0FBT0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0EiLCJzb3VyY2VSb290IjoiIn0="); + + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.normalizeSectionData = normalizeSectionData; +exports.writeSectionData = writeSectionData; +exports.getTemplateDataPair = getTemplateDataPair; +exports.normalizeHeader = normalizeHeader; +exports.wrapMarkup = wrapMarkup; +exports.generateFilename = generateFilename; +exports.writeFile = writeFile; +exports.removeFile = removeFile; +exports.writeSectionTemplate = writeSectionTemplate; +exports.getSection = getSection; +exports.matchKssDir = matchKssDir; +exports.mergeClassnameJSON = mergeClassnameJSON; +exports.removeTrailingSlash = removeTrailingSlash; + +var _path = __webpack_require__(0); + +var _path2 = _interopRequireDefault(_path); + +var _fsExtra = __webpack_require__(3); + +var _fsExtra2 = _interopRequireDefault(_fsExtra); + +var _chalk = __webpack_require__(2); + +var _chalk2 = _interopRequireDefault(_chalk); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +const cwd = process.cwd(); // Current working directory + +/** + * Ensure predictable data structure for KSS section data + * + * @function normalizeSectionData + * @param {object} section - section data + * @return {object} section data + */ +/** @module cli/utilities */ +function normalizeSectionData(section) { + const data = section.data || section; + + if (!data.referenceURI || '' === data.referenceURI) { + data.referenceURI = section.referenceURI(); + } + + return data; +} + +/** + * Ensure predictable data structure for KSS section data + * + * @function writeSectionData + * @param {object} store - data store + * @param {object} section - section data + * @param {string} sectionPath - output destination for section data file + */ +function writeSectionData(store, section, sectionPath = false) { + let outputPath = sectionPath; + let sectionFileInfo; + + if (!outputPath && {}.hasOwnProperty.call(section, 'kssPath')) { + sectionFileInfo = _path2.default.parse(section.kssPath); + outputPath = _path2.default.join(sectionFileInfo.dir, `${sectionFileInfo.name}.json`); + } + + // Output section data + if (outputPath) { + return writeFile(section.referenceURI, 'section', outputPath, JSON.stringify(section), store); + } + + console.warn( // eslint-disable-line no-console + _chalk2.default.red(`Failed to write section data for ${section.referenceURI}`)); + return false; +} + +/** + * Find .json from a template file or vice versa + * + * @function getTemplateDataPair + * @param {object} file - file object from path.parse() + * @param {object} section - KSS section data + * @return {string} relative path to module JSON file + */ +function getTemplateDataPair(file, section, store) { + const huron = store.get('config'); + const kssDir = matchKssDir(file.dir, huron); + + if (kssDir) { + const componentPath = _path2.default.relative(_path2.default.resolve(cwd, kssDir), file.dir); + const partnerType = '.json' === file.ext ? 'template' : 'data'; + const partnerExt = '.json' === file.ext ? huron.get('templates').extension : '.json'; + + const pairPath = _path2.default.join(componentPath, generateFilename(section.referenceURI, partnerType, partnerExt, store)); + + return `./${pairPath}`; + } + + return false; +} + +/** + * Normalize a section title for use as a filename + * + * @function normalizeHeader + * @param {string} header - section header extracted from KSS documentation + * @return {string} modified header, lowercase and words separated by dash + */ +function normalizeHeader(header) { + return header.toLowerCase().replace(/\s?\W\s?/g, '-'); +} + +/** + * Wrap html in required template tags + * + * @function wrapMarkup + * @param {string} content - html or template markup + * @param {string} templateId - id of template (should be section reference) + * @return {string} modified HTML + */ +function wrapMarkup(content, templateId) { + return ` + +\n`; +} + +/** + * Generate a filename based on referenceURI, type and file object + * + * @function generateFilename + * @param {string} id - The name of the file (with extension). + * @param {string} type - the type of file output + * @param {object} ext - file extension + * @param {store} store - data store + * @return {string} Path to output file, relative to ouput dir (can be use in require statements) + */ +function generateFilename(id, type, ext, store) { + // Type of file and its corresponding extension(s) + const types = store.get('types'); + const outputExt = '.scss' !== ext ? ext : '.html'; + + /* eslint-disable */ + if (-1 === types.indexOf(type)) { + console.log(`Huron data ${type} does not exist`); + return false; + } + /* eslint-enable */ + + return `${id}-${type}${outputExt}`; +} + +/** + * Copy an HTML file into the huron output directory. + * + * @function writeFile + * @param {string} id - The name of the file (with extension). + * @param {string} content - The content of the file to write. + * @param {string} type - the type of file output + * @param {object} store - The data store + * @return {string} Path to output file, relative to ouput dir (can be use in require statements) + */ +function writeFile(id, type, filepath, content, store) { + const huron = store.get('config'); + const file = _path2.default.parse(filepath); + const filename = generateFilename(id, type, file.ext, store); + const kssDir = matchKssDir(filepath, huron); + + if (kssDir) { + const componentPath = _path2.default.relative(_path2.default.resolve(cwd, kssDir), file.dir); + const outputRelative = _path2.default.join(huron.get('output'), componentPath, `${filename}`); + const outputPath = _path2.default.resolve(cwd, huron.get('root'), outputRelative); + let newContent = content; + + if ('data' !== type && 'section' !== type) { + newContent = wrapMarkup(content, id); + } + + try { + _fsExtra2.default.outputFileSync(outputPath, newContent); + console.log(_chalk2.default.green(`Writing ${outputRelative}`)); // eslint-disable-line no-console + } catch (e) { + console.log(_chalk2.default.red(`Failed to write ${outputRelative}`)); // eslint-disable-line no-console + } + + return `./${outputRelative.replace(`${huron.get('output')}/`, '')}`; + } + + return false; +} + +/** + * Delete a file in the huron output directory + * + * @function removeFile + * @param {string} filename - The name of the file (with extension). + * @param {object} store - The data store + * @return {string} Path to output file, relative to ouput dir (can be use in require statements) + */ +function removeFile(id, type, filepath, store) { + const huron = store.get('config'); + const file = _path2.default.parse(filepath); + const filename = generateFilename(id, type, file.ext, store); + const kssDir = matchKssDir(filepath, huron); + + if (kssDir) { + const componentPath = _path2.default.relative(_path2.default.resolve(cwd, kssDir), file.dir); + const outputRelative = _path2.default.join(huron.get('output'), componentPath, `${filename}`); + const outputPath = _path2.default.resolve(cwd, huron.get('root'), outputRelative); + + try { + _fsExtra2.default.removeSync(outputPath); + console.log(_chalk2.default.green(`Removing ${outputRelative}`)); // eslint-disable-line no-console + } catch (e) { + console.log( // eslint-disable-line no-console + _chalk2.default.red(`${outputRelative} does not exist or cannot be deleted`)); + } + + return `./${outputRelative.replace(`${huron.get('output')}/`, '')}`; + } + + return false; +} + +/** + * Write a template for sections + * + * @function writeSectionTemplate + * @param {string} filepath - the original template file + * @param {object} store - data store + * @return {object} updated store + */ +function writeSectionTemplate(filepath, store) { + const huron = store.get('config'); + const sectionTemplate = wrapMarkup(_fsExtra2.default.readFileSync(filepath, 'utf8')); + const componentPath = './huron-assets/section.hbs'; + const output = _path2.default.join(cwd, huron.get('root'), componentPath); + + // Move huron script and section template into huron root + _fsExtra2.default.outputFileSync(output, sectionTemplate); + console.log(_chalk2.default.green(`writing section template to ${output}`)); // eslint-disable-line no-console + + return store.set('sectionTemplatePath', componentPath); +} + +/** + * Request for section data based on section reference + * + * @function writeSectionTemplate + * @param {string} search - key on which to match section + * @param {field} string - field in which to look to determine section + * @param {obj} store - sections memory store + */ +function getSection(search, field, store) { + const sectionValues = store.getIn(['sections', 'sectionsByPath']).valueSeq(); + let selectedSection = false; + + if (field) { + selectedSection = sectionValues.filter(value => value[field] === search).get(0); + } else { + selectedSection = store.getIn(['sections', 'sectionsByPath', search]); + } + + return selectedSection; +} + +/** + * Find which configured KSS directory a filepath exists in + * + * @function matchKssDir + * @param {string} filepath - filepath to search for + * @param {object} huron - huron configuration + * @return {string} kssMatch - relative path to KSS directory + */ +function matchKssDir(filepath, huron) { + const kssSource = huron.get('kss'); + // Include forward slash in our test to make sure we're matchin a directory, not a file extension + const kssMatch = kssSource.filter(dir => filepath.includes(`/${dir}`)); + + if (kssMatch.length) { + return kssMatch[0]; + } + + return false; +} + +/** + * Merge JSON files for css modules classnames in a provided directory + * + * @function mergeClassnameJSON + * @param {string} directory - directory containing classname JSON files + * + * @return {object} classnamesMerged - merged classnames. contents of each JSON file is nested within + * the returned object by filename. (e.g. article.json -> { article: {...json contents}}) + */ +function mergeClassnameJSON(directory) { + let files; + + // If no config is provided, return immediately + if (!directory) { + return {}; + } + + // Try to read through classnames directory + try { + files = _fsExtra2.default.readdirSync(directory); + } catch (e) { + console.warn(_chalk2.default.red(e)); + } + + // Merge classname json files + const classNamesMerged = files.reduce((acc, file) => { + const fileInfo = _path2.default.parse(file); + let classNames = {}; + + if ('.json' === fileInfo.ext) { + try { + const contents = _fsExtra2.default.readFileSync(_path2.default.join(directory, file), 'utf8'); + classNames = JSON.parse(contents); + } catch (e) { + console.warn(_chalk2.default.red(e)); + } + } + + return Object.assign({}, acc, { [fileInfo.name]: classNames }); + }, {}); + + return classNamesMerged; +} + +/** + * Remove the trailing slash from a provided directory + * + * @function removeTrailingSlash + * @param {string} directory - directory path + * @return {string} directory - directory path with trailing slash removed + */ +function removeTrailingSlash(directory) { + if ('/' === directory.slice(-1)) { + return directory.slice(0, -1); + } + + return directory; +} /***/ }), /* 2 */ -/* no static exports found */ -/* all exports used */ -/*!************************!*\ - !*** external "chalk" ***! - \************************/ /***/ (function(module, exports) { -eval("module.exports = require(\"chalk\");//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMi5qcyIsInNvdXJjZXMiOlsid2VicGFjazovLy9leHRlcm5hbCBcImNoYWxrXCI/NTNmNyJdLCJzb3VyY2VzQ29udGVudCI6WyJtb2R1bGUuZXhwb3J0cyA9IHJlcXVpcmUoXCJjaGFsa1wiKTtcblxuXG4vLy8vLy8vLy8vLy8vLy8vLy9cbi8vIFdFQlBBQ0sgRk9PVEVSXG4vLyBleHRlcm5hbCBcImNoYWxrXCJcbi8vIG1vZHVsZSBpZCA9IDJcbi8vIG1vZHVsZSBjaHVua3MgPSAwIl0sIm1hcHBpbmdzIjoiQUFBQSIsInNvdXJjZVJvb3QiOiIifQ=="); +module.exports = require("chalk"); /***/ }), /* 3 */ -/* no static exports found */ -/* all exports used */ -/*!***************************!*\ - !*** external "fs-extra" ***! - \***************************/ /***/ (function(module, exports) { -eval("module.exports = require(\"fs-extra\");//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMy5qcyIsInNvdXJjZXMiOlsid2VicGFjazovLy9leHRlcm5hbCBcImZzLWV4dHJhXCI/N2NhNiJdLCJzb3VyY2VzQ29udGVudCI6WyJtb2R1bGUuZXhwb3J0cyA9IHJlcXVpcmUoXCJmcy1leHRyYVwiKTtcblxuXG4vLy8vLy8vLy8vLy8vLy8vLy9cbi8vIFdFQlBBQ0sgRk9PVEVSXG4vLyBleHRlcm5hbCBcImZzLWV4dHJhXCJcbi8vIG1vZHVsZSBpZCA9IDNcbi8vIG1vZHVsZSBjaHVua3MgPSAwIl0sIm1hcHBpbmdzIjoiQUFBQSIsInNvdXJjZVJvb3QiOiIifQ=="); +module.exports = require("fs-extra"); /***/ }), /* 4 */ -/* no static exports found */ -/* all exports used */ -/*!******************************!*\ - !*** ./src/cli/parseArgs.js ***! - \******************************/ /***/ (function(module, exports, __webpack_require__) { "use strict"; -eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _commander = __webpack_require__(/*! commander */ 21);\n\nvar _commander2 = _interopRequireDefault(_commander);\n\nvar _path = __webpack_require__(/*! path */ 0);\n\nvar _path2 = _interopRequireDefault(_path);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n// Requires\n/** @global */\n\n/**\n * Process huron CLI arguments\n *\n * @function parseArgs\n * @example node huron/dist/cli/huron-cli.js --config 'client/config/webpack.config.js' --production\n */\n/** @module cli/parse-arguments */\n/* eslint-disable space-unary-ops */\n\nfunction parseArgs() {\n const envArg = {};\n\n process.argv = process.argv.filter(arg => {\n if (-1 !== arg.indexOf('--env')) {\n const envParts = arg.split('.')[1].split('=');\n\n envArg[envParts[0]] = envParts[1] || true;\n return false;\n }\n\n return true;\n });\n\n _commander2.default.version('1.0.1').option('-c, --huron-config [huronConfig]', '[huronConfig] for all huron options', _path2.default.resolve(__dirname, '../defaultConfig/huron.config.js')).option('-w, --webpack-config [webpackConfig]', '[webpackConfig] for all webpack options', _path2.default.resolve(__dirname, '../defaultConfig/webpack.config.js')).option('-p, --production', 'compile assets once for production');\n\n _commander2.default.env = envArg;\n\n // Only parse if we're not running tests\n if (!process.env.npm_lifecycle_event || 'test' !== process.env.npm_lifecycle_event) {\n _commander2.default.parse(process.argv);\n }\n}\n\nparseArgs();\n/* eslint-enable */\n\nexports.default = _commander2.default;//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiNC5qcyIsInNvdXJjZXMiOlsid2VicGFjazovLy9zcmMvY2xpL3BhcnNlQXJncy5qcz9iYTdmIl0sInNvdXJjZXNDb250ZW50IjpbIi8qKiBAbW9kdWxlIGNsaS9wYXJzZS1hcmd1bWVudHMgKi9cbi8qIGVzbGludC1kaXNhYmxlIHNwYWNlLXVuYXJ5LW9wcyAqL1xuXG5pbXBvcnQgcHJvZ3JhbSBmcm9tICdjb21tYW5kZXInO1xuaW1wb3J0IHBhdGggZnJvbSAncGF0aCc7XG5cbi8vIFJlcXVpcmVzXG4vKiogQGdsb2JhbCAqL1xuXG4vKipcbiAqIFByb2Nlc3MgaHVyb24gQ0xJIGFyZ3VtZW50c1xuICpcbiAqIEBmdW5jdGlvbiBwYXJzZUFyZ3NcbiAqIEBleGFtcGxlIG5vZGUgaHVyb24vZGlzdC9jbGkvaHVyb24tY2xpLmpzIC0tY29uZmlnICdjbGllbnQvY29uZmlnL3dlYnBhY2suY29uZmlnLmpzJyAtLXByb2R1Y3Rpb25cbiAqL1xuZnVuY3Rpb24gcGFyc2VBcmdzKCkge1xuICBjb25zdCBlbnZBcmcgPSB7fTtcblxuICBwcm9jZXNzLmFyZ3YgPSBwcm9jZXNzLmFyZ3YuZmlsdGVyKChhcmcpID0+IHtcbiAgICBpZiAoLTEgIT09IGFyZy5pbmRleE9mKCctLWVudicpKSB7XG4gICAgICBjb25zdCBlbnZQYXJ0cyA9IGF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YpO1xuICB9XG59XG5cbnBhcnNlQXJncygpO1xuLyogZXNsaW50LWVuYWJsZSAqL1xuXG5leHBvcnQgZGVmYXVsdCBwcm9ncmFtO1xuXG5cblxuLy8gV0VCUEFDSyBGT09URVIgLy9cbi8vIHNyYy9jbGkvcGFyc2VBcmdzLmpzIl0sIm1hcHBpbmdzIjoiOzs7Ozs7QUFHQTtBQUNBOzs7QUFBQTtBQUNBOzs7OztBQUNBO0FBQ0E7QUFDQTtBQUNBOzs7Ozs7QUFUQTtBQUNBO0FBQ0E7QUFhQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUdBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQVlBO0FBQ0E7QUFDQTtBQUNBO0FBSUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QSIsInNvdXJjZVJvb3QiOiIifQ=="); + + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _commander = __webpack_require__(21); + +var _commander2 = _interopRequireDefault(_commander); + +var _path = __webpack_require__(0); + +var _path2 = _interopRequireDefault(_path); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +// Requires +/** @global */ + +/** + * Process huron CLI arguments + * + * @function parseArgs + * @example node huron/dist/cli/huron-cli.js --config 'client/config/webpack.config.js' --production + */ +/** @module cli/parse-arguments */ +/* eslint-disable space-unary-ops */ + +function parseArgs() { + const envArg = {}; + + process.argv = process.argv.filter(arg => { + if (-1 !== arg.indexOf('--env')) { + const envParts = arg.split('.')[1].split('='); + + envArg[envParts[0]] = envParts[1] || true; + return false; + } + + return true; + }); + + _commander2.default.version('1.0.1').option('-c, --huron-config [huronConfig]', '[huronConfig] for all huron options', _path2.default.resolve(__dirname, '../defaultConfig/huron.config.js')).option('-w, --webpack-config [webpackConfig]', '[webpackConfig] for all webpack options', _path2.default.resolve(__dirname, '../defaultConfig/webpack.config.js')).option('-p, --production', 'compile assets once for production'); + + _commander2.default.env = envArg; + + // Only parse if we're not running tests + if (!process.env.npm_lifecycle_event || 'test' !== process.env.npm_lifecycle_event) { + _commander2.default.parse(process.argv); + } +} + +parseArgs(); +/* eslint-enable */ + +exports.default = _commander2.default; /***/ }), /* 5 */ -/* no static exports found */ -/* all exports used */ -/*!**************************!*\ - !*** external "webpack" ***! - \**************************/ /***/ (function(module, exports) { -eval("module.exports = require(\"webpack\");//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiNS5qcyIsInNvdXJjZXMiOlsid2VicGFjazovLy9leHRlcm5hbCBcIndlYnBhY2tcIj8zOTNkIl0sInNvdXJjZXNDb250ZW50IjpbIm1vZHVsZS5leHBvcnRzID0gcmVxdWlyZShcIndlYnBhY2tcIik7XG5cblxuLy8vLy8vLy8vLy8vLy8vLy8vXG4vLyBXRUJQQUNLIEZPT1RFUlxuLy8gZXh0ZXJuYWwgXCJ3ZWJwYWNrXCJcbi8vIG1vZHVsZSBpZCA9IDVcbi8vIG1vZHVsZSBjaHVua3MgPSAwIl0sIm1hcHBpbmdzIjoiQUFBQSIsInNvdXJjZVJvb3QiOiIifQ=="); +module.exports = require("webpack"); /***/ }), /* 6 */ -/* no static exports found */ -/* all exports used */ -/*!*********************************!*\ - !*** ./src/cli/defaultStore.js ***! - \*********************************/ /***/ (function(module, exports, __webpack_require__) { "use strict"; -eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.config = exports.defaultStore = undefined;\n\nvar _immutable = __webpack_require__(/*! immutable */ 24);\n\nvar _generateConfig = __webpack_require__(/*! ./generateConfig */ 13);\n\nvar _generateConfig2 = _interopRequireDefault(_generateConfig);\n\nvar _utils = __webpack_require__(/*! ./utils */ 1);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n// Create initial data structure\n\n// Merge Huron default webpack config with user config\nconst config = (0, _generateConfig2.default)();\n\n// Make sure the kss option is represented as an array\nconfig.huron.kss = [].concat(config.huron.kss);\n\n/* eslint-disable */\n/**\n * Initial structure for immutable data store\n *\n * @global\n */\nconst defaultStore = (0, _immutable.Map)({\n types: ['template', 'data', 'description', 'section', 'prototype', 'sections-template'],\n config: (0, _immutable.Map)(config.huron),\n classNames: (0, _utils.mergeClassnameJSON)(config.huron.classNames),\n sections: (0, _immutable.Map)({\n sectionsByPath: (0, _immutable.Map)({}),\n sectionsByURI: (0, _immutable.Map)({}),\n sorted: {}\n }),\n templates: (0, _immutable.Map)({}),\n prototypes: (0, _immutable.Map)({}),\n sectionTemplatePath: '',\n referenceDelimiter: '.'\n});\n/* eslint-enable */\n\nexports.defaultStore = defaultStore;\nexports.config = config;//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiNi5qcyIsInNvdXJjZXMiOlsid2VicGFjazovLy9zcmMvY2xpL2RlZmF1bHRTdG9yZS5qcz8zNzBmIl0sInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IE1hcCB9IGZyb20gJ2ltbXV0YWJsZSc7XG5cbmltcG9ydCBnZW5lcmF0ZUNvbmZpZyBmcm9tICcuL2dlbmVyYXRlQ29uZmlnJztcbmltcG9ydCB7IG1lcmdlQ2xhc3NuYW1lSlNPTiB9IGZyb20gJy4vdXRpbHMnO1xuLy8gQ3JlYXRlIGluaXRpYWwgZGF0YSBzdHJ1Y3R1cmVcblxuLy8gTWVyZ2UgSHVyb24gZGVmYXVsdCB3ZWJwYWNrIGNvbmZpZyB3aXRoIHVzZXIgY29uZmlnXG5jb25zdCBjb25maWcgPSBnZW5lcmF0ZUNvbmZpZygpO1xuXG4vLyBNYWtlIHN1cmUgdGhlIGtzcyBvcHRpb24gaXMgcmVwcmVzZW50ZWQgYXMgYW4gYXJyYXlcbmNvbmZpZy5odXJvbi5rc3MgPSBbXS5jb25jYXQoY29uZmlnLmh1cm9uLmtzcyk7XG5cbi8qIGVzbGludC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UFIQTtBQUtBO0FBQ0E7QUFDQTtBQUNBO0FBbkJBO0FBcUJBO0FBQ0E7QUFDQTtBQUFBIiwic291cmNlUm9vdCI6IiJ9"); + + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.config = exports.defaultStore = undefined; + +var _immutable = __webpack_require__(24); + +var _generateConfig = __webpack_require__(13); + +var _generateConfig2 = _interopRequireDefault(_generateConfig); + +var _utils = __webpack_require__(1); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +// Create initial data structure + +// Merge Huron default webpack config with user config +const config = (0, _generateConfig2.default)(); + +// Make sure the kss option is represented as an array +config.huron.kss = [].concat(config.huron.kss); + +/* eslint-disable */ +/** + * Initial structure for immutable data store + * + * @global + */ +const defaultStore = (0, _immutable.Map)({ + types: ['template', 'data', 'description', 'section', 'prototype', 'sections-template'], + config: (0, _immutable.Map)(config.huron), + classNames: (0, _utils.mergeClassnameJSON)(config.huron.classNames), + sections: (0, _immutable.Map)({ + sectionsByPath: (0, _immutable.Map)({}), + sectionsByURI: (0, _immutable.Map)({}), + sorted: {} + }), + templates: (0, _immutable.Map)({}), + prototypes: (0, _immutable.Map)({}), + sectionTemplatePath: '', + referenceDelimiter: '.' +}); +/* eslint-enable */ + +exports.defaultStore = defaultStore; +exports.config = config; /***/ }), /* 7 */ -/* no static exports found */ -/* all exports used */ -/*!************************************!*\ - !*** ./src/cli/handleTemplates.js ***! - \************************************/ /***/ (function(module, exports, __webpack_require__) { "use strict"; -eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.updateTemplate = updateTemplate;\nexports.deleteTemplate = deleteTemplate;\n\nvar _path = __webpack_require__(/*! path */ 0);\n\nvar _path2 = _interopRequireDefault(_path);\n\nvar _fsExtra = __webpack_require__(/*! fs-extra */ 3);\n\nvar _fsExtra2 = _interopRequireDefault(_fsExtra);\n\nvar _chalk = __webpack_require__(/*! chalk */ 2);\n\nvar _chalk2 = _interopRequireDefault(_chalk);\n\nvar _utils = __webpack_require__(/*! ./utils */ 1);\n\nvar utils = _interopRequireWildcard(_utils);\n\nfunction _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n/**\n * Handle update of a template or data (json) file\n *\n * @function updateTemplate\n * @param {string} filepath - filepath of changed file (comes from gaze)\n * @param {object} section - contains KSS section data\n * @param {object} store - memory store\n * @return {object} updated memory store\n */\n/** @module cli/template-handler */\nfunction updateTemplate(filepath, section, store) {\n const file = _path2.default.parse(filepath);\n const pairPath = utils.getTemplateDataPair(file, section, store);\n const type = '.json' === file.ext ? 'data' : 'template';\n const newSection = section;\n const newStore = store;\n let content = false;\n\n try {\n content = _fsExtra2.default.readFileSync(filepath, 'utf8');\n } catch (e) {\n console.log(_chalk2.default.red(`${filepath} does not exist`));\n }\n\n if (content) {\n const requirePath = utils.writeFile(newSection.referenceURI, type, filepath, content, newStore);\n newSection[`${type}Path`] = requirePath;\n\n if ('template' === type) {\n newSection.templateContent = content;\n\n // Rewrite section data with template content\n newSection.sectionPath = utils.writeSectionData(newStore, newSection);\n }\n\n return newStore.setIn(['templates', requirePath], pairPath).setIn(['sections', 'sectionsByPath', newSection.kssPath], newSection).setIn(['sections', 'sectionsByURI', newSection.referenceURI], newSection);\n }\n\n return newStore;\n}\n\n/**\n * Handle removal of a template or data (json) file\n *\n * @function deleteTemplate\n * @param {string} filepath - filepath of changed file (comes from gaze)\n * @param {object} section - contains KSS section data\n * @param {object} store - memory store\n * @return {object} updated memory store\n */\nfunction deleteTemplate(filepath, section, store) {\n const file = _path2.default.parse(filepath);\n const type = '.json' === file.ext ? 'data' : 'template';\n const newSection = section;\n const newStore = store;\n\n // Remove partner\n const requirePath = utils.removeFile(newSection.referenceURI, type, filepath, newStore);\n delete newSection[`${type}Path`];\n\n return newStore.deleteIn(['templates', requirePath]).setIn(['sections', 'sectionsByPath', newSection.kssPath], newSection).setIn(['sections', 'sectionsByURI', newSection.referenceURI], newSection);\n}//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiNy5qcyIsInNvdXJjZXMiOlsid2VicGFjazovLy9zcmMvY2xpL2hhbmRsZVRlbXBsYXRlcy5qcz8yYzdmIl0sInNvdXJjZXNDb250ZW50IjpbIi8qKiBAbW9kdWxlIGNsaS90ZW1wbGF0ZS1oYW5kbGVyICovXG5pbXBvcnQgcGF0aCBmcm9tICdwYXRoJztcbmltcG9ydCBmcyBmcm9tICdmcy1leHRyYSc7XG5pbXBvcnQgY2hhbGsgZnJvbSAnY2hhbGsnO1xuXG5pbXBvcnQgKiBhcyB1dGlscyBmcm9tICcuL3V0aWxzJztcblxuLyoqXG4gKiBIYW5kbGUgdXBkYXRlIG9mIGEgdGVtcGxhdGUgb3IgZGF0YSAoanNvbikgZmlsZVxuICpcbiAqIEBmdW5jdGlvbiB1cGRhdGVUZW1wbGF0ZVxuICogQHBhcmFtIHtzdHJpbmd9IGZpbGVwYXRoIC0gZmlsZXBhdGggb2YgY2hhbmdlZCBmaWxlIChjb21lcyBmcm9tIGdhemUpXG4gKiBAcGFyYW0ge29iamVjdH0gc2VjdGlvbiAtIGNvbnRhaW5zIEtTUyBzZWN0aW9uIGRhdGFcbiAqIEBwYXJhbSB7b2JqZWN0fSBzdG9yZSAtIG1lbW9yeSBzdG9yZVxuICogQHJldHVybiB7b2JqZWN0fSB1cGRhdGVkIG1lbW9yeSBzdG9yZVxuICovXG5leHBvcnQgZnVuY3Rpb24gdXBkYXRlVGVtcGxhdGUoZmlsZXBhdGgsIHNlY3Rpb24sIHN0b3JlKSB7XG4gIGNvbnN0IGZpbGUgPSBwYXRoLnBhcnNlKGZpbGVwYXRoKTtcbiAgY29uc3QgcGFpclBhdGggPSB1dGlscy5nZXRUZ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BO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBTUE7QUFDQTtBQUNBO0FBVUEiLCJzb3VyY2VSb290IjoiIn0="); + + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.updateTemplate = updateTemplate; +exports.deleteTemplate = deleteTemplate; + +var _path = __webpack_require__(0); + +var _path2 = _interopRequireDefault(_path); + +var _fsExtra = __webpack_require__(3); + +var _fsExtra2 = _interopRequireDefault(_fsExtra); + +var _chalk = __webpack_require__(2); + +var _chalk2 = _interopRequireDefault(_chalk); + +var _utils = __webpack_require__(1); + +var utils = _interopRequireWildcard(_utils); + +function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * Handle update of a template or data (json) file + * + * @function updateTemplate + * @param {string} filepath - filepath of changed file (comes from gaze) + * @param {object} section - contains KSS section data + * @param {object} store - memory store + * @return {object} updated memory store + */ +/** @module cli/template-handler */ +function updateTemplate(filepath, section, store) { + const file = _path2.default.parse(filepath); + const pairPath = utils.getTemplateDataPair(file, section, store); + const type = '.json' === file.ext ? 'data' : 'template'; + const newSection = section; + const newStore = store; + let content = false; + + try { + content = _fsExtra2.default.readFileSync(filepath, 'utf8'); + } catch (e) { + console.log(_chalk2.default.red(`${filepath} does not exist`)); + } + + if (content) { + const requirePath = utils.writeFile(newSection.referenceURI, type, filepath, content, newStore); + newSection[`${type}Path`] = requirePath; + + if ('template' === type) { + newSection.templateContent = content; + + // Rewrite section data with template content + newSection.sectionPath = utils.writeSectionData(newStore, newSection); + } + + return newStore.setIn(['templates', requirePath], pairPath).setIn(['sections', 'sectionsByPath', newSection.kssPath], newSection).setIn(['sections', 'sectionsByURI', newSection.referenceURI], newSection); + } + + return newStore; +} + +/** + * Handle removal of a template or data (json) file + * + * @function deleteTemplate + * @param {string} filepath - filepath of changed file (comes from gaze) + * @param {object} section - contains KSS section data + * @param {object} store - memory store + * @return {object} updated memory store + */ +function deleteTemplate(filepath, section, store) { + const file = _path2.default.parse(filepath); + const type = '.json' === file.ext ? 'data' : 'template'; + const newSection = section; + const newStore = store; + + // Remove partner + const requirePath = utils.removeFile(newSection.referenceURI, type, filepath, newStore); + delete newSection[`${type}Path`]; + + return newStore.deleteIn(['templates', requirePath]).setIn(['sections', 'sectionsByPath', newSection.kssPath], newSection).setIn(['sections', 'sectionsByURI', newSection.referenceURI], newSection); +} /***/ }), /* 8 */ -/* no static exports found */ -/* all exports used */ -/*!*************************************!*\ - !*** ./src/cli/requireTemplates.js ***! - \*************************************/ /***/ (function(module, exports, __webpack_require__) { "use strict"; -eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.writeStore = exports.requireTemplates = undefined;\n\nvar _path = __webpack_require__(/*! path */ 0);\n\nvar _path2 = _interopRequireDefault(_path);\n\nvar _fsExtra = __webpack_require__(/*! fs-extra */ 3);\n\nvar _fsExtra2 = _interopRequireDefault(_fsExtra);\n\nvar _hotTemplate = __webpack_require__(/*! raw-loader!babel-loader!../../templates/hotTemplate */ 20);\n\nvar _hotTemplate2 = _interopRequireDefault(_hotTemplate);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n/* eslint-enable */\n\nconst cwd = process.cwd();\n\n// We need to prepend this to the browser script as a string but still want to transpile it,\n// hence loading it using `raw-loader` so we receive a string from webpack\n/* eslint-disable */\n/** @module cli/require-templates */\n\nconst huronScript = _fsExtra2.default.readFileSync(_path2.default.join(__dirname, '../web/index.js'), 'utf8');\n\n/**\n * Write code for requiring all generated huron assets\n *\n * @function requireTemplates\n * @param {object} store - memory store\n */\nconst requireTemplates = exports.requireTemplates = function requireTemplates(store) {\n const huron = store.get('config');\n const outputPath = _path2.default.join(cwd, huron.get('root'), 'huron-assets');\n // These will be used to replace strings in the hotTemplate.\n // In order to accurately replace strings but still keep things parseable by eslint and babel,\n // each replaceable value should be referenced in `hotTemplate.js` under the `hotScope` object.\n // For example, if you need to replace a string with a value passed in from the CLI called `userVariable`,\n // you would reference that string in `hotTemplate.js` with `hotScope.userVariable`.\n const hotVariableScope = {\n sectionTemplatePath: `'${huron.get('sectionTemplate')}'`,\n requireRegex: new RegExp(`\\\\.html|\\\\.json|\\\\${huron.get('templates').extension}$`),\n requirePath: `'../${huron.get('output')}'`\n };\n const hotTemplateTransformed = Object.keys(hotVariableScope).reduce((acc, curr) => acc.replace(new RegExp(`hotScope.${curr}`, 'g'), hotVariableScope[curr]), _hotTemplate2.default);\n\n // Write the contents of this script.\n _fsExtra2.default.outputFileSync(_path2.default.join(outputPath, 'index.js'), hotTemplateTransformed);\n _fsExtra2.default.outputFileSync(_path2.default.join(outputPath, 'insertNodes.js'), huronScript);\n};\n\n/**\n * Output entire data store to a JS object and handle if any KSS data has changed\n *\n * @function writeStore\n * @param {object} store - memory store\n * @param {string} changed - filepath of changed KSS section, if applicable\n */\nconst writeStore = exports.writeStore = function writeStore(store, newStore = false) {\n const updatedStore = newStore || store;\n const huron = updatedStore.get('config');\n const outputPath = _path2.default.join(cwd, huron.get('root'), 'huron-assets');\n\n // Write updated data store\n _fsExtra2.default.outputFileSync(_path2.default.join(outputPath, 'huron-store.js'), `module.exports = ${JSON.stringify(updatedStore.toJSON())}`);\n};//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiOC5qcyIsInNvdXJjZXMiOlsid2VicGFjazovLy9zcmMvY2xpL3JlcXVpcmVUZW1wbGF0ZXMuanM/ZmViYSJdLCJzb3VyY2VzQ29udGVudCI6WyIvKiogQG1vZHVsZSBjbGkvcmVxdWlyZS10ZW1wbGF0ZXMgKi9cbmltcG9ydCBwYXRoIGZyb20gJ3BhdGgnO1xuaW1wb3J0IGZzIGZyb20gJ2ZzLWV4dHJhJztcbl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cycpO1xuXG4gIC8vIFdyaXRlIHVwZGF0ZWQgZGF0YSBzdG9yZVxuICBmcy5vdXRwdXRGaWxlU3luYyhcbiAgICBwYXRoLmpvaW4ob3V0cHV0UGF0aCwgJ2h1cm9uLXN0b3JlLmpzJyksXG4gICAgYG1vZHVsZS5leHBvcnRzID0gJHtKU09OLnN0cmluZ2lmeSh1cGRhdGVkU3RvcmUudG9KU09OKCkpfWBcbiAgKTtcbn07XG5cblxuXG5cbi8vIFdFQlBBQ0sgRk9PVEVSIC8vXG4vLyBzcmMvY2xpL3JlcXVpcmVUZW1wbGF0ZXMuanMiXSwibWFwcGluZ3MiOiI7Ozs7Ozs7QUFDQTtBQUNBOzs7QUFBQTtBQUNBOzs7QUFJQTtBQUNBOzs7OztBQUFBO0FBQ0E7QUFDQTtBQUNBO0FBUEE7QUFDQTtBQUNBO0FBTkE7QUFDQTtBQVVBO0FBQ0E7QUFJQTs7Ozs7O0FBTUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUdBO0FBTEE7QUFPQTtBQUNBO0FBT0E7QUFDQTtBQUlBO0FBSUE7QUFDQTtBQUNBOzs7Ozs7O0FBT0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFJQSIsInNvdXJjZVJvb3QiOiIifQ=="); + + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.writeStore = exports.requireTemplates = undefined; + +var _path = __webpack_require__(0); + +var _path2 = _interopRequireDefault(_path); + +var _fsExtra = __webpack_require__(3); + +var _fsExtra2 = _interopRequireDefault(_fsExtra); + +var _hotTemplate = __webpack_require__(20); + +var _hotTemplate2 = _interopRequireDefault(_hotTemplate); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/* eslint-enable */ + +const cwd = process.cwd(); + +// We need to prepend this to the browser script as a string but still want to transpile it, +// hence loading it using `raw-loader` so we receive a string from webpack +/* eslint-disable */ +/** @module cli/require-templates */ + +const huronScript = _fsExtra2.default.readFileSync(_path2.default.join(__dirname, '../web/index.js'), 'utf8'); + +/** + * Write code for requiring all generated huron assets + * + * @function requireTemplates + * @param {object} store - memory store + */ +const requireTemplates = exports.requireTemplates = function requireTemplates(store) { + const huron = store.get('config'); + const outputPath = _path2.default.join(cwd, huron.get('root'), 'huron-assets'); + // These will be used to replace strings in the hotTemplate. + // In order to accurately replace strings but still keep things parseable by eslint and babel, + // each replaceable value should be referenced in `hotTemplate.js` under the `hotScope` object. + // For example, if you need to replace a string with a value passed in from the CLI called `userVariable`, + // you would reference that string in `hotTemplate.js` with `hotScope.userVariable`. + const hotVariableScope = { + sectionTemplatePath: `'${huron.get('sectionTemplate')}'`, + requireRegex: new RegExp(`\\.html|\\.json|\\${huron.get('templates').extension}$`), + requirePath: `'../${huron.get('output')}'` + }; + const hotTemplateTransformed = Object.keys(hotVariableScope).reduce((acc, curr) => acc.replace(new RegExp(`hotScope.${curr}`, 'g'), hotVariableScope[curr]), _hotTemplate2.default); + + // Write the contents of this script. + _fsExtra2.default.outputFileSync(_path2.default.join(outputPath, 'index.js'), hotTemplateTransformed); + _fsExtra2.default.outputFileSync(_path2.default.join(outputPath, 'insertNodes.js'), huronScript); +}; + +/** + * Output entire data store to a JS object and handle if any KSS data has changed + * + * @function writeStore + * @param {object} store - memory store + * @param {string} changed - filepath of changed KSS section, if applicable + */ +const writeStore = exports.writeStore = function writeStore(store, newStore = false) { + const updatedStore = newStore || store; + const huron = updatedStore.get('config'); + const outputPath = _path2.default.join(cwd, huron.get('root'), 'huron-assets'); + + // Write updated data store + _fsExtra2.default.outputFileSync(_path2.default.join(outputPath, 'huron-store.js'), `module.exports = ${JSON.stringify(updatedStore.toJSON())}`); +}; /***/ }), /* 9 */ -/* no static exports found */ -/* all exports used */ -/*!**************************!*\ - !*** ./src/cli/index.js ***! - \**************************/ /***/ (function(module, exports, __webpack_require__) { "use strict"; -eval("\n\nvar _chalk = __webpack_require__(/*! chalk */ 2);\n\nvar _chalk2 = _interopRequireDefault(_chalk);\n\nvar _actions = __webpack_require__(/*! ./actions */ 11);\n\nvar _requireTemplates = __webpack_require__(/*! ./requireTemplates */ 8);\n\nvar _utils = __webpack_require__(/*! ./utils */ 1);\n\nvar _parseArgs = __webpack_require__(/*! ./parseArgs */ 4);\n\nvar _parseArgs2 = _interopRequireDefault(_parseArgs);\n\nvar _server = __webpack_require__(/*! ./server */ 17);\n\nvar _server2 = _interopRequireDefault(_server);\n\nvar _defaultStore = __webpack_require__(/*! ./defaultStore */ 6);\n\nvar _fileWatcher = __webpack_require__(/*! ./fileWatcher */ 12);\n\nvar _fileWatcher2 = _interopRequireDefault(_fileWatcher);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n/**\n * Initialize data store with files from gaze and original data structure\n *\n * @global\n */\n// Local imports\nconst huron = _defaultStore.defaultStore.get('config');\nlet store = (0, _actions.initFiles)(_fileWatcher2.default.watched(), _defaultStore.defaultStore);\n\n(0, _requireTemplates.requireTemplates)(store);\n(0, _requireTemplates.writeStore)(store);\n\n// If building for production, close gaze and exit process once initFiles is done.\nif (_parseArgs2.default.production) {\n _fileWatcher2.default.close();\n}\n\n/** @module cli/gaze */\n_fileWatcher2.default.on('all', (event, filepath) => {\n store = (0, _actions.updateClassNames)(filepath, store);\n (0, _requireTemplates.writeStore)(store);\n});\n\n/**\n * Anonymous handler for Gaze 'changed' event indicating a file has changed\n *\n * @callback changed\n * @listens gaze:changed\n * @param {string} filepath - absolute path of changed file\n */\n_fileWatcher2.default.on('changed', filepath => {\n if ((0, _utils.matchKssDir)(filepath, huron)) {\n store = (0, _actions.updateFile)(filepath, store);\n }\n\n console.log(_chalk2.default.green(`${filepath} updated!`));\n});\n\n/**\n * Anonymous handler for Gaze 'added' event indicating a file has been added to the watched directories\n *\n * @callback added\n * @listens gaze:added\n * @param {string} filepath - absolute path of changed file\n */\n_fileWatcher2.default.on('added', filepath => {\n if ((0, _utils.matchKssDir)(filepath, huron)) {\n store = (0, _actions.updateFile)(filepath, store);\n (0, _requireTemplates.writeStore)(store);\n }\n\n console.log(_chalk2.default.blue(`${filepath} added!`));\n});\n\n/**\n * Anonymous handler for Gaze 'renamed' event indicating a file has been renamed\n *\n * @callback renamed\n * @listens gaze:renamed\n * @param {string} filepath - absolute path of changed file\n */\n_fileWatcher2.default.on('renamed', (newPath, oldPath) => {\n if ((0, _utils.matchKssDir)(newPath, huron)) {\n store = (0, _actions.deleteFile)(oldPath, store);\n store = (0, _actions.updateFile)(newPath, store);\n (0, _requireTemplates.writeStore)(store);\n }\n\n console.log(_chalk2.default.blue(`${newPath} added!`));\n});\n\n/**\n * Anonymous handler for Gaze 'deleted' event indicating a file has been removed\n *\n * @callback deleted\n * @listens gaze:deleted\n * @param {string} filepath - absolute path of changed file\n */\n_fileWatcher2.default.on('deleted', filepath => {\n if ((0, _utils.matchKssDir)(filepath, huron)) {\n store = (0, _actions.deleteFile)(filepath, store);\n (0, _requireTemplates.writeStore)(store);\n }\n\n console.log(_chalk2.default.red(`${filepath} deleted`));\n});\n\n// Start webpack or build for production\n(0, _server2.default)(_defaultStore.config);//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiOS5qcyIsInNvdXJjZXMiOlsid2VicGFjazovLy9zcmMvY2xpL2luZGV4LmpzPzg2N2IiXSwic291cmNlc0NvbnRlbnQiOlsiLy8gTG9jYWwgaW1wb3J0c1xuaW1wb3J0IGNoYWxrIGZyb20gJ2NoYWxrJztcblxuaW1wb3J0IHtcbiAgaW5pdEZpbGVzLFxuICB1cGRhdGVGaWxlLFxuICBkZWxldGVGaWxlLFxuICB1cGRhdGVDbGFzc05hbWVzLFxufSBmcm9tICcuL2FjdGlvbnMnO1xuaW1wb3J0IHsgcmVxdWlyZVRlbXBsYXRlcywgd3JpdGVTdG9yZSB9IGZyb20gJy4vcmVxdWlyZVRlbXBsYXRlcyc7XG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XBhdGh9IGRlbGV0ZWRgKSk7XG59KTtcblxuLy8gU3RhcnQgd2VicGFjayBvciBidWlsZCBmb3IgcHJvZHVjdGlvblxuc3RhcnRXZWJwYWNrKGNvbmZpZyk7XG5cblxuXG4vLyBXRUJQQUNLIEZPT1RFUiAvL1xuLy8gc3JjL2NsaS9pbmRleC5qcyJdLCJtYXBwaW5ncyI6Ijs7QUFDQTtBQUNBOzs7QUFDQTtBQUNBO0FBS0E7QUFDQTtBQUFBO0FBQ0E7QUFBQTtBQUNBOzs7QUFBQTtBQUNBOzs7QUFBQTtBQUNBO0FBQUE7QUFDQTs7Ozs7QUFDQTs7Ozs7QUFoQkE7QUFxQkE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOzs7Ozs7O0FBT0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOzs7Ozs7O0FBT0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7Ozs7Ozs7QUFPQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOzs7Ozs7O0FBT0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQSIsInNvdXJjZVJvb3QiOiIifQ=="); + + +var _chalk = __webpack_require__(2); + +var _chalk2 = _interopRequireDefault(_chalk); + +var _actions = __webpack_require__(11); + +var _requireTemplates = __webpack_require__(8); + +var _utils = __webpack_require__(1); + +var _parseArgs = __webpack_require__(4); + +var _parseArgs2 = _interopRequireDefault(_parseArgs); + +var _server = __webpack_require__(17); + +var _server2 = _interopRequireDefault(_server); + +var _defaultStore = __webpack_require__(6); + +var _fileWatcher = __webpack_require__(12); + +var _fileWatcher2 = _interopRequireDefault(_fileWatcher); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * Initialize data store with files from gaze and original data structure + * + * @global + */ +// Local imports +const huron = _defaultStore.defaultStore.get('config'); +let store = (0, _actions.initFiles)(_fileWatcher2.default.watched(), _defaultStore.defaultStore); + +(0, _requireTemplates.requireTemplates)(store); +(0, _requireTemplates.writeStore)(store); + +// If building for production, close gaze and exit process once initFiles is done. +if (_parseArgs2.default.production) { + _fileWatcher2.default.close(); +} + +/** @module cli/gaze */ +_fileWatcher2.default.on('all', (event, filepath) => { + store = (0, _actions.updateClassNames)(filepath, store); + (0, _requireTemplates.writeStore)(store); +}); + +/** + * Anonymous handler for Gaze 'changed' event indicating a file has changed + * + * @callback changed + * @listens gaze:changed + * @param {string} filepath - absolute path of changed file + */ +_fileWatcher2.default.on('changed', filepath => { + if ((0, _utils.matchKssDir)(filepath, huron)) { + store = (0, _actions.updateFile)(filepath, store); + } + + console.log(_chalk2.default.green(`${filepath} updated!`)); +}); + +/** + * Anonymous handler for Gaze 'added' event indicating a file has been added to the watched directories + * + * @callback added + * @listens gaze:added + * @param {string} filepath - absolute path of changed file + */ +_fileWatcher2.default.on('added', filepath => { + if ((0, _utils.matchKssDir)(filepath, huron)) { + store = (0, _actions.updateFile)(filepath, store); + (0, _requireTemplates.writeStore)(store); + } + + console.log(_chalk2.default.blue(`${filepath} added!`)); +}); + +/** + * Anonymous handler for Gaze 'renamed' event indicating a file has been renamed + * + * @callback renamed + * @listens gaze:renamed + * @param {string} filepath - absolute path of changed file + */ +_fileWatcher2.default.on('renamed', (newPath, oldPath) => { + if ((0, _utils.matchKssDir)(newPath, huron)) { + store = (0, _actions.deleteFile)(oldPath, store); + store = (0, _actions.updateFile)(newPath, store); + (0, _requireTemplates.writeStore)(store); + } + + console.log(_chalk2.default.blue(`${newPath} added!`)); +}); + +/** + * Anonymous handler for Gaze 'deleted' event indicating a file has been removed + * + * @callback deleted + * @listens gaze:deleted + * @param {string} filepath - absolute path of changed file + */ +_fileWatcher2.default.on('deleted', filepath => { + if ((0, _utils.matchKssDir)(filepath, huron)) { + store = (0, _actions.deleteFile)(filepath, store); + (0, _requireTemplates.writeStore)(store); + } + + console.log(_chalk2.default.red(`${filepath} deleted`)); +}); + +// Start webpack or build for production +(0, _server2.default)(_defaultStore.config); /***/ }), /* 10 */ -/* no static exports found */ -/* all exports used */ -/*!************************************!*\ - !*** ./config/devServer.config.js ***! - \************************************/ /***/ (function(module, exports, __webpack_require__) { "use strict"; -eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\n// import path from 'path';\n\nexports.default = huron => ({\n hot: true,\n host: 'localhost',\n quiet: false,\n noInfo: false,\n overlay: true,\n stats: {\n colors: true,\n hash: false,\n version: false,\n assets: false,\n chunks: false,\n modules: false,\n reasons: false,\n children: false,\n source: false\n },\n publicPath: `/${huron.root}`\n});//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMTAuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vY29uZmlnL2RldlNlcnZlci5jb25maWcuanM/YzhlNCJdLCJzb3VyY2VzQ29udGVudCI6WyIvLyBpbXBvcnQgcGF0aCBmcm9tICdwYXRoJztcblxuZXhwb3J0IGRlZmF1bHQgKGh1cm9uKSA9PiAoe1xuICBob3Q6IHRydWUsXG4gIGhvc3Q6ICdsb2NhbGhvc3QnLFxuICBxdWlldDogZmFsc2UsXG4gIG5vSW5mbzogZmFsc2UsXG4gIG92ZXJsYXk6IHRydWUsXG4gIHN0YXRzOiB7XG4gICAgY29sb3JzOiB0cnVlLFxuICAgIGhhc2g6IGZhbHNlLFxuICAgIHZlcnNpb246IGZhbHNlLFxuICAgIGFzc2V0czogZmFsc2UsXG4gICAgY2h1bmtzOiBmYWxzZSxcbiAgICBtb2R1bGVzOiBmYWxzZSxcbiAgICByZWFzb25zOiBmYWxzZSxcbiAgICBjaGlsZHJlbjogZmFsc2UsXG4gICAgc291cmNlOiBmYWxzZSxcbiAgfSxcbiAgcHVibGljUGF0aDogYC8ke2h1cm9uLnJvb3R9YCxcbn0pO1xuXG5cblxuLy8gV0VCUEFDSyBGT09URVIgLy9cbi8vIGNvbmZpZy9kZXZTZXJ2ZXIuY29uZmlnLmpzIl0sIm1hcHBpbmdzIjoiOzs7Ozs7QUFBQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFUQTtBQVdBO0FBakJBIiwic291cmNlUm9vdCI6IiJ9"); + + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +exports.default = huron => ({ + hot: true, + host: 'localhost', + quiet: false, + noInfo: false, + overlay: true, + stats: { + colors: true, + hash: false, + version: false, + assets: false, + chunks: false, + modules: false, + reasons: false, + children: false, + source: false + }, + publicPath: `/${huron.root}` +}); /***/ }), /* 11 */ -/* no static exports found */ -/* all exports used */ -/*!****************************!*\ - !*** ./src/cli/actions.js ***! - \****************************/ /***/ (function(module, exports, __webpack_require__) { "use strict"; -eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.initFiles = initFiles;\nexports.updateFile = updateFile;\nexports.deleteFile = deleteFile;\nexports.updateClassNames = updateClassNames;\n\nvar _path = __webpack_require__(/*! path */ 0);\n\nvar _path2 = _interopRequireDefault(_path);\n\nvar _chalk = __webpack_require__(/*! chalk */ 2);\n\nvar _chalk2 = _interopRequireDefault(_chalk);\n\nvar _isEqual = __webpack_require__(/*! lodash/isEqual */ 26);\n\nvar _isEqual2 = _interopRequireDefault(_isEqual);\n\nvar _handleHTML = __webpack_require__(/*! ./handleHTML */ 14);\n\nvar _handleTemplates = __webpack_require__(/*! ./handleTemplates */ 7);\n\nvar _handleKSS = __webpack_require__(/*! ./handleKSS */ 15);\n\nvar _utils = __webpack_require__(/*! ./utils */ 1);\n\nvar utils = _interopRequireWildcard(_utils);\n\nfunction _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n/**\n * Recursively loop through initial watched files list from Gaze.\n *\n * @param {object} data - object containing directory and file paths\n * @param {object} store - memory store\n * @return {object} newStore - map object of entire data store\n */\nfunction initFiles(data, store, depth = 0) {\n const type = Object.prototype.toString.call(data);\n const huron = store.get('config');\n let newStore = store;\n let info;\n let files;\n\n switch (type) {\n case '[object Object]':\n files = Object.keys(data);\n newStore = files.reduce((prevStore, file) => initFiles(data[file], prevStore, depth), newStore);\n break;\n\n case '[object Array]':\n newStore = data.reduce((prevStore, file) => initFiles(file, prevStore, depth), newStore);\n break;\n\n case '[object String]':\n info = _path2.default.parse(data);\n\n // Only call update if data is a filepath and it's within the KSS source directory\n if (info.ext && !data.includes(huron.get('classNames'))) {\n newStore = updateFile(data, store);\n }\n break;\n\n default:\n break;\n }\n\n return newStore;\n}\n\n/**\n * Logic for updating and writing file information based on file type (extension)\n *\n * @param {string} filepath - path to updated file. usually passed in from Gaze\n * @param {object} store - memory store\n * @return {object} store - map object of map object of entire data store\n */\n/** @module cli/actions */\n\n// Imports\nfunction updateFile(filepath, store) {\n const huron = store.get('config');\n const file = _path2.default.parse(filepath);\n let field;\n let section;\n\n if (filepath.includes(huron.get('sectionTemplate'))) {\n return utils.writeSectionTemplate(filepath, store);\n }\n\n switch (file.ext) {\n // Plain HTML template, external\n case '.html':\n section = utils.getSection(file.base, 'markup', store);\n\n if (section) {\n return (0, _handleHTML.updateHTML)(filepath, section, store);\n } else if (file.dir.includes('prototypes') && file.name.includes('prototype-')) {\n return (0, _handleHTML.updatePrototype)(filepath, store);\n }\n\n console.log(_chalk2.default.red(`Failed to write file: ${file.name}`));\n break;\n\n // Handlebars template, external\n case huron.get('templates').extension:\n case '.json':\n field = '.json' === file.ext ? 'data' : 'markup';\n section = utils.getSection(file.base, field, store);\n\n if (section) {\n return (0, _handleTemplates.updateTemplate)(filepath, section, store);\n }\n\n console.log( // eslint-disable-line no-console\n _chalk2.default.red(`Could not find associated KSS section for ${filepath}`));\n break;\n\n // KSS documentation (default extension is `.css`)\n // Will also output a template if markup is inline\n // Note: inline markup does _not_ support handlebars currently\n case huron.get('kssExtension'):\n return (0, _handleKSS.updateKSS)(filepath, store);\n\n // This should never happen if Gaze is working properly\n default:\n return store;\n }\n\n return store;\n}\n\n/**\n * Logic for deleting file information and files based on file type (extension)\n *\n * @param {string} filepath - path to updated file. usually passed in from Gaze\n * @param {object} store - memory store\n * @return {object} newStore - map object of map object of entire data store\n */\nfunction deleteFile(filepath, store) {\n const huron = store.get('config');\n const file = _path2.default.parse(filepath);\n let field = '';\n let section = null;\n let newStore = store;\n\n switch (file.ext) {\n // Plain HTML template, external\n case '.html':\n section = utils.getSection(file.base, 'markup', store);\n\n if (section) {\n newStore = (0, _handleHTML.deleteHTML)(filepath, section, store);\n } else if (file.dir.includes('prototypes') && file.name.includes('prototype-')) {\n newStore = (0, _handleHTML.deletePrototype)(filepath, store);\n }\n break;\n\n case huron.get('templates').extension:\n case '.json':\n field = '.json' === file.ext ? 'data' : 'markup';\n section = utils.getSection(file.base, field, store);\n\n if (section) {\n newStore = (0, _handleTemplates.deleteTemplate)(filepath, section, store);\n }\n break;\n\n case huron.get('kssExtension'):\n section = utils.getSection(filepath, false, store);\n\n if (section) {\n newStore = (0, _handleKSS.deleteKSS)(filepath, section, store);\n }\n break;\n\n default:\n console.warn( // eslint-disable-line no-console\n _chalk2.default.red(`Could not delete: ${file.name}`));\n break;\n }\n\n return newStore;\n}\n\n/**\n * Logic for updating localized classnames from CSS modules\n *\n * @param {string} filepath - path to updated file. usually passed in from Gaze\n * @param {object} store - memory store\n *\n * @return void\n */\nfunction updateClassNames(filepath, store) {\n const classNamesPath = store.getIn(['config', 'classNames']);\n\n if (filepath.includes(classNamesPath)) {\n const oldClassnames = store.get('classNames');\n const newClassnames = utils.mergeClassnameJSON(classNamesPath);\n\n if (!(0, _isEqual2.default)(oldClassnames, newClassnames)) {\n return store.set('classNames', newClassnames);\n }\n }\n\n return store;\n}//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMTEuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vc3JjL2NsaS9hY3Rpb25zLmpzPzVlNWEiXSwic291cmNlc0NvbnRlbnQiOlsiLyoqIEBtb2R1bGUgY2xpL2FjdGlvbnMgKi9cblxuLy8gSW1wb3J0c1xuaW1wb3J0IHBhdGggZnJvbSAncGF0aCc7XG5pbXBvcnQgY2hhbGsgZnJvbSAnY2hhbGsnO1xuaW1wb3J0IGlzRXF1YWwgZnJvbSAnbG9kYXNoL2lzRXF1YWwnO1xuXG5pbXBvcnQge1xuICB1cGRhdGVIVE1MLFxuICBkZWxldGVIVE1MLFxuICB1cGRhdGVQcm90b3R5cGUsXG4gIGRlbGV0ZVByb3RvdHlwZSxcbn0gZnJvbSAnLi9oYW5kbGVIVE1MJztcbmltcG9ydCB7IHVwZGF0ZVRlbXBsYXRlLCBkZWxldGVUZW1wbGF0ZSB9IGZyb20gJy4vaGFuZGxlVGVtcGxhdGVzJztcbmltcG9ydCB7IHVwZGF0ZUtTUywgZGVsZXRlS1NTIH0gZnJvbSAnLi9oYW5kbGVLU1MnO1xuaW1wb3J0ICogYXMgdXRpbHMgZnJvbSAnLi91dGlscyc7XG5cbi8qKlxuICogUmVjdXJzaXZlbHkgbG9vcCB0aHJvdWdoIGluaXRpYWwgd2F0Y2hlZCBmaWxlcyBsaXN0IGZyb20gR2F6ZS5cbiAqXG4gKiBAcGFyYW0ge29iamVjdH0gZGF0YSAtIG9iamVjdCBjb250YWluaW5nIG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E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBSUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBRUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQXhDQTtBQUNBO0FBMENBO0FBQ0E7QUFDQTtBQUNBOzs7Ozs7O0FBT0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBSUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFFQTtBQXJDQTtBQUNBO0FBdUNBO0FBQ0E7QUFDQTtBQUNBOzs7Ozs7OztBQVFBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0EiLCJzb3VyY2VSb290IjoiIn0="); + + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.initFiles = initFiles; +exports.updateFile = updateFile; +exports.deleteFile = deleteFile; +exports.updateClassNames = updateClassNames; + +var _path = __webpack_require__(0); + +var _path2 = _interopRequireDefault(_path); + +var _chalk = __webpack_require__(2); + +var _chalk2 = _interopRequireDefault(_chalk); + +var _isEqual = __webpack_require__(26); + +var _isEqual2 = _interopRequireDefault(_isEqual); + +var _handleHTML = __webpack_require__(14); + +var _handleTemplates = __webpack_require__(7); + +var _handleKSS = __webpack_require__(15); + +var _utils = __webpack_require__(1); + +var utils = _interopRequireWildcard(_utils); + +function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * Recursively loop through initial watched files list from Gaze. + * + * @param {object} data - object containing directory and file paths + * @param {object} store - memory store + * @return {object} newStore - map object of entire data store + */ +function initFiles(data, store, depth = 0) { + const type = Object.prototype.toString.call(data); + const huron = store.get('config'); + let newStore = store; + let info; + let files; + + switch (type) { + case '[object Object]': + files = Object.keys(data); + newStore = files.reduce((prevStore, file) => initFiles(data[file], prevStore, depth), newStore); + break; + + case '[object Array]': + newStore = data.reduce((prevStore, file) => initFiles(file, prevStore, depth), newStore); + break; + + case '[object String]': + info = _path2.default.parse(data); + + // Only call update if data is a filepath and it's within the KSS source directory + if (info.ext && !data.includes(huron.get('classNames'))) { + newStore = updateFile(data, store); + } + break; + + default: + break; + } + + return newStore; +} + +/** + * Logic for updating and writing file information based on file type (extension) + * + * @param {string} filepath - path to updated file. usually passed in from Gaze + * @param {object} store - memory store + * @return {object} store - map object of map object of entire data store + */ +/** @module cli/actions */ + +// Imports +function updateFile(filepath, store) { + const huron = store.get('config'); + const file = _path2.default.parse(filepath); + let field; + let section; + + if (filepath.includes(huron.get('sectionTemplate'))) { + return utils.writeSectionTemplate(filepath, store); + } + + switch (file.ext) { + // Plain HTML template, external + case '.html': + section = utils.getSection(file.base, 'markup', store); + + if (section) { + return (0, _handleHTML.updateHTML)(filepath, section, store); + } else if (file.dir.includes('prototypes') && file.name.includes('prototype-')) { + return (0, _handleHTML.updatePrototype)(filepath, store); + } + + console.log(_chalk2.default.red(`Failed to write file: ${file.name}`)); + break; + + // Handlebars template, external + case huron.get('templates').extension: + case '.json': + field = '.json' === file.ext ? 'data' : 'markup'; + section = utils.getSection(file.base, field, store); + + if (section) { + return (0, _handleTemplates.updateTemplate)(filepath, section, store); + } + + console.log( // eslint-disable-line no-console + _chalk2.default.red(`Could not find associated KSS section for ${filepath}`)); + break; + + // KSS documentation (default extension is `.css`) + // Will also output a template if markup is inline + // Note: inline markup does _not_ support handlebars currently + case huron.get('kssExtension'): + return (0, _handleKSS.updateKSS)(filepath, store); + + // This should never happen if Gaze is working properly + default: + return store; + } + + return store; +} + +/** + * Logic for deleting file information and files based on file type (extension) + * + * @param {string} filepath - path to updated file. usually passed in from Gaze + * @param {object} store - memory store + * @return {object} newStore - map object of map object of entire data store + */ +function deleteFile(filepath, store) { + const huron = store.get('config'); + const file = _path2.default.parse(filepath); + let field = ''; + let section = null; + let newStore = store; + + switch (file.ext) { + // Plain HTML template, external + case '.html': + section = utils.getSection(file.base, 'markup', store); + + if (section) { + newStore = (0, _handleHTML.deleteHTML)(filepath, section, store); + } else if (file.dir.includes('prototypes') && file.name.includes('prototype-')) { + newStore = (0, _handleHTML.deletePrototype)(filepath, store); + } + break; + + case huron.get('templates').extension: + case '.json': + field = '.json' === file.ext ? 'data' : 'markup'; + section = utils.getSection(file.base, field, store); + + if (section) { + newStore = (0, _handleTemplates.deleteTemplate)(filepath, section, store); + } + break; + + case huron.get('kssExtension'): + section = utils.getSection(filepath, false, store); + + if (section) { + newStore = (0, _handleKSS.deleteKSS)(filepath, section, store); + } + break; + + default: + console.warn( // eslint-disable-line no-console + _chalk2.default.red(`Could not delete: ${file.name}`)); + break; + } + + return newStore; +} + +/** + * Logic for updating localized classnames from CSS modules + * + * @param {string} filepath - path to updated file. usually passed in from Gaze + * @param {object} store - memory store + * + * @return void + */ +function updateClassNames(filepath, store) { + const classNamesPath = store.getIn(['config', 'classNames']); + + if (filepath.includes(classNamesPath)) { + const oldClassnames = store.get('classNames'); + const newClassnames = utils.mergeClassnameJSON(classNamesPath); + + if (!(0, _isEqual2.default)(oldClassnames, newClassnames)) { + return store.set('classNames', newClassnames); + } + } + + return store; +} /***/ }), /* 12 */ -/* no static exports found */ -/* all exports used */ -/*!********************************!*\ - !*** ./src/cli/fileWatcher.js ***! - \********************************/ /***/ (function(module, exports, __webpack_require__) { "use strict"; -eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.watchedFiles = exports.extensions = undefined;\n\nvar _gaze = __webpack_require__(/*! gaze */ 22);\n\nvar _path = __webpack_require__(/*! path */ 0);\n\nvar _path2 = _interopRequireDefault(_path);\n\nvar _utils = __webpack_require__(/*! ./utils */ 1);\n\nvar _defaultStore = __webpack_require__(/*! ./defaultStore */ 6);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n/**\n * Huron configuration object\n *\n * @global\n */\nconst huron = _defaultStore.defaultStore.get('config');\n\n/**\n * Available file extensions. Extensions should not include the leading '.'\n *\n * @global\n */\nconst extensions = exports.extensions = [huron.get('kssExtension'), huron.get('templates').extension, 'html', 'json'].map(extension => extension.replace('.', ''));\n\n// Generate watch list for Gaze, start gaze\nconst watchedFiles = exports.watchedFiles = [];\n\n// Watch section template\nwatchedFiles.push(_path2.default.resolve(huron.get('sectionTemplate')));\n\n// Watch cssmodules classname files (if they exist)\nif (huron.get('classNames')) {\n watchedFiles.push(`${_path2.default.resolve(huron.get('classNames'))}/*.json`);\n}\n\n// Watch all provided kss directories\nhuron.get('kss').forEach(dir => {\n watchedFiles.push(`${(0, _utils.removeTrailingSlash)(dir)}/**/*.+(${extensions.join('|')})`);\n});\n\n/**\n * Gaze instance for watching all files, including KSS, html, hbs/template, and JSON\n *\n * @global\n */\nconst gaze = new _gaze.Gaze(watchedFiles);\n\nexports.default = gaze;//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMTIuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vc3JjL2NsaS9maWxlV2F0Y2hlci5qcz80ZGI4Il0sInNvdXJjZX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4gIHdhdGNoZWRGaWxlcy5wdXNoKFxuICAgIGAke3BhdGgucmVzb2x2ZShodXJvbi5nZXQoJ2NsYXNzTmFtZXMnKSl9LyouanNvbmBcbiAgKTtcbn1cblxuLy8gV2F0Y2ggYWxsIHByb3ZpZGVkIGtzcyBkaXJlY3Rvcmllc1xuaHVyb24uZ2V0KCdrc3MnKS5mb3JFYWNoKChkaXIpID0+IHtcbiAgd2F0Y2hlZEZpbGVzLnB1c2goXG4gICAgYCR7cmVtb3ZlVHJhaWxpbmdTbGFzaChkaXIpfS8qKi8qLisoJHtleHRlbnNpb25zLmpvaW4oJ3wnKX0pYFxuICApO1xufSk7XG5cbi8qKlxuICogR2F6ZSBpbnN0YW5jZSBmb3Igd2F0Y2hpbmcgYWxsIGZpbGVzLCBpbmNsdWRpbmcgS1NTLCBodG1sLCBoYnMvdGVtcGxhdGUsIGFuZCBKU09OXG4gKlxuICogQGdsb2JhbFxuICovXG5jb25zdCBnYXplID0gbmV3IEdhemUod2F0Y2hlZEZpbGVzKTtcblxuZXhwb3J0IGRlZmF1bHQgZ2F6ZTtcblxuXG5cbi8vIFdFQlBBQ0sgRk9PVEVSIC8vXG4vLyBzcmMvY2xpL2ZpbGVXYXRjaGVyLmpzIl0sIm1hcHBpbmdzIjoiOzs7Ozs7O0FBQUE7QUFDQTtBQUFBO0FBQ0E7OztBQUNBO0FBQ0E7QUFBQTtBQUNBOzs7QUFDQTs7Ozs7QUFLQTtBQUNBO0FBQ0E7Ozs7O0FBS0E7QUFDQTtBQU1BO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUdBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFHQTtBQUNBO0FBQ0E7Ozs7O0FBS0E7QUFDQTtBQUNBIiwic291cmNlUm9vdCI6IiJ9"); + + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.watchedFiles = exports.extensions = undefined; + +var _gaze = __webpack_require__(22); + +var _path = __webpack_require__(0); + +var _path2 = _interopRequireDefault(_path); + +var _utils = __webpack_require__(1); + +var _defaultStore = __webpack_require__(6); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * Huron configuration object + * + * @global + */ +const huron = _defaultStore.defaultStore.get('config'); + +/** + * Available file extensions. Extensions should not include the leading '.' + * + * @global + */ +const extensions = exports.extensions = [huron.get('kssExtension'), huron.get('templates').extension, 'html', 'json'].map(extension => extension.replace('.', '')); + +// Generate watch list for Gaze, start gaze +const watchedFiles = exports.watchedFiles = []; + +// Watch section template +watchedFiles.push(_path2.default.resolve(huron.get('sectionTemplate'))); + +// Watch cssmodules classname files (if they exist) +if (huron.get('classNames')) { + watchedFiles.push(`${_path2.default.resolve(huron.get('classNames'))}/*.json`); +} + +// Watch all provided kss directories +huron.get('kss').forEach(dir => { + watchedFiles.push(`${(0, _utils.removeTrailingSlash)(dir)}/**/*.+(${extensions.join('|')})`); +}); + +/** + * Gaze instance for watching all files, including KSS, html, hbs/template, and JSON + * + * @global + */ +const gaze = new _gaze.Gaze(watchedFiles); + +exports.default = gaze; /***/ }), /* 13 */ -/* no static exports found */ -/* all exports used */ -/*!***********************************!*\ - !*** ./src/cli/generateConfig.js ***! - \***********************************/ /***/ (function(module, exports, __webpack_require__) { "use strict"; -eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = generateConfig;\n\nvar _path = __webpack_require__(/*! path */ 0);\n\nvar _path2 = _interopRequireDefault(_path);\n\nvar _url = __webpack_require__(/*! url */ 28);\n\nvar _url2 = _interopRequireDefault(_url);\n\nvar _fsExtra = __webpack_require__(/*! fs-extra */ 3);\n\nvar _fsExtra2 = _interopRequireDefault(_fsExtra);\n\nvar _webpack = __webpack_require__(/*! webpack */ 5);\n\nvar _webpack2 = _interopRequireDefault(_webpack);\n\nvar _htmlWebpackPlugin = __webpack_require__(/*! html-webpack-plugin */ 23);\n\nvar _htmlWebpackPlugin2 = _interopRequireDefault(_htmlWebpackPlugin);\n\nvar _parseArgs = __webpack_require__(/*! ./parseArgs */ 4);\n\nvar _parseArgs2 = _interopRequireDefault(_parseArgs);\n\nvar _requireExternal = __webpack_require__(/*! ./requireExternal */ 16);\n\nvar _requireExternal2 = _interopRequireDefault(_requireExternal);\n\nvar _webpack3 = __webpack_require__(/*! ../defaultConfig/webpack.config */ 19);\n\nvar _webpack4 = _interopRequireDefault(_webpack3);\n\nvar _huron = __webpack_require__(/*! ../defaultConfig/huron.config */ 18);\n\nvar _huron2 = _interopRequireDefault(_huron);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nconst cwd = process.cwd();\n\n// Require configs passed in by user from CLI\n/** @module cli/generate-config */\nlet defaultConfig = false;\nconst localConfig = (0, _requireExternal2.default)(_path2.default.resolve(_parseArgs2.default.webpackConfig));\nconst localHuron = (0, _requireExternal2.default)(_path2.default.resolve(_parseArgs2.default.huronConfig));\n\n/**\n * Generate a mutant hybrid of the huron default webpack config and your local webpack config\n *\n * @function generateConfig\n * @param {object} config - local webpack config\n * @return {object} newConfig - updated data store\n */\nfunction generateConfig() {\n let newConfig = localConfig;\n let newHuron = localHuron;\n\n // Execute config function, if provided\n if ('function' === typeof newConfig) {\n newConfig = newConfig(_parseArgs2.default.env);\n }\n\n // Execute huron config function, if provided\n if ('function' === typeof newHuron) {\n newHuron = newHuron(_parseArgs2.default.env);\n }\n\n // Merge huron defaults with user settings\n newHuron = Object.assign({}, _huron2.default, newHuron);\n // Use user huron config to modify webpack defaults\n defaultConfig = (0, _webpack4.default)(newHuron);\n\n // Set ouput options\n newConfig.output = Object.assign({}, defaultConfig.output, newConfig.output);\n newConfig.output.path = defaultConfig.output.path;\n newConfig.output.publicPath = defaultConfig.output.publicPath;\n\n // configure entries\n newConfig = configureEntries(newHuron, newConfig);\n\n // configure plugins\n newConfig = configurePlugins(newHuron, newConfig);\n\n // configure loaders\n newConfig = configureLoaders(newHuron, newConfig);\n\n // Add HTMLWebpackPlugin for each configured prototype\n newConfig = configurePrototypes(newHuron, newConfig);\n\n // Remove existing devServer settings\n delete newConfig.devServer;\n\n return {\n huron: newHuron,\n webpack: newConfig\n };\n}\n\n/**\n * Configure and manage webpack entry points\n *\n * @param {object} huron - huron configuration object\n * @param {object} config - webpack configuration object\n * @return {object} newConfig - updated data store\n */\nfunction configureEntries(huron, config) {\n const entry = config.entry[huron.entry];\n const newConfig = config;\n\n newConfig.entry = {};\n if (!_parseArgs2.default.production) {\n newConfig.entry[huron.entry] = [`webpack-dev-server/client/index.js?http://localhost:${huron.port}/`, 'webpack/hot/dev-server', _path2.default.join(cwd, huron.root, 'huron-assets/index')].concat(entry);\n } else {\n newConfig.entry[huron.entry] = [_path2.default.join(cwd, huron.root, 'huron-assets/index')].concat(entry);\n }\n\n return newConfig;\n}\n\n/**\n * Configure and manage webpack plugins\n *\n * @param {object} huron - huron configuration object\n * @param {object} config - webpack configuration object\n * @return {object} newConfig - updated data store\n */\nfunction configurePlugins(huron, config) {\n const newConfig = config;\n\n newConfig.plugins = config.plugins || [];\n\n if (!_parseArgs2.default.production) {\n if (newConfig.plugins && newConfig.plugins.length) {\n newConfig.plugins = newConfig.plugins.filter(plugin => 'HotModuleReplacementPlugin' !== plugin.constructor.name && 'NamedModulesPlugin' !== plugin.constructor.name);\n }\n newConfig.plugins = newConfig.plugins.concat([new _webpack2.default.HotModuleReplacementPlugin(), new _webpack2.default.NamedModulesPlugin()]);\n }\n\n return newConfig;\n}\n\n/**\n * Configure and manage webpack loaders\n *\n * @param {object} huron - huron configuration object\n * @param {object} config - webpack configuration object\n * @return {object} newConfig - updated data store\n */\nfunction configureLoaders(huron, config) {\n // Manage loaders\n const templatesLoader = huron.templates.rule || {};\n const newConfig = config;\n\n // Make sure we're only using templates loader for files in huron root\n templatesLoader.include = [_path2.default.join(cwd, huron.root, huron.output)];\n\n // Normalize module and module.rules\n newConfig.module = newConfig.module || {};\n newConfig.module.rules = newConfig.module.rules || newConfig.module.loaders || [];\n\n // Add default loaders\n newConfig.module.rules = defaultConfig.module.rules.concat(newConfig.module.rules, templatesLoader);\n\n return newConfig;\n}\n\n/**\n * Create an HTML webpack plugin for each configured prototype\n *\n * @param {object} huron - huron configuration object\n * @param {object} config - webpack configuration object\n * @return {object} newConfig - updated data store\n */\nfunction configurePrototypes(huron, config) {\n const wrapperTemplate = _fsExtra2.default.readFileSync(_path2.default.join(__dirname, '../../templates/prototypeTemplate.hbs'), 'utf8');\n\n const defaultHTMLPluginOptions = {\n title: 'Huron',\n window: huron.window,\n js: [],\n css: [],\n filename: 'index.html',\n template: _path2.default.join(cwd, huron.root, 'huron-assets/prototypeTemplate.hbs'),\n inject: false,\n chunks: [huron.entry]\n };\n const newConfig = config;\n\n // Write prototype template file for HTML webpack plugin\n _fsExtra2.default.outputFileSync(_path2.default.join(cwd, huron.root, 'huron-assets/prototypeTemplate.hbs'), wrapperTemplate);\n\n huron.prototypes.forEach(prototype => {\n const newPrototype = prototype;\n let opts = {};\n\n // Merge configured settings with default settings\n if ('string' === typeof prototype) {\n opts = Object.assign({}, defaultHTMLPluginOptions, {\n title: prototype,\n filename: `${prototype}.html`\n });\n } else if ('object' === typeof prototype && {}.hasOwnProperty.call(prototype, 'title')) {\n // Create filename based on configured title if not provided\n if (!prototype.filename) {\n newPrototype.filename = `${prototype.title}.html`;\n }\n\n // Move css assets for this prototype,\n // reset css option with new file paths\n if (prototype.css) {\n newPrototype.css = moveAdditionalAssets(prototype.css, 'css', huron);\n }\n\n // Move js assets for this prototype,\n // reset js option with new file paths\n if (prototype.js) {\n newPrototype.js = moveAdditionalAssets(prototype.js, 'js', huron);\n }\n\n opts = Object.assign({}, defaultHTMLPluginOptions, newPrototype);\n }\n\n // Move global css assets,\n // reset css option with new file paths\n if (huron.css.length) {\n opts.css = opts.css.concat(moveAdditionalAssets(huron.css, 'css', huron));\n }\n\n // Move global js assets,\n // reset js option with new file paths\n if (huron.js.length) {\n opts.js = opts.js.concat(moveAdditionalAssets(huron.js, 'js', huron));\n }\n\n // Push a new plugin for each configured prototype\n if (Object.keys(opts).length) {\n newConfig.plugins.push(new _htmlWebpackPlugin2.default(opts));\n }\n });\n\n return newConfig;\n}\n\n/**\n * Move relative (and local) js and css assets provided in huron options\n *\n * @param {array|string} assets - array of assets or single asset\n * @param {string} subdir - subdirectory in huron root from which to load additional asset\n * @param {object} huron - huron configuration object\n * @return {array} assetResults - paths to js and css assets\n */\nfunction moveAdditionalAssets(assets, subdir = '', huron) {\n const currentAssets = [].concat(assets);\n const assetResults = [];\n\n currentAssets.forEach(asset => {\n const assetInfo = _path2.default.parse(asset);\n const assetURL = _url2.default.parse(asset);\n const sourcePath = _path2.default.join(cwd, asset);\n const outputPath = _path2.default.resolve(cwd, huron.root, subdir, assetInfo.base);\n const loadPath = _path2.default.join(subdir, assetInfo.base);\n let contents = false;\n\n if (!_path2.default.isAbsolute(asset) && !assetURL.protocol) {\n try {\n contents = _fsExtra2.default.readFileSync(sourcePath);\n } catch (e) {\n console.warn(`could not read ${sourcePath}`);\n }\n\n if (contents) {\n _fsExtra2.default.outputFileSync(outputPath, contents);\n assetResults.push(loadPath);\n }\n } else {\n assetResults.push(asset);\n }\n });\n\n return assetResults;\n}//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMTMuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vc3JjL2NsaS9nZW5lcmF0ZUNvbmZpZy5qcz9lZGUwIl0sInNvdXJjZXNDb250ZW50IjpbIi8qKiBAbW9kdWxlIGNsaS9nZW5lcmF0ZS1jb25maWcgKi9cbmltcG9ydCBwYXRoIGZyb20gJ3BhdGgnO1xuaW1wb3J0IHVybCBmcm9tICd1cmwnO1xuaW1wb3J0IGZzIGZyb20gJ2ZzLWV4dHJhJztcbmltcG9ydCB3ZWJwYWNrIGZyb20gJ3dlYnBhY2snO1xuaW1wb3J0IEhUTUxXZWJwYWNrUGx1Z2luIGZyb20gJ2h0bWwtd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O0FBQ0E7QUFJQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBIiwic291cmNlUm9vdCI6IiJ9"); + + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = generateConfig; + +var _path = __webpack_require__(0); + +var _path2 = _interopRequireDefault(_path); + +var _url = __webpack_require__(28); + +var _url2 = _interopRequireDefault(_url); + +var _fsExtra = __webpack_require__(3); + +var _fsExtra2 = _interopRequireDefault(_fsExtra); + +var _webpack = __webpack_require__(5); + +var _webpack2 = _interopRequireDefault(_webpack); + +var _htmlWebpackPlugin = __webpack_require__(23); + +var _htmlWebpackPlugin2 = _interopRequireDefault(_htmlWebpackPlugin); + +var _parseArgs = __webpack_require__(4); + +var _parseArgs2 = _interopRequireDefault(_parseArgs); + +var _requireExternal = __webpack_require__(16); + +var _requireExternal2 = _interopRequireDefault(_requireExternal); + +var _webpack3 = __webpack_require__(19); + +var _webpack4 = _interopRequireDefault(_webpack3); + +var _huron = __webpack_require__(18); + +var _huron2 = _interopRequireDefault(_huron); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +const cwd = process.cwd(); + +// Require configs passed in by user from CLI +/** @module cli/generate-config */ +let defaultConfig = false; +const localConfig = (0, _requireExternal2.default)(_path2.default.resolve(_parseArgs2.default.webpackConfig)); +const localHuron = (0, _requireExternal2.default)(_path2.default.resolve(_parseArgs2.default.huronConfig)); + +/** + * Generate a mutant hybrid of the huron default webpack config and your local webpack config + * + * @function generateConfig + * @param {object} config - local webpack config + * @return {object} newConfig - updated data store + */ +function generateConfig() { + let newConfig = localConfig; + let newHuron = localHuron; + + // Execute config function, if provided + if ('function' === typeof newConfig) { + newConfig = newConfig(_parseArgs2.default.env); + } + + // Execute huron config function, if provided + if ('function' === typeof newHuron) { + newHuron = newHuron(_parseArgs2.default.env); + } + + // Merge huron defaults with user settings + newHuron = Object.assign({}, _huron2.default, newHuron); + // Use user huron config to modify webpack defaults + defaultConfig = (0, _webpack4.default)(newHuron); + + // Set ouput options + newConfig.output = Object.assign({}, defaultConfig.output, newConfig.output); + newConfig.output.path = defaultConfig.output.path; + newConfig.output.publicPath = defaultConfig.output.publicPath; + + // configure entries + newConfig = configureEntries(newHuron, newConfig); + + // configure plugins + newConfig = configurePlugins(newHuron, newConfig); + + // configure loaders + newConfig = configureLoaders(newHuron, newConfig); + + // Add HTMLWebpackPlugin for each configured prototype + newConfig = configurePrototypes(newHuron, newConfig); + + // Remove existing devServer settings + delete newConfig.devServer; + + return { + huron: newHuron, + webpack: newConfig + }; +} + +/** + * Configure and manage webpack entry points + * + * @param {object} huron - huron configuration object + * @param {object} config - webpack configuration object + * @return {object} newConfig - updated data store + */ +function configureEntries(huron, config) { + const entry = config.entry[huron.entry]; + const newConfig = config; + + newConfig.entry = {}; + if (!_parseArgs2.default.production) { + newConfig.entry[huron.entry] = [`webpack-dev-server/client/index.js?http://localhost:${huron.port}/`, 'webpack/hot/dev-server', _path2.default.join(cwd, huron.root, 'huron-assets/index')].concat(entry); + } else { + newConfig.entry[huron.entry] = [_path2.default.join(cwd, huron.root, 'huron-assets/index')].concat(entry); + } + + return newConfig; +} + +/** + * Configure and manage webpack plugins + * + * @param {object} huron - huron configuration object + * @param {object} config - webpack configuration object + * @return {object} newConfig - updated data store + */ +function configurePlugins(huron, config) { + const newConfig = config; + + newConfig.plugins = config.plugins || []; + + if (!_parseArgs2.default.production) { + if (newConfig.plugins && newConfig.plugins.length) { + newConfig.plugins = newConfig.plugins.filter(plugin => 'HotModuleReplacementPlugin' !== plugin.constructor.name && 'NamedModulesPlugin' !== plugin.constructor.name); + } + newConfig.plugins = newConfig.plugins.concat([new _webpack2.default.HotModuleReplacementPlugin(), new _webpack2.default.NamedModulesPlugin()]); + } + + return newConfig; +} + +/** + * Configure and manage webpack loaders + * + * @param {object} huron - huron configuration object + * @param {object} config - webpack configuration object + * @return {object} newConfig - updated data store + */ +function configureLoaders(huron, config) { + // Manage loaders + const templatesLoader = huron.templates.rule || {}; + const newConfig = config; + + // Make sure we're only using templates loader for files in huron root + templatesLoader.include = [_path2.default.join(cwd, huron.root, huron.output)]; + + // Normalize module and module.rules + newConfig.module = newConfig.module || {}; + newConfig.module.rules = newConfig.module.rules || newConfig.module.loaders || []; + + // Add default loaders + newConfig.module.rules = defaultConfig.module.rules.concat(newConfig.module.rules, templatesLoader); + + return newConfig; +} + +/** + * Create an HTML webpack plugin for each configured prototype + * + * @param {object} huron - huron configuration object + * @param {object} config - webpack configuration object + * @return {object} newConfig - updated data store + */ +function configurePrototypes(huron, config) { + const wrapperTemplate = _fsExtra2.default.readFileSync(_path2.default.join(__dirname, '../../templates/prototypeTemplate.hbs'), 'utf8'); + + const defaultHTMLPluginOptions = { + title: 'Huron', + window: huron.window, + js: [], + css: [], + filename: 'index.html', + template: _path2.default.join(cwd, huron.root, 'huron-assets/prototypeTemplate.hbs'), + inject: false, + chunks: [huron.entry] + }; + const newConfig = config; + + // Write prototype template file for HTML webpack plugin + _fsExtra2.default.outputFileSync(_path2.default.join(cwd, huron.root, 'huron-assets/prototypeTemplate.hbs'), wrapperTemplate); + + huron.prototypes.forEach(prototype => { + const newPrototype = prototype; + let opts = {}; + + // Merge configured settings with default settings + if ('string' === typeof prototype) { + opts = Object.assign({}, defaultHTMLPluginOptions, { + title: prototype, + filename: `${prototype}.html` + }); + } else if ('object' === typeof prototype && {}.hasOwnProperty.call(prototype, 'title')) { + // Create filename based on configured title if not provided + if (!prototype.filename) { + newPrototype.filename = `${prototype.title}.html`; + } + + // Move css assets for this prototype, + // reset css option with new file paths + if (prototype.css) { + newPrototype.css = moveAdditionalAssets(prototype.css, 'css', huron); + } + + // Move js assets for this prototype, + // reset js option with new file paths + if (prototype.js) { + newPrototype.js = moveAdditionalAssets(prototype.js, 'js', huron); + } + + opts = Object.assign({}, defaultHTMLPluginOptions, newPrototype); + } + + // Move global css assets, + // reset css option with new file paths + if (huron.css.length) { + opts.css = opts.css.concat(moveAdditionalAssets(huron.css, 'css', huron)); + } + + // Move global js assets, + // reset js option with new file paths + if (huron.js.length) { + opts.js = opts.js.concat(moveAdditionalAssets(huron.js, 'js', huron)); + } + + // Push a new plugin for each configured prototype + if (Object.keys(opts).length) { + newConfig.plugins.push(new _htmlWebpackPlugin2.default(opts)); + } + }); + + return newConfig; +} + +/** + * Move relative (and local) js and css assets provided in huron options + * + * @param {array|string} assets - array of assets or single asset + * @param {string} subdir - subdirectory in huron root from which to load additional asset + * @param {object} huron - huron configuration object + * @return {array} assetResults - paths to js and css assets + */ +function moveAdditionalAssets(assets, subdir = '', huron) { + const currentAssets = [].concat(assets); + const assetResults = []; + + currentAssets.forEach(asset => { + const assetInfo = _path2.default.parse(asset); + const assetURL = _url2.default.parse(asset); + const sourcePath = _path2.default.join(cwd, asset); + const outputPath = _path2.default.resolve(cwd, huron.root, subdir, assetInfo.base); + const loadPath = _path2.default.join(subdir, assetInfo.base); + let contents = false; + + if (!_path2.default.isAbsolute(asset) && !assetURL.protocol) { + try { + contents = _fsExtra2.default.readFileSync(sourcePath); + } catch (e) { + console.warn(`could not read ${sourcePath}`); + } + + if (contents) { + _fsExtra2.default.outputFileSync(outputPath, contents); + assetResults.push(loadPath); + } + } else { + assetResults.push(asset); + } + }); + + return assetResults; +} /***/ }), /* 14 */ -/* no static exports found */ -/* all exports used */ -/*!*******************************!*\ - !*** ./src/cli/handleHTML.js ***! - \*******************************/ /***/ (function(module, exports, __webpack_require__) { "use strict"; -eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.updateHTML = updateHTML;\nexports.deleteHTML = deleteHTML;\nexports.updatePrototype = updatePrototype;\nexports.deletePrototype = deletePrototype;\n\nvar _path = __webpack_require__(/*! path */ 0);\n\nvar _path2 = _interopRequireDefault(_path);\n\nvar _fsExtra = __webpack_require__(/*! fs-extra */ 3);\n\nvar _fsExtra2 = _interopRequireDefault(_fsExtra);\n\nvar _utils = __webpack_require__(/*! ./utils */ 1);\n\nvar utils = _interopRequireWildcard(_utils);\n\nfunction _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n/**\n * Handle update of an HMTL template\n *\n * @function updateHTML\n * @param {string} filepath - filepath of changed file (comes from gaze)\n * @param {object} section - contains KSS section data\n * @param {object} store - memory store\n * @return {object} updated data store\n */\nfunction updateHTML(filepath, section, store) {\n const file = _path2.default.parse(filepath);\n const content = _fsExtra2.default.readFileSync(filepath, 'utf8');\n const newSection = section;\n\n if (content) {\n newSection.templatePath = utils.writeFile(section.referenceURI, 'template', filepath, content, store);\n newSection.templateContent = content;\n\n // Rewrite section data with template content\n newSection.sectionPath = utils.writeSectionData(store, newSection);\n\n return store.setIn(['sections', 'sectionsByPath', section.kssPath], newSection).setIn(['sections', 'sectionsByURI', section.referenceURI], newSection);\n }\n\n console.log(`File ${file.base} could not be read`);\n return store;\n}\n\n/**\n * Handle removal of an HMTL template\n *\n * @function deleteHTML\n * @param {string} filepath - filepath of changed file (comes from gaze)\n * @param {object} section - contains KSS section data\n * @param {object} store - memory store\n * @return {object} updated data store\n */\n/** @module cli/html-handler */\nfunction deleteHTML(filepath, section, store) {\n const newSection = section;\n\n utils.removeFile(newSection.referenceURI, 'template', filepath, store);\n\n delete newSection.templatePath;\n\n return store.setIn(['sections', 'sectionsByPath', section.kssPath], newSection).setIn(['sections', 'sectionsByURI', section.referenceURI], newSection);\n}\n\n/**\n * Handle update for a prototype file\n *\n * @function updatePrototype\n * @param {string} filepath - filepath of changed file (comes from gaze)\n * @param {object} store - memory store\n * @return {object} updated data store\n */\nfunction updatePrototype(filepath, store) {\n const file = _path2.default.parse(filepath);\n const content = _fsExtra2.default.readFileSync(filepath, 'utf8');\n\n if (content) {\n const requirePath = utils.writeFile(file.name, 'prototype', filepath, content, store);\n\n return store.setIn(['prototypes', file.name], requirePath);\n }\n\n console.log(`File ${file.base} could not be read`);\n return store;\n}\n\n/**\n * Handle removal of a prototype file\n *\n * @function deletePrototype\n * @param {string} filepath - filepath of changed file (comes from gaze)\n * @param {object} store - memory store\n * @return {object} updated data store\n */\nfunction deletePrototype(filepath, store) {\n const file = _path2.default.parse(filepath);\n const requirePath = utils.removeFile(file.name, 'prototype', filepath, store);\n\n return store.setIn(['prototypes', file.name], requirePath);\n}//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMTQuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vc3JjL2NsaS9oYW5kbGVIVE1MLmpzP2VhMjIiXSwic291cmNlc0NvbnRlbnQiOlsiLyoqIEBtb2R1bGUgY2xpL2h0bWwtaGFuZGxlciAqL1xuaW1wb3J0IHBhdGggZnJvbSAncGF0aCc7XG5pbXBvcnQgZnMgZnJvbSAnZnMtZXh0cmEnO1xuXG5pbXBvcnQgKiBhcyB1dGlscyBmcm9tICcuL3V0aWxzJztcblxuLyoqXG4gKiBIYW5kbGUgdXBkYXRlIG9mIGFuIEhNVEwgdGVtcGxhdGVcbiAqXG4gKiBAZnVuY3Rpb24gdXBkYXRlSFRNTFxuICogQHBhcmFtIHtzdHJpbmd9IGZpbGVwYXRoIC0gZmlsZXBhdGggb2YgY2hhbmdlZCBmaWxlIChjb21lcyBmcm9tIGdhemUpXG4gKiBAcGFyYW0ge29iamVjdH0gc2VjdGlvbiAtIGNvbnRhaW5zIEtTUyBzZWN0aW9uIGRhdGFcbiAqIEBwYXJhbSB7b2JqZWN0fSBzdG9yZSAtIG1lbW9yeSBzdG9yZVxuICogQHJldHVybiB7b2JqZWN0fSB1cGRhdGVkIGRhdGEgc3RvcmVcbiAqL1xuZXhwb3J0IGZ1bmN0aW9uIHVwZG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BO0FBQ0E7QUFDQTtBQUNBO0FBTUE7QUFJQSIsInNvdXJjZVJvb3QiOiIifQ=="); + + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.updateHTML = updateHTML; +exports.deleteHTML = deleteHTML; +exports.updatePrototype = updatePrototype; +exports.deletePrototype = deletePrototype; + +var _path = __webpack_require__(0); + +var _path2 = _interopRequireDefault(_path); + +var _fsExtra = __webpack_require__(3); + +var _fsExtra2 = _interopRequireDefault(_fsExtra); + +var _utils = __webpack_require__(1); + +var utils = _interopRequireWildcard(_utils); + +function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * Handle update of an HMTL template + * + * @function updateHTML + * @param {string} filepath - filepath of changed file (comes from gaze) + * @param {object} section - contains KSS section data + * @param {object} store - memory store + * @return {object} updated data store + */ +function updateHTML(filepath, section, store) { + const file = _path2.default.parse(filepath); + const content = _fsExtra2.default.readFileSync(filepath, 'utf8'); + const newSection = section; + + if (content) { + newSection.templatePath = utils.writeFile(section.referenceURI, 'template', filepath, content, store); + newSection.templateContent = content; + + // Rewrite section data with template content + newSection.sectionPath = utils.writeSectionData(store, newSection); + + return store.setIn(['sections', 'sectionsByPath', section.kssPath], newSection).setIn(['sections', 'sectionsByURI', section.referenceURI], newSection); + } + + console.log(`File ${file.base} could not be read`); + return store; +} + +/** + * Handle removal of an HMTL template + * + * @function deleteHTML + * @param {string} filepath - filepath of changed file (comes from gaze) + * @param {object} section - contains KSS section data + * @param {object} store - memory store + * @return {object} updated data store + */ +/** @module cli/html-handler */ +function deleteHTML(filepath, section, store) { + const newSection = section; + + utils.removeFile(newSection.referenceURI, 'template', filepath, store); + + delete newSection.templatePath; + + return store.setIn(['sections', 'sectionsByPath', section.kssPath], newSection).setIn(['sections', 'sectionsByURI', section.referenceURI], newSection); +} + +/** + * Handle update for a prototype file + * + * @function updatePrototype + * @param {string} filepath - filepath of changed file (comes from gaze) + * @param {object} store - memory store + * @return {object} updated data store + */ +function updatePrototype(filepath, store) { + const file = _path2.default.parse(filepath); + const content = _fsExtra2.default.readFileSync(filepath, 'utf8'); + + if (content) { + const requirePath = utils.writeFile(file.name, 'prototype', filepath, content, store); + + return store.setIn(['prototypes', file.name], requirePath); + } + + console.log(`File ${file.base} could not be read`); + return store; +} + +/** + * Handle removal of a prototype file + * + * @function deletePrototype + * @param {string} filepath - filepath of changed file (comes from gaze) + * @param {object} store - memory store + * @return {object} updated data store + */ +function deletePrototype(filepath, store) { + const file = _path2.default.parse(filepath); + const requirePath = utils.removeFile(file.name, 'prototype', filepath, store); + + return store.setIn(['prototypes', file.name], requirePath); +} /***/ }), /* 15 */ -/* no static exports found */ -/* all exports used */ -/*!******************************!*\ - !*** ./src/cli/handleKSS.js ***! - \******************************/ /***/ (function(module, exports, __webpack_require__) { "use strict"; -eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.updateKSS = updateKSS;\nexports.deleteKSS = deleteKSS;\n\nvar _path = __webpack_require__(/*! path */ 0);\n\nvar _path2 = _interopRequireDefault(_path);\n\nvar _fsExtra = __webpack_require__(/*! fs-extra */ 3);\n\nvar _fsExtra2 = _interopRequireDefault(_fsExtra);\n\nvar _kss = __webpack_require__(/*! kss */ 25);\n\nvar _chalk = __webpack_require__(/*! chalk */ 2);\n\nvar _chalk2 = _interopRequireDefault(_chalk);\n\nvar _utils = __webpack_require__(/*! ./utils */ 1);\n\nvar utils = _interopRequireWildcard(_utils);\n\nvar _handleTemplates = __webpack_require__(/*! ./handleTemplates */ 7);\n\nvar _requireTemplates = __webpack_require__(/*! ./requireTemplates */ 8);\n\nfunction _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n/**\n * Handle update of a KSS section\n *\n * @function updateKSS\n * @param {string} filepath - filepath of changed file (comes from gaze)\n * @param {object} store - memory store\n * @return {object} updated data store\n */\nfunction updateKSS(filepath, store) {\n const kssSource = _fsExtra2.default.readFileSync(filepath, 'utf8');\n const huron = store.get('config');\n const oldSection = utils.getSection(filepath, false, store) || {};\n const file = _path2.default.parse(filepath);\n let newStore = store;\n\n if (kssSource) {\n const styleguide = (0, _kss.parse)(kssSource, huron.get('kssOptions'));\n\n if (styleguide.data.sections.length) {\n const section = utils.normalizeSectionData(styleguide.data.sections[0]);\n\n if (section.reference && section.referenceURI) {\n // Update or add section data\n newStore = updateSectionData(filepath, section, oldSection, newStore);\n\n // Remove old section data if reference URI has changed\n if (oldSection && oldSection.referenceURI && oldSection.referenceURI !== section.referenceURI) {\n newStore = unsetSection(oldSection, file, newStore, false);\n }\n\n (0, _requireTemplates.writeStore)(newStore);\n console.log(_chalk2.default.green(`KSS source in ${filepath} changed or added`));\n return newStore;\n }\n\n console.log(_chalk2.default.magenta(`KSS section in ${filepath} is missing a section reference`));\n return newStore;\n }\n\n console.log(_chalk2.default.magenta(`No KSS found in ${filepath}`));\n return newStore;\n }\n\n if (oldSection) {\n newStore = deleteKSS(filepath, oldSection, newStore);\n }\n\n console.log(_chalk2.default.red(`${filepath} not found or empty`)); // eslint-disable-line no-console\n return newStore;\n}\n\n/**\n * Handle removal of a KSS section\n *\n * @function deleteKSS\n * @param {string} filepath - filepath of changed file (comes from gaze)\n * @param {object} section - KSS section data\n * @param {object} store - memory store\n * @return {object} updated data store\n */\n/** @module cli/kss-handler */\n\nfunction deleteKSS(filepath, section, store) {\n const file = _path2.default.parse(filepath);\n\n if (section.reference && section.referenceURI) {\n // Remove section data from memory store\n return unsetSection(section, file, store, true);\n }\n\n return store;\n}\n\n/**\n * Update the sections store with new data for a specific section\n *\n * @function updateSectionData\n * @param {object} section - contains updated section data\n * @param {string} kssPath - path to KSS section\n * @param {object} store - memory store\n * @return {object} updated data store\n */\nfunction updateSectionData(kssPath, section, oldSection, store) {\n const sectionFileInfo = _path2.default.parse(kssPath);\n const dataFilepath = _path2.default.join(sectionFileInfo.dir, `${sectionFileInfo.name}.json`);\n const isInline = null !== section.markup.match(/<\\/[^>]*>/);\n const newSort = sortSection(store.getIn(['sections', 'sorted']), section.reference, store.get('referenceDelimiter'));\n const newSection = Object.assign({}, oldSection, section);\n let newStore = store;\n\n // Required for reference from templates and data\n newSection.kssPath = kssPath;\n\n if (isInline) {\n // Set section value if inlineTempalte() returned a path\n newStore = updateInlineTemplate(kssPath, oldSection, newSection, newStore);\n } else {\n // Remove inline template, if it exists\n utils.removeFile(newSection.referenceURI, 'template', kssPath, store);\n // Update markup and data fields\n newStore = updateTemplateFields(sectionFileInfo, oldSection, newSection, newStore);\n }\n\n // Output section description\n newStore = updateDescription(kssPath, oldSection, newSection, newStore);\n\n // Output section data to a JSON file\n newSection.sectionPath = utils.writeSectionData(newStore, newSection, dataFilepath);\n\n // Update section sorting\n return newStore.setIn(['sections', 'sorted'], newSort).setIn(['sections', 'sectionsByPath', kssPath], newSection).setIn(['sections', 'sectionsByURI', section.referenceURI], newSection);\n}\n\n/**\n * Handle detection and output of inline templates, which is markup written\n * in the KSS documentation itself as opposed to an external file\n *\n * @function updateInlineTemplate\n * @param {string} oldSection - previous iteration of KSS data, if updated\n * @param {object} section - KSS section data\n * @return {object} updated data store with new template path info\n */\nfunction updateInlineTemplate(filepath, oldSection, section, store) {\n const newSection = section;\n const newStore = store;\n\n // If we have inline markup\n if (fieldShouldOutput(oldSection, section, 'markup')) {\n newSection.templatePath = utils.writeFile(section.referenceURI, 'template', filepath, section.markup, store);\n newSection.templateContent = section.markup;\n\n return newStore.setIn(['sections', 'sectionsByPath', filepath], newSection).setIn(['sections', 'sectionsByURI', section.referenceURI], newSection);\n }\n\n return newStore;\n}\n\n/**\n * Handle output of section description\n *\n * @function updateDescription\n * @param {string} oldSection - previous iteration of KSS data, if updated\n * @param {object} section - KSS section data\n * @return {object} updated data store with new descripton path info\n */\nfunction updateDescription(filepath, oldSection, section, store) {\n const newSection = section;\n const newStore = store;\n\n // If we don't have previous KSS or the KSS has been updated\n if (fieldShouldOutput(oldSection, section, 'description')) {\n // Write new description\n newSection.descriptionPath = utils.writeFile(section.referenceURI, 'description', filepath, section.description, store);\n\n return newStore.setIn(['sections', 'sectionsByPath', filepath], newSection).setIn(['sections', 'sectionsByURI', section.referenceURI], newSection);\n }\n\n return newStore;\n}\n\n/**\n * Handle Data and Markup fields\n *\n * @function updateTemplateFields\n * @param {string} file - File data for KSS file from path.parse()\n * @param {object} oldSection - outdated KSS data\n * @param {object} section - KSS section data\n * @param {object} store - memory store\n * @return {object} KSS section data with updated asset paths\n */\nfunction updateTemplateFields(file, oldSection, section, store) {\n const kssPath = _path2.default.format(file);\n const newSection = section;\n let filepath = '';\n let oldFilepath = '';\n let newStore = store;\n\n ['data', 'markup'].forEach(field => {\n if (newSection[field]) {\n if (oldSection[field]) {\n oldFilepath = _path2.default.join(file.dir, oldSection[field]);\n newStore = (0, _handleTemplates.deleteTemplate)(oldFilepath, oldSection, newStore);\n }\n\n filepath = _path2.default.join(file.dir, newSection[field]);\n newStore = (0, _handleTemplates.updateTemplate)(filepath, newSection, newStore);\n } else {\n delete newSection[field];\n newStore = newStore.setIn(['sections', 'sectionsByPath', kssPath], newSection).setIn(['sections', 'sectionsByURI', newSection.referenceURI], newSection);\n }\n });\n\n return newStore;\n}\n\n/**\n * Remove a section from the memory store\n *\n * @function unsetSection\n * @param {object} section - contains updated section data\n * @param {string} file - file object from path.parse()\n * @param {object} store - memory store\n * @param {bool} removed - has the file been removed or just the section information changed?\n * @return {object} updated data store with new descripton path info\n */\nfunction unsetSection(section, file, store, removed) {\n const sorted = store.getIn(['sections', 'sorted']);\n const kssPath = _path2.default.format(file);\n const dataFilepath = _path2.default.join(file.dir, `${file.name}.json`);\n const isInline = section.markup && null !== section.markup.match(/<\\/[^>]*>/);\n const newSort = unsortSection(sorted, section.reference, store.get('referenceDelimiter'));\n let newStore = store;\n\n // Remove old section data\n utils.removeFile(section.referenceURI, 'section', dataFilepath, newStore);\n\n // Remove associated inline template\n if (isInline) {\n utils.removeFile(section.referenceURI, 'template', kssPath, newStore);\n }\n\n // Remove description template\n utils.removeFile(section.referenceURI, 'description', kssPath, newStore);\n\n // Remove data from sectionsByPath if file has been removed\n if (removed) {\n newStore = newStore.deleteIn(['sections', 'sectionsByPath', kssPath]);\n }\n\n return newStore.deleteIn(['sections', 'sectionsByURI', section.referenceURI]).setIn(['sections', 'sorted'], newSort);\n}\n\n/**\n * Sort sections and subsections\n *\n * @function sortSection\n * @param {object} sorted - currently sorted sections\n * @param {string} reference - reference URI of section to sort\n * @return {object} updated data store with new descripton path info\n */\nfunction sortSection(sorted, reference, delimiter) {\n const parts = reference.split(delimiter);\n const newSort = sorted[parts[0]] || {};\n const newSorted = sorted;\n\n if (1 < parts.length) {\n const newParts = parts.filter((part, idx) => 0 !== idx);\n newSorted[parts[0]] = sortSection(newSort, newParts.join(delimiter), delimiter);\n } else {\n newSorted[parts[0]] = newSort;\n }\n\n return newSorted;\n}\n\n/**\n * Remove a section from the sorted sections\n *\n * @function unsortSection\n * @param {object} sorted - currently sorted sections\n * @param {string} reference - reference URI of section to sort\n * @return {object} updated data store with new descripton path info\n */\nfunction unsortSection(sorted, reference, delimiter) {\n const parts = reference.split(delimiter);\n const subsections = Object.keys(sorted[parts[0]]);\n const newSorted = sorted;\n\n if (subsections.length) {\n if (1 < parts.length) {\n const newParts = parts.filter((part, idx) => 0 !== idx);\n newSorted[parts[0]] = unsortSection(newSorted[parts[0]], newParts.join(delimiter), delimiter);\n }\n } else {\n delete newSorted[parts[0]];\n }\n\n return newSorted;\n}\n\n/**\n * Compare a KSS field between old and new KSS data to see if we need to output\n * a new module for that field\n *\n * @function fieldShouldOutput\n * @param {object} oldSection - currently sorted sections\n * @param {object} newSection - reference URI of section to sort\n * @param {string} field - KSS field to check\n * @return {bool} output a new module for the KSS field\n */\nfunction fieldShouldOutput(oldSection, newSection, field) {\n return oldSection && (oldSection[field] !== newSection[field] || oldSection.referenceURI !== newSection.referenceURI) || !oldSection;\n}//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMTUuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vc3JjL2NsaS9oYW5kbGVLU1MuanM/MzJmZCJdLCJzb3VyY2VzQ29udGVudCI6WyIvKiogQG1vZHVsZSBjbGkva3NzLWhhbmRsZXIgKi9cblxuaW1wb3J0IHBhdGggZnJvbSAncGF0aCc7XG5pbXBvcnQgZnMgZnJvbSAnZnMtZXh0cmEnO1xuaW1wb3J0IHsgcGFyc2UgfSBmcm9tICdrc3MnO1xuaW1wb3J0IGNoYWxrIGZyb20gJ2NoYWxrJztcblxuaW1wb3J0ICogYXMgdXRpbHMgZnJvbSAnLi91dGlscyc7XG5pbXBvcnQgeyB1cGRhdGVUZW1wbGF0ZSwgZGVsZXRlVGVtcGxhdGUgfSBmcm9tICcuL2hhbmRsZVRlbXBsYXRlcyc7XG5pbXBvcnQgeyB3cml0ZVN0b3JlIH0gZnJvbSAnLi9yZXF1aXJlVGVtcGxhdGVzJztcblxuLyoqXG4gKiBIYW5kbGUgdXBkYXRlIG9mIGEgS1NTIHNlY3Rpb25cbiAqXG4gKiBAZnVuY3Rpb24gdXBkYXRlS1NTXG4gKiBAcGFyYW0ge3N0cmluZ30gZmlsZXBhdGggLSBmaWxlcGF0aCBvZiBjaGFuZ2VkIGZpbGUgKGNvbWVzIGZyb20gZ2F6ZSlcbiAqIEBwYXJhbSB7b2JqZWN0fSBzdG9yZSAtIG1lbW9yeSBzdG9yZVxuICogQHJldHVybiB7b2JqZWN0fSB1cGRhdGVkIGRhdGEgc3RvcmVcbiAqL1xuZXhwb3J0I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= deleteKSS; + +var _path = __webpack_require__(0); + +var _path2 = _interopRequireDefault(_path); + +var _fsExtra = __webpack_require__(3); + +var _fsExtra2 = _interopRequireDefault(_fsExtra); + +var _kss = __webpack_require__(25); + +var _chalk = __webpack_require__(2); + +var _chalk2 = _interopRequireDefault(_chalk); + +var _utils = __webpack_require__(1); + +var utils = _interopRequireWildcard(_utils); + +var _handleTemplates = __webpack_require__(7); + +var _requireTemplates = __webpack_require__(8); + +function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * Handle update of a KSS section + * + * @function updateKSS + * @param {string} filepath - filepath of changed file (comes from gaze) + * @param {object} store - memory store + * @return {object} updated data store + */ +function updateKSS(filepath, store) { + const kssSource = _fsExtra2.default.readFileSync(filepath, 'utf8'); + const huron = store.get('config'); + const oldSection = utils.getSection(filepath, false, store) || {}; + const file = _path2.default.parse(filepath); + let newStore = store; + + if (kssSource) { + const styleguide = (0, _kss.parse)(kssSource, huron.get('kssOptions')); + + if (styleguide.data.sections.length) { + const section = utils.normalizeSectionData(styleguide.data.sections[0]); + + if (section.reference && section.referenceURI) { + // Update or add section data + newStore = updateSectionData(filepath, section, oldSection, newStore); + + // Remove old section data if reference URI has changed + if (oldSection && oldSection.referenceURI && oldSection.referenceURI !== section.referenceURI) { + newStore = unsetSection(oldSection, file, newStore, false); + } + + (0, _requireTemplates.writeStore)(newStore); + console.log(_chalk2.default.green(`KSS source in ${filepath} changed or added`)); + return newStore; + } + + console.log(_chalk2.default.magenta(`KSS section in ${filepath} is missing a section reference`)); + return newStore; + } + + console.log(_chalk2.default.magenta(`No KSS found in ${filepath}`)); + return newStore; + } + + if (oldSection) { + newStore = deleteKSS(filepath, oldSection, newStore); + } + + console.log(_chalk2.default.red(`${filepath} not found or empty`)); // eslint-disable-line no-console + return newStore; +} + +/** + * Handle removal of a KSS section + * + * @function deleteKSS + * @param {string} filepath - filepath of changed file (comes from gaze) + * @param {object} section - KSS section data + * @param {object} store - memory store + * @return {object} updated data store + */ +/** @module cli/kss-handler */ + +function deleteKSS(filepath, section, store) { + const file = _path2.default.parse(filepath); + + if (section.reference && section.referenceURI) { + // Remove section data from memory store + return unsetSection(section, file, store, true); + } + + return store; +} + +/** + * Update the sections store with new data for a specific section + * + * @function updateSectionData + * @param {object} section - contains updated section data + * @param {string} kssPath - path to KSS section + * @param {object} store - memory store + * @return {object} updated data store + */ +function updateSectionData(kssPath, section, oldSection, store) { + const sectionFileInfo = _path2.default.parse(kssPath); + const dataFilepath = _path2.default.join(sectionFileInfo.dir, `${sectionFileInfo.name}.json`); + const isInline = null !== section.markup.match(/<\/[^>]*>/); + const newSort = sortSection(store.getIn(['sections', 'sorted']), section.reference, store.get('referenceDelimiter')); + const newSection = Object.assign({}, oldSection, section); + let newStore = store; + + // Required for reference from templates and data + newSection.kssPath = kssPath; + + if (isInline) { + // Set section value if inlineTempalte() returned a path + newStore = updateInlineTemplate(kssPath, oldSection, newSection, newStore); + } else { + // Remove inline template, if it exists + utils.removeFile(newSection.referenceURI, 'template', kssPath, store); + // Update markup and data fields + newStore = updateTemplateFields(sectionFileInfo, oldSection, newSection, newStore); + } + + // Output section description + newStore = updateDescription(kssPath, oldSection, newSection, newStore); + + // Output section data to a JSON file + newSection.sectionPath = utils.writeSectionData(newStore, newSection, dataFilepath); + + // Update section sorting + return newStore.setIn(['sections', 'sorted'], newSort).setIn(['sections', 'sectionsByPath', kssPath], newSection).setIn(['sections', 'sectionsByURI', section.referenceURI], newSection); +} + +/** + * Handle detection and output of inline templates, which is markup written + * in the KSS documentation itself as opposed to an external file + * + * @function updateInlineTemplate + * @param {string} oldSection - previous iteration of KSS data, if updated + * @param {object} section - KSS section data + * @return {object} updated data store with new template path info + */ +function updateInlineTemplate(filepath, oldSection, section, store) { + const newSection = section; + const newStore = store; + + // If we have inline markup + if (fieldShouldOutput(oldSection, section, 'markup')) { + newSection.templatePath = utils.writeFile(section.referenceURI, 'template', filepath, section.markup, store); + newSection.templateContent = section.markup; + + return newStore.setIn(['sections', 'sectionsByPath', filepath], newSection).setIn(['sections', 'sectionsByURI', section.referenceURI], newSection); + } + + return newStore; +} + +/** + * Handle output of section description + * + * @function updateDescription + * @param {string} oldSection - previous iteration of KSS data, if updated + * @param {object} section - KSS section data + * @return {object} updated data store with new descripton path info + */ +function updateDescription(filepath, oldSection, section, store) { + const newSection = section; + const newStore = store; + + // If we don't have previous KSS or the KSS has been updated + if (fieldShouldOutput(oldSection, section, 'description')) { + // Write new description + newSection.descriptionPath = utils.writeFile(section.referenceURI, 'description', filepath, section.description, store); + + return newStore.setIn(['sections', 'sectionsByPath', filepath], newSection).setIn(['sections', 'sectionsByURI', section.referenceURI], newSection); + } + + return newStore; +} + +/** + * Handle Data and Markup fields + * + * @function updateTemplateFields + * @param {string} file - File data for KSS file from path.parse() + * @param {object} oldSection - outdated KSS data + * @param {object} section - KSS section data + * @param {object} store - memory store + * @return {object} KSS section data with updated asset paths + */ +function updateTemplateFields(file, oldSection, section, store) { + const kssPath = _path2.default.format(file); + const newSection = section; + let filepath = ''; + let oldFilepath = ''; + let newStore = store; + + ['data', 'markup'].forEach(field => { + if (newSection[field]) { + if (oldSection[field]) { + oldFilepath = _path2.default.join(file.dir, oldSection[field]); + newStore = (0, _handleTemplates.deleteTemplate)(oldFilepath, oldSection, newStore); + } + + filepath = _path2.default.join(file.dir, newSection[field]); + newStore = (0, _handleTemplates.updateTemplate)(filepath, newSection, newStore); + } else { + delete newSection[field]; + newStore = newStore.setIn(['sections', 'sectionsByPath', kssPath], newSection).setIn(['sections', 'sectionsByURI', newSection.referenceURI], newSection); + } + }); + + return newStore; +} + +/** + * Remove a section from the memory store + * + * @function unsetSection + * @param {object} section - contains updated section data + * @param {string} file - file object from path.parse() + * @param {object} store - memory store + * @param {bool} removed - has the file been removed or just the section information changed? + * @return {object} updated data store with new descripton path info + */ +function unsetSection(section, file, store, removed) { + const sorted = store.getIn(['sections', 'sorted']); + const kssPath = _path2.default.format(file); + const dataFilepath = _path2.default.join(file.dir, `${file.name}.json`); + const isInline = section.markup && null !== section.markup.match(/<\/[^>]*>/); + const newSort = unsortSection(sorted, section.reference, store.get('referenceDelimiter')); + let newStore = store; + + // Remove old section data + utils.removeFile(section.referenceURI, 'section', dataFilepath, newStore); + + // Remove associated inline template + if (isInline) { + utils.removeFile(section.referenceURI, 'template', kssPath, newStore); + } + + // Remove description template + utils.removeFile(section.referenceURI, 'description', kssPath, newStore); + + // Remove data from sectionsByPath if file has been removed + if (removed) { + newStore = newStore.deleteIn(['sections', 'sectionsByPath', kssPath]); + } + + return newStore.deleteIn(['sections', 'sectionsByURI', section.referenceURI]).setIn(['sections', 'sorted'], newSort); +} + +/** + * Sort sections and subsections + * + * @function sortSection + * @param {object} sorted - currently sorted sections + * @param {string} reference - reference URI of section to sort + * @return {object} updated data store with new descripton path info + */ +function sortSection(sorted, reference, delimiter) { + const parts = reference.split(delimiter); + const newSort = sorted[parts[0]] || {}; + const newSorted = sorted; + + if (1 < parts.length) { + const newParts = parts.filter((part, idx) => 0 !== idx); + newSorted[parts[0]] = sortSection(newSort, newParts.join(delimiter), delimiter); + } else { + newSorted[parts[0]] = newSort; + } + + return newSorted; +} + +/** + * Remove a section from the sorted sections + * + * @function unsortSection + * @param {object} sorted - currently sorted sections + * @param {string} reference - reference URI of section to sort + * @return {object} updated data store with new descripton path info + */ +function unsortSection(sorted, reference, delimiter) { + const parts = reference.split(delimiter); + const subsections = Object.keys(sorted[parts[0]]); + const newSorted = sorted; + + if (subsections.length) { + if (1 < parts.length) { + const newParts = parts.filter((part, idx) => 0 !== idx); + newSorted[parts[0]] = unsortSection(newSorted[parts[0]], newParts.join(delimiter), delimiter); + } + } else { + delete newSorted[parts[0]]; + } + + return newSorted; +} + +/** + * Compare a KSS field between old and new KSS data to see if we need to output + * a new module for that field + * + * @function fieldShouldOutput + * @param {object} oldSection - currently sorted sections + * @param {object} newSection - reference URI of section to sort + * @param {string} field - KSS field to check + * @return {bool} output a new module for the KSS field + */ +function fieldShouldOutput(oldSection, newSection, field) { + return oldSection && (oldSection[field] !== newSection[field] || oldSection.referenceURI !== newSection.referenceURI) || !oldSection; +} /***/ }), /* 16 */ -/* no static exports found */ -/* all exports used */ -/*!************************************!*\ - !*** ./src/cli/requireExternal.js ***! - \************************************/ /***/ (function(module, exports) { -eval("\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = requireExternal;\n// Necessary to remove require statement from Webpack processing preserve it in output\n/* eslint-disable import/no-dynamic-require, global-require */\nfunction requireExternal(requirePath) {\n return require(requirePath);\n}\n/* eslint-enable *///# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMTYuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vc3JjL2NsaS9yZXF1aXJlRXh0ZXJuYWwuanM/OWM3MCJdLCJzb3VyY2VzQ29udGVudCI6WyIvLyBOZWNlc3NhcnkgdG8gcmVtb3ZlIHJlcXVpcmUgc3RhdGVtZW50IGZyb20gV2VicGFjayBwcm9jZXNzaW5nIHByZXNlcnZlIGl0IGluIG91dHB1dFxuLyogZXNsaW50LWRpc2FibGUgaW1wb3J0L25vLWR5bmFtaWMtcmVxdWlyZSwgZ2xvYmFsLXJlcXVpcmUgKi9cbmV4cG9ydCBkZWZhdWx0IGZ1bmN0aW9uIHJlcXVpcmVFeHRlcm5hbChyZXF1aXJlUGF0aCkge1xuICByZXR1cm4gcmVxdWlyZShyZXF1aXJlUGF0aCk7XG59XG4vKiBlc2xpbnQtZW5hYmxlICovXG5cblxuXG4vLyBXRUJQQUNLIEZPT1RFUiAvL1xuLy8gc3JjL2NsaS9yZXF1aXJlRXh0ZXJuYWwuanMiXSwibWFwcGluZ3MiOiI7Ozs7O0FBRUE7QUFGQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0EiLCJzb3VyY2VSb290IjoiIn0="); +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = requireExternal; +// Necessary to remove require statement from Webpack processing preserve it in output +/* eslint-disable import/no-dynamic-require, global-require */ +function requireExternal(requirePath) { + return require(requirePath); +} +/* eslint-enable */ /***/ }), /* 17 */ -/* no static exports found */ -/* all exports used */ -/*!***************************!*\ - !*** ./src/cli/server.js ***! - \***************************/ /***/ (function(module, exports, __webpack_require__) { "use strict"; -eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = startWebpack;\n\nvar _webpack = __webpack_require__(/*! webpack */ 5);\n\nvar _webpack2 = _interopRequireDefault(_webpack);\n\nvar _webpackDevServer = __webpack_require__(/*! webpack-dev-server */ 29);\n\nvar _webpackDevServer2 = _interopRequireDefault(_webpackDevServer);\n\nvar _chalk = __webpack_require__(/*! chalk */ 2);\n\nvar _chalk2 = _interopRequireDefault(_chalk);\n\nvar _opn = __webpack_require__(/*! opn */ 27);\n\nvar _opn2 = _interopRequireDefault(_opn);\n\nvar _devServer = __webpack_require__(/*! ../../config/devServer.config */ 10);\n\nvar _devServer2 = _interopRequireDefault(_devServer);\n\nvar _parseArgs = __webpack_require__(/*! ./parseArgs */ 4);\n\nvar _parseArgs2 = _interopRequireDefault(_parseArgs);\n\nvar _utils = __webpack_require__(/*! ./utils */ 1);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n/**\n * Spin up webpack-dev-server or, if production flag is set, run webpack a single time\n *\n * @function startWebpack\n * @param {object} config - webpack configuration, preprocessed by {@link module:cli/generate-config generateConfig}\n * @see {@link module:cli/generate-config generateConfig}\n */\nfunction startWebpack(config) {\n const huron = config.huron;\n const webpackConfig = config.webpack;\n const compiler = (0, _webpack2.default)(webpackConfig);\n\n if (_parseArgs2.default.progress) {\n compiler.apply(new _webpack2.default.ProgressPlugin((percentage, msg) => {\n console.log(`${percentage * 100}% `, msg);\n }));\n }\n\n if (_parseArgs2.default.production) {\n compiler.run((err, stats) => {\n const info = stats.toJson();\n\n if (err) {\n console.log(err);\n }\n\n if (stats.hasErrors()) {\n console.error(_chalk2.default.red('Webpack encountered errors during compile: ', info.errors));\n }\n\n if (stats.hasWarnings()) {\n console.error(_chalk2.default.yellow('Webpack encountered warnings during compile: ', info.warnings));\n }\n });\n } else {\n const server = new _webpackDevServer2.default(compiler, (0, _devServer2.default)(huron));\n const prototypeName = huron.prototypes[0].title || huron.prototypes[0];\n\n server.listen(huron.port, 'localhost', err => {\n if (err) {\n return console.log(err);\n }\n\n console.log(`Listening at http://localhost:${huron.port}/`);\n (0, _opn2.default)(`http://localhost:${huron.port}/${(0, _utils.removeTrailingSlash)(huron.root)}/${prototypeName}.html`);\n return true;\n });\n }\n} /** @module cli/webpack-server *///# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMTcuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vc3JjL2NsaS9zZXJ2ZXIuanM/ODJlMSJdLCJzb3VyY2VzQ29udGVudCI6WyIvKiogQG1vZHVsZSBjbGkvd2VicGFjay1zZXJ2ZXIgKi9cbmltcG9ydCB3ZWJwYWNrIGZyb20gJ3dlYnBhY2snO1xuaW1wb3J0IFdlYnBhY2tEZXZTZXJ2ZXIgZnJvbSAnd2VicGFjay1kZXYtc2VydmVyJztcbmltcG9ydCBjaGFsayBmcm9tICdjaGFsayc7XG5pbXBvcnQgb3BlbiBmcm9tICdvcG4nO1xuXG5pbXBvcnQgY3JlYXRlRGV2U2VydmVyQ29uZmlnIGZyb20gJy4uLy4uL2NvbmZpZy9kZXZTZXJ2ZXIuY29uZmlnJztcbmltcG9ydCBwcm9ncmFtIGZyb20gJy4vcGFyc2VBcmdzJztcbmltcG9ydCB7IHJlbW92ZVRyYWlsaW5nU2xhc2ggfSBmcm9tICcuL3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G9zdDoke2h1cm9uLnBvcnR9LyR7XG4gICAgICAgICAgcmVtb3ZlVHJhaWxpbmdTbGFzaChodXJvbi5yb290KVxuICAgICAgICB9LyR7cHJvdG90eXBlTmFtZX0uaHRtbGApO1xuICAgICAgICByZXR1cm4gdHJ1ZTtcbiAgICAgIH1cbiAgICApO1xuICB9XG59XG5cblxuXG4vLyBXRUJQQUNLIEZPT1RFUiAvL1xuLy8gc3JjL2NsaS9zZXJ2ZXIuanMiXSwibWFwcGluZ3MiOiI7Ozs7O0FBaUJBO0FBQ0E7QUFqQkE7QUFDQTs7O0FBQUE7QUFDQTs7O0FBQUE7QUFDQTs7O0FBQUE7QUFDQTs7O0FBQ0E7QUFDQTs7O0FBQUE7QUFDQTs7O0FBQUE7QUFDQTs7O0FBQ0E7Ozs7Ozs7QUFPQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUdBO0FBQ0E7QUFHQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFNQTtBQUNBO0FBQ0E7QUFDQTtBQUtBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBSUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBR0E7QUFDQTtBQUVBO0FBQ0EiLCJzb3VyY2VSb290IjoiIn0="); + + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = startWebpack; + +var _webpack = __webpack_require__(5); + +var _webpack2 = _interopRequireDefault(_webpack); + +var _webpackDevServer = __webpack_require__(29); + +var _webpackDevServer2 = _interopRequireDefault(_webpackDevServer); + +var _chalk = __webpack_require__(2); + +var _chalk2 = _interopRequireDefault(_chalk); + +var _opn = __webpack_require__(27); + +var _opn2 = _interopRequireDefault(_opn); + +var _devServer = __webpack_require__(10); + +var _devServer2 = _interopRequireDefault(_devServer); + +var _parseArgs = __webpack_require__(4); + +var _parseArgs2 = _interopRequireDefault(_parseArgs); + +var _utils = __webpack_require__(1); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * Spin up webpack-dev-server or, if production flag is set, run webpack a single time + * + * @function startWebpack + * @param {object} config - webpack configuration, preprocessed by {@link module:cli/generate-config generateConfig} + * @see {@link module:cli/generate-config generateConfig} + */ +function startWebpack(config) { + const huron = config.huron; + const webpackConfig = config.webpack; + const compiler = (0, _webpack2.default)(webpackConfig); + + if (_parseArgs2.default.progress) { + compiler.apply(new _webpack2.default.ProgressPlugin((percentage, msg) => { + console.log(`${percentage * 100}% `, msg); + })); + } + + if (_parseArgs2.default.production) { + compiler.run((err, stats) => { + const info = stats.toJson(); + + if (err) { + console.log(err); + } + + if (stats.hasErrors()) { + console.error(_chalk2.default.red('Webpack encountered errors during compile: ', info.errors)); + } + + if (stats.hasWarnings()) { + console.error(_chalk2.default.yellow('Webpack encountered warnings during compile: ', info.warnings)); + } + }); + } else { + const server = new _webpackDevServer2.default(compiler, (0, _devServer2.default)(huron)); + const prototypeName = huron.prototypes[0].title || huron.prototypes[0]; + + server.listen(huron.port, 'localhost', err => { + if (err) { + return console.log(err); + } + + console.log(`Listening at http://localhost:${huron.port}/`); + (0, _opn2.default)(`http://localhost:${huron.port}/${(0, _utils.removeTrailingSlash)(huron.root)}/${prototypeName}.html`); + return true; + }); + } +} /** @module cli/webpack-server */ /***/ }), /* 18 */ -/* no static exports found */ -/* all exports used */ -/*!*******************************************!*\ - !*** ./src/defaultConfig/huron.config.js ***! - \*******************************************/ /***/ (function(module, exports, __webpack_require__) { "use strict"; -eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _path = __webpack_require__(/*! path */ 0);\n\nvar _path2 = _interopRequireDefault(_path);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nexports.default = {\n css: [],\n entry: 'huron',\n js: [],\n kss: 'css/',\n kssExtension: '.css',\n kssOptions: {\n multiline: true,\n markdown: true,\n custom: ['data']\n },\n output: 'partials',\n port: 8080,\n prototypes: ['index'],\n root: 'dist/',\n sectionTemplate: _path2.default.join(__dirname, '../../templates/section.hbs'),\n classNames: false,\n templates: {\n rule: {\n test: /\\.(hbs|handlebars)$/,\n use: 'handlebars-loader'\n },\n extension: '.hbs'\n },\n window: {}\n};//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMTguanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vc3JjL2RlZmF1bHRDb25maWcvaHVyb24uY29uZmlnLmpzP2I1MjYiXSwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHBhdGggZnJvbSAncGF0aCc7XG5cbmV4cG9ydCBkZWZhdWx0IHtcbiAgY3NzOiBbXSxcbiAgZW50cnk6ICdodXJvbicsXG4gIGpzOiBbXSxcbiAga3NzOiAnY3NzLycsXG4gIGtzc0V4dGVuc2lvbjogJy5jc3MnLFxuICBrc3NPcHRpb25zOiB7XG4gICAgbXVsdGlsaW5lOiB0cnVlLFxuICAgIG1hcmtkb3duOiB0cnVlLFxuICAgIGN1c3RvbTogWydkYXRhJ10sXG4gIH0sXG4gIG91dHB1dDogJ3BhcnRpYWxzJyxcbiAgcG9ydDogODA4MCxcbiAgcHJvdG90eXBlczogWydpbmRleCddLFxuICByb290OiAnZGlzdC8nLFxuICBzZWN0aW9uVGVtcGxhdGU6IHBhdGguam9pbihfX2Rpcm5hbWUsICcuLi8uLi90ZW1wbGF0ZXMvc2VjdGlvbi5oYnMnKSxcbiAgY2xhc3NOYW1lczogZmFsc2UsXG4gIHRlbXBsYXRlczoge1xuICAgIHJ1bGU6IHtcbiAgICAgIHRlc3Q6IC9cXC4oaGJzfGhhbmRsZWJhcnMpJC8sXG4gICAgICB1c2U6ICdoYW5kbGViYXJzLWxvYWRlcicsXG4gICAgfSxcbiAgICBleHRlbnNpb246ICcuaGJzJyxcbiAgfSxcbiAgd2luZG93OiB7fSxcbn07XG5cblxuXG4vLyBXRUJQQUNLIEZPT1RFUiAvL1xuLy8gc3JjL2RlZmF1bHRDb25maWcvaHVyb24uY29uZmlnLmpzIl0sIm1hcHBpbmdzIjoiOzs7Ozs7QUFBQTtBQUNBOzs7OztBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBSEE7QUFLQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUZBO0FBSUE7QUFMQTtBQU9BO0FBeEJBIiwic291cmNlUm9vdCI6IiJ9"); + + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _path = __webpack_require__(0); + +var _path2 = _interopRequireDefault(_path); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +exports.default = { + css: [], + entry: 'huron', + js: [], + kss: 'css/', + kssExtension: '.css', + kssOptions: { + multiline: true, + markdown: true, + custom: ['data'] + }, + output: 'partials', + port: 8080, + prototypes: ['index'], + root: 'dist/', + sectionTemplate: _path2.default.join(__dirname, '../../templates/section.hbs'), + classNames: false, + templates: { + rule: { + test: /\.(hbs|handlebars)$/, + use: 'handlebars-loader' + }, + extension: '.hbs' + }, + window: {} +}; /***/ }), /* 19 */ -/* no static exports found */ -/* all exports used */ -/*!*********************************************!*\ - !*** ./src/defaultConfig/webpack.config.js ***! - \*********************************************/ /***/ (function(module, exports, __webpack_require__) { "use strict"; -eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _webpack = __webpack_require__(/*! webpack */ 5);\n\nvar _webpack2 = _interopRequireDefault(_webpack);\n\nvar _path = __webpack_require__(/*! path */ 0);\n\nvar _path2 = _interopRequireDefault(_path);\n\nvar _parseArgs = __webpack_require__(/*! ../cli/parseArgs */ 4);\n\nvar _parseArgs2 = _interopRequireDefault(_parseArgs);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nexports.default = huron => {\n const cwd = process.cwd();\n\n return {\n entry: {},\n output: {\n path: _path2.default.join(cwd, huron.root),\n publicPath: _parseArgs2.default.production ? '' : `/${huron.root}`,\n filename: '[name].js',\n chunkFilename: '[name].chunk.min.js'\n },\n plugins: [new _webpack2.default.HotModuleReplacementPlugin(), new _webpack2.default.NamedModulesPlugin()],\n resolve: {\n modulesDirectories: [_path2.default.resolve(__dirname, '../src/js')]\n },\n resolveLoader: {\n modulesDirectories: ['web_loaders', 'web_modules', 'node_loaders', 'node_modules', _path2.default.resolve(__dirname, '../node_modules')]\n },\n module: {\n rules: [{\n test: /\\.html$/,\n include: [_path2.default.join(cwd, huron.root, huron.output)],\n use: 'html-loader'\n }, {\n test: /\\.(hbs|handlebars)$/,\n include: [_path2.default.join(cwd, huron.root, 'huron-assets')],\n use: {\n loader: 'handlebars-loader',\n options: {\n helperDirs: [_path2.default.join(__dirname, '../../', 'templates/handlebarsHelpers')]\n }\n }\n }]\n }\n };\n};//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMTkuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vc3JjL2RlZmF1bHRDb25maWcvd2VicGFjay5jb25maWcuanM/M2Q3YyJdLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgd2VicGFjayBmcm9tICd3ZWJwYWNrJztcbmltcG9ydCBwYXRoIGZyb20gJ3BhdGgnO1xuXG5pbXBvcnQgcHJvZ3JhbSBmcm9tICcuLi9jbGkvcGFyc2VBcmdzJztcblxuZXhwb3J0IGRlZmF1bHQgKGh1cm9uKSA9PiB7XG4gIGNvbnN0IGN3ZCA9IHByb2Nlc3MuY3dkKCk7XG5cbiAgcmV0dXJuIHtcbiAgICBlbnRyeToge30sXG4gICAgb3V0cHV0OiB7XG4gICAgICBwYXRoOiBwYXRoLmpvaW4oY3dkLCBodXJvbi5yb290KSxcbiAgICAgIH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HVkZTogW3BhdGguam9pbihjd2QsIGh1cm9uLnJvb3QsICdodXJvbi1hc3NldHMnKV0sXG4gICAgICAgICAgdXNlOiB7XG4gICAgICAgICAgICBsb2FkZXI6ICdoYW5kbGViYXJzLWxvYWRlcicsXG4gICAgICAgICAgICBvcHRpb25zOiB7XG4gICAgICAgICAgICAgIGhlbHBlckRpcnM6IFtwYXRoLmpvaW4oXG4gICAgICAgICAgICAgICAgX19kaXJuYW1lLFxuICAgICAgICAgICAgICAgICcuLi8uLi8nLFxuICAgICAgICAgICAgICAgICd0ZW1wbGF0ZXMvaGFuZGxlYmFyc0hlbHBlcnMnXG4gICAgICAgICAgICAgICldLFxuICAgICAgICAgICAgfSxcbiAgICAgICAgICB9LFxuICAgICAgICB9LFxuICAgICAgXSxcbiAgICB9LFxuICB9O1xufTtcblxuXG5cbi8vIFdFQlBBQ0sgRk9PVEVSIC8vXG4vLyBzcmMvZGVmYXVsdENvbmZpZy93ZWJwYWNrLmNvbmZpZy5qcyJdLCJtYXBwaW5ncyI6Ijs7Ozs7O0FBQUE7QUFDQTs7O0FBQUE7QUFDQTs7O0FBQ0E7QUFDQTs7Ozs7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBRUE7QUFDQTtBQUxBO0FBT0E7QUFJQTtBQUNBO0FBREE7QUFLQTtBQUNBO0FBREE7QUFTQTtBQUNBO0FBRUE7QUFDQTtBQUNBO0FBSEE7QUFNQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFEQTtBQUZBO0FBSEE7QUFQQTtBQTNCQTtBQW1EQSIsInNvdXJjZVJvb3QiOiIifQ=="); + + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _webpack = __webpack_require__(5); + +var _webpack2 = _interopRequireDefault(_webpack); + +var _path = __webpack_require__(0); + +var _path2 = _interopRequireDefault(_path); + +var _parseArgs = __webpack_require__(4); + +var _parseArgs2 = _interopRequireDefault(_parseArgs); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +exports.default = huron => { + const cwd = process.cwd(); + + return { + entry: {}, + output: { + path: _path2.default.join(cwd, huron.root), + publicPath: _parseArgs2.default.production ? '' : `/${huron.root}`, + filename: '[name].js', + chunkFilename: '[name].chunk.min.js' + }, + plugins: [new _webpack2.default.HotModuleReplacementPlugin(), new _webpack2.default.NamedModulesPlugin()], + resolve: { + modulesDirectories: [_path2.default.resolve(__dirname, '../src/js')] + }, + resolveLoader: { + modulesDirectories: ['web_loaders', 'web_modules', 'node_loaders', 'node_modules', _path2.default.resolve(__dirname, '../node_modules')] + }, + module: { + rules: [{ + test: /\.html$/, + include: [_path2.default.join(cwd, huron.root, huron.output)], + use: 'html-loader' + }, { + test: /\.(hbs|handlebars)$/, + include: [_path2.default.join(cwd, huron.root, 'huron-assets')], + use: { + loader: 'handlebars-loader', + options: { + helperDirs: [_path2.default.join(__dirname, '../../', 'templates/handlebarsHelpers')] + } + } + }] + } + }; +}; /***/ }), /* 20 */ -/* no static exports found */ -/* all exports used */ -/*!**********************************************************************!*\ - !*** ./~/raw-loader!./~/babel-loader/lib!./templates/hotTemplate.js ***! - \**********************************************************************/ /***/ (function(module, exports) { -eval("module.exports = \"'use strict';\\n\\nvar _huronStore = require('./huron-store');\\n\\nvar _huronStore2 = _interopRequireDefault(_huronStore);\\n\\nvar _insertNodes = require('./insertNodes');\\n\\nvar _insertNodes2 = _interopRequireDefault(_insertNodes);\\n\\nvar _section = require('./section.hbs');\\n\\nvar _section2 = _interopRequireDefault(_section);\\n\\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\\n\\n/* eslint-enable */\\n\\nconst assets = require.context(hotScope.requirePath, true, hotScope.requireRegex); /* globals hotScope */\\n\\n// NOTE: This is not a normal JS file! It is pulled in by the CLI as a string\\n// and prepended to the browser script after replacing anything referenced via `hotScope[variable]`\\n// with CLI arguments or config properties passed in by the user.\\n\\n/* eslint-disable */\\n\\nconst modules = {};\\n\\nmodules[hotScope.sectionTemplatePath] = _section2.default;\\n\\nassets.keys().forEach(key => {\\n modules[key] = assets(key);\\n});\\n\\nconst insert = new _insertNodes2.default(modules, _huronStore2.default);\\n\\nif (module.hot) {\\n // Hot Module Replacement for huron components (json, hbs, html)\\n module.hot.accept(assets.id, () => {\\n const newAssets = require.context(hotScope.requirePath, true, hotScope.requireRegex);\\n const newModules = newAssets.keys().map(key => [key, newAssets(key)]).filter(newModule => modules[newModule[0]] !== newModule[1]);\\n\\n updateStore(require('./huron-store.js')); // eslint-disable-line global-require, import/no-unresolved\\n newModules.forEach(module => {\\n modules[module[0]] = module[1];\\n hotReplace(module[0], module[1], modules);\\n });\\n });\\n\\n // Hot Module Replacement for sections template\\n module.hot.accept('./section.hbs', () => {\\n const newSectionTemplate = require('./section.hbs'); // eslint-disable-line global-require, import/no-unresolved\\n\\n modules[hotScope.sectionTemplatePath] = newSectionTemplate;\\n hotReplace('./huron-assets/section.hbs', newSectionTemplate, modules);\\n });\\n\\n // Hot Module Replacement for data store\\n module.hot.accept('./huron-store.js', () => {\\n updateStore(require('./huron-store.js')); // eslint-disable-line global-require, import/no-unresolved\\n });\\n}\\n\\nfunction hotReplace(key, module, newModules) {\\n insert.modules = newModules;\\n if (key === _huronStore2.default.sectionTemplatePath) {\\n insert.cycleSections();\\n } else {\\n insert.inserted = [];\\n insert.loadModule(key, module, false);\\n }\\n}\\n\\nfunction updateStore(newStore) {\\n insert.store = newStore;\\n}\"//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMjAuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi90ZW1wbGF0ZXMvaG90VGVtcGxhdGUuanM/YzA4MiJdLCJzb3VyY2VzQ29udGVudCI6WyJtb2R1bGUuZXhwb3J0cyA9IFwiJ3VzZSBzdHJpY3QnO1xcblxcbnZhciBfaHVyb25TdG9yZSA9IHJlcXVpcmUoJy4vaHVyb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B7XFxuICAgIGluc2VydC5jeWNsZVNlY3Rpb25zKCk7XFxuICB9IGVsc2Uge1xcbiAgICBpbnNlcnQuaW5zZXJ0ZWQgPSBbXTtcXG4gICAgaW5zZXJ0LmxvYWRNb2R1bGUoa2V5LCBtb2R1bGUsIGZhbHNlKTtcXG4gIH1cXG59XFxuXFxuZnVuY3Rpb24gdXBkYXRlU3RvcmUobmV3U3RvcmUpIHtcXG4gIGluc2VydC5zdG9yZSA9IG5ld1N0b3JlO1xcbn1cIlxuXG5cbi8vLy8vLy8vLy8vLy8vLy8vL1xuLy8gV0VCUEFDSyBGT09URVJcbi8vIC4vfi9yYXctbG9hZGVyIS4vfi9iYWJlbC1sb2FkZXIvbGliIS4vdGVtcGxhdGVzL2hvdFRlbXBsYXRlLmpzXG4vLyBtb2R1bGUgaWQgPSAyMFxuLy8gbW9kdWxlIGNodW5rcyA9IDAiXSwibWFwcGluZ3MiOiJBQUFBIiwic291cmNlUm9vdCI6IiJ9"); +module.exports = "'use strict';\n\nvar _huronStore = require('./huron-store');\n\nvar _huronStore2 = _interopRequireDefault(_huronStore);\n\nvar _insertNodes = require('./insertNodes');\n\nvar _insertNodes2 = _interopRequireDefault(_insertNodes);\n\nvar _section = require('./section.hbs');\n\nvar _section2 = _interopRequireDefault(_section);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n/* eslint-enable */\n\nconst assets = require.context(hotScope.requirePath, true, hotScope.requireRegex); /* globals hotScope */\n\n// NOTE: This is not a normal JS file! It is pulled in by the CLI as a string\n// and prepended to the browser script after replacing anything referenced via `hotScope[variable]`\n// with CLI arguments or config properties passed in by the user.\n\n/* eslint-disable */\n\nconst modules = {};\n\nmodules[hotScope.sectionTemplatePath] = _section2.default;\n\nassets.keys().forEach(key => {\n modules[key] = assets(key);\n});\n\nconst insert = new _insertNodes2.default(modules, _huronStore2.default);\n\nif (module.hot) {\n // Hot Module Replacement for huron components (json, hbs, html)\n module.hot.accept(assets.id, () => {\n const newAssets = require.context(hotScope.requirePath, true, hotScope.requireRegex);\n const newModules = newAssets.keys().map(key => [key, newAssets(key)]).filter(newModule => modules[newModule[0]] !== newModule[1]);\n\n updateStore(require('./huron-store.js')); // eslint-disable-line global-require, import/no-unresolved\n newModules.forEach(module => {\n modules[module[0]] = module[1];\n hotReplace(module[0], module[1], modules);\n });\n });\n\n // Hot Module Replacement for sections template\n module.hot.accept('./section.hbs', () => {\n const newSectionTemplate = require('./section.hbs'); // eslint-disable-line global-require, import/no-unresolved\n\n modules[hotScope.sectionTemplatePath] = newSectionTemplate;\n hotReplace('./huron-assets/section.hbs', newSectionTemplate, modules);\n });\n\n // Hot Module Replacement for data store\n module.hot.accept('./huron-store.js', () => {\n updateStore(require('./huron-store.js')); // eslint-disable-line global-require, import/no-unresolved\n });\n}\n\nfunction hotReplace(key, module, newModules) {\n insert.modules = newModules;\n if (key === _huronStore2.default.sectionTemplatePath) {\n insert.cycleSections();\n } else {\n insert.inserted = [];\n insert.loadModule(key, module, false);\n }\n}\n\nfunction updateStore(newStore) {\n insert.store = newStore;\n}" /***/ }), /* 21 */ -/* no static exports found */ -/* all exports used */ -/*!****************************!*\ - !*** external "commander" ***! - \****************************/ /***/ (function(module, exports) { -eval("module.exports = require(\"commander\");//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMjEuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vZXh0ZXJuYWwgXCJjb21tYW5kZXJcIj83NTczIl0sInNvdXJjZXNDb250ZW50IjpbIm1vZHVsZS5leHBvcnRzID0gcmVxdWlyZShcImNvbW1hbmRlclwiKTtcblxuXG4vLy8vLy8vLy8vLy8vLy8vLy9cbi8vIFdFQlBBQ0sgRk9PVEVSXG4vLyBleHRlcm5hbCBcImNvbW1hbmRlclwiXG4vLyBtb2R1bGUgaWQgPSAyMVxuLy8gbW9kdWxlIGNodW5rcyA9IDAiXSwibWFwcGluZ3MiOiJBQUFBIiwic291cmNlUm9vdCI6IiJ9"); +module.exports = require("commander"); /***/ }), /* 22 */ -/* no static exports found */ -/* all exports used */ -/*!***********************!*\ - !*** external "gaze" ***! - \***********************/ /***/ (function(module, exports) { -eval("module.exports = require(\"gaze\");//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMjIuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vZXh0ZXJuYWwgXCJnYXplXCI/ZjIxOCJdLCJzb3VyY2VzQ29udGVudCI6WyJtb2R1bGUuZXhwb3J0cyA9IHJlcXVpcmUoXCJnYXplXCIpO1xuXG5cbi8vLy8vLy8vLy8vLy8vLy8vL1xuLy8gV0VCUEFDSyBGT09URVJcbi8vIGV4dGVybmFsIFwiZ2F6ZVwiXG4vLyBtb2R1bGUgaWQgPSAyMlxuLy8gbW9kdWxlIGNodW5rcyA9IDAiXSwibWFwcGluZ3MiOiJBQUFBIiwic291cmNlUm9vdCI6IiJ9"); +module.exports = require("gaze"); /***/ }), /* 23 */ -/* no static exports found */ -/* all exports used */ -/*!**************************************!*\ - !*** external "html-webpack-plugin" ***! - \**************************************/ /***/ (function(module, exports) { -eval("module.exports = require(\"html-webpack-plugin\");//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMjMuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vZXh0ZXJuYWwgXCJodG1sLXdlYnBhY2stcGx1Z2luXCI/MThlYyJdLCJzb3VyY2VzQ29udGVudCI6WyJtb2R1bGUuZXhwb3J0cyA9IHJlcXVpcmUoXCJodG1sLXdlYnBhY2stcGx1Z2luXCIpO1xuXG5cbi8vLy8vLy8vLy8vLy8vLy8vL1xuLy8gV0VCUEFDSyBGT09URVJcbi8vIGV4dGVybmFsIFwiaHRtbC13ZWJwYWNrLXBsdWdpblwiXG4vLyBtb2R1bGUgaWQgPSAyM1xuLy8gbW9kdWxlIGNodW5rcyA9IDAiXSwibWFwcGluZ3MiOiJBQUFBIiwic291cmNlUm9vdCI6IiJ9"); +module.exports = require("html-webpack-plugin"); /***/ }), /* 24 */ -/* no static exports found */ -/* all exports used */ -/*!****************************!*\ - !*** external "immutable" ***! - \****************************/ /***/ (function(module, exports) { -eval("module.exports = require(\"immutable\");//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMjQuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vZXh0ZXJuYWwgXCJpbW11dGFibGVcIj8xZDIwIl0sInNvdXJjZXNDb250ZW50IjpbIm1vZHVsZS5leHBvcnRzID0gcmVxdWlyZShcImltbXV0YWJsZVwiKTtcblxuXG4vLy8vLy8vLy8vLy8vLy8vLy9cbi8vIFdFQlBBQ0sgRk9PVEVSXG4vLyBleHRlcm5hbCBcImltbXV0YWJsZVwiXG4vLyBtb2R1bGUgaWQgPSAyNFxuLy8gbW9kdWxlIGNodW5rcyA9IDAiXSwibWFwcGluZ3MiOiJBQUFBIiwic291cmNlUm9vdCI6IiJ9"); +module.exports = require("immutable"); /***/ }), /* 25 */ -/* no static exports found */ -/* all exports used */ -/*!**********************!*\ - !*** external "kss" ***! - \**********************/ /***/ (function(module, exports) { -eval("module.exports = require(\"kss\");//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMjUuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vZXh0ZXJuYWwgXCJrc3NcIj9jZDAyIl0sInNvdXJjZXNDb250ZW50IjpbIm1vZHVsZS5leHBvcnRzID0gcmVxdWlyZShcImtzc1wiKTtcblxuXG4vLy8vLy8vLy8vLy8vLy8vLy9cbi8vIFdFQlBBQ0sgRk9PVEVSXG4vLyBleHRlcm5hbCBcImtzc1wiXG4vLyBtb2R1bGUgaWQgPSAyNVxuLy8gbW9kdWxlIGNodW5rcyA9IDAiXSwibWFwcGluZ3MiOiJBQUFBIiwic291cmNlUm9vdCI6IiJ9"); +module.exports = require("kss"); /***/ }), /* 26 */ -/* no static exports found */ -/* all exports used */ -/*!*********************************!*\ - !*** external "lodash/isEqual" ***! - \*********************************/ /***/ (function(module, exports) { -eval("module.exports = require(\"lodash/isEqual\");//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMjYuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vZXh0ZXJuYWwgXCJsb2Rhc2gvaXNFcXVhbFwiP2NiNTIiXSwic291cmNlc0NvbnRlbnQiOlsibW9kdWxlLmV4cG9ydHMgPSByZXF1aXJlKFwibG9kYXNoL2lzRXF1YWxcIik7XG5cblxuLy8vLy8vLy8vLy8vLy8vLy8vXG4vLyBXRUJQQUNLIEZPT1RFUlxuLy8gZXh0ZXJuYWwgXCJsb2Rhc2gvaXNFcXVhbFwiXG4vLyBtb2R1bGUgaWQgPSAyNlxuLy8gbW9kdWxlIGNodW5rcyA9IDAiXSwibWFwcGluZ3MiOiJBQUFBIiwic291cmNlUm9vdCI6IiJ9"); +module.exports = require("lodash/isEqual"); /***/ }), /* 27 */ -/* no static exports found */ -/* all exports used */ -/*!**********************!*\ - !*** external "opn" ***! - \**********************/ /***/ (function(module, exports) { -eval("module.exports = require(\"opn\");//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMjcuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vZXh0ZXJuYWwgXCJvcG5cIj82MDBmIl0sInNvdXJjZXNDb250ZW50IjpbIm1vZHVsZS5leHBvcnRzID0gcmVxdWlyZShcIm9wblwiKTtcblxuXG4vLy8vLy8vLy8vLy8vLy8vLy9cbi8vIFdFQlBBQ0sgRk9PVEVSXG4vLyBleHRlcm5hbCBcIm9wblwiXG4vLyBtb2R1bGUgaWQgPSAyN1xuLy8gbW9kdWxlIGNodW5rcyA9IDAiXSwibWFwcGluZ3MiOiJBQUFBIiwic291cmNlUm9vdCI6IiJ9"); +module.exports = require("opn"); /***/ }), /* 28 */ -/* no static exports found */ -/* all exports used */ -/*!**********************!*\ - !*** external "url" ***! - \**********************/ /***/ (function(module, exports) { -eval("module.exports = require(\"url\");//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMjguanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vZXh0ZXJuYWwgXCJ1cmxcIj9jYWVjIl0sInNvdXJjZXNDb250ZW50IjpbIm1vZHVsZS5leHBvcnRzID0gcmVxdWlyZShcInVybFwiKTtcblxuXG4vLy8vLy8vLy8vLy8vLy8vLy9cbi8vIFdFQlBBQ0sgRk9PVEVSXG4vLyBleHRlcm5hbCBcInVybFwiXG4vLyBtb2R1bGUgaWQgPSAyOFxuLy8gbW9kdWxlIGNodW5rcyA9IDAiXSwibWFwcGluZ3MiOiJBQUFBIiwic291cmNlUm9vdCI6IiJ9"); +module.exports = require("url"); /***/ }), /* 29 */ -/* no static exports found */ -/* all exports used */ -/*!*************************************!*\ - !*** external "webpack-dev-server" ***! - \*************************************/ /***/ (function(module, exports) { -eval("module.exports = require(\"webpack-dev-server\");//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMjkuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vZXh0ZXJuYWwgXCJ3ZWJwYWNrLWRldi1zZXJ2ZXJcIj8xYmVhIl0sInNvdXJjZXNDb250ZW50IjpbIm1vZHVsZS5leHBvcnRzID0gcmVxdWlyZShcIndlYnBhY2stZGV2LXNlcnZlclwiKTtcblxuXG4vLy8vLy8vLy8vLy8vLy8vLy9cbi8vIFdFQlBBQ0sgRk9PVEVSXG4vLyBleHRlcm5hbCBcIndlYnBhY2stZGV2LXNlcnZlclwiXG4vLyBtb2R1bGUgaWQgPSAyOVxuLy8gbW9kdWxlIGNodW5rcyA9IDAiXSwibWFwcGluZ3MiOiJBQUFBIiwic291cmNlUm9vdCI6IiJ9"); +module.exports = require("webpack-dev-server"); /***/ }), /* 30 */ -/* no static exports found */ -/* all exports used */ -/*!*****************************!*\ - !*** multi ./src/cli/index ***! - \*****************************/ /***/ (function(module, exports, __webpack_require__) { -module.exports = __webpack_require__(/*! ./src/cli/index */9); +module.exports = __webpack_require__(9); /***/ }) -/******/ ]); \ No newline at end of file +/******/ ]); +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/dist/cli/index.js.map b/dist/cli/index.js.map new file mode 100644 index 0000000..2a34548 --- /dev/null +++ b/dist/cli/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sources":["webpack:///webpack/bootstrap b0c884d423deecb6359c","webpack:///external \"path\"","webpack:///src/cli/utils.js","webpack:///external \"chalk\"","webpack:///external \"fs-extra\"","webpack:///src/cli/parseArgs.js","webpack:///external \"webpack\"","webpack:///src/cli/defaultStore.js","webpack:///src/cli/handleTemplates.js","webpack:///src/cli/requireTemplates.js","webpack:///src/cli/index.js","webpack:///config/devServer.config.js","webpack:///src/cli/actions.js","webpack:///src/cli/fileWatcher.js","webpack:///src/cli/generateConfig.js","webpack:///src/cli/handleHTML.js","webpack:///src/cli/handleKSS.js","webpack:///src/cli/requireExternal.js","webpack:///src/cli/server.js","webpack:///src/defaultConfig/huron.config.js","webpack:///src/defaultConfig/webpack.config.js","webpack:///./templates/hotTemplate.js","webpack:///external \"commander\"","webpack:///external \"gaze\"","webpack:///external \"html-webpack-plugin\"","webpack:///external \"immutable\"","webpack:///external \"kss\"","webpack:///external \"lodash/isEqual\"","webpack:///external \"opn\"","webpack:///external \"url\"","webpack:///external \"webpack-dev-server\""],"sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// identity function for calling harmony imports with the correct context\n \t__webpack_require__.i = function(value) { return value; };\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"../\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 30);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap b0c884d423deecb6359c","module.exports = require(\"path\");\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"path\"\n// module id = 0\n// module chunks = 0","/** @module cli/utilities */\nimport path from 'path';\nimport fs from 'fs-extra';\nimport chalk from 'chalk';\n\nconst cwd = process.cwd(); // Current working directory\n\n/**\n * Ensure predictable data structure for KSS section data\n *\n * @function normalizeSectionData\n * @param {object} section - section data\n * @return {object} section data\n */\nexport function normalizeSectionData(section) {\n const data = section.data || section;\n\n if (!data.referenceURI || '' === data.referenceURI) {\n data.referenceURI = section.referenceURI();\n }\n\n return data;\n}\n\n/**\n * Ensure predictable data structure for KSS section data\n *\n * @function writeSectionData\n * @param {object} store - data store\n * @param {object} section - section data\n * @param {string} sectionPath - output destination for section data file\n */\nexport function writeSectionData(store, section, sectionPath = false) {\n let outputPath = sectionPath;\n let sectionFileInfo;\n\n if (!outputPath && {}.hasOwnProperty.call(section, 'kssPath')) {\n sectionFileInfo = path.parse(section.kssPath);\n outputPath = path.join(\n sectionFileInfo.dir,\n `${sectionFileInfo.name}.json`\n );\n }\n\n // Output section data\n if (outputPath) {\n return writeFile(\n section.referenceURI,\n 'section',\n outputPath,\n JSON.stringify(section),\n store\n );\n }\n\n console.warn( // eslint-disable-line no-console\n chalk.red(`Failed to write section data for ${section.referenceURI}`)\n );\n return false;\n}\n\n/**\n * Find .json from a template file or vice versa\n *\n * @function getTemplateDataPair\n * @param {object} file - file object from path.parse()\n * @param {object} section - KSS section data\n * @return {string} relative path to module JSON file\n */\nexport function getTemplateDataPair(file, section, store) {\n const huron = store.get('config');\n const kssDir = matchKssDir(file.dir, huron);\n\n if (kssDir) {\n const componentPath = path.relative(\n path.resolve(cwd, kssDir),\n file.dir\n );\n const partnerType = '.json' === file.ext ? 'template' : 'data';\n const partnerExt = '.json' === file.ext ?\n huron.get('templates').extension :\n '.json';\n\n const pairPath = path.join(\n componentPath,\n generateFilename(\n section.referenceURI,\n partnerType,\n partnerExt,\n store\n )\n );\n\n return `./${pairPath}`;\n }\n\n return false;\n}\n\n/**\n * Normalize a section title for use as a filename\n *\n * @function normalizeHeader\n * @param {string} header - section header extracted from KSS documentation\n * @return {string} modified header, lowercase and words separated by dash\n */\nexport function normalizeHeader(header) {\n return header\n .toLowerCase()\n .replace(/\\s?\\W\\s?/g, '-');\n}\n\n/**\n * Wrap html in required template tags\n *\n * @function wrapMarkup\n * @param {string} content - html or template markup\n * @param {string} templateId - id of template (should be section reference)\n * @return {string} modified HTML\n */\nexport function wrapMarkup(content, templateId) {\n return `\n\n\\n`;\n}\n\n/**\n * Generate a filename based on referenceURI, type and file object\n *\n * @function generateFilename\n * @param {string} id - The name of the file (with extension).\n * @param {string} type - the type of file output\n * @param {object} ext - file extension\n * @param {store} store - data store\n * @return {string} Path to output file, relative to ouput dir (can be use in require statements)\n */\nexport function generateFilename(id, type, ext, store) {\n // Type of file and its corresponding extension(s)\n const types = store.get('types');\n const outputExt = '.scss' !== ext ? ext : '.html';\n\n /* eslint-disable */\n if (-1 === types.indexOf(type)) {\n console.log(`Huron data ${type} does not exist`);\n return false;\n }\n /* eslint-enable */\n\n return `${id}-${type}${outputExt}`;\n}\n\n/**\n * Copy an HTML file into the huron output directory.\n *\n * @function writeFile\n * @param {string} id - The name of the file (with extension).\n * @param {string} content - The content of the file to write.\n * @param {string} type - the type of file output\n * @param {object} store - The data store\n * @return {string} Path to output file, relative to ouput dir (can be use in require statements)\n */\nexport function writeFile(id, type, filepath, content, store) {\n const huron = store.get('config');\n const file = path.parse(filepath);\n const filename = generateFilename(id, type, file.ext, store);\n const kssDir = matchKssDir(filepath, huron);\n\n if (kssDir) {\n const componentPath = path.relative(\n path.resolve(cwd, kssDir),\n file.dir\n );\n const outputRelative = path.join(\n huron.get('output'),\n componentPath,\n `${filename}`\n );\n const outputPath = path.resolve(cwd, huron.get('root'), outputRelative);\n let newContent = content;\n\n if ('data' !== type && 'section' !== type) {\n newContent = wrapMarkup(content, id);\n }\n\n try {\n fs.outputFileSync(outputPath, newContent);\n console.log(chalk.green(`Writing ${outputRelative}`)); // eslint-disable-line no-console\n } catch (e) {\n console.log(chalk.red(`Failed to write ${outputRelative}`)); // eslint-disable-line no-console\n }\n\n return `./${outputRelative.replace(`${huron.get('output')}/`, '')}`;\n }\n\n return false;\n}\n\n/**\n * Delete a file in the huron output directory\n *\n * @function removeFile\n * @param {string} filename - The name of the file (with extension).\n * @param {object} store - The data store\n * @return {string} Path to output file, relative to ouput dir (can be use in require statements)\n */\nexport function removeFile(id, type, filepath, store) {\n const huron = store.get('config');\n const file = path.parse(filepath);\n const filename = generateFilename(id, type, file.ext, store);\n const kssDir = matchKssDir(filepath, huron);\n\n if (kssDir) {\n const componentPath = path.relative(\n path.resolve(cwd, kssDir),\n file.dir\n );\n const outputRelative = path.join(\n huron.get('output'),\n componentPath,\n `${filename}`\n );\n const outputPath = path.resolve(cwd, huron.get('root'), outputRelative);\n\n try {\n fs.removeSync(outputPath);\n console.log(chalk.green(`Removing ${outputRelative}`)); // eslint-disable-line no-console\n } catch (e) {\n console.log( // eslint-disable-line no-console\n chalk.red(`${outputRelative} does not exist or cannot be deleted`)\n );\n }\n\n return `./${outputRelative.replace(`${huron.get('output')}/`, '')}`;\n }\n\n return false;\n}\n\n/**\n * Write a template for sections\n *\n * @function writeSectionTemplate\n * @param {string} filepath - the original template file\n * @param {object} store - data store\n * @return {object} updated store\n */\nexport function writeSectionTemplate(filepath, store) {\n const huron = store.get('config');\n const sectionTemplate = wrapMarkup(fs.readFileSync(filepath, 'utf8'));\n const componentPath = './huron-assets/section.hbs';\n const output = path.join(\n cwd,\n huron.get('root'),\n componentPath\n );\n\n // Move huron script and section template into huron root\n fs.outputFileSync(output, sectionTemplate);\n console.log(chalk.green(`writing section template to ${output}`)); // eslint-disable-line no-console\n\n return store.set('sectionTemplatePath', componentPath);\n}\n\n/**\n * Request for section data based on section reference\n *\n * @function writeSectionTemplate\n * @param {string} search - key on which to match section\n * @param {field} string - field in which to look to determine section\n * @param {obj} store - sections memory store\n */\nexport function getSection(search, field, store) {\n const sectionValues = store\n .getIn(['sections', 'sectionsByPath'])\n .valueSeq();\n let selectedSection = false;\n\n if (field) {\n selectedSection = sectionValues\n .filter((value) => value[field] === search)\n .get(0);\n } else {\n selectedSection = store.getIn(['sections', 'sectionsByPath', search]);\n }\n\n return selectedSection;\n}\n\n/**\n * Find which configured KSS directory a filepath exists in\n *\n * @function matchKssDir\n * @param {string} filepath - filepath to search for\n * @param {object} huron - huron configuration\n * @return {string} kssMatch - relative path to KSS directory\n */\nexport function matchKssDir(filepath, huron) {\n const kssSource = huron.get('kss');\n // Include forward slash in our test to make sure we're matchin a directory, not a file extension\n const kssMatch = kssSource.filter((dir) => filepath.includes(`/${dir}`));\n\n if (kssMatch.length) {\n return kssMatch[0];\n }\n\n return false;\n}\n\n/**\n * Merge JSON files for css modules classnames in a provided directory\n *\n * @function mergeClassnameJSON\n * @param {string} directory - directory containing classname JSON files\n *\n * @return {object} classnamesMerged - merged classnames. contents of each JSON file is nested within\n * the returned object by filename. (e.g. article.json -> { article: {...json contents}})\n */\nexport function mergeClassnameJSON(directory) {\n let files;\n\n // If no config is provided, return immediately\n if (!directory) {\n return {};\n }\n\n // Try to read through classnames directory\n try {\n files = fs.readdirSync(directory);\n } catch (e) {\n console.warn(chalk.red(e));\n }\n\n // Merge classname json files\n const classNamesMerged = files.reduce((acc, file) => {\n const fileInfo = path.parse(file);\n let classNames = {};\n\n if ('.json' === fileInfo.ext) {\n try {\n const contents = fs.readFileSync(\n path.join(directory, file),\n 'utf8'\n );\n classNames = JSON.parse(contents);\n } catch (e) {\n console.warn(chalk.red(e));\n }\n }\n\n return Object.assign({}, acc, { [fileInfo.name]: classNames });\n }, {});\n\n return classNamesMerged;\n}\n\n/**\n * Remove the trailing slash from a provided directory\n *\n * @function removeTrailingSlash\n * @param {string} directory - directory path\n * @return {string} directory - directory path with trailing slash removed\n */\nexport function removeTrailingSlash(directory) {\n if ('/' === directory.slice(-1)) {\n return directory.slice(0, -1);\n }\n\n return directory;\n}\n\n\n\n// WEBPACK FOOTER //\n// src/cli/utils.js","module.exports = require(\"chalk\");\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"chalk\"\n// module id = 2\n// module chunks = 0","module.exports = require(\"fs-extra\");\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"fs-extra\"\n// module id = 3\n// module chunks = 0","/** @module cli/parse-arguments */\n/* eslint-disable space-unary-ops */\n\nimport program from 'commander';\nimport path from 'path';\n\n// Requires\n/** @global */\n\n/**\n * Process huron CLI arguments\n *\n * @function parseArgs\n * @example node huron/dist/cli/huron-cli.js --config 'client/config/webpack.config.js' --production\n */\nfunction parseArgs() {\n const envArg = {};\n\n process.argv = process.argv.filter((arg) => {\n if (-1 !== arg.indexOf('--env')) {\n const envParts = arg\n .split('.')[1]\n .split('=');\n\n envArg[envParts[0]] = envParts[1] || true;\n return false;\n }\n\n return true;\n });\n\n program.version('1.0.1')\n .option(\n '-c, --huron-config [huronConfig]',\n '[huronConfig] for all huron options',\n path.resolve(__dirname, '../defaultConfig/huron.config.js')\n )\n .option(\n '-w, --webpack-config [webpackConfig]',\n '[webpackConfig] for all webpack options',\n path.resolve(__dirname, '../defaultConfig/webpack.config.js')\n )\n .option('-p, --production', 'compile assets once for production');\n\n program.env = envArg;\n\n // Only parse if we're not running tests\n if (\n ! process.env.npm_lifecycle_event ||\n 'test' !== process.env.npm_lifecycle_event\n ) {\n program.parse(process.argv);\n }\n}\n\nparseArgs();\n/* eslint-enable */\n\nexport default program;\n\n\n\n// WEBPACK FOOTER //\n// src/cli/parseArgs.js","module.exports = require(\"webpack\");\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"webpack\"\n// module id = 5\n// module chunks = 0","import { Map } from 'immutable';\n\nimport generateConfig from './generateConfig';\nimport { mergeClassnameJSON } from './utils';\n// Create initial data structure\n\n// Merge Huron default webpack config with user config\nconst config = generateConfig();\n\n// Make sure the kss option is represented as an array\nconfig.huron.kss = [].concat(config.huron.kss);\n\n/* eslint-disable */\n/**\n * Initial structure for immutable data store\n *\n * @global\n */\nconst defaultStore = Map({\n types: [\n 'template',\n 'data',\n 'description',\n 'section',\n 'prototype',\n 'sections-template',\n ],\n config: Map(config.huron),\n classNames: mergeClassnameJSON(config.huron.classNames),\n sections: Map({\n sectionsByPath: Map({}),\n sectionsByURI: Map({}),\n sorted: {},\n }),\n templates: Map({}),\n prototypes: Map({}),\n sectionTemplatePath: '',\n referenceDelimiter: '.',\n});\n/* eslint-enable */\n\nexport { defaultStore, config };\n\n\n\n// WEBPACK FOOTER //\n// src/cli/defaultStore.js","/** @module cli/template-handler */\nimport path from 'path';\nimport fs from 'fs-extra';\nimport chalk from 'chalk';\n\nimport * as utils from './utils';\n\n/**\n * Handle update of a template or data (json) file\n *\n * @function updateTemplate\n * @param {string} filepath - filepath of changed file (comes from gaze)\n * @param {object} section - contains KSS section data\n * @param {object} store - memory store\n * @return {object} updated memory store\n */\nexport function updateTemplate(filepath, section, store) {\n const file = path.parse(filepath);\n const pairPath = utils.getTemplateDataPair(file, section, store);\n const type = '.json' === file.ext ? 'data' : 'template';\n const newSection = section;\n const newStore = store;\n let content = false;\n\n try {\n content = fs.readFileSync(filepath, 'utf8');\n } catch (e) {\n console.log(chalk.red(`${filepath} does not exist`));\n }\n\n if (content) {\n const requirePath = utils.writeFile(\n newSection.referenceURI,\n type,\n filepath,\n content,\n newStore\n );\n newSection[`${type}Path`] = requirePath;\n\n if ('template' === type) {\n newSection.templateContent = content;\n\n // Rewrite section data with template content\n newSection.sectionPath = utils.writeSectionData(newStore, newSection);\n }\n\n return newStore\n .setIn(\n ['templates', requirePath],\n pairPath\n )\n .setIn(\n ['sections', 'sectionsByPath', newSection.kssPath],\n newSection\n )\n .setIn(\n ['sections', 'sectionsByURI', newSection.referenceURI],\n newSection\n );\n }\n\n return newStore;\n}\n\n/**\n * Handle removal of a template or data (json) file\n *\n * @function deleteTemplate\n * @param {string} filepath - filepath of changed file (comes from gaze)\n * @param {object} section - contains KSS section data\n * @param {object} store - memory store\n * @return {object} updated memory store\n */\nexport function deleteTemplate(filepath, section, store) {\n const file = path.parse(filepath);\n const type = '.json' === file.ext ? 'data' : 'template';\n const newSection = section;\n const newStore = store;\n\n // Remove partner\n const requirePath = utils.removeFile(\n newSection.referenceURI,\n type,\n filepath,\n newStore\n );\n delete newSection[`${type}Path`];\n\n return newStore\n .deleteIn(['templates', requirePath])\n .setIn(\n ['sections', 'sectionsByPath', newSection.kssPath],\n newSection\n )\n .setIn(\n ['sections', 'sectionsByURI', newSection.referenceURI],\n newSection\n );\n}\n\n\n\n// WEBPACK FOOTER //\n// src/cli/handleTemplates.js","/** @module cli/require-templates */\nimport path from 'path';\nimport fs from 'fs-extra';\n\n// We need to prepend this to the browser script as a string but still want to transpile it,\n// hence loading it using `raw-loader` so we receive a string from webpack\n/* eslint-disable */\nimport hotTemplate from '!raw-loader!babel-loader!../../templates/hotTemplate';\n/* eslint-enable */\n\nconst cwd = process.cwd();\nconst huronScript = fs.readFileSync(\n path.join(__dirname, '../web/index.js'),\n 'utf8'\n);\n\n/**\n * Write code for requiring all generated huron assets\n *\n * @function requireTemplates\n * @param {object} store - memory store\n */\nexport const requireTemplates = function requireTemplates(store) {\n const huron = store.get('config');\n const outputPath = path.join(cwd, huron.get('root'), 'huron-assets');\n // These will be used to replace strings in the hotTemplate.\n // In order to accurately replace strings but still keep things parseable by eslint and babel,\n // each replaceable value should be referenced in `hotTemplate.js` under the `hotScope` object.\n // For example, if you need to replace a string with a value passed in from the CLI called `userVariable`,\n // you would reference that string in `hotTemplate.js` with `hotScope.userVariable`.\n const hotVariableScope = {\n sectionTemplatePath: `'${huron.get('sectionTemplate')}'`,\n requireRegex: new RegExp(`\\\\.html|\\\\.json|\\\\${\n huron.get('templates').extension\n }$`),\n requirePath: `'../${huron.get('output')}'`,\n };\n const hotTemplateTransformed = Object.keys(hotVariableScope)\n .reduce(\n (acc, curr) => acc.replace(\n new RegExp(`hotScope.${curr}`, 'g'),\n hotVariableScope[curr]\n ), hotTemplate\n );\n\n // Write the contents of this script.\n fs.outputFileSync(\n path.join(outputPath, 'index.js'),\n hotTemplateTransformed\n );\n fs.outputFileSync(\n path.join(outputPath, 'insertNodes.js'),\n huronScript\n );\n};\n\n/**\n * Output entire data store to a JS object and handle if any KSS data has changed\n *\n * @function writeStore\n * @param {object} store - memory store\n * @param {string} changed - filepath of changed KSS section, if applicable\n */\nexport const writeStore = function writeStore(store, newStore = false) {\n const updatedStore = newStore || store;\n const huron = updatedStore.get('config');\n const outputPath = path.join(cwd, huron.get('root'), 'huron-assets');\n\n // Write updated data store\n fs.outputFileSync(\n path.join(outputPath, 'huron-store.js'),\n `module.exports = ${JSON.stringify(updatedStore.toJSON())}`\n );\n};\n\n\n\n\n// WEBPACK FOOTER //\n// src/cli/requireTemplates.js","// Local imports\nimport chalk from 'chalk';\n\nimport {\n initFiles,\n updateFile,\n deleteFile,\n updateClassNames,\n} from './actions';\nimport { requireTemplates, writeStore } from './requireTemplates';\nimport { matchKssDir } from './utils';\nimport program from './parseArgs';\nimport startWebpack from './server';\nimport { defaultStore, config } from './defaultStore';\nimport gaze from './fileWatcher';\n\n/**\n * Initialize data store with files from gaze and original data structure\n *\n * @global\n */\nconst huron = defaultStore.get('config');\nlet store = initFiles(gaze.watched(), defaultStore);\n\nrequireTemplates(store);\nwriteStore(store);\n\n// If building for production, close gaze and exit process once initFiles is done.\nif (program.production) {\n gaze.close();\n}\n\n/** @module cli/gaze */\ngaze.on('all', (event, filepath) => {\n store = updateClassNames(filepath, store);\n writeStore(store);\n});\n\n/**\n * Anonymous handler for Gaze 'changed' event indicating a file has changed\n *\n * @callback changed\n * @listens gaze:changed\n * @param {string} filepath - absolute path of changed file\n */\ngaze.on('changed', (filepath) => {\n if (matchKssDir(filepath, huron)) {\n store = updateFile(filepath, store);\n }\n\n console.log(chalk.green(`${filepath} updated!`));\n});\n\n/**\n * Anonymous handler for Gaze 'added' event indicating a file has been added to the watched directories\n *\n * @callback added\n * @listens gaze:added\n * @param {string} filepath - absolute path of changed file\n */\ngaze.on('added', (filepath) => {\n if (matchKssDir(filepath, huron)) {\n store = updateFile(filepath, store);\n writeStore(store);\n }\n\n console.log(chalk.blue(`${filepath} added!`));\n});\n\n/**\n * Anonymous handler for Gaze 'renamed' event indicating a file has been renamed\n *\n * @callback renamed\n * @listens gaze:renamed\n * @param {string} filepath - absolute path of changed file\n */\ngaze.on('renamed', (newPath, oldPath) => {\n if (matchKssDir(newPath, huron)) {\n store = deleteFile(oldPath, store);\n store = updateFile(newPath, store);\n writeStore(store);\n }\n\n console.log(chalk.blue(`${newPath} added!`));\n});\n\n/**\n * Anonymous handler for Gaze 'deleted' event indicating a file has been removed\n *\n * @callback deleted\n * @listens gaze:deleted\n * @param {string} filepath - absolute path of changed file\n */\ngaze.on('deleted', (filepath) => {\n if (matchKssDir(filepath, huron)) {\n store = deleteFile(filepath, store);\n writeStore(store);\n }\n\n console.log(chalk.red(`${filepath} deleted`));\n});\n\n// Start webpack or build for production\nstartWebpack(config);\n\n\n\n// WEBPACK FOOTER //\n// src/cli/index.js","export default (huron) => ({\n hot: true,\n host: 'localhost',\n quiet: false,\n noInfo: false,\n overlay: true,\n stats: {\n colors: true,\n hash: false,\n version: false,\n assets: false,\n chunks: false,\n modules: false,\n reasons: false,\n children: false,\n source: false,\n },\n publicPath: `/${huron.root}`,\n});\n\n\n\n// WEBPACK FOOTER //\n// config/devServer.config.js","/** @module cli/actions */\n\n// Imports\nimport path from 'path';\nimport chalk from 'chalk';\nimport isEqual from 'lodash/isEqual';\n\nimport {\n updateHTML,\n deleteHTML,\n updatePrototype,\n deletePrototype,\n} from './handleHTML';\nimport { updateTemplate, deleteTemplate } from './handleTemplates';\nimport { updateKSS, deleteKSS } from './handleKSS';\nimport * as utils from './utils';\n\n/**\n * Recursively loop through initial watched files list from Gaze.\n *\n * @param {object} data - object containing directory and file paths\n * @param {object} store - memory store\n * @return {object} newStore - map object of entire data store\n */\nexport function initFiles(data, store, depth = 0) {\n const type = Object.prototype.toString.call(data);\n const huron = store.get('config');\n let newStore = store;\n let info;\n let files;\n\n switch (type) {\n case '[object Object]':\n files = Object.keys(data);\n newStore = files.reduce(\n (prevStore, file) => initFiles(data[file], prevStore, depth),\n newStore\n );\n break;\n\n case '[object Array]':\n newStore = data.reduce(\n (prevStore, file) => initFiles(file, prevStore, depth),\n newStore\n );\n break;\n\n case '[object String]':\n info = path.parse(data);\n\n // Only call update if data is a filepath and it's within the KSS source directory\n if (info.ext && !data.includes(huron.get('classNames'))) {\n newStore = updateFile(data, store);\n }\n break;\n\n default:\n break;\n }\n\n return newStore;\n}\n\n/**\n * Logic for updating and writing file information based on file type (extension)\n *\n * @param {string} filepath - path to updated file. usually passed in from Gaze\n * @param {object} store - memory store\n * @return {object} store - map object of map object of entire data store\n */\nexport function updateFile(filepath, store) {\n const huron = store.get('config');\n const file = path.parse(filepath);\n let field;\n let section;\n\n if (filepath.includes(huron.get('sectionTemplate'))) {\n return utils.writeSectionTemplate(filepath, store);\n }\n\n switch (file.ext) {\n // Plain HTML template, external\n case '.html':\n section = utils.getSection(file.base, 'markup', store);\n\n if (section) {\n return updateHTML(filepath, section, store);\n } else if (\n file.dir.includes('prototypes') &&\n file.name.includes('prototype-')\n ) {\n return updatePrototype(filepath, store);\n }\n\n console.log(chalk.red(`Failed to write file: ${file.name}`));\n break;\n\n // Handlebars template, external\n case huron.get('templates').extension:\n case '.json':\n field = ('.json' === file.ext) ? 'data' : 'markup';\n section = utils.getSection(file.base, field, store);\n\n if (section) {\n return updateTemplate(filepath, section, store);\n }\n\n console.log( // eslint-disable-line no-console\n chalk.red(`Could not find associated KSS section for ${filepath}`)\n );\n break;\n\n // KSS documentation (default extension is `.css`)\n // Will also output a template if markup is inline\n // Note: inline markup does _not_ support handlebars currently\n case huron.get('kssExtension'):\n return updateKSS(filepath, store);\n\n // This should never happen if Gaze is working properly\n default:\n return store;\n }\n\n return store;\n}\n\n/**\n * Logic for deleting file information and files based on file type (extension)\n *\n * @param {string} filepath - path to updated file. usually passed in from Gaze\n * @param {object} store - memory store\n * @return {object} newStore - map object of map object of entire data store\n */\nexport function deleteFile(filepath, store) {\n const huron = store.get('config');\n const file = path.parse(filepath);\n let field = '';\n let section = null;\n let newStore = store;\n\n switch (file.ext) {\n // Plain HTML template, external\n case '.html':\n section = utils.getSection(file.base, 'markup', store);\n\n if (section) {\n newStore = deleteHTML(filepath, section, store);\n } else if (\n file.dir.includes('prototypes') &&\n file.name.includes('prototype-')\n ) {\n newStore = deletePrototype(filepath, store);\n }\n break;\n\n case huron.get('templates').extension:\n case '.json':\n field = ('.json' === file.ext) ? 'data' : 'markup';\n section = utils.getSection(file.base, field, store);\n\n if (section) {\n newStore = deleteTemplate(filepath, section, store);\n }\n break;\n\n case huron.get('kssExtension'):\n section = utils.getSection(filepath, false, store);\n\n if (section) {\n newStore = deleteKSS(filepath, section, store);\n }\n break;\n\n default:\n console.warn( // eslint-disable-line no-console\n chalk.red(`Could not delete: ${file.name}`)\n );\n break;\n }\n\n return newStore;\n}\n\n/**\n * Logic for updating localized classnames from CSS modules\n *\n * @param {string} filepath - path to updated file. usually passed in from Gaze\n * @param {object} store - memory store\n *\n * @return void\n */\nexport function updateClassNames(filepath, store) {\n const classNamesPath = store.getIn(['config', 'classNames']);\n\n if (filepath.includes(classNamesPath)) {\n const oldClassnames = store.get('classNames');\n const newClassnames = utils.mergeClassnameJSON(classNamesPath);\n\n if (!isEqual(oldClassnames, newClassnames)) {\n return store.set('classNames', newClassnames);\n }\n }\n\n return store;\n}\n\n\n\n// WEBPACK FOOTER //\n// src/cli/actions.js","import { Gaze } from 'gaze';\nimport path from 'path';\n\nimport { removeTrailingSlash } from './utils';\nimport { defaultStore } from './defaultStore';\n\n/**\n * Huron configuration object\n *\n * @global\n */\nconst huron = defaultStore.get('config');\n\n/**\n * Available file extensions. Extensions should not include the leading '.'\n *\n * @global\n */\nexport const extensions = [\n huron.get('kssExtension'),\n huron.get('templates').extension,\n 'html',\n 'json',\n].map((extension) => extension.replace('.', ''));\n\n// Generate watch list for Gaze, start gaze\nexport const watchedFiles = [];\n\n// Watch section template\nwatchedFiles.push(path.resolve(huron.get('sectionTemplate')));\n\n// Watch cssmodules classname files (if they exist)\nif (huron.get('classNames')) {\n watchedFiles.push(\n `${path.resolve(huron.get('classNames'))}/*.json`\n );\n}\n\n// Watch all provided kss directories\nhuron.get('kss').forEach((dir) => {\n watchedFiles.push(\n `${removeTrailingSlash(dir)}/**/*.+(${extensions.join('|')})`\n );\n});\n\n/**\n * Gaze instance for watching all files, including KSS, html, hbs/template, and JSON\n *\n * @global\n */\nconst gaze = new Gaze(watchedFiles);\n\nexport default gaze;\n\n\n\n// WEBPACK FOOTER //\n// src/cli/fileWatcher.js","/** @module cli/generate-config */\nimport path from 'path';\nimport url from 'url';\nimport fs from 'fs-extra';\nimport webpack from 'webpack';\nimport HTMLWebpackPlugin from 'html-webpack-plugin';\n\nimport program from './parseArgs';\nimport requireExternal from './requireExternal';\nimport defaultWebpack from '../defaultConfig/webpack.config';\nimport defaultHuron from '../defaultConfig/huron.config';\n\nconst cwd = process.cwd();\n\n// Require configs passed in by user from CLI\nlet defaultConfig = false;\nconst localConfig = requireExternal(\n path.resolve(program.webpackConfig)\n);\nconst localHuron = requireExternal(\n path.resolve(program.huronConfig)\n);\n\n/**\n * Generate a mutant hybrid of the huron default webpack config and your local webpack config\n *\n * @function generateConfig\n * @param {object} config - local webpack config\n * @return {object} newConfig - updated data store\n */\nexport default function generateConfig() {\n let newConfig = localConfig;\n let newHuron = localHuron;\n\n // Execute config function, if provided\n if ('function' === typeof newConfig) {\n newConfig = newConfig(program.env);\n }\n\n // Execute huron config function, if provided\n if ('function' === typeof newHuron) {\n newHuron = newHuron(program.env);\n }\n\n // Merge huron defaults with user settings\n newHuron = Object.assign({}, defaultHuron, newHuron);\n // Use user huron config to modify webpack defaults\n defaultConfig = defaultWebpack(newHuron);\n\n // Set ouput options\n newConfig.output = Object.assign({}, defaultConfig.output, newConfig.output);\n newConfig.output.path = defaultConfig.output.path;\n newConfig.output.publicPath = defaultConfig.output.publicPath;\n\n // configure entries\n newConfig = configureEntries(newHuron, newConfig);\n\n // configure plugins\n newConfig = configurePlugins(newHuron, newConfig);\n\n // configure loaders\n newConfig = configureLoaders(newHuron, newConfig);\n\n // Add HTMLWebpackPlugin for each configured prototype\n newConfig = configurePrototypes(newHuron, newConfig);\n\n // Remove existing devServer settings\n delete newConfig.devServer;\n\n return {\n huron: newHuron,\n webpack: newConfig,\n };\n}\n\n/**\n * Configure and manage webpack entry points\n *\n * @param {object} huron - huron configuration object\n * @param {object} config - webpack configuration object\n * @return {object} newConfig - updated data store\n */\nfunction configureEntries(huron, config) {\n const entry = config.entry[huron.entry];\n const newConfig = config;\n\n newConfig.entry = {};\n if (!program.production) {\n newConfig.entry[huron.entry] = [\n `webpack-dev-server/client/index.js?http://localhost:${huron.port}/`,\n 'webpack/hot/dev-server',\n path.join(cwd, huron.root, 'huron-assets/index'),\n ].concat(entry);\n } else {\n newConfig.entry[huron.entry] = [\n path.join(cwd, huron.root, 'huron-assets/index'),\n ].concat(entry);\n }\n\n return newConfig;\n}\n\n/**\n * Configure and manage webpack plugins\n *\n * @param {object} huron - huron configuration object\n * @param {object} config - webpack configuration object\n * @return {object} newConfig - updated data store\n */\nfunction configurePlugins(huron, config) {\n const newConfig = config;\n\n newConfig.plugins = config.plugins || [];\n\n if (!program.production) {\n if (newConfig.plugins && newConfig.plugins.length) {\n newConfig.plugins = newConfig.plugins.filter(\n (plugin) => 'HotModuleReplacementPlugin' !== plugin.constructor.name &&\n 'NamedModulesPlugin' !== plugin.constructor.name\n );\n }\n newConfig.plugins = newConfig.plugins\n .concat([\n new webpack.HotModuleReplacementPlugin(),\n new webpack.NamedModulesPlugin(),\n ]);\n }\n\n return newConfig;\n}\n\n/**\n * Configure and manage webpack loaders\n *\n * @param {object} huron - huron configuration object\n * @param {object} config - webpack configuration object\n * @return {object} newConfig - updated data store\n */\nfunction configureLoaders(huron, config) {\n // Manage loaders\n const templatesLoader = huron.templates.rule || {};\n const newConfig = config;\n\n // Make sure we're only using templates loader for files in huron root\n templatesLoader.include = [path.join(cwd, huron.root, huron.output)];\n\n // Normalize module and module.rules\n newConfig.module = newConfig.module || {};\n newConfig.module.rules = newConfig.module.rules ||\n newConfig.module.loaders ||\n [];\n\n // Add default loaders\n newConfig.module.rules = defaultConfig.module.rules\n .concat(\n newConfig.module.rules,\n templatesLoader\n );\n\n return newConfig;\n}\n\n/**\n * Create an HTML webpack plugin for each configured prototype\n *\n * @param {object} huron - huron configuration object\n * @param {object} config - webpack configuration object\n * @return {object} newConfig - updated data store\n */\nfunction configurePrototypes(huron, config) {\n const wrapperTemplate = fs.readFileSync(\n path.join(__dirname, '../../templates/prototypeTemplate.hbs'),\n 'utf8'\n );\n\n const defaultHTMLPluginOptions = {\n title: 'Huron',\n window: huron.window,\n js: [],\n css: [],\n filename: 'index.html',\n template: path.join(\n cwd,\n huron.root,\n 'huron-assets/prototypeTemplate.hbs'\n ),\n inject: false,\n chunks: [huron.entry],\n };\n const newConfig = config;\n\n // Write prototype template file for HTML webpack plugin\n fs.outputFileSync(\n path.join(cwd, huron.root, 'huron-assets/prototypeTemplate.hbs'),\n wrapperTemplate\n );\n\n huron.prototypes.forEach((prototype) => {\n const newPrototype = prototype;\n let opts = {};\n\n // Merge configured settings with default settings\n if ('string' === typeof prototype) {\n opts = Object.assign({}, defaultHTMLPluginOptions, {\n title: prototype,\n filename: `${prototype}.html`,\n });\n } else if (\n 'object' === typeof prototype &&\n {}.hasOwnProperty.call(prototype, 'title')\n ) {\n // Create filename based on configured title if not provided\n if (!prototype.filename) {\n newPrototype.filename = `${prototype.title}.html`;\n }\n\n // Move css assets for this prototype,\n // reset css option with new file paths\n if (prototype.css) {\n newPrototype.css = moveAdditionalAssets(prototype.css, 'css', huron);\n }\n\n // Move js assets for this prototype,\n // reset js option with new file paths\n if (prototype.js) {\n newPrototype.js = moveAdditionalAssets(prototype.js, 'js', huron);\n }\n\n opts = Object.assign({}, defaultHTMLPluginOptions, newPrototype);\n }\n\n // Move global css assets,\n // reset css option with new file paths\n if (huron.css.length) {\n opts.css = opts.css.concat(\n moveAdditionalAssets(huron.css, 'css', huron)\n );\n }\n\n // Move global js assets,\n // reset js option with new file paths\n if (huron.js.length) {\n opts.js = opts.js.concat(\n moveAdditionalAssets(huron.js, 'js', huron)\n );\n }\n\n // Push a new plugin for each configured prototype\n if (Object.keys(opts).length) {\n newConfig.plugins.push(\n new HTMLWebpackPlugin(opts)\n );\n }\n });\n\n return newConfig;\n}\n\n/**\n * Move relative (and local) js and css assets provided in huron options\n *\n * @param {array|string} assets - array of assets or single asset\n * @param {string} subdir - subdirectory in huron root from which to load additional asset\n * @param {object} huron - huron configuration object\n * @return {array} assetResults - paths to js and css assets\n */\nfunction moveAdditionalAssets(assets, subdir = '', huron) {\n const currentAssets = [].concat(assets);\n const assetResults = [];\n\n currentAssets.forEach((asset) => {\n const assetInfo = path.parse(asset);\n const assetURL = url.parse(asset);\n const sourcePath = path.join(cwd, asset);\n const outputPath = path.resolve(cwd, huron.root, subdir, assetInfo.base);\n const loadPath = path.join(subdir, assetInfo.base);\n let contents = false;\n\n if (\n !path.isAbsolute(asset) &&\n !assetURL.protocol\n ) {\n try {\n contents = fs.readFileSync(sourcePath);\n } catch (e) {\n console.warn(`could not read ${sourcePath}`);\n }\n\n if (contents) {\n fs.outputFileSync(outputPath, contents);\n assetResults.push(loadPath);\n }\n } else {\n assetResults.push(asset);\n }\n });\n\n return assetResults;\n}\n\n\n\n// WEBPACK FOOTER //\n// src/cli/generateConfig.js","/** @module cli/html-handler */\nimport path from 'path';\nimport fs from 'fs-extra';\n\nimport * as utils from './utils';\n\n/**\n * Handle update of an HMTL template\n *\n * @function updateHTML\n * @param {string} filepath - filepath of changed file (comes from gaze)\n * @param {object} section - contains KSS section data\n * @param {object} store - memory store\n * @return {object} updated data store\n */\nexport function updateHTML(filepath, section, store) {\n const file = path.parse(filepath);\n const content = fs.readFileSync(filepath, 'utf8');\n const newSection = section;\n\n if (content) {\n newSection.templatePath = utils.writeFile(\n section.referenceURI,\n 'template',\n filepath,\n content,\n store\n );\n newSection.templateContent = content;\n\n // Rewrite section data with template content\n newSection.sectionPath = utils.writeSectionData(store, newSection);\n\n return store\n .setIn(\n ['sections', 'sectionsByPath', section.kssPath],\n newSection\n )\n .setIn(\n ['sections', 'sectionsByURI', section.referenceURI],\n newSection\n );\n }\n\n console.log(`File ${file.base} could not be read`);\n return store;\n}\n\n/**\n * Handle removal of an HMTL template\n *\n * @function deleteHTML\n * @param {string} filepath - filepath of changed file (comes from gaze)\n * @param {object} section - contains KSS section data\n * @param {object} store - memory store\n * @return {object} updated data store\n */\nexport function deleteHTML(filepath, section, store) {\n const newSection = section;\n\n utils.removeFile(\n newSection.referenceURI,\n 'template',\n filepath,\n store\n );\n\n delete newSection.templatePath;\n\n return store\n .setIn(\n ['sections', 'sectionsByPath', section.kssPath],\n newSection\n )\n .setIn(\n ['sections', 'sectionsByURI', section.referenceURI],\n newSection\n );\n}\n\n/**\n * Handle update for a prototype file\n *\n * @function updatePrototype\n * @param {string} filepath - filepath of changed file (comes from gaze)\n * @param {object} store - memory store\n * @return {object} updated data store\n */\nexport function updatePrototype(filepath, store) {\n const file = path.parse(filepath);\n const content = fs.readFileSync(filepath, 'utf8');\n\n if (content) {\n const requirePath = utils.writeFile(\n file.name,\n 'prototype',\n filepath,\n content,\n store\n );\n\n return store.setIn(\n ['prototypes', file.name],\n requirePath\n );\n }\n\n console.log(`File ${file.base} could not be read`);\n return store;\n}\n\n/**\n * Handle removal of a prototype file\n *\n * @function deletePrototype\n * @param {string} filepath - filepath of changed file (comes from gaze)\n * @param {object} store - memory store\n * @return {object} updated data store\n */\nexport function deletePrototype(filepath, store) {\n const file = path.parse(filepath);\n const requirePath = utils.removeFile(\n file.name,\n 'prototype',\n filepath,\n store\n );\n\n return store.setIn(\n ['prototypes', file.name],\n requirePath\n );\n}\n\n\n\n// WEBPACK FOOTER //\n// src/cli/handleHTML.js","/** @module cli/kss-handler */\n\nimport path from 'path';\nimport fs from 'fs-extra';\nimport { parse } from 'kss';\nimport chalk from 'chalk';\n\nimport * as utils from './utils';\nimport { updateTemplate, deleteTemplate } from './handleTemplates';\nimport { writeStore } from './requireTemplates';\n\n/**\n * Handle update of a KSS section\n *\n * @function updateKSS\n * @param {string} filepath - filepath of changed file (comes from gaze)\n * @param {object} store - memory store\n * @return {object} updated data store\n */\nexport function updateKSS(filepath, store) {\n const kssSource = fs.readFileSync(filepath, 'utf8');\n const huron = store.get('config');\n const oldSection = utils.getSection(filepath, false, store) || {};\n const file = path.parse(filepath);\n let newStore = store;\n\n if (kssSource) {\n const styleguide = parse(kssSource, huron.get('kssOptions'));\n\n if (styleguide.data.sections.length) {\n const section = utils.normalizeSectionData(\n styleguide.data.sections[0]\n );\n\n if (section.reference && section.referenceURI) {\n // Update or add section data\n newStore = updateSectionData(\n filepath,\n section,\n oldSection,\n newStore\n );\n\n // Remove old section data if reference URI has changed\n if (oldSection &&\n oldSection.referenceURI &&\n oldSection.referenceURI !== section.referenceURI\n ) {\n newStore = unsetSection(oldSection, file, newStore, false);\n }\n\n writeStore(newStore);\n console.log(\n chalk.green(\n `KSS source in ${filepath} changed or added`\n )\n );\n return newStore;\n }\n\n console.log(\n chalk.magenta(\n `KSS section in ${filepath} is missing a section reference`\n )\n );\n return newStore;\n }\n\n console.log(chalk.magenta(`No KSS found in ${filepath}`));\n return newStore;\n }\n\n if (oldSection) {\n newStore = deleteKSS(filepath, oldSection, newStore);\n }\n\n console.log(chalk.red(`${filepath} not found or empty`)); // eslint-disable-line no-console\n return newStore;\n}\n\n/**\n * Handle removal of a KSS section\n *\n * @function deleteKSS\n * @param {string} filepath - filepath of changed file (comes from gaze)\n * @param {object} section - KSS section data\n * @param {object} store - memory store\n * @return {object} updated data store\n */\nexport function deleteKSS(filepath, section, store) {\n const file = path.parse(filepath);\n\n if (section.reference && section.referenceURI) {\n // Remove section data from memory store\n return unsetSection(section, file, store, true);\n }\n\n return store;\n}\n\n/**\n * Update the sections store with new data for a specific section\n *\n * @function updateSectionData\n * @param {object} section - contains updated section data\n * @param {string} kssPath - path to KSS section\n * @param {object} store - memory store\n * @return {object} updated data store\n */\nfunction updateSectionData(kssPath, section, oldSection, store) {\n const sectionFileInfo = path.parse(kssPath);\n const dataFilepath = path.join(\n sectionFileInfo.dir,\n `${sectionFileInfo.name}.json`\n );\n const isInline = null !== section.markup.match(/<\\/[^>]*>/);\n const newSort = sortSection(\n store.getIn(['sections', 'sorted']),\n section.reference,\n store.get('referenceDelimiter')\n );\n const newSection = Object.assign({}, oldSection, section);\n let newStore = store;\n\n // Required for reference from templates and data\n newSection.kssPath = kssPath;\n\n if (isInline) {\n // Set section value if inlineTempalte() returned a path\n newStore = updateInlineTemplate(\n kssPath,\n oldSection,\n newSection,\n newStore\n );\n } else {\n // Remove inline template, if it exists\n utils.removeFile(\n newSection.referenceURI,\n 'template',\n kssPath,\n store\n );\n // Update markup and data fields\n newStore = updateTemplateFields(\n sectionFileInfo,\n oldSection,\n newSection,\n newStore\n );\n }\n\n // Output section description\n newStore = updateDescription(\n kssPath,\n oldSection,\n newSection,\n newStore\n );\n\n // Output section data to a JSON file\n newSection.sectionPath = utils.writeSectionData(\n newStore,\n newSection,\n dataFilepath\n );\n\n // Update section sorting\n return newStore\n .setIn(\n ['sections', 'sorted'],\n newSort\n )\n .setIn(\n ['sections', 'sectionsByPath', kssPath],\n newSection\n )\n .setIn(\n ['sections', 'sectionsByURI', section.referenceURI],\n newSection\n );\n}\n\n/**\n * Handle detection and output of inline templates, which is markup written\n * in the KSS documentation itself as opposed to an external file\n *\n * @function updateInlineTemplate\n * @param {string} oldSection - previous iteration of KSS data, if updated\n * @param {object} section - KSS section data\n * @return {object} updated data store with new template path info\n */\nfunction updateInlineTemplate(filepath, oldSection, section, store) {\n const newSection = section;\n const newStore = store;\n\n // If we have inline markup\n if (fieldShouldOutput(oldSection, section, 'markup')) {\n newSection.templatePath = utils.writeFile(\n section.referenceURI,\n 'template',\n filepath,\n section.markup,\n store\n );\n newSection.templateContent = section.markup;\n\n return newStore\n .setIn(\n ['sections', 'sectionsByPath', filepath],\n newSection\n )\n .setIn(\n ['sections', 'sectionsByURI', section.referenceURI],\n newSection\n );\n }\n\n return newStore;\n}\n\n/**\n * Handle output of section description\n *\n * @function updateDescription\n * @param {string} oldSection - previous iteration of KSS data, if updated\n * @param {object} section - KSS section data\n * @return {object} updated data store with new descripton path info\n */\nfunction updateDescription(filepath, oldSection, section, store) {\n const newSection = section;\n const newStore = store;\n\n // If we don't have previous KSS or the KSS has been updated\n if (fieldShouldOutput(oldSection, section, 'description')) {\n // Write new description\n newSection.descriptionPath = utils.writeFile(\n section.referenceURI,\n 'description',\n filepath,\n section.description,\n store\n );\n\n return newStore\n .setIn(\n ['sections', 'sectionsByPath', filepath],\n newSection\n )\n .setIn(\n ['sections', 'sectionsByURI', section.referenceURI],\n newSection\n );\n }\n\n return newStore;\n}\n\n/**\n * Handle Data and Markup fields\n *\n * @function updateTemplateFields\n * @param {string} file - File data for KSS file from path.parse()\n * @param {object} oldSection - outdated KSS data\n * @param {object} section - KSS section data\n * @param {object} store - memory store\n * @return {object} KSS section data with updated asset paths\n */\nfunction updateTemplateFields(file, oldSection, section, store) {\n const kssPath = path.format(file);\n const newSection = section;\n let filepath = '';\n let oldFilepath = '';\n let newStore = store;\n\n ['data', 'markup'].forEach((field) => {\n if (newSection[field]) {\n if (oldSection[field]) {\n oldFilepath = path.join(file.dir, oldSection[field]);\n newStore = deleteTemplate(\n oldFilepath,\n oldSection,\n newStore\n );\n }\n\n filepath = path.join(file.dir, newSection[field]);\n newStore = updateTemplate(\n filepath,\n newSection,\n newStore\n );\n } else {\n delete newSection[field];\n newStore = newStore\n .setIn(\n ['sections', 'sectionsByPath', kssPath],\n newSection\n )\n .setIn(\n ['sections', 'sectionsByURI', newSection.referenceURI],\n newSection\n );\n }\n });\n\n return newStore;\n}\n\n/**\n * Remove a section from the memory store\n *\n * @function unsetSection\n * @param {object} section - contains updated section data\n * @param {string} file - file object from path.parse()\n * @param {object} store - memory store\n * @param {bool} removed - has the file been removed or just the section information changed?\n * @return {object} updated data store with new descripton path info\n */\nfunction unsetSection(section, file, store, removed) {\n const sorted = store.getIn(['sections', 'sorted']);\n const kssPath = path.format(file);\n const dataFilepath = path.join(file.dir, `${file.name}.json`);\n const isInline = section.markup &&\n null !== section.markup.match(/<\\/[^>]*>/);\n const newSort = unsortSection(\n sorted,\n section.reference,\n store.get('referenceDelimiter')\n );\n let newStore = store;\n\n // Remove old section data\n utils.removeFile(\n section.referenceURI,\n 'section',\n dataFilepath,\n newStore\n );\n\n // Remove associated inline template\n if (isInline) {\n utils.removeFile(section.referenceURI, 'template', kssPath, newStore);\n }\n\n // Remove description template\n utils.removeFile(section.referenceURI, 'description', kssPath, newStore);\n\n // Remove data from sectionsByPath if file has been removed\n if (removed) {\n newStore = newStore.deleteIn(['sections', 'sectionsByPath', kssPath]);\n }\n\n return newStore\n .deleteIn(['sections', 'sectionsByURI', section.referenceURI])\n .setIn(['sections', 'sorted'], newSort);\n}\n\n/**\n * Sort sections and subsections\n *\n * @function sortSection\n * @param {object} sorted - currently sorted sections\n * @param {string} reference - reference URI of section to sort\n * @return {object} updated data store with new descripton path info\n */\nfunction sortSection(sorted, reference, delimiter) {\n const parts = reference.split(delimiter);\n const newSort = sorted[parts[0]] || {};\n const newSorted = sorted;\n\n if (1 < parts.length) {\n const newParts = parts.filter((part, idx) => 0 !== idx);\n newSorted[parts[0]] = sortSection(\n newSort,\n newParts.join(delimiter),\n delimiter\n );\n } else {\n newSorted[parts[0]] = newSort;\n }\n\n return newSorted;\n}\n\n/**\n * Remove a section from the sorted sections\n *\n * @function unsortSection\n * @param {object} sorted - currently sorted sections\n * @param {string} reference - reference URI of section to sort\n * @return {object} updated data store with new descripton path info\n */\nfunction unsortSection(sorted, reference, delimiter) {\n const parts = reference.split(delimiter);\n const subsections = Object.keys(sorted[parts[0]]);\n const newSorted = sorted;\n\n if (subsections.length) {\n if (1 < parts.length) {\n const newParts = parts.filter((part, idx) => 0 !== idx);\n newSorted[parts[0]] = unsortSection(\n newSorted[parts[0]],\n newParts.join(delimiter),\n delimiter\n );\n }\n } else {\n delete newSorted[parts[0]];\n }\n\n return newSorted;\n}\n\n/**\n * Compare a KSS field between old and new KSS data to see if we need to output\n * a new module for that field\n *\n * @function fieldShouldOutput\n * @param {object} oldSection - currently sorted sections\n * @param {object} newSection - reference URI of section to sort\n * @param {string} field - KSS field to check\n * @return {bool} output a new module for the KSS field\n */\nfunction fieldShouldOutput(oldSection, newSection, field) {\n return (oldSection &&\n (oldSection[field] !== newSection[field] ||\n oldSection.referenceURI !== newSection.referenceURI)\n ) ||\n !oldSection;\n}\n\n\n\n// WEBPACK FOOTER //\n// src/cli/handleKSS.js","// Necessary to remove require statement from Webpack processing preserve it in output\n/* eslint-disable import/no-dynamic-require, global-require */\nexport default function requireExternal(requirePath) {\n return require(requirePath);\n}\n/* eslint-enable */\n\n\n\n// WEBPACK FOOTER //\n// src/cli/requireExternal.js","/** @module cli/webpack-server */\nimport webpack from 'webpack';\nimport WebpackDevServer from 'webpack-dev-server';\nimport chalk from 'chalk';\nimport open from 'opn';\n\nimport createDevServerConfig from '../../config/devServer.config';\nimport program from './parseArgs';\nimport { removeTrailingSlash } from './utils';\n\n/**\n * Spin up webpack-dev-server or, if production flag is set, run webpack a single time\n *\n * @function startWebpack\n * @param {object} config - webpack configuration, preprocessed by {@link module:cli/generate-config generateConfig}\n * @see {@link module:cli/generate-config generateConfig}\n */\nexport default function startWebpack(config) {\n const huron = config.huron;\n const webpackConfig = config.webpack;\n const compiler = webpack(webpackConfig);\n\n if (program.progress) {\n compiler.apply(\n new webpack.ProgressPlugin(\n (percentage, msg) => {\n console.log(`${(percentage * 100)}% `, msg);\n }\n )\n );\n }\n\n if (program.production) {\n compiler.run((err, stats) => {\n const info = stats.toJson();\n\n if (err) {\n console.log(err);\n }\n\n if (stats.hasErrors()) {\n console.error(\n chalk.red(\n 'Webpack encountered errors during compile: ',\n info.errors\n )\n );\n }\n\n if (stats.hasWarnings()) {\n console.error(\n chalk.yellow(\n 'Webpack encountered warnings during compile: ', info.warnings\n )\n );\n }\n });\n } else {\n const server = new WebpackDevServer(compiler, createDevServerConfig(huron));\n const prototypeName = huron.prototypes[0].title || huron.prototypes[0];\n\n server.listen(\n huron.port,\n 'localhost',\n (err) => {\n if (err) {\n return console.log(err);\n }\n\n console.log(`Listening at http://localhost:${huron.port}/`);\n open(`http://localhost:${huron.port}/${\n removeTrailingSlash(huron.root)\n }/${prototypeName}.html`);\n return true;\n }\n );\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// src/cli/server.js","import path from 'path';\n\nexport default {\n css: [],\n entry: 'huron',\n js: [],\n kss: 'css/',\n kssExtension: '.css',\n kssOptions: {\n multiline: true,\n markdown: true,\n custom: ['data'],\n },\n output: 'partials',\n port: 8080,\n prototypes: ['index'],\n root: 'dist/',\n sectionTemplate: path.join(__dirname, '../../templates/section.hbs'),\n classNames: false,\n templates: {\n rule: {\n test: /\\.(hbs|handlebars)$/,\n use: 'handlebars-loader',\n },\n extension: '.hbs',\n },\n window: {},\n};\n\n\n\n// WEBPACK FOOTER //\n// src/defaultConfig/huron.config.js","import webpack from 'webpack';\nimport path from 'path';\n\nimport program from '../cli/parseArgs';\n\nexport default (huron) => {\n const cwd = process.cwd();\n\n return {\n entry: {},\n output: {\n path: path.join(cwd, huron.root),\n publicPath: program.production ? '' :\n `/${huron.root}`,\n filename: '[name].js',\n chunkFilename: '[name].chunk.min.js',\n },\n plugins: [\n new webpack.HotModuleReplacementPlugin(),\n new webpack.NamedModulesPlugin(),\n ],\n resolve: {\n modulesDirectories: [\n path.resolve(__dirname, '../src/js'),\n ],\n },\n resolveLoader: {\n modulesDirectories: [\n 'web_loaders',\n 'web_modules',\n 'node_loaders',\n 'node_modules',\n path.resolve(__dirname, '../node_modules'),\n ],\n },\n module: {\n rules: [\n {\n test: /\\.html$/,\n include: [path.join(cwd, huron.root, huron.output)],\n use: 'html-loader',\n },\n {\n test: /\\.(hbs|handlebars)$/,\n include: [path.join(cwd, huron.root, 'huron-assets')],\n use: {\n loader: 'handlebars-loader',\n options: {\n helperDirs: [path.join(\n __dirname,\n '../../',\n 'templates/handlebarsHelpers'\n )],\n },\n },\n },\n ],\n },\n };\n};\n\n\n\n// WEBPACK FOOTER //\n// src/defaultConfig/webpack.config.js","module.exports = \"'use strict';\\n\\nvar _huronStore = require('./huron-store');\\n\\nvar _huronStore2 = _interopRequireDefault(_huronStore);\\n\\nvar _insertNodes = require('./insertNodes');\\n\\nvar _insertNodes2 = _interopRequireDefault(_insertNodes);\\n\\nvar _section = require('./section.hbs');\\n\\nvar _section2 = _interopRequireDefault(_section);\\n\\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\\n\\n/* eslint-enable */\\n\\nconst assets = require.context(hotScope.requirePath, true, hotScope.requireRegex); /* globals hotScope */\\n\\n// NOTE: This is not a normal JS file! It is pulled in by the CLI as a string\\n// and prepended to the browser script after replacing anything referenced via `hotScope[variable]`\\n// with CLI arguments or config properties passed in by the user.\\n\\n/* eslint-disable */\\n\\nconst modules = {};\\n\\nmodules[hotScope.sectionTemplatePath] = _section2.default;\\n\\nassets.keys().forEach(key => {\\n modules[key] = assets(key);\\n});\\n\\nconst insert = new _insertNodes2.default(modules, _huronStore2.default);\\n\\nif (module.hot) {\\n // Hot Module Replacement for huron components (json, hbs, html)\\n module.hot.accept(assets.id, () => {\\n const newAssets = require.context(hotScope.requirePath, true, hotScope.requireRegex);\\n const newModules = newAssets.keys().map(key => [key, newAssets(key)]).filter(newModule => modules[newModule[0]] !== newModule[1]);\\n\\n updateStore(require('./huron-store.js')); // eslint-disable-line global-require, import/no-unresolved\\n newModules.forEach(module => {\\n modules[module[0]] = module[1];\\n hotReplace(module[0], module[1], modules);\\n });\\n });\\n\\n // Hot Module Replacement for sections template\\n module.hot.accept('./section.hbs', () => {\\n const newSectionTemplate = require('./section.hbs'); // eslint-disable-line global-require, import/no-unresolved\\n\\n modules[hotScope.sectionTemplatePath] = newSectionTemplate;\\n hotReplace('./huron-assets/section.hbs', newSectionTemplate, modules);\\n });\\n\\n // Hot Module Replacement for data store\\n module.hot.accept('./huron-store.js', () => {\\n updateStore(require('./huron-store.js')); // eslint-disable-line global-require, import/no-unresolved\\n });\\n}\\n\\nfunction hotReplace(key, module, newModules) {\\n insert.modules = newModules;\\n if (key === _huronStore2.default.sectionTemplatePath) {\\n insert.cycleSections();\\n } else {\\n insert.inserted = [];\\n insert.loadModule(key, module, false);\\n }\\n}\\n\\nfunction updateStore(newStore) {\\n insert.store = newStore;\\n}\"\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/raw-loader!./~/babel-loader/lib!./templates/hotTemplate.js\n// module id = 20\n// module chunks = 0","module.exports = require(\"commander\");\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"commander\"\n// module id = 21\n// module chunks = 0","module.exports = require(\"gaze\");\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"gaze\"\n// module id = 22\n// module chunks = 0","module.exports = require(\"html-webpack-plugin\");\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"html-webpack-plugin\"\n// module id = 23\n// module chunks = 0","module.exports = require(\"immutable\");\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"immutable\"\n// module id = 24\n// module chunks = 0","module.exports = require(\"kss\");\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"kss\"\n// module id = 25\n// module chunks = 0","module.exports = require(\"lodash/isEqual\");\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"lodash/isEqual\"\n// module id = 26\n// module chunks = 0","module.exports = require(\"opn\");\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"opn\"\n// module id = 27\n// module chunks = 0","module.exports = require(\"url\");\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"url\"\n// module id = 28\n// module chunks = 0","module.exports = require(\"webpack-dev-server\");\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"webpack-dev-server\"\n// module id = 29\n// module chunks = 0"],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;A;;;;AChEA;;;;;;;;;;;;ACcA;AAkBA;AAqCA;AAqCA;AAcA;AAkBA;AAyBA;AA4CA;AAyCA;AAyBA;AAyBA;AAqBA;AA6CA;AACA;AA5WA;AACA;;;AAAA;AACA;;;AAAA;AACA;;;;;AACA;AACA;AACA;;;;;;;AAPA;AAcA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;AAQA;AACA;AACA;AACA;AACA;AACA;AACA;AAIA;AACA;AACA;AACA;AACA;AAOA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;;;;;;;;AAQA;AACA;AACA;AACA;AACA;AACA;AAIA;AACA;AACA;AAGA;AACA;AASA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;AAOA;AACA;AAGA;AACA;AACA;;;;;;;;AAQA;AACA;AACA;AACA;;AAFA;AAKA;AACA;AACA;;;;;;;;;;AAUA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;AAUA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAIA;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;AAQA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAIA;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;AAQA;AACA;AACA;AACA;AACA;AACA;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;AAQA;AACA;AAGA;AACA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;AAQA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;AASA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;AAOA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;AClXA;;;;;;ACAA;;;;;;;;;;;;;ACGA;AACA;;;AAAA;AACA;;;;;AACA;AACA;AACA;AACA;;;;;;AATA;AACA;AACA;AAaA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAYA;AACA;AACA;AACA;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;ACzDA;;;;;;;;;;;;;;ACAA;AACA;AACA;AACA;;;AAAA;AACA;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;AAKA;AACA;AAQA;AACA;AACA;AACA;AACA;AACA;AAHA;AAKA;AACA;AACA;AACA;AAnBA;AAqBA;AACA;AACA;AAAA;;;;;;;;;;;;ACzBA;AA0DA;AACA;AA1EA;AACA;;;AAAA;AACA;;;AAAA;AACA;;;AACA;AACA;AADA;AACA;;;;;AACA;;;;;;;;;AAPA;AAgBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAOA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAaA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;AASA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAMA;AACA;AACA;AAUA;;;;;;;;;;;;;;AClGA;AACA;;;AAAA;AACA;;;AAIA;AACA;;;;;AAAA;AACA;AACA;AACA;AAPA;AACA;AACA;AANA;AACA;AAUA;AACA;AAIA;;;;;;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA;AALA;AAOA;AACA;AAOA;AACA;AAIA;AAIA;AACA;AACA;;;;;;;AAOA;AACA;AACA;AACA;AACA;AACA;AACA;AAIA;;;;;;;;;ACxEA;AACA;;;AACA;AACA;AAKA;AACA;AAAA;AACA;AAAA;AACA;;;AAAA;AACA;;;AAAA;AACA;AAAA;AACA;;;;;AACA;;;;;AAhBA;AAqBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;AAOA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;AAOA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;AAOA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;AAOA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;ACvGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AATA;AAWA;AAjBA;;;;;;;;;;;;ACwBA;AA8CA;AA+DA;AA0DA;AACA;AA7LA;AACA;;;AAAA;AACA;;;AAAA;AACA;;;AACA;AACA;AAKA;AACA;AAAA;AACA;AAAA;AACA;AADA;AACA;;;;;AACA;;;;;;;AAOA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAIA;AACA;AACA;AACA;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA1BA;AACA;AA4BA;AACA;AACA;AACA;;;;;;;AA/DA;AACA;AACA;AAoEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAxCA;AACA;AA0CA;AACA;AACA;AACA;;;;;;;AAOA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AArCA;AACA;AAuCA;AACA;AACA;AACA;;;;;;;;AAQA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;AC5MA;AACA;AAAA;AACA;;;AACA;AACA;AAAA;AACA;;;AACA;;;;;AAKA;AACA;AACA;;;;;AAKA;AACA;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AAGA;AACA;AACA;;;;;AAKA;AACA;AACA;;;;;;;;;;;;ACtBA;AACA;AA9BA;AACA;;;AAAA;AACA;;;AAAA;AACA;;;AAAA;AACA;;;AAAA;AACA;;;AACA;AACA;;;AAAA;AACA;;;AAAA;AACA;;;AAAA;AACA;;;;;AACA;AACA;AACA;AAdA;AAeA;AACA;AAGA;AACA;AAGA;;;;;;;AAOA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAFA;AAIA;AACA;AACA;;;;;;;AAOA;AACA;AACA;AACA;AACA;AACA;AACA;AAKA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;;;;;;;AAOA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAIA;AACA;AAKA;AACA;AACA;AACA;AACA;AACA;;;;;;;AAOA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA;AACA;AACA;AAKA;AACA;AACA;AACA;;;;;;;AAOA;AACA;AACA;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AAKA;AACA;AAZA;AAcA;AACA;AACA;AACA;AACA;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAFA;AAIA;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;AAQA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;AC3RA;AA0CA;AA+BA;AA+BA;AACA;AAvHA;AACA;;;AAAA;AACA;;;AACA;AACA;AADA;AACA;;;;;AACA;;;;;;;;;AASA;AACA;AACA;AACA;AACA;AACA;AACA;AAOA;AACA;AACA;AACA;AACA;AACA;AASA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;AAhDA;AAyDA;AACA;AACA;AACA;AACA;AAMA;AACA;AACA;AASA;AACA;AACA;;;;;;;;AAQA;AACA;AACA;AACA;AACA;AACA;AACA;AAOA;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;AAQA;AACA;AACA;AACA;AAMA;AAIA;;;;;;;;;;;;ACjHA;AAsEA;AACA;AAxFA;AACA;;;AAAA;AACA;;;AAAA;AACA;AAAA;AACA;;;AACA;AACA;AADA;AACA;AAAA;AACA;AAAA;AACA;;;;;AACA;;;;;;;;AAQA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA;AACA;AACA;AACA;AAMA;AACA;AAIA;AACA;AACA;AACA;AACA;AAKA;AACA;AACA;AACA;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;AAhFA;AACA;AAwFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;AASA;AACA;AACA;AAIA;AACA;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAMA;AACA;AACA;AAMA;AACA;AAMA;AACA;AACA;AACA;AACA;AAMA;AACA;AACA;AAKA;AACA;AAaA;AACA;AACA;;;;;;;;;AASA;AACA;AACA;AACA;AACA;AACA;AACA;AAOA;AACA;AACA;AASA;AACA;AACA;AACA;AACA;AACA;;;;;;;;AAQA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAOA;AASA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;AAUA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAKA;AACA;AACA;AACA;AAKA;AACA;AACA;AASA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;AAUA;AACA;AACA;AACA;AACA;AAEA;AAKA;AACA;AACA;AACA;AACA;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA;AACA;AACA;;;;;;;;AAQA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;AAQA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;AAUA;AACA;AAKA;;;;;;;;;;;AC5aA;AAFA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;ACYA;AACA;AAjBA;AACA;;;AAAA;AACA;;;AAAA;AACA;;;AAAA;AACA;;;AACA;AACA;;;AAAA;AACA;;;AAAA;AACA;;;AACA;;;;;;;AAOA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAMA;AACA;AACA;AACA;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AAIA;AACA;AACA;AACA;AACA;AACA;AAGA;AACA;AAEA;AACA;;;;;;;;;;;;;AC7EA;AACA;;;;;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAHA;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAFA;AAIA;AALA;AAOA;AAxBA;;;;;;;;;;;;;ACFA;AACA;;;AAAA;AACA;;;AACA;AACA;;;;;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AALA;AAOA;AAIA;AACA;AADA;AAKA;AACA;AADA;AASA;AACA;AAEA;AACA;AACA;AAHA;AAMA;AACA;AACA;AACA;AACA;AACA;AADA;AAFA;AAHA;AAPA;AA3BA;AAmDA;;;;;;AC3DA;;;;;;ACAA;;;;;;ACAA;;;;;;ACAA;;;;;;ACAA;;;;;;ACAA;;;;;;ACAA;;;;;;ACAA;;;;;;ACAA;;;;;;ACAA;;;;;;;;;;A","sourceRoot":""} \ No newline at end of file From 342608fab04fc941df8169ffd7fdb2187e2a6ec7 Mon Sep 17 00:00:00 2001 From: Owen Stowe Date: Fri, 5 Jan 2018 12:48:06 -0500 Subject: [PATCH 5/8] Bump version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 85a3732..6e7062f 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "huron", "description": "An in-browser prototyping tool built on top of webpack and kss-node", "author": "Alley Interactive", - "version": "2.3.2", + "version": "2.3.3-beta.0", "license": "GPL-2.0", "repository": { "type": "git", From 8812cd0ccc16c89dd7437e0a5c37563f4775aabe Mon Sep 17 00:00:00 2001 From: Ryan Domingue Date: Fri, 5 Jan 2018 10:39:37 -0800 Subject: [PATCH 6/8] Updates Webpack dependency to greater than 2.6.1; version bump --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index d33bca2..de1e818 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "huron", "description": "An in-browser prototyping tool built on top of webpack and kss-node", "author": "Alley Interactive", - "version": "2.3.1", + "version": "2.3.3-beta.0", "license": "GPL-2.0", "repository": { "type": "git", @@ -51,7 +51,7 @@ "lodash": "^4.17.4", "opn": "^5.1.0", "style-loader": "0.13.1", - "webpack": "^2.6.1 || ^3.7.1", + "webpack": ">=2.6.1", "webpack-dev-server": "^2.9.3" }, "devDependencies": { From 0aa474f34fda2e35aa495330053eb7f4200eea06 Mon Sep 17 00:00:00 2001 From: Owen Stowe Date: Mon, 8 Jan 2018 10:11:27 -0500 Subject: [PATCH 7/8] Bump beta version again --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 6e7062f..86a2cc9 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "huron", "description": "An in-browser prototyping tool built on top of webpack and kss-node", "author": "Alley Interactive", - "version": "2.3.3-beta.0", + "version": "2.3.3-beta.1", "license": "GPL-2.0", "repository": { "type": "git", From c8e35888367c96958a5e06172fcfccc129f93613 Mon Sep 17 00:00:00 2001 From: Owen Stowe Date: Mon, 8 Jan 2018 12:22:02 -0500 Subject: [PATCH 8/8] set master version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index b858094..41f6705 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "huron", "description": "An in-browser prototyping tool built on top of webpack and kss-node", "author": "Alley Interactive", - "version": "2.3.3-beta.1", + "version": "2.3.3", "license": "GPL-2.0", "repository": { "type": "git",