Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
(stats, config, logger) => {
// config.stats contains our own stats settings, added during buildWebpackConfig().
const json = stats.toJson(config.stats);
if (verbose) {
logger.info(stats.toString(config.stats));
} else {
logger.info(statsToString(json, config.stats));
}
if (stats.hasWarnings()) {
logger.warn(statsWarningsToString(json, config.stats));
}
if (stats.hasErrors()) {
logger.error(statsErrorsToString(json, config.stats));
}
};
// ...event,
success,
error,
baseOutputPath,
outputPath: baseOutputPath,
outputPaths: outputPaths && Array.from(outputPaths.values()) || [baseOutputPath],
} as BrowserBuilderOutput);
if (!success && useBundleDownleveling) {
// If using bundle downleveling then there is only one build
// If it fails show any diagnostic messages and bail
if (webpackStats && webpackStats.warnings.length > 0) {
context.logger.warn(statsWarningsToString(webpackStats, { colors: true }));
}
if (webpackStats && webpackStats.errors.length > 0) {
context.logger.error(statsErrorsToString(webpackStats, { colors: true }));
}
return finalize(success);
} else if (success) {
outputPaths = ensureOutputPaths(baseOutputPath, i18n);
let noModuleFiles: EmittedFiles[] | undefined;
let moduleFiles: EmittedFiles[] | undefined;
let files: EmittedFiles[] | undefined;
const scriptsEntryPointName = normalizeExtraEntryPoints(
options.scripts || [],
'scripts',
).map(x => x.bundleName);
if (isDifferentialLoadingNeeded && options.watch) {
let outputPaths: undefined | Map;
const finalize = (success: boolean, error?: string) => ({
// ...event,
success,
error,
baseOutputPath,
outputPath: baseOutputPath,
outputPaths: outputPaths && Array.from(outputPaths.values()) || [baseOutputPath],
} as BrowserBuilderOutput);
if (!success && useBundleDownleveling) {
// If using bundle downleveling then there is only one build
// If it fails show any diagnostic messages and bail
if (webpackStats && webpackStats.warnings.length > 0) {
context.logger.warn(statsWarningsToString(webpackStats, { colors: true }));
}
if (webpackStats && webpackStats.errors.length > 0) {
context.logger.error(statsErrorsToString(webpackStats, { colors: true }));
}
return finalize(success);
} else if (success) {
outputPaths = ensureOutputPaths(baseOutputPath, i18n);
let noModuleFiles: EmittedFiles[] | undefined;
let moduleFiles: EmittedFiles[] | undefined;
let files: EmittedFiles[] | undefined;
const scriptsEntryPointName = normalizeExtraEntryPoints(
options.scripts || [],
'scripts',
(stats, config, logger) => {
// config.stats contains our own stats settings, added during buildWebpackConfig().
const json = stats.toJson(config.stats);
if (verbose) {
logger.info(stats.toString(config.stats));
} else {
logger.info(statsToString(json, config.stats));
}
if (stats.hasWarnings()) {
logger.warn(statsWarningsToString(json, config.stats));
}
if (stats.hasErrors()) {
logger.error(statsErrorsToString(json, config.stats));
}
};
(stats, config, logger) => {
// config.stats contains our own stats settings, added during buildWebpackConfig().
const json = stats.toJson(config.stats);
if (verbose) {
logger.info(stats.toString(config.stats));
} else {
logger.info(statsToString(json, config.stats));
}
if (stats.hasWarnings()) {
logger.warn(statsWarningsToString(json, config.stats));
}
if (stats.hasErrors()) {
logger.error(statsErrorsToString(json, config.stats));
}
};
export function getAngularCliParts(cliWebpackConfigOptions: any) {
// eslint-disable-next-line global-require, import/no-extraneous-dependencies
const ngCliConfigFactory = require('@angular-devkit/build-angular/src/angular-cli-files/models/webpack-configs');
try {
return {
cliCommonConfig: ngCliConfigFactory.getCommonConfig(cliWebpackConfigOptions),
cliStyleConfig: ngCliConfigFactory.getStylesConfig(cliWebpackConfigOptions),
};
} catch (e) {
return null;
}
}
if (fileLoader) {
if (fileLoader.options) {
(fileLoader.options as { emitFile: boolean }).emitFile = emitFile;
} else {
fileLoader.options = { emitFile: emitFile };
}
}
if (emitFile || !webpackConfig.module) {
return;
}
// fix: avoid extract css files when value is false
// Determine hashing format.
const hashFormat = getOutputHashFormat(serverOptions.outputHashing as string);
const autoprefixer = require('autoprefixer');
const postcssImports = require('postcss-import');
const udkPostcssPluginCreator = (loader: webpack.loader.LoaderContext) => [
postcssImports({
resolve: (url: string) => (url.startsWith('~') ? url.substr(1) : url),
load: (filename: string) => {
return new Promise((resolve, reject) => {
loader.fs.readFile(filename, (err: Error, data: Buffer) => {
if (err) {
reject(err);
return;
}
if (fileLoader) {
if (fileLoader.options) {
(fileLoader.options as { emitFile: boolean }).emitFile = value;
} else {
fileLoader.options = { emitFile: value };
}
}
if (value || !webpackConfig.module) {
return;
}
// fix: avoid extract css files when value is false
// Determine hashing format.
const hashFormat = getOutputHashFormat(serverOptions.outputHashing as string);
const autoprefixer = require('autoprefixer');
const postcssImports = require('postcss-import');
const udkPostcssPluginCreator = (loader: webpack.loader.LoaderContext) => [
postcssImports({
resolve: (url: string) => (url.startsWith('~') ? url.substr(1) : url),
load: (filename: string) => {
return new Promise((resolve, reject) => {
loader.fs.readFile(filename, (err: Error, data: Buffer) => {
if (err) {
reject(err);
return;
}
export function getAngularCliParts(cliWebpackConfigOptions: any) {
// eslint-disable-next-line global-require, import/no-extraneous-dependencies
const ngCliConfigFactory = require('@angular-devkit/build-angular/src/angular-cli-files/models/webpack-configs');
try {
return {
cliCommonConfig: ngCliConfigFactory.getCommonConfig(cliWebpackConfigOptions),
cliStyleConfig: ngCliConfigFactory.getStylesConfig(cliWebpackConfigOptions),
};
} catch (e) {
return null;
}
}
return rxjs_1.from(setup()).pipe(operators_1.switchMap(opt => {
return browser_1.buildWebpackBrowser(opt.buildOptions, context, {
webpackConfiguration: util_1.electronBuildWebpackConfigTransformFactory(opt.buildOptions, opt.buildElectronOptions, context)
});
}), operators_1.filter((val, index) => index < 1), operators_1.tap(result => {
// Copy electron main