@teambit/babel 1.0.107 → 1.0.109
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/artifacts/preview/teambit_compilation_babel-preview.js +1 -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-1703590665075.js → preview-1703698405864.js} +2 -2
- package/package.json +16 -23
- package/tsconfig.json +16 -21
- package/types/asset.d.ts +15 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["teambit.compilation/babel-preview"]=t():e["teambit.compilation/babel-preview"]=t()}(self,(()=>(()=>{"use strict";var e={17856:(e,t,o)=>{var n={id:"teambit.compilation/babel@1.0.109",homepage:"https://bit.cloud/teambit/compilation/babel",exported:!0};function r(){const e=i(o(87363));return r=function(){return e},e}function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.Logo=void 0,r.__bit_component=n,i.__bit_component=n;const a=()=>r().default.createElement("div",{style:{height:"100%",display:"flex",justifyContent:"center"}},r().default.createElement("img",{style:{width:70},src:"https://static.bit.dev/extensions-icons/babel.svg"}));a.__bit_component=n,t.Logo=a},76694:(e,t,o)=>{var n={id:"teambit.compilation/aspect-docs/babel@0.0.166",homepage:"https://bit.cloud/teambit/compilation/aspect-docs/babel",exported:!0};Object.defineProperty(t,"__esModule",{value:!0}),t.default=b,a(o(87363));var r=o(40040),i=["components"];function a(e){return e&&e.__esModule?e:{default:e}}function p(){return p=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var o=arguments[t];for(var n in o)Object.prototype.hasOwnProperty.call(o,n)&&(e[n]=o[n])}return e},p.apply(this,arguments)}function l(e,t){if(null==e)return{};var o,n,r=s(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)o=i[n],t.indexOf(o)>=0||Object.prototype.propertyIsEnumerable.call(e,o)&&(r[o]=e[o])}return r}function s(e,t){if(null==e)return{};var o,n,r={},i=Object.keys(e);for(n=0;n<i.length;n++)o=i[n],t.indexOf(o)>=0||(r[o]=e[o]);return r}a.__bit_component=n,p.__bit_component=n,l.__bit_component=n,s.__bit_component=n;var c={},m="wrapper";function b(e){var t=e.components,o=l(e,i);return(0,r.mdx)(m,p({},c,o,{components:t,mdxType:"MDXLayout"}),(0,r.mdx)("p",null,"This compiler utilizes the programmatic API of Babel to transpile files. See the compiler-options.ts for more data how to pass Babel options to the compiler."),(0,r.mdx)("p",null,"Note that to isolate the components from different Babel config files on the machine, the following two props are set to false (if they weren't passed in the options): ",(0,r.mdx)("inlineCode",{parentName:"p"},"configFile")," and ",(0,r.mdx)("inlineCode",{parentName:"p"},"babelrc"),"."),(0,r.mdx)("h2",null,"FAQ"),(0,r.mdx)("p",null,(0,r.mdx)("em",{parentName:"p"},"Q"),": I'm getting an error about missing plugins."),(0,r.mdx)("p",null,(0,r.mdx)("em",{parentName:"p"},"A"),": make sure that workspace.jsonc has the plugins and that you ran ",(0,r.mdx)("inlineCode",{parentName:"p"},"bit install"),".\nExample of the workspace.jsonc settings:"),(0,r.mdx)("pre",null,(0,r.mdx)("code",{parentName:"pre"},'"my-babel-env": {\n "teambit.bit/aspect": {},\n "teambit.bit/dependency-resolver": {\n "policy": {\n "dependencies": {\n "@babel/core": "7.11.6",\n "@babel/preset-react": "7.22.15",\n "@babel/preset-env": "7.22.15",\n "@babel/preset-typescript": "7.22.15",\n "@babel/plugin-transform-class-properties": "7.22.5"\n }\n }\n }\n },\n')),(0,r.mdx)("ol",{start:2},(0,r.mdx)("li",{parentName:"ol"},"You're not using the plugin.\nThe reason for the error is that Babel searches for config files in different directories. To disable this, add the following to the config you pass to the compiler:")),(0,r.mdx)("pre",null,(0,r.mdx)("code",{parentName:"pre"},'{\n ...\n "babelrc": false,\n "configFile": false,\n}\n')),(0,r.mdx)("p",null,"this takes care of both .babelrc and babel.config.json."))}b.__bit_component=n,b.isMDXComponent=!0},53802:(e,t,o)=>{Object.defineProperty(t,"C",{enumerable:!0,get:function(){return n.default}});var n=r(o(76694));function r(e){return e&&e.__esModule?e:{default:e}}r.__bit_component={id:"teambit.compilation/aspect-docs/babel@0.0.166",homepage:"https://bit.cloud/teambit/compilation/aspect-docs/babel",exported:!0}},40040:e=>{e.exports=MdxJsReact},87363:e=>{e.exports=React}},t={};function o(n){var r=t[n];if(void 0!==r)return r.exports;var i=t[n]={exports:{}};return e[n](i,i.exports,o),i.exports}o.d=(e,t)=>{for(var n in t)o.o(t,n)&&!o.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};return(()=>{o.r(n),o.d(n,{compositions:()=>b,compositions_metadata:()=>u,overview:()=>d});var e={};o.r(e),o.d(e,{default:()=>m});var t=o(17856),r=(o(87363),o(40040));const i=TeambitMdxUiMdxScopeContext;var a=o(53802),p=["components"];function l(){return l=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var o=arguments[t];for(var n in o)Object.prototype.hasOwnProperty.call(o,n)&&(e[n]=o[n])}return e},l.apply(this,arguments)}var s={},c="wrapper";function m(e){var t=e.components,o=function(e,t){if(null==e)return{};var o,n,r=function(e,t){if(null==e)return{};var o,n,r={},i=Object.keys(e);for(n=0;n<i.length;n++)o=i[n],t.indexOf(o)>=0||(r[o]=e[o]);return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)o=i[n],t.indexOf(o)>=0||Object.prototype.propertyIsEnumerable.call(e,o)&&(r[o]=e[o])}return r}(e,p);return(0,r.mdx)(c,l({},s,o,{components:t,mdxType:"MDXLayout"}),(0,r.mdx)(i.MDXScopeProvider,{components:{Babel:a.C},mdxType:"MDXScopeProvider"},(0,r.mdx)(a.C,{mdxType:"Babel"})))}m.isMDXComponent=!0;const b=[t],d=[e],u={compositions:[{displayName:"Logo",identifier:"Logo"}]}})(),n})()));
|
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,I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X,kBAAkB,CAACU,OAAO,CAAC;IAC9D,OAAOjE,eAAI,CAAC2C,IAAI,CAAC,IAAI,CAACvD,OAAO,EAAE8E,qBAAqB,CAAC;EACvD;;EAEA;AACF;AACA;EACEpB,eAAeA,CAAC5C,QAAgB,EAAW;IACzC,IAAI,IAAI,CAACV,0BAA0B,EAAE;MACnC,OAAO,IAAAsD,qCAAe,EAAC5C,QAAQ,CAAC,IAAI,CAAC,CAAC,IAAAiE,qBAAU,EAACjE,QAAQ,EAAE,IAAI,CAACV,0BAA0B,CAAC,CAAC3B,MAAM;IACpG;IACA,OAAO,IAAAiF,qCAAe,EAAC5C,QAAQ,CAAC;EAClC;EAEAkE,aAAaA,CAAA,EAAG;IACd,OAAOC,IAAI,CAACC,SAAS,CAAC,IAAI,CAACpF,OAAO,CAACoB,qBAAqB,IAAI,CAAC,CAAC,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;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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E,IAAI,CAACzE;IACrB,CAAC,CACF;EACH;;EAEA;AACF;AACA;EACE0E,oBAAoBA,CAACC,OAAe,EAAE;IACpC,MAAMC,qBAAqB,GAAG,IAAI,CAACV,kBAAkB,CAACS,OAAO,CAAC;IAC9D,OAAOhE,eAAI,CAAC2C,IAAI,CAAC,IAAI,CAACvD,OAAO,EAAE6E,qBAAqB,CAAC;EACvD;;EAEA;AACF;AACA;EACEnB,eAAeA,CAAC5C,QAAgB,EAAW;IACzC,IAAI,IAAI,CAACV,0BAA0B,EAAE;MACnC,OAAO,IAAAsD,qCAAe,EAAC5C,QAAQ,CAAC,IAAI,CAAC,CAAC,IAAAgE,qBAAU,EAAChE,QAAQ,EAAE,IAAI,CAACV,0BAA0B,CAAC,CAAC3B,MAAM;IACpG;IACA,OAAO,IAAAiF,qCAAe,EAAC5C,QAAQ,CAAC;EAClC;EAEAiE,aAAaA,CAAA,EAAG;IACd,OAAOC,IAAI,CAACC,SAAS,CAAC,IAAI,CAACnF,OAAO,CAACoB,qBAAqB,IAAI,CAAC,CAAC,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.109/dist/babel.composition.js';
|
|
2
|
+
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.compilation_babel@1.0.109/dist/babel.docs.mdx';
|
|
3
3
|
|
|
4
4
|
export const compositions = [compositions_0];
|
|
5
5
|
export const overview = [overview_0];
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teambit/babel",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.109",
|
|
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.109"
|
|
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.109",
|
|
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.109",
|
|
21
|
+
"@teambit/isolator": "1.0.109",
|
|
22
|
+
"@teambit/logger": "0.0.934",
|
|
23
|
+
"@teambit/cli": "0.0.841"
|
|
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.14",
|
|
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
|
+
}
|