Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const getLocalPageRootPath = pageOrLightboxItem =>
sc.matchItem(pageOrLightboxItem, {
[sc.page]: pageRootPath,
[sc.pageWithCode]: ({ page }) => pageRootPath(page),
[sc.lightbox]: lightboxRootPath,
[sc.lightboxWithCode]: ({ lightbox }) => lightboxRootPath(lightbox)
});
const itemToFile = item =>
sc.matchItem(item, {
[sc.page]: page,
[sc.pageWithCode]: pageWithCode,
[sc.lightbox]: lightbox,
[sc.lightboxWithCode]: lightboxWithCode,
[sc.router]: router,
[sc.menu]: menu,
[sc.colors]: colors,
[sc.fonts]: fonts,
[sc.theme]: theme,
[sc.topLevelStyles]: topLevelStyles,
[sc.commonComponents]: commonComponents,
[sc.multilingualInfo]: multilingualInfo,
[sc.siteInfo]: siteInfo,
[sc.version]: version,
[sc.publicCode]: publicCodeFile,
[sc.backendCode]: backendCodeFile,
const getLocalFilePath = (siteItem, partKey) => {
const file = itemToFile(siteItem);
const pickValue = paths => (isUndefined_(partKey) ? paths : paths[partKey]);
return sc.matchItem(siteItem, {
[sc.page]: () =>
pickValue({
page: file[0].path,
code: file[1].path,
tsConfig: file[2].path,
typings: file[3].path
}),
[sc.pageWithCode]: () =>
pickValue({
page: file[0].path,
code: file[1].path,
tsConfig: file[2].path,
typings: file[3].path
}),
[sc.lightbox]: () =>
pickValue({
[sc.page]: page,
[sc.pageWithCode]: pageWithCode,
[sc.lightbox]: lightbox,
[sc.lightboxWithCode]: lightboxWithCode,
[sc.router]: router,
[sc.menu]: menu,
[sc.colors]: colors,
[sc.fonts]: fonts,
[sc.theme]: theme,
[sc.topLevelStyles]: topLevelStyles,
[sc.commonComponents]: commonComponents,
[sc.multilingualInfo]: multilingualInfo,
[sc.siteInfo]: siteInfo,
[sc.version]: version,
[sc.publicCode]: publicCodeFile,
[sc.backendCode]: backendCodeFile,
[sc.collectionSchema]: collectionSchema,
[sc.corvidPackageJson]: corvidPackageJson,
[sc.masterPageCode]: masterPageCode
});
[sc.pageWithCode]: pageWithCode,
[sc.lightbox]: lightbox,
[sc.lightboxWithCode]: lightboxWithCode,
[sc.router]: router,
[sc.menu]: menu,
[sc.colors]: colors,
[sc.fonts]: fonts,
[sc.theme]: theme,
[sc.topLevelStyles]: topLevelStyles,
[sc.commonComponents]: commonComponents,
[sc.multilingualInfo]: multilingualInfo,
[sc.siteInfo]: siteInfo,
[sc.version]: version,
[sc.publicCode]: publicCodeFile,
[sc.backendCode]: backendCodeFile,
[sc.collectionSchema]: collectionSchema,
[sc.corvidPackageJson]: corvidPackageJson,
[sc.masterPageCode]: masterPageCode
});
const itemToFile = item =>
sc.matchItem(item, {
[sc.page]: page,
[sc.pageWithCode]: pageWithCode,
[sc.lightbox]: lightbox,
[sc.lightboxWithCode]: lightboxWithCode,
[sc.router]: router,
[sc.menu]: menu,
[sc.colors]: colors,
[sc.fonts]: fonts,
[sc.theme]: theme,
[sc.topLevelStyles]: topLevelStyles,
[sc.commonComponents]: commonComponents,
[sc.multilingualInfo]: multilingualInfo,
[sc.siteInfo]: siteInfo,
[sc.version]: version,
[sc.publicCode]: publicCodeFile,
[sc.backendCode]: backendCodeFile,
[sc.collectionSchema]: collectionSchema,
[sc.corvidPackageJson]: corvidPackageJson,
[sc.masterPageCode]: masterPageCode
});
const itemToFile = item =>
sc.matchItem(item, {
[sc.page]: page,
[sc.pageWithCode]: pageWithCode,
[sc.lightbox]: lightbox,
[sc.lightboxWithCode]: lightboxWithCode,
[sc.router]: router,
[sc.menu]: menu,
[sc.colors]: colors,
[sc.fonts]: fonts,
[sc.theme]: theme,
[sc.topLevelStyles]: topLevelStyles,
[sc.commonComponents]: commonComponents,
[sc.multilingualInfo]: multilingualInfo,
[sc.siteInfo]: siteInfo,
[sc.version]: version,
[sc.publicCode]: publicCodeFile,
[sc.backendCode]: backendCodeFile,
[sc.collectionSchema]: collectionSchema,
[sc.corvidPackageJson]: corvidPackageJson,
[sc.masterPageCode]: masterPageCode
});
[sc.lightbox]: lightbox,
[sc.lightboxWithCode]: lightboxWithCode,
[sc.router]: router,
[sc.menu]: menu,
[sc.colors]: colors,
[sc.fonts]: fonts,
[sc.theme]: theme,
[sc.topLevelStyles]: topLevelStyles,
[sc.commonComponents]: commonComponents,
[sc.multilingualInfo]: multilingualInfo,
[sc.siteInfo]: siteInfo,
[sc.version]: version,
[sc.publicCode]: publicCodeFile,
[sc.backendCode]: backendCodeFile,
[sc.collectionSchema]: collectionSchema,
[sc.corvidPackageJson]: corvidPackageJson,
[sc.masterPageCode]: masterPageCode
});
const getElementsMapFromEncodedContent = content => {
const { elementsMap } = sc.decodePageContent(content);
return elementsMap;
};
const itemToFile = item =>
sc.matchItem(item, {
[sc.page]: page,
[sc.pageWithCode]: pageWithCode,
[sc.lightbox]: lightbox,
[sc.lightboxWithCode]: lightboxWithCode,
[sc.router]: router,
[sc.menu]: menu,
[sc.colors]: colors,
[sc.fonts]: fonts,
[sc.theme]: theme,
[sc.topLevelStyles]: topLevelStyles,
[sc.commonComponents]: commonComponents,
[sc.multilingualInfo]: multilingualInfo,
[sc.siteInfo]: siteInfo,
[sc.version]: version,
[sc.publicCode]: publicCodeFile,
[sc.backendCode]: backendCodeFile,
[sc.collectionSchema]: collectionSchema,
[sc.corvidPackageJson]: corvidPackageJson,
[sc.masterPageCode]: masterPageCode
});