Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
`Localized bundle generation ${hasErrors ? 'failed' : 'complete'}.`,
);
if (hasErrors) {
return finalize(false);
}
}
} finally {
executor.stop();
}
// Copy assets
if (options.assets) {
try {
await copyAssets(
normalizeAssetPatterns(
options.assets,
new virtualFs.SyncDelegateHost(host),
root,
normalize(projectRoot),
projectSourceRoot === undefined ? undefined : normalize(projectSourceRoot),
),
Array.from(outputPaths.values()),
context.workspaceRoot,
);
} catch (err) {
context.logger.error('Unable to copy assets: ' + err.message);
return finalize(false);
}
}
async function sassCompileTask(context: EntryPointTaskContext) {
const globalContext = context.context();
if (context.epNode.data.entryPoint.isSecondaryEntryPoint) {
return;
}
const { builderContext, workspace, root, projectRoot, sourceRoot, options } = globalContext;
const host = new virtualFs.AliasHost(workspace.host as virtualFs.Host);
const syncHost = new virtualFs.SyncDelegateHost(host);
if (!options.tasks.data.sassCompile) {
return;
}
const assets = normalizeAssetPatterns(
options.tasks.data.sassCompile.entries,
syncHost as any,
root,
projectRoot,
sourceRoot,
);
const copyPatterns = buildCopyPatterns(root, assets);
log.info('Compiling sass bundles...');
const destPath = Path.join(root, copyPatterns[0].to);
const taskName = context.epNode.data.entryPoint.moduleId + ':css';
task(taskName, () => {
return buildScssPipeline(copyPatterns[0].context, [ Path.join(root, 'node_modules/') ], true).pipe(dest(destPath));
});
async function sassBundleTask(context: EntryPointTaskContext) {
const globalContext = context.context();
if (context.epNode.data.entryPoint.isSecondaryEntryPoint) {
return;
}
const { builderContext, workspace, root, projectRoot, sourceRoot, options } = globalContext;
const host = new virtualFs.AliasHost(workspace.host as virtualFs.Host);
const syncHost = new virtualFs.SyncDelegateHost(host);
if (!options.tasks.data.sassBundle) {
return;
}
const assets = normalizeAssetPatterns(
options.tasks.data.sassBundle.entries,
syncHost as any,
root,
projectRoot,
sourceRoot,
);
const copyPatterns = buildCopyPatterns(root, assets);
const copyOptions = { ignore: ['.gitkeep', '**/.DS_Store', '**/Thumbs.db'] };
log.info('Bundling a sass bundles...');
const promises = copyPatterns.map( pattern => {
const fullPattern = pattern.context + pattern.from.glob;
const opts = { ...copyOptions, dot: pattern.from.dot };
return globby(fullPattern, opts)