message: Fix support for Windows path separators in configDir and staticDir
diff: +import path from 'path';
  +
  import { getWorkingDir } from '../git/git';
  import bailFile from '../ui/messages/warnings/bailFile';
  @@ -10,14 +12,18 @@ const EXTERNALS = [/\/node_modules\//, /\/webpack\/runtime\//, /^\(webpack\)/];
  const isGlobal = (name) => GLOBALS.some((re) => re.test(name));
  const isUserCode = ({ name, moduleName }) => !EXTERNALS.some((re) => re.test(name || moduleName));
  +const posixRelativePath = (dir) => `./${dir.split(path.sep).filter(Boolean).join(path.posix.sep)}`;
  +
  export async function getDependentStoryFiles(ctx, stats, changedFiles) {
  - const { configDir = './.storybook', staticDir = [] } = ctx.storybook || {};
  + const { configDir = '.storybook', staticDir = [] } = ctx.storybook || {};
  const workingDir = await getWorkingDir();
  const workingDirRegExp = workingDir && new RegExp(`^./${workingDir}`);
  - // TODO deal with Windows path separator
  - const storybookDir = configDir.startsWith('./') ? configDir : `./${configDir}`;
  - const staticDirs = staticDir.map((dir) => (dir.startsWith('./') ? dir : `./${dir}`));
  + // Replace Windows-style backslash path separators with POSIX-style forward slashes, because the
  + // Webpack stats use forward slashes in the `name` and `moduleName` fields. Note `changedFiles`
  + // already contains forward slashes, because that's what git yields even on Windows.
  + const storybookDir = posixRelativePath(configDir);
  + const staticDirs = staticDir.map(posixRelativePath);
  // NOTE: this only works with `main:stories` -- if stories are imported from files in `.storybook/preview.js`
  // we'll need a different approach to figure out CSF files (maybe the user should pass a glob?).
  