@teambit/multi-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.
@@ -1,7 +1,7 @@
1
1
  import { Compiler, CompilerOptions, TranspileComponentParams, TranspileFileOutput, TranspileFileParams } from '@teambit/compiler';
2
2
  import { BuiltTaskResult, BuildContext, TaskResultsList } from '@teambit/builder';
3
3
  import { Component } from '@teambit/component';
4
- export declare type MultiCompilerOptions = {
4
+ export type MultiCompilerOptions = {
5
5
  targetExtension?: string;
6
6
  };
7
7
  export declare class MultiCompiler implements Compiler {
@@ -72,7 +72,7 @@ class MultiCompiler {
72
72
  const filesToTranspile = await files;
73
73
  if (!filesToTranspile) return null;
74
74
  const flatMap = (await (0, _pMapSeries().default)(filesToTranspile, async file => {
75
- if (!compiler.isFileSupported(file === null || file === void 0 ? void 0 : file.outputPath)) return [file];
75
+ if (!compiler.isFileSupported(file?.outputPath)) return [file];
76
76
  if (!compiler.transpileFile) return [];
77
77
  const params = Object.assign({}, options, {
78
78
  filePath: file.outputPath
@@ -92,8 +92,7 @@ class MultiCompiler {
92
92
  }
93
93
  async transpileComponent(params) {
94
94
  await Promise.all(this.compilers.map(compiler => {
95
- var _compiler$transpileCo;
96
- return (_compiler$transpileCo = compiler.transpileComponent) === null || _compiler$transpileCo === void 0 ? void 0 : _compiler$transpileCo.call(compiler, params);
95
+ return compiler.transpileComponent?.(params);
97
96
  }));
98
97
  }
99
98
  async build(context) {
@@ -1 +1 @@
1
- {"version":3,"names":["_path","data","require","_pMapSeries","_interopRequireDefault","_pipelinesModules","obj","__esModule","default","_defineProperty","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","t","i","_toPrimitive","String","r","e","Symbol","toPrimitive","call","TypeError","Number","MultiCompiler","constructor","id","compilers","compilerOptions","options","shouldCopyNonSupportedFiles","getDistDir","distDir","getArtifactDefinition","generatedBy","name","artifactName","globPatterns","distGlobPatterns","getOptions","defaultOpts","targetExtension","assign","displayConfig","map","compiler","displayName","join","transpileFile","fileContent","outputs","reduce","files","filesToTranspile","flatMap","pMapSeries","file","isFileSupported","outputPath","params","filePath","compiledContent","outputText","flat","Promise","resolve","transpileComponent","all","_compiler$transpileCo","build","context","builds","buildResult","componentsResults","mergeComponentResults","artifacts","preBuild","postBuild","taskResults","firstMatchedCompiler","find","getPreviewComponentRootPath","component","matchedCompiler","getDistPathBySrcPath","srcPath","version","exports"],"sources":["multi-compiler.compiler.ts"],"sourcesContent":["import { join } from 'path';\nimport pMapSeries from 'p-map-series';\nimport {\n Compiler,\n CompilerOptions,\n TranspileComponentParams,\n TranspileFileOutput,\n TranspileFileParams,\n} from '@teambit/compiler';\nimport { BuiltTaskResult, BuildContext, TaskResultsList } from '@teambit/builder';\nimport { mergeComponentResults } from '@teambit/pipelines.modules.merge-component-results';\nimport { Component } from '@teambit/component';\n\nexport type MultiCompilerOptions = {\n targetExtension?: string;\n};\n\nexport class MultiCompiler implements Compiler {\n displayName = 'Multi compiler';\n\n shouldCopyNonSupportedFiles =\n typeof this.compilerOptions.shouldCopyNonSupportedFiles === 'boolean'\n ? this.compilerOptions.shouldCopyNonSupportedFiles\n : true;\n distDir = 'dist';\n\n constructor(\n readonly id: string,\n readonly compilers: Compiler[],\n readonly compilerOptions: Partial<CompilerOptions> = {},\n readonly options: MultiCompilerOptions = {}\n ) {}\n\n getDistDir() {\n return this.distDir;\n }\n\n getArtifactDefinition() {\n return [\n {\n generatedBy: this.id,\n name: this.compilerOptions.artifactName || 'dist',\n globPatterns: this.compilerOptions.distGlobPatterns || [\n `${this.distDir}/**`,\n `!${this.distDir}/tsconfig.tsbuildinfo`,\n ],\n },\n ];\n }\n\n private getOptions() {\n const defaultOpts = {\n targetExtension: '.js',\n };\n\n return Object.assign(defaultOpts, this.options);\n }\n\n displayConfig() {\n return this.compilers\n .map((compiler) => {\n return `${compiler.displayName}\\n${compiler.displayConfig}\\n`;\n })\n .join('\\n');\n }\n\n /**\n * the multi-compiler applies all applicable defined compilers on given content.\n */\n async transpileFile(fileContent: string, options: TranspileFileParams): Promise<TranspileFileOutput> {\n const outputs: TranspileFileOutput = await this.compilers.reduce<Promise<TranspileFileOutput>>(\n async (files: Promise<TranspileFileOutput>, compiler: Compiler) => {\n if (!compiler.transpileFile) {\n return files;\n }\n const filesToTranspile = await files;\n if (!filesToTranspile) return null;\n const flatMap = (\n await pMapSeries(filesToTranspile, async (file) => {\n if (!compiler.isFileSupported(file?.outputPath)) return [file];\n if (!compiler.transpileFile) return [];\n const params = Object.assign({}, options, {\n filePath: file.outputPath,\n });\n const compiledContent = await compiler.transpileFile(file.outputText, params);\n if (compiledContent) {\n return compiledContent;\n }\n return [];\n })\n ).flat();\n return flatMap;\n },\n Promise.resolve([{ outputText: fileContent, outputPath: options.filePath }] as TranspileFileOutput)\n );\n return outputs;\n }\n\n async transpileComponent(params: TranspileComponentParams): Promise<void> {\n await Promise.all(\n this.compilers.map((compiler) => {\n return compiler.transpileComponent?.(params);\n })\n );\n }\n\n async build(context: BuildContext): Promise<BuiltTaskResult> {\n const builds = await pMapSeries(this.compilers, async (compiler) => {\n const buildResult = await compiler.build(context);\n return buildResult.componentsResults;\n });\n\n return {\n componentsResults: mergeComponentResults(builds),\n artifacts: this.getArtifactDefinition(),\n };\n }\n\n async preBuild(context: BuildContext) {\n await Promise.all(\n this.compilers.map(async (compiler) => {\n if (!compiler.preBuild) return;\n await compiler.preBuild(context);\n })\n );\n }\n\n async postBuild(context: BuildContext, taskResults: TaskResultsList) {\n await Promise.all(\n this.compilers.map(async (compiler) => {\n if (!compiler.postBuild) return;\n await compiler.postBuild(context, taskResults);\n })\n );\n }\n\n private firstMatchedCompiler(filePath: string): Compiler | undefined {\n return this.compilers.find((compiler) => compiler.isFileSupported(filePath));\n }\n\n getPreviewComponentRootPath(component: Component): string {\n const matchedCompiler = this.compilers.find(\n (compiler) => typeof compiler.getPreviewComponentRootPath !== 'undefined'\n );\n if (!matchedCompiler) {\n return '';\n }\n\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n return matchedCompiler.getPreviewComponentRootPath!(component);\n }\n\n /**\n * given a source file, return its parallel in the dists. e.g. \"index.ts\" => \"dist/index.js\"\n * both, the return path and the given path are relative paths.\n */\n getDistPathBySrcPath(srcPath: string): string {\n const matchedCompiler = this.firstMatchedCompiler(srcPath);\n if (!matchedCompiler) {\n return join(this.distDir, srcPath);\n }\n\n return matchedCompiler.getDistPathBySrcPath(srcPath);\n }\n\n /**\n * only supported files matching get compiled. others, are copied to the dist dir.\n */\n isFileSupported(filePath: string): boolean {\n return !!this.firstMatchedCompiler(filePath);\n }\n\n /**\n * returns the version of the current compiler instance (e.g. '4.0.1').\n */\n version(): string {\n return this.compilers\n .map((compiler) => {\n return `${compiler.displayName}@${compiler.version()}`;\n })\n .join('\\n');\n }\n}\n"],"mappings":";;;;;;AAAA,SAAAA,MAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,KAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,YAAA;EAAA,MAAAF,IAAA,GAAAG,sBAAA,CAAAF,OAAA;EAAAC,WAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AASA,SAAAI,kBAAA;EAAA,MAAAJ,IAAA,GAAAC,OAAA;EAAAG,iBAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAA2F,SAAAG,uBAAAE,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAAA,SAAAG,gBAAAH,GAAA,EAAAI,GAAA,EAAAC,KAAA,IAAAD,GAAA,GAAAE,cAAA,CAAAF,GAAA,OAAAA,GAAA,IAAAJ,GAAA,IAAAO,MAAA,CAAAC,cAAA,CAAAR,GAAA,EAAAI,GAAA,IAAAC,KA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AAgB,EAAW;IACzC,OAAO,CAAC,CAAC,IAAI,CAACmB,oBAAoB,CAACnB,QAAQ,CAAC;EAC9C;;EAEA;AACF;AACA;EACE0B,OAAOA,CAAA,EAAW;IAChB,OAAO,IAAI,CAAC3D,SAAS,CAClBiB,GAAG,CAAEC,QAAQ,IAAK;MACjB,OAAQ,GAAEA,QAAQ,CAACC,WAAY,IAAGD,QAAQ,CAACyC,OAAO,CAAC,CAAE,EAAC;IACxD,CAAC,CAAC,CACDvC,IAAI,CAAC,IAAI,CAAC;EACf;AACF;AAACwC,OAAA,CAAA/D,aAAA,GAAAA,aAAA"}
1
+ {"version":3,"names":["_path","data","require","_pMapSeries","_interopRequireDefault","_pipelinesModules","obj","__esModule","default","_defineProperty","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","t","i","_toPrimitive","String","r","e","Symbol","toPrimitive","call","TypeError","Number","MultiCompiler","constructor","id","compilers","compilerOptions","options","shouldCopyNonSupportedFiles","getDistDir","distDir","getArtifactDefinition","generatedBy","name","artifactName","globPatterns","distGlobPatterns","getOptions","defaultOpts","targetExtension","assign","displayConfig","map","compiler","displayName","join","transpileFile","fileContent","outputs","reduce","files","filesToTranspile","flatMap","pMapSeries","file","isFileSupported","outputPath","params","filePath","compiledContent","outputText","flat","Promise","resolve","transpileComponent","all","build","context","builds","buildResult","componentsResults","mergeComponentResults","artifacts","preBuild","postBuild","taskResults","firstMatchedCompiler","find","getPreviewComponentRootPath","component","matchedCompiler","getDistPathBySrcPath","srcPath","version","exports"],"sources":["multi-compiler.compiler.ts"],"sourcesContent":["import { join } from 'path';\nimport pMapSeries from 'p-map-series';\nimport {\n Compiler,\n CompilerOptions,\n TranspileComponentParams,\n TranspileFileOutput,\n TranspileFileParams,\n} from '@teambit/compiler';\nimport { BuiltTaskResult, BuildContext, TaskResultsList } from '@teambit/builder';\nimport { mergeComponentResults } from '@teambit/pipelines.modules.merge-component-results';\nimport { Component } from '@teambit/component';\n\nexport type MultiCompilerOptions = {\n targetExtension?: string;\n};\n\nexport class MultiCompiler implements Compiler {\n displayName = 'Multi compiler';\n\n shouldCopyNonSupportedFiles =\n typeof this.compilerOptions.shouldCopyNonSupportedFiles === 'boolean'\n ? this.compilerOptions.shouldCopyNonSupportedFiles\n : true;\n distDir = 'dist';\n\n constructor(\n readonly id: string,\n readonly compilers: Compiler[],\n readonly compilerOptions: Partial<CompilerOptions> = {},\n readonly options: MultiCompilerOptions = {}\n ) {}\n\n getDistDir() {\n return this.distDir;\n }\n\n getArtifactDefinition() {\n return [\n {\n generatedBy: this.id,\n name: this.compilerOptions.artifactName || 'dist',\n globPatterns: this.compilerOptions.distGlobPatterns || [\n `${this.distDir}/**`,\n `!${this.distDir}/tsconfig.tsbuildinfo`,\n ],\n },\n ];\n }\n\n private getOptions() {\n const defaultOpts = {\n targetExtension: '.js',\n };\n\n return Object.assign(defaultOpts, this.options);\n }\n\n displayConfig() {\n return this.compilers\n .map((compiler) => {\n return `${compiler.displayName}\\n${compiler.displayConfig}\\n`;\n })\n .join('\\n');\n }\n\n /**\n * the multi-compiler applies all applicable defined compilers on given content.\n */\n async transpileFile(fileContent: string, options: TranspileFileParams): Promise<TranspileFileOutput> {\n const outputs: TranspileFileOutput = await this.compilers.reduce<Promise<TranspileFileOutput>>(\n async (files: Promise<TranspileFileOutput>, compiler: Compiler) => {\n if (!compiler.transpileFile) {\n return files;\n }\n const filesToTranspile = await files;\n if (!filesToTranspile) return null;\n const flatMap = (\n await pMapSeries(filesToTranspile, async (file) => {\n if (!compiler.isFileSupported(file?.outputPath)) return [file];\n if (!compiler.transpileFile) return [];\n const params = Object.assign({}, options, {\n filePath: file.outputPath,\n });\n const compiledContent = await compiler.transpileFile(file.outputText, params);\n if (compiledContent) {\n return compiledContent;\n }\n return [];\n })\n ).flat();\n return flatMap;\n },\n Promise.resolve([{ outputText: fileContent, outputPath: options.filePath }] as TranspileFileOutput)\n );\n return outputs;\n }\n\n async transpileComponent(params: TranspileComponentParams): Promise<void> {\n await Promise.all(\n this.compilers.map((compiler) => {\n return compiler.transpileComponent?.(params);\n })\n );\n }\n\n async build(context: BuildContext): Promise<BuiltTaskResult> {\n const builds = await pMapSeries(this.compilers, async (compiler) => {\n const buildResult = await compiler.build(context);\n return buildResult.componentsResults;\n });\n\n return {\n componentsResults: mergeComponentResults(builds),\n artifacts: this.getArtifactDefinition(),\n };\n }\n\n async preBuild(context: BuildContext) {\n await Promise.all(\n this.compilers.map(async (compiler) => {\n if (!compiler.preBuild) return;\n await compiler.preBuild(context);\n })\n );\n }\n\n async postBuild(context: BuildContext, taskResults: TaskResultsList) {\n await Promise.all(\n this.compilers.map(async (compiler) => {\n if (!compiler.postBuild) return;\n await compiler.postBuild(context, taskResults);\n })\n );\n }\n\n private firstMatchedCompiler(filePath: string): Compiler | undefined {\n return this.compilers.find((compiler) => compiler.isFileSupported(filePath));\n }\n\n getPreviewComponentRootPath(component: Component): string {\n const matchedCompiler = this.compilers.find(\n (compiler) => typeof compiler.getPreviewComponentRootPath !== 'undefined'\n );\n if (!matchedCompiler) {\n return '';\n }\n\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n return matchedCompiler.getPreviewComponentRootPath!(component);\n }\n\n /**\n * given a source file, return its parallel in the dists. e.g. \"index.ts\" => \"dist/index.js\"\n * both, the return path and the given path are relative paths.\n */\n getDistPathBySrcPath(srcPath: string): string {\n const matchedCompiler = this.firstMatchedCompiler(srcPath);\n if (!matchedCompiler) {\n return join(this.distDir, srcPath);\n }\n\n return matchedCompiler.getDistPathBySrcPath(srcPath);\n }\n\n /**\n * only supported files matching get compiled. others, are copied to the dist dir.\n */\n isFileSupported(filePath: string): boolean {\n return !!this.firstMatchedCompiler(filePath);\n }\n\n /**\n * returns the version of the current compiler instance (e.g. '4.0.1').\n */\n version(): string {\n return this.compilers\n .map((compiler) => {\n return `${compiler.displayName}@${compiler.version()}`;\n })\n .join('\\n');\n }\n}\n"],"mappings":";;;;;;AAAA,SAAAA,MAAA;EAAA,MAAAC,IA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SAAS,CAACoD,IAAI,CACxClC,QAAQ,IAAK,OAAOA,QAAQ,CAACmC,2BAA2B,KAAK,WAChE,CAAC;IACD,IAAI,CAACE,eAAe,EAAE;MACpB,OAAO,EAAE;IACX;;IAEA;IACA,OAAOA,eAAe,CAACF,2BAA2B,CAAEC,SAAS,CAAC;EAChE;;EAEA;AACF;AACA;AACA;EACEE,oBAAoBA,CAACC,OAAe,EAAU;IAC5C,MAAMF,eAAe,GAAG,IAAI,CAACJ,oBAAoB,CAACM,OAAO,CAAC;IAC1D,IAAI,CAACF,eAAe,EAAE;MACpB,OAAO,IAAAnC,YAAI,EAAC,IAAI,CAACf,OAAO,EAAEoD,OAAO,CAAC;IACpC;IAEA,OAAOF,eAAe,CAACC,oBAAoB,CAACC,OAAO,CAAC;EACtD;;EAEA;AACF;AACA;EACE3B,eAAeA,CAACG,QAAgB,EAAW;IACzC,OAAO,CAAC,CAAC,IAAI,CAACkB,oBAAoB,CAAClB,QAAQ,CAAC;EAC9C;;EAEA;AACF;AACA;EACEyB,OAAOA,CAAA,EAAW;IAChB,OAAO,IAAI,CAAC1D,SAAS,CAClBiB,GAAG,CAAEC,QAAQ,IAAK;MACjB,OAAQ,GAAEA,QAAQ,CAACC,WAAY,IAAGD,QAAQ,CAACwC,OAAO,CAAC,CAAE,EAAC;IACxD,CAAC,CAAC,CACDtC,IAAI,CAAC,IAAI,CAAC;EACf;AACF;AAACuC,OAAA,CAAA9D,aAAA,GAAAA,aAAA"}
@@ -1,2 +1,2 @@
1
- import React from 'react';
2
- export declare const Logo: () => React.JSX.Element;
1
+ /// <reference types="react" />
2
+ export declare const Logo: () => JSX.Element;
@@ -1,5 +1,5 @@
1
- import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.compilation_multi-compiler@1.0.106/dist/multi-compiler.composition.js';
2
- import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.compilation_multi-compiler@1.0.106/dist/multi-compiler.docs.mdx';
1
+ import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.compilation_multi-compiler@1.0.108/dist/multi-compiler.composition.js';
2
+ import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.compilation_multi-compiler@1.0.108/dist/multi-compiler.docs.mdx';
3
3
 
4
4
  export const compositions = [compositions_0];
5
5
  export const overview = [overview_0];
package/index.ts ADDED
@@ -0,0 +1,6 @@
1
+ import { MultiCompilerAspect } from './multi-compiler.aspect';
2
+
3
+ export { MultiCompilerAspect };
4
+ export type { MultiCompilerMain } from './multi-compiler.main.runtime';
5
+ export type { MultiCompiler } from './multi-compiler.compiler';
6
+ export default MultiCompilerAspect;
@@ -0,0 +1,5 @@
1
+ import { Aspect } from '@teambit/harmony';
2
+
3
+ export const MultiCompilerAspect = Aspect.create({
4
+ id: 'teambit.compilation/multi-compiler',
5
+ });
@@ -0,0 +1,183 @@
1
+ import { join } from 'path';
2
+ import pMapSeries from 'p-map-series';
3
+ import {
4
+ Compiler,
5
+ CompilerOptions,
6
+ TranspileComponentParams,
7
+ TranspileFileOutput,
8
+ TranspileFileParams,
9
+ } from '@teambit/compiler';
10
+ import { BuiltTaskResult, BuildContext, TaskResultsList } from '@teambit/builder';
11
+ import { mergeComponentResults } from '@teambit/pipelines.modules.merge-component-results';
12
+ import { Component } from '@teambit/component';
13
+
14
+ export type MultiCompilerOptions = {
15
+ targetExtension?: string;
16
+ };
17
+
18
+ export class MultiCompiler implements Compiler {
19
+ displayName = 'Multi compiler';
20
+
21
+ shouldCopyNonSupportedFiles =
22
+ typeof this.compilerOptions.shouldCopyNonSupportedFiles === 'boolean'
23
+ ? this.compilerOptions.shouldCopyNonSupportedFiles
24
+ : true;
25
+ distDir = 'dist';
26
+
27
+ constructor(
28
+ readonly id: string,
29
+ readonly compilers: Compiler[],
30
+ readonly compilerOptions: Partial<CompilerOptions> = {},
31
+ readonly options: MultiCompilerOptions = {}
32
+ ) {}
33
+
34
+ getDistDir() {
35
+ return this.distDir;
36
+ }
37
+
38
+ getArtifactDefinition() {
39
+ return [
40
+ {
41
+ generatedBy: this.id,
42
+ name: this.compilerOptions.artifactName || 'dist',
43
+ globPatterns: this.compilerOptions.distGlobPatterns || [
44
+ `${this.distDir}/**`,
45
+ `!${this.distDir}/tsconfig.tsbuildinfo`,
46
+ ],
47
+ },
48
+ ];
49
+ }
50
+
51
+ private getOptions() {
52
+ const defaultOpts = {
53
+ targetExtension: '.js',
54
+ };
55
+
56
+ return Object.assign(defaultOpts, this.options);
57
+ }
58
+
59
+ displayConfig() {
60
+ return this.compilers
61
+ .map((compiler) => {
62
+ return `${compiler.displayName}\n${compiler.displayConfig}\n`;
63
+ })
64
+ .join('\n');
65
+ }
66
+
67
+ /**
68
+ * the multi-compiler applies all applicable defined compilers on given content.
69
+ */
70
+ async transpileFile(fileContent: string, options: TranspileFileParams): Promise<TranspileFileOutput> {
71
+ const outputs: TranspileFileOutput = await this.compilers.reduce<Promise<TranspileFileOutput>>(
72
+ async (files: Promise<TranspileFileOutput>, compiler: Compiler) => {
73
+ if (!compiler.transpileFile) {
74
+ return files;
75
+ }
76
+ const filesToTranspile = await files;
77
+ if (!filesToTranspile) return null;
78
+ const flatMap = (
79
+ await pMapSeries(filesToTranspile, async (file) => {
80
+ if (!compiler.isFileSupported(file?.outputPath)) return [file];
81
+ if (!compiler.transpileFile) return [];
82
+ const params = Object.assign({}, options, {
83
+ filePath: file.outputPath,
84
+ });
85
+ const compiledContent = await compiler.transpileFile(file.outputText, params);
86
+ if (compiledContent) {
87
+ return compiledContent;
88
+ }
89
+ return [];
90
+ })
91
+ ).flat();
92
+ return flatMap;
93
+ },
94
+ Promise.resolve([{ outputText: fileContent, outputPath: options.filePath }] as TranspileFileOutput)
95
+ );
96
+ return outputs;
97
+ }
98
+
99
+ async transpileComponent(params: TranspileComponentParams): Promise<void> {
100
+ await Promise.all(
101
+ this.compilers.map((compiler) => {
102
+ return compiler.transpileComponent?.(params);
103
+ })
104
+ );
105
+ }
106
+
107
+ async build(context: BuildContext): Promise<BuiltTaskResult> {
108
+ const builds = await pMapSeries(this.compilers, async (compiler) => {
109
+ const buildResult = await compiler.build(context);
110
+ return buildResult.componentsResults;
111
+ });
112
+
113
+ return {
114
+ componentsResults: mergeComponentResults(builds),
115
+ artifacts: this.getArtifactDefinition(),
116
+ };
117
+ }
118
+
119
+ async preBuild(context: BuildContext) {
120
+ await Promise.all(
121
+ this.compilers.map(async (compiler) => {
122
+ if (!compiler.preBuild) return;
123
+ await compiler.preBuild(context);
124
+ })
125
+ );
126
+ }
127
+
128
+ async postBuild(context: BuildContext, taskResults: TaskResultsList) {
129
+ await Promise.all(
130
+ this.compilers.map(async (compiler) => {
131
+ if (!compiler.postBuild) return;
132
+ await compiler.postBuild(context, taskResults);
133
+ })
134
+ );
135
+ }
136
+
137
+ private firstMatchedCompiler(filePath: string): Compiler | undefined {
138
+ return this.compilers.find((compiler) => compiler.isFileSupported(filePath));
139
+ }
140
+
141
+ getPreviewComponentRootPath(component: Component): string {
142
+ const matchedCompiler = this.compilers.find(
143
+ (compiler) => typeof compiler.getPreviewComponentRootPath !== 'undefined'
144
+ );
145
+ if (!matchedCompiler) {
146
+ return '';
147
+ }
148
+
149
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
150
+ return matchedCompiler.getPreviewComponentRootPath!(component);
151
+ }
152
+
153
+ /**
154
+ * given a source file, return its parallel in the dists. e.g. "index.ts" => "dist/index.js"
155
+ * both, the return path and the given path are relative paths.
156
+ */
157
+ getDistPathBySrcPath(srcPath: string): string {
158
+ const matchedCompiler = this.firstMatchedCompiler(srcPath);
159
+ if (!matchedCompiler) {
160
+ return join(this.distDir, srcPath);
161
+ }
162
+
163
+ return matchedCompiler.getDistPathBySrcPath(srcPath);
164
+ }
165
+
166
+ /**
167
+ * only supported files matching get compiled. others, are copied to the dist dir.
168
+ */
169
+ isFileSupported(filePath: string): boolean {
170
+ return !!this.firstMatchedCompiler(filePath);
171
+ }
172
+
173
+ /**
174
+ * returns the version of the current compiler instance (e.g. '4.0.1').
175
+ */
176
+ version(): string {
177
+ return this.compilers
178
+ .map((compiler) => {
179
+ return `${compiler.displayName}@${compiler.version()}`;
180
+ })
181
+ .join('\n');
182
+ }
183
+ }
@@ -0,0 +1,22 @@
1
+ import { MainRuntime } from '@teambit/cli';
2
+ import { Compiler, CompilerOptions } from '@teambit/compiler';
3
+ import { MultiCompilerAspect } from './multi-compiler.aspect';
4
+ import { MultiCompiler } from './multi-compiler.compiler';
5
+
6
+ export class MultiCompilerMain {
7
+ /**
8
+ * create a multi-compiler `Compiler` instance.
9
+ * @param compilers list of compilers to include.
10
+ */
11
+ createCompiler(compilers: Compiler[], options: Partial<CompilerOptions> = {}) {
12
+ return new MultiCompiler(MultiCompilerAspect.id, compilers, options, {});
13
+ }
14
+
15
+ static runtime = MainRuntime;
16
+
17
+ static async provider() {
18
+ return new MultiCompilerMain();
19
+ }
20
+ }
21
+
22
+ MultiCompilerAspect.addRuntime(MultiCompilerMain);
package/package.json CHANGED
@@ -1,37 +1,33 @@
1
1
  {
2
2
  "name": "@teambit/multi-compiler",
3
- "version": "1.0.106",
3
+ "version": "1.0.108",
4
4
  "homepage": "https://bit.cloud/teambit/compilation/multi-compiler",
5
5
  "main": "dist/index.js",
6
6
  "componentId": {
7
7
  "scope": "teambit.compilation",
8
8
  "name": "multi-compiler",
9
- "version": "1.0.106"
9
+ "version": "1.0.108"
10
10
  },
11
11
  "dependencies": {
12
12
  "p-map-series": "2.1.0",
13
- "core-js": "^3.0.0",
14
- "@babel/runtime": "7.20.0",
15
13
  "@teambit/harmony": "0.4.6",
16
- "@teambit/builder": "1.0.106",
17
- "@teambit/compiler": "1.0.106",
18
- "@teambit/component": "1.0.106",
14
+ "@teambit/builder": "1.0.108",
15
+ "@teambit/compiler": "1.0.108",
16
+ "@teambit/component": "1.0.108",
19
17
  "@teambit/pipelines.modules.merge-component-results": "0.0.496",
20
- "@teambit/cli": "0.0.839"
18
+ "@teambit/cli": "0.0.840"
21
19
  },
22
20
  "devDependencies": {
23
- "@types/react": "^17.0.8",
24
21
  "@types/mocha": "9.1.0",
25
- "@types/node": "12.20.4",
26
- "@types/react-dom": "^17.0.5",
27
- "@types/jest": "^26.0.0",
28
- "@types/testing-library__jest-dom": "5.9.5",
22
+ "@types/jest": "^29.2.2",
23
+ "@types/testing-library__jest-dom": "^5.9.5",
24
+ "@teambit/harmony.envs.core-aspect-env": "0.0.13",
29
25
  "@teambit/compilation.aspect-docs.multi-compiler": "0.0.167"
30
26
  },
31
27
  "peerDependencies": {
32
- "@teambit/legacy": "1.0.624",
33
- "react": "^16.8.0 || ^17.0.0",
34
- "react-dom": "^16.8.0 || ^17.0.0"
28
+ "react": "^17.0.0 || ^18.0.0",
29
+ "@types/react": "^18.2.12",
30
+ "@teambit/legacy": "1.0.624"
35
31
  },
36
32
  "license": "Apache-2.0",
37
33
  "optionalDependencies": {},
@@ -45,7 +41,7 @@
45
41
  },
46
42
  "private": false,
47
43
  "engines": {
48
- "node": ">=12.22.0"
44
+ "node": ">=16.0.0"
49
45
  },
50
46
  "repository": {
51
47
  "type": "git",
@@ -54,12 +50,9 @@
54
50
  "keywords": [
55
51
  "bit",
56
52
  "bit-aspect",
53
+ "bit-core-aspect",
57
54
  "components",
58
55
  "collaboration",
59
- "web",
60
- "react",
61
- "react-components",
62
- "angular",
63
- "angular-components"
56
+ "web"
64
57
  ]
65
58
  }
package/tsconfig.json CHANGED
@@ -1,38 +1,33 @@
1
1
  {
2
2
  "compilerOptions": {
3
3
  "lib": [
4
- "es2019",
5
- "DOM",
6
- "ES6",
7
- "DOM.Iterable",
8
- "ScriptHost"
4
+ "esnext",
5
+ "dom",
6
+ "dom.Iterable"
9
7
  ],
10
- "target": "es2015",
11
- "module": "CommonJS",
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
- "outDir": "dist",
14
+ "skipLibCheck": true,
20
15
  "moduleResolution": "node",
21
16
  "esModuleInterop": true,
22
- "rootDir": ".",
23
17
  "resolveJsonModule": true,
24
- "emitDeclarationOnly": true,
25
- "emitDecoratorMetadata": true,
26
- "allowSyntheticDefaultImports": true,
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
- "package.json"
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<SVGProps<SVGSVGElement> & { title?: string }>;
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
+ }