Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
minify,
manifestFilepath,
manifest,
require: requires
} = argv;
log('[Arguments]', argv);
// execute all require hooks before running the CLI build
for (const request of requires) {
if (request) {
require(request);
}
}
const stylable = Stylable.create({
fileSystem: fs,
requireModule: require,
projectRoot: rootDir,
resolveNamespace: require(namespaceResolver).resolveNamespace
});
build({
extension: ext,
fs,
stylable,
outDir,
srcDir,
rootDir,
log,
diagnostics,
indexFile,
export function stylableModuleFactory(
stylableOptions: StylableConfig,
{
runtimePath = '@stylable/runtime',
runtimeStylesheetId = 'module',
injectCSS = true,
renderableOnly = false,
legacyRuntime,
staticImports = []
}: Partial = {}
) {
let afterModule = '';
const stylable = Stylable.create(stylableOptions);
if (legacyRuntime && runtimePath === '@stylable/runtime') {
runtimePath = '@stylable/runtime/cjs/index-legacy';
afterModule += 'module.exports.default = module.exports;';
}
return function stylableToModule(source: string, path: string) {
const res = stylable.transform(source, path);
return generateModuleSource(
res,
runtimeStylesheetId === 'module' ? 'module.id' : res.meta.namespace,
[
...staticImports.map(request => `import ${JSON.stringify(request)}`),
`const runtime = require(${JSON.stringify(runtimePath)})`
],
`runtime.$`,
`runtime.create`,
`runtime.createRenderable`,
export function stylableModuleFactory(stylableOptions: StylableConfig, runtimePath?: string) {
const stylable = Stylable.create(stylableOptions);
return function stylableToModule(source: string, path: string) {
return generateModuleSource(stylable.transform(source, path), true, runtimePath);
};
}