@teambit/babel 1.0.106 → 1.0.108
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/babel.aspect.ts +5 -0
- package/babel.compiler.ts +175 -0
- package/babel.main.runtime.ts +31 -0
- package/compiler-options.ts +22 -0
- package/dist/babel.compiler.js +1 -2
- package/dist/babel.compiler.js.map +1 -1
- package/dist/babel.composition.d.ts +2 -2
- package/dist/compiler-options.d.ts +1 -1
- package/dist/{preview-1703505948637.js → preview-1703647408454.js} +2 -2
- package/index.ts +3 -0
- package/package.json +16 -23
- package/tsconfig.json +16 -21
- package/types/asset.d.ts +15 -3
package/babel.aspect.ts
ADDED
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
import * as babel from '@babel/core';
|
|
2
|
+
import multimatch from 'multimatch';
|
|
3
|
+
import { flatten } from 'lodash';
|
|
4
|
+
import mapSeries from 'p-map-series';
|
|
5
|
+
import fs from 'fs-extra';
|
|
6
|
+
import { BuildContext, BuiltTaskResult, ComponentResult } from '@teambit/builder';
|
|
7
|
+
import { Compiler, CompilerMain, TranspileFileParams, TranspileFileOutput } from '@teambit/compiler';
|
|
8
|
+
import { Capsule } from '@teambit/isolator';
|
|
9
|
+
import { Logger } from '@teambit/logger';
|
|
10
|
+
import path from 'path';
|
|
11
|
+
import {
|
|
12
|
+
isFileSupported,
|
|
13
|
+
transpileFileContent,
|
|
14
|
+
transpileFilePathAsync,
|
|
15
|
+
replaceFileExtToJs,
|
|
16
|
+
TranspileContext,
|
|
17
|
+
} from '@teambit/compilation.modules.babel-compiler';
|
|
18
|
+
import { BabelCompilerOptions } from './compiler-options';
|
|
19
|
+
|
|
20
|
+
export class BabelCompiler implements Compiler {
|
|
21
|
+
distDir: string;
|
|
22
|
+
distGlobPatterns: string[];
|
|
23
|
+
shouldCopyNonSupportedFiles: boolean;
|
|
24
|
+
artifactName: string;
|
|
25
|
+
supportedFilesGlobPatterns: string[] | null;
|
|
26
|
+
constructor(
|
|
27
|
+
readonly id: string,
|
|
28
|
+
private logger: Logger,
|
|
29
|
+
private compiler: CompilerMain,
|
|
30
|
+
private options: BabelCompilerOptions,
|
|
31
|
+
private babelModule = babel
|
|
32
|
+
) {
|
|
33
|
+
this.distDir = options.distDir || 'dist';
|
|
34
|
+
this.distGlobPatterns = options.distGlobPatterns || [`${this.distDir}/**`, `!${this.distDir}/tsconfig.tsbuildinfo`];
|
|
35
|
+
this.shouldCopyNonSupportedFiles =
|
|
36
|
+
typeof options.shouldCopyNonSupportedFiles === 'boolean' ? options.shouldCopyNonSupportedFiles : true;
|
|
37
|
+
this.artifactName = options.artifactName || 'dist';
|
|
38
|
+
this.supportedFilesGlobPatterns = options.supportedFilesGlobPatterns
|
|
39
|
+
? flatten(options.supportedFilesGlobPatterns)
|
|
40
|
+
: null;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
displayName = 'Babel';
|
|
44
|
+
deleteDistDir = false;
|
|
45
|
+
|
|
46
|
+
version() {
|
|
47
|
+
return this.babelModule.version;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
getDistDir() {
|
|
51
|
+
return this.distDir;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* compile one file on the workspace
|
|
56
|
+
*/
|
|
57
|
+
transpileFile(fileContent: string, options: TranspileFileParams): TranspileFileOutput {
|
|
58
|
+
const supportedExtensions = ['.ts', '.tsx', '.js', '.jsx'];
|
|
59
|
+
const fileExtension = path.extname(options.filePath);
|
|
60
|
+
if (!supportedExtensions.includes(fileExtension) || options.filePath.endsWith('.d.ts')) {
|
|
61
|
+
return null; // file is not supported
|
|
62
|
+
}
|
|
63
|
+
const transformOptions = this.options.babelTransformOptions || {};
|
|
64
|
+
const context: TranspileContext = {
|
|
65
|
+
filePath: options.filePath,
|
|
66
|
+
rootDir: options.componentDir,
|
|
67
|
+
};
|
|
68
|
+
const outputFiles = transpileFileContent(fileContent, context, transformOptions, this.babelModule);
|
|
69
|
+
return outputFiles;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* compile multiple components on the capsules
|
|
74
|
+
*/
|
|
75
|
+
async build(context: BuildContext): Promise<BuiltTaskResult> {
|
|
76
|
+
const capsules = context.capsuleNetwork.seedersCapsules;
|
|
77
|
+
const componentsResults: ComponentResult[] = [];
|
|
78
|
+
const longProcessLogger = this.logger.createLongProcessLogger('compile babel components', capsules.length);
|
|
79
|
+
await mapSeries(capsules, async (capsule) => {
|
|
80
|
+
const currentComponentResult: ComponentResult = {
|
|
81
|
+
errors: [],
|
|
82
|
+
component: capsule.component,
|
|
83
|
+
};
|
|
84
|
+
longProcessLogger.logProgress(capsule.component.id.toString());
|
|
85
|
+
await this.buildOneCapsule(capsule, currentComponentResult);
|
|
86
|
+
componentsResults.push({ ...currentComponentResult });
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
return {
|
|
90
|
+
artifacts: this.getArtifactDefinition(),
|
|
91
|
+
componentsResults,
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
createTask(name = 'BabelCompiler') {
|
|
96
|
+
return this.compiler.createTask(name, this);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
private async buildOneCapsule(capsule: Capsule, componentResult: ComponentResult) {
|
|
100
|
+
componentResult.startTime = Date.now();
|
|
101
|
+
const sourceFiles = capsule.component.filesystem.files.map((file) => file.relative);
|
|
102
|
+
await fs.ensureDir(path.join(capsule.path, this.distDir));
|
|
103
|
+
await Promise.all(
|
|
104
|
+
sourceFiles.map(async (filePath) => {
|
|
105
|
+
if (this.isFileSupported(filePath)) {
|
|
106
|
+
const absoluteFilePath = path.join(capsule.path, filePath);
|
|
107
|
+
this.options.babelTransformOptions ||= {};
|
|
108
|
+
this.options.babelTransformOptions.sourceFileName = path.basename(filePath);
|
|
109
|
+
this.options.babelTransformOptions.filename = path.basename(filePath);
|
|
110
|
+
try {
|
|
111
|
+
const result = await transpileFilePathAsync(
|
|
112
|
+
absoluteFilePath,
|
|
113
|
+
this.options.babelTransformOptions || {},
|
|
114
|
+
this.babelModule
|
|
115
|
+
);
|
|
116
|
+
if (!result || !result.length) {
|
|
117
|
+
this.logger.debug(
|
|
118
|
+
`getting an empty response from Babel for the file ${filePath}. it might be configured to be ignored`
|
|
119
|
+
);
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
// Make sure to get only the relative path of the dist because we want to add the dist dir.
|
|
123
|
+
// If we use the result outputPath we will get an absolute path here
|
|
124
|
+
const distPath = this.replaceFileExtToJs(filePath);
|
|
125
|
+
const distPathMap = `${distPath}.map`;
|
|
126
|
+
await fs.outputFile(path.join(capsule.path, this.distDir, distPath), result[0].outputText);
|
|
127
|
+
if (result.length > 1) {
|
|
128
|
+
await fs.outputFile(path.join(capsule.path, this.distDir, distPathMap), result[1].outputText);
|
|
129
|
+
}
|
|
130
|
+
} catch (err: any) {
|
|
131
|
+
componentResult.errors?.push(err);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
})
|
|
135
|
+
);
|
|
136
|
+
componentResult.endTime = Date.now();
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
getArtifactDefinition() {
|
|
140
|
+
return [
|
|
141
|
+
{
|
|
142
|
+
generatedBy: this.id,
|
|
143
|
+
name: this.artifactName,
|
|
144
|
+
globPatterns: this.distGlobPatterns,
|
|
145
|
+
},
|
|
146
|
+
];
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* given a source file, return its parallel in the dists. e.g. index.ts => dist/index.js
|
|
151
|
+
*/
|
|
152
|
+
getDistPathBySrcPath(srcPath: string) {
|
|
153
|
+
const fileWithJSExtIfNeeded = this.replaceFileExtToJs(srcPath);
|
|
154
|
+
return path.join(this.distDir, fileWithJSExtIfNeeded);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* whether babel is able to compile the given path
|
|
159
|
+
*/
|
|
160
|
+
isFileSupported(filePath: string): boolean {
|
|
161
|
+
if (this.supportedFilesGlobPatterns) {
|
|
162
|
+
return isFileSupported(filePath) && !!multimatch(filePath, this.supportedFilesGlobPatterns).length;
|
|
163
|
+
}
|
|
164
|
+
return isFileSupported(filePath);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
displayConfig() {
|
|
168
|
+
return JSON.stringify(this.options.babelTransformOptions || {}, null, 2);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
private replaceFileExtToJs(filePath: string): string {
|
|
172
|
+
if (!this.isFileSupported(filePath)) return filePath;
|
|
173
|
+
return replaceFileExtToJs(filePath);
|
|
174
|
+
}
|
|
175
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { MainRuntime } from '@teambit/cli';
|
|
2
|
+
import { CompilerAspect, CompilerMain } from '@teambit/compiler';
|
|
3
|
+
import { Logger, LoggerAspect, LoggerMain } from '@teambit/logger';
|
|
4
|
+
import * as babel from '@babel/core';
|
|
5
|
+
import { BabelCompilerOptions } from './compiler-options';
|
|
6
|
+
import { BabelAspect } from './babel.aspect';
|
|
7
|
+
import { BabelCompiler } from './babel.compiler';
|
|
8
|
+
|
|
9
|
+
export class BabelMain {
|
|
10
|
+
constructor(private logger: Logger, private compiler: CompilerMain) {}
|
|
11
|
+
|
|
12
|
+
createCompiler(options: BabelCompilerOptions, babelModule = babel): BabelCompiler {
|
|
13
|
+
return new BabelCompiler(BabelAspect.id, this.logger, this.compiler, options, babelModule);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
getPackageJsonProps() {
|
|
17
|
+
return {
|
|
18
|
+
main: 'dist/{main}.js',
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
static runtime = MainRuntime;
|
|
23
|
+
static dependencies = [LoggerAspect, CompilerAspect];
|
|
24
|
+
|
|
25
|
+
static async provider([loggerExt, compiler]: [LoggerMain, CompilerMain]) {
|
|
26
|
+
const logger = loggerExt.createLogger(BabelAspect.id);
|
|
27
|
+
return new BabelMain(logger, compiler);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
BabelAspect.addRuntime(BabelMain);
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { TransformOptions } from '@babel/core';
|
|
2
|
+
import { CompilerOptions } from '@teambit/compiler';
|
|
3
|
+
|
|
4
|
+
export type BabelCompilerOptions = {
|
|
5
|
+
/**
|
|
6
|
+
* TransformOptions of Babel. @see https://babeljs.io/docs/en/options
|
|
7
|
+
*
|
|
8
|
+
* `babel.config.json` and `.babelrc.json` use the same options, so you can require the json file
|
|
9
|
+
* and pass it as the option parameter. e.g.
|
|
10
|
+
* ```
|
|
11
|
+
* createCompiler({ babelTransformOptions: require('./babel.config.json') });
|
|
12
|
+
* ```
|
|
13
|
+
*/
|
|
14
|
+
babelTransformOptions?: TransformOptions;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Determines which files should be compiled by the Babel compiler.
|
|
18
|
+
* It only works with the file types supported by Babel (.ts, .tsx, .js, .jsx, .d.ts).
|
|
19
|
+
* See https://github.com/mrmlnc/fast-glob for the supported glob patters syntax.
|
|
20
|
+
*/
|
|
21
|
+
supportedFilesGlobPatterns?: string[];
|
|
22
|
+
} & Partial<CompilerOptions>;
|
package/dist/babel.compiler.js
CHANGED
|
@@ -155,8 +155,7 @@ class BabelCompiler {
|
|
|
155
155
|
await _fsExtra().default.outputFile(_path().default.join(capsule.path, this.distDir, distPathMap), result[1].outputText);
|
|
156
156
|
}
|
|
157
157
|
} catch (err) {
|
|
158
|
-
|
|
159
|
-
(_componentResult$erro = componentResult.errors) === null || _componentResult$erro === void 0 || _componentResult$erro.push(err);
|
|
158
|
+
componentResult.errors?.push(err);
|
|
160
159
|
}
|
|
161
160
|
}
|
|
162
161
|
}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["babel","data","_interopRequireWildcard","require","_multimatch","_interopRequireDefault","_lodash","_pMapSeries","_fsExtra","_path","_compilationModules","obj","__esModule","default","_getRequireWildcardCache","e","WeakMap","r","t","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","ownKeys","keys","getOwnPropertySymbols","o","filter","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","key","value","_toPropertyKey","configurable","writable","_toPrimitive","String","Symbol","toPrimitive","TypeError","Number","BabelCompiler","constructor","id","logger","compiler","options","babelModule","distDir","distGlobPatterns","shouldCopyNonSupportedFiles","artifactName","supportedFilesGlobPatterns","flatten","version","getDistDir","transpileFile","fileContent","supportedExtensions","fileExtension","path","extname","filePath","includes","endsWith","transformOptions","babelTransformOptions","context","rootDir","componentDir","outputFiles","transpileFileContent","build","capsules","capsuleNetwork","seedersCapsules","componentsResults","longProcessLogger","createLongProcessLogger","mapSeries","capsule","currentComponentResult","errors","component","logProgress","toString","buildOneCapsule","artifacts","getArtifactDefinition","createTask","name","componentResult","startTime","Date","now","sourceFiles","filesystem","files","map","file","relative","fs","ensureDir","join","Promise","all","isFileSupported","absoluteFilePath","sourceFileName","basename","filename","result","transpileFilePathAsync","debug","distPath","replaceFileExtToJs","distPathMap","outputFile","outputText","err","_componentResult$erro","endTime","generatedBy","globPatterns","getDistPathBySrcPath","srcPath","fileWithJSExtIfNeeded","multimatch","displayConfig","JSON","stringify","exports"],"sources":["babel.compiler.ts"],"sourcesContent":["import * as babel from '@babel/core';\nimport multimatch from 'multimatch';\nimport { flatten } from 'lodash';\nimport mapSeries from 'p-map-series';\nimport fs from 'fs-extra';\nimport { BuildContext, BuiltTaskResult, ComponentResult } from '@teambit/builder';\nimport { Compiler, CompilerMain, TranspileFileParams, TranspileFileOutput } from '@teambit/compiler';\nimport { Capsule } from '@teambit/isolator';\nimport { Logger } from '@teambit/logger';\nimport path from 'path';\nimport {\n isFileSupported,\n transpileFileContent,\n transpileFilePathAsync,\n replaceFileExtToJs,\n TranspileContext,\n} from '@teambit/compilation.modules.babel-compiler';\nimport { BabelCompilerOptions } from './compiler-options';\n\nexport class BabelCompiler implements Compiler {\n distDir: string;\n distGlobPatterns: string[];\n shouldCopyNonSupportedFiles: boolean;\n artifactName: string;\n supportedFilesGlobPatterns: string[] | null;\n constructor(\n readonly id: string,\n private logger: Logger,\n private compiler: CompilerMain,\n private options: BabelCompilerOptions,\n private babelModule = babel\n ) {\n this.distDir = options.distDir || 'dist';\n this.distGlobPatterns = options.distGlobPatterns || [`${this.distDir}/**`, `!${this.distDir}/tsconfig.tsbuildinfo`];\n this.shouldCopyNonSupportedFiles =\n typeof options.shouldCopyNonSupportedFiles === 'boolean' ? options.shouldCopyNonSupportedFiles : true;\n this.artifactName = options.artifactName || 'dist';\n this.supportedFilesGlobPatterns = options.supportedFilesGlobPatterns\n ? flatten(options.supportedFilesGlobPatterns)\n : null;\n }\n\n displayName = 'Babel';\n deleteDistDir = false;\n\n version() {\n return this.babelModule.version;\n }\n\n getDistDir() {\n return this.distDir;\n }\n\n /**\n * compile one file on the workspace\n */\n transpileFile(fileContent: string, options: TranspileFileParams): TranspileFileOutput {\n const supportedExtensions = ['.ts', '.tsx', '.js', '.jsx'];\n const fileExtension = path.extname(options.filePath);\n if (!supportedExtensions.includes(fileExtension) || options.filePath.endsWith('.d.ts')) {\n return null; // file is not supported\n }\n const transformOptions = this.options.babelTransformOptions || {};\n const context: TranspileContext = {\n filePath: options.filePath,\n rootDir: options.componentDir,\n };\n const outputFiles = transpileFileContent(fileContent, context, transformOptions, this.babelModule);\n return outputFiles;\n }\n\n /**\n * compile multiple components on the capsules\n */\n async build(context: BuildContext): Promise<BuiltTaskResult> {\n const capsules = context.capsuleNetwork.seedersCapsules;\n const componentsResults: ComponentResult[] = [];\n const longProcessLogger = this.logger.createLongProcessLogger('compile babel components', capsules.length);\n await mapSeries(capsules, async (capsule) => {\n const currentComponentResult: ComponentResult = {\n errors: [],\n component: capsule.component,\n };\n longProcessLogger.logProgress(capsule.component.id.toString());\n await this.buildOneCapsule(capsule, currentComponentResult);\n componentsResults.push({ ...currentComponentResult });\n });\n\n return {\n artifacts: this.getArtifactDefinition(),\n componentsResults,\n };\n }\n\n createTask(name = 'BabelCompiler') {\n return this.compiler.createTask(name, this);\n }\n\n private async buildOneCapsule(capsule: Capsule, componentResult: ComponentResult) {\n componentResult.startTime = Date.now();\n const sourceFiles = capsule.component.filesystem.files.map((file) => file.relative);\n await fs.ensureDir(path.join(capsule.path, this.distDir));\n await Promise.all(\n sourceFiles.map(async (filePath) => {\n if (this.isFileSupported(filePath)) {\n const absoluteFilePath = path.join(capsule.path, filePath);\n this.options.babelTransformOptions ||= {};\n this.options.babelTransformOptions.sourceFileName = path.basename(filePath);\n this.options.babelTransformOptions.filename = path.basename(filePath);\n try {\n const result = await transpileFilePathAsync(\n absoluteFilePath,\n this.options.babelTransformOptions || {},\n this.babelModule\n );\n if (!result || !result.length) {\n this.logger.debug(\n `getting an empty response from Babel for the file ${filePath}. it might be configured to be ignored`\n );\n return;\n }\n // Make sure to get only the relative path of the dist because we want to add the dist dir.\n // If we use the result outputPath we will get an absolute path here\n const distPath = this.replaceFileExtToJs(filePath);\n const distPathMap = `${distPath}.map`;\n await fs.outputFile(path.join(capsule.path, this.distDir, distPath), result[0].outputText);\n if (result.length > 1) {\n await fs.outputFile(path.join(capsule.path, this.distDir, distPathMap), result[1].outputText);\n }\n } catch (err: any) {\n componentResult.errors?.push(err);\n }\n }\n })\n );\n componentResult.endTime = Date.now();\n }\n\n getArtifactDefinition() {\n return [\n {\n generatedBy: this.id,\n name: this.artifactName,\n globPatterns: this.distGlobPatterns,\n },\n ];\n }\n\n /**\n * given a source file, return its parallel in the dists. e.g. index.ts => dist/index.js\n */\n getDistPathBySrcPath(srcPath: string) {\n const fileWithJSExtIfNeeded = this.replaceFileExtToJs(srcPath);\n return path.join(this.distDir, fileWithJSExtIfNeeded);\n }\n\n /**\n * whether babel is able to compile the given path\n */\n isFileSupported(filePath: string): boolean {\n if (this.supportedFilesGlobPatterns) {\n return isFileSupported(filePath) && !!multimatch(filePath, this.supportedFilesGlobPatterns).length;\n }\n return isFileSupported(filePath);\n }\n\n displayConfig() {\n return JSON.stringify(this.options.babelTransformOptions || {}, null, 2);\n }\n\n private replaceFileExtToJs(filePath: string): string {\n if (!this.isFileSupported(filePath)) return filePath;\n return replaceFileExtToJs(filePath);\n }\n}\n"],"mappings":";;;;;;AAAA,SAAAA,MAAA;EAAA,MAAAC,IAAA,GAAAC,uBAAA,CAAAC,OAAA;EAAAH,KAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,YAAA;EAAA,MAAAH,IAAA,GAAAI,sBAAA,CAAAF,OAAA;EAAAC,WAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,QAAA;EAAA,MAAAL,IAAA,GAAAE,OAAA;EAAAG,OAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAM,YAAA;EAAA,MAAAN,IAAA,GAAAI,sBAAA,CAAAF,OAAA;EAAAI,WAAA,YAAAA,CAAA;IAAA,OAAAN,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAO,SAAA;EAAA,MAAAP,IAAA,GAAAI,sBAAA,CAAAF,OAAA;EAAAK,QAAA,YAAAA,CAAA;IAAA,OAAAP,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAKA,SAAAQ,MAAA;EAAA,MAAAR,IAAA,GAAAI,sBAAA,CAAAF,OAAA;EAAAM,KAAA,YAAAA,CAAA;IAAA,OAAAR,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAS,oBAAA;EAAA,MAAAT,IAAA,GAAAE,OAAA;EAAAO,mBAAA,YAAAA,CAAA;IAAA,OAAAT,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;A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QAAQ,CAAC,EAAE,OAAOA,QAAQ;IACpD,OAAO,IAAAqD,wCAAkB,EAACrD,QAAQ,CAAC;EACrC;AACF;AAACqE,OAAA,CAAA1F,aAAA,GAAAA,aAAA"}
|
|
1
|
+
{"version":3,"names":["babel","data","_interopRequireWildcard","require","_multimatch","_interopRequireDefault","_lodash","_pMapSeries","_fsExtra","_path","_compilationModules","obj","__esModule","default","_getRequireWildcardCache","e","WeakMap","r","t","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","ownKeys","keys","getOwnPropertySymbols","o","filter","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","key","value","_toPropertyKey","configurable","writable","_toPrimitive","String","Symbol","toPrimitive","TypeError","Number","BabelCompiler","constructor","id","logger","compiler","options","babelModule","distDir","distGlobPatterns","shouldCopyNonSupportedFiles","artifactName","supportedFilesGlobPatterns","flatten","version","getDistDir","transpileFile","fileContent","supportedExtensions","fileExtension","path","extname","filePath","includes","endsWith","transformOptions","babelTransformOptions","context","rootDir","componentDir","outputFiles","transpileFileContent","build","capsules","capsuleNetwork","seedersCapsules","componentsResults","longProcessLogger","createLongProcessLogger","mapSeries","capsule","currentComponentResult","errors","component","logProgress","toString","buildOneCapsule","artifacts","getArtifactDefinition","createTask","name","componentResult","startTime","Date","now","sourceFiles","filesystem","files","map","file","relative","fs","ensureDir","join","Promise","all","isFileSupported","absoluteFilePath","sourceFileName","basename","filename","result","transpileFilePathAsync","debug","distPath","replaceFileExtToJs","distPathMap","outputFile","outputText","err","endTime","generatedBy","globPatterns","getDistPathBySrcPath","srcPath","fileWithJSExtIfNeeded","multimatch","displayConfig","JSON","stringify","exports"],"sources":["babel.compiler.ts"],"sourcesContent":["import * as babel from '@babel/core';\nimport multimatch from 'multimatch';\nimport { flatten } from 'lodash';\nimport mapSeries from 'p-map-series';\nimport fs from 'fs-extra';\nimport { BuildContext, BuiltTaskResult, ComponentResult } from '@teambit/builder';\nimport { Compiler, CompilerMain, TranspileFileParams, TranspileFileOutput } from '@teambit/compiler';\nimport { Capsule } from '@teambit/isolator';\nimport { Logger } from '@teambit/logger';\nimport path from 'path';\nimport {\n isFileSupported,\n transpileFileContent,\n transpileFilePathAsync,\n replaceFileExtToJs,\n TranspileContext,\n} from '@teambit/compilation.modules.babel-compiler';\nimport { BabelCompilerOptions } from './compiler-options';\n\nexport class BabelCompiler implements Compiler {\n distDir: string;\n distGlobPatterns: string[];\n shouldCopyNonSupportedFiles: boolean;\n artifactName: string;\n supportedFilesGlobPatterns: string[] | null;\n constructor(\n readonly id: string,\n private logger: Logger,\n private compiler: CompilerMain,\n private options: BabelCompilerOptions,\n private babelModule = babel\n ) {\n this.distDir = options.distDir || 'dist';\n this.distGlobPatterns = options.distGlobPatterns || [`${this.distDir}/**`, `!${this.distDir}/tsconfig.tsbuildinfo`];\n this.shouldCopyNonSupportedFiles =\n typeof options.shouldCopyNonSupportedFiles === 'boolean' ? options.shouldCopyNonSupportedFiles : true;\n this.artifactName = options.artifactName || 'dist';\n this.supportedFilesGlobPatterns = options.supportedFilesGlobPatterns\n ? flatten(options.supportedFilesGlobPatterns)\n : null;\n }\n\n displayName = 'Babel';\n deleteDistDir = false;\n\n version() {\n return this.babelModule.version;\n }\n\n getDistDir() {\n return this.distDir;\n }\n\n /**\n * compile one file on the workspace\n */\n transpileFile(fileContent: string, options: TranspileFileParams): TranspileFileOutput {\n const supportedExtensions = ['.ts', '.tsx', '.js', '.jsx'];\n const fileExtension = path.extname(options.filePath);\n if (!supportedExtensions.includes(fileExtension) || options.filePath.endsWith('.d.ts')) {\n return null; // file is not supported\n }\n const transformOptions = this.options.babelTransformOptions || {};\n const context: TranspileContext = {\n filePath: options.filePath,\n rootDir: options.componentDir,\n };\n const outputFiles = transpileFileContent(fileContent, context, transformOptions, this.babelModule);\n return outputFiles;\n }\n\n /**\n * compile multiple components on the capsules\n */\n async build(context: BuildContext): Promise<BuiltTaskResult> {\n const capsules = context.capsuleNetwork.seedersCapsules;\n const componentsResults: ComponentResult[] = [];\n const longProcessLogger = this.logger.createLongProcessLogger('compile babel components', capsules.length);\n await mapSeries(capsules, async (capsule) => {\n const currentComponentResult: ComponentResult = {\n errors: [],\n component: capsule.component,\n };\n longProcessLogger.logProgress(capsule.component.id.toString());\n await this.buildOneCapsule(capsule, currentComponentResult);\n componentsResults.push({ ...currentComponentResult });\n });\n\n return {\n artifacts: this.getArtifactDefinition(),\n componentsResults,\n };\n }\n\n createTask(name = 'BabelCompiler') {\n return this.compiler.createTask(name, this);\n }\n\n private async buildOneCapsule(capsule: Capsule, componentResult: ComponentResult) {\n componentResult.startTime = Date.now();\n const sourceFiles = capsule.component.filesystem.files.map((file) => file.relative);\n await fs.ensureDir(path.join(capsule.path, this.distDir));\n await Promise.all(\n sourceFiles.map(async (filePath) => {\n if (this.isFileSupported(filePath)) {\n const absoluteFilePath = path.join(capsule.path, filePath);\n this.options.babelTransformOptions ||= {};\n this.options.babelTransformOptions.sourceFileName = path.basename(filePath);\n this.options.babelTransformOptions.filename = path.basename(filePath);\n try {\n const result = await transpileFilePathAsync(\n absoluteFilePath,\n this.options.babelTransformOptions || {},\n this.babelModule\n );\n if (!result || !result.length) {\n this.logger.debug(\n `getting an empty response from Babel for the file ${filePath}. it might be configured to be ignored`\n );\n return;\n }\n // Make sure to get only the relative path of the dist because we want to add the dist dir.\n // If we use the result outputPath we will get an absolute path here\n const distPath = this.replaceFileExtToJs(filePath);\n const distPathMap = `${distPath}.map`;\n await fs.outputFile(path.join(capsule.path, this.distDir, distPath), result[0].outputText);\n if (result.length > 1) {\n await fs.outputFile(path.join(capsule.path, this.distDir, distPathMap), result[1].outputText);\n }\n } catch (err: any) {\n componentResult.errors?.push(err);\n }\n }\n })\n );\n componentResult.endTime = Date.now();\n }\n\n getArtifactDefinition() {\n return [\n {\n generatedBy: this.id,\n name: this.artifactName,\n globPatterns: this.distGlobPatterns,\n },\n ];\n }\n\n /**\n * given a source file, return its parallel in the dists. e.g. index.ts => dist/index.js\n */\n getDistPathBySrcPath(srcPath: string) {\n const fileWithJSExtIfNeeded = this.replaceFileExtToJs(srcPath);\n return path.join(this.distDir, fileWithJSExtIfNeeded);\n }\n\n /**\n * whether babel is able to compile the given path\n */\n isFileSupported(filePath: string): boolean {\n if (this.supportedFilesGlobPatterns) {\n return isFileSupported(filePath) && !!multimatch(filePath, this.supportedFilesGlobPatterns).length;\n }\n return isFileSupported(filePath);\n }\n\n displayConfig() {\n return JSON.stringify(this.options.babelTransformOptions || {}, null, 2);\n }\n\n private replaceFileExtToJs(filePath: string): string {\n if (!this.isFileSupported(filePath)) return filePath;\n return replaceFileExtToJs(filePath);\n }\n}\n"],"mappings":";;;;;;AAAA,SAAAA,MAAA;EAAA,MAAAC,IAAA,GAAAC,uBAAA,CAAAC,OAAA;EAAAH,KAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,YAAA;EAAA,MAAAH,IAAA,GAAAI,sBAAA,CAAAF,OAAA;EAAAC,WAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,QAAA;EAAA,MAAAL,IAAA,GAAAE,OAAA;EAAAG,OAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAM,YAAA;EAAA,MAAAN,IAAA,GAAAI,sBAAA,CAAAF,OAAA;EAAAI,WAAA,YAAAA,CAAA;IAAA,OAAAN,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAO,SAAA;EAAA,MAAAP,IAAA,GAAAI,sBAAA,CAAAF,OAAA;EAAAK,QAAA,YAAAA,CAAA;IAAA,OAAAP,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAKA,SAAAQ,MAAA;EAAA,MAAAR,IAAA,GAAAI,sBAAA,CAAAF,OAAA;EAAAM,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AC,EAAE,IAAI,EAAE,CAAC,CAAC;EAC1E;EAEQiD,kBAAkBA,CAACrD,QAAgB,EAAU;IACnD,IAAI,CAAC,IAAI,CAAC4C,eAAe,CAAC5C,QAAQ,CAAC,EAAE,OAAOA,QAAQ;IACpD,OAAO,IAAAqD,wCAAkB,EAACrD,QAAQ,CAAC;EACrC;AACF;AAACoE,OAAA,CAAAzF,aAAA,GAAAA,aAAA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
export declare const Logo: () =>
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const Logo: () => JSX.Element;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { TransformOptions } from '@babel/core';
|
|
2
2
|
import { CompilerOptions } from '@teambit/compiler';
|
|
3
|
-
export
|
|
3
|
+
export type BabelCompilerOptions = {
|
|
4
4
|
/**
|
|
5
5
|
* TransformOptions of Babel. @see https://babeljs.io/docs/en/options
|
|
6
6
|
*
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.compilation_babel@1.0.
|
|
2
|
-
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.compilation_babel@1.0.
|
|
1
|
+
import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.compilation_babel@1.0.108/dist/babel.composition.js';
|
|
2
|
+
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.compilation_babel@1.0.108/dist/babel.docs.mdx';
|
|
3
3
|
|
|
4
4
|
export const compositions = [compositions_0];
|
|
5
5
|
export const overview = [overview_0];
|
package/index.ts
ADDED
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teambit/babel",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.108",
|
|
4
4
|
"homepage": "https://bit.cloud/teambit/compilation/babel",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"componentId": {
|
|
7
7
|
"scope": "teambit.compilation",
|
|
8
8
|
"name": "babel",
|
|
9
|
-
"version": "1.0.
|
|
9
|
+
"version": "1.0.108"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@babel/core": "7.19.6",
|
|
@@ -14,31 +14,27 @@
|
|
|
14
14
|
"lodash": "4.17.21",
|
|
15
15
|
"multimatch": "5.0.0",
|
|
16
16
|
"p-map-series": "2.1.0",
|
|
17
|
-
"core-js": "^3.0.0",
|
|
18
|
-
"@babel/runtime": "7.20.0",
|
|
19
17
|
"@teambit/harmony": "0.4.6",
|
|
20
|
-
"@teambit/builder": "1.0.
|
|
18
|
+
"@teambit/builder": "1.0.108",
|
|
21
19
|
"@teambit/compilation.modules.babel-compiler": "0.0.137",
|
|
22
|
-
"@teambit/compiler": "1.0.
|
|
23
|
-
"@teambit/isolator": "1.0.
|
|
24
|
-
"@teambit/logger": "0.0.
|
|
25
|
-
"@teambit/cli": "0.0.
|
|
20
|
+
"@teambit/compiler": "1.0.108",
|
|
21
|
+
"@teambit/isolator": "1.0.108",
|
|
22
|
+
"@teambit/logger": "0.0.933",
|
|
23
|
+
"@teambit/cli": "0.0.840"
|
|
26
24
|
},
|
|
27
25
|
"devDependencies": {
|
|
28
26
|
"@types/fs-extra": "9.0.7",
|
|
29
27
|
"@types/lodash": "4.14.165",
|
|
30
|
-
"@types/react": "^17.0.8",
|
|
31
28
|
"@types/mocha": "9.1.0",
|
|
32
|
-
"@types/
|
|
33
|
-
"@types/
|
|
34
|
-
"@
|
|
35
|
-
"@types/testing-library__jest-dom": "5.9.5",
|
|
29
|
+
"@types/jest": "^29.2.2",
|
|
30
|
+
"@types/testing-library__jest-dom": "^5.9.5",
|
|
31
|
+
"@teambit/harmony.envs.core-aspect-env": "0.0.13",
|
|
36
32
|
"@teambit/compilation.aspect-docs.babel": "0.0.166"
|
|
37
33
|
},
|
|
38
34
|
"peerDependencies": {
|
|
39
|
-
"
|
|
40
|
-
"react": "^
|
|
41
|
-
"
|
|
35
|
+
"react": "^17.0.0 || ^18.0.0",
|
|
36
|
+
"@types/react": "^18.2.12",
|
|
37
|
+
"@teambit/legacy": "1.0.624"
|
|
42
38
|
},
|
|
43
39
|
"license": "Apache-2.0",
|
|
44
40
|
"optionalDependencies": {},
|
|
@@ -52,7 +48,7 @@
|
|
|
52
48
|
},
|
|
53
49
|
"private": false,
|
|
54
50
|
"engines": {
|
|
55
|
-
"node": ">=
|
|
51
|
+
"node": ">=16.0.0"
|
|
56
52
|
},
|
|
57
53
|
"repository": {
|
|
58
54
|
"type": "git",
|
|
@@ -61,12 +57,9 @@
|
|
|
61
57
|
"keywords": [
|
|
62
58
|
"bit",
|
|
63
59
|
"bit-aspect",
|
|
60
|
+
"bit-core-aspect",
|
|
64
61
|
"components",
|
|
65
62
|
"collaboration",
|
|
66
|
-
"web"
|
|
67
|
-
"react",
|
|
68
|
-
"react-components",
|
|
69
|
-
"angular",
|
|
70
|
-
"angular-components"
|
|
63
|
+
"web"
|
|
71
64
|
]
|
|
72
65
|
}
|
package/tsconfig.json
CHANGED
|
@@ -1,38 +1,33 @@
|
|
|
1
1
|
{
|
|
2
2
|
"compilerOptions": {
|
|
3
3
|
"lib": [
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
"DOM.Iterable",
|
|
8
|
-
"ScriptHost"
|
|
4
|
+
"esnext",
|
|
5
|
+
"dom",
|
|
6
|
+
"dom.Iterable"
|
|
9
7
|
],
|
|
10
|
-
"target": "
|
|
11
|
-
"module": "
|
|
12
|
-
"jsx": "react",
|
|
13
|
-
"allowJs": true,
|
|
14
|
-
"composite": true,
|
|
8
|
+
"target": "es2020",
|
|
9
|
+
"module": "es2020",
|
|
10
|
+
"jsx": "react-jsx",
|
|
15
11
|
"declaration": true,
|
|
16
12
|
"sourceMap": true,
|
|
17
|
-
"skipLibCheck": true,
|
|
18
13
|
"experimentalDecorators": true,
|
|
19
|
-
"
|
|
14
|
+
"skipLibCheck": true,
|
|
20
15
|
"moduleResolution": "node",
|
|
21
16
|
"esModuleInterop": true,
|
|
22
|
-
"rootDir": ".",
|
|
23
17
|
"resolveJsonModule": true,
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"strictPropertyInitialization": false,
|
|
28
|
-
"strict": true,
|
|
29
|
-
"noImplicitAny": false,
|
|
30
|
-
"preserveConstEnums": true
|
|
18
|
+
"allowJs": true,
|
|
19
|
+
"outDir": "dist",
|
|
20
|
+
"emitDeclarationOnly": true
|
|
31
21
|
},
|
|
32
22
|
"exclude": [
|
|
23
|
+
"artifacts",
|
|
24
|
+
"public",
|
|
33
25
|
"dist",
|
|
26
|
+
"node_modules",
|
|
27
|
+
"package.json",
|
|
34
28
|
"esm.mjs",
|
|
35
|
-
"
|
|
29
|
+
"**/*.cjs",
|
|
30
|
+
"./dist"
|
|
36
31
|
],
|
|
37
32
|
"include": [
|
|
38
33
|
"**/*",
|
package/types/asset.d.ts
CHANGED
|
@@ -5,12 +5,12 @@ declare module '*.png' {
|
|
|
5
5
|
declare module '*.svg' {
|
|
6
6
|
import type { FunctionComponent, SVGProps } from 'react';
|
|
7
7
|
|
|
8
|
-
export const ReactComponent: FunctionComponent<
|
|
8
|
+
export const ReactComponent: FunctionComponent<
|
|
9
|
+
SVGProps<SVGSVGElement> & { title?: string }
|
|
10
|
+
>;
|
|
9
11
|
const src: string;
|
|
10
12
|
export default src;
|
|
11
13
|
}
|
|
12
|
-
|
|
13
|
-
// @TODO Gilad
|
|
14
14
|
declare module '*.jpg' {
|
|
15
15
|
const value: any;
|
|
16
16
|
export = value;
|
|
@@ -27,3 +27,15 @@ declare module '*.bmp' {
|
|
|
27
27
|
const value: any;
|
|
28
28
|
export = value;
|
|
29
29
|
}
|
|
30
|
+
declare module '*.otf' {
|
|
31
|
+
const value: any;
|
|
32
|
+
export = value;
|
|
33
|
+
}
|
|
34
|
+
declare module '*.woff' {
|
|
35
|
+
const value: any;
|
|
36
|
+
export = value;
|
|
37
|
+
}
|
|
38
|
+
declare module '*.woff2' {
|
|
39
|
+
const value: any;
|
|
40
|
+
export = value;
|
|
41
|
+
}
|