Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 | // Copyright (c) 2015-present, salesforce.com, inc. All rights reserved // Licensed under BSD 3-Clause - see LICENSE.txt or git.io/sfdc-license const I = require('immutable-ext'); const Either = require('data.either'); const { ui, variants } = require('../ui'); const FOLDERNAME = '__internal'; const webpackPath = prefix => filepath => { const pathSegments = filepath.concat('.js').split('/'); return `${prefix}/${pathSegments.join('/')}`; }; const setKeyIfExists = (keypath, fixFilePath) => (entry, item) => Either.fromNullable(item.get(keypath)).fold( () => entry, result => entry.set(fixFilePath(result), result) ); const chunkedDocsEntry = (ui, fixFilePath) => ui.reduce( (entry, group) => group.reduce(setKeyIfExists('docPath', fixFilePath), entry), I.Map() ); const chunkedShowcaseEntry = (ui, fixFilePath) => { const setShowcase = setKeyIfExists('showcasePath', fixFilePath); return ui.reduce( (entry, group, groupName) => group.reduce( (entry, item, name) => groupName === 'utilities' ? setShowcase(entry, item) : variants(item).reduce(setShowcase, entry), entry ), I.Map() ); }; const chunkedEntry = ui().map(ui => I.Map({ [`${FOLDERNAME}/chunked/showcase`]: chunkedShowcaseEntry, [`${FOLDERNAME}/chunked/docs`]: chunkedDocsEntry }).map((createEntry, prefix) => createEntry(ui, webpackPath(prefix))) ); const manifest = chunkedEntry.map(entryMap => entryMap.reduce( (manifest, entries, prefix) => manifest .merge(entries.flip()) // Need to add a common "entry" with a name that can be referenced // in design-system-site .set( `${I.List(prefix.split('/')).last()}/common`, `${prefix}/common.js` ), I.Map({}) ) ); module.exports = { FOLDERNAME, chunkedEntry, manifest }; |