Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export function processFactory(
stylableConfig?: Partial,
factoryOptions?: Partial
) {
return stylableModuleFactory(
{
fileSystem: fs,
requireModule: require,
projectRoot: '',
...stylableConfig
},
// ensure the generated module points to our own @stylable/runtime copy
// this allows @stylable/jest to be used as part of a globally installed CLI
{ runtimePath: stylableRuntimePath, ...factoryOptions }
);
}
export function attachHook({
matcher,
afterCompile,
stylableConfig,
runtimePath,
ignoreJSModules,
legacyRuntime
}: Partial = {}) {
const stylableToModule = stylableModuleFactory(
{
projectRoot: 'root',
fileSystem: fs,
requireModule: require,
resolveNamespace,
...stylableConfig
},
{ runtimePath, legacyRuntime }
);
if (!matcher) {
matcher = defaultStylableMatcher;
}
const prevHook = require.extensions[HOOK_EXTENSION];
require.extensions[HOOK_EXTENSION] = function cssModulesHook(m: any, filename: string) {