Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const processOptions = options0 => {
let options = options0;
if (options.single) {
options = merge(options, { src: [] });
} else {
// If workspaces are enabled in the monorepo, some configuration is
// overriden by the monorepo package.json
if (monorepoPkg.workspaces) {
let src = monorepoPkg.workspaces;
if (isObject(src)) src = src.packages;
if (!src) {
throw new Error('Could not find correct config for Yarn workspaces');
}
options = merge(options, { src, workspaces: true });
}
// Add extra configuration in the `oao` field of the monorepo package.json
options = addDefaults(options, { ignoreSrc: OAO_CONFIG.ignoreSrc });
}
const rxRecords = (state0, action, settings) => {
let state = state0;
const { records, fPastRecords, fShorthandForDuplicates } = action;
const options = timm.merge(settings, { fPastRecords, fShorthandForDuplicates });
const newStories = [];
for (let i = 0, len = records.length; i < len; i++) {
const record = records[i];
if (record.signalType) continue;
if (record.fStory) {
const [tempState, pathStr] = rxStory(state, record, options);
state = tempState;
if (pathStr) newStories.push(pathStr);
} else {
state = rxLog(state, record, options);
}
}
// Don't expand stories that are already closed upon reception
for (let j = 0, len1 = newStories.length; j < len1; j++) {
const pathStr = newStories[j];
async function updateConfig(
newAttrs: Object,
{ story }: { story: StoryT }
): Promise {
const prevLangs = _config.langs;
const updatedConfig = merge(_config, newAttrs);
_config = updatedConfig;
story.debug('db', 'New config:', { attach: updatedConfig });
saveConfig({ story });
debouncedCompileTranslations({ story });
await delay(RESPONSE_DELAY);
publish('updatedConfig', { config: updatedConfig });
updateStats();
// If new langs have been added, add automatic translations
const langs = _config.langs;
let hasNewLangs = false;
for (let i = 0; i < langs.length; i++) {
const lang = langs[i];
if (prevLangs.indexOf(lang) < 0) {
hasNewLangs = true;
break;
childrenFolderPaths: [
'-/path/to/folder/super/nested/folder',
'-/path/to/folder/subdir',
],
childrenFolderDirtyFlags: [false, false],
});
export const FOLDER_WITH_SUBFOLDERS = merge(FOLDER_BASE, {
childrenFolderPaths: [
'-/path/to/folder/super/nested/folder',
'-/path/to/folder/subdir',
],
childrenFolderDirtyFlags: [false, false],
});
export const FOLDER_WITH_SUITES = merge(FOLDER_BASE, {
filePaths: [
'-/path/to/folder/suite1.snap',
'-/path/to/folder/suite2.snap',
'-/path/to/folder/suite3.snap',
],
suiteDirtyFlags: [false, false, false],
});
export const ROOT_FOLDER = {
folderPath: '-',
filePaths: [],
suiteDirtyFlags: [],
parentFolderPath: null,
childrenFolderPaths: ['-/path/to/folder', '-/path/to/folder2'],
childrenFolderDirtyFlags: [false, false],
};
const forgetRecords = (state0, action, settings) => {
let state = state0;
const { pathStr } = action;
const { maxRecords, forgetHysteresis } = settings;
const path = `mainStory/${pathStr}`.split('/');
const prevStory = timm.getIn(state, path);
const { numRecords } = prevStory;
const targetForget = Math.ceil((numRecords - maxRecords) + (maxRecords * forgetHysteresis));
const { nextStory, numForgotten, updatedStoryPaths } =
forgetRecursively(prevStory, targetForget, {}, prevStory.pathStr);
nextStory.numRecords = numRecords - numForgotten;
state = timm.setIn(state, path, nextStory);
const openStories = updateStoryPaths(state.openStories, updatedStoryPaths);
const closedStories = updateStoryPaths(state.closedStories, updatedStoryPaths);
state = timm.merge(state, { openStories, closedStories });
return state;
};
if (typeof instance === 'string') return escapeHtml(instance);
let result = `<${instance.type}`;
const filteredProps = filterProps(instance.props);
const numProps = Object.keys(filteredProps).length;
result += printProps(filteredProps, print, indent, opts);
if (numProps > 1) result += opts.edgeSpacing;
result += '>';
if (SELF_CLOSING[instance.type]) return result;
let opts2 = opts;
let indent2 = indent;
if (filteredProps.style && filteredProps.style.whiteSpace === 'pre') {
opts2 = merge(opts, { edgeSpacing: '' });
indent2 = str => str;
}
const dangerousInnerHTML = instance.props && instance.props.dangerouslySetInnerHTML;
if (dangerousInnerHTML) {
result += `${dangerousInnerHTML.__html}`;
return result;
}
const children = instance.children;
if (children) {
const printedChildren = printChildren(children, print, indent2, opts2);
result +=
`${opts2.edgeSpacing}${indent2(printedChildren)}` +
`${opts2.edgeSpacing}`;
} else if (instance.type.toUpperCase() === 'TEXTAREA') {
const configure = (options) => { config = merge(config, options); };
const path = require('path');
const { merge } = require('timm');
const webpackConfig = require('../webpackConfigBase');
module.exports = merge(webpackConfig, {
entry: {
app: ['./src/example/client'],
exampleUpload: ['./src/example/clientWithUpload'],
},
output: {
filename: '[name].js',
path: path.resolve(process.cwd(), 'example'),
publicPath: '/',
},
});
const path = require('path');
const { merge } = require('timm');
const webpackConfig = require('../webpackConfigBase');
module.exports = merge(webpackConfig, {
entry: {
app: ['./src/serverLogsApp/app.js'],
},
output: {
filename: '[name].js',
path: path.resolve(process.cwd(), 'serverLogsApp'),
publicPath: '/',
},
});