@teambit/compiler 1.0.852 → 1.0.854

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
- import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.compilation_compiler@1.0.852/dist/compiler.composition.js';
2
- import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.compilation_compiler@1.0.852/dist/compiler.docs.mdx';
1
+ import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.compilation_compiler@1.0.854/dist/compiler.composition.js';
2
+ import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.compilation_compiler@1.0.854/dist/compiler.docs.mdx';
3
3
 
4
4
  export const compositions = [compositions_0];
5
5
  export const overview = [overview_0];
@@ -56,6 +56,12 @@ export declare class ComponentCompiler {
56
56
  private getInjectedDirs;
57
57
  private get componentDir();
58
58
  copyTypesToOtherDists(): Promise<void>;
59
+ /**
60
+ * Copy all compiled files from the outputDir (where the compiler wrote) to all other dist directories.
61
+ * This is needed for compilers that use transpileComponent and write directly to the filesystem,
62
+ * as they only receive one outputDir but files need to be available in all dist locations.
63
+ */
64
+ copyCompiledFilesToOtherDists(): Promise<void>;
59
65
  private compileOneFile;
60
66
  private compileAllFiles;
61
67
  }
@@ -243,6 +243,49 @@ ${this.compileErrors.map(formatError).join('\n')}`);
243
243
  }));
244
244
  }));
245
245
  }
246
+
247
+ /**
248
+ * Copy all compiled files from the outputDir (where the compiler wrote) to all other dist directories.
249
+ * This is needed for compilers that use transpileComponent and write directly to the filesystem,
250
+ * as they only receive one outputDir but files need to be available in all dist locations.
251
+ */
252
+ async copyCompiledFilesToOtherDists() {
253
+ const distDirs = await this.distDirs();
254
+ if (distDirs.length <= 1) return;
255
+
256
+ // The compiler writes to the outputDir from getComponentPackagePath + distDirName
257
+ const outputDir = await this.workspace.getComponentPackagePath(this.component);
258
+ const distDirName = this.compilerInstance.getDistDir?.() || _legacy().DEFAULT_DIST_DIRNAME;
259
+ const sourceDistDirAbs = _path().default.join(outputDir, distDirName);
260
+
261
+ // Check if the dist directory exists (compiler may not have written anything)
262
+ if (!(await _fsExtra().default.pathExists(sourceDistDirAbs))) return;
263
+
264
+ // Find which distDir corresponds to the outputDir and get the others
265
+ const outputDirRelative = _path().default.relative(this.workspace.path, outputDir);
266
+ const sourceDistDirRelative = _path().default.join(outputDirRelative, distDirName);
267
+ const otherDirs = distDirs.filter(dir => dir !== sourceDistDirRelative);
268
+ if (!otherDirs.length) return;
269
+ const matches = await (0, _globby().default)(`**/*`, {
270
+ cwd: sourceDistDirAbs,
271
+ onlyFiles: true,
272
+ ignore: ['node_modules/**']
273
+ });
274
+ if (!matches.length) return;
275
+ await Promise.all(otherDirs.map(async distDir => {
276
+ const distDirAbs = _path().default.join(this.workspace.path, distDir);
277
+ await Promise.all(matches.map(async match => {
278
+ const source = _path().default.join(sourceDistDirAbs, match);
279
+ const dest = _path().default.join(distDirAbs, match);
280
+ try {
281
+ await _fsExtra().default.ensureDir(_path().default.dirname(dest));
282
+ await _fsExtra().default.copyFile(source, dest);
283
+ } catch (err) {
284
+ throw new Error(`failed to copy compiled file from "${source}" to "${dest}": ${err.message}`);
285
+ }
286
+ }));
287
+ }));
288
+ }
246
289
  async compileOneFile(file, initiator, distDirs) {
247
290
  const options = {
248
291
  componentDir: this.componentDir,
@@ -304,6 +347,8 @@ ${this.compileErrors.map(formatError).join('\n')}`);
304
347
  outputDir: await this.workspace.getComponentPackagePath(this.component),
305
348
  initiator
306
349
  });
350
+ // Copy compiled files to all other dist directories (injected dirs)
351
+ await this.copyCompiledFilesToOtherDists();
307
352
  } catch (error) {
308
353
  this.compileErrors.push({
309
354
  path: this.componentDir,
@@ -1 +1 @@
1
- {"version":3,"names":["_pMapSeries","data","_interopRequireDefault","require","_globby","_fsExtra","_workspace","_path","_chalk","_componentId","_logger","_legacy","_component","_workspaceModules","_dependencyResolver","_pkgModules","_workspace2","_lodash","_compiler","_events","_types","e","__esModule","default","_defineProperty","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","ComponentCompiler","constructor","pubsub","workspace","component","compilerInstance","compilerId","logger","env","dists","compileErrors","compile","noThrow","options","dataToPersist","deleteDistDir","distDirs","DataToPersist","distDir","removePath","RemovePath","addBasePath","path","persistAllToFS","compilers","canTranspileFile","find","c","transpileFile","canTranspileComponent","transpileComponent","Promise","all","filesystem","files","map","file","compileOneFile","initiator","compileAllFiles","Error","toString","throwOnCompileErrors","addManyFiles","buildResults","distFile","state","_consumer","compiler","consoleSuccess","id","errors","getPackageDir","packageName","componentIdToPackageName","join","length","forEach","errorItem","error","formatError","err","pub","CompilerAspect","CompilerErrorEvent","console","message","packageDir","distDirName","getDistDir","DEFAULT_DIST_DIRNAME","injectedDirs","getInjectedDirs","dist","rootDirs","readRootComponentsDir","rootComponentsPath","rootDir","relative","componentDir","copyTypesToOtherDists","packageDistDir","otherDirs","slice","packageDistDirAbs","matches","globby","cwd","onlyFiles","ignore","distDirAbs","match","source","dest","fs","copyFile","filePath","isFileSupported","compileResults","contents","push","base","result","Dist","outputPath","Buffer","from","outputText","shouldCopyNonSupportedFiles","filesToCompile","outputDir","getComponentPackagePath","exports","WorkspaceCompiler","envs","aspectLoader","ui","dependencyResolver","watcher","Set","registerOnComponentChange","onComponentChange","bind","registerOnComponentAdd","onComponentAdd","registerOnPreWatch","onPreWatch","registerPreStart","onPreStart","registerOnAspectLoadErrorSlot","onAspectLoadFail","preStartOpts","skipCompilation","compileComponents","changed","verbose","CompilationInitiator","PreStart","watchScopeInternalFiles","code","includes","inInstallContext","inInstallAfterPmContext","shouldCompile","idStr","componentsBeingProcessedInOnAspectLoadFail","has","debug","add","graph","successors","getEnvDepsGraph","depsIds","s","AspectLoadFail","loadExtensions","executeLoadSlot","delete","envComponentId","getGraphIds","nodeFilter","node","hasId","attr","watchOpts","undefined","removedFiles","Boolean","removeLinksFromNodeModules","ComponentChanged","generateTypes","results","formatCompileResults","componentIds","preCompile","start","Date","now","PreWatch","end","componentsIds","componentLoadOptions","OutsideWorkspaceError","getIdsToCompile","loadSeedersAsAspects","components","getMany","loadExternalEnvs","grouped","buildGroupsToCompile","mapSeries","group","runCompileComponents","linkComponents","linkToNodeModulesByComponents","flat","componentsIdsStr","envIdsCompIdsMap","compsWithWrongEnvId","envId","calculateEnvId","envIdByGet","getEnvId","externalEnvsIds","keys","nonLoadedEnvs","filter","isEnvRegistered","loadAspects","idsToClearCache","uniq","reduce","acc","compIds","concat","clearComponentsCache","ComponentID","fromString","componentsCompilers","getOrCalculateEnv","environment","getCompiler","compilerName","name","warn","typeGeneratorParamsPerEnv","getTypesCompilerPerEnv","preGenerateTypesOnWorkspace","resultOnWorkspace","componentCompiler","generateTypesOnWorkspace","envsMap","componentCompilers","compParams","typeCompiler","buildPipe","getBuildPipe","compilerTasks","task","aspectId","tsTask","displayName","compact","typesGeneratorParamsPerEnv","envCompIds","envsIds","groupedByIsEnv","groupBy","isEnv","envsOfEnvsCompIds","groupedByEnvsOfEnvs","envsOfEnvsWithoutCoreCompIds","isCoreEnv","depsOfEnvsOfEnvsCompIds","subGraph","successorsSubgraph","nodes","n","depsOfEnvsOfEnvsCompLists","envsOfEnvs","envComp","getDependencies","DependencyList","merge","getComponentDependencies","dep","groupedByIsDepsOfEnvsOfEnvs","other","depsOfEnvsOfCompIds","otherEnvsIds","otherEnvs","otherEnvsWithoutCoreIds","depsOfEnvsCompLists","groupedByIsDepsOfEnvs","depsOfEnvsOfEnvs","depsOfEnvs","resolveMultipleComponentIds","filterIds","getNewAndModifiedIds","listIds","buildResult","title","chalk","underline","verboseComponentFilesArrayToString","Logger","successSymbol"],"sources":["workspace-compiler.ts"],"sourcesContent":["/* eslint-disable max-classes-per-file */\nimport mapSeries from 'p-map-series';\nimport globby from 'globby';\nimport fs from 'fs-extra';\nimport type { Component } from '@teambit/component';\nimport type { EnvDefinition, EnvsMain } from '@teambit/envs';\nimport type { PubsubMain } from '@teambit/pubsub';\nimport { OutsideWorkspaceError } from '@teambit/workspace';\nimport type { WorkspaceComponentLoadOptions, SerializableResults, Workspace } from '@teambit/workspace';\nimport type { WatcherMain, WatchOptions } from '@teambit/watcher';\nimport path from 'path';\nimport chalk from 'chalk';\nimport { ComponentID } from '@teambit/component-id';\nimport { Logger } from '@teambit/logger';\nimport { DEFAULT_DIST_DIRNAME } from '@teambit/legacy.constants';\nimport type { AbstractVinyl } from '@teambit/component.sources';\nimport { Dist, DataToPersist, RemovePath } from '@teambit/component.sources';\nimport {\n linkToNodeModulesByComponents,\n removeLinksFromNodeModules,\n} from '@teambit/workspace.modules.node-modules-linker';\nimport type { AspectLoaderMain } from '@teambit/aspect-loader';\nimport type { DependencyResolverMain } from '@teambit/dependency-resolver';\nimport { DependencyList } from '@teambit/dependency-resolver';\nimport type { PathOsBasedAbsolute, PathOsBasedRelative } from '@teambit/toolbox.path.path';\nimport { componentIdToPackageName } from '@teambit/pkg.modules.component-package-name';\nimport type { UiMain, PreStartOpts } from '@teambit/ui';\nimport { readRootComponentsDir } from '@teambit/workspace.root-components';\nimport { compact, groupBy, uniq } from 'lodash';\nimport type { MultiCompiler } from '@teambit/multi-compiler';\nimport type { CompIdGraph } from '@teambit/graph';\nimport { CompilerAspect } from './compiler.aspect';\nimport { CompilerErrorEvent } from './events';\nimport type { Compiler, TypeGeneratorCompParams } from './types';\nimport { CompilationInitiator } from './types';\n\nexport type BuildResult = {\n component: string;\n buildResults: string[];\n errors: CompileError[];\n};\n\nexport type CompileOptions = {\n changed?: boolean; // compile only new and modified components\n verbose?: boolean; // show more data, such as, dist paths\n /**\n * whether the dist root dir should be deleted before writing new dists.\n * defaults to true for `bit compile` and false everywhere else, such as `bit watch` and `bit\n * start` to avoid webpack \"EINTR\" error.\n */\n deleteDistDir?: boolean;\n initiator: CompilationInitiator; // describes where the compilation is coming from\n // should we create links in node_modules for the compiled components (default = true)\n // this will link the source files, and create the package.json\n linkComponents?: boolean;\n /**\n * whether to generate types after the compilation, default = false.\n * keep in mind that it's a heavy operation, and hurts the performance.\n */\n generateTypes?: boolean;\n};\n\nexport type CompileError = { path: string; error: Error };\n\nexport class ComponentCompiler {\n constructor(\n private pubsub: PubsubMain,\n private workspace: Workspace,\n readonly component: Component,\n readonly compilerInstance: Compiler,\n private compilerId: string,\n private logger: Logger,\n readonly env: EnvDefinition,\n private dists: Dist[] = [],\n private compileErrors: CompileError[] = []\n ) {}\n\n async compile(noThrow = true, options: CompileOptions): Promise<BuildResult> {\n let dataToPersist;\n const deleteDistDir = options.deleteDistDir ?? this.compilerInstance.deleteDistDir;\n const distDirs = await this.distDirs();\n // delete dist folder before transpilation (because some compilers (like ngPackagr) can generate files there during the compilation process)\n if (deleteDistDir) {\n dataToPersist = new DataToPersist();\n for (const distDir of distDirs) {\n dataToPersist.removePath(new RemovePath(distDir));\n }\n dataToPersist.addBasePath(this.workspace.path);\n await dataToPersist.persistAllToFS();\n }\n\n const compilers: Compiler[] = (this.compilerInstance as MultiCompiler).compilers\n ? (this.compilerInstance as MultiCompiler).compilers\n : [this.compilerInstance];\n const canTranspileFile = compilers.find((c) => c.transpileFile);\n const canTranspileComponent = compilers.find((c) => c.transpileComponent);\n\n if (canTranspileFile) {\n await Promise.all(\n this.component.filesystem.files.map((file: AbstractVinyl) =>\n this.compileOneFile(file, options.initiator, distDirs)\n )\n );\n }\n\n if (canTranspileComponent) {\n await this.compileAllFiles(options.initiator, distDirs);\n }\n\n if (!canTranspileFile && !canTranspileComponent) {\n throw new Error(\n `compiler ${this.compilerId.toString()} doesn't implement either \"transpileFile\" or \"transpileComponent\" methods`\n );\n }\n this.throwOnCompileErrors(noThrow);\n\n // writing the dists with `component.setDists(dists); component.dists.writeDists` is tricky\n // as it uses other base-paths and doesn't respect the new node-modules base path.\n dataToPersist = new DataToPersist();\n dataToPersist.addManyFiles(this.dists);\n dataToPersist.addBasePath(this.workspace.path);\n await dataToPersist.persistAllToFS();\n const buildResults = this.dists.map((distFile) => distFile.path);\n if (this.component.state._consumer.compiler) this.logger.consoleSuccess();\n\n return { component: this.component.id.toString(), buildResults, errors: this.compileErrors };\n }\n\n getPackageDir() {\n const packageName = componentIdToPackageName(this.component.state._consumer);\n return path.join('node_modules', packageName);\n }\n\n private throwOnCompileErrors(noThrow = true) {\n if (this.compileErrors.length) {\n this.compileErrors.forEach((errorItem) => {\n this.logger.error(`compilation error at ${errorItem.path}`, errorItem.error);\n });\n const formatError = (errorItem) => `${errorItem.path}\\n${errorItem.error}`;\n const err = new Error(`compilation failed. see the following errors from the compiler\n${this.compileErrors.map(formatError).join('\\n')}`);\n\n this.pubsub.pub(CompilerAspect.id, new CompilerErrorEvent(err));\n\n if (!noThrow) {\n throw err;\n }\n\n this.logger.console(err.message);\n }\n }\n\n private async distDirs(): Promise<PathOsBasedRelative[]> {\n const packageName = componentIdToPackageName(this.component.state._consumer);\n const packageDir = path.join('node_modules', packageName);\n const distDirName = this.compilerInstance.getDistDir?.() || DEFAULT_DIST_DIRNAME;\n const injectedDirs = await this.getInjectedDirs(packageName);\n return [packageDir, ...injectedDirs].map((dist) => path.join(dist, distDirName));\n }\n\n private async getInjectedDirs(packageName: string): Promise<string[]> {\n const injectedDirs = await this.workspace.getInjectedDirs(this.component);\n if (injectedDirs.length > 0) return injectedDirs;\n\n const rootDirs = await readRootComponentsDir(this.workspace.rootComponentsPath);\n return rootDirs.map((rootDir) => path.relative(this.workspace.path, path.join(rootDir, packageName)));\n }\n\n private get componentDir(): PathOsBasedAbsolute {\n return this.workspace.componentDir(this.component.id);\n }\n\n async copyTypesToOtherDists() {\n const distDirs = await this.distDirs();\n if (distDirs.length <= 1) return;\n const packageDistDir = distDirs[0];\n const otherDirs = distDirs.slice(1);\n const packageDistDirAbs = path.join(this.workspace.path, packageDistDir);\n const matches = await globby(`**/*.d.ts`, {\n cwd: packageDistDirAbs,\n onlyFiles: true,\n ignore: [`${packageDistDir}/node_modules/`],\n });\n if (!matches.length) return;\n await Promise.all(\n otherDirs.map(async (distDir) => {\n const distDirAbs = path.join(this.workspace.path, distDir);\n await Promise.all(\n matches.map(async (match) => {\n const source = path.join(packageDistDirAbs, match);\n const dest = path.join(distDirAbs, match);\n await fs.copyFile(source, dest);\n })\n );\n })\n );\n }\n\n private async compileOneFile(\n file: AbstractVinyl,\n initiator: CompilationInitiator,\n distDirs: PathOsBasedRelative[]\n ): Promise<void> {\n const options = { componentDir: this.componentDir, filePath: file.relative, initiator };\n const isFileSupported = this.compilerInstance.isFileSupported(file.path);\n let compileResults;\n if (isFileSupported) {\n try {\n compileResults = await this.compilerInstance.transpileFile?.(file.contents.toString(), options);\n } catch (error: any) {\n this.compileErrors.push({ path: file.path, error });\n return;\n }\n }\n for (const base of distDirs) {\n if (isFileSupported && compileResults) {\n this.dists.push(\n ...compileResults.map(\n (result) =>\n new Dist({\n base,\n path: path.join(base, result.outputPath),\n contents: Buffer.from(result.outputText),\n })\n )\n );\n } else if (this.compilerInstance.shouldCopyNonSupportedFiles) {\n // compiler doesn't support this file type. copy the file as is to the dist dir.\n this.dists.push(new Dist({ base, path: path.join(base, file.relative), contents: file.contents }));\n }\n }\n }\n\n private async compileAllFiles(initiator: CompilationInitiator, distDirs: PathOsBasedRelative[]): Promise<void> {\n const filesToCompile: AbstractVinyl[] = [];\n for (const base of distDirs) {\n this.component.filesystem.files.forEach((file: AbstractVinyl) => {\n const isFileSupported = this.compilerInstance.isFileSupported(file.path);\n if (isFileSupported) {\n filesToCompile.push(file);\n } else if (this.compilerInstance.shouldCopyNonSupportedFiles) {\n // compiler doesn't support this file type. copy the file as is to the dist dir.\n this.dists.push(\n new Dist({\n base,\n path: path.join(base, file.relative),\n contents: file.contents,\n })\n );\n }\n });\n }\n\n if (filesToCompile.length) {\n try {\n await this.compilerInstance.transpileComponent?.({\n component: this.component,\n componentDir: this.componentDir,\n outputDir: await this.workspace.getComponentPackagePath(this.component),\n initiator,\n });\n } catch (error: any) {\n this.compileErrors.push({ path: this.componentDir, error });\n }\n }\n }\n}\n\ntype TypeGeneratorParamsPerEnv = { envId: string; compParams: TypeGeneratorCompParams[]; typeCompiler: Compiler };\n\nexport class WorkspaceCompiler {\n private componentsBeingProcessedInOnAspectLoadFail = new Set<string>();\n\n constructor(\n private workspace: Workspace,\n private envs: EnvsMain,\n private pubsub: PubsubMain,\n private aspectLoader: AspectLoaderMain,\n private ui: UiMain,\n private logger: Logger,\n private dependencyResolver: DependencyResolverMain,\n private watcher: WatcherMain\n ) {\n if (this.workspace) {\n this.workspace.registerOnComponentChange(this.onComponentChange.bind(this));\n this.workspace.registerOnComponentAdd(this.onComponentAdd.bind(this));\n this.watcher.registerOnPreWatch(this.onPreWatch.bind(this));\n }\n this.ui.registerPreStart(this.onPreStart.bind(this));\n if (this.aspectLoader) {\n this.aspectLoader.registerOnAspectLoadErrorSlot(this.onAspectLoadFail.bind(this));\n }\n }\n\n async onPreStart(preStartOpts: PreStartOpts): Promise<void> {\n if (this.workspace) {\n if (preStartOpts.skipCompilation) {\n return;\n }\n await this.compileComponents([], {\n changed: true,\n verbose: false,\n deleteDistDir: false,\n initiator: CompilationInitiator.PreStart,\n });\n } else {\n await this.watcher.watchScopeInternalFiles();\n }\n }\n\n async onAspectLoadFail(err: Error & { code?: string }, component: Component): Promise<boolean> {\n if (\n ((err.code &&\n (err.code === 'MODULE_NOT_FOUND' || err.code === 'ERR_MODULE_NOT_FOUND' || err.code === 'ERR_REQUIRE_ESM')) ||\n err.message.includes('import.meta') ||\n err.message.includes('exports is not defined')) &&\n this.workspace\n ) {\n const inInstallContext = this.workspace.inInstallContext;\n const inInstallAfterPmContext = this.workspace.inInstallAfterPmContext;\n // If we are now running install we only want to compile after the package manager is done\n const shouldCompile = (inInstallContext && inInstallAfterPmContext) || !inInstallContext;\n if (shouldCompile) {\n const id = component.id;\n const idStr = id.toString();\n\n // Prevent infinite loop when there's a circular dependency between an env and a component.\n // If we're already processing this component, don't re-enter.\n if (this.componentsBeingProcessedInOnAspectLoadFail.has(idStr)) {\n this.logger.debug(\n `onAspectLoadFail: skipping ${idStr} as it's already being processed (preventing infinite loop)`\n );\n return false;\n }\n\n this.componentsBeingProcessedInOnAspectLoadFail.add(idStr);\n try {\n const { graph, successors } = await this.getEnvDepsGraph(id);\n // const deps = this.dependencyResolver.getDependencies(component);\n // const depsIds = deps.getComponentDependencies().map((dep) => {\n // return dep.id.toString();\n // });\n const depsIds = successors.map((s) => s.id);\n await this.compileComponents(\n [id.toString(), ...depsIds],\n { initiator: CompilationInitiator.AspectLoadFail },\n true,\n { loadExtensions: true, executeLoadSlot: true },\n graph\n );\n return true;\n } finally {\n this.componentsBeingProcessedInOnAspectLoadFail.delete(idStr);\n }\n }\n }\n return false;\n }\n\n async getEnvDepsGraph(envComponentId: ComponentID): Promise<{ graph: CompIdGraph; successors: { id: string }[] }> {\n const graph = await this.workspace.getGraphIds([envComponentId]);\n const successors = graph.successors(envComponentId.toString(), {\n nodeFilter: (node) => this.workspace.hasId(node.attr),\n });\n return { graph, successors };\n }\n\n async onComponentAdd(component: Component, files: string[], watchOpts: WatchOptions) {\n return this.onComponentChange(component, files, undefined, watchOpts);\n }\n\n async onComponentChange(\n component: Component,\n files: string[],\n removedFiles: string[] = [],\n watchOpts: WatchOptions\n ): Promise<SerializableResults | void> {\n if (!watchOpts.compile) return undefined;\n // when files are removed, we need to remove the dist directories and the old symlinks, otherwise, it has\n // symlinks to non-exist files and the dist has stale files\n const deleteDistDir = Boolean(removedFiles?.length);\n if (removedFiles?.length) {\n await removeLinksFromNodeModules(component, this.workspace, removedFiles);\n }\n const buildResults = await this.compileComponents(\n [component.id.toString()],\n {\n initiator: watchOpts.initiator || CompilationInitiator.ComponentChanged,\n deleteDistDir,\n generateTypes: watchOpts.generateTypes,\n },\n true\n );\n return {\n results: buildResults,\n toString() {\n return formatCompileResults(buildResults, watchOpts.verbose);\n },\n };\n }\n\n async onPreWatch(componentIds: ComponentID[], watchOpts: WatchOptions) {\n if (watchOpts.preCompile) {\n const start = Date.now();\n this.logger.console(`compiling ${componentIds.length} components`);\n await this.compileComponents(\n componentIds.map((id) => id),\n { initiator: CompilationInitiator.PreWatch, generateTypes: watchOpts.generateTypes }\n );\n const end = Date.now() - start;\n this.logger.consoleSuccess(`compiled ${componentIds.length} components successfully (${end / 1000} sec)`);\n }\n }\n\n async compileComponents(\n componentsIds: string[] | ComponentID[] | ComponentID[], // when empty, it compiles new+modified (unless options.all is set),\n options: CompileOptions,\n noThrow?: boolean,\n componentLoadOptions: WorkspaceComponentLoadOptions = {},\n graph?: CompIdGraph\n ): Promise<BuildResult[]> {\n if (!this.workspace) throw new OutsideWorkspaceError();\n const componentIds = await this.getIdsToCompile(componentsIds, options.changed);\n // In case the aspect failed to load, we want to compile it without try to re-load it again\n if (options.initiator === CompilationInitiator.AspectLoadFail) {\n componentLoadOptions.loadSeedersAsAspects = false;\n }\n let components = await this.workspace.getMany(componentIds, componentLoadOptions);\n await this.loadExternalEnvs(components);\n // reload components as we might cleared the cache as part of the loadExternalEnvs\n components = await this.workspace.getMany(componentIds, componentLoadOptions);\n const grouped = await this.buildGroupsToCompile(components, graph);\n\n const results = await mapSeries(grouped, async (group) => {\n return this.runCompileComponents(group.components, options, noThrow);\n });\n const linkComponents = options.linkComponents ?? true;\n if (linkComponents) {\n await linkToNodeModulesByComponents(components, this.workspace);\n }\n return results.flat();\n }\n\n /**\n * This will ensue that the envs of the components are loaded before the compilation starts.\n * @param components\n */\n private async loadExternalEnvs(components: Component[]) {\n const componentsIdsStr = components.map((c) => c.id.toString());\n const envIdsCompIdsMap = {};\n const compsWithWrongEnvId: string[] = [];\n await Promise.all(\n components.map(async (component) => {\n // It's important to use calculate here to get the real id even if it's not loaded\n const envId = (await this.envs.calculateEnvId(component)).toString();\n // This might be different from the env id above, because the component might be loaded before the env\n // in that case we will need to clear the cache of that component\n const envIdByGet = this.envs.getEnvId(component);\n if (envId !== envIdByGet) {\n compsWithWrongEnvId.push(component.id.toString());\n }\n // If it's part of the components it will be handled later as it's not external\n // and might need to be compiled as well\n if (componentsIdsStr.includes(envId)) return undefined;\n if (!envIdsCompIdsMap[envId]) envIdsCompIdsMap[envId] = [component.id.toString()];\n envIdsCompIdsMap[envId].push(component.id.toString());\n })\n );\n const externalEnvsIds = Object.keys(envIdsCompIdsMap);\n\n if (!externalEnvsIds.length) return;\n const nonLoadedEnvs = externalEnvsIds.filter((envId) => !this.envs.isEnvRegistered(envId));\n await this.workspace.loadAspects(nonLoadedEnvs);\n const idsToClearCache: string[] = uniq(\n nonLoadedEnvs\n .reduce((acc, envId) => {\n const compIds = envIdsCompIdsMap[envId];\n return [...acc, ...compIds];\n }, [] as string[])\n .concat(compsWithWrongEnvId)\n );\n this.workspace.clearComponentsCache(idsToClearCache.map((id) => ComponentID.fromString(id)));\n }\n\n private async runCompileComponents(\n components: Component[],\n options: CompileOptions,\n noThrow?: boolean\n ): Promise<BuildResult[]> {\n const componentsCompilers: ComponentCompiler[] = [];\n\n components.forEach((c) => {\n const env = this.envs.getOrCalculateEnv(c);\n const environment = env.env;\n const compilerInstance = environment.getCompiler?.();\n\n if (compilerInstance) {\n const compilerName = compilerInstance.constructor.name || 'compiler';\n componentsCompilers.push(\n new ComponentCompiler(this.pubsub, this.workspace, c, compilerInstance, compilerName, this.logger, env)\n );\n } else {\n this.logger.warn(`unable to find a compiler instance for ${c.id.toString()}`);\n }\n });\n\n const typeGeneratorParamsPerEnv = options.generateTypes\n ? await this.getTypesCompilerPerEnv(componentsCompilers)\n : undefined;\n\n if (typeGeneratorParamsPerEnv) {\n await this.preGenerateTypesOnWorkspace(typeGeneratorParamsPerEnv);\n }\n\n const resultOnWorkspace = await mapSeries(componentsCompilers, (componentCompiler) =>\n componentCompiler.compile(noThrow, options)\n );\n\n if (typeGeneratorParamsPerEnv) {\n await this.generateTypesOnWorkspace(typeGeneratorParamsPerEnv, componentsCompilers);\n }\n\n return resultOnWorkspace;\n }\n\n private async getTypesCompilerPerEnv(componentsCompilers: ComponentCompiler[]): Promise<TypeGeneratorParamsPerEnv[]> {\n const envsMap: { [envId: string]: ComponentCompiler[] } = {};\n componentsCompilers.forEach((componentCompiler) => {\n const envId = componentCompiler.env.id;\n if (!envsMap[envId]) envsMap[envId] = [];\n envsMap[envId].push(componentCompiler);\n });\n\n const results = await mapSeries(Object.keys(envsMap), async (envId) => {\n const componentCompilers = envsMap[envId];\n const compParams = await Promise.all(\n componentCompilers.map(async (componentCompiler) => {\n return {\n component: componentCompiler.component,\n packageDir: path.join(this.workspace.path, componentCompiler.getPackageDir()),\n };\n })\n );\n\n let typeCompiler = componentCompilers[0].compilerInstance;\n if (!typeCompiler.preGenerateTypesOnWorkspace) {\n const buildPipe = componentCompilers[0].env.env.getBuildPipe();\n const compilerTasks = buildPipe.filter((task) => task.aspectId === CompilerAspect.id);\n const tsTask = compilerTasks.find(\n (task) => task.compilerInstance && task.compilerInstance.displayName === 'TypeScript'\n );\n if (!tsTask) return;\n typeCompiler = tsTask.compilerInstance;\n if (!typeCompiler.preGenerateTypesOnWorkspace) return;\n }\n return { envId, compParams, typeCompiler };\n });\n return compact(results);\n }\n\n private async preGenerateTypesOnWorkspace(typesGeneratorParamsPerEnv: TypeGeneratorParamsPerEnv[]) {\n await mapSeries(typesGeneratorParamsPerEnv, async ({ envId, compParams, typeCompiler }) => {\n await typeCompiler.preGenerateTypesOnWorkspace!(compParams, envId);\n });\n }\n\n private async generateTypesOnWorkspace(\n typesGeneratorParamsPerEnv: TypeGeneratorParamsPerEnv[],\n componentsCompilers: ComponentCompiler[]\n ) {\n await mapSeries(typesGeneratorParamsPerEnv, async ({ compParams, typeCompiler }) => {\n await typeCompiler.generateTypesOnWorkspace!(path.join(this.workspace.path, 'node_modules'), compParams);\n });\n await Promise.all(componentsCompilers.map((componentCompiler) => componentCompiler.copyTypesToOtherDists()));\n }\n\n /**\n * This function groups the components to compile into groups by their environment and dependencies.\n * The order of the groups is important, the first group should be compiled first.\n * The order inside the group is not important.\n * The groups are:\n * 1. dependencies of envs of envs.\n * 2. envs of envs.\n * 3. dependencies of envs.\n * 4. envs.\n * 5. the rest.\n * @param ids\n */\n async buildGroupsToCompile(\n components: Component[],\n graph?: CompIdGraph\n ): Promise<\n Array<{\n components: Component[];\n envsOfEnvs?: boolean;\n envs?: boolean;\n depsOfEnvsOfEnvs?: boolean;\n depsOfEnvs?: boolean;\n other?: boolean;\n }>\n > {\n const envCompIds = await Promise.all(\n components\n // .map((component) => this.envs.getEnvId(component))\n .map(async (component) => {\n const envId = await this.envs.calculateEnvId(component);\n return envId.toString();\n })\n );\n const envsIds = uniq(envCompIds);\n const groupedByIsEnv = groupBy(components, (component) => {\n if (envsIds.includes(component.id.toString())) return 'envs';\n if (this.envs.isEnv(component)) return 'envs';\n return 'other';\n });\n const envsOfEnvsCompIds = await Promise.all(\n (groupedByIsEnv.envs || [])\n // .map((component) => this.envs.getEnvId(component))\n .map(async (component) => (await this.envs.calculateEnvId(component)).toString())\n );\n const groupedByEnvsOfEnvs = groupBy(groupedByIsEnv.envs, (component) => {\n if (envsOfEnvsCompIds.includes(component.id.toString())) return 'envsOfEnvs';\n return 'otherEnvs';\n });\n const envsOfEnvsWithoutCoreCompIds = envsOfEnvsCompIds.filter((id) => !this.envs.isCoreEnv(id));\n let depsOfEnvsOfEnvsCompIds: string[] = [];\n if (graph) {\n const subGraph = graph.successorsSubgraph(envsOfEnvsWithoutCoreCompIds, {\n nodeFilter: (node) => this.workspace.hasId(node.attr),\n });\n depsOfEnvsOfEnvsCompIds = subGraph.nodes.map((n) => n.id);\n } else {\n const depsOfEnvsOfEnvsCompLists = (groupedByEnvsOfEnvs.envsOfEnvs || []).map((envComp) =>\n this.dependencyResolver.getDependencies(envComp)\n );\n depsOfEnvsOfEnvsCompIds = DependencyList.merge(depsOfEnvsOfEnvsCompLists)\n .getComponentDependencies()\n .map((dep) => dep.id.toString());\n }\n const groupedByIsDepsOfEnvsOfEnvs = groupBy(groupedByIsEnv.other, (component) => {\n if (depsOfEnvsOfEnvsCompIds.includes(component.id.toString())) return 'depsOfEnvsOfEnvs';\n return 'other';\n });\n let depsOfEnvsOfCompIds: string[] = [];\n if (graph) {\n const otherEnvsIds = (groupedByEnvsOfEnvs.otherEnvs || []).map((c) => c.id.toString());\n if (otherEnvsIds.length) {\n const otherEnvsWithoutCoreIds = otherEnvsIds.filter((id) => !this.envs.isCoreEnv(id));\n const subGraph = graph.successorsSubgraph(otherEnvsWithoutCoreIds, {\n nodeFilter: (node) => this.workspace.hasId(node.attr),\n });\n depsOfEnvsOfCompIds = subGraph.nodes.map((n) => n.id);\n }\n } else {\n const depsOfEnvsCompLists = (groupedByEnvsOfEnvs.otherEnvs || []).map((envComp) =>\n this.dependencyResolver.getDependencies(envComp)\n );\n depsOfEnvsOfCompIds = DependencyList.merge(depsOfEnvsCompLists)\n .getComponentDependencies()\n .map((dep) => dep.id.toString());\n }\n const groupedByIsDepsOfEnvs = groupBy(groupedByIsDepsOfEnvsOfEnvs.other, (component) => {\n if (depsOfEnvsOfCompIds.includes(component.id.toString())) return 'depsOfEnvs';\n return 'other';\n });\n return [\n {\n components: groupedByIsDepsOfEnvsOfEnvs.depsOfEnvsOfEnvs || [],\n depsOfEnvsOfEnvs: true,\n },\n {\n components: groupedByEnvsOfEnvs.envsOfEnvs || [],\n envsOfEnvs: true,\n },\n {\n components: groupedByIsDepsOfEnvs.depsOfEnvs || [],\n depsOfEnvs: true,\n },\n {\n components: groupedByEnvsOfEnvs.otherEnvs || [],\n envs: true,\n },\n {\n components: groupedByIsDepsOfEnvs.other || [],\n other: true,\n },\n ];\n }\n\n private async getIdsToCompile(componentsIds: Array<string | ComponentID>, changed = false): Promise<ComponentID[]> {\n if (componentsIds.length) {\n const componentIds = await this.workspace.resolveMultipleComponentIds(componentsIds);\n return this.workspace.filterIds(componentIds);\n }\n if (changed) {\n return this.workspace.getNewAndModifiedIds();\n }\n return this.workspace.listIds();\n }\n}\n\nfunction formatCompileResults(buildResults: BuildResult[], verbose?: boolean) {\n if (!buildResults.length) return '';\n // this gets called when a file is changed, so the buildResults array always has only one item\n const buildResult = buildResults[0];\n const title = ` ${chalk.underline('STATUS\\tCOMPONENT ID')}`;\n const verboseComponentFilesArrayToString = () => {\n return buildResult.buildResults.map((filePath) => ` \\t - ${filePath}`).join('\\n');\n };\n\n return `${title}\n ${Logger.successSymbol()}SUCCESS\\t${buildResult.component}\\n\n ${verbose ? `${verboseComponentFilesArrayToString()}\\n` : ''}`;\n}\n"],"mappings":";;;;;;AACA,SAAAA,YAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,WAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,QAAA;EAAA,MAAAH,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAC,OAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,SAAA;EAAA,MAAAJ,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAE,QAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAIA,SAAAK,WAAA;EAAA,MAAAL,IAAA,GAAAE,OAAA;EAAAG,UAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAGA,SAAAM,MAAA;EAAA,MAAAN,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAI,KAAA,YAAAA,CAAA;IAAA,OAAAN,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAO,OAAA;EAAA,MAAAP,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAK,MAAA,YAAAA,CAAA;IAAA,OAAAP,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAQ,aAAA;EAAA,MAAAR,IAAA,GAAAE,OAAA;EAAAM,YAAA,YAAAA,CAAA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A2B,EAAE2F,OAAiB,EAAE;EAC5E,IAAI,CAAC3F,YAAY,CAACY,MAAM,EAAE,OAAO,EAAE;EACnC;EACA,MAAMgO,WAAW,GAAG5O,YAAY,CAAC,CAAC,CAAC;EACnC,MAAM6O,KAAK,GAAG,IAAIC,gBAAK,CAACC,SAAS,CAAC,sBAAsB,CAAC,EAAE;EAC3D,MAAMC,kCAAkC,GAAGA,CAAA,KAAM;IAC/C,OAAOJ,WAAW,CAAC5O,YAAY,CAACT,GAAG,CAAE6D,QAAQ,IAAK,SAASA,QAAQ,EAAE,CAAC,CAACzC,IAAI,CAAC,IAAI,CAAC;EACnF,CAAC;EAED,OAAO,GAAGkO,KAAK;AACjB,IAAII,gBAAM,CAACC,aAAa,CAAC,CAAC,YAAYN,WAAW,CAACpR,SAAS;AAC3D,IAAImI,OAAO,GAAG,GAAGqJ,kCAAkC,CAAC,CAAC,IAAI,GAAG,EAAE,EAAE;AAChE","ignoreList":[]}
1
+ {"version":3,"names":["_pMapSeries","data","_interopRequireDefault","require","_globby","_fsExtra","_workspace","_path","_chalk","_componentId","_logger","_legacy","_component","_workspaceModules","_dependencyResolver","_pkgModules","_workspace2","_lodash","_compiler","_events","_types","e","__esModule","default","_defineProperty","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","ComponentCompiler","constructor","pubsub","workspace","component","compilerInstance","compilerId","logger","env","dists","compileErrors","compile","noThrow","options","dataToPersist","deleteDistDir","distDirs","DataToPersist","distDir","removePath","RemovePath","addBasePath","path","persistAllToFS","compilers","canTranspileFile","find","c","transpileFile","canTranspileComponent","transpileComponent","Promise","all","filesystem","files","map","file","compileOneFile","initiator","compileAllFiles","Error","toString","throwOnCompileErrors","addManyFiles","buildResults","distFile","state","_consumer","compiler","consoleSuccess","id","errors","getPackageDir","packageName","componentIdToPackageName","join","length","forEach","errorItem","error","formatError","err","pub","CompilerAspect","CompilerErrorEvent","console","message","packageDir","distDirName","getDistDir","DEFAULT_DIST_DIRNAME","injectedDirs","getInjectedDirs","dist","rootDirs","readRootComponentsDir","rootComponentsPath","rootDir","relative","componentDir","copyTypesToOtherDists","packageDistDir","otherDirs","slice","packageDistDirAbs","matches","globby","cwd","onlyFiles","ignore","distDirAbs","match","source","dest","fs","copyFile","copyCompiledFilesToOtherDists","outputDir","getComponentPackagePath","sourceDistDirAbs","pathExists","outputDirRelative","sourceDistDirRelative","filter","dir","ensureDir","dirname","filePath","isFileSupported","compileResults","contents","push","base","result","Dist","outputPath","Buffer","from","outputText","shouldCopyNonSupportedFiles","filesToCompile","exports","WorkspaceCompiler","envs","aspectLoader","ui","dependencyResolver","watcher","Set","registerOnComponentChange","onComponentChange","bind","registerOnComponentAdd","onComponentAdd","registerOnPreWatch","onPreWatch","registerPreStart","onPreStart","registerOnAspectLoadErrorSlot","onAspectLoadFail","preStartOpts","skipCompilation","compileComponents","changed","verbose","CompilationInitiator","PreStart","watchScopeInternalFiles","code","includes","inInstallContext","inInstallAfterPmContext","shouldCompile","idStr","componentsBeingProcessedInOnAspectLoadFail","has","debug","add","graph","successors","getEnvDepsGraph","depsIds","s","AspectLoadFail","loadExtensions","executeLoadSlot","delete","envComponentId","getGraphIds","nodeFilter","node","hasId","attr","watchOpts","undefined","removedFiles","Boolean","removeLinksFromNodeModules","ComponentChanged","generateTypes","results","formatCompileResults","componentIds","preCompile","start","Date","now","PreWatch","end","componentsIds","componentLoadOptions","OutsideWorkspaceError","getIdsToCompile","loadSeedersAsAspects","components","getMany","loadExternalEnvs","grouped","buildGroupsToCompile","mapSeries","group","runCompileComponents","linkComponents","linkToNodeModulesByComponents","flat","componentsIdsStr","envIdsCompIdsMap","compsWithWrongEnvId","envId","calculateEnvId","envIdByGet","getEnvId","externalEnvsIds","keys","nonLoadedEnvs","isEnvRegistered","loadAspects","idsToClearCache","uniq","reduce","acc","compIds","concat","clearComponentsCache","ComponentID","fromString","componentsCompilers","getOrCalculateEnv","environment","getCompiler","compilerName","name","warn","typeGeneratorParamsPerEnv","getTypesCompilerPerEnv","preGenerateTypesOnWorkspace","resultOnWorkspace","componentCompiler","generateTypesOnWorkspace","envsMap","componentCompilers","compParams","typeCompiler","buildPipe","getBuildPipe","compilerTasks","task","aspectId","tsTask","displayName","compact","typesGeneratorParamsPerEnv","envCompIds","envsIds","groupedByIsEnv","groupBy","isEnv","envsOfEnvsCompIds","groupedByEnvsOfEnvs","envsOfEnvsWithoutCoreCompIds","isCoreEnv","depsOfEnvsOfEnvsCompIds","subGraph","successorsSubgraph","nodes","n","depsOfEnvsOfEnvsCompLists","envsOfEnvs","envComp","getDependencies","DependencyList","merge","getComponentDependencies","dep","groupedByIsDepsOfEnvsOfEnvs","other","depsOfEnvsOfCompIds","otherEnvsIds","otherEnvs","otherEnvsWithoutCoreIds","depsOfEnvsCompLists","groupedByIsDepsOfEnvs","depsOfEnvsOfEnvs","depsOfEnvs","resolveMultipleComponentIds","filterIds","getNewAndModifiedIds","listIds","buildResult","title","chalk","underline","verboseComponentFilesArrayToString","Logger","successSymbol"],"sources":["workspace-compiler.ts"],"sourcesContent":["/* eslint-disable max-classes-per-file */\nimport mapSeries from 'p-map-series';\nimport globby from 'globby';\nimport fs from 'fs-extra';\nimport type { Component } from '@teambit/component';\nimport type { EnvDefinition, EnvsMain } from '@teambit/envs';\nimport type { PubsubMain } from '@teambit/pubsub';\nimport { OutsideWorkspaceError } from '@teambit/workspace';\nimport type { WorkspaceComponentLoadOptions, SerializableResults, Workspace } from '@teambit/workspace';\nimport type { WatcherMain, WatchOptions } from '@teambit/watcher';\nimport path from 'path';\nimport chalk from 'chalk';\nimport { ComponentID } from '@teambit/component-id';\nimport { Logger } from '@teambit/logger';\nimport { DEFAULT_DIST_DIRNAME } from '@teambit/legacy.constants';\nimport type { AbstractVinyl } from '@teambit/component.sources';\nimport { Dist, DataToPersist, RemovePath } from '@teambit/component.sources';\nimport {\n linkToNodeModulesByComponents,\n removeLinksFromNodeModules,\n} from '@teambit/workspace.modules.node-modules-linker';\nimport type { AspectLoaderMain } from '@teambit/aspect-loader';\nimport type { DependencyResolverMain } from '@teambit/dependency-resolver';\nimport { DependencyList } from '@teambit/dependency-resolver';\nimport type { PathOsBasedAbsolute, PathOsBasedRelative } from '@teambit/toolbox.path.path';\nimport { componentIdToPackageName } from '@teambit/pkg.modules.component-package-name';\nimport type { UiMain, PreStartOpts } from '@teambit/ui';\nimport { readRootComponentsDir } from '@teambit/workspace.root-components';\nimport { compact, groupBy, uniq } from 'lodash';\nimport type { MultiCompiler } from '@teambit/multi-compiler';\nimport type { CompIdGraph } from '@teambit/graph';\nimport { CompilerAspect } from './compiler.aspect';\nimport { CompilerErrorEvent } from './events';\nimport type { Compiler, TypeGeneratorCompParams } from './types';\nimport { CompilationInitiator } from './types';\n\nexport type BuildResult = {\n component: string;\n buildResults: string[];\n errors: CompileError[];\n};\n\nexport type CompileOptions = {\n changed?: boolean; // compile only new and modified components\n verbose?: boolean; // show more data, such as, dist paths\n /**\n * whether the dist root dir should be deleted before writing new dists.\n * defaults to true for `bit compile` and false everywhere else, such as `bit watch` and `bit\n * start` to avoid webpack \"EINTR\" error.\n */\n deleteDistDir?: boolean;\n initiator: CompilationInitiator; // describes where the compilation is coming from\n // should we create links in node_modules for the compiled components (default = true)\n // this will link the source files, and create the package.json\n linkComponents?: boolean;\n /**\n * whether to generate types after the compilation, default = false.\n * keep in mind that it's a heavy operation, and hurts the performance.\n */\n generateTypes?: boolean;\n};\n\nexport type CompileError = { path: string; error: Error };\n\nexport class ComponentCompiler {\n constructor(\n private pubsub: PubsubMain,\n private workspace: Workspace,\n readonly component: Component,\n readonly compilerInstance: Compiler,\n private compilerId: string,\n private logger: Logger,\n readonly env: EnvDefinition,\n private dists: Dist[] = [],\n private compileErrors: CompileError[] = []\n ) {}\n\n async compile(noThrow = true, options: CompileOptions): Promise<BuildResult> {\n let dataToPersist;\n const deleteDistDir = options.deleteDistDir ?? this.compilerInstance.deleteDistDir;\n const distDirs = await this.distDirs();\n // delete dist folder before transpilation (because some compilers (like ngPackagr) can generate files there during the compilation process)\n if (deleteDistDir) {\n dataToPersist = new DataToPersist();\n for (const distDir of distDirs) {\n dataToPersist.removePath(new RemovePath(distDir));\n }\n dataToPersist.addBasePath(this.workspace.path);\n await dataToPersist.persistAllToFS();\n }\n\n const compilers: Compiler[] = (this.compilerInstance as MultiCompiler).compilers\n ? (this.compilerInstance as MultiCompiler).compilers\n : [this.compilerInstance];\n const canTranspileFile = compilers.find((c) => c.transpileFile);\n const canTranspileComponent = compilers.find((c) => c.transpileComponent);\n\n if (canTranspileFile) {\n await Promise.all(\n this.component.filesystem.files.map((file: AbstractVinyl) =>\n this.compileOneFile(file, options.initiator, distDirs)\n )\n );\n }\n\n if (canTranspileComponent) {\n await this.compileAllFiles(options.initiator, distDirs);\n }\n\n if (!canTranspileFile && !canTranspileComponent) {\n throw new Error(\n `compiler ${this.compilerId.toString()} doesn't implement either \"transpileFile\" or \"transpileComponent\" methods`\n );\n }\n this.throwOnCompileErrors(noThrow);\n\n // writing the dists with `component.setDists(dists); component.dists.writeDists` is tricky\n // as it uses other base-paths and doesn't respect the new node-modules base path.\n dataToPersist = new DataToPersist();\n dataToPersist.addManyFiles(this.dists);\n dataToPersist.addBasePath(this.workspace.path);\n await dataToPersist.persistAllToFS();\n const buildResults = this.dists.map((distFile) => distFile.path);\n if (this.component.state._consumer.compiler) this.logger.consoleSuccess();\n\n return { component: this.component.id.toString(), buildResults, errors: this.compileErrors };\n }\n\n getPackageDir() {\n const packageName = componentIdToPackageName(this.component.state._consumer);\n return path.join('node_modules', packageName);\n }\n\n private throwOnCompileErrors(noThrow = true) {\n if (this.compileErrors.length) {\n this.compileErrors.forEach((errorItem) => {\n this.logger.error(`compilation error at ${errorItem.path}`, errorItem.error);\n });\n const formatError = (errorItem) => `${errorItem.path}\\n${errorItem.error}`;\n const err = new Error(`compilation failed. see the following errors from the compiler\n${this.compileErrors.map(formatError).join('\\n')}`);\n\n this.pubsub.pub(CompilerAspect.id, new CompilerErrorEvent(err));\n\n if (!noThrow) {\n throw err;\n }\n\n this.logger.console(err.message);\n }\n }\n\n private async distDirs(): Promise<PathOsBasedRelative[]> {\n const packageName = componentIdToPackageName(this.component.state._consumer);\n const packageDir = path.join('node_modules', packageName);\n const distDirName = this.compilerInstance.getDistDir?.() || DEFAULT_DIST_DIRNAME;\n const injectedDirs = await this.getInjectedDirs(packageName);\n return [packageDir, ...injectedDirs].map((dist) => path.join(dist, distDirName));\n }\n\n private async getInjectedDirs(packageName: string): Promise<string[]> {\n const injectedDirs = await this.workspace.getInjectedDirs(this.component);\n if (injectedDirs.length > 0) return injectedDirs;\n\n const rootDirs = await readRootComponentsDir(this.workspace.rootComponentsPath);\n return rootDirs.map((rootDir) => path.relative(this.workspace.path, path.join(rootDir, packageName)));\n }\n\n private get componentDir(): PathOsBasedAbsolute {\n return this.workspace.componentDir(this.component.id);\n }\n\n async copyTypesToOtherDists() {\n const distDirs = await this.distDirs();\n if (distDirs.length <= 1) return;\n const packageDistDir = distDirs[0];\n const otherDirs = distDirs.slice(1);\n const packageDistDirAbs = path.join(this.workspace.path, packageDistDir);\n const matches = await globby(`**/*.d.ts`, {\n cwd: packageDistDirAbs,\n onlyFiles: true,\n ignore: [`${packageDistDir}/node_modules/`],\n });\n if (!matches.length) return;\n await Promise.all(\n otherDirs.map(async (distDir) => {\n const distDirAbs = path.join(this.workspace.path, distDir);\n await Promise.all(\n matches.map(async (match) => {\n const source = path.join(packageDistDirAbs, match);\n const dest = path.join(distDirAbs, match);\n await fs.copyFile(source, dest);\n })\n );\n })\n );\n }\n\n /**\n * Copy all compiled files from the outputDir (where the compiler wrote) to all other dist directories.\n * This is needed for compilers that use transpileComponent and write directly to the filesystem,\n * as they only receive one outputDir but files need to be available in all dist locations.\n */\n async copyCompiledFilesToOtherDists() {\n const distDirs = await this.distDirs();\n if (distDirs.length <= 1) return;\n\n // The compiler writes to the outputDir from getComponentPackagePath + distDirName\n const outputDir = await this.workspace.getComponentPackagePath(this.component);\n const distDirName = this.compilerInstance.getDistDir?.() || DEFAULT_DIST_DIRNAME;\n const sourceDistDirAbs = path.join(outputDir, distDirName);\n\n // Check if the dist directory exists (compiler may not have written anything)\n if (!(await fs.pathExists(sourceDistDirAbs))) return;\n\n // Find which distDir corresponds to the outputDir and get the others\n const outputDirRelative = path.relative(this.workspace.path, outputDir);\n const sourceDistDirRelative = path.join(outputDirRelative, distDirName);\n const otherDirs = distDirs.filter((dir) => dir !== sourceDistDirRelative);\n\n if (!otherDirs.length) return;\n\n const matches = await globby(`**/*`, {\n cwd: sourceDistDirAbs,\n onlyFiles: true,\n ignore: ['node_modules/**'],\n });\n if (!matches.length) return;\n\n await Promise.all(\n otherDirs.map(async (distDir) => {\n const distDirAbs = path.join(this.workspace.path, distDir);\n await Promise.all(\n matches.map(async (match) => {\n const source = path.join(sourceDistDirAbs, match);\n const dest = path.join(distDirAbs, match);\n try {\n await fs.ensureDir(path.dirname(dest));\n await fs.copyFile(source, dest);\n } catch (err: any) {\n throw new Error(`failed to copy compiled file from \"${source}\" to \"${dest}\": ${err.message}`);\n }\n })\n );\n })\n );\n }\n\n private async compileOneFile(\n file: AbstractVinyl,\n initiator: CompilationInitiator,\n distDirs: PathOsBasedRelative[]\n ): Promise<void> {\n const options = { componentDir: this.componentDir, filePath: file.relative, initiator };\n const isFileSupported = this.compilerInstance.isFileSupported(file.path);\n let compileResults;\n if (isFileSupported) {\n try {\n compileResults = await this.compilerInstance.transpileFile?.(file.contents.toString(), options);\n } catch (error: any) {\n this.compileErrors.push({ path: file.path, error });\n return;\n }\n }\n for (const base of distDirs) {\n if (isFileSupported && compileResults) {\n this.dists.push(\n ...compileResults.map(\n (result) =>\n new Dist({\n base,\n path: path.join(base, result.outputPath),\n contents: Buffer.from(result.outputText),\n })\n )\n );\n } else if (this.compilerInstance.shouldCopyNonSupportedFiles) {\n // compiler doesn't support this file type. copy the file as is to the dist dir.\n this.dists.push(new Dist({ base, path: path.join(base, file.relative), contents: file.contents }));\n }\n }\n }\n\n private async compileAllFiles(initiator: CompilationInitiator, distDirs: PathOsBasedRelative[]): Promise<void> {\n const filesToCompile: AbstractVinyl[] = [];\n for (const base of distDirs) {\n this.component.filesystem.files.forEach((file: AbstractVinyl) => {\n const isFileSupported = this.compilerInstance.isFileSupported(file.path);\n if (isFileSupported) {\n filesToCompile.push(file);\n } else if (this.compilerInstance.shouldCopyNonSupportedFiles) {\n // compiler doesn't support this file type. copy the file as is to the dist dir.\n this.dists.push(\n new Dist({\n base,\n path: path.join(base, file.relative),\n contents: file.contents,\n })\n );\n }\n });\n }\n\n if (filesToCompile.length) {\n try {\n await this.compilerInstance.transpileComponent?.({\n component: this.component,\n componentDir: this.componentDir,\n outputDir: await this.workspace.getComponentPackagePath(this.component),\n initiator,\n });\n // Copy compiled files to all other dist directories (injected dirs)\n await this.copyCompiledFilesToOtherDists();\n } catch (error: any) {\n this.compileErrors.push({ path: this.componentDir, error });\n }\n }\n }\n}\n\ntype TypeGeneratorParamsPerEnv = { envId: string; compParams: TypeGeneratorCompParams[]; typeCompiler: Compiler };\n\nexport class WorkspaceCompiler {\n private componentsBeingProcessedInOnAspectLoadFail = new Set<string>();\n\n constructor(\n private workspace: Workspace,\n private envs: EnvsMain,\n private pubsub: PubsubMain,\n private aspectLoader: AspectLoaderMain,\n private ui: UiMain,\n private logger: Logger,\n private dependencyResolver: DependencyResolverMain,\n private watcher: WatcherMain\n ) {\n if (this.workspace) {\n this.workspace.registerOnComponentChange(this.onComponentChange.bind(this));\n this.workspace.registerOnComponentAdd(this.onComponentAdd.bind(this));\n this.watcher.registerOnPreWatch(this.onPreWatch.bind(this));\n }\n this.ui.registerPreStart(this.onPreStart.bind(this));\n if (this.aspectLoader) {\n this.aspectLoader.registerOnAspectLoadErrorSlot(this.onAspectLoadFail.bind(this));\n }\n }\n\n async onPreStart(preStartOpts: PreStartOpts): Promise<void> {\n if (this.workspace) {\n if (preStartOpts.skipCompilation) {\n return;\n }\n await this.compileComponents([], {\n changed: true,\n verbose: false,\n deleteDistDir: false,\n initiator: CompilationInitiator.PreStart,\n });\n } else {\n await this.watcher.watchScopeInternalFiles();\n }\n }\n\n async onAspectLoadFail(err: Error & { code?: string }, component: Component): Promise<boolean> {\n if (\n ((err.code &&\n (err.code === 'MODULE_NOT_FOUND' || err.code === 'ERR_MODULE_NOT_FOUND' || err.code === 'ERR_REQUIRE_ESM')) ||\n err.message.includes('import.meta') ||\n err.message.includes('exports is not defined')) &&\n this.workspace\n ) {\n const inInstallContext = this.workspace.inInstallContext;\n const inInstallAfterPmContext = this.workspace.inInstallAfterPmContext;\n // If we are now running install we only want to compile after the package manager is done\n const shouldCompile = (inInstallContext && inInstallAfterPmContext) || !inInstallContext;\n if (shouldCompile) {\n const id = component.id;\n const idStr = id.toString();\n\n // Prevent infinite loop when there's a circular dependency between an env and a component.\n // If we're already processing this component, don't re-enter.\n if (this.componentsBeingProcessedInOnAspectLoadFail.has(idStr)) {\n this.logger.debug(\n `onAspectLoadFail: skipping ${idStr} as it's already being processed (preventing infinite loop)`\n );\n return false;\n }\n\n this.componentsBeingProcessedInOnAspectLoadFail.add(idStr);\n try {\n const { graph, successors } = await this.getEnvDepsGraph(id);\n // const deps = this.dependencyResolver.getDependencies(component);\n // const depsIds = deps.getComponentDependencies().map((dep) => {\n // return dep.id.toString();\n // });\n const depsIds = successors.map((s) => s.id);\n await this.compileComponents(\n [id.toString(), ...depsIds],\n { initiator: CompilationInitiator.AspectLoadFail },\n true,\n { loadExtensions: true, executeLoadSlot: true },\n graph\n );\n return true;\n } finally {\n this.componentsBeingProcessedInOnAspectLoadFail.delete(idStr);\n }\n }\n }\n return false;\n }\n\n async getEnvDepsGraph(envComponentId: ComponentID): Promise<{ graph: CompIdGraph; successors: { id: string }[] }> {\n const graph = await this.workspace.getGraphIds([envComponentId]);\n const successors = graph.successors(envComponentId.toString(), {\n nodeFilter: (node) => this.workspace.hasId(node.attr),\n });\n return { graph, successors };\n }\n\n async onComponentAdd(component: Component, files: string[], watchOpts: WatchOptions) {\n return this.onComponentChange(component, files, undefined, watchOpts);\n }\n\n async onComponentChange(\n component: Component,\n files: string[],\n removedFiles: string[] = [],\n watchOpts: WatchOptions\n ): Promise<SerializableResults | void> {\n if (!watchOpts.compile) return undefined;\n // when files are removed, we need to remove the dist directories and the old symlinks, otherwise, it has\n // symlinks to non-exist files and the dist has stale files\n const deleteDistDir = Boolean(removedFiles?.length);\n if (removedFiles?.length) {\n await removeLinksFromNodeModules(component, this.workspace, removedFiles);\n }\n const buildResults = await this.compileComponents(\n [component.id.toString()],\n {\n initiator: watchOpts.initiator || CompilationInitiator.ComponentChanged,\n deleteDistDir,\n generateTypes: watchOpts.generateTypes,\n },\n true\n );\n return {\n results: buildResults,\n toString() {\n return formatCompileResults(buildResults, watchOpts.verbose);\n },\n };\n }\n\n async onPreWatch(componentIds: ComponentID[], watchOpts: WatchOptions) {\n if (watchOpts.preCompile) {\n const start = Date.now();\n this.logger.console(`compiling ${componentIds.length} components`);\n await this.compileComponents(\n componentIds.map((id) => id),\n { initiator: CompilationInitiator.PreWatch, generateTypes: watchOpts.generateTypes }\n );\n const end = Date.now() - start;\n this.logger.consoleSuccess(`compiled ${componentIds.length} components successfully (${end / 1000} sec)`);\n }\n }\n\n async compileComponents(\n componentsIds: string[] | ComponentID[] | ComponentID[], // when empty, it compiles new+modified (unless options.all is set),\n options: CompileOptions,\n noThrow?: boolean,\n componentLoadOptions: WorkspaceComponentLoadOptions = {},\n graph?: CompIdGraph\n ): Promise<BuildResult[]> {\n if (!this.workspace) throw new OutsideWorkspaceError();\n const componentIds = await this.getIdsToCompile(componentsIds, options.changed);\n // In case the aspect failed to load, we want to compile it without try to re-load it again\n if (options.initiator === CompilationInitiator.AspectLoadFail) {\n componentLoadOptions.loadSeedersAsAspects = false;\n }\n let components = await this.workspace.getMany(componentIds, componentLoadOptions);\n await this.loadExternalEnvs(components);\n // reload components as we might cleared the cache as part of the loadExternalEnvs\n components = await this.workspace.getMany(componentIds, componentLoadOptions);\n const grouped = await this.buildGroupsToCompile(components, graph);\n\n const results = await mapSeries(grouped, async (group) => {\n return this.runCompileComponents(group.components, options, noThrow);\n });\n const linkComponents = options.linkComponents ?? true;\n if (linkComponents) {\n await linkToNodeModulesByComponents(components, this.workspace);\n }\n return results.flat();\n }\n\n /**\n * This will ensue that the envs of the components are loaded before the compilation starts.\n * @param components\n */\n private async loadExternalEnvs(components: Component[]) {\n const componentsIdsStr = components.map((c) => c.id.toString());\n const envIdsCompIdsMap = {};\n const compsWithWrongEnvId: string[] = [];\n await Promise.all(\n components.map(async (component) => {\n // It's important to use calculate here to get the real id even if it's not loaded\n const envId = (await this.envs.calculateEnvId(component)).toString();\n // This might be different from the env id above, because the component might be loaded before the env\n // in that case we will need to clear the cache of that component\n const envIdByGet = this.envs.getEnvId(component);\n if (envId !== envIdByGet) {\n compsWithWrongEnvId.push(component.id.toString());\n }\n // If it's part of the components it will be handled later as it's not external\n // and might need to be compiled as well\n if (componentsIdsStr.includes(envId)) return undefined;\n if (!envIdsCompIdsMap[envId]) envIdsCompIdsMap[envId] = [component.id.toString()];\n envIdsCompIdsMap[envId].push(component.id.toString());\n })\n );\n const externalEnvsIds = Object.keys(envIdsCompIdsMap);\n\n if (!externalEnvsIds.length) return;\n const nonLoadedEnvs = externalEnvsIds.filter((envId) => !this.envs.isEnvRegistered(envId));\n await this.workspace.loadAspects(nonLoadedEnvs);\n const idsToClearCache: string[] = uniq(\n nonLoadedEnvs\n .reduce((acc, envId) => {\n const compIds = envIdsCompIdsMap[envId];\n return [...acc, ...compIds];\n }, [] as string[])\n .concat(compsWithWrongEnvId)\n );\n this.workspace.clearComponentsCache(idsToClearCache.map((id) => ComponentID.fromString(id)));\n }\n\n private async runCompileComponents(\n components: Component[],\n options: CompileOptions,\n noThrow?: boolean\n ): Promise<BuildResult[]> {\n const componentsCompilers: ComponentCompiler[] = [];\n\n components.forEach((c) => {\n const env = this.envs.getOrCalculateEnv(c);\n const environment = env.env;\n const compilerInstance = environment.getCompiler?.();\n\n if (compilerInstance) {\n const compilerName = compilerInstance.constructor.name || 'compiler';\n componentsCompilers.push(\n new ComponentCompiler(this.pubsub, this.workspace, c, compilerInstance, compilerName, this.logger, env)\n );\n } else {\n this.logger.warn(`unable to find a compiler instance for ${c.id.toString()}`);\n }\n });\n\n const typeGeneratorParamsPerEnv = options.generateTypes\n ? await this.getTypesCompilerPerEnv(componentsCompilers)\n : undefined;\n\n if (typeGeneratorParamsPerEnv) {\n await this.preGenerateTypesOnWorkspace(typeGeneratorParamsPerEnv);\n }\n\n const resultOnWorkspace = await mapSeries(componentsCompilers, (componentCompiler) =>\n componentCompiler.compile(noThrow, options)\n );\n\n if (typeGeneratorParamsPerEnv) {\n await this.generateTypesOnWorkspace(typeGeneratorParamsPerEnv, componentsCompilers);\n }\n\n return resultOnWorkspace;\n }\n\n private async getTypesCompilerPerEnv(componentsCompilers: ComponentCompiler[]): Promise<TypeGeneratorParamsPerEnv[]> {\n const envsMap: { [envId: string]: ComponentCompiler[] } = {};\n componentsCompilers.forEach((componentCompiler) => {\n const envId = componentCompiler.env.id;\n if (!envsMap[envId]) envsMap[envId] = [];\n envsMap[envId].push(componentCompiler);\n });\n\n const results = await mapSeries(Object.keys(envsMap), async (envId) => {\n const componentCompilers = envsMap[envId];\n const compParams = await Promise.all(\n componentCompilers.map(async (componentCompiler) => {\n return {\n component: componentCompiler.component,\n packageDir: path.join(this.workspace.path, componentCompiler.getPackageDir()),\n };\n })\n );\n\n let typeCompiler = componentCompilers[0].compilerInstance;\n if (!typeCompiler.preGenerateTypesOnWorkspace) {\n const buildPipe = componentCompilers[0].env.env.getBuildPipe();\n const compilerTasks = buildPipe.filter((task) => task.aspectId === CompilerAspect.id);\n const tsTask = compilerTasks.find(\n (task) => task.compilerInstance && task.compilerInstance.displayName === 'TypeScript'\n );\n if (!tsTask) return;\n typeCompiler = tsTask.compilerInstance;\n if (!typeCompiler.preGenerateTypesOnWorkspace) return;\n }\n return { envId, compParams, typeCompiler };\n });\n return compact(results);\n }\n\n private async preGenerateTypesOnWorkspace(typesGeneratorParamsPerEnv: TypeGeneratorParamsPerEnv[]) {\n await mapSeries(typesGeneratorParamsPerEnv, async ({ envId, compParams, typeCompiler }) => {\n await typeCompiler.preGenerateTypesOnWorkspace!(compParams, envId);\n });\n }\n\n private async generateTypesOnWorkspace(\n typesGeneratorParamsPerEnv: TypeGeneratorParamsPerEnv[],\n componentsCompilers: ComponentCompiler[]\n ) {\n await mapSeries(typesGeneratorParamsPerEnv, async ({ compParams, typeCompiler }) => {\n await typeCompiler.generateTypesOnWorkspace!(path.join(this.workspace.path, 'node_modules'), compParams);\n });\n await Promise.all(componentsCompilers.map((componentCompiler) => componentCompiler.copyTypesToOtherDists()));\n }\n\n /**\n * This function groups the components to compile into groups by their environment and dependencies.\n * The order of the groups is important, the first group should be compiled first.\n * The order inside the group is not important.\n * The groups are:\n * 1. dependencies of envs of envs.\n * 2. envs of envs.\n * 3. dependencies of envs.\n * 4. envs.\n * 5. the rest.\n * @param ids\n */\n async buildGroupsToCompile(\n components: Component[],\n graph?: CompIdGraph\n ): Promise<\n Array<{\n components: Component[];\n envsOfEnvs?: boolean;\n envs?: boolean;\n depsOfEnvsOfEnvs?: boolean;\n depsOfEnvs?: boolean;\n other?: boolean;\n }>\n > {\n const envCompIds = await Promise.all(\n components\n // .map((component) => this.envs.getEnvId(component))\n .map(async (component) => {\n const envId = await this.envs.calculateEnvId(component);\n return envId.toString();\n })\n );\n const envsIds = uniq(envCompIds);\n const groupedByIsEnv = groupBy(components, (component) => {\n if (envsIds.includes(component.id.toString())) return 'envs';\n if (this.envs.isEnv(component)) return 'envs';\n return 'other';\n });\n const envsOfEnvsCompIds = await Promise.all(\n (groupedByIsEnv.envs || [])\n // .map((component) => this.envs.getEnvId(component))\n .map(async (component) => (await this.envs.calculateEnvId(component)).toString())\n );\n const groupedByEnvsOfEnvs = groupBy(groupedByIsEnv.envs, (component) => {\n if (envsOfEnvsCompIds.includes(component.id.toString())) return 'envsOfEnvs';\n return 'otherEnvs';\n });\n const envsOfEnvsWithoutCoreCompIds = envsOfEnvsCompIds.filter((id) => !this.envs.isCoreEnv(id));\n let depsOfEnvsOfEnvsCompIds: string[] = [];\n if (graph) {\n const subGraph = graph.successorsSubgraph(envsOfEnvsWithoutCoreCompIds, {\n nodeFilter: (node) => this.workspace.hasId(node.attr),\n });\n depsOfEnvsOfEnvsCompIds = subGraph.nodes.map((n) => n.id);\n } else {\n const depsOfEnvsOfEnvsCompLists = (groupedByEnvsOfEnvs.envsOfEnvs || []).map((envComp) =>\n this.dependencyResolver.getDependencies(envComp)\n );\n depsOfEnvsOfEnvsCompIds = DependencyList.merge(depsOfEnvsOfEnvsCompLists)\n .getComponentDependencies()\n .map((dep) => dep.id.toString());\n }\n const groupedByIsDepsOfEnvsOfEnvs = groupBy(groupedByIsEnv.other, (component) => {\n if (depsOfEnvsOfEnvsCompIds.includes(component.id.toString())) return 'depsOfEnvsOfEnvs';\n return 'other';\n });\n let depsOfEnvsOfCompIds: string[] = [];\n if (graph) {\n const otherEnvsIds = (groupedByEnvsOfEnvs.otherEnvs || []).map((c) => c.id.toString());\n if (otherEnvsIds.length) {\n const otherEnvsWithoutCoreIds = otherEnvsIds.filter((id) => !this.envs.isCoreEnv(id));\n const subGraph = graph.successorsSubgraph(otherEnvsWithoutCoreIds, {\n nodeFilter: (node) => this.workspace.hasId(node.attr),\n });\n depsOfEnvsOfCompIds = subGraph.nodes.map((n) => n.id);\n }\n } else {\n const depsOfEnvsCompLists = (groupedByEnvsOfEnvs.otherEnvs || []).map((envComp) =>\n this.dependencyResolver.getDependencies(envComp)\n );\n depsOfEnvsOfCompIds = DependencyList.merge(depsOfEnvsCompLists)\n .getComponentDependencies()\n .map((dep) => dep.id.toString());\n }\n const groupedByIsDepsOfEnvs = groupBy(groupedByIsDepsOfEnvsOfEnvs.other, (component) => {\n if (depsOfEnvsOfCompIds.includes(component.id.toString())) return 'depsOfEnvs';\n return 'other';\n });\n return [\n {\n components: groupedByIsDepsOfEnvsOfEnvs.depsOfEnvsOfEnvs || [],\n depsOfEnvsOfEnvs: true,\n },\n {\n components: groupedByEnvsOfEnvs.envsOfEnvs || [],\n envsOfEnvs: true,\n },\n {\n components: groupedByIsDepsOfEnvs.depsOfEnvs || [],\n depsOfEnvs: true,\n },\n {\n components: groupedByEnvsOfEnvs.otherEnvs || [],\n envs: true,\n },\n {\n components: groupedByIsDepsOfEnvs.other || [],\n other: true,\n },\n ];\n }\n\n private async getIdsToCompile(componentsIds: Array<string | ComponentID>, changed = false): Promise<ComponentID[]> {\n if (componentsIds.length) {\n const componentIds = await this.workspace.resolveMultipleComponentIds(componentsIds);\n return this.workspace.filterIds(componentIds);\n }\n if (changed) {\n return this.workspace.getNewAndModifiedIds();\n }\n return this.workspace.listIds();\n }\n}\n\nfunction formatCompileResults(buildResults: BuildResult[], verbose?: boolean) {\n if (!buildResults.length) return '';\n // this gets called when a file is changed, so the buildResults array always has only one item\n const buildResult = buildResults[0];\n const title = ` ${chalk.underline('STATUS\\tCOMPONENT ID')}`;\n const verboseComponentFilesArrayToString = () => {\n return buildResult.buildResults.map((filePath) => ` \\t - ${filePath}`).join('\\n');\n };\n\n return `${title}\n ${Logger.successSymbol()}SUCCESS\\t${buildResult.component}\\n\n ${verbose ? `${verboseComponentFilesArrayToString()}\\n` : ''}`;\n}\n"],"mappings":";;;;;;AACA,SAAAA,YAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,WAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,QAAA;EAAA,MAAAH,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAC,OAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,SAAA;EAAA,MAAAJ,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAE,QAAA,YAAAA,CAAA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BAAA;AAED,SAAS2D,oBAAoBA,CAACzI,YAA2B,EAAEoG,OAAiB,EAAE;EAC5E,IAAI,CAACpG,YAAY,CAACY,MAAM,EAAE,OAAO,EAAE;EACnC;EACA,MAAMwO,WAAW,GAAGpP,YAAY,CAAC,CAAC,CAAC;EACnC,MAAMqP,KAAK,GAAG,IAAIC,gBAAK,CAACC,SAAS,CAAC,sBAAsB,CAAC,EAAE;EAC3D,MAAMC,kCAAkC,GAAGA,CAAA,KAAM;IAC/C,OAAOJ,WAAW,CAACpP,YAAY,CAACT,GAAG,CAAEwE,QAAQ,IAAK,SAASA,QAAQ,EAAE,CAAC,CAACpD,IAAI,CAAC,IAAI,CAAC;EACnF,CAAC;EAED,OAAO,GAAG0O,KAAK;AACjB,IAAII,gBAAM,CAACC,aAAa,CAAC,CAAC,YAAYN,WAAW,CAAC5R,SAAS;AAC3D,IAAI4I,OAAO,GAAG,GAAGoJ,kCAAkC,CAAC,CAAC,IAAI,GAAG,EAAE,EAAE;AAChE","ignoreList":[]}
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@teambit/compiler",
3
- "version": "1.0.852",
3
+ "version": "1.0.854",
4
4
  "homepage": "https://bit.cloud/teambit/compilation/compiler",
5
5
  "main": "dist/index.js",
6
6
  "componentId": {
7
7
  "scope": "teambit.compilation",
8
8
  "name": "compiler",
9
- "version": "1.0.852"
9
+ "version": "1.0.854"
10
10
  },
11
11
  "dependencies": {
12
12
  "chalk": "4.1.2",
@@ -17,33 +17,33 @@
17
17
  "lodash": "4.17.21",
18
18
  "p-map-series": "2.1.0",
19
19
  "@teambit/harmony": "0.4.7",
20
- "@teambit/component-id": "1.2.4",
21
- "@teambit/toolbox.fs.hard-link-directory": "0.0.26",
22
- "@teambit/workspace.root-components": "1.0.1",
23
- "@teambit/bit-error": "0.0.404",
24
- "@teambit/envs": "1.0.852",
25
20
  "@teambit/cli": "0.0.1294",
26
21
  "@teambit/logger": "0.0.1387",
27
- "@teambit/pubsub": "1.0.852",
28
- "@teambit/aspect-loader": "1.0.852",
29
- "@teambit/builder": "1.0.852",
30
- "@teambit/bundler": "1.0.852",
22
+ "@teambit/component-id": "1.2.4",
31
23
  "@teambit/component-issues": "0.0.168",
32
- "@teambit/component": "1.0.852",
33
- "@teambit/dependency-resolver": "1.0.852",
34
- "@teambit/generator": "1.0.853",
35
- "@teambit/issues": "1.0.852",
36
24
  "@teambit/legacy.constants": "0.0.22",
37
- "@teambit/ui": "1.0.852",
38
- "@teambit/watcher": "1.0.852",
39
- "@teambit/workspace": "1.0.852",
40
- "@teambit/isolator": "1.0.852",
25
+ "@teambit/toolbox.fs.hard-link-directory": "0.0.26",
41
26
  "@teambit/component.sources": "0.0.146",
42
27
  "@teambit/toolbox.path.path": "0.0.14",
43
- "@teambit/graph": "1.0.852",
44
- "@teambit/multi-compiler": "1.0.852",
45
28
  "@teambit/pkg.modules.component-package-name": "0.0.101",
46
- "@teambit/workspace.modules.node-modules-linker": "0.0.323"
29
+ "@teambit/workspace.modules.node-modules-linker": "0.0.323",
30
+ "@teambit/workspace.root-components": "1.0.1",
31
+ "@teambit/bit-error": "0.0.404",
32
+ "@teambit/envs": "1.0.854",
33
+ "@teambit/pubsub": "1.0.854",
34
+ "@teambit/aspect-loader": "1.0.854",
35
+ "@teambit/builder": "1.0.854",
36
+ "@teambit/bundler": "1.0.854",
37
+ "@teambit/component": "1.0.854",
38
+ "@teambit/dependency-resolver": "1.0.854",
39
+ "@teambit/generator": "1.0.855",
40
+ "@teambit/issues": "1.0.854",
41
+ "@teambit/ui": "1.0.854",
42
+ "@teambit/watcher": "1.0.854",
43
+ "@teambit/workspace": "1.0.854",
44
+ "@teambit/isolator": "1.0.854",
45
+ "@teambit/graph": "1.0.854",
46
+ "@teambit/multi-compiler": "1.0.854"
47
47
  },
48
48
  "devDependencies": {
49
49
  "@types/pretty-time": "^1.1.5",