MCPcopy
hub / github.com/webpack/webpack / compile

Method compile

lib/Compiler.js:1413–1458  ·  view source on GitHub ↗

* Processes the provided compilation. * @param {Callback<Compilation>} callback signals when the compilation finishes * @returns {void}

(callback)

Source from the content-addressed store, hash-verified

1411 * @returns {void}
1412 */
1413 compile(callback) {
1414 const params = this.newCompilationParams();
1415 this.hooks.beforeCompile.callAsync(params, (err) => {
1416 if (err) return callback(err);
1417
1418 this.hooks.compile.call(params);
1419
1420 const compilation = this.newCompilation(params);
1421
1422 const logger = compilation.getLogger("webpack.Compiler");
1423
1424 logger.time("make hook");
1425 this.hooks.make.callAsync(compilation, (err) => {
1426 logger.timeEnd("make hook");
1427 if (err) return callback(err);
1428
1429 logger.time("finish make hook");
1430 this.hooks.finishMake.callAsync(compilation, (err) => {
1431 logger.timeEnd("finish make hook");
1432 if (err) return callback(err);
1433
1434 process.nextTick(() => {
1435 logger.time("finish compilation");
1436 compilation.finish((err) => {
1437 logger.timeEnd("finish compilation");
1438 if (err) return callback(err);
1439
1440 logger.time("seal compilation");
1441 compilation.seal((err) => {
1442 logger.timeEnd("seal compilation");
1443 if (err) return callback(err);
1444
1445 logger.time("afterCompile hook");
1446 this.hooks.afterCompile.callAsync(compilation, (err) => {
1447 logger.timeEnd("afterCompile hook");
1448 if (err) return callback(err);
1449
1450 return callback(null, compilation);
1451 });
1452 });
1453 });
1454 });
1455 });
1456 });
1457 });
1458 }
1459
1460 /**
1461 * Processes the provided error callback.

Callers 6

onCompiledMethod · 0.95
runMethod · 0.95
runAsChildMethod · 0.95
onCompiledMethod · 0.45
runMethod · 0.45
constructorMethod · 0.45

Calls 9

newCompilationParamsMethod · 0.95
newCompilationMethod · 0.95
timeMethod · 0.80
timeEndMethod · 0.80
finishMethod · 0.80
sealMethod · 0.80
getLoggerMethod · 0.65
callbackFunction · 0.50
callMethod · 0.45

Tested by

no test coverage detected