@teambit/compiler 1.0.106 → 1.0.108
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.
- package/compiler-env-type.ts +9 -0
- package/compiler.aspect.ts +5 -0
- package/compiler.cmd.ts +121 -0
- package/compiler.main.runtime.ts +191 -0
- package/compiler.task.ts +104 -0
- package/dist/compiler.cmd.d.ts +1 -1
- package/dist/compiler.composition.d.ts +2 -2
- package/dist/compiler.main.runtime.js +2 -4
- package/dist/compiler.main.runtime.js.map +1 -1
- package/dist/compiler.service.d.ts +5 -5
- package/dist/compiler.service.js +4 -4
- package/dist/compiler.service.js.map +1 -1
- package/dist/compiler.task.d.ts +1 -1
- package/dist/dist-artifact.d.ts +1 -1
- package/dist/output-formatter.js +1 -2
- package/dist/output-formatter.js.map +1 -1
- package/dist/{preview-1703505948637.js → preview-1703647408454.js} +2 -2
- package/dist/types.d.ts +4 -4
- package/dist/workspace-compiler.d.ts +5 -5
- package/dist/workspace-compiler.js +8 -13
- package/dist/workspace-compiler.js.map +1 -1
- package/dist-artifact.ts +12 -0
- package/index.ts +15 -0
- package/output-formatter.ts +20 -0
- package/package.json +29 -36
- package/tsconfig.json +16 -21
- package/types/asset.d.ts +15 -3
- package/types.ts +154 -0
- package/workspace-compiler.ts +398 -0
package/dist/compiler.task.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { Capsule } from '@teambit/isolator';
|
|
|
3
3
|
import { EnvContext, EnvHandler } from '@teambit/envs';
|
|
4
4
|
import { DependencyResolverMain } from '@teambit/dependency-resolver';
|
|
5
5
|
import { Compiler } from './types';
|
|
6
|
-
export
|
|
6
|
+
export type CompilerTaskOptions = {
|
|
7
7
|
/**
|
|
8
8
|
* instance of compiler to use.
|
|
9
9
|
*/
|
package/dist/dist-artifact.d.ts
CHANGED
|
@@ -2,5 +2,5 @@ import { AbstractVinyl } from '@teambit/legacy/dist/consumer/component/sources';
|
|
|
2
2
|
export declare class DistArtifact {
|
|
3
3
|
private artifacts;
|
|
4
4
|
constructor(artifacts: AbstractVinyl[]);
|
|
5
|
-
getFile(path: string): AbstractVinyl
|
|
5
|
+
getFile(path: string): AbstractVinyl;
|
|
6
6
|
}
|
package/dist/output-formatter.js
CHANGED
|
@@ -20,9 +20,8 @@ const formatCompileResults = (compileResults, verbose) => compileResults.map(com
|
|
|
20
20
|
})).reduce((outputString, result) => {
|
|
21
21
|
outputString += `${result.icon} ${result.status}\t${result.componentId}`;
|
|
22
22
|
if (verbose) {
|
|
23
|
-
var _result$files;
|
|
24
23
|
outputString += ':';
|
|
25
|
-
outputString += result
|
|
24
|
+
outputString += result?.files?.reduce((fileList, file) => `${fileList}\t\t - ${file}\n`, '\n');
|
|
26
25
|
}
|
|
27
26
|
outputString += '\n';
|
|
28
27
|
return outputString;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_chalk","data","_interopRequireDefault","require","obj","__esModule","default","formatCompileResults","compileResults","verbose","map","componentResult","componentId","component","id","fullName","files","buildResults","status","errors","length","icon","chalk","red","green","reduce","outputString","result","
|
|
1
|
+
{"version":3,"names":["_chalk","data","_interopRequireDefault","require","obj","__esModule","default","formatCompileResults","compileResults","verbose","map","componentResult","componentId","component","id","fullName","files","buildResults","status","errors","length","icon","chalk","red","green","reduce","outputString","result","fileList","file","exports"],"sources":["output-formatter.ts"],"sourcesContent":["import chalk from 'chalk';\nimport { ComponentsStatus } from './compiler.cmd';\n\nexport const formatCompileResults = (compileResults: ComponentsStatus[], verbose: boolean) =>\n compileResults\n .map((componentResult: ComponentsStatus) => ({\n componentId: componentResult.component.id.fullName,\n files: componentResult.buildResults,\n status: componentResult.errors.length ? 'FAILURE' : 'SUCCESS',\n icon: componentResult.errors.length ? chalk.red('✗') : chalk.green('✔'),\n }))\n .reduce((outputString, result) => {\n outputString += `${result.icon} ${result.status}\\t${result.componentId}`;\n if (verbose) {\n outputString += ':';\n outputString += result?.files?.reduce((fileList, file) => `${fileList}\\t\\t - ${file}\\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1,5 @@
|
|
|
1
|
-
import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.compilation_compiler@1.0.
|
|
2
|
-
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.compilation_compiler@1.0.
|
|
1
|
+
import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.compilation_compiler@1.0.108/dist/compiler.composition.js';
|
|
2
|
+
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.compilation_compiler@1.0.108/dist/compiler.docs.mdx';
|
|
3
3
|
|
|
4
4
|
export const compositions = [compositions_0];
|
|
5
5
|
export const overview = [overview_0];
|
package/dist/types.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { BuildContext, BuildTask, BuiltTaskResult, TaskResultsList } from '@teambit/builder';
|
|
2
2
|
import type { Component } from '@teambit/component';
|
|
3
3
|
import { ServiceHandler } from '@teambit/envs';
|
|
4
|
-
export
|
|
4
|
+
export type TranspileFileParams = {
|
|
5
5
|
componentDir: string;
|
|
6
6
|
filePath: string;
|
|
7
7
|
};
|
|
@@ -16,17 +16,17 @@ export declare enum CompilationInitiator {
|
|
|
16
16
|
ComponentAdded = 7,
|
|
17
17
|
Install = 8
|
|
18
18
|
}
|
|
19
|
-
export
|
|
19
|
+
export type TranspileComponentParams = {
|
|
20
20
|
component: Component;
|
|
21
21
|
componentDir: string;
|
|
22
22
|
outputDir: string;
|
|
23
23
|
initiator: CompilationInitiator;
|
|
24
24
|
};
|
|
25
|
-
export
|
|
25
|
+
export type TranspileFileOutputOneFile = {
|
|
26
26
|
outputText: string;
|
|
27
27
|
outputPath: string;
|
|
28
28
|
};
|
|
29
|
-
export
|
|
29
|
+
export type TranspileFileOutput = TranspileFileOutputOneFile[] | null;
|
|
30
30
|
export interface CompilerOptions {
|
|
31
31
|
/**
|
|
32
32
|
* name of the compiler.
|
|
@@ -11,11 +11,11 @@ import { DependencyResolverMain } from '@teambit/dependency-resolver';
|
|
|
11
11
|
import { UiMain } from '@teambit/ui';
|
|
12
12
|
import type { PreStartOpts } from '@teambit/ui';
|
|
13
13
|
import { Compiler, CompilationInitiator } from './types';
|
|
14
|
-
export
|
|
14
|
+
export type BuildResult = {
|
|
15
15
|
component: string;
|
|
16
16
|
buildResults: string[] | null | undefined;
|
|
17
17
|
};
|
|
18
|
-
export
|
|
18
|
+
export type CompileOptions = {
|
|
19
19
|
changed?: boolean;
|
|
20
20
|
verbose?: boolean;
|
|
21
21
|
/**
|
|
@@ -27,7 +27,7 @@ export declare type CompileOptions = {
|
|
|
27
27
|
initiator: CompilationInitiator;
|
|
28
28
|
linkComponents?: boolean;
|
|
29
29
|
};
|
|
30
|
-
export
|
|
30
|
+
export type CompileError = {
|
|
31
31
|
path: string;
|
|
32
32
|
error: Error;
|
|
33
33
|
};
|
|
@@ -42,7 +42,7 @@ export declare class ComponentCompiler {
|
|
|
42
42
|
private dists;
|
|
43
43
|
private compileErrors;
|
|
44
44
|
constructor(pubsub: PubsubMain, workspace: Workspace, component: Component, compilerInstance: Compiler, compilerId: string, logger: Logger, dependencyResolver: DependencyResolverMain, dists?: Dist[], compileErrors?: CompileError[]);
|
|
45
|
-
compile(noThrow: boolean
|
|
45
|
+
compile(noThrow: boolean, options: CompileOptions): Promise<BuildResult>;
|
|
46
46
|
private throwOnCompileErrors;
|
|
47
47
|
private distDirs;
|
|
48
48
|
private getInjectedDirs;
|
|
@@ -65,7 +65,7 @@ export declare class WorkspaceCompiler {
|
|
|
65
65
|
code?: string;
|
|
66
66
|
}, id: ComponentID): Promise<boolean>;
|
|
67
67
|
onComponentAdd(component: Component, files: string[], watchOpts: WatchOptions): Promise<void | SerializableResults>;
|
|
68
|
-
onComponentChange(component: Component, files: string[], removedFiles: string[]
|
|
68
|
+
onComponentChange(component: Component, files: string[], removedFiles: string[], watchOpts: WatchOptions): Promise<SerializableResults | void>;
|
|
69
69
|
onPreWatch(componentIds: ComponentID[], watchOpts: WatchOptions): Promise<void>;
|
|
70
70
|
compileComponents(componentsIds: string[] | ComponentID[] | ComponentID[], // when empty, it compiles new+modified (unless options.all is set),
|
|
71
71
|
options: CompileOptions, noThrow?: boolean): Promise<BuildResult[]>;
|
|
@@ -184,10 +184,9 @@ ${this.compileErrors.map(formatError).join('\n')}`);
|
|
|
184
184
|
}
|
|
185
185
|
}
|
|
186
186
|
async distDirs() {
|
|
187
|
-
var _this$compilerInstanc, _this$compilerInstanc2;
|
|
188
187
|
const packageName = (0, _componentIdToPackageName().default)(this.component.state._consumer);
|
|
189
188
|
const packageDir = _path().default.join('node_modules', packageName);
|
|
190
|
-
const distDirName =
|
|
189
|
+
const distDirName = this.compilerInstance.getDistDir?.() || _constants().DEFAULT_DIST_DIRNAME;
|
|
191
190
|
const injectedDirs = await this.getInjectedDirs(packageName);
|
|
192
191
|
return [packageDir, ...injectedDirs].map(dist => _path().default.join(dist, distDirName));
|
|
193
192
|
}
|
|
@@ -210,8 +209,7 @@ ${this.compileErrors.map(formatError).join('\n')}`);
|
|
|
210
209
|
let compileResults;
|
|
211
210
|
if (isFileSupported) {
|
|
212
211
|
try {
|
|
213
|
-
|
|
214
|
-
compileResults = await ((_this$compilerInstanc3 = (_this$compilerInstanc4 = this.compilerInstance).transpileFile) === null || _this$compilerInstanc3 === void 0 ? void 0 : _this$compilerInstanc3.call(_this$compilerInstanc4, file.contents.toString(), options));
|
|
212
|
+
compileResults = await this.compilerInstance.transpileFile?.(file.contents.toString(), options);
|
|
215
213
|
} catch (error) {
|
|
216
214
|
this.compileErrors.push({
|
|
217
215
|
path: file.path,
|
|
@@ -256,13 +254,12 @@ ${this.compileErrors.map(formatError).join('\n')}`);
|
|
|
256
254
|
}
|
|
257
255
|
if (filesToCompile.length) {
|
|
258
256
|
try {
|
|
259
|
-
|
|
260
|
-
await ((_this$compilerInstanc5 = (_this$compilerInstanc6 = this.compilerInstance).transpileComponent) === null || _this$compilerInstanc5 === void 0 ? void 0 : _this$compilerInstanc5.call(_this$compilerInstanc6, {
|
|
257
|
+
await this.compilerInstance.transpileComponent?.({
|
|
261
258
|
component,
|
|
262
259
|
componentDir: this.componentDir,
|
|
263
260
|
outputDir: await this.workspace.getComponentPackagePath(component),
|
|
264
261
|
initiator
|
|
265
|
-
})
|
|
262
|
+
});
|
|
266
263
|
} catch (error) {
|
|
267
264
|
this.compileErrors.push({
|
|
268
265
|
path: this.componentDir,
|
|
@@ -324,8 +321,8 @@ class WorkspaceCompiler {
|
|
|
324
321
|
if (!watchOpts.compile) return undefined;
|
|
325
322
|
// when files are removed, we need to remove the dist directories and the old symlinks, otherwise, it has
|
|
326
323
|
// symlinks to non-exist files and the dist has stale files
|
|
327
|
-
const deleteDistDir = Boolean(removedFiles
|
|
328
|
-
if (removedFiles
|
|
324
|
+
const deleteDistDir = Boolean(removedFiles?.length);
|
|
325
|
+
if (removedFiles?.length) {
|
|
329
326
|
await (0, _workspaceModules().removeLinksFromNodeModules)(component, this.workspace, removedFiles);
|
|
330
327
|
}
|
|
331
328
|
const buildResults = await this.compileComponents([component.id.toString()], {
|
|
@@ -336,8 +333,7 @@ class WorkspaceCompiler {
|
|
|
336
333
|
return {
|
|
337
334
|
results: buildResults,
|
|
338
335
|
toString() {
|
|
339
|
-
|
|
340
|
-
return `${(_buildResults$ = buildResults[0]) === null || _buildResults$ === void 0 || (_buildResults$ = _buildResults$.buildResults) === null || _buildResults$ === void 0 ? void 0 : _buildResults$.join('\n\t')}`;
|
|
336
|
+
return `${buildResults[0]?.buildResults?.join('\n\t')}`;
|
|
341
337
|
}
|
|
342
338
|
};
|
|
343
339
|
}
|
|
@@ -370,9 +366,8 @@ class WorkspaceCompiler {
|
|
|
370
366
|
async runCompileComponents(components, options, noThrow) {
|
|
371
367
|
const componentsCompilers = [];
|
|
372
368
|
components.forEach(c => {
|
|
373
|
-
var _environment$getCompi;
|
|
374
369
|
const environment = this.envs.getEnv(c).env;
|
|
375
|
-
const compilerInstance =
|
|
370
|
+
const compilerInstance = environment.getCompiler?.();
|
|
376
371
|
if (compilerInstance) {
|
|
377
372
|
const compilerName = compilerInstance.constructor.name || 'compiler';
|
|
378
373
|
componentsCompilers.push(new ComponentCompiler(this.pubsub, this.workspace, c, compilerInstance, compilerName, this.logger, this.dependencyResolver));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_pMapSeries","data","_interopRequireDefault","require","_workspace","_path","_loader","_constants","_sources","_dataToPersist","_workspaceModules","_componentIdToPackageName","_removePath","_bitRoots","_lodash","_compiler","_events","_types","obj","__esModule","default","ComponentCompiler","constructor","pubsub","workspace","component","compilerInstance","compilerId","logger","dependencyResolver","dists","compileErrors","compile","noThrow","options","dataToPersist","deleteDistDir","DataToPersist","distDir","distDirs","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","linkComponents","linkToNodeModulesByComponents","buildResults","distFile","state","_consumer","compiler","loader","succeed","pub","CompilerAspect","id","ComponentCompilationOnDoneEvent","length","forEach","errorItem","error","formatError","err","join","CompilerErrorEvent","console","message","_this$compilerInstanc","_this$compilerInstanc2","packageName","componentIdToPackageName","packageDir","distDirName","getDistDir","call","DEFAULT_DIST_DIRNAME","injectedDirs","getInjectedDirs","dist","rootDirs","readBitRootsDir","rootDir","relative","componentDir","filePath","isFileSupported","compileResults","_this$compilerInstanc3","_this$compilerInstanc4","contents","push","base","result","Dist","outputPath","Buffer","from","outputText","shouldCopyNonSupportedFiles","filesToCompile","_this$compilerInstanc5","_this$compilerInstanc6","outputDir","getComponentPackagePath","exports","WorkspaceCompiler","envs","aspectLoader","ui","watcher","registerOnComponentChange","onComponentChange","bind","registerOnComponentAdd","onComponentAdd","registerOnPreWatch","onPreWatch","registerPreStart","onPreStart","registerOnAspectLoadErrorSlot","onAspectLoadFail","preStartOpts","skipCompilation","compileComponents","changed","verbose","CompilationInitiator","PreStart","watchScopeInternalFiles","code","AspectLoadFail","watchOpts","undefined","removedFiles","Boolean","removeLinksFromNodeModules","ComponentChanged","results","_buildResults$","componentIds","preCompile","start","Date","now","PreWatch","end","consoleSuccess","componentsIds","OutsideWorkspaceError","getIdsToCompile","getManyOpts","loadSeedersAsAspects","components","getMany","grouped","groupByIsEnv","envsResults","runCompileComponents","otherResults","other","componentsCompilers","_environment$getCompi","environment","getEnv","env","getCompiler","compilerName","name","warn","resultOnWorkspace","mapSeries","componentCompiler","envsIds","uniq","getEnvId","filter","envId","isCoreEnv","groupBy","includes","resolveMultipleComponentIds","filterIds","getNewAndModifiedIds","listIds"],"sources":["workspace-compiler.ts"],"sourcesContent":["/* eslint-disable max-classes-per-file */\nimport mapSeries from 'p-map-series';\nimport { Component } from '@teambit/component';\nimport { EnvsMain } from '@teambit/envs';\nimport type { PubsubMain } from '@teambit/pubsub';\nimport { SerializableResults, Workspace, OutsideWorkspaceError } from '@teambit/workspace';\nimport { WatcherMain, WatchOptions } from '@teambit/watcher';\nimport path from 'path';\nimport { ComponentID } from '@teambit/component-id';\nimport { Logger } from '@teambit/logger';\nimport loader from '@teambit/legacy/dist/cli/loader';\nimport { DEFAULT_DIST_DIRNAME } from '@teambit/legacy/dist/constants';\nimport { AbstractVinyl, Dist } from '@teambit/legacy/dist/consumer/component/sources';\nimport DataToPersist from '@teambit/legacy/dist/consumer/component/sources/data-to-persist';\nimport {\n linkToNodeModulesByComponents,\n removeLinksFromNodeModules,\n} from '@teambit/workspace.modules.node-modules-linker';\nimport { AspectLoaderMain } from '@teambit/aspect-loader';\nimport { DependencyResolverMain } from '@teambit/dependency-resolver';\nimport componentIdToPackageName from '@teambit/legacy/dist/utils/bit/component-id-to-package-name';\nimport RemovePath from '@teambit/legacy/dist/consumer/component/sources/remove-path';\nimport { UiMain } from '@teambit/ui';\nimport { readBitRootsDir } from '@teambit/bit-roots';\nimport { groupBy, uniq } from 'lodash';\nimport type { PreStartOpts } from '@teambit/ui';\nimport { PathOsBasedAbsolute, PathOsBasedRelative } from '@teambit/legacy/dist/utils/path';\nimport { MultiCompiler } from '@teambit/multi-compiler';\nimport { CompilerAspect } from './compiler.aspect';\nimport { CompilerErrorEvent, ComponentCompilationOnDoneEvent } from './events';\nimport { Compiler, CompilationInitiator } from './types';\n\nexport type BuildResult = { component: string; buildResults: string[] | null | undefined };\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\nexport type CompileError = { path: string; error: Error };\n\nexport class ComponentCompiler {\n constructor(\n private pubsub: PubsubMain,\n private workspace: Workspace,\n private component: Component,\n private compilerInstance: Compiler,\n private compilerId: string,\n private logger: Logger,\n private dependencyResolver: DependencyResolverMain,\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 // 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 await this.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) => this.compileOneFile(file, options.initiator))\n );\n }\n\n if (canTranspileComponent) {\n await this.compileAllFiles(this.component, options.initiator);\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 linkComponents = options.linkComponents ?? true;\n if (linkComponents) {\n await linkToNodeModulesByComponents([this.component], this.workspace);\n }\n const buildResults = this.dists.map((distFile) => distFile.path);\n if (this.component.state._consumer.compiler) loader.succeed();\n this.pubsub.pub(\n CompilerAspect.id,\n new ComponentCompilationOnDoneEvent(this.compileErrors, this.component, buildResults)\n );\n return { component: this.component.id.toString(), buildResults };\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 readBitRootsDir(this.workspace.path);\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 private async compileOneFile(file: AbstractVinyl, initiator: CompilationInitiator): 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 await this.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(component: Component, initiator: CompilationInitiator): Promise<void> {\n const filesToCompile: AbstractVinyl[] = [];\n for (const base of await this.distDirs()) {\n 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,\n componentDir: this.componentDir,\n outputDir: await this.workspace.getComponentPackagePath(component),\n initiator,\n });\n } catch (error: any) {\n this.compileErrors.push({ path: this.componentDir, error });\n }\n }\n }\n}\n\nexport class WorkspaceCompiler {\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 }, id: ComponentID): Promise<boolean> {\n if (err.code && err.code === 'MODULE_NOT_FOUND' && this.workspace) {\n await this.compileComponents([id.toString()], { initiator: CompilationInitiator.AspectLoadFail }, true);\n return true;\n }\n return false;\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 { initiator: watchOpts.initiator || CompilationInitiator.ComponentChanged, deleteDistDir },\n true\n );\n // await linkToNodeModulesByComponents([component], this.workspace);\n return {\n results: buildResults,\n toString() {\n return `${buildResults[0]?.buildResults?.join('\\n\\t')}`;\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 }\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 ): 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 const getManyOpts =\n options.initiator === CompilationInitiator.AspectLoadFail ? { loadSeedersAsAspects: false } : undefined;\n const components = await this.workspace.getMany(componentIds, getManyOpts);\n\n const grouped = this.groupByIsEnv(components);\n const envsResults = grouped.envs ? await this.runCompileComponents(grouped.envs, options, noThrow) : [];\n const otherResults = grouped.other ? await this.runCompileComponents(grouped.other, options, noThrow) : [];\n return [...envsResults, ...otherResults];\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 environment = this.envs.getEnv(c).env;\n const compilerInstance = environment.getCompiler?.();\n\n if (compilerInstance) {\n const compilerName = compilerInstance.constructor.name || 'compiler';\n componentsCompilers.push(\n new ComponentCompiler(\n this.pubsub,\n this.workspace,\n c,\n compilerInstance,\n compilerName,\n this.logger,\n this.dependencyResolver\n )\n );\n } else {\n this.logger.warn(`unable to find a compiler instance for ${c.id.toString()}`);\n }\n });\n const resultOnWorkspace = await mapSeries(componentsCompilers, (componentCompiler) =>\n componentCompiler.compile(noThrow, options)\n );\n\n return resultOnWorkspace;\n }\n\n /**\n * This function get's a list of aspect ids and return them grouped by whether any of them is the env of other from the list\n * @param ids\n */\n groupByIsEnv(components: Component[]): { envs?: Component[]; other?: Component[] } {\n const envsIds = uniq(\n components\n .map((component) => this.envs.getEnvId(component))\n .filter((envId) => !this.aspectLoader.isCoreEnv(envId))\n );\n const grouped = groupBy(components, (component) => {\n if (envsIds.includes(component.id.toString())) return 'envs';\n return 'other';\n });\n return grouped as { envs: Component[]; other: Component[] };\n }\n\n private async getIdsToCompile(\n componentsIds: Array<string | ComponentID | ComponentID>,\n changed = false\n ): 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"],"mappings":";;;;;;AACA,SAAAA,YAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,WAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAIA,SAAAG,WAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,UAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAI,MAAA;EAAA,MAAAJ,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAE,KAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAGA,SAAAK,QAAA;EAAA,MAAAL,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAG,OAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAA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EC,OAAO,CAC5C,CAAC;IAED,OAAO4J,iBAAiB;EAC1B;;EAEA;AACF;AACA;AACA;EACEd,YAAYA,CAACH,UAAuB,EAA+C;IACjF,MAAMoB,OAAO,GAAG,IAAAC,cAAI,EAClBrB,UAAU,CACPrH,GAAG,CAAE/B,SAAS,IAAK,IAAI,CAACsG,IAAI,CAACoE,QAAQ,CAAC1K,SAAS,CAAC,CAAC,CACjD2K,MAAM,CAAEC,KAAK,IAAK,CAAC,IAAI,CAACrE,YAAY,CAACsE,SAAS,CAACD,KAAK,CAAC,CAC1D,CAAC;IACD,MAAMtB,OAAO,GAAG,IAAAwB,iBAAO,EAAC1B,UAAU,EAAGpJ,SAAS,IAAK;MACjD,IAAIwK,OAAO,CAACO,QAAQ,CAAC/K,SAAS,CAACmD,EAAE,CAACd,QAAQ,CAAC,CAAC,CAAC,EAAE,OAAO,MAAM;MAC5D,OAAO,OAAO;IAChB,CAAC,CAAC;IACF,OAAOiH,OAAO;EAChB;EAEA,MAAcL,eAAeA,CAC3BF,aAAwD,EACxDvB,OAAO,GAAG,KAAK,EACS;IACxB,IAAIuB,aAAa,CAAC1F,MAAM,EAAE;MACxB,MAAMkF,YAAY,GAAG,MAAM,IAAI,CAACxI,SAAS,CAACiL,2BAA2B,CAACjC,aAAa,CAAC;MACpF,OAAO,IAAI,CAAChJ,SAAS,CAACkL,SAAS,CAAC1C,YAAY,CAAC;IAC/C;IACA,IAAIf,OAAO,EAAE;MACX,OAAO,IAAI,CAACzH,SAAS,CAACmL,oBAAoB,CAAC,CAAC;IAC9C;IACA,OAAO,IAAI,CAACnL,SAAS,CAACoL,OAAO,CAAC,CAAC;EACjC;AACF;AAAC/E,OAAA,CAAAC,iBAAA,GAAAA,iBAAA"}
|
|
1
|
+
{"version":3,"names":["_pMapSeries","data","_interopRequireDefault","require","_workspace","_path","_loader","_constants","_sources","_dataToPersist","_workspaceModules","_componentIdToPackageName","_removePath","_bitRoots","_lodash","_compiler","_events","_types","obj","__esModule","default","ComponentCompiler","constructor","pubsub","workspace","component","compilerInstance","compilerId","logger","dependencyResolver","dists","compileErrors","compile","noThrow","options","dataToPersist","deleteDistDir","DataToPersist","distDir","distDirs","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","linkComponents","linkToNodeModulesByComponents","buildResults","distFile","state","_consumer","compiler","loader","succeed","pub","CompilerAspect","id","ComponentCompilationOnDoneEvent","length","forEach","errorItem","error","formatError","err","join","CompilerErrorEvent","console","message","packageName","componentIdToPackageName","packageDir","distDirName","getDistDir","DEFAULT_DIST_DIRNAME","injectedDirs","getInjectedDirs","dist","rootDirs","readBitRootsDir","rootDir","relative","componentDir","filePath","isFileSupported","compileResults","contents","push","base","result","Dist","outputPath","Buffer","from","outputText","shouldCopyNonSupportedFiles","filesToCompile","outputDir","getComponentPackagePath","exports","WorkspaceCompiler","envs","aspectLoader","ui","watcher","registerOnComponentChange","onComponentChange","bind","registerOnComponentAdd","onComponentAdd","registerOnPreWatch","onPreWatch","registerPreStart","onPreStart","registerOnAspectLoadErrorSlot","onAspectLoadFail","preStartOpts","skipCompilation","compileComponents","changed","verbose","CompilationInitiator","PreStart","watchScopeInternalFiles","code","AspectLoadFail","watchOpts","undefined","removedFiles","Boolean","removeLinksFromNodeModules","ComponentChanged","results","componentIds","preCompile","start","Date","now","PreWatch","end","consoleSuccess","componentsIds","OutsideWorkspaceError","getIdsToCompile","getManyOpts","loadSeedersAsAspects","components","getMany","grouped","groupByIsEnv","envsResults","runCompileComponents","otherResults","other","componentsCompilers","environment","getEnv","env","getCompiler","compilerName","name","warn","resultOnWorkspace","mapSeries","componentCompiler","envsIds","uniq","getEnvId","filter","envId","isCoreEnv","groupBy","includes","resolveMultipleComponentIds","filterIds","getNewAndModifiedIds","listIds"],"sources":["workspace-compiler.ts"],"sourcesContent":["/* eslint-disable max-classes-per-file */\nimport mapSeries from 'p-map-series';\nimport { Component } from '@teambit/component';\nimport { EnvsMain } from '@teambit/envs';\nimport type { PubsubMain } from '@teambit/pubsub';\nimport { SerializableResults, Workspace, OutsideWorkspaceError } from '@teambit/workspace';\nimport { WatcherMain, WatchOptions } from '@teambit/watcher';\nimport path from 'path';\nimport { ComponentID } from '@teambit/component-id';\nimport { Logger } from '@teambit/logger';\nimport loader from '@teambit/legacy/dist/cli/loader';\nimport { DEFAULT_DIST_DIRNAME } from '@teambit/legacy/dist/constants';\nimport { AbstractVinyl, Dist } from '@teambit/legacy/dist/consumer/component/sources';\nimport DataToPersist from '@teambit/legacy/dist/consumer/component/sources/data-to-persist';\nimport {\n linkToNodeModulesByComponents,\n removeLinksFromNodeModules,\n} from '@teambit/workspace.modules.node-modules-linker';\nimport { AspectLoaderMain } from '@teambit/aspect-loader';\nimport { DependencyResolverMain } from '@teambit/dependency-resolver';\nimport componentIdToPackageName from '@teambit/legacy/dist/utils/bit/component-id-to-package-name';\nimport RemovePath from '@teambit/legacy/dist/consumer/component/sources/remove-path';\nimport { UiMain } from '@teambit/ui';\nimport { readBitRootsDir } from '@teambit/bit-roots';\nimport { groupBy, uniq } from 'lodash';\nimport type { PreStartOpts } from '@teambit/ui';\nimport { PathOsBasedAbsolute, PathOsBasedRelative } from '@teambit/legacy/dist/utils/path';\nimport { MultiCompiler } from '@teambit/multi-compiler';\nimport { CompilerAspect } from './compiler.aspect';\nimport { CompilerErrorEvent, ComponentCompilationOnDoneEvent } from './events';\nimport { Compiler, CompilationInitiator } from './types';\n\nexport type BuildResult = { component: string; buildResults: string[] | null | undefined };\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\nexport type CompileError = { path: string; error: Error };\n\nexport class ComponentCompiler {\n constructor(\n private pubsub: PubsubMain,\n private workspace: Workspace,\n private component: Component,\n private compilerInstance: Compiler,\n private compilerId: string,\n private logger: Logger,\n private dependencyResolver: DependencyResolverMain,\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 // 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 await this.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) => this.compileOneFile(file, options.initiator))\n );\n }\n\n if (canTranspileComponent) {\n await this.compileAllFiles(this.component, options.initiator);\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 linkComponents = options.linkComponents ?? true;\n if (linkComponents) {\n await linkToNodeModulesByComponents([this.component], this.workspace);\n }\n const buildResults = this.dists.map((distFile) => distFile.path);\n if (this.component.state._consumer.compiler) loader.succeed();\n this.pubsub.pub(\n CompilerAspect.id,\n new ComponentCompilationOnDoneEvent(this.compileErrors, this.component, buildResults)\n );\n return { component: this.component.id.toString(), buildResults };\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 readBitRootsDir(this.workspace.path);\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 private async compileOneFile(file: AbstractVinyl, initiator: CompilationInitiator): 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 await this.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(component: Component, initiator: CompilationInitiator): Promise<void> {\n const filesToCompile: AbstractVinyl[] = [];\n for (const base of await this.distDirs()) {\n 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,\n componentDir: this.componentDir,\n outputDir: await this.workspace.getComponentPackagePath(component),\n initiator,\n });\n } catch (error: any) {\n this.compileErrors.push({ path: this.componentDir, error });\n }\n }\n }\n}\n\nexport class WorkspaceCompiler {\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 }, id: ComponentID): Promise<boolean> {\n if (err.code && err.code === 'MODULE_NOT_FOUND' && this.workspace) {\n await this.compileComponents([id.toString()], { initiator: CompilationInitiator.AspectLoadFail }, true);\n return true;\n }\n return false;\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 { initiator: watchOpts.initiator || CompilationInitiator.ComponentChanged, deleteDistDir },\n true\n );\n // await linkToNodeModulesByComponents([component], this.workspace);\n return {\n results: buildResults,\n toString() {\n return `${buildResults[0]?.buildResults?.join('\\n\\t')}`;\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 }\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 ): 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 const getManyOpts =\n options.initiator === CompilationInitiator.AspectLoadFail ? { loadSeedersAsAspects: false } : undefined;\n const components = await this.workspace.getMany(componentIds, getManyOpts);\n\n const grouped = this.groupByIsEnv(components);\n const envsResults = grouped.envs ? await this.runCompileComponents(grouped.envs, options, noThrow) : [];\n const otherResults = grouped.other ? await this.runCompileComponents(grouped.other, options, noThrow) : [];\n return [...envsResults, ...otherResults];\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 environment = this.envs.getEnv(c).env;\n const compilerInstance = environment.getCompiler?.();\n\n if (compilerInstance) {\n const compilerName = compilerInstance.constructor.name || 'compiler';\n componentsCompilers.push(\n new ComponentCompiler(\n this.pubsub,\n this.workspace,\n c,\n compilerInstance,\n compilerName,\n this.logger,\n this.dependencyResolver\n )\n );\n } else {\n this.logger.warn(`unable to find a compiler instance for ${c.id.toString()}`);\n }\n });\n const resultOnWorkspace = await mapSeries(componentsCompilers, (componentCompiler) =>\n componentCompiler.compile(noThrow, options)\n );\n\n return resultOnWorkspace;\n }\n\n /**\n * This function get's a list of aspect ids and return them grouped by whether any of them is the env of other from the list\n * @param ids\n */\n groupByIsEnv(components: Component[]): { envs?: Component[]; other?: Component[] } {\n const envsIds = uniq(\n components\n .map((component) => this.envs.getEnvId(component))\n .filter((envId) => !this.aspectLoader.isCoreEnv(envId))\n );\n const grouped = groupBy(components, (component) => {\n if (envsIds.includes(component.id.toString())) return 'envs';\n return 'other';\n });\n return grouped as { envs: Component[]; other: Component[] };\n }\n\n private async getIdsToCompile(\n componentsIds: Array<string | ComponentID | ComponentID>,\n changed = false\n ): 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"],"mappings":";;;;;;AACA,SAAAA,YAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,WAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAIA,SAAAG,WAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,UAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAI,MAAA;EAAA,MAAAJ,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAE,KAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAGA,SAAAK,QAAA;EAAA,MAAAL,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAG,OAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAM,WAAA;EAAA,MAAAN,IAAA,GAAAE,OAAA;EAAAI,UAAA,YAAAA,CAAA;IAAA,OAAAN,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAO,SAAA;EAAA,MAAAP,IAAA,GAAAE,OAAA;EAAAK,QAAA,YAAAA,CAAA;IAAA,OAAAP,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAQ,eAAA;EAAA,MAAAR,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAM,cAAA,YAAAA,CAAA;IAAA,OAAAR,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAS,kBAAA;EAAA,MAAAT,IAAA,GAAAE,OAAA;EAAAO,iBAAA,YAAAA,CAAA;IAAA,OAAAT,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAMA,SAAAU,0BAAA;EAA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
+
import { pathNormalizeToLinux } from '@teambit/legacy/dist/utils';
|
|
3
|
+
|
|
4
|
+
export class DistArtifact {
|
|
5
|
+
constructor(private artifacts: AbstractVinyl[]) {}
|
|
6
|
+
|
|
7
|
+
getFile(path: string) {
|
|
8
|
+
return this.artifacts.find((file) => {
|
|
9
|
+
return pathNormalizeToLinux(file.relative) === path;
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
}
|
package/index.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export type { CompilerMain } from './compiler.main.runtime';
|
|
2
|
+
export type { CompilerTaskOptions } from './compiler.task';
|
|
3
|
+
export { CompilerTask } from './compiler.task';
|
|
4
|
+
export type { CompilerEnv } from './compiler-env-type';
|
|
5
|
+
export { CompilerAspect } from './compiler.aspect';
|
|
6
|
+
export { CompilationInitiator } from './types';
|
|
7
|
+
export type {
|
|
8
|
+
Compiler,
|
|
9
|
+
CompilerOptions,
|
|
10
|
+
TranspileFileOutput,
|
|
11
|
+
TranspileFileParams,
|
|
12
|
+
TranspileComponentParams,
|
|
13
|
+
TranspileFileOutputOneFile,
|
|
14
|
+
} from './types';
|
|
15
|
+
export * from './events';
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import chalk from 'chalk';
|
|
2
|
+
import { ComponentsStatus } from './compiler.cmd';
|
|
3
|
+
|
|
4
|
+
export const formatCompileResults = (compileResults: ComponentsStatus[], verbose: boolean) =>
|
|
5
|
+
compileResults
|
|
6
|
+
.map((componentResult: ComponentsStatus) => ({
|
|
7
|
+
componentId: componentResult.component.id.fullName,
|
|
8
|
+
files: componentResult.buildResults,
|
|
9
|
+
status: componentResult.errors.length ? 'FAILURE' : 'SUCCESS',
|
|
10
|
+
icon: componentResult.errors.length ? chalk.red('✗') : chalk.green('✔'),
|
|
11
|
+
}))
|
|
12
|
+
.reduce((outputString, result) => {
|
|
13
|
+
outputString += `${result.icon} ${result.status}\t${result.componentId}`;
|
|
14
|
+
if (verbose) {
|
|
15
|
+
outputString += ':';
|
|
16
|
+
outputString += result?.files?.reduce((fileList, file) => `${fileList}\t\t - ${file}\n`, '\n');
|
|
17
|
+
}
|
|
18
|
+
outputString += '\n';
|
|
19
|
+
return outputString;
|
|
20
|
+
}, '');
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teambit/compiler",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.108",
|
|
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.
|
|
9
|
+
"version": "1.0.108"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"chalk": "2.4.2",
|
|
@@ -16,46 +16,42 @@
|
|
|
16
16
|
"ink": "3.2.0",
|
|
17
17
|
"lodash": "4.17.21",
|
|
18
18
|
"p-map-series": "2.1.0",
|
|
19
|
-
"core-js": "^3.0.0",
|
|
20
|
-
"@babel/runtime": "7.20.0",
|
|
21
19
|
"@teambit/harmony": "0.4.6",
|
|
22
20
|
"@teambit/component-id": "1.2.0",
|
|
23
21
|
"@teambit/bit-roots": "0.0.133",
|
|
24
22
|
"@teambit/bit-error": "0.0.404",
|
|
25
|
-
"@teambit/envs": "1.0.
|
|
26
|
-
"@teambit/cli": "0.0.
|
|
27
|
-
"@teambit/component": "1.0.
|
|
28
|
-
"@teambit/logger": "0.0.
|
|
29
|
-
"@teambit/pubsub": "1.0.
|
|
30
|
-
"@teambit/aspect-loader": "1.0.
|
|
31
|
-
"@teambit/builder": "1.0.
|
|
32
|
-
"@teambit/component-issues": "0.0.
|
|
33
|
-
"@teambit/dependency-resolver": "1.0.
|
|
34
|
-
"@teambit/generator": "1.0.
|
|
35
|
-
"@teambit/issues": "1.0.
|
|
36
|
-
"@teambit/ui": "1.0.
|
|
37
|
-
"@teambit/watcher": "1.0.
|
|
38
|
-
"@teambit/workspace": "1.0.
|
|
39
|
-
"@teambit/isolator": "1.0.
|
|
23
|
+
"@teambit/envs": "1.0.108",
|
|
24
|
+
"@teambit/cli": "0.0.840",
|
|
25
|
+
"@teambit/component": "1.0.108",
|
|
26
|
+
"@teambit/logger": "0.0.933",
|
|
27
|
+
"@teambit/pubsub": "1.0.108",
|
|
28
|
+
"@teambit/aspect-loader": "1.0.108",
|
|
29
|
+
"@teambit/builder": "1.0.108",
|
|
30
|
+
"@teambit/component-issues": "0.0.138",
|
|
31
|
+
"@teambit/dependency-resolver": "1.0.108",
|
|
32
|
+
"@teambit/generator": "1.0.109",
|
|
33
|
+
"@teambit/issues": "1.0.108",
|
|
34
|
+
"@teambit/ui": "1.0.108",
|
|
35
|
+
"@teambit/watcher": "1.0.108",
|
|
36
|
+
"@teambit/workspace": "1.0.108",
|
|
37
|
+
"@teambit/isolator": "1.0.108",
|
|
40
38
|
"@teambit/toolbox.fs.hard-link-directory": "0.0.19",
|
|
41
|
-
"@teambit/multi-compiler": "1.0.
|
|
42
|
-
"@teambit/workspace.modules.node-modules-linker": "0.0.
|
|
39
|
+
"@teambit/multi-compiler": "1.0.108",
|
|
40
|
+
"@teambit/workspace.modules.node-modules-linker": "0.0.158"
|
|
43
41
|
},
|
|
44
42
|
"devDependencies": {
|
|
45
|
-
"@types/react": "^17.0.8",
|
|
46
43
|
"@types/fs-extra": "9.0.7",
|
|
47
44
|
"@types/lodash": "4.14.165",
|
|
48
45
|
"@types/mocha": "9.1.0",
|
|
49
|
-
"@types/
|
|
50
|
-
"@types/
|
|
51
|
-
"@
|
|
52
|
-
"@
|
|
53
|
-
"@teambit/compilation.content.compiler-overview": "1.95.0"
|
|
46
|
+
"@types/jest": "^29.2.2",
|
|
47
|
+
"@types/testing-library__jest-dom": "^5.9.5",
|
|
48
|
+
"@teambit/compilation.content.compiler-overview": "1.95.0",
|
|
49
|
+
"@teambit/harmony.envs.core-aspect-env": "0.0.13"
|
|
54
50
|
},
|
|
55
51
|
"peerDependencies": {
|
|
56
|
-
"
|
|
57
|
-
"react": "^
|
|
58
|
-
"
|
|
52
|
+
"react": "^17.0.0 || ^18.0.0",
|
|
53
|
+
"@types/react": "^18.2.12",
|
|
54
|
+
"@teambit/legacy": "1.0.624"
|
|
59
55
|
},
|
|
60
56
|
"license": "Apache-2.0",
|
|
61
57
|
"optionalDependencies": {},
|
|
@@ -69,7 +65,7 @@
|
|
|
69
65
|
},
|
|
70
66
|
"private": false,
|
|
71
67
|
"engines": {
|
|
72
|
-
"node": ">=
|
|
68
|
+
"node": ">=16.0.0"
|
|
73
69
|
},
|
|
74
70
|
"repository": {
|
|
75
71
|
"type": "git",
|
|
@@ -78,12 +74,9 @@
|
|
|
78
74
|
"keywords": [
|
|
79
75
|
"bit",
|
|
80
76
|
"bit-aspect",
|
|
77
|
+
"bit-core-aspect",
|
|
81
78
|
"components",
|
|
82
79
|
"collaboration",
|
|
83
|
-
"web"
|
|
84
|
-
"react",
|
|
85
|
-
"react-components",
|
|
86
|
-
"angular",
|
|
87
|
-
"angular-components"
|
|
80
|
+
"web"
|
|
88
81
|
]
|
|
89
82
|
}
|
package/tsconfig.json
CHANGED
|
@@ -1,38 +1,33 @@
|
|
|
1
1
|
{
|
|
2
2
|
"compilerOptions": {
|
|
3
3
|
"lib": [
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
"DOM.Iterable",
|
|
8
|
-
"ScriptHost"
|
|
4
|
+
"esnext",
|
|
5
|
+
"dom",
|
|
6
|
+
"dom.Iterable"
|
|
9
7
|
],
|
|
10
|
-
"target": "
|
|
11
|
-
"module": "
|
|
12
|
-
"jsx": "react",
|
|
13
|
-
"allowJs": true,
|
|
14
|
-
"composite": true,
|
|
8
|
+
"target": "es2020",
|
|
9
|
+
"module": "es2020",
|
|
10
|
+
"jsx": "react-jsx",
|
|
15
11
|
"declaration": true,
|
|
16
12
|
"sourceMap": true,
|
|
17
|
-
"skipLibCheck": true,
|
|
18
13
|
"experimentalDecorators": true,
|
|
19
|
-
"
|
|
14
|
+
"skipLibCheck": true,
|
|
20
15
|
"moduleResolution": "node",
|
|
21
16
|
"esModuleInterop": true,
|
|
22
|
-
"rootDir": ".",
|
|
23
17
|
"resolveJsonModule": true,
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"strictPropertyInitialization": false,
|
|
28
|
-
"strict": true,
|
|
29
|
-
"noImplicitAny": false,
|
|
30
|
-
"preserveConstEnums": true
|
|
18
|
+
"allowJs": true,
|
|
19
|
+
"outDir": "dist",
|
|
20
|
+
"emitDeclarationOnly": true
|
|
31
21
|
},
|
|
32
22
|
"exclude": [
|
|
23
|
+
"artifacts",
|
|
24
|
+
"public",
|
|
33
25
|
"dist",
|
|
26
|
+
"node_modules",
|
|
27
|
+
"package.json",
|
|
34
28
|
"esm.mjs",
|
|
35
|
-
"
|
|
29
|
+
"**/*.cjs",
|
|
30
|
+
"./dist"
|
|
36
31
|
],
|
|
37
32
|
"include": [
|
|
38
33
|
"**/*",
|
package/types/asset.d.ts
CHANGED
|
@@ -5,12 +5,12 @@ declare module '*.png' {
|
|
|
5
5
|
declare module '*.svg' {
|
|
6
6
|
import type { FunctionComponent, SVGProps } from 'react';
|
|
7
7
|
|
|
8
|
-
export const ReactComponent: FunctionComponent<
|
|
8
|
+
export const ReactComponent: FunctionComponent<
|
|
9
|
+
SVGProps<SVGSVGElement> & { title?: string }
|
|
10
|
+
>;
|
|
9
11
|
const src: string;
|
|
10
12
|
export default src;
|
|
11
13
|
}
|
|
12
|
-
|
|
13
|
-
// @TODO Gilad
|
|
14
14
|
declare module '*.jpg' {
|
|
15
15
|
const value: any;
|
|
16
16
|
export = value;
|
|
@@ -27,3 +27,15 @@ declare module '*.bmp' {
|
|
|
27
27
|
const value: any;
|
|
28
28
|
export = value;
|
|
29
29
|
}
|
|
30
|
+
declare module '*.otf' {
|
|
31
|
+
const value: any;
|
|
32
|
+
export = value;
|
|
33
|
+
}
|
|
34
|
+
declare module '*.woff' {
|
|
35
|
+
const value: any;
|
|
36
|
+
export = value;
|
|
37
|
+
}
|
|
38
|
+
declare module '*.woff2' {
|
|
39
|
+
const value: any;
|
|
40
|
+
export = value;
|
|
41
|
+
}
|