Skip to content

Commit

Permalink
[7.x] [build] rewrite source as transpiled JS later in the process (#…
Browse files Browse the repository at this point in the history
…73749) (#73765)

Co-authored-by: spalger <[email protected]>

Co-authored-by: spalger <[email protected]>
  • Loading branch information
Spencer and spalger authored Jul 30, 2020
1 parent 9974d59 commit d64ff63
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
15 changes: 10 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,12 @@ const observeCompiler = (
continue;
}

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

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

Expand All @@ -180,13 +185,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 d64ff63

Please sign in to comment.