How to use the @stylable/module-utils.stylableModuleFactory function in @stylable/module-utils

To help you get started, we’ve selected a few @stylable/module-utils examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github wix / stylable / packages / jest / src / jest.ts View on Github external
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 }
    );
}
github wix / stylable / packages / node / src / require-hook.ts View on Github external
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) {

@stylable/module-utils

Stylable module creation utilities

MIT
Latest version published 7 months ago

Package Health Score

62 / 100
Full package analysis

Similar packages