@teambit/compiler 0.0.988 → 0.0.990
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.service.tsx +3 -3
- package/dist/compiler-env-type.d.ts +2 -2
- package/dist/compiler-env-type.js.map +1 -1
- package/dist/compiler.main.runtime.d.ts +4 -2
- package/dist/compiler.main.runtime.js +10 -3
- package/dist/compiler.main.runtime.js.map +1 -1
- package/dist/compiler.service.js.map +1 -1
- package/dist/compiler.task.js.map +1 -1
- package/dist/{preview-1676604673087.js → preview-1676811569495.js} +2 -2
- package/dist/workspace-compiler.d.ts +4 -2
- package/dist/workspace-compiler.js +15 -8
- package/dist/workspace-compiler.js.map +1 -1
- package/package-tar/teambit-compiler-0.0.990.tgz +0 -0
- package/package.json +22 -20
- package/package-tar/teambit-compiler-0.0.988.tgz +0 -0
package/compiler.service.tsx
CHANGED
|
@@ -10,9 +10,9 @@ export type CompilerDescriptor = {
|
|
|
10
10
|
config?: string;
|
|
11
11
|
};
|
|
12
12
|
|
|
13
|
-
type CompilerTransformationMap = ServiceTransformationMap
|
|
13
|
+
type CompilerTransformationMap = ServiceTransformationMap & {
|
|
14
14
|
getCompiler: () => Compiler;
|
|
15
|
-
}
|
|
15
|
+
};
|
|
16
16
|
|
|
17
17
|
export class CompilerService implements EnvService<{}, CompilerDescriptor> {
|
|
18
18
|
name = 'Compile';
|
|
@@ -42,7 +42,7 @@ export class CompilerService implements EnvService<{}, CompilerDescriptor> {
|
|
|
42
42
|
if (!env?.compiler) return undefined;
|
|
43
43
|
return {
|
|
44
44
|
getCompiler: () => env.compiler()(context),
|
|
45
|
-
}
|
|
45
|
+
};
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
getDescriptor(env: EnvDefinition) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["compiler-env-type.ts"],"sourcesContent":["import { EnvHandler } from
|
|
1
|
+
{"version":3,"names":[],"sources":["compiler-env-type.ts"],"sourcesContent":["import { EnvHandler } from '@teambit/envs';\nimport { Compiler } from './types';\n\nexport interface CompilerEnv {\n /**\n * return a compiler instance.\n */\n compiler(): EnvHandler<Compiler>;\n}\n"],"mappings":""}
|
|
@@ -2,6 +2,7 @@ import { AspectLoaderMain } from '@teambit/aspect-loader';
|
|
|
2
2
|
import { BuilderMain } from '@teambit/builder';
|
|
3
3
|
import { CLIMain } from '@teambit/cli';
|
|
4
4
|
import { Component, ComponentID } from '@teambit/component';
|
|
5
|
+
import { WatcherMain } from '@teambit/watcher';
|
|
5
6
|
import { EnvsMain } from '@teambit/envs';
|
|
6
7
|
import { BitId } from '@teambit/legacy-bit-id';
|
|
7
8
|
import { DependencyResolverMain } from '@teambit/dependency-resolver';
|
|
@@ -50,7 +51,7 @@ export declare class CompilerMain {
|
|
|
50
51
|
addMissingDistsIssue(component: Component): Promise<undefined>;
|
|
51
52
|
static runtime: import("@teambit/harmony").RuntimeDefinition;
|
|
52
53
|
static dependencies: import("@teambit/harmony").Aspect[];
|
|
53
|
-
static provider([cli, workspace, envs, loggerMain, pubsub, aspectLoader, builder, ui, generator, dependencyResolver,]: [
|
|
54
|
+
static provider([cli, workspace, envs, loggerMain, pubsub, aspectLoader, builder, ui, generator, dependencyResolver, watcher,]: [
|
|
54
55
|
CLIMain,
|
|
55
56
|
Workspace,
|
|
56
57
|
EnvsMain,
|
|
@@ -60,7 +61,8 @@ export declare class CompilerMain {
|
|
|
60
61
|
BuilderMain,
|
|
61
62
|
UiMain,
|
|
62
63
|
GeneratorMain,
|
|
63
|
-
DependencyResolverMain
|
|
64
|
+
DependencyResolverMain,
|
|
65
|
+
WatcherMain
|
|
64
66
|
]): Promise<CompilerMain>;
|
|
65
67
|
}
|
|
66
68
|
export default CompilerMain;
|
|
@@ -63,6 +63,13 @@ function _constants() {
|
|
|
63
63
|
};
|
|
64
64
|
return data;
|
|
65
65
|
}
|
|
66
|
+
function _watcher() {
|
|
67
|
+
const data = _interopRequireDefault(require("@teambit/watcher"));
|
|
68
|
+
_watcher = function () {
|
|
69
|
+
return data;
|
|
70
|
+
};
|
|
71
|
+
return data;
|
|
72
|
+
}
|
|
66
73
|
function _envs() {
|
|
67
74
|
const data = require("@teambit/envs");
|
|
68
75
|
_envs = function () {
|
|
@@ -251,9 +258,9 @@ class CompilerMain {
|
|
|
251
258
|
// we don't want to add any data to the compiler aspect, only to add issues on the component
|
|
252
259
|
return undefined;
|
|
253
260
|
}
|
|
254
|
-
static async provider([cli, workspace, envs, loggerMain, pubsub, aspectLoader, builder, ui, generator, dependencyResolver]) {
|
|
261
|
+
static async provider([cli, workspace, envs, loggerMain, pubsub, aspectLoader, builder, ui, generator, dependencyResolver, watcher]) {
|
|
255
262
|
const logger = loggerMain.createLogger(_compiler().CompilerAspect.id);
|
|
256
|
-
const workspaceCompiler = new (_workspaceCompiler().WorkspaceCompiler)(workspace, envs, pubsub, aspectLoader, ui, logger, dependencyResolver);
|
|
263
|
+
const workspaceCompiler = new (_workspaceCompiler().WorkspaceCompiler)(workspace, envs, pubsub, aspectLoader, ui, logger, dependencyResolver, watcher);
|
|
257
264
|
envs.registerService(new (_compiler3().CompilerService)());
|
|
258
265
|
const compilerMain = new CompilerMain(pubsub, workspaceCompiler, envs, builder, workspace, dependencyResolver);
|
|
259
266
|
cli.register(new (_compiler2().CompileCmd)(workspaceCompiler, logger, pubsub));
|
|
@@ -266,7 +273,7 @@ class CompilerMain {
|
|
|
266
273
|
}
|
|
267
274
|
exports.CompilerMain = CompilerMain;
|
|
268
275
|
(0, _defineProperty2().default)(CompilerMain, "runtime", _cli().MainRuntime);
|
|
269
|
-
(0, _defineProperty2().default)(CompilerMain, "dependencies", [_cli().CLIAspect, _workspace().WorkspaceAspect, _envs().EnvsAspect, _logger().LoggerAspect, _pubsub().PubsubAspect, _aspectLoader().default, _builder().BuilderAspect, _ui().default, _generator().GeneratorAspect, _dependencyResolver().DependencyResolverAspect]);
|
|
276
|
+
(0, _defineProperty2().default)(CompilerMain, "dependencies", [_cli().CLIAspect, _workspace().WorkspaceAspect, _envs().EnvsAspect, _logger().LoggerAspect, _pubsub().PubsubAspect, _aspectLoader().default, _builder().BuilderAspect, _ui().default, _generator().GeneratorAspect, _dependencyResolver().DependencyResolverAspect, _watcher().default]);
|
|
270
277
|
_compiler().CompilerAspect.addRuntime(CompilerMain);
|
|
271
278
|
var _default = CompilerMain;
|
|
272
279
|
exports.default = _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["CompilerMain","constructor","pubsub","workspaceCompiler","envs","builder","workspace","dependencyResolver","compileOnWorkspace","componentsIds","options","initiator","CompilationInitiator","ComponentAdded","compileComponents","createTask","name","compiler","CompilerTask","CompilerAspect","id","getDistPathBySrcPath","component","srcPath","environment","getEnv","env","compilerInstance","getCompiler","getRelativeDistFolder","getOrCalculateEnv","getDistDir","DEFAULT_DIST_DIRNAME","isDistDirExists","packageDir","getComponentPackagePath","distDir","pathToCheck","path","join","fs","existsSync","getDistsFiles","artifacts","getArtifactsVinylByAspect","length","DistArtifactNotFound","DistArtifact","addMissingDistsIssue","exist","state","issues","getOrCreate","IssuesClasses","MissingDists","data","undefined","provider","cli","loggerMain","aspectLoader","ui","generator","logger","createLogger","WorkspaceCompiler","registerService","CompilerService","compilerMain","register","CompileCmd","onComponentLoad","bind","registerComponentTemplate","compilerTemplate","MainRuntime","CLIAspect","WorkspaceAspect","EnvsAspect","LoggerAspect","PubsubAspect","AspectLoaderAspect","BuilderAspect","UIAspect","GeneratorAspect","DependencyResolverAspect","addRuntime"],"sources":["compiler.main.runtime.ts"],"sourcesContent":["import * as path from 'path';\nimport fs from 'fs-extra';\nimport AspectLoaderAspect, { AspectLoaderMain } from '@teambit/aspect-loader';\nimport { BuilderAspect, BuilderMain } from '@teambit/builder';\nimport { CLIAspect, CLIMain, MainRuntime } from '@teambit/cli';\nimport { IssuesClasses } from '@teambit/component-issues';\nimport { Component, ComponentID } from '@teambit/component';\nimport { DEFAULT_DIST_DIRNAME } from '@teambit/legacy/dist/constants';\nimport { EnvsAspect, EnvsMain } from '@teambit/envs';\nimport { BitId } from '@teambit/legacy-bit-id';\nimport { DependencyResolverAspect, DependencyResolverMain } from '@teambit/dependency-resolver';\nimport { LoggerAspect, LoggerMain } from '@teambit/logger';\nimport { GeneratorAspect, GeneratorMain } from '@teambit/generator';\nimport { PubsubAspect, PubsubMain } from '@teambit/pubsub';\nimport UIAspect, { UiMain } from '@teambit/ui';\nimport { Workspace, WorkspaceAspect } from '@teambit/workspace';\nimport { CompilerAspect } from './compiler.aspect';\nimport { CompileCmd } from './compiler.cmd';\nimport { CompilerService } from './compiler.service';\nimport { CompilerTask } from './compiler.task';\nimport { DistArtifact } from './dist-artifact';\nimport { DistArtifactNotFound } from './exceptions';\nimport { CompilationInitiator, Compiler } from './types';\nimport { CompileOptions, WorkspaceCompiler } from './workspace-compiler';\nimport { compilerTemplate } from './templates/compiler';\n\nexport class CompilerMain {\n constructor(\n private pubsub: PubsubMain,\n private workspaceCompiler: WorkspaceCompiler,\n private envs: EnvsMain,\n private builder: BuilderMain,\n private workspace: Workspace,\n private dependencyResolver: DependencyResolverMain\n ) {}\n\n /**\n * Run compilation on `bit new` and when new components are imported\n */\n compileOnWorkspace(\n componentsIds: string[] | BitId[] | ComponentID[] = [], // when empty, it compiles all\n options: CompileOptions = { initiator: CompilationInitiator.ComponentAdded }\n ) {\n return this.workspaceCompiler.compileComponents(componentsIds, options);\n }\n /**\n * API to create a new compiler task, it facilitates the usage of multiple compilers.\n * with this method you can create any number of compilers and add them to the buildPipeline.\n */\n createTask(name: string, compiler: Compiler): CompilerTask {\n return new CompilerTask(CompilerAspect.id, name, compiler, this.dependencyResolver);\n }\n\n /**\n * find the compiler configured on the workspace and ask for the dist path.\n */\n getDistPathBySrcPath(component: Component, srcPath: string): string | null {\n const environment = this.envs.getEnv(component).env;\n const compilerInstance = environment.getCompiler?.();\n if (!compilerInstance) return null;\n return compilerInstance.getDistPathBySrcPath(srcPath);\n }\n\n /**\n * find the compiler configured on the workspace and ask for the dist folder path.\n */\n getRelativeDistFolder(component: Component): string {\n const environment = this.envs.getOrCalculateEnv(component).env;\n const compilerInstance: Compiler | undefined = environment.getCompiler?.();\n if (!compilerInstance || !compilerInstance.getDistDir) return DEFAULT_DIST_DIRNAME;\n return compilerInstance.getDistDir();\n }\n\n /**\n * Check if the dist folder (in the component package under node_modules) exist\n * @param component\n * @returns\n */\n isDistDirExists(component: Component): boolean {\n const packageDir = this.workspace.getComponentPackagePath(component);\n const distDir = this.getRelativeDistFolder(component);\n const pathToCheck = path.join(packageDir, distDir);\n return fs.existsSync(pathToCheck);\n }\n\n async getDistsFiles(component: Component): Promise<DistArtifact> {\n const artifacts = await this.builder.getArtifactsVinylByAspect(component, CompilerAspect.id);\n if (!artifacts.length) throw new DistArtifactNotFound(component.id);\n\n return new DistArtifact(artifacts);\n }\n\n async addMissingDistsIssue(component: Component) {\n const exist = this.isDistDirExists(component);\n if (!exist) {\n component.state.issues.getOrCreate(IssuesClasses.MissingDists).data = true;\n }\n // we don't want to add any data to the compiler aspect, only to add issues on the component\n return undefined;\n }\n\n static runtime = MainRuntime;\n\n static dependencies = [\n CLIAspect,\n WorkspaceAspect,\n EnvsAspect,\n LoggerAspect,\n PubsubAspect,\n AspectLoaderAspect,\n BuilderAspect,\n UIAspect,\n GeneratorAspect,\n DependencyResolverAspect,\n ];\n\n static async provider([\n cli,\n workspace,\n envs,\n loggerMain,\n pubsub,\n aspectLoader,\n builder,\n ui,\n generator,\n dependencyResolver,\n ]: [\n CLIMain,\n Workspace,\n EnvsMain,\n LoggerMain,\n PubsubMain,\n AspectLoaderMain,\n BuilderMain,\n UiMain,\n GeneratorMain,\n DependencyResolverMain\n ]) {\n const logger = loggerMain.createLogger(CompilerAspect.id);\n const workspaceCompiler = new WorkspaceCompiler(\n workspace,\n envs,\n pubsub,\n aspectLoader,\n ui,\n logger,\n dependencyResolver\n );\n envs.registerService(new CompilerService());\n const compilerMain = new CompilerMain(pubsub, workspaceCompiler, envs, builder, workspace, dependencyResolver);\n cli.register(new CompileCmd(workspaceCompiler, logger, pubsub));\n if (workspace) {\n workspace.onComponentLoad(compilerMain.addMissingDistsIssue.bind(compilerMain));\n }\n if (generator) generator.registerComponentTemplate([compilerTemplate]);\n\n return compilerMain;\n }\n}\n\nCompilerAspect.addRuntime(CompilerMain);\n\nexport default CompilerMain;\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAAwD;AAAA;AAEjD,MAA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ACN0D,YAAY,EACZvD,OAAO,EACPwD,EAAE,EACFC,SAAS,EACTvD,kBAAkB,CAYnB,EAAE;IACD,MAAMwD,MAAM,GAAGJ,UAAU,CAACK,YAAY,CAAC7C,0BAAc,CAACC,EAAE,CAAC;IACzD,MAAMjB,iBAAiB,GAAG,KAAI8D,sCAAiB,EAC7C3D,SAAS,EACTF,IAAI,EACJF,MAAM,EACN0D,YAAY,EACZC,EAAE,EACFE,MAAM,EACNxD,kBAAkB,CACnB;IACDH,IAAI,CAAC8D,eAAe,CAAC,KAAIC,4BAAe,GAAE,CAAC;IAC3C,MAAMC,YAAY,GAAG,IAAIpE,YAAY,CAACE,MAAM,EAAEC,iBAAiB,EAAEC,IAAI,EAAEC,OAAO,EAAEC,SAAS,EAAEC,kBAAkB,CAAC;IAC9GmD,GAAG,CAACW,QAAQ,CAAC,KAAIC,uBAAU,EAACnE,iBAAiB,EAAE4D,MAAM,EAAE7D,MAAM,CAAC,CAAC;IAC/D,IAAII,SAAS,EAAE;MACbA,SAAS,CAACiE,eAAe,CAACH,YAAY,CAACpB,oBAAoB,CAACwB,IAAI,CAACJ,YAAY,CAAC,CAAC;IACjF;IACA,IAAIN,SAAS,EAAEA,SAAS,CAACW,yBAAyB,CAAC,CAACC,6BAAgB,CAAC,CAAC;IAEtE,OAAON,YAAY;EACrB;AACF;AAAC;AAAA,gCArIYpE,YAAY,aA2EN2E,kBAAW;AAAA,gCA3EjB3E,YAAY,kBA6ED,CACpB4E,gBAAS,EACTC,4BAAe,EACfC,kBAAU,EACVC,sBAAY,EACZC,sBAAY,EACZC,uBAAkB,EAClBC,wBAAa,EACbC,aAAQ,EACRC,4BAAe,EACfC,8CAAwB,CACzB;AA+CHlE,0BAAc,CAACmE,UAAU,CAACtF,YAAY,CAAC;AAAC,eAEzBA,YAAY;AAAA"}
|
|
1
|
+
{"version":3,"names":["CompilerMain","constructor","pubsub","workspaceCompiler","envs","builder","workspace","dependencyResolver","compileOnWorkspace","componentsIds","options","initiator","CompilationInitiator","ComponentAdded","compileComponents","createTask","name","compiler","CompilerTask","CompilerAspect","id","getDistPathBySrcPath","component","srcPath","environment","getEnv","env","compilerInstance","getCompiler","getRelativeDistFolder","getOrCalculateEnv","getDistDir","DEFAULT_DIST_DIRNAME","isDistDirExists","packageDir","getComponentPackagePath","distDir","pathToCheck","path","join","fs","existsSync","getDistsFiles","artifacts","getArtifactsVinylByAspect","length","DistArtifactNotFound","DistArtifact","addMissingDistsIssue","exist","state","issues","getOrCreate","IssuesClasses","MissingDists","data","undefined","provider","cli","loggerMain","aspectLoader","ui","generator","watcher","logger","createLogger","WorkspaceCompiler","registerService","CompilerService","compilerMain","register","CompileCmd","onComponentLoad","bind","registerComponentTemplate","compilerTemplate","MainRuntime","CLIAspect","WorkspaceAspect","EnvsAspect","LoggerAspect","PubsubAspect","AspectLoaderAspect","BuilderAspect","UIAspect","GeneratorAspect","DependencyResolverAspect","WatcherAspect","addRuntime"],"sources":["compiler.main.runtime.ts"],"sourcesContent":["import * as path from 'path';\nimport fs from 'fs-extra';\nimport AspectLoaderAspect, { AspectLoaderMain } from '@teambit/aspect-loader';\nimport { BuilderAspect, BuilderMain } from '@teambit/builder';\nimport { CLIAspect, CLIMain, MainRuntime } from '@teambit/cli';\nimport { IssuesClasses } from '@teambit/component-issues';\nimport { Component, ComponentID } from '@teambit/component';\nimport { DEFAULT_DIST_DIRNAME } from '@teambit/legacy/dist/constants';\nimport WatcherAspect, { WatcherMain } from '@teambit/watcher';\nimport { EnvsAspect, EnvsMain } from '@teambit/envs';\nimport { BitId } from '@teambit/legacy-bit-id';\nimport { DependencyResolverAspect, DependencyResolverMain } from '@teambit/dependency-resolver';\nimport { LoggerAspect, LoggerMain } from '@teambit/logger';\nimport { GeneratorAspect, GeneratorMain } from '@teambit/generator';\nimport { PubsubAspect, PubsubMain } from '@teambit/pubsub';\nimport UIAspect, { UiMain } from '@teambit/ui';\nimport { Workspace, WorkspaceAspect } from '@teambit/workspace';\nimport { CompilerAspect } from './compiler.aspect';\nimport { CompileCmd } from './compiler.cmd';\nimport { CompilerService } from './compiler.service';\nimport { CompilerTask } from './compiler.task';\nimport { DistArtifact } from './dist-artifact';\nimport { DistArtifactNotFound } from './exceptions';\nimport { CompilationInitiator, Compiler } from './types';\nimport { CompileOptions, WorkspaceCompiler } from './workspace-compiler';\nimport { compilerTemplate } from './templates/compiler';\n\nexport class CompilerMain {\n constructor(\n private pubsub: PubsubMain,\n private workspaceCompiler: WorkspaceCompiler,\n private envs: EnvsMain,\n private builder: BuilderMain,\n private workspace: Workspace,\n private dependencyResolver: DependencyResolverMain\n ) {}\n\n /**\n * Run compilation on `bit new` and when new components are imported\n */\n compileOnWorkspace(\n componentsIds: string[] | BitId[] | ComponentID[] = [], // when empty, it compiles all\n options: CompileOptions = { initiator: CompilationInitiator.ComponentAdded }\n ) {\n return this.workspaceCompiler.compileComponents(componentsIds, options);\n }\n /**\n * API to create a new compiler task, it facilitates the usage of multiple compilers.\n * with this method you can create any number of compilers and add them to the buildPipeline.\n */\n createTask(name: string, compiler: Compiler): CompilerTask {\n return new CompilerTask(CompilerAspect.id, name, compiler, this.dependencyResolver);\n }\n\n /**\n * find the compiler configured on the workspace and ask for the dist path.\n */\n getDistPathBySrcPath(component: Component, srcPath: string): string | null {\n const environment = this.envs.getEnv(component).env;\n const compilerInstance = environment.getCompiler?.();\n if (!compilerInstance) return null;\n return compilerInstance.getDistPathBySrcPath(srcPath);\n }\n\n /**\n * find the compiler configured on the workspace and ask for the dist folder path.\n */\n getRelativeDistFolder(component: Component): string {\n const environment = this.envs.getOrCalculateEnv(component).env;\n const compilerInstance: Compiler | undefined = environment.getCompiler?.();\n if (!compilerInstance || !compilerInstance.getDistDir) return DEFAULT_DIST_DIRNAME;\n return compilerInstance.getDistDir();\n }\n\n /**\n * Check if the dist folder (in the component package under node_modules) exist\n * @param component\n * @returns\n */\n isDistDirExists(component: Component): boolean {\n const packageDir = this.workspace.getComponentPackagePath(component);\n const distDir = this.getRelativeDistFolder(component);\n const pathToCheck = path.join(packageDir, distDir);\n return fs.existsSync(pathToCheck);\n }\n\n async getDistsFiles(component: Component): Promise<DistArtifact> {\n const artifacts = await this.builder.getArtifactsVinylByAspect(component, CompilerAspect.id);\n if (!artifacts.length) throw new DistArtifactNotFound(component.id);\n\n return new DistArtifact(artifacts);\n }\n\n async addMissingDistsIssue(component: Component) {\n const exist = this.isDistDirExists(component);\n if (!exist) {\n component.state.issues.getOrCreate(IssuesClasses.MissingDists).data = true;\n }\n // we don't want to add any data to the compiler aspect, only to add issues on the component\n return undefined;\n }\n\n static runtime = MainRuntime;\n\n static dependencies = [\n CLIAspect,\n WorkspaceAspect,\n EnvsAspect,\n LoggerAspect,\n PubsubAspect,\n AspectLoaderAspect,\n BuilderAspect,\n UIAspect,\n GeneratorAspect,\n DependencyResolverAspect,\n WatcherAspect,\n ];\n\n static async provider([\n cli,\n workspace,\n envs,\n loggerMain,\n pubsub,\n aspectLoader,\n builder,\n ui,\n generator,\n dependencyResolver,\n watcher,\n ]: [\n CLIMain,\n Workspace,\n EnvsMain,\n LoggerMain,\n PubsubMain,\n AspectLoaderMain,\n BuilderMain,\n UiMain,\n GeneratorMain,\n DependencyResolverMain,\n WatcherMain\n ]) {\n const logger = loggerMain.createLogger(CompilerAspect.id);\n const workspaceCompiler = new WorkspaceCompiler(\n workspace,\n envs,\n pubsub,\n aspectLoader,\n ui,\n logger,\n dependencyResolver,\n watcher\n );\n envs.registerService(new CompilerService());\n const compilerMain = new CompilerMain(pubsub, workspaceCompiler, envs, builder, workspace, dependencyResolver);\n cli.register(new CompileCmd(workspaceCompiler, logger, pubsub));\n if (workspace) {\n workspace.onComponentLoad(compilerMain.addMissingDistsIssue.bind(compilerMain));\n }\n if (generator) generator.registerComponentTemplate([compilerTemplate]);\n\n return compilerMain;\n }\n}\n\nCompilerAspect.addRuntime(CompilerMain);\n\nexport default CompilerMain;\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAA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ACN0D,YAAY,EACZC,EAAE,EACFG,MAAM,EACNzD,kBAAkB,EAClBwD,OAAO,CACR;IACD3D,IAAI,CAAC+D,eAAe,CAAC,KAAIC,4BAAe,GAAE,CAAC;IAC3C,MAAMC,YAAY,GAAG,IAAIrE,YAAY,CAACE,MAAM,EAAEC,iBAAiB,EAAEC,IAAI,EAAEC,OAAO,EAAEC,SAAS,EAAEC,kBAAkB,CAAC;IAC9GmD,GAAG,CAACY,QAAQ,CAAC,KAAIC,uBAAU,EAACpE,iBAAiB,EAAE6D,MAAM,EAAE9D,MAAM,CAAC,CAAC;IAC/D,IAAII,SAAS,EAAE;MACbA,SAAS,CAACkE,eAAe,CAACH,YAAY,CAACrB,oBAAoB,CAACyB,IAAI,CAACJ,YAAY,CAAC,CAAC;IACjF;IACA,IAAIP,SAAS,EAAEA,SAAS,CAACY,yBAAyB,CAAC,CAACC,6BAAgB,CAAC,CAAC;IAEtE,OAAON,YAAY;EACrB;AACF;AAAC;AAAA,gCAzIYrE,YAAY,aA2EN4E,kBAAW;AAAA,gCA3EjB5E,YAAY,kBA6ED,CACpB6E,gBAAS,EACTC,4BAAe,EACfC,kBAAU,EACVC,sBAAY,EACZC,sBAAY,EACZC,uBAAkB,EAClBC,wBAAa,EACbC,aAAQ,EACRC,4BAAe,EACfC,8CAAwB,EACxBC,kBAAa,CACd;AAkDHpE,0BAAc,CAACqE,UAAU,CAACxF,YAAY,CAAC;AAAC,eAEzBA,YAAY;AAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["CompilerService","render","env","descriptor","getDescriptor","id","displayName","version","config","highlight","language","ignoreIllegals","transform","context","compiler","undefined","getCompiler","icon","displayConfig"],"sources":["compiler.service.tsx"],"sourcesContent":["import React from 'react';\nimport { Text, Newline } from 'ink';\nimport { EnvService, EnvDefinition, Env, EnvContext, ServiceTransformationMap } from '@teambit/envs';\nimport highlight from 'cli-highlight';\nimport { Compiler } from './types';\n\nexport type CompilerDescriptor = {\n id: string;\n icon?: string;\n config?: string;\n};\n\ntype CompilerTransformationMap = ServiceTransformationMap
|
|
1
|
+
{"version":3,"names":["CompilerService","render","env","descriptor","getDescriptor","id","displayName","version","config","highlight","language","ignoreIllegals","transform","context","compiler","undefined","getCompiler","icon","displayConfig"],"sources":["compiler.service.tsx"],"sourcesContent":["import React from 'react';\nimport { Text, Newline } from 'ink';\nimport { EnvService, EnvDefinition, Env, EnvContext, ServiceTransformationMap } from '@teambit/envs';\nimport highlight from 'cli-highlight';\nimport { Compiler } from './types';\n\nexport type CompilerDescriptor = {\n id: string;\n icon?: string;\n config?: string;\n};\n\ntype CompilerTransformationMap = ServiceTransformationMap & {\n getCompiler: () => Compiler;\n};\n\nexport class CompilerService implements EnvService<{}, CompilerDescriptor> {\n name = 'Compile';\n\n render(env: EnvDefinition) {\n const descriptor = this.getDescriptor(env);\n\n return (\n <Text key={descriptor?.id}>\n <Text color=\"cyan\">configured compiler: </Text>\n <Text>\n {descriptor?.id} ({descriptor?.displayName} @ {descriptor?.version})\n </Text>\n <Newline />\n <Text color=\"cyan\">compiler config:</Text>\n <Newline />\n <Text>\n {descriptor?.config && highlight(descriptor?.config, { language: 'javascript', ignoreIllegals: true })}\n </Text>\n <Newline />\n </Text>\n );\n }\n\n transform(env: Env, context: EnvContext): CompilerTransformationMap | undefined {\n // Old env\n if (!env?.compiler) return undefined;\n return {\n getCompiler: () => env.compiler()(context),\n };\n }\n\n getDescriptor(env: EnvDefinition) {\n if (!env.env.getCompiler) return undefined;\n const compiler = env.env.getCompiler();\n\n return {\n id: compiler.id,\n icon: compiler.icon,\n config: compiler.displayConfig ? compiler.displayConfig() : undefined,\n version: compiler.version ? compiler.version() : '?',\n displayName: compiler.displayName ? compiler.displayName : '?',\n };\n }\n}\n"],"mappings":";;;;;;;;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;EAAA;EAAA;IAAA;EAAA;EAA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GAAG,CAACc,WAAW,EAAE;IAEtC,OAAO;MACLX,EAAE,EAAES,QAAQ,CAACT,EAAE;MACfY,IAAI,EAAEH,QAAQ,CAACG,IAAI;MACnBT,MAAM,EAAEM,QAAQ,CAACI,aAAa,GAAGJ,QAAQ,CAACI,aAAa,EAAE,GAAGH,SAAS;MACrER,OAAO,EAAEO,QAAQ,CAACP,OAAO,GAAGO,QAAQ,CAACP,OAAO,EAAE,GAAG,GAAG;MACpDD,WAAW,EAAEQ,QAAQ,CAACR,WAAW,GAAGQ,QAAQ,CAACR,WAAW,GAAG;IAC7D,CAAC;EACH;AACF;AAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["CompilerTask","constructor","aspectId","name","compilerInstance","dependencyResolver","artifactName","description","preBuild","context","Promise","all","capsuleNetwork","seedersCapsules","map","capsule","copyNonSupportedFiles","execute","buildResults","build","_hardLinkBuildArtifactsOnCapsules","relCompDir","path","relative","capsulesRootDir","replace","injectedDirs","getInjectedDirs","getPackageName","component","hardLinkDirectory","injectedDir","join","postBuild","tasksResults","compiler","shouldCopyNonSupportedFiles","filesystem","files","file","isFileSupported","content","contents","fs","outputFile","distDir","from","options","CompilerAspect","id","depResolve","getAspect"],"sources":["compiler.task.ts"],"sourcesContent":["import { BuildContext, BuiltTaskResult, BuildTask, TaskResultsList } from '@teambit/builder';\nimport { Capsule } from '@teambit/isolator';\nimport { hardLinkDirectory } from '@teambit/toolbox.fs.hard-link-directory';\nimport { EnvContext, EnvHandler } from '@teambit/envs';\nimport { DependencyResolverMain } from '@teambit/dependency-resolver';\nimport fs from 'fs-extra';\nimport path from 'path';\nimport { Compiler } from './types';\nimport { CompilerAspect } from './compiler.aspect';\n\nexport type CompilerTaskOptions = {\n /**\n * instance of compiler to use.\n */\n compiler: EnvHandler<Compiler>;\n\n /**\n * name of compiler task\n */\n name?: string;\n};\n\n/**\n * compiler build task. Allows to compile components during component build.\n */\nexport class CompilerTask implements BuildTask {\n readonly description = 'compile components';\n constructor(\n readonly aspectId: string,\n readonly name: string,\n private compilerInstance: Compiler,\n private dependencyResolver: DependencyResolverMain\n ) {\n if (compilerInstance.artifactName) {\n this.description += ` for artifact ${compilerInstance.artifactName}`;\n }\n }\n\n async preBuild(context: BuildContext) {\n await Promise.all(\n context.capsuleNetwork.seedersCapsules.map((capsule) =>\n this.copyNonSupportedFiles(capsule, this.compilerInstance)\n )\n );\n if (!this.compilerInstance.preBuild) return;\n await this.compilerInstance.preBuild(context);\n }\n\n async execute(context: BuildContext): Promise<BuiltTaskResult> {\n const buildResults = await this.compilerInstance.build(context);\n await this._hardLinkBuildArtifactsOnCapsules(context);\n return buildResults;\n }\n\n /**\n * This function hard links the compiled artifacts to the `node_modules` of other component capsules.\n * For instance, if we have a `button` component that is a dependency of the `card` component,\n * then the `dist` folder of the `button` component will be copied to `<card_capsule>/node_modules/button/dist`.\n */\n private async _hardLinkBuildArtifactsOnCapsules(context: BuildContext): Promise<void> {\n await Promise.all(\n context.capsuleNetwork.seedersCapsules.map(async (capsule) => {\n const relCompDir = path.relative(context.capsuleNetwork.capsulesRootDir, capsule.path).replace(/\\\\/g, '/');\n const injectedDirs = await this.dependencyResolver.getInjectedDirs(\n context.capsuleNetwork.capsulesRootDir,\n relCompDir,\n this.dependencyResolver.getPackageName(capsule.component)\n );\n return hardLinkDirectory(\n capsule.path,\n injectedDirs.map((injectedDir) => path.join(context.capsuleNetwork.capsulesRootDir, injectedDir))\n );\n })\n );\n }\n\n async postBuild?(context: BuildContext, tasksResults: TaskResultsList): Promise<void> {\n if (!this.compilerInstance.postBuild) return;\n await this.compilerInstance.postBuild(context, tasksResults);\n }\n\n async copyNonSupportedFiles(capsule: Capsule, compiler: Compiler) {\n if (!compiler.shouldCopyNonSupportedFiles) {\n return;\n }\n const component = capsule.component;\n await Promise.all(\n component.filesystem.files.map(async (file) => {\n if (compiler.isFileSupported(file.path)) return;\n const content = file.contents;\n await fs.outputFile(path.join(capsule.path, compiler.distDir, file.relative), content);\n })\n );\n }\n\n static from(options: CompilerTaskOptions) {\n return (context: EnvContext) => {\n const aspectId = CompilerAspect.id;\n const name = options.name || 'compiler-task';\n const depResolve = context.getAspect<any>('teambit.dependencies/dependency-resolver');\n return new CompilerTask(aspectId, name, options.compiler(context), depResolve);\n }
|
|
1
|
+
{"version":3,"names":["CompilerTask","constructor","aspectId","name","compilerInstance","dependencyResolver","artifactName","description","preBuild","context","Promise","all","capsuleNetwork","seedersCapsules","map","capsule","copyNonSupportedFiles","execute","buildResults","build","_hardLinkBuildArtifactsOnCapsules","relCompDir","path","relative","capsulesRootDir","replace","injectedDirs","getInjectedDirs","getPackageName","component","hardLinkDirectory","injectedDir","join","postBuild","tasksResults","compiler","shouldCopyNonSupportedFiles","filesystem","files","file","isFileSupported","content","contents","fs","outputFile","distDir","from","options","CompilerAspect","id","depResolve","getAspect"],"sources":["compiler.task.ts"],"sourcesContent":["import { BuildContext, BuiltTaskResult, BuildTask, TaskResultsList } from '@teambit/builder';\nimport { Capsule } from '@teambit/isolator';\nimport { hardLinkDirectory } from '@teambit/toolbox.fs.hard-link-directory';\nimport { EnvContext, EnvHandler } from '@teambit/envs';\nimport { DependencyResolverMain } from '@teambit/dependency-resolver';\nimport fs from 'fs-extra';\nimport path from 'path';\nimport { Compiler } from './types';\nimport { CompilerAspect } from './compiler.aspect';\n\nexport type CompilerTaskOptions = {\n /**\n * instance of compiler to use.\n */\n compiler: EnvHandler<Compiler>;\n\n /**\n * name of compiler task\n */\n name?: string;\n};\n\n/**\n * compiler build task. Allows to compile components during component build.\n */\nexport class CompilerTask implements BuildTask {\n readonly description = 'compile components';\n constructor(\n readonly aspectId: string,\n readonly name: string,\n private compilerInstance: Compiler,\n private dependencyResolver: DependencyResolverMain\n ) {\n if (compilerInstance.artifactName) {\n this.description += ` for artifact ${compilerInstance.artifactName}`;\n }\n }\n\n async preBuild(context: BuildContext) {\n await Promise.all(\n context.capsuleNetwork.seedersCapsules.map((capsule) =>\n this.copyNonSupportedFiles(capsule, this.compilerInstance)\n )\n );\n if (!this.compilerInstance.preBuild) return;\n await this.compilerInstance.preBuild(context);\n }\n\n async execute(context: BuildContext): Promise<BuiltTaskResult> {\n const buildResults = await this.compilerInstance.build(context);\n await this._hardLinkBuildArtifactsOnCapsules(context);\n return buildResults;\n }\n\n /**\n * This function hard links the compiled artifacts to the `node_modules` of other component capsules.\n * For instance, if we have a `button` component that is a dependency of the `card` component,\n * then the `dist` folder of the `button` component will be copied to `<card_capsule>/node_modules/button/dist`.\n */\n private async _hardLinkBuildArtifactsOnCapsules(context: BuildContext): Promise<void> {\n await Promise.all(\n context.capsuleNetwork.seedersCapsules.map(async (capsule) => {\n const relCompDir = path.relative(context.capsuleNetwork.capsulesRootDir, capsule.path).replace(/\\\\/g, '/');\n const injectedDirs = await this.dependencyResolver.getInjectedDirs(\n context.capsuleNetwork.capsulesRootDir,\n relCompDir,\n this.dependencyResolver.getPackageName(capsule.component)\n );\n return hardLinkDirectory(\n capsule.path,\n injectedDirs.map((injectedDir) => path.join(context.capsuleNetwork.capsulesRootDir, injectedDir))\n );\n })\n );\n }\n\n async postBuild?(context: BuildContext, tasksResults: TaskResultsList): Promise<void> {\n if (!this.compilerInstance.postBuild) return;\n await this.compilerInstance.postBuild(context, tasksResults);\n }\n\n async copyNonSupportedFiles(capsule: Capsule, compiler: Compiler) {\n if (!compiler.shouldCopyNonSupportedFiles) {\n return;\n }\n const component = capsule.component;\n await Promise.all(\n component.filesystem.files.map(async (file) => {\n if (compiler.isFileSupported(file.path)) return;\n const content = file.contents;\n await fs.outputFile(path.join(capsule.path, compiler.distDir, file.relative), content);\n })\n );\n }\n\n static from(options: CompilerTaskOptions) {\n return (context: EnvContext) => {\n const aspectId = CompilerAspect.id;\n const name = options.name || 'compiler-task';\n const depResolve = context.getAspect<any>('teambit.dependencies/dependency-resolver');\n return new CompilerTask(aspectId, name, options.compiler(context), depResolve);\n };\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAEA;EAAA;EAAA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tB,eAAI,CAACU,IAAI,CAACjB,OAAO,CAACO,IAAI,EAAEa,QAAQ,CAACU,OAAO,EAAEN,IAAI,CAAChB,QAAQ,CAAC,EAAEkB,OAAO,CAAC;IACxF,CAAC,CAAC,CACH;EACH;EAEA,OAAOK,IAAI,CAACC,OAA4B,EAAE;IACxC,OAAQtC,OAAmB,IAAK;MAC9B,MAAMP,QAAQ,GAAG8C,0BAAc,CAACC,EAAE;MAClC,MAAM9C,IAAI,GAAG4C,OAAO,CAAC5C,IAAI,IAAI,eAAe;MAC5C,MAAM+C,UAAU,GAAGzC,OAAO,CAAC0C,SAAS,CAAM,0CAA0C,CAAC;MACrF,OAAO,IAAInD,YAAY,CAACE,QAAQ,EAAEC,IAAI,EAAE4C,OAAO,CAACZ,QAAQ,CAAC1B,OAAO,CAAC,EAAEyC,UAAU,CAAC;IAChF,CAAC;EACH;AACF;AAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.compilation_compiler@0.0.
|
|
2
|
-
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.compilation_compiler@0.0.
|
|
1
|
+
import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.compilation_compiler@0.0.990/dist/compiler.composition.js';
|
|
2
|
+
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.compilation_compiler@0.0.990/dist/compiler.docs.mdx';
|
|
3
3
|
|
|
4
4
|
export const compositions = [compositions_0];
|
|
5
5
|
export const overview = [overview_0];
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { Component, ComponentID } from '@teambit/component';
|
|
2
2
|
import { EnvsMain } from '@teambit/envs';
|
|
3
3
|
import type { PubsubMain } from '@teambit/pubsub';
|
|
4
|
-
import { SerializableResults, Workspace
|
|
4
|
+
import { SerializableResults, Workspace } from '@teambit/workspace';
|
|
5
|
+
import { WatcherMain, WatchOptions } from '@teambit/watcher';
|
|
5
6
|
import { BitId } from '@teambit/legacy-bit-id';
|
|
6
7
|
import { Logger } from '@teambit/logger';
|
|
7
8
|
import { Dist } from '@teambit/legacy/dist/consumer/component/sources';
|
|
@@ -56,7 +57,8 @@ export declare class WorkspaceCompiler {
|
|
|
56
57
|
private ui;
|
|
57
58
|
private logger;
|
|
58
59
|
private dependencyResolver;
|
|
59
|
-
|
|
60
|
+
private watcher;
|
|
61
|
+
constructor(workspace: Workspace, envs: EnvsMain, pubsub: PubsubMain, aspectLoader: AspectLoaderMain, ui: UiMain, logger: Logger, dependencyResolver: DependencyResolverMain, watcher: WatcherMain);
|
|
60
62
|
onPreStart(preStartOpts: PreStartOpts): Promise<void>;
|
|
61
63
|
onAspectLoadFail(err: Error & {
|
|
62
64
|
code?: string;
|
|
@@ -77,6 +77,13 @@ function _removePath() {
|
|
|
77
77
|
};
|
|
78
78
|
return data;
|
|
79
79
|
}
|
|
80
|
+
function _bitRoots() {
|
|
81
|
+
const data = require("@teambit/bit-roots");
|
|
82
|
+
_bitRoots = function () {
|
|
83
|
+
return data;
|
|
84
|
+
};
|
|
85
|
+
return data;
|
|
86
|
+
}
|
|
80
87
|
function _lodash() {
|
|
81
88
|
const data = require("lodash");
|
|
82
89
|
_lodash = function () {
|
|
@@ -187,7 +194,10 @@ ${this.compileErrors.map(formatError).join('\n')}`);
|
|
|
187
194
|
const relativeCompDir = this.workspace.componentDir(this.component.id, undefined, {
|
|
188
195
|
relative: true
|
|
189
196
|
});
|
|
190
|
-
|
|
197
|
+
const injectedDirs = await this.dependencyResolver.getInjectedDirs(this.workspace.path, relativeCompDir, packageName);
|
|
198
|
+
if (injectedDirs.length > 0) return injectedDirs;
|
|
199
|
+
const rootDirs = await (0, _bitRoots().readBitRootsDir)(this.workspace.path);
|
|
200
|
+
return rootDirs.map(rootDir => _path().default.relative(this.workspace.path, _path().default.join(rootDir, packageName)));
|
|
191
201
|
}
|
|
192
202
|
get componentDir() {
|
|
193
203
|
return this.workspace.componentDir(this.component.id);
|
|
@@ -266,7 +276,7 @@ ${this.compileErrors.map(formatError).join('\n')}`);
|
|
|
266
276
|
}
|
|
267
277
|
exports.ComponentCompiler = ComponentCompiler;
|
|
268
278
|
class WorkspaceCompiler {
|
|
269
|
-
constructor(workspace, envs, pubsub, aspectLoader, ui, logger, dependencyResolver) {
|
|
279
|
+
constructor(workspace, envs, pubsub, aspectLoader, ui, logger, dependencyResolver, watcher) {
|
|
270
280
|
this.workspace = workspace;
|
|
271
281
|
this.envs = envs;
|
|
272
282
|
this.pubsub = pubsub;
|
|
@@ -274,14 +284,11 @@ class WorkspaceCompiler {
|
|
|
274
284
|
this.ui = ui;
|
|
275
285
|
this.logger = logger;
|
|
276
286
|
this.dependencyResolver = dependencyResolver;
|
|
287
|
+
this.watcher = watcher;
|
|
277
288
|
if (this.workspace) {
|
|
278
289
|
this.workspace.registerOnComponentChange(this.onComponentChange.bind(this));
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
if (!this.dependencyResolver.hasRootComponents()) {
|
|
282
|
-
this.workspace.registerOnComponentAdd(this.onComponentChange.bind(this));
|
|
283
|
-
}
|
|
284
|
-
this.workspace.registerOnPreWatch(this.onPreWatch.bind(this));
|
|
290
|
+
this.workspace.registerOnComponentAdd(this.onComponentChange.bind(this));
|
|
291
|
+
this.watcher.registerOnPreWatch(this.onPreWatch.bind(this));
|
|
285
292
|
this.ui.registerPreStart(this.onPreStart.bind(this));
|
|
286
293
|
}
|
|
287
294
|
if (this.aspectLoader) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["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","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","relativeCompDir","componentDir","undefined","relative","filePath","isFileSupported","compileResults","contents","push","base","result","Dist","outputPath","Buffer","from","outputText","shouldCopyNonSupportedFiles","filesToCompile","outputDir","getComponentPackagePath","WorkspaceCompiler","envs","aspectLoader","ui","registerOnComponentChange","onComponentChange","bind","hasRootComponents","registerOnComponentAdd","registerOnPreWatch","onPreWatch","registerPreStart","onPreStart","registerOnAspectLoadErrorSlot","onAspectLoadFail","preStartOpts","skipCompilation","compileComponents","changed","verbose","CompilationInitiator","PreStart","code","AspectLoadFail","ComponentChanged","linkToNodeModulesByComponents","results","components","watchOpts","preCompile","start","Date","now","_legacy","PreWatch","end","consoleSuccess","componentsIds","OutsideWorkspaceError","componentIds","getIdsToCompile","getMany","grouped","groupByIsEnv","envsResults","runCompileComponents","otherResults","other","componentsCompilers","environment","getEnv","env","getCompiler","componentMap","getComponentDir","compilerName","name","resultOnWorkspace","mapSeries","componentCompiler","envsIds","uniq","getEnvId","filter","envId","isCoreEnv","groupBy","includes","resolveMultipleComponentIds","getNewAndModifiedIds","getAllComponentIds"],"sources":["workspace-compiler.ts"],"sourcesContent":["/* eslint-disable max-classes-per-file */\nimport mapSeries from 'p-map-series';\nimport { Component, ComponentID } from '@teambit/component';\nimport { EnvsMain } from '@teambit/envs';\nimport type { PubsubMain } from '@teambit/pubsub';\nimport { SerializableResults, Workspace, WatchOptions, OutsideWorkspaceError } from '@teambit/workspace';\nimport path from 'path';\nimport { BitId } from '@teambit/legacy-bit-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 { linkToNodeModulesByComponents } 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 { 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};\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 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<PathOsBasedRelative[]> {\n const relativeCompDir = this.workspace.componentDir(this.component.id, undefined, {\n relative: true,\n });\n return this.dependencyResolver.getInjectedDirs(this.workspace.path, relativeCompDir, 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 = 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: 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 ) {\n if (this.workspace) {\n this.workspace.registerOnComponentChange(this.onComponentChange.bind(this));\n // When root components are on, register happens in the installer instead\n // and the installer runs both installation and compilation.\n if (!this.dependencyResolver.hasRootComponents()) {\n this.workspace.registerOnComponentAdd(this.onComponentChange.bind(this));\n }\n this.workspace.registerOnPreWatch(this.onPreWatch.bind(this));\n this.ui.registerPreStart(this.onPreStart.bind(this));\n }\n if (this.aspectLoader) {\n this.aspectLoader.registerOnAspectLoadErrorSlot(this.onAspectLoadFail.bind(this));\n }\n }\n\n async onPreStart(preStartOpts: PreStartOpts): Promise<void> {\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 }\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 onComponentChange(\n component: Component,\n files: string[],\n initiator?: CompilationInitiator\n ): Promise<SerializableResults> {\n const buildResults = await this.compileComponents(\n [component.id.toString()],\n { initiator: initiator || CompilationInitiator.ComponentChanged },\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(components: Component[], watchOpts: WatchOptions) {\n if (watchOpts.preCompile) {\n const start = Date.now();\n this.logger.console(`compiling ${components.length} components`);\n await this.compileComponents(\n components.map((c) => c.id._legacy),\n { initiator: CompilationInitiator.PreWatch }\n );\n const end = Date.now() - start;\n this.logger.consoleSuccess(`compiled ${components.length} components successfully (${end / 1000} sec)`);\n }\n }\n\n async compileComponents(\n componentsIds: string[] | BitId[] | 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 const components = await this.workspace.getMany(componentIds);\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 // if there is no componentDir (e.g. author that added files, not dir), then we can't write the dists\n // inside the component dir.\n if (compilerInstance && c.state._consumer.componentMap?.getComponentDir()) {\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 }\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 | BitId>,\n changed = false\n ): Promise<ComponentID[]> {\n if (componentsIds.length) {\n return this.workspace.resolveMultipleComponentIds(componentsIds);\n }\n if (changed) {\n return this.workspace.getNewAndModifiedIds();\n }\n return this.workspace.getAllComponentIds();\n }\n}\n"],"mappings":";;;;;;;;;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAIA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAGA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAGA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAIA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAzBA;;AA2CO,MAAMA,iBAAiB,CAAC;EAC7BC,WAAW,CACDC,MAAkB,EAClBC,SAAoB,EACpBC,SAAoB,EACpBC,gBAA0B,EAC1BC,UAAkB,EAClBC,MAAc,EACdC,kBA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erInstance","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","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","relativeCompDir","componentDir","undefined","relative","rootDirs","readBitRootsDir","rootDir","filePath","isFileSupported","compileResults","contents","push","base","result","Dist","outputPath","Buffer","from","outputText","shouldCopyNonSupportedFiles","filesToCompile","outputDir","getComponentPackagePath","WorkspaceCompiler","envs","aspectLoader","ui","watcher","registerOnComponentChange","onComponentChange","bind","registerOnComponentAdd","registerOnPreWatch","onPreWatch","registerPreStart","onPreStart","registerOnAspectLoadErrorSlot","onAspectLoadFail","preStartOpts","skipCompilation","compileComponents","changed","verbose","CompilationInitiator","PreStart","code","AspectLoadFail","ComponentChanged","linkToNodeModulesByComponents","results","components","watchOpts","preCompile","start","Date","now","_legacy","PreWatch","end","consoleSuccess","componentsIds","OutsideWorkspaceError","componentIds","getIdsToCompile","getMany","grouped","groupByIsEnv","envsResults","runCompileComponents","otherResults","other","componentsCompilers","environment","getEnv","env","getCompiler","componentMap","getComponentDir","compilerName","name","resultOnWorkspace","mapSeries","componentCompiler","envsIds","uniq","getEnvId","filter","envId","isCoreEnv","groupBy","includes","resolveMultipleComponentIds","getNewAndModifiedIds","getAllComponentIds"],"sources":["workspace-compiler.ts"],"sourcesContent":["/* eslint-disable max-classes-per-file */\nimport mapSeries from 'p-map-series';\nimport { Component, ComponentID } 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 { BitId } from '@teambit/legacy-bit-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 { linkToNodeModulesByComponents } 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};\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 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 relativeCompDir = this.workspace.componentDir(this.component.id, undefined, {\n relative: true,\n });\n const injectedDirs = await this.dependencyResolver.getInjectedDirs(\n this.workspace.path,\n relativeCompDir,\n packageName\n );\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 = 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: 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.onComponentChange.bind(this));\n this.watcher.registerOnPreWatch(this.onPreWatch.bind(this));\n this.ui.registerPreStart(this.onPreStart.bind(this));\n }\n if (this.aspectLoader) {\n this.aspectLoader.registerOnAspectLoadErrorSlot(this.onAspectLoadFail.bind(this));\n }\n }\n\n async onPreStart(preStartOpts: PreStartOpts): Promise<void> {\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 }\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 onComponentChange(\n component: Component,\n files: string[],\n initiator?: CompilationInitiator\n ): Promise<SerializableResults> {\n const buildResults = await this.compileComponents(\n [component.id.toString()],\n { initiator: initiator || CompilationInitiator.ComponentChanged },\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(components: Component[], watchOpts: WatchOptions) {\n if (watchOpts.preCompile) {\n const start = Date.now();\n this.logger.console(`compiling ${components.length} components`);\n await this.compileComponents(\n components.map((c) => c.id._legacy),\n { initiator: CompilationInitiator.PreWatch }\n );\n const end = Date.now() - start;\n this.logger.consoleSuccess(`compiled ${components.length} components successfully (${end / 1000} sec)`);\n }\n }\n\n async compileComponents(\n componentsIds: string[] | BitId[] | 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 const components = await this.workspace.getMany(componentIds);\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 // if there is no componentDir (e.g. author that added files, not dir), then we can't write the dists\n // inside the component dir.\n if (compilerInstance && c.state._consumer.componentMap?.getComponentDir()) {\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 }\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 | BitId>,\n changed = false\n ): Promise<ComponentID[]> {\n if (componentsIds.length) {\n return this.workspace.resolveMultipleComponentIds(componentsIds);\n }\n if (changed) {\n return this.workspace.getNewAndModifiedIds();\n }\n return this.workspace.getAllComponentIds();\n }\n}\n"],"mappings":";;;;;;;;;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAIA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAGA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAGA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA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AG,IAAAwB,iBAAO,EAACvC,UAAU,EAAGxH,SAAS,IAAK;MACjD,IAAIyJ,OAAO,CAACO,QAAQ,CAAChK,SAAS,CAACiD,EAAE,CAACZ,QAAQ,EAAE,CAAC,EAAE,OAAO,MAAM;MAC5D,OAAO,OAAO;IAChB,CAAC,CAAC;IACF,OAAOkG,OAAO;EAChB;EAEA,MAAcF,eAAe,CAC3BH,aAAkD,EAClDnB,OAAO,GAAG,KAAK,EACS;IACxB,IAAImB,aAAa,CAAC/E,MAAM,EAAE;MACxB,OAAO,IAAI,CAACpD,SAAS,CAACkK,2BAA2B,CAAC/B,aAAa,CAAC;IAClE;IACA,IAAInB,OAAO,EAAE;MACX,OAAO,IAAI,CAAChH,SAAS,CAACmK,oBAAoB,EAAE;IAC9C;IACA,OAAO,IAAI,CAACnK,SAAS,CAACoK,kBAAkB,EAAE;EAC5C;AACF;AAAC"}
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teambit/compiler",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.990",
|
|
4
4
|
"homepage": "https://bit.dev/teambit/compilation/compiler",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"componentId": {
|
|
7
7
|
"scope": "teambit.compilation",
|
|
8
8
|
"name": "compiler",
|
|
9
|
-
"version": "0.0.
|
|
9
|
+
"version": "0.0.990"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"chalk": "2.4.2",
|
|
@@ -19,23 +19,25 @@
|
|
|
19
19
|
"core-js": "^3.0.0",
|
|
20
20
|
"@babel/runtime": "7.20.0",
|
|
21
21
|
"@teambit/harmony": "0.4.6",
|
|
22
|
-
"@teambit/envs": "0.0.
|
|
23
|
-
"@teambit/cli": "0.0.
|
|
24
|
-
"@teambit/component": "0.0.
|
|
25
|
-
"@teambit/logger": "0.0.
|
|
26
|
-
"@teambit/pubsub": "0.0.
|
|
27
|
-
"@teambit/aspect-loader": "0.0.
|
|
28
|
-
"@teambit/builder": "0.0.
|
|
29
|
-
"@teambit/component-issues": "0.0.
|
|
30
|
-
"@teambit/dependency-resolver": "0.0.
|
|
31
|
-
"@teambit/generator": "0.0.
|
|
32
|
-
"@teambit/legacy-bit-id": "0.0.
|
|
33
|
-
"@teambit/ui": "0.0.
|
|
34
|
-
"@teambit/
|
|
35
|
-
"@teambit/
|
|
36
|
-
"@teambit/
|
|
37
|
-
"@teambit/
|
|
38
|
-
"@teambit/
|
|
22
|
+
"@teambit/envs": "0.0.990",
|
|
23
|
+
"@teambit/cli": "0.0.664",
|
|
24
|
+
"@teambit/component": "0.0.990",
|
|
25
|
+
"@teambit/logger": "0.0.757",
|
|
26
|
+
"@teambit/pubsub": "0.0.990",
|
|
27
|
+
"@teambit/aspect-loader": "0.0.990",
|
|
28
|
+
"@teambit/builder": "0.0.990",
|
|
29
|
+
"@teambit/component-issues": "0.0.88",
|
|
30
|
+
"@teambit/dependency-resolver": "0.0.990",
|
|
31
|
+
"@teambit/generator": "0.0.990",
|
|
32
|
+
"@teambit/legacy-bit-id": "0.0.423",
|
|
33
|
+
"@teambit/ui": "0.0.990",
|
|
34
|
+
"@teambit/watcher": "0.0.2",
|
|
35
|
+
"@teambit/workspace": "0.0.990",
|
|
36
|
+
"@teambit/isolator": "0.0.990",
|
|
37
|
+
"@teambit/toolbox.fs.hard-link-directory": "0.0.12",
|
|
38
|
+
"@teambit/bit-roots": "0.0.1",
|
|
39
|
+
"@teambit/multi-compiler": "0.0.990",
|
|
40
|
+
"@teambit/workspace.modules.node-modules-linker": "0.0.8",
|
|
39
41
|
"@teambit/bit-error": "0.0.402"
|
|
40
42
|
},
|
|
41
43
|
"devDependencies": {
|
|
@@ -50,7 +52,7 @@
|
|
|
50
52
|
"@teambit/compilation.content.compiler-overview": "1.95.0"
|
|
51
53
|
},
|
|
52
54
|
"peerDependencies": {
|
|
53
|
-
"@teambit/legacy": "1.0.
|
|
55
|
+
"@teambit/legacy": "1.0.445",
|
|
54
56
|
"react": "^16.8.0 || ^17.0.0",
|
|
55
57
|
"react-dom": "^16.8.0 || ^17.0.0"
|
|
56
58
|
},
|
|
Binary file
|