Skip to content

Commit

Permalink
[build] rewrite source as tranpiled JS later in the process
Browse files Browse the repository at this point in the history
  • Loading branch information
spalger committed Jul 29, 2020
1 parent 297a2c6 commit f970e77
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
14 changes: 9 additions & 5 deletions packages/kbn-optimizer/src/worker/run_compilers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ const observeCompiler = (

const bundleRefExportIds: string[] = [];
const referencedFiles = new Set<string>();
let normalModuleCount = 0;
let moduleCount = 0;
let workUnits = stats.compilation.fileDependencies.size;

if (bundle.manifestPath) {
Expand All @@ -119,7 +119,7 @@ const observeCompiler = (

for (const module of stats.compilation.modules) {
if (isNormalModule(module)) {
normalModuleCount += 1;
moduleCount += 1;
const path = getModulePath(module);
const parsedPath = parseFilePath(path);

Expand Down Expand Up @@ -154,7 +154,11 @@ const observeCompiler = (
continue;
}

if (isExternalModule(module) || isIgnoredModule(module) || isConcatenatedModule(module)) {
if (isConcatenatedModule(module)) {
moduleCount += module.modules.length;
}

if (isExternalModule(module) || isIgnoredModule(module)) {
continue;
}

Expand All @@ -180,13 +184,13 @@ const observeCompiler = (
bundleRefExportIds,
optimizerCacheKey: workerConfig.optimizerCacheKey,
cacheKey: bundle.createCacheKey(files, mtimes),
moduleCount: normalModuleCount,
moduleCount,
workUnits,
files,
});

return compilerMsgs.compilerSuccess({
moduleCount: normalModuleCount,
moduleCount,
});
})
);
Expand Down
1 change: 1 addition & 0 deletions packages/kbn-optimizer/src/worker/webpack_helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ export interface WebpackConcatenatedModule {
id: number;
dependencies: Dependency[];
usedExports: string[];
modules: unknown[];
}

export function isConcatenatedModule(module: any): module is WebpackConcatenatedModule {
Expand Down
4 changes: 2 additions & 2 deletions src/dev/build/build_distributables.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,17 +63,17 @@ export async function buildDistributables(log: ToolingLog, options: BuildOptions
await run(Tasks.CopyBinScripts);
await run(Tasks.CreateEmptyDirsAndFiles);
await run(Tasks.CreateReadme);
await run(Tasks.TranspileBabel);
await run(Tasks.BuildPackages);
await run(Tasks.CreatePackageJson);
await run(Tasks.InstallDependencies);
await run(Tasks.BuildKibanaPlatformPlugins);
await run(Tasks.TranspileBabel);
await run(Tasks.RemoveWorkspaces);
await run(Tasks.CleanPackages);
await run(Tasks.CreateNoticeFile);
await run(Tasks.UpdateLicenseFile);
await run(Tasks.RemovePackageJsonDeps);
await run(Tasks.TranspileScss);
await run(Tasks.BuildKibanaPlatformPlugins);
await run(Tasks.OptimizeBuild);
await run(Tasks.CleanTypescript);
await run(Tasks.CleanExtraFilesFromModules);
Expand Down

0 comments on commit f970e77

Please sign in to comment.