@teambit/compiler 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_compiler-preview.js +1 -0
- package/dist/compiler.cmd.d.ts +1 -1
- package/dist/compiler.composition.d.ts +2 -2
- package/dist/compiler.main.runtime.js +2 -4
- package/dist/compiler.main.runtime.js.map +1 -1
- package/dist/compiler.service.d.ts +5 -5
- package/dist/compiler.service.js +4 -4
- package/dist/compiler.service.js.map +1 -1
- package/dist/compiler.task.d.ts +1 -1
- package/dist/dist-artifact.d.ts +1 -1
- package/dist/output-formatter.js +1 -2
- package/dist/output-formatter.js.map +1 -1
- package/dist/{preview-1703590665075.js → preview-1703698405864.js} +2 -2
- package/dist/types.d.ts +4 -4
- package/dist/workspace-compiler.d.ts +5 -5
- package/dist/workspace-compiler.js +8 -13
- package/dist/workspace-compiler.js.map +1 -1
- package/package.json +29 -36
- package/tsconfig.json +16 -21
- package/types/asset.d.ts +15 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
!function(e,n){"object"==typeof exports&&"object"==typeof module?module.exports=n():"function"==typeof define&&define.amd?define([],n):"object"==typeof exports?exports["teambit.compilation/compiler-preview"]=n():e["teambit.compilation/compiler-preview"]=n()}(self,(()=>(()=>{"use strict";var e={9135:(e,n,t)=>{var o={id:"teambit.compilation/compiler@1.0.109",homepage:"https://bit.cloud/teambit/compilation/compiler",exported:!0};function i(){const e=r(t(87363));return i=function(){return e},e}function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(n,"__esModule",{value:!0}),n.Logo=void 0,i.__bit_component=o,r.__bit_component=o;const a=()=>i().default.createElement("div",{style:{height:"100%",display:"flex",justifyContent:"center"}},i().default.createElement("img",{style:{width:70},src:"https://static.bit.dev/extensions-icons/compiler.svg"}));a.__bit_component=o,n.Logo=a},13826:(e,n,t)=>{var o={id:"teambit.compilation/content/compiler-overview@1.95.0",homepage:"https://bit.dev/teambit/compilation/content/compiler-overview",exported:!0};Object.defineProperty(n,"__esModule",{value:!0}),n.default=u,p(t(87363));var i=t(40040),r=t(70500),a=["components"];function p(e){return e&&e.__esModule?e:{default:e}}function m(){return m=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}return e},m.apply(this,arguments)}function l(e,n){if(null==e)return{};var t,o,i=d(e,n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(o=0;o<r.length;o++)t=r[o],n.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(i[t]=e[t])}return i}function d(e,n){if(null==e)return{};var t,o,i={},r=Object.keys(e);for(o=0;o<r.length;o++)t=r[o],n.indexOf(t)>=0||(i[t]=e[t]);return i}p.__bit_component=o,m.__bit_component=o,l.__bit_component=o,d.__bit_component=o;var c={},s="wrapper";function u(e){var n=e.components,t=l(e,a);return(0,i.mdx)(s,m({},c,t,{components:n,mdxType:"MDXLayout"}),(0,i.mdx)(r.MDXScopeProvider,{components:{},mdxType:"MDXScopeProvider"},(0,i.mdx)("h1",null,"Compiler overview"),(0,i.mdx)("p",null,"The Compiler aspect provides a single interface for Component compilation, ",(0,i.mdx)("a",{parentName:"p",href:"/"},"during development")," and ",(0,i.mdx)("a",{parentName:"p",href:"/"},"during build"),".\nIt enables you to use the same commands and APIs to compile any Component, regardless of the specific compiler it uses."),(0,i.mdx)("div",{className:"admonition admonition-info alert alert--info"},(0,i.mdx)("div",{parentName:"div",className:"admonition-heading"},(0,i.mdx)("h5",{parentName:"div"},(0,i.mdx)("span",{parentName:"h5",className:"admonition-icon"},(0,i.mdx)("svg",{parentName:"span",xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"},(0,i.mdx)("path",{parentName:"svg",fillRule:"evenodd",d:"M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"}))),"info")),(0,i.mdx)("div",{parentName:"div",className:"admonition-content"},(0,i.mdx)("p",{parentName:"div"},"The specific compiler used by a Component (",(0,i.mdx)("a",{parentName:"p",href:"/"},"Babel"),", ",(0,i.mdx)("a",{parentName:"p",href:"/"},"TypeScript"),", and so on) is set by the Component's Env."))),(0,i.mdx)("h2",null,"Compiling during development"),(0,i.mdx)("p",null,"Run the following to compile all your Workspace Components:"),(0,i.mdx)("pre",null,(0,i.mdx)("code",{parentName:"pre",className:"language-bash"},"bit compile\n")),(0,i.mdx)("p",null,"The following output lists the compilation results in a single format:"),(0,i.mdx)("pre",null,(0,i.mdx)("code",{parentName:"pre",className:"language-bash"}," STATUS COMPONENT ID\n✔ SUCCESS apps/bit-dev\n✔ SUCCESS blocks/component/architecture-breakdown\n✔ SUCCESS blocks/footer\n✔ SUCCESS blocks/header\n✔ SUCCESS buttons/button\n✔ SUCCESS content/adding-components\n")),(0,i.mdx)("p",null,"To 'watch' Components for changes, and to auto-compile modified Components, run:"),(0,i.mdx)("pre",null,(0,i.mdx)("code",{parentName:"pre"},"bit watch\n")),(0,i.mdx)("p",null,"The compiled code is written into each Component's corresponding package, in the ",(0,i.mdx)("a",{parentName:"p",href:"/dependencies/node-modules"},(0,i.mdx)("inlineCode",{parentName:"a"},"node_modules")," directory")," of your workspace.\nFor example, the compiled code for ",(0,i.mdx)("inlineCode",{parentName:"p"},"company.scope/ui/text")," will be found in the ",(0,i.mdx)("inlineCode",{parentName:"p"},"./node_modules/@company/scope.ui.text/dist")," directory (inside your workspace)."),(0,i.mdx)("p",null,"To learn more about compilation in the Workspace, see ",(0,i.mdx)("a",{parentName:"p",href:"/"},"'Compiling during development'"),"."),(0,i.mdx)("h2",null,"Compiling during build"),(0,i.mdx)("p",null,"Run the following to compile Components as part of the ",(0,i.mdx)("a",{parentName:"p",href:"/"},"build pipeline")," (which prepares Components for distribution):"),(0,i.mdx)("pre",null,(0,i.mdx)("code",{parentName:"pre",className:"language-bash"},"bit build\n")),(0,i.mdx)("p",null,"The output to the terminal details the specific compilers being used, as well as the Envs that use them:"),(0,i.mdx)("pre",null,(0,i.mdx)("code",{parentName:"pre",className:"language-bash"},'...\n✔ env "teambit.harmony/aspect", task "teambit.compilation/compiler:BabelCompiler (compile components for artifact dist)" has completed successfully in 363ms\n✔ env "teambit.react/react", task "teambit.compilation/compiler:TSCompiler (compile components for artifact dist)" has completed successfully in 1s\n✔ env "teambit.mdx/mdx", task "teambit.compilation/compiler:MDXCompiler (compile components)" has completed successfully in 879ms\n...\nthe build has been completed. total: 19 tasks\n')),(0,i.mdx)("p",null,"The compiled code is written into the ",(0,i.mdx)("a",{parentName:"p",href:"/"},"Component's Capsule"),". Run ",(0,i.mdx)("a",{parentName:"p",href:"/"},(0,i.mdx)("inlineCode",{parentName:"a"},"bit snap"))," or ",(0,i.mdx)("a",{parentName:"p",href:"/"},(0,i.mdx)("inlineCode",{parentName:"a"},"bit tag"))," to execute the build pipeline (as well as other pipelines), and have the compiled code persisted in the ",(0,i.mdx)("a",{parentName:"p",href:"/"},"Component version"),", and included in the ",(0,i.mdx)("a",{parentName:"p",href:"/"},"Component's package"),"."),(0,i.mdx)("p",null,"To learn more about compilation in the Workspace, see ",(0,i.mdx)("a",{parentName:"p",href:"/"},"'Compiling during build'"),"."),(0,i.mdx)("h2",null,"Compilation strategies and standards"),(0,i.mdx)("p",null,"The Compiler aspect does not set specific compilation strategies as these are defined by the ",(0,i.mdx)("a",{parentName:"p",href:"/"},"specific compilers")," themselves (and are often configurable by the Envs that use them)."),(0,i.mdx)("p",null,"However, all official Bit compilers are configured to favor dev experience when compiling during development, and to favor runtime performance and code universality, when compiling for distribution (during build)."),(0,i.mdx)("p",null,"For example, Bit's ",(0,i.mdx)("a",{parentName:"p",href:"/"},"TypeScript compiler")," performs type-checking when compiling during build but skips it when compiling during development.\nThis enables faster compilation and better dev experience."),(0,i.mdx)("p",null,"To examine a Component's specific compiler config, run the following:"),(0,i.mdx)("pre",null,(0,i.mdx)("code",{parentName:"pre"},"bit env get COMPONENT_ID\n")),(0,i.mdx)("p",null,"For example:"),(0,i.mdx)("pre",null,(0,i.mdx)("code",{parentName:"pre"},"bit env get company.demo/ui/card\n")),(0,i.mdx)("p",null,"The output details the Component's env config which includes the compiler config:"),(0,i.mdx)("pre",null,(0,i.mdx)("code",{parentName:"pre",className:"language-bash"},'Environment: teambit.react/react\n...\nteambit.compilation/compiler\n\nconfigured compiler: teambit.typescript/typescript (TypeScript @ 4.4.2)\ncompiler config:\n{\n "compilerOptions": {\n "lib": [\n "es2019",\n "DOM",\n "ES6",\n "DOM.Iterable"\n ],\n "target": "es2015",\n "module": "commonjs",\n "jsx": "react",\n "declaration": true,\n "sourceMap": true,\n "skipLibCheck": true,\n "moduleResolution": "node",\n "esModuleInterop": true,\n "resolveJsonModule": true,\n "outDir": "dist"\n },\n "exclude": [\n "dist"\n ]\n}\n\n')),(0,i.mdx)("h2",null,"Setting a Component with a specific compiler"),(0,i.mdx)("p",null,"Specific compilers are applied on Components via the Components' Envs. For example, the ",(0,i.mdx)("inlineCode",{parentName:"p"},"company.demo/ui/card")," Component examined earlier, is applied with\nthe ",(0,i.mdx)("a",{parentName:"p",href:"/"},"TypeScript")," compiler by its Env, the React Env."),(0,i.mdx)("p",null,"To learn how to use a specific compiler, see ",(0,i.mdx)("a",{parentName:"p",href:"/"},"'Using compilers'"),".")))}u.__bit_component=o,u.isMDXComponent=!0},99636:(e,n,t)=>{Object.defineProperty(n,"ZP",{enumerable:!0,get:function(){return o.default}});var o=i(t(13826));function i(e){return e&&e.__esModule?e:{default:e}}i.__bit_component={id:"teambit.compilation/content/compiler-overview@1.95.0",homepage:"https://bit.dev/teambit/compilation/content/compiler-overview",exported:!0}},40040:e=>{e.exports=MdxJsReact},87363:e=>{e.exports=React},70500:e=>{e.exports=TeambitMdxUiMdxScopeContext}},n={};function t(o){var i=n[o];if(void 0!==i)return i.exports;var r=n[o]={exports:{}};return e[o](r,r.exports,t),r.exports}t.d=(e,n)=>{for(var o in n)t.o(n,o)&&!t.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:n[o]})},t.o=(e,n)=>Object.prototype.hasOwnProperty.call(e,n),t.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var o={};return(()=>{t.r(o),t.d(o,{compositions:()=>s,compositions_metadata:()=>f,overview:()=>u});var e={};t.r(e),t.d(e,{default:()=>c});var n=t(9135),i=(t(87363),t(40040)),r=t(70500),a=t(99636),p=["components"];function m(){return m=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}return e},m.apply(this,arguments)}var l={},d="wrapper";function c(e){var n=e.components,t=function(e,n){if(null==e)return{};var t,o,i=function(e,n){if(null==e)return{};var t,o,i={},r=Object.keys(e);for(o=0;o<r.length;o++)t=r[o],n.indexOf(t)>=0||(i[t]=e[t]);return i}(e,n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(o=0;o<r.length;o++)t=r[o],n.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(i[t]=e[t])}return i}(e,p);return(0,i.mdx)(d,m({},l,t,{components:n,mdxType:"MDXLayout"}),(0,i.mdx)(r.MDXScopeProvider,{components:{CompilerOverview:a.ZP},mdxType:"MDXScopeProvider"},(0,i.mdx)(a.ZP,{mdxType:"CompilerOverview"})))}c.isMDXComponent=!0;const s=[n],u=[e],f={compositions:[{displayName:"Logo",identifier:"Logo"}]}})(),o})()));
|
package/dist/compiler.cmd.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { Logger } from '@teambit/logger';
|
|
|
3
3
|
import type { PubsubMain } from '@teambit/pubsub';
|
|
4
4
|
import { Component } from '@teambit/component';
|
|
5
5
|
import { CompileError, WorkspaceCompiler, CompileOptions } from './workspace-compiler';
|
|
6
|
-
export
|
|
6
|
+
export type ComponentsStatus = {
|
|
7
7
|
buildResults: string[];
|
|
8
8
|
component: Component;
|
|
9
9
|
errors: CompileError[];
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
export declare const Logo: () =>
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const Logo: () => JSX.Element;
|
|
@@ -221,9 +221,8 @@ class CompilerMain {
|
|
|
221
221
|
* find the compiler configured on the workspace and ask for the dist path.
|
|
222
222
|
*/
|
|
223
223
|
getDistPathBySrcPath(component, srcPath) {
|
|
224
|
-
var _environment$getCompi;
|
|
225
224
|
const environment = this.envs.getEnv(component).env;
|
|
226
|
-
const compilerInstance =
|
|
225
|
+
const compilerInstance = environment.getCompiler?.();
|
|
227
226
|
if (!compilerInstance) return null;
|
|
228
227
|
return compilerInstance.getDistPathBySrcPath(srcPath);
|
|
229
228
|
}
|
|
@@ -232,9 +231,8 @@ class CompilerMain {
|
|
|
232
231
|
* find the compiler configured on the workspace and ask for the dist folder path.
|
|
233
232
|
*/
|
|
234
233
|
getRelativeDistFolder(component) {
|
|
235
|
-
var _environment$getCompi2;
|
|
236
234
|
const environment = this.envs.getOrCalculateEnv(component).env;
|
|
237
|
-
const compilerInstance =
|
|
235
|
+
const compilerInstance = environment.getCompiler?.();
|
|
238
236
|
if (!compilerInstance || !compilerInstance.getDistDir) return _constants().DEFAULT_DIST_DIRNAME;
|
|
239
237
|
return compilerInstance.getDistDir();
|
|
240
238
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["path","data","_interopRequireWildcard","require","_fsExtra","_interopRequireDefault","_aspectLoader","_builder","_cli","_componentIssues","_issues","_constants","_watcher","_envs","_dependencyResolver","_logger","_generator","_pubsub","_ui","_workspace","_compiler","_compiler2","_compiler3","_compiler4","_distArtifact","_exceptions","_types","_workspaceCompiler","_compiler5","obj","__esModule","default","_getRequireWildcardCache","e","WeakMap","r","t","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","_defineProperty","key","value","_toPropertyKey","enumerable","configurable","writable","_toPrimitive","String","Symbol","toPrimitive","TypeError","Number","CompilerMain","constructor","pubsub","workspaceCompiler","envs","builder","workspace","dependencyResolver","compilerService","getCompiler","context","compileOnWorkspace","componentsIds","options","initiator","CompilationInitiator","ComponentAdded","compileComponents","createTask","name","compiler","CompilerTask","CompilerAspect","id","getDistPathBySrcPath","component","srcPath","_environment$getCompi","environment","getEnv","env","compilerInstance","getRelativeDistFolder","_environment$getCompi2","getOrCalculateEnv","getDistDir","DEFAULT_DIST_DIRNAME","isDistDirExists","packageDir","getComponentPackagePath","distDir","pathToCheck","join","fs","existsSync","getDistsFiles","artifacts","getArtifactsVinylByAspect","length","DistArtifactNotFound","DistArtifact","addMissingDistsIssue","components","issuesToIgnore","includes","IssuesClasses","MissingDists","Promise","all","map","exist","state","issues","getOrCreate","provider","cli","loggerMain","aspectLoader","ui","generator","watcher","logger","createLogger","CompilerService","WorkspaceCompiler","registerService","compilerMain","register","CompileCmd","registerAddComponentsIssues","bind","registerComponentTemplate","compilerTemplate","exports","MainRuntime","CLIAspect","WorkspaceAspect","EnvsAspect","LoggerAspect","PubsubAspect","AspectLoaderAspect","BuilderAspect","UIAspect","GeneratorAspect","DependencyResolverAspect","WatcherAspect","IssuesAspect","addRuntime","_default"],"sources":["compiler.main.runtime.ts"],"sourcesContent":["import * as path from 'path';\nimport fs from 'fs-extra';\nimport AspectLoaderAspect, { AspectLoaderMain } from '@teambit/aspect-loader';\nimport { BuilderAspect, BuilderMain } from '@teambit/builder';\nimport { CLIAspect, CLIMain, MainRuntime } from '@teambit/cli';\nimport { IssuesClasses } from '@teambit/component-issues';\nimport IssuesAspect, { IssuesMain } from '@teambit/issues';\nimport { Component } from '@teambit/component';\nimport { DEFAULT_DIST_DIRNAME } from '@teambit/legacy/dist/constants';\nimport WatcherAspect, { WatcherMain } from '@teambit/watcher';\nimport { EnvsAspect, EnvsMain, ExecutionContext } from '@teambit/envs';\nimport { ComponentID } from '@teambit/component-id';\nimport { DependencyResolverAspect, DependencyResolverMain } from '@teambit/dependency-resolver';\nimport { LoggerAspect, LoggerMain } from '@teambit/logger';\nimport { GeneratorAspect, GeneratorMain } from '@teambit/generator';\nimport { PubsubAspect, PubsubMain } from '@teambit/pubsub';\nimport UIAspect, { UiMain } from '@teambit/ui';\nimport { Workspace, WorkspaceAspect } from '@teambit/workspace';\nimport { CompilerAspect } from './compiler.aspect';\nimport { CompileCmd } from './compiler.cmd';\nimport { CompilerService } from './compiler.service';\nimport { CompilerTask } from './compiler.task';\nimport { DistArtifact } from './dist-artifact';\nimport { DistArtifactNotFound } from './exceptions';\nimport { CompilationInitiator, Compiler } from './types';\nimport { CompileOptions, WorkspaceCompiler } from './workspace-compiler';\nimport { compilerTemplate } from './templates/compiler';\n\nexport class CompilerMain {\n constructor(\n private pubsub: PubsubMain,\n private workspaceCompiler: WorkspaceCompiler,\n private envs: EnvsMain,\n private builder: BuilderMain,\n private workspace: Workspace,\n private dependencyResolver: DependencyResolverMain,\n private compilerService: CompilerService\n ) {}\n\n getCompiler(context: ExecutionContext): Compiler {\n return this.compilerService.getCompiler(context);\n }\n\n /**\n * Run compilation on `bit new` and when new components are imported\n */\n compileOnWorkspace(\n componentsIds: string[] | ComponentID[] | ComponentID[] = [], // when empty, it compiles all\n options: CompileOptions = { initiator: CompilationInitiator.ComponentAdded }\n ) {\n return this.workspaceCompiler.compileComponents(componentsIds, options);\n }\n /**\n * API to create a new compiler task, it facilitates the usage of multiple compilers.\n * with this method you can create any number of compilers and add them to the buildPipeline.\n */\n createTask(name: string, compiler: Compiler): CompilerTask {\n return new CompilerTask(CompilerAspect.id, name, compiler, this.dependencyResolver);\n }\n\n /**\n * find the compiler configured on the workspace and ask for the dist path.\n */\n getDistPathBySrcPath(component: Component, srcPath: string): string | null {\n const environment = this.envs.getEnv(component).env;\n const compilerInstance = environment.getCompiler?.();\n if (!compilerInstance) return null;\n return compilerInstance.getDistPathBySrcPath(srcPath);\n }\n\n /**\n * find the compiler configured on the workspace and ask for the dist folder path.\n */\n getRelativeDistFolder(component: Component): string {\n const environment = this.envs.getOrCalculateEnv(component).env;\n const compilerInstance: Compiler | undefined = environment.getCompiler?.();\n if (!compilerInstance || !compilerInstance.getDistDir) return DEFAULT_DIST_DIRNAME;\n return compilerInstance.getDistDir();\n }\n\n /**\n * Check if the dist folder (in the component package under node_modules) exist\n * @param component\n * @returns\n */\n async isDistDirExists(component: Component): Promise<boolean> {\n const packageDir = await this.workspace.getComponentPackagePath(component);\n const distDir = this.getRelativeDistFolder(component);\n const pathToCheck = path.join(packageDir, distDir);\n return fs.existsSync(pathToCheck);\n }\n\n async getDistsFiles(component: Component): Promise<DistArtifact> {\n const artifacts = await this.builder.getArtifactsVinylByAspect(component, CompilerAspect.id);\n if (!artifacts.length) throw new DistArtifactNotFound(component.id);\n\n return new DistArtifact(artifacts);\n }\n\n async addMissingDistsIssue(components: Component[], issuesToIgnore: string[]): Promise<void> {\n if (issuesToIgnore.includes(IssuesClasses.MissingDists.name)) return;\n await Promise.all(\n components.map(async (component) => {\n const exist = await this.isDistDirExists(component);\n if (!exist) {\n component.state.issues.getOrCreate(IssuesClasses.MissingDists).data = true;\n }\n })\n );\n }\n\n static runtime = MainRuntime;\n\n static dependencies = [\n CLIAspect,\n WorkspaceAspect,\n EnvsAspect,\n LoggerAspect,\n PubsubAspect,\n AspectLoaderAspect,\n BuilderAspect,\n UIAspect,\n GeneratorAspect,\n DependencyResolverAspect,\n WatcherAspect,\n IssuesAspect,\n ];\n\n static async provider([\n cli,\n workspace,\n envs,\n loggerMain,\n pubsub,\n aspectLoader,\n builder,\n ui,\n generator,\n dependencyResolver,\n watcher,\n issues,\n ]: [\n CLIMain,\n Workspace,\n EnvsMain,\n LoggerMain,\n PubsubMain,\n AspectLoaderMain,\n BuilderMain,\n UiMain,\n GeneratorMain,\n DependencyResolverMain,\n WatcherMain,\n IssuesMain\n ]) {\n const logger = loggerMain.createLogger(CompilerAspect.id);\n const compilerService = new CompilerService();\n\n const workspaceCompiler = new WorkspaceCompiler(\n workspace,\n envs,\n pubsub,\n aspectLoader,\n ui,\n logger,\n dependencyResolver,\n watcher\n );\n envs.registerService(compilerService);\n const compilerMain = new CompilerMain(\n pubsub,\n workspaceCompiler,\n envs,\n builder,\n workspace,\n dependencyResolver,\n compilerService\n );\n cli.register(new CompileCmd(workspaceCompiler, logger, pubsub));\n if (issues) {\n issues.registerAddComponentsIssues(compilerMain.addMissingDistsIssue.bind(compilerMain));\n }\n if (generator) generator.registerComponentTemplate([compilerTemplate]);\n\n return compilerMain;\n }\n}\n\nCompilerAspect.addRuntime(CompilerMain);\n\nexport default CompilerMain;\n"],"mappings":";;;;;;AAAA,SAAAA,KAAA;EAAA,MAAAC,IAAA,GAAAC,uBAAA,CAAAC,OAAA;EAAAH,IAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,SAAA;EAAA,MAAAH,IAAA,GAAAI,sBAAA,CAAAF,OAAA;EAAAC,QAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,cAAA;EAAA,MAAAL,IAAA,GAAAI,sBAAA,CAAAF,OAAA;EAAAG,aAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAM,SAAA;EAAA,MAAAN,IAAA,GAAAE,OAAA;EAAAI,QAAA,YAAAA,CAAA;IAAA,OAAAN,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAO,KAAA;EAAA,MAAAP,IAAA,GAAAE,OAAA;EAAAK,IAAA,YAAAA,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A,YAAA;AAAAb,eAAA,CA9JYa,YAAY,aAmFNoF,kBAAW;AAAAjG,eAAA,CAnFjBa,YAAY,kBAqFD,CACpBqF,gBAAS,EACTC,4BAAe,EACfC,kBAAU,EACVC,sBAAY,EACZC,sBAAY,EACZC,uBAAkB,EAClBC,wBAAa,EACbC,aAAQ,EACRC,4BAAe,EACfC,8CAAwB,EACxBC,kBAAa,EACbC,iBAAY,CACb;AA8DH1E,0BAAc,CAAC2E,UAAU,CAACjG,YAAY,CAAC;AAAC,IAAAkG,QAAA,GAAAf,OAAA,CAAApH,OAAA,GAEzBiC,YAAY"}
|
|
1
|
+
{"version":3,"names":["path","data","_interopRequireWildcard","require","_fsExtra","_interopRequireDefault","_aspectLoader","_builder","_cli","_componentIssues","_issues","_constants","_watcher","_envs","_dependencyResolver","_logger","_generator","_pubsub","_ui","_workspace","_compiler","_compiler2","_compiler3","_compiler4","_distArtifact","_exceptions","_types","_workspaceCompiler","_compiler5","obj","__esModule","default","_getRequireWildcardCache","e","WeakMap","r","t","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","_defineProperty","key","value","_toPropertyKey","enumerable","configurable","writable","_toPrimitive","String","Symbol","toPrimitive","TypeError","Number","CompilerMain","constructor","pubsub","workspaceCompiler","envs","builder","workspace","dependencyResolver","compilerService","getCompiler","context","compileOnWorkspace","componentsIds","options","initiator","CompilationInitiator","ComponentAdded","compileComponents","createTask","name","compiler","CompilerTask","CompilerAspect","id","getDistPathBySrcPath","component","srcPath","environment","getEnv","env","compilerInstance","getRelativeDistFolder","getOrCalculateEnv","getDistDir","DEFAULT_DIST_DIRNAME","isDistDirExists","packageDir","getComponentPackagePath","distDir","pathToCheck","join","fs","existsSync","getDistsFiles","artifacts","getArtifactsVinylByAspect","length","DistArtifactNotFound","DistArtifact","addMissingDistsIssue","components","issuesToIgnore","includes","IssuesClasses","MissingDists","Promise","all","map","exist","state","issues","getOrCreate","provider","cli","loggerMain","aspectLoader","ui","generator","watcher","logger","createLogger","CompilerService","WorkspaceCompiler","registerService","compilerMain","register","CompileCmd","registerAddComponentsIssues","bind","registerComponentTemplate","compilerTemplate","exports","MainRuntime","CLIAspect","WorkspaceAspect","EnvsAspect","LoggerAspect","PubsubAspect","AspectLoaderAspect","BuilderAspect","UIAspect","GeneratorAspect","DependencyResolverAspect","WatcherAspect","IssuesAspect","addRuntime","_default"],"sources":["compiler.main.runtime.ts"],"sourcesContent":["import * as path from 'path';\nimport fs from 'fs-extra';\nimport AspectLoaderAspect, { AspectLoaderMain } from '@teambit/aspect-loader';\nimport { BuilderAspect, BuilderMain } from '@teambit/builder';\nimport { CLIAspect, CLIMain, MainRuntime } from '@teambit/cli';\nimport { IssuesClasses } from '@teambit/component-issues';\nimport IssuesAspect, { IssuesMain } from '@teambit/issues';\nimport { Component } from '@teambit/component';\nimport { DEFAULT_DIST_DIRNAME } from '@teambit/legacy/dist/constants';\nimport WatcherAspect, { WatcherMain } from '@teambit/watcher';\nimport { EnvsAspect, EnvsMain, ExecutionContext } from '@teambit/envs';\nimport { ComponentID } from '@teambit/component-id';\nimport { DependencyResolverAspect, DependencyResolverMain } from '@teambit/dependency-resolver';\nimport { LoggerAspect, LoggerMain } from '@teambit/logger';\nimport { GeneratorAspect, GeneratorMain } from '@teambit/generator';\nimport { PubsubAspect, PubsubMain } from '@teambit/pubsub';\nimport UIAspect, { UiMain } from '@teambit/ui';\nimport { Workspace, WorkspaceAspect } from '@teambit/workspace';\nimport { CompilerAspect } from './compiler.aspect';\nimport { CompileCmd } from './compiler.cmd';\nimport { CompilerService } from './compiler.service';\nimport { CompilerTask } from './compiler.task';\nimport { DistArtifact } from './dist-artifact';\nimport { DistArtifactNotFound } from './exceptions';\nimport { CompilationInitiator, Compiler } from './types';\nimport { CompileOptions, WorkspaceCompiler } from './workspace-compiler';\nimport { compilerTemplate } from './templates/compiler';\n\nexport class CompilerMain {\n constructor(\n private pubsub: PubsubMain,\n private workspaceCompiler: WorkspaceCompiler,\n private envs: EnvsMain,\n private builder: BuilderMain,\n private workspace: Workspace,\n private dependencyResolver: DependencyResolverMain,\n private compilerService: CompilerService\n ) {}\n\n getCompiler(context: ExecutionContext): Compiler {\n return this.compilerService.getCompiler(context);\n }\n\n /**\n * Run compilation on `bit new` and when new components are imported\n */\n compileOnWorkspace(\n componentsIds: string[] | ComponentID[] | ComponentID[] = [], // when empty, it compiles all\n options: CompileOptions = { initiator: CompilationInitiator.ComponentAdded }\n ) {\n return this.workspaceCompiler.compileComponents(componentsIds, options);\n }\n /**\n * API to create a new compiler task, it facilitates the usage of multiple compilers.\n * with this method you can create any number of compilers and add them to the buildPipeline.\n */\n createTask(name: string, compiler: Compiler): CompilerTask {\n return new CompilerTask(CompilerAspect.id, name, compiler, this.dependencyResolver);\n }\n\n /**\n * find the compiler configured on the workspace and ask for the dist path.\n */\n getDistPathBySrcPath(component: Component, srcPath: string): string | null {\n const environment = this.envs.getEnv(component).env;\n const compilerInstance = environment.getCompiler?.();\n if (!compilerInstance) return null;\n return compilerInstance.getDistPathBySrcPath(srcPath);\n }\n\n /**\n * find the compiler configured on the workspace and ask for the dist folder path.\n */\n getRelativeDistFolder(component: Component): string {\n const environment = this.envs.getOrCalculateEnv(component).env;\n const compilerInstance: Compiler | undefined = environment.getCompiler?.();\n if (!compilerInstance || !compilerInstance.getDistDir) return DEFAULT_DIST_DIRNAME;\n return compilerInstance.getDistDir();\n }\n\n /**\n * Check if the dist folder (in the component package under node_modules) exist\n * @param component\n * @returns\n */\n async isDistDirExists(component: Component): Promise<boolean> {\n const packageDir = await this.workspace.getComponentPackagePath(component);\n const distDir = this.getRelativeDistFolder(component);\n const pathToCheck = path.join(packageDir, distDir);\n return fs.existsSync(pathToCheck);\n }\n\n async getDistsFiles(component: Component): Promise<DistArtifact> {\n const artifacts = await this.builder.getArtifactsVinylByAspect(component, CompilerAspect.id);\n if (!artifacts.length) throw new DistArtifactNotFound(component.id);\n\n return new DistArtifact(artifacts);\n }\n\n async addMissingDistsIssue(components: Component[], issuesToIgnore: string[]): Promise<void> {\n if (issuesToIgnore.includes(IssuesClasses.MissingDists.name)) return;\n await Promise.all(\n components.map(async (component) => {\n const exist = await this.isDistDirExists(component);\n if (!exist) {\n component.state.issues.getOrCreate(IssuesClasses.MissingDists).data = true;\n }\n })\n );\n }\n\n static runtime = MainRuntime;\n\n static dependencies = [\n CLIAspect,\n WorkspaceAspect,\n EnvsAspect,\n LoggerAspect,\n PubsubAspect,\n AspectLoaderAspect,\n BuilderAspect,\n UIAspect,\n GeneratorAspect,\n DependencyResolverAspect,\n WatcherAspect,\n IssuesAspect,\n ];\n\n static async provider([\n cli,\n workspace,\n envs,\n loggerMain,\n pubsub,\n aspectLoader,\n builder,\n ui,\n generator,\n dependencyResolver,\n watcher,\n issues,\n ]: [\n CLIMain,\n Workspace,\n EnvsMain,\n LoggerMain,\n PubsubMain,\n AspectLoaderMain,\n BuilderMain,\n UiMain,\n GeneratorMain,\n DependencyResolverMain,\n WatcherMain,\n IssuesMain\n ]) {\n const logger = loggerMain.createLogger(CompilerAspect.id);\n const compilerService = new CompilerService();\n\n const workspaceCompiler = new WorkspaceCompiler(\n workspace,\n envs,\n pubsub,\n aspectLoader,\n ui,\n logger,\n dependencyResolver,\n watcher\n );\n envs.registerService(compilerService);\n const compilerMain = new CompilerMain(\n pubsub,\n workspaceCompiler,\n envs,\n builder,\n workspace,\n dependencyResolver,\n compilerService\n );\n cli.register(new CompileCmd(workspaceCompiler, logger, pubsub));\n if (issues) {\n issues.registerAddComponentsIssues(compilerMain.addMissingDistsIssue.bind(compilerMain));\n }\n if (generator) generator.registerComponentTemplate([compilerTemplate]);\n\n return compilerMain;\n }\n}\n\nCompilerAspect.addRuntime(CompilerMain);\n\nexport default CompilerMain;\n"],"mappings":";;;;;;AAAA,SAAAA,KAAA;EAAA,MAAAC,IAAA,GAAAC,uBAAA,CAAAC,OAAA;EAAAH,IAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAA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iBAAiB,EAAEkE,MAAM,EAAEnE,MAAM,CAAC,CAAC;IAC/D,IAAI0D,MAAM,EAAE;MACVA,MAAM,CAACiB,2BAA2B,CAACH,YAAY,CAACzB,oBAAoB,CAAC6B,IAAI,CAACJ,YAAY,CAAC,CAAC;IAC1F;IACA,IAAIP,SAAS,EAAEA,SAAS,CAACY,yBAAyB,CAAC,CAACC,6BAAgB,CAAC,CAAC;IAEtE,OAAON,YAAY;EACrB;AACF;AAACO,OAAA,CAAAjF,YAAA,GAAAA,YAAA;AAAAb,eAAA,CA9JYa,YAAY,aAmFNkF,kBAAW;AAAA/F,eAAA,CAnFjBa,YAAY,kBAqFD,CACpBmF,gBAAS,EACTC,4BAAe,EACfC,kBAAU,EACVC,sBAAY,EACZC,sBAAY,EACZC,uBAAkB,EAClBC,wBAAa,EACbC,aAAQ,EACRC,4BAAe,EACfC,8CAAwB,EACxBC,kBAAa,EACbC,iBAAY,CACb;AA8DHxE,0BAAc,CAACyE,UAAU,CAAC/F,YAAY,CAAC;AAAC,IAAAgG,QAAA,GAAAf,OAAA,CAAAlH,OAAA,GAEzBiC,YAAY"}
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
2
|
import { EnvService, EnvDefinition, Env, EnvContext, ServiceTransformationMap, ExecutionContext } from '@teambit/envs';
|
|
3
3
|
import { Compiler } from './types';
|
|
4
|
-
export
|
|
4
|
+
export type CompilerDescriptor = {
|
|
5
5
|
id: string;
|
|
6
6
|
icon?: string;
|
|
7
7
|
config?: string;
|
|
8
8
|
};
|
|
9
|
-
|
|
9
|
+
type CompilerTransformationMap = ServiceTransformationMap & {
|
|
10
10
|
getCompiler: () => Compiler;
|
|
11
11
|
};
|
|
12
12
|
export declare class CompilerService implements EnvService<{}, CompilerDescriptor> {
|
|
13
13
|
name: string;
|
|
14
14
|
getCompiler(context: ExecutionContext): Compiler;
|
|
15
|
-
render(env: EnvDefinition):
|
|
15
|
+
render(env: EnvDefinition): JSX.Element;
|
|
16
16
|
transform(env: Env, context: EnvContext): CompilerTransformationMap | undefined;
|
|
17
17
|
getDescriptor(env: EnvDefinition): {
|
|
18
18
|
id: any;
|
|
@@ -20,6 +20,6 @@ export declare class CompilerService implements EnvService<{}, CompilerDescripto
|
|
|
20
20
|
config: any;
|
|
21
21
|
version: any;
|
|
22
22
|
displayName: any;
|
|
23
|
-
}
|
|
23
|
+
};
|
|
24
24
|
}
|
|
25
25
|
export {};
|
package/dist/compiler.service.js
CHANGED
|
@@ -40,19 +40,19 @@ class CompilerService {
|
|
|
40
40
|
render(env) {
|
|
41
41
|
const descriptor = this.getDescriptor(env);
|
|
42
42
|
return /*#__PURE__*/_react().default.createElement(_ink().Text, {
|
|
43
|
-
key: descriptor
|
|
43
|
+
key: descriptor?.id
|
|
44
44
|
}, /*#__PURE__*/_react().default.createElement(_ink().Text, {
|
|
45
45
|
color: "cyan"
|
|
46
|
-
}, "configured compiler: "), /*#__PURE__*/_react().default.createElement(_ink().Text, null, descriptor
|
|
46
|
+
}, "configured compiler: "), /*#__PURE__*/_react().default.createElement(_ink().Text, null, descriptor?.id, " (", descriptor?.displayName, " @ ", descriptor?.version, ")"), /*#__PURE__*/_react().default.createElement(_ink().Newline, null), /*#__PURE__*/_react().default.createElement(_ink().Text, {
|
|
47
47
|
color: "cyan"
|
|
48
|
-
}, "compiler config:"), /*#__PURE__*/_react().default.createElement(_ink().Newline, null), /*#__PURE__*/_react().default.createElement(_ink().Text, null,
|
|
48
|
+
}, "compiler config:"), /*#__PURE__*/_react().default.createElement(_ink().Newline, null), /*#__PURE__*/_react().default.createElement(_ink().Text, null, descriptor?.config && (0, _cliHighlight().default)(descriptor?.config, {
|
|
49
49
|
language: 'javascript',
|
|
50
50
|
ignoreIllegals: true
|
|
51
51
|
})), /*#__PURE__*/_react().default.createElement(_ink().Newline, null));
|
|
52
52
|
}
|
|
53
53
|
transform(env, context) {
|
|
54
54
|
// Old env
|
|
55
|
-
if (!
|
|
55
|
+
if (!env?.compiler) return undefined;
|
|
56
56
|
return {
|
|
57
57
|
getCompiler: () => env.compiler()(context)
|
|
58
58
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","data","_interopRequireDefault","require","_ink","_cliHighlight","obj","__esModule","default","_defineProperty","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","t","i","_toPrimitive","String","r","e","Symbol","toPrimitive","call","TypeError","Number","CompilerService","constructor","getCompiler","context","compiler","env","render","descriptor","getDescriptor","createElement","Text","id","color","displayName","version","Newline","config","highlight","language","ignoreIllegals","transform","undefined","icon","displayConfig","exports"],"sources":["compiler.service.tsx"],"sourcesContent":["import React from 'react';\nimport { Text, Newline } from 'ink';\nimport { EnvService, EnvDefinition, Env, EnvContext, ServiceTransformationMap, ExecutionContext } from '@teambit/envs';\nimport highlight from 'cli-highlight';\nimport { Compiler } from './types';\n\nexport type CompilerDescriptor = {\n id: string;\n icon?: string;\n config?: string;\n};\n\ntype CompilerTransformationMap = ServiceTransformationMap & {\n getCompiler: () => Compiler;\n};\n\nexport class CompilerService implements EnvService<{}, CompilerDescriptor> {\n name = 'Compile';\n\n getCompiler(context: ExecutionContext): Compiler {\n const compiler: Compiler = context.env.getCompiler();\n return compiler;\n }\n\n render(env: EnvDefinition) {\n const descriptor = this.getDescriptor(env);\n\n return (\n <Text key={descriptor?.id}>\n <Text color=\"cyan\">configured compiler: </Text>\n <Text>\n {descriptor?.id} ({descriptor?.displayName} @ {descriptor?.version})\n </Text>\n <Newline />\n <Text color=\"cyan\">compiler config:</Text>\n <Newline />\n <Text>\n {descriptor?.config && highlight(descriptor?.config, { language: 'javascript', ignoreIllegals: true })}\n </Text>\n <Newline />\n </Text>\n );\n }\n\n transform(env: Env, context: EnvContext): CompilerTransformationMap | undefined {\n // Old env\n if (!env?.compiler) return undefined;\n return {\n getCompiler: () => env.compiler()(context),\n };\n }\n\n getDescriptor(env: EnvDefinition) {\n if (!env.env.getCompiler) return undefined;\n const compiler = env.env.getCompiler();\n\n return {\n id: compiler.id,\n icon: compiler.icon,\n config: compiler.displayConfig ? compiler.displayConfig() : undefined,\n version: compiler.version ? compiler.version() : '?',\n displayName: compiler.displayName ? compiler.displayName : '?',\n };\n }\n}\n"],"mappings":";;;;;;AAAA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,KAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,IAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAI,cAAA;EAAA,MAAAJ,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAE,aAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAAsC,SAAAC,uBAAAI,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,KAAA,EAAAA,KAAA,EAAAI,UAAA,QAAAC,YAAA,QAAAC,QAAA,oBAAAX,GAAA,CAAAI,GAAA,IAAAC,KAAA,WAAAL,GAAA;AAAA,SAAAM,eAAAM,CAAA,QAAAC,CAAA,GAAAC,YAAA,CAAAF,CAAA,uCAAAC,CAAA,GAAAA,CAAA,GAAAE,MAAA,CAAAF,CAAA;AAAA,SAAAC,aAAAF,CAAA,EAAAI,CAAA,2BAAAJ,CAAA,KAAAA,CAAA,SAAAA,CAAA,MAAAK,CAAA,GAAAL,CAAA,CAAAM,MAAA,CAAAC,WAAA,kBAAAF,CAAA,QAAAJ,CAAA,GAAAI,CAAA,CAAAG,IAAA,CAAAR,CAAA,EAAAI,CAAA,uCAAAH,CAAA,SAAAA,CAAA,YAAAQ,SAAA,yEAAAL,CAAA,GAAAD,MAAA,GAAAO,MAAA,EAAAV,CAAA;AAa/B,MAAMW,eAAe,CAA+C;EAAAC,YAAA;IAAArB,eAAA,eAClE,SAAS;EAAA;EAEhBsB,WAAWA,CAACC,OAAyB,EAAY;IAC/C,MAAMC,QAAkB,GAAGD,OAAO,CAACE,GAAG,CAACH,WAAW,CAAC,CAAC;IACpD,OAAOE,QAAQ;EACjB;EAEAE,MAAMA,CAACD,GAAkB,EAAE;IACzB,MAAME,UAAU,GAAG,IAAI,CAACC,aAAa,CAACH,GAAG,CAAC;IAE1C,oBACElC,MAAA,GAAAQ,OAAA,CAAA8B,aAAA,CAAClC,IAAA,GAAAmC,IAAI;MAAC7B,GAAG,EAAE0B,UAAU,
|
|
1
|
+
{"version":3,"names":["_react","data","_interopRequireDefault","require","_ink","_cliHighlight","obj","__esModule","default","_defineProperty","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","t","i","_toPrimitive","String","r","e","Symbol","toPrimitive","call","TypeError","Number","CompilerService","constructor","getCompiler","context","compiler","env","render","descriptor","getDescriptor","createElement","Text","id","color","displayName","version","Newline","config","highlight","language","ignoreIllegals","transform","undefined","icon","displayConfig","exports"],"sources":["compiler.service.tsx"],"sourcesContent":["import React from 'react';\nimport { Text, Newline } from 'ink';\nimport { EnvService, EnvDefinition, Env, EnvContext, ServiceTransformationMap, ExecutionContext } from '@teambit/envs';\nimport highlight from 'cli-highlight';\nimport { Compiler } from './types';\n\nexport type CompilerDescriptor = {\n id: string;\n icon?: string;\n config?: string;\n};\n\ntype CompilerTransformationMap = ServiceTransformationMap & {\n getCompiler: () => Compiler;\n};\n\nexport class CompilerService implements EnvService<{}, CompilerDescriptor> {\n name = 'Compile';\n\n getCompiler(context: ExecutionContext): Compiler {\n const compiler: Compiler = context.env.getCompiler();\n return compiler;\n }\n\n render(env: EnvDefinition) {\n const descriptor = this.getDescriptor(env);\n\n return (\n <Text key={descriptor?.id}>\n <Text color=\"cyan\">configured compiler: </Text>\n <Text>\n {descriptor?.id} ({descriptor?.displayName} @ {descriptor?.version})\n </Text>\n <Newline />\n <Text color=\"cyan\">compiler config:</Text>\n <Newline />\n <Text>\n {descriptor?.config && highlight(descriptor?.config, { language: 'javascript', ignoreIllegals: true })}\n </Text>\n <Newline />\n </Text>\n );\n }\n\n transform(env: Env, context: EnvContext): CompilerTransformationMap | undefined {\n // Old env\n if (!env?.compiler) return undefined;\n return {\n getCompiler: () => env.compiler()(context),\n };\n }\n\n getDescriptor(env: EnvDefinition) {\n if (!env.env.getCompiler) return undefined;\n const compiler = env.env.getCompiler();\n\n return {\n id: compiler.id,\n icon: compiler.icon,\n config: compiler.displayConfig ? compiler.displayConfig() : undefined,\n version: compiler.version ? compiler.version() : '?',\n displayName: compiler.displayName ? compiler.displayName : '?',\n };\n }\n}\n"],"mappings":";;;;;;AAAA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,KAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,IAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAI,cAAA;EAAA,MAAAJ,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAE,aAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAAsC,SAAAC,uBAAAI,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAAA,SAAAG,gBAAAH,GAAA,EAAAI,GAAA,EA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QAAQ,CAACkB,IAAI;MACnBN,MAAM,EAAEZ,QAAQ,CAACmB,aAAa,GAAGnB,QAAQ,CAACmB,aAAa,CAAC,CAAC,GAAGF,SAAS;MACrEP,OAAO,EAAEV,QAAQ,CAACU,OAAO,GAAGV,QAAQ,CAACU,OAAO,CAAC,CAAC,GAAG,GAAG;MACpDD,WAAW,EAAET,QAAQ,CAACS,WAAW,GAAGT,QAAQ,CAACS,WAAW,GAAG;IAC7D,CAAC;EACH;AACF;AAACW,OAAA,CAAAxB,eAAA,GAAAA,eAAA"}
|
package/dist/compiler.task.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { Capsule } from '@teambit/isolator';
|
|
|
3
3
|
import { EnvContext, EnvHandler } from '@teambit/envs';
|
|
4
4
|
import { DependencyResolverMain } from '@teambit/dependency-resolver';
|
|
5
5
|
import { Compiler } from './types';
|
|
6
|
-
export
|
|
6
|
+
export type CompilerTaskOptions = {
|
|
7
7
|
/**
|
|
8
8
|
* instance of compiler to use.
|
|
9
9
|
*/
|
package/dist/dist-artifact.d.ts
CHANGED
|
@@ -2,5 +2,5 @@ import { AbstractVinyl } from '@teambit/legacy/dist/consumer/component/sources';
|
|
|
2
2
|
export declare class DistArtifact {
|
|
3
3
|
private artifacts;
|
|
4
4
|
constructor(artifacts: AbstractVinyl[]);
|
|
5
|
-
getFile(path: string): AbstractVinyl
|
|
5
|
+
getFile(path: string): AbstractVinyl;
|
|
6
6
|
}
|
package/dist/output-formatter.js
CHANGED
|
@@ -20,9 +20,8 @@ const formatCompileResults = (compileResults, verbose) => compileResults.map(com
|
|
|
20
20
|
})).reduce((outputString, result) => {
|
|
21
21
|
outputString += `${result.icon} ${result.status}\t${result.componentId}`;
|
|
22
22
|
if (verbose) {
|
|
23
|
-
var _result$files;
|
|
24
23
|
outputString += ':';
|
|
25
|
-
outputString += result
|
|
24
|
+
outputString += result?.files?.reduce((fileList, file) => `${fileList}\t\t - ${file}\n`, '\n');
|
|
26
25
|
}
|
|
27
26
|
outputString += '\n';
|
|
28
27
|
return outputString;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_chalk","data","_interopRequireDefault","require","obj","__esModule","default","formatCompileResults","compileResults","verbose","map","componentResult","componentId","component","id","fullName","files","buildResults","status","errors","length","icon","chalk","red","green","reduce","outputString","result","
|
|
1
|
+
{"version":3,"names":["_chalk","data","_interopRequireDefault","require","obj","__esModule","default","formatCompileResults","compileResults","verbose","map","componentResult","componentId","component","id","fullName","files","buildResults","status","errors","length","icon","chalk","red","green","reduce","outputString","result","fileList","file","exports"],"sources":["output-formatter.ts"],"sourcesContent":["import chalk from 'chalk';\nimport { ComponentsStatus } from './compiler.cmd';\n\nexport const formatCompileResults = (compileResults: ComponentsStatus[], verbose: boolean) =>\n compileResults\n .map((componentResult: ComponentsStatus) => ({\n componentId: componentResult.component.id.fullName,\n files: componentResult.buildResults,\n status: componentResult.errors.length ? 'FAILURE' : 'SUCCESS',\n icon: componentResult.errors.length ? chalk.red('✗') : chalk.green('✔'),\n }))\n .reduce((outputString, result) => {\n outputString += `${result.icon} ${result.status}\\t${result.componentId}`;\n if (verbose) {\n outputString += ':';\n outputString += result?.files?.reduce((fileList, file) => `${fileList}\\t\\t - ${file}\\n`, '\\n');\n }\n outputString += '\\n';\n return outputString;\n }, '');\n"],"mappings":";;;;;;AAAA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAA0B,SAAAC,uBAAAE,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAGnB,MAAMG,oBAAoB,GAAGA,CAACC,cAAkC,EAAEC,OAAgB,KACvFD,cAAc,CACXE,GAAG,CAAEC,eAAiC,KAAM;EAC3CC,WAAW,EAAED,eAAe,CAACE,SAAS,CAACC,EAAE,CAACC,QAAQ;EAClDC,KAAK,EAAEL,eAAe,CAACM,YAAY;EACnCC,MAAM,EAAEP,eAAe,CAACQ,MAAM,CAACC,MAAM,GAAG,SAAS,GAAG,SAAS;EAC7DC,IAAI,EAAEV,eAAe,CAACQ,MAAM,CAACC,MAAM,GAAGE,gBAAK,CAACC,GAAG,CAAC,GAAG,CAAC,GAAGD,gBAAK,CAACE,KAAK,CAAC,GAAG;AACxE,CAAC,CAAC,CAAC,CACFC,MAAM,CAAC,CAACC,YAAY,EAAEC,MAAM,KAAK;EAChCD,YAAY,IAAK,GAAEC,MAAM,CAACN,IAAK,IAAGM,MAAM,CAACT,MAAO,KAAIS,MAAM,CAACf,WAAY,EAAC;EACxE,IAAIH,OAAO,EAAE;IACXiB,YAAY,IAAI,GAAG;IACnBA,YAAY,IAAIC,MAAM,EAAEX,KAAK,EAAES,MAAM,CAAC,CAACG,QAAQ,EAAEC,IAAI,KAAM,GAAED,QAAS,UAASC,IAAK,IAAG,EAAE,IAAI,CAAC;EAChG;EACAH,YAAY,IAAI,IAAI;EACpB,OAAOA,YAAY;AACrB,CAAC,EAAE,EAAE,CAAC;AAACI,OAAA,CAAAvB,oBAAA,GAAAA,oBAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.compilation_compiler@1.0.
|
|
2
|
-
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.compilation_compiler@1.0.
|
|
1
|
+
import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.compilation_compiler@1.0.109/dist/compiler.composition.js';
|
|
2
|
+
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.compilation_compiler@1.0.109/dist/compiler.docs.mdx';
|
|
3
3
|
|
|
4
4
|
export const compositions = [compositions_0];
|
|
5
5
|
export const overview = [overview_0];
|
package/dist/types.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { BuildContext, BuildTask, BuiltTaskResult, TaskResultsList } from '@teambit/builder';
|
|
2
2
|
import type { Component } from '@teambit/component';
|
|
3
3
|
import { ServiceHandler } from '@teambit/envs';
|
|
4
|
-
export
|
|
4
|
+
export type TranspileFileParams = {
|
|
5
5
|
componentDir: string;
|
|
6
6
|
filePath: string;
|
|
7
7
|
};
|
|
@@ -16,17 +16,17 @@ export declare enum CompilationInitiator {
|
|
|
16
16
|
ComponentAdded = 7,
|
|
17
17
|
Install = 8
|
|
18
18
|
}
|
|
19
|
-
export
|
|
19
|
+
export type TranspileComponentParams = {
|
|
20
20
|
component: Component;
|
|
21
21
|
componentDir: string;
|
|
22
22
|
outputDir: string;
|
|
23
23
|
initiator: CompilationInitiator;
|
|
24
24
|
};
|
|
25
|
-
export
|
|
25
|
+
export type TranspileFileOutputOneFile = {
|
|
26
26
|
outputText: string;
|
|
27
27
|
outputPath: string;
|
|
28
28
|
};
|
|
29
|
-
export
|
|
29
|
+
export type TranspileFileOutput = TranspileFileOutputOneFile[] | null;
|
|
30
30
|
export interface CompilerOptions {
|
|
31
31
|
/**
|
|
32
32
|
* name of the compiler.
|
|
@@ -11,11 +11,11 @@ import { DependencyResolverMain } from '@teambit/dependency-resolver';
|
|
|
11
11
|
import { UiMain } from '@teambit/ui';
|
|
12
12
|
import type { PreStartOpts } from '@teambit/ui';
|
|
13
13
|
import { Compiler, CompilationInitiator } from './types';
|
|
14
|
-
export
|
|
14
|
+
export type BuildResult = {
|
|
15
15
|
component: string;
|
|
16
16
|
buildResults: string[] | null | undefined;
|
|
17
17
|
};
|
|
18
|
-
export
|
|
18
|
+
export type CompileOptions = {
|
|
19
19
|
changed?: boolean;
|
|
20
20
|
verbose?: boolean;
|
|
21
21
|
/**
|
|
@@ -27,7 +27,7 @@ export declare type CompileOptions = {
|
|
|
27
27
|
initiator: CompilationInitiator;
|
|
28
28
|
linkComponents?: boolean;
|
|
29
29
|
};
|
|
30
|
-
export
|
|
30
|
+
export type CompileError = {
|
|
31
31
|
path: string;
|
|
32
32
|
error: Error;
|
|
33
33
|
};
|
|
@@ -42,7 +42,7 @@ export declare class ComponentCompiler {
|
|
|
42
42
|
private dists;
|
|
43
43
|
private compileErrors;
|
|
44
44
|
constructor(pubsub: PubsubMain, workspace: Workspace, component: Component, compilerInstance: Compiler, compilerId: string, logger: Logger, dependencyResolver: DependencyResolverMain, dists?: Dist[], compileErrors?: CompileError[]);
|
|
45
|
-
compile(noThrow: boolean
|
|
45
|
+
compile(noThrow: boolean, options: CompileOptions): Promise<BuildResult>;
|
|
46
46
|
private throwOnCompileErrors;
|
|
47
47
|
private distDirs;
|
|
48
48
|
private getInjectedDirs;
|
|
@@ -65,7 +65,7 @@ export declare class WorkspaceCompiler {
|
|
|
65
65
|
code?: string;
|
|
66
66
|
}, id: ComponentID): Promise<boolean>;
|
|
67
67
|
onComponentAdd(component: Component, files: string[], watchOpts: WatchOptions): Promise<void | SerializableResults>;
|
|
68
|
-
onComponentChange(component: Component, files: string[], removedFiles: string[]
|
|
68
|
+
onComponentChange(component: Component, files: string[], removedFiles: string[], watchOpts: WatchOptions): Promise<SerializableResults | void>;
|
|
69
69
|
onPreWatch(componentIds: ComponentID[], watchOpts: WatchOptions): Promise<void>;
|
|
70
70
|
compileComponents(componentsIds: string[] | ComponentID[] | ComponentID[], // when empty, it compiles new+modified (unless options.all is set),
|
|
71
71
|
options: CompileOptions, noThrow?: boolean): Promise<BuildResult[]>;
|
|
@@ -184,10 +184,9 @@ ${this.compileErrors.map(formatError).join('\n')}`);
|
|
|
184
184
|
}
|
|
185
185
|
}
|
|
186
186
|
async distDirs() {
|
|
187
|
-
var _this$compilerInstanc, _this$compilerInstanc2;
|
|
188
187
|
const packageName = (0, _componentIdToPackageName().default)(this.component.state._consumer);
|
|
189
188
|
const packageDir = _path().default.join('node_modules', packageName);
|
|
190
|
-
const distDirName =
|
|
189
|
+
const distDirName = this.compilerInstance.getDistDir?.() || _constants().DEFAULT_DIST_DIRNAME;
|
|
191
190
|
const injectedDirs = await this.getInjectedDirs(packageName);
|
|
192
191
|
return [packageDir, ...injectedDirs].map(dist => _path().default.join(dist, distDirName));
|
|
193
192
|
}
|
|
@@ -210,8 +209,7 @@ ${this.compileErrors.map(formatError).join('\n')}`);
|
|
|
210
209
|
let compileResults;
|
|
211
210
|
if (isFileSupported) {
|
|
212
211
|
try {
|
|
213
|
-
|
|
214
|
-
compileResults = await ((_this$compilerInstanc3 = (_this$compilerInstanc4 = this.compilerInstance).transpileFile) === null || _this$compilerInstanc3 === void 0 ? void 0 : _this$compilerInstanc3.call(_this$compilerInstanc4, file.contents.toString(), options));
|
|
212
|
+
compileResults = await this.compilerInstance.transpileFile?.(file.contents.toString(), options);
|
|
215
213
|
} catch (error) {
|
|
216
214
|
this.compileErrors.push({
|
|
217
215
|
path: file.path,
|
|
@@ -256,13 +254,12 @@ ${this.compileErrors.map(formatError).join('\n')}`);
|
|
|
256
254
|
}
|
|
257
255
|
if (filesToCompile.length) {
|
|
258
256
|
try {
|
|
259
|
-
|
|
260
|
-
await ((_this$compilerInstanc5 = (_this$compilerInstanc6 = this.compilerInstance).transpileComponent) === null || _this$compilerInstanc5 === void 0 ? void 0 : _this$compilerInstanc5.call(_this$compilerInstanc6, {
|
|
257
|
+
await this.compilerInstance.transpileComponent?.({
|
|
261
258
|
component,
|
|
262
259
|
componentDir: this.componentDir,
|
|
263
260
|
outputDir: await this.workspace.getComponentPackagePath(component),
|
|
264
261
|
initiator
|
|
265
|
-
})
|
|
262
|
+
});
|
|
266
263
|
} catch (error) {
|
|
267
264
|
this.compileErrors.push({
|
|
268
265
|
path: this.componentDir,
|
|
@@ -324,8 +321,8 @@ class WorkspaceCompiler {
|
|
|
324
321
|
if (!watchOpts.compile) return undefined;
|
|
325
322
|
// when files are removed, we need to remove the dist directories and the old symlinks, otherwise, it has
|
|
326
323
|
// symlinks to non-exist files and the dist has stale files
|
|
327
|
-
const deleteDistDir = Boolean(removedFiles
|
|
328
|
-
if (removedFiles
|
|
324
|
+
const deleteDistDir = Boolean(removedFiles?.length);
|
|
325
|
+
if (removedFiles?.length) {
|
|
329
326
|
await (0, _workspaceModules().removeLinksFromNodeModules)(component, this.workspace, removedFiles);
|
|
330
327
|
}
|
|
331
328
|
const buildResults = await this.compileComponents([component.id.toString()], {
|
|
@@ -336,8 +333,7 @@ class WorkspaceCompiler {
|
|
|
336
333
|
return {
|
|
337
334
|
results: buildResults,
|
|
338
335
|
toString() {
|
|
339
|
-
|
|
340
|
-
return `${(_buildResults$ = buildResults[0]) === null || _buildResults$ === void 0 || (_buildResults$ = _buildResults$.buildResults) === null || _buildResults$ === void 0 ? void 0 : _buildResults$.join('\n\t')}`;
|
|
336
|
+
return `${buildResults[0]?.buildResults?.join('\n\t')}`;
|
|
341
337
|
}
|
|
342
338
|
};
|
|
343
339
|
}
|
|
@@ -370,9 +366,8 @@ class WorkspaceCompiler {
|
|
|
370
366
|
async runCompileComponents(components, options, noThrow) {
|
|
371
367
|
const componentsCompilers = [];
|
|
372
368
|
components.forEach(c => {
|
|
373
|
-
var _environment$getCompi;
|
|
374
369
|
const environment = this.envs.getEnv(c).env;
|
|
375
|
-
const compilerInstance =
|
|
370
|
+
const compilerInstance = environment.getCompiler?.();
|
|
376
371
|
if (compilerInstance) {
|
|
377
372
|
const compilerName = compilerInstance.constructor.name || 'compiler';
|
|
378
373
|
componentsCompilers.push(new ComponentCompiler(this.pubsub, this.workspace, c, compilerInstance, compilerName, this.logger, this.dependencyResolver));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_pMapSeries","data","_interopRequireDefault","require","_workspace","_path","_loader","_constants","_sources","_dataToPersist","_workspaceModules","_componentIdToPackageName","_removePath","_bitRoots","_lodash","_compiler","_events","_types","obj","__esModule","default","ComponentCompiler","constructor","pubsub","workspace","component","compilerInstance","compilerId","logger","dependencyResolver","dists","compileErrors","compile","noThrow","options","dataToPersist","deleteDistDir","DataToPersist","distDir","distDirs","removePath","RemovePath","addBasePath","path","persistAllToFS","compilers","canTranspileFile","find","c","transpileFile","canTranspileComponent","transpileComponent","Promise","all","filesystem","files","map","file","compileOneFile","initiator","compileAllFiles","Error","toString","throwOnCompileErrors","addManyFiles","linkComponents","linkToNodeModulesByComponents","buildResults","distFile","state","_consumer","compiler","loader","succeed","pub","CompilerAspect","id","ComponentCompilationOnDoneEvent","length","forEach","errorItem","error","formatError","err","join","CompilerErrorEvent","console","message","_this$compilerInstanc","_this$compilerInstanc2","packageName","componentIdToPackageName","packageDir","distDirName","getDistDir","call","DEFAULT_DIST_DIRNAME","injectedDirs","getInjectedDirs","dist","rootDirs","readBitRootsDir","rootDir","relative","componentDir","filePath","isFileSupported","compileResults","_this$compilerInstanc3","_this$compilerInstanc4","contents","push","base","result","Dist","outputPath","Buffer","from","outputText","shouldCopyNonSupportedFiles","filesToCompile","_this$compilerInstanc5","_this$compilerInstanc6","outputDir","getComponentPackagePath","exports","WorkspaceCompiler","envs","aspectLoader","ui","watcher","registerOnComponentChange","onComponentChange","bind","registerOnComponentAdd","onComponentAdd","registerOnPreWatch","onPreWatch","registerPreStart","onPreStart","registerOnAspectLoadErrorSlot","onAspectLoadFail","preStartOpts","skipCompilation","compileComponents","changed","verbose","CompilationInitiator","PreStart","watchScopeInternalFiles","code","AspectLoadFail","watchOpts","undefined","removedFiles","Boolean","removeLinksFromNodeModules","ComponentChanged","results","_buildResults$","componentIds","preCompile","start","Date","now","PreWatch","end","consoleSuccess","componentsIds","OutsideWorkspaceError","getIdsToCompile","getManyOpts","loadSeedersAsAspects","components","getMany","grouped","groupByIsEnv","envsResults","runCompileComponents","otherResults","other","componentsCompilers","_environment$getCompi","environment","getEnv","env","getCompiler","compilerName","name","warn","resultOnWorkspace","mapSeries","componentCompiler","envsIds","uniq","getEnvId","filter","envId","isCoreEnv","groupBy","includes","resolveMultipleComponentIds","filterIds","getNewAndModifiedIds","listIds"],"sources":["workspace-compiler.ts"],"sourcesContent":["/* eslint-disable max-classes-per-file */\nimport mapSeries from 'p-map-series';\nimport { Component } from '@teambit/component';\nimport { EnvsMain } from '@teambit/envs';\nimport type { PubsubMain } from '@teambit/pubsub';\nimport { SerializableResults, Workspace, OutsideWorkspaceError } from '@teambit/workspace';\nimport { WatcherMain, WatchOptions } from '@teambit/watcher';\nimport path from 'path';\nimport { ComponentID } from '@teambit/component-id';\nimport { Logger } from '@teambit/logger';\nimport loader from '@teambit/legacy/dist/cli/loader';\nimport { DEFAULT_DIST_DIRNAME } from '@teambit/legacy/dist/constants';\nimport { AbstractVinyl, Dist } from '@teambit/legacy/dist/consumer/component/sources';\nimport DataToPersist from '@teambit/legacy/dist/consumer/component/sources/data-to-persist';\nimport {\n linkToNodeModulesByComponents,\n removeLinksFromNodeModules,\n} from '@teambit/workspace.modules.node-modules-linker';\nimport { AspectLoaderMain } from '@teambit/aspect-loader';\nimport { DependencyResolverMain } from '@teambit/dependency-resolver';\nimport componentIdToPackageName from '@teambit/legacy/dist/utils/bit/component-id-to-package-name';\nimport RemovePath from '@teambit/legacy/dist/consumer/component/sources/remove-path';\nimport { UiMain } from '@teambit/ui';\nimport { readBitRootsDir } from '@teambit/bit-roots';\nimport { groupBy, uniq } from 'lodash';\nimport type { PreStartOpts } from '@teambit/ui';\nimport { PathOsBasedAbsolute, PathOsBasedRelative } from '@teambit/legacy/dist/utils/path';\nimport { MultiCompiler } from '@teambit/multi-compiler';\nimport { CompilerAspect } from './compiler.aspect';\nimport { CompilerErrorEvent, ComponentCompilationOnDoneEvent } from './events';\nimport { Compiler, CompilationInitiator } from './types';\n\nexport type BuildResult = { component: string; buildResults: string[] | null | undefined };\n\nexport type CompileOptions = {\n changed?: boolean; // compile only new and modified components\n verbose?: boolean; // show more data, such as, dist paths\n /**\n * whether the dist root dir should be deleted before writing new dists.\n * defaults to true for `bit compile` and false everywhere else, such as `bit watch` and `bit\n * start` to avoid webpack \"EINTR\" error.\n */\n deleteDistDir?: boolean;\n initiator: CompilationInitiator; // describes where the compilation is coming from\n // should we create links in node_modules for the compiled components (default = true)\n // this will link the source files, and create the package.json\n linkComponents?: boolean;\n};\n\nexport type CompileError = { path: string; error: Error };\n\nexport class ComponentCompiler {\n constructor(\n private pubsub: PubsubMain,\n private workspace: Workspace,\n private component: Component,\n private compilerInstance: Compiler,\n private compilerId: string,\n private logger: Logger,\n private dependencyResolver: DependencyResolverMain,\n private dists: Dist[] = [],\n private compileErrors: CompileError[] = []\n ) {}\n\n async compile(noThrow = true, options: CompileOptions): Promise<BuildResult> {\n let dataToPersist;\n const deleteDistDir = options.deleteDistDir ?? this.compilerInstance.deleteDistDir;\n // delete dist folder before transpilation (because some compilers (like ngPackagr) can generate files there during the compilation process)\n if (deleteDistDir) {\n dataToPersist = new DataToPersist();\n for (const distDir of await this.distDirs()) {\n dataToPersist.removePath(new RemovePath(distDir));\n }\n dataToPersist.addBasePath(this.workspace.path);\n await dataToPersist.persistAllToFS();\n }\n\n const compilers: Compiler[] = (this.compilerInstance as MultiCompiler).compilers\n ? (this.compilerInstance as MultiCompiler).compilers\n : [this.compilerInstance];\n const canTranspileFile = compilers.find((c) => c.transpileFile);\n const canTranspileComponent = compilers.find((c) => c.transpileComponent);\n\n if (canTranspileFile) {\n await Promise.all(\n this.component.filesystem.files.map((file: AbstractVinyl) => this.compileOneFile(file, options.initiator))\n );\n }\n\n if (canTranspileComponent) {\n await this.compileAllFiles(this.component, options.initiator);\n }\n\n if (!canTranspileFile && !canTranspileComponent) {\n throw new Error(\n `compiler ${this.compilerId.toString()} doesn't implement either \"transpileFile\" or \"transpileComponent\" methods`\n );\n }\n this.throwOnCompileErrors(noThrow);\n\n // writing the dists with `component.setDists(dists); component.dists.writeDists` is tricky\n // as it uses other base-paths and doesn't respect the new node-modules base path.\n dataToPersist = new DataToPersist();\n dataToPersist.addManyFiles(this.dists);\n dataToPersist.addBasePath(this.workspace.path);\n await dataToPersist.persistAllToFS();\n const linkComponents = options.linkComponents ?? true;\n if (linkComponents) {\n await linkToNodeModulesByComponents([this.component], this.workspace);\n }\n const buildResults = this.dists.map((distFile) => distFile.path);\n if (this.component.state._consumer.compiler) loader.succeed();\n this.pubsub.pub(\n CompilerAspect.id,\n new ComponentCompilationOnDoneEvent(this.compileErrors, this.component, buildResults)\n );\n return { component: this.component.id.toString(), buildResults };\n }\n\n private throwOnCompileErrors(noThrow = true) {\n if (this.compileErrors.length) {\n this.compileErrors.forEach((errorItem) => {\n this.logger.error(`compilation error at ${errorItem.path}`, errorItem.error);\n });\n const formatError = (errorItem) => `${errorItem.path}\\n${errorItem.error}`;\n const err = new Error(`compilation failed. see the following errors from the compiler\n${this.compileErrors.map(formatError).join('\\n')}`);\n\n this.pubsub.pub(CompilerAspect.id, new CompilerErrorEvent(err));\n\n if (!noThrow) {\n throw err;\n }\n\n this.logger.console(err.message);\n }\n }\n\n private async distDirs(): Promise<PathOsBasedRelative[]> {\n const packageName = componentIdToPackageName(this.component.state._consumer);\n const packageDir = path.join('node_modules', packageName);\n const distDirName = this.compilerInstance.getDistDir?.() || DEFAULT_DIST_DIRNAME;\n const injectedDirs = await this.getInjectedDirs(packageName);\n return [packageDir, ...injectedDirs].map((dist) => path.join(dist, distDirName));\n }\n\n private async getInjectedDirs(packageName: string): Promise<string[]> {\n const injectedDirs = await this.workspace.getInjectedDirs(this.component);\n if (injectedDirs.length > 0) return injectedDirs;\n\n const rootDirs = await readBitRootsDir(this.workspace.path);\n return rootDirs.map((rootDir) => path.relative(this.workspace.path, path.join(rootDir, packageName)));\n }\n\n private get componentDir(): PathOsBasedAbsolute {\n return this.workspace.componentDir(this.component.id);\n }\n\n private async compileOneFile(file: AbstractVinyl, initiator: CompilationInitiator): Promise<void> {\n const options = { componentDir: this.componentDir, filePath: file.relative, initiator };\n const isFileSupported = this.compilerInstance.isFileSupported(file.path);\n let compileResults;\n if (isFileSupported) {\n try {\n compileResults = await this.compilerInstance.transpileFile?.(file.contents.toString(), options);\n } catch (error: any) {\n this.compileErrors.push({ path: file.path, error });\n return;\n }\n }\n for (const base of await this.distDirs()) {\n if (isFileSupported && compileResults) {\n this.dists.push(\n ...compileResults.map(\n (result) =>\n new Dist({\n base,\n path: path.join(base, result.outputPath),\n contents: Buffer.from(result.outputText),\n })\n )\n );\n } else if (this.compilerInstance.shouldCopyNonSupportedFiles) {\n // compiler doesn't support this file type. copy the file as is to the dist dir.\n this.dists.push(new Dist({ base, path: path.join(base, file.relative), contents: file.contents }));\n }\n }\n }\n\n private async compileAllFiles(component: Component, initiator: CompilationInitiator): Promise<void> {\n const filesToCompile: AbstractVinyl[] = [];\n for (const base of await this.distDirs()) {\n component.filesystem.files.forEach((file: AbstractVinyl) => {\n const isFileSupported = this.compilerInstance.isFileSupported(file.path);\n if (isFileSupported) {\n filesToCompile.push(file);\n } else if (this.compilerInstance.shouldCopyNonSupportedFiles) {\n // compiler doesn't support this file type. copy the file as is to the dist dir.\n this.dists.push(\n new Dist({\n base,\n path: path.join(base, file.relative),\n contents: file.contents,\n })\n );\n }\n });\n }\n\n if (filesToCompile.length) {\n try {\n await this.compilerInstance.transpileComponent?.({\n component,\n componentDir: this.componentDir,\n outputDir: await this.workspace.getComponentPackagePath(component),\n initiator,\n });\n } catch (error: any) {\n this.compileErrors.push({ path: this.componentDir, error });\n }\n }\n }\n}\n\nexport class WorkspaceCompiler {\n constructor(\n private workspace: Workspace,\n private envs: EnvsMain,\n private pubsub: PubsubMain,\n private aspectLoader: AspectLoaderMain,\n private ui: UiMain,\n private logger: Logger,\n private dependencyResolver: DependencyResolverMain,\n private watcher: WatcherMain\n ) {\n if (this.workspace) {\n this.workspace.registerOnComponentChange(this.onComponentChange.bind(this));\n this.workspace.registerOnComponentAdd(this.onComponentAdd.bind(this));\n this.watcher.registerOnPreWatch(this.onPreWatch.bind(this));\n }\n this.ui.registerPreStart(this.onPreStart.bind(this));\n if (this.aspectLoader) {\n this.aspectLoader.registerOnAspectLoadErrorSlot(this.onAspectLoadFail.bind(this));\n }\n }\n\n async onPreStart(preStartOpts: PreStartOpts): Promise<void> {\n if (this.workspace) {\n if (preStartOpts.skipCompilation) {\n return;\n }\n await this.compileComponents([], {\n changed: true,\n verbose: false,\n deleteDistDir: false,\n initiator: CompilationInitiator.PreStart,\n });\n } else {\n await this.watcher.watchScopeInternalFiles();\n }\n }\n\n async onAspectLoadFail(err: Error & { code?: string }, id: ComponentID): Promise<boolean> {\n if (err.code && err.code === 'MODULE_NOT_FOUND' && this.workspace) {\n await this.compileComponents([id.toString()], { initiator: CompilationInitiator.AspectLoadFail }, true);\n return true;\n }\n return false;\n }\n\n async onComponentAdd(component: Component, files: string[], watchOpts: WatchOptions) {\n return this.onComponentChange(component, files, undefined, watchOpts);\n }\n\n async onComponentChange(\n component: Component,\n files: string[],\n removedFiles: string[] = [],\n watchOpts: WatchOptions\n ): Promise<SerializableResults | void> {\n if (!watchOpts.compile) return undefined;\n // when files are removed, we need to remove the dist directories and the old symlinks, otherwise, it has\n // symlinks to non-exist files and the dist has stale files\n const deleteDistDir = Boolean(removedFiles?.length);\n if (removedFiles?.length) {\n await removeLinksFromNodeModules(component, this.workspace, removedFiles);\n }\n const buildResults = await this.compileComponents(\n [component.id.toString()],\n { initiator: watchOpts.initiator || CompilationInitiator.ComponentChanged, deleteDistDir },\n true\n );\n // await linkToNodeModulesByComponents([component], this.workspace);\n return {\n results: buildResults,\n toString() {\n return `${buildResults[0]?.buildResults?.join('\\n\\t')}`;\n },\n };\n }\n\n async onPreWatch(componentIds: ComponentID[], watchOpts: WatchOptions) {\n if (watchOpts.preCompile) {\n const start = Date.now();\n this.logger.console(`compiling ${componentIds.length} components`);\n await this.compileComponents(\n componentIds.map((id) => id),\n { initiator: CompilationInitiator.PreWatch }\n );\n const end = Date.now() - start;\n this.logger.consoleSuccess(`compiled ${componentIds.length} components successfully (${end / 1000} sec)`);\n }\n }\n\n async compileComponents(\n componentsIds: string[] | ComponentID[] | ComponentID[], // when empty, it compiles new+modified (unless options.all is set),\n options: CompileOptions,\n noThrow?: boolean\n ): Promise<BuildResult[]> {\n if (!this.workspace) throw new OutsideWorkspaceError();\n const componentIds = await this.getIdsToCompile(componentsIds, options.changed);\n // In case the aspect failed to load, we want to compile it without try to re-load it again\n const getManyOpts =\n options.initiator === CompilationInitiator.AspectLoadFail ? { loadSeedersAsAspects: false } : undefined;\n const components = await this.workspace.getMany(componentIds, getManyOpts);\n\n const grouped = this.groupByIsEnv(components);\n const envsResults = grouped.envs ? await this.runCompileComponents(grouped.envs, options, noThrow) : [];\n const otherResults = grouped.other ? await this.runCompileComponents(grouped.other, options, noThrow) : [];\n return [...envsResults, ...otherResults];\n }\n\n private async runCompileComponents(\n components: Component[],\n options: CompileOptions,\n noThrow?: boolean\n ): Promise<BuildResult[]> {\n const componentsCompilers: ComponentCompiler[] = [];\n\n components.forEach((c) => {\n const environment = this.envs.getEnv(c).env;\n const compilerInstance = environment.getCompiler?.();\n\n if (compilerInstance) {\n const compilerName = compilerInstance.constructor.name || 'compiler';\n componentsCompilers.push(\n new ComponentCompiler(\n this.pubsub,\n this.workspace,\n c,\n compilerInstance,\n compilerName,\n this.logger,\n this.dependencyResolver\n )\n );\n } else {\n this.logger.warn(`unable to find a compiler instance for ${c.id.toString()}`);\n }\n });\n const resultOnWorkspace = await mapSeries(componentsCompilers, (componentCompiler) =>\n componentCompiler.compile(noThrow, options)\n );\n\n return resultOnWorkspace;\n }\n\n /**\n * This function get's a list of aspect ids and return them grouped by whether any of them is the env of other from the list\n * @param ids\n */\n groupByIsEnv(components: Component[]): { envs?: Component[]; other?: Component[] } {\n const envsIds = uniq(\n components\n .map((component) => this.envs.getEnvId(component))\n .filter((envId) => !this.aspectLoader.isCoreEnv(envId))\n );\n const grouped = groupBy(components, (component) => {\n if (envsIds.includes(component.id.toString())) return 'envs';\n return 'other';\n });\n return grouped as { envs: Component[]; other: Component[] };\n }\n\n private async getIdsToCompile(\n componentsIds: Array<string | ComponentID | ComponentID>,\n changed = false\n ): Promise<ComponentID[]> {\n if (componentsIds.length) {\n const componentIds = await this.workspace.resolveMultipleComponentIds(componentsIds);\n return this.workspace.filterIds(componentIds);\n }\n if (changed) {\n return this.workspace.getNewAndModifiedIds();\n }\n return this.workspace.listIds();\n }\n}\n"],"mappings":";;;;;;AACA,SAAAA,YAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,WAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAIA,SAAAG,WAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,UAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAI,MAAA;EAAA,MAAAJ,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAE,KAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAGA,SAAAK,QAAA;EAAA,MAAAL,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAG,OAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAM,WAAA;EAAA,MAAAN,IAAA,GAAAE,OAAA;EAAAI,UAAA,YAAAA,CAAA;IAAA,OAAAN,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAO,SAAA;EAAA,MAAAP,IAAA,GAAAE,OAAA;EAAAK,QAAA,YAAAA,CAAA;IAAA,OAAAP,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAQ,eAAA;EAAA,MAAAR,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAM,cAAA,YAAAA,CAAA;IAAA,OAAAR,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAS,kBAAA;EAAA,MAAAT,IAAA,GAAAE,OAAA;EA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,CAAC/K,SAAS,CAACmD,EAAE,CAACd,QAAQ,CAAC,CAAC,CAAC,EAAE,OAAO,MAAM;MAC5D,OAAO,OAAO;IAChB,CAAC,CAAC;IACF,OAAOiH,OAAO;EAChB;EAEA,MAAcL,eAAeA,CAC3BF,aAAwD,EACxDvB,OAAO,GAAG,KAAK,EACS;IACxB,IAAIuB,aAAa,CAAC1F,MAAM,EAAE;MACxB,MAAMkF,YAAY,GAAG,MAAM,IAAI,CAACxI,SAAS,CAACiL,2BAA2B,CAACjC,aAAa,CAAC;MACpF,OAAO,IAAI,CAAChJ,SAAS,CAACkL,SAAS,CAAC1C,YAAY,CAAC;IAC/C;IACA,IAAIf,OAAO,EAAE;MACX,OAAO,IAAI,CAACzH,SAAS,CAACmL,oBAAoB,CAAC,CAAC;IAC9C;IACA,OAAO,IAAI,CAACnL,SAAS,CAACoL,OAAO,CAAC,CAAC;EACjC;AACF;AAAC/E,OAAA,CAAAC,iBAAA,GAAAA,iBAAA"}
|
|
1
|
+
{"version":3,"names":["_pMapSeries","data","_interopRequireDefault","require","_workspace","_path","_loader","_constants","_sources","_dataToPersist","_workspaceModules","_componentIdToPackageName","_removePath","_bitRoots","_lodash","_compiler","_events","_types","obj","__esModule","default","ComponentCompiler","constructor","pubsub","workspace","component","compilerInstance","compilerId","logger","dependencyResolver","dists","compileErrors","compile","noThrow","options","dataToPersist","deleteDistDir","DataToPersist","distDir","distDirs","removePath","RemovePath","addBasePath","path","persistAllToFS","compilers","canTranspileFile","find","c","transpileFile","canTranspileComponent","transpileComponent","Promise","all","filesystem","files","map","file","compileOneFile","initiator","compileAllFiles","Error","toString","throwOnCompileErrors","addManyFiles","linkComponents","linkToNodeModulesByComponents","buildResults","distFile","state","_consumer","compiler","loader","succeed","pub","CompilerAspect","id","ComponentCompilationOnDoneEvent","length","forEach","errorItem","error","formatError","err","join","CompilerErrorEvent","console","message","packageName","componentIdToPackageName","packageDir","distDirName","getDistDir","DEFAULT_DIST_DIRNAME","injectedDirs","getInjectedDirs","dist","rootDirs","readBitRootsDir","rootDir","relative","componentDir","filePath","isFileSupported","compileResults","contents","push","base","result","Dist","outputPath","Buffer","from","outputText","shouldCopyNonSupportedFiles","filesToCompile","outputDir","getComponentPackagePath","exports","WorkspaceCompiler","envs","aspectLoader","ui","watcher","registerOnComponentChange","onComponentChange","bind","registerOnComponentAdd","onComponentAdd","registerOnPreWatch","onPreWatch","registerPreStart","onPreStart","registerOnAspectLoadErrorSlot","onAspectLoadFail","preStartOpts","skipCompilation","compileComponents","changed","verbose","CompilationInitiator","PreStart","watchScopeInternalFiles","code","AspectLoadFail","watchOpts","undefined","removedFiles","Boolean","removeLinksFromNodeModules","ComponentChanged","results","componentIds","preCompile","start","Date","now","PreWatch","end","consoleSuccess","componentsIds","OutsideWorkspaceError","getIdsToCompile","getManyOpts","loadSeedersAsAspects","components","getMany","grouped","groupByIsEnv","envsResults","runCompileComponents","otherResults","other","componentsCompilers","environment","getEnv","env","getCompiler","compilerName","name","warn","resultOnWorkspace","mapSeries","componentCompiler","envsIds","uniq","getEnvId","filter","envId","isCoreEnv","groupBy","includes","resolveMultipleComponentIds","filterIds","getNewAndModifiedIds","listIds"],"sources":["workspace-compiler.ts"],"sourcesContent":["/* eslint-disable max-classes-per-file */\nimport mapSeries from 'p-map-series';\nimport { Component } from '@teambit/component';\nimport { EnvsMain } from '@teambit/envs';\nimport type { PubsubMain } from '@teambit/pubsub';\nimport { SerializableResults, Workspace, OutsideWorkspaceError } from '@teambit/workspace';\nimport { WatcherMain, WatchOptions } from '@teambit/watcher';\nimport path from 'path';\nimport { ComponentID } from '@teambit/component-id';\nimport { Logger } from '@teambit/logger';\nimport loader from '@teambit/legacy/dist/cli/loader';\nimport { DEFAULT_DIST_DIRNAME } from '@teambit/legacy/dist/constants';\nimport { AbstractVinyl, Dist } from '@teambit/legacy/dist/consumer/component/sources';\nimport DataToPersist from '@teambit/legacy/dist/consumer/component/sources/data-to-persist';\nimport {\n linkToNodeModulesByComponents,\n removeLinksFromNodeModules,\n} from '@teambit/workspace.modules.node-modules-linker';\nimport { AspectLoaderMain } from '@teambit/aspect-loader';\nimport { DependencyResolverMain } from '@teambit/dependency-resolver';\nimport componentIdToPackageName from '@teambit/legacy/dist/utils/bit/component-id-to-package-name';\nimport RemovePath from '@teambit/legacy/dist/consumer/component/sources/remove-path';\nimport { UiMain } from '@teambit/ui';\nimport { readBitRootsDir } from '@teambit/bit-roots';\nimport { groupBy, uniq } from 'lodash';\nimport type { PreStartOpts } from '@teambit/ui';\nimport { PathOsBasedAbsolute, PathOsBasedRelative } from '@teambit/legacy/dist/utils/path';\nimport { MultiCompiler } from '@teambit/multi-compiler';\nimport { CompilerAspect } from './compiler.aspect';\nimport { CompilerErrorEvent, ComponentCompilationOnDoneEvent } from './events';\nimport { Compiler, CompilationInitiator } from './types';\n\nexport type BuildResult = { component: string; buildResults: string[] | null | undefined };\n\nexport type CompileOptions = {\n changed?: boolean; // compile only new and modified components\n verbose?: boolean; // show more data, such as, dist paths\n /**\n * whether the dist root dir should be deleted before writing new dists.\n * defaults to true for `bit compile` and false everywhere else, such as `bit watch` and `bit\n * start` to avoid webpack \"EINTR\" error.\n */\n deleteDistDir?: boolean;\n initiator: CompilationInitiator; // describes where the compilation is coming from\n // should we create links in node_modules for the compiled components (default = true)\n // this will link the source files, and create the package.json\n linkComponents?: boolean;\n};\n\nexport type CompileError = { path: string; error: Error };\n\nexport class ComponentCompiler {\n constructor(\n private pubsub: PubsubMain,\n private workspace: Workspace,\n private component: Component,\n private compilerInstance: Compiler,\n private compilerId: string,\n private logger: Logger,\n private dependencyResolver: DependencyResolverMain,\n private dists: Dist[] = [],\n private compileErrors: CompileError[] = []\n ) {}\n\n async compile(noThrow = true, options: CompileOptions): Promise<BuildResult> {\n let dataToPersist;\n const deleteDistDir = options.deleteDistDir ?? this.compilerInstance.deleteDistDir;\n // delete dist folder before transpilation (because some compilers (like ngPackagr) can generate files there during the compilation process)\n if (deleteDistDir) {\n dataToPersist = new DataToPersist();\n for (const distDir of await this.distDirs()) {\n dataToPersist.removePath(new RemovePath(distDir));\n }\n dataToPersist.addBasePath(this.workspace.path);\n await dataToPersist.persistAllToFS();\n }\n\n const compilers: Compiler[] = (this.compilerInstance as MultiCompiler).compilers\n ? (this.compilerInstance as MultiCompiler).compilers\n : [this.compilerInstance];\n const canTranspileFile = compilers.find((c) => c.transpileFile);\n const canTranspileComponent = compilers.find((c) => c.transpileComponent);\n\n if (canTranspileFile) {\n await Promise.all(\n this.component.filesystem.files.map((file: AbstractVinyl) => this.compileOneFile(file, options.initiator))\n );\n }\n\n if (canTranspileComponent) {\n await this.compileAllFiles(this.component, options.initiator);\n }\n\n if (!canTranspileFile && !canTranspileComponent) {\n throw new Error(\n `compiler ${this.compilerId.toString()} doesn't implement either \"transpileFile\" or \"transpileComponent\" methods`\n );\n }\n this.throwOnCompileErrors(noThrow);\n\n // writing the dists with `component.setDists(dists); component.dists.writeDists` is tricky\n // as it uses other base-paths and doesn't respect the new node-modules base path.\n dataToPersist = new DataToPersist();\n dataToPersist.addManyFiles(this.dists);\n dataToPersist.addBasePath(this.workspace.path);\n await dataToPersist.persistAllToFS();\n const linkComponents = options.linkComponents ?? true;\n if (linkComponents) {\n await linkToNodeModulesByComponents([this.component], this.workspace);\n }\n const buildResults = this.dists.map((distFile) => distFile.path);\n if (this.component.state._consumer.compiler) loader.succeed();\n this.pubsub.pub(\n CompilerAspect.id,\n new ComponentCompilationOnDoneEvent(this.compileErrors, this.component, buildResults)\n );\n return { component: this.component.id.toString(), buildResults };\n }\n\n private throwOnCompileErrors(noThrow = true) {\n if (this.compileErrors.length) {\n this.compileErrors.forEach((errorItem) => {\n this.logger.error(`compilation error at ${errorItem.path}`, errorItem.error);\n });\n const formatError = (errorItem) => `${errorItem.path}\\n${errorItem.error}`;\n const err = new Error(`compilation failed. see the following errors from the compiler\n${this.compileErrors.map(formatError).join('\\n')}`);\n\n this.pubsub.pub(CompilerAspect.id, new CompilerErrorEvent(err));\n\n if (!noThrow) {\n throw err;\n }\n\n this.logger.console(err.message);\n }\n }\n\n private async distDirs(): Promise<PathOsBasedRelative[]> {\n const packageName = componentIdToPackageName(this.component.state._consumer);\n const packageDir = path.join('node_modules', packageName);\n const distDirName = this.compilerInstance.getDistDir?.() || DEFAULT_DIST_DIRNAME;\n const injectedDirs = await this.getInjectedDirs(packageName);\n return [packageDir, ...injectedDirs].map((dist) => path.join(dist, distDirName));\n }\n\n private async getInjectedDirs(packageName: string): Promise<string[]> {\n const injectedDirs = await this.workspace.getInjectedDirs(this.component);\n if (injectedDirs.length > 0) return injectedDirs;\n\n const rootDirs = await readBitRootsDir(this.workspace.path);\n return rootDirs.map((rootDir) => path.relative(this.workspace.path, path.join(rootDir, packageName)));\n }\n\n private get componentDir(): PathOsBasedAbsolute {\n return this.workspace.componentDir(this.component.id);\n }\n\n private async compileOneFile(file: AbstractVinyl, initiator: CompilationInitiator): Promise<void> {\n const options = { componentDir: this.componentDir, filePath: file.relative, initiator };\n const isFileSupported = this.compilerInstance.isFileSupported(file.path);\n let compileResults;\n if (isFileSupported) {\n try {\n compileResults = await this.compilerInstance.transpileFile?.(file.contents.toString(), options);\n } catch (error: any) {\n this.compileErrors.push({ path: file.path, error });\n return;\n }\n }\n for (const base of await this.distDirs()) {\n if (isFileSupported && compileResults) {\n this.dists.push(\n ...compileResults.map(\n (result) =>\n new Dist({\n base,\n path: path.join(base, result.outputPath),\n contents: Buffer.from(result.outputText),\n })\n )\n );\n } else if (this.compilerInstance.shouldCopyNonSupportedFiles) {\n // compiler doesn't support this file type. copy the file as is to the dist dir.\n this.dists.push(new Dist({ base, path: path.join(base, file.relative), contents: file.contents }));\n }\n }\n }\n\n private async compileAllFiles(component: Component, initiator: CompilationInitiator): Promise<void> {\n const filesToCompile: AbstractVinyl[] = [];\n for (const base of await this.distDirs()) {\n component.filesystem.files.forEach((file: AbstractVinyl) => {\n const isFileSupported = this.compilerInstance.isFileSupported(file.path);\n if (isFileSupported) {\n filesToCompile.push(file);\n } else if (this.compilerInstance.shouldCopyNonSupportedFiles) {\n // compiler doesn't support this file type. copy the file as is to the dist dir.\n this.dists.push(\n new Dist({\n base,\n path: path.join(base, file.relative),\n contents: file.contents,\n })\n );\n }\n });\n }\n\n if (filesToCompile.length) {\n try {\n await this.compilerInstance.transpileComponent?.({\n component,\n componentDir: this.componentDir,\n outputDir: await this.workspace.getComponentPackagePath(component),\n initiator,\n });\n } catch (error: any) {\n this.compileErrors.push({ path: this.componentDir, error });\n }\n }\n }\n}\n\nexport class WorkspaceCompiler {\n constructor(\n private workspace: Workspace,\n private envs: EnvsMain,\n private pubsub: PubsubMain,\n private aspectLoader: AspectLoaderMain,\n private ui: UiMain,\n private logger: Logger,\n private dependencyResolver: DependencyResolverMain,\n private watcher: WatcherMain\n ) {\n if (this.workspace) {\n this.workspace.registerOnComponentChange(this.onComponentChange.bind(this));\n this.workspace.registerOnComponentAdd(this.onComponentAdd.bind(this));\n this.watcher.registerOnPreWatch(this.onPreWatch.bind(this));\n }\n this.ui.registerPreStart(this.onPreStart.bind(this));\n if (this.aspectLoader) {\n this.aspectLoader.registerOnAspectLoadErrorSlot(this.onAspectLoadFail.bind(this));\n }\n }\n\n async onPreStart(preStartOpts: PreStartOpts): Promise<void> {\n if (this.workspace) {\n if (preStartOpts.skipCompilation) {\n return;\n }\n await this.compileComponents([], {\n changed: true,\n verbose: false,\n deleteDistDir: false,\n initiator: CompilationInitiator.PreStart,\n });\n } else {\n await this.watcher.watchScopeInternalFiles();\n }\n }\n\n async onAspectLoadFail(err: Error & { code?: string }, id: ComponentID): Promise<boolean> {\n if (err.code && err.code === 'MODULE_NOT_FOUND' && this.workspace) {\n await this.compileComponents([id.toString()], { initiator: CompilationInitiator.AspectLoadFail }, true);\n return true;\n }\n return false;\n }\n\n async onComponentAdd(component: Component, files: string[], watchOpts: WatchOptions) {\n return this.onComponentChange(component, files, undefined, watchOpts);\n }\n\n async onComponentChange(\n component: Component,\n files: string[],\n removedFiles: string[] = [],\n watchOpts: WatchOptions\n ): Promise<SerializableResults | void> {\n if (!watchOpts.compile) return undefined;\n // when files are removed, we need to remove the dist directories and the old symlinks, otherwise, it has\n // symlinks to non-exist files and the dist has stale files\n const deleteDistDir = Boolean(removedFiles?.length);\n if (removedFiles?.length) {\n await removeLinksFromNodeModules(component, this.workspace, removedFiles);\n }\n const buildResults = await this.compileComponents(\n [component.id.toString()],\n { initiator: watchOpts.initiator || CompilationInitiator.ComponentChanged, deleteDistDir },\n true\n );\n // await linkToNodeModulesByComponents([component], this.workspace);\n return {\n results: buildResults,\n toString() {\n return `${buildResults[0]?.buildResults?.join('\\n\\t')}`;\n },\n };\n }\n\n async onPreWatch(componentIds: ComponentID[], watchOpts: WatchOptions) {\n if (watchOpts.preCompile) {\n const start = Date.now();\n this.logger.console(`compiling ${componentIds.length} components`);\n await this.compileComponents(\n componentIds.map((id) => id),\n { initiator: CompilationInitiator.PreWatch }\n );\n const end = Date.now() - start;\n this.logger.consoleSuccess(`compiled ${componentIds.length} components successfully (${end / 1000} sec)`);\n }\n }\n\n async compileComponents(\n componentsIds: string[] | ComponentID[] | ComponentID[], // when empty, it compiles new+modified (unless options.all is set),\n options: CompileOptions,\n noThrow?: boolean\n ): Promise<BuildResult[]> {\n if (!this.workspace) throw new OutsideWorkspaceError();\n const componentIds = await this.getIdsToCompile(componentsIds, options.changed);\n // In case the aspect failed to load, we want to compile it without try to re-load it again\n const getManyOpts =\n options.initiator === CompilationInitiator.AspectLoadFail ? { loadSeedersAsAspects: false } : undefined;\n const components = await this.workspace.getMany(componentIds, getManyOpts);\n\n const grouped = this.groupByIsEnv(components);\n const envsResults = grouped.envs ? await this.runCompileComponents(grouped.envs, options, noThrow) : [];\n const otherResults = grouped.other ? await this.runCompileComponents(grouped.other, options, noThrow) : [];\n return [...envsResults, ...otherResults];\n }\n\n private async runCompileComponents(\n components: Component[],\n options: CompileOptions,\n noThrow?: boolean\n ): Promise<BuildResult[]> {\n const componentsCompilers: ComponentCompiler[] = [];\n\n components.forEach((c) => {\n const environment = this.envs.getEnv(c).env;\n const compilerInstance = environment.getCompiler?.();\n\n if (compilerInstance) {\n const compilerName = compilerInstance.constructor.name || 'compiler';\n componentsCompilers.push(\n new ComponentCompiler(\n this.pubsub,\n this.workspace,\n c,\n compilerInstance,\n compilerName,\n this.logger,\n this.dependencyResolver\n )\n );\n } else {\n this.logger.warn(`unable to find a compiler instance for ${c.id.toString()}`);\n }\n });\n const resultOnWorkspace = await mapSeries(componentsCompilers, (componentCompiler) =>\n componentCompiler.compile(noThrow, options)\n );\n\n return resultOnWorkspace;\n }\n\n /**\n * This function get's a list of aspect ids and return them grouped by whether any of them is the env of other from the list\n * @param ids\n */\n groupByIsEnv(components: Component[]): { envs?: Component[]; other?: Component[] } {\n const envsIds = uniq(\n components\n .map((component) => this.envs.getEnvId(component))\n .filter((envId) => !this.aspectLoader.isCoreEnv(envId))\n );\n const grouped = groupBy(components, (component) => {\n if (envsIds.includes(component.id.toString())) return 'envs';\n return 'other';\n });\n return grouped as { envs: Component[]; other: Component[] };\n }\n\n private async getIdsToCompile(\n componentsIds: Array<string | ComponentID | ComponentID>,\n changed = false\n ): Promise<ComponentID[]> {\n if (componentsIds.length) {\n const componentIds = await this.workspace.resolveMultipleComponentIds(componentsIds);\n return this.workspace.filterIds(componentIds);\n }\n if (changed) {\n return this.workspace.getNewAndModifiedIds();\n }\n return this.workspace.listIds();\n }\n}\n"],"mappings":";;;;;;AACA,SAAAA,YAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,WAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAIA,SAAAG,WAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,UAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAI,MAAA;EAAA,MAAAJ,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAE,KA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I,SAAS,IAAK;MACjD,IAAI+J,OAAO,CAACO,QAAQ,CAACtK,SAAS,CAACmD,EAAE,CAACd,QAAQ,CAAC,CAAC,CAAC,EAAE,OAAO,MAAM;MAC5D,OAAO,OAAO;IAChB,CAAC,CAAC;IACF,OAAOyG,OAAO;EAChB;EAEA,MAAcL,eAAeA,CAC3BF,aAAwD,EACxDtB,OAAO,GAAG,KAAK,EACS;IACxB,IAAIsB,aAAa,CAAClF,MAAM,EAAE;MACxB,MAAM0E,YAAY,GAAG,MAAM,IAAI,CAAChI,SAAS,CAACwK,2BAA2B,CAAChC,aAAa,CAAC;MACpF,OAAO,IAAI,CAACxI,SAAS,CAACyK,SAAS,CAACzC,YAAY,CAAC;IAC/C;IACA,IAAId,OAAO,EAAE;MACX,OAAO,IAAI,CAAClH,SAAS,CAAC0K,oBAAoB,CAAC,CAAC;IAC9C;IACA,OAAO,IAAI,CAAC1K,SAAS,CAAC2K,OAAO,CAAC,CAAC;EACjC;AACF;AAAC7E,OAAA,CAAAC,iBAAA,GAAAA,iBAAA"}
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teambit/compiler",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.109",
|
|
4
4
|
"homepage": "https://bit.cloud/teambit/compilation/compiler",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"componentId": {
|
|
7
7
|
"scope": "teambit.compilation",
|
|
8
8
|
"name": "compiler",
|
|
9
|
-
"version": "1.0.
|
|
9
|
+
"version": "1.0.109"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"chalk": "2.4.2",
|
|
@@ -16,46 +16,42 @@
|
|
|
16
16
|
"ink": "3.2.0",
|
|
17
17
|
"lodash": "4.17.21",
|
|
18
18
|
"p-map-series": "2.1.0",
|
|
19
|
-
"core-js": "^3.0.0",
|
|
20
|
-
"@babel/runtime": "7.20.0",
|
|
21
19
|
"@teambit/harmony": "0.4.6",
|
|
22
20
|
"@teambit/component-id": "1.2.0",
|
|
23
21
|
"@teambit/bit-roots": "0.0.133",
|
|
24
22
|
"@teambit/bit-error": "0.0.404",
|
|
25
|
-
"@teambit/envs": "1.0.
|
|
26
|
-
"@teambit/cli": "0.0.
|
|
27
|
-
"@teambit/component": "1.0.
|
|
28
|
-
"@teambit/logger": "0.0.
|
|
29
|
-
"@teambit/pubsub": "1.0.
|
|
30
|
-
"@teambit/aspect-loader": "1.0.
|
|
31
|
-
"@teambit/builder": "1.0.
|
|
32
|
-
"@teambit/component-issues": "0.0.
|
|
33
|
-
"@teambit/dependency-resolver": "1.0.
|
|
34
|
-
"@teambit/generator": "1.0.
|
|
35
|
-
"@teambit/issues": "1.0.
|
|
36
|
-
"@teambit/ui": "1.0.
|
|
37
|
-
"@teambit/watcher": "1.0.
|
|
38
|
-
"@teambit/workspace": "1.0.
|
|
39
|
-
"@teambit/isolator": "1.0.
|
|
23
|
+
"@teambit/envs": "1.0.109",
|
|
24
|
+
"@teambit/cli": "0.0.841",
|
|
25
|
+
"@teambit/component": "1.0.109",
|
|
26
|
+
"@teambit/logger": "0.0.934",
|
|
27
|
+
"@teambit/pubsub": "1.0.109",
|
|
28
|
+
"@teambit/aspect-loader": "1.0.109",
|
|
29
|
+
"@teambit/builder": "1.0.109",
|
|
30
|
+
"@teambit/component-issues": "0.0.138",
|
|
31
|
+
"@teambit/dependency-resolver": "1.0.109",
|
|
32
|
+
"@teambit/generator": "1.0.110",
|
|
33
|
+
"@teambit/issues": "1.0.109",
|
|
34
|
+
"@teambit/ui": "1.0.109",
|
|
35
|
+
"@teambit/watcher": "1.0.109",
|
|
36
|
+
"@teambit/workspace": "1.0.109",
|
|
37
|
+
"@teambit/isolator": "1.0.109",
|
|
40
38
|
"@teambit/toolbox.fs.hard-link-directory": "0.0.19",
|
|
41
|
-
"@teambit/multi-compiler": "1.0.
|
|
42
|
-
"@teambit/workspace.modules.node-modules-linker": "0.0.
|
|
39
|
+
"@teambit/multi-compiler": "1.0.109",
|
|
40
|
+
"@teambit/workspace.modules.node-modules-linker": "0.0.159"
|
|
43
41
|
},
|
|
44
42
|
"devDependencies": {
|
|
45
|
-
"@types/react": "^17.0.8",
|
|
46
43
|
"@types/fs-extra": "9.0.7",
|
|
47
44
|
"@types/lodash": "4.14.165",
|
|
48
45
|
"@types/mocha": "9.1.0",
|
|
49
|
-
"@types/
|
|
50
|
-
"@types/
|
|
51
|
-
"@
|
|
52
|
-
"@
|
|
53
|
-
"@teambit/compilation.content.compiler-overview": "1.95.0"
|
|
46
|
+
"@types/jest": "^29.2.2",
|
|
47
|
+
"@types/testing-library__jest-dom": "^5.9.5",
|
|
48
|
+
"@teambit/compilation.content.compiler-overview": "1.95.0",
|
|
49
|
+
"@teambit/harmony.envs.core-aspect-env": "0.0.14"
|
|
54
50
|
},
|
|
55
51
|
"peerDependencies": {
|
|
56
|
-
"
|
|
57
|
-
"react": "^
|
|
58
|
-
"
|
|
52
|
+
"react": "^17.0.0 || ^18.0.0",
|
|
53
|
+
"@types/react": "^18.2.12",
|
|
54
|
+
"@teambit/legacy": "1.0.624"
|
|
59
55
|
},
|
|
60
56
|
"license": "Apache-2.0",
|
|
61
57
|
"optionalDependencies": {},
|
|
@@ -69,7 +65,7 @@
|
|
|
69
65
|
},
|
|
70
66
|
"private": false,
|
|
71
67
|
"engines": {
|
|
72
|
-
"node": ">=
|
|
68
|
+
"node": ">=16.0.0"
|
|
73
69
|
},
|
|
74
70
|
"repository": {
|
|
75
71
|
"type": "git",
|
|
@@ -78,12 +74,9 @@
|
|
|
78
74
|
"keywords": [
|
|
79
75
|
"bit",
|
|
80
76
|
"bit-aspect",
|
|
77
|
+
"bit-core-aspect",
|
|
81
78
|
"components",
|
|
82
79
|
"collaboration",
|
|
83
|
-
"web"
|
|
84
|
-
"react",
|
|
85
|
-
"react-components",
|
|
86
|
-
"angular",
|
|
87
|
-
"angular-components"
|
|
80
|
+
"web"
|
|
88
81
|
]
|
|
89
82
|
}
|
package/tsconfig.json
CHANGED
|
@@ -1,38 +1,33 @@
|
|
|
1
1
|
{
|
|
2
2
|
"compilerOptions": {
|
|
3
3
|
"lib": [
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
"DOM.Iterable",
|
|
8
|
-
"ScriptHost"
|
|
4
|
+
"esnext",
|
|
5
|
+
"dom",
|
|
6
|
+
"dom.Iterable"
|
|
9
7
|
],
|
|
10
|
-
"target": "
|
|
11
|
-
"module": "
|
|
12
|
-
"jsx": "react",
|
|
13
|
-
"allowJs": true,
|
|
14
|
-
"composite": true,
|
|
8
|
+
"target": "es2020",
|
|
9
|
+
"module": "es2020",
|
|
10
|
+
"jsx": "react-jsx",
|
|
15
11
|
"declaration": true,
|
|
16
12
|
"sourceMap": true,
|
|
17
|
-
"skipLibCheck": true,
|
|
18
13
|
"experimentalDecorators": true,
|
|
19
|
-
"
|
|
14
|
+
"skipLibCheck": true,
|
|
20
15
|
"moduleResolution": "node",
|
|
21
16
|
"esModuleInterop": true,
|
|
22
|
-
"rootDir": ".",
|
|
23
17
|
"resolveJsonModule": true,
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"strictPropertyInitialization": false,
|
|
28
|
-
"strict": true,
|
|
29
|
-
"noImplicitAny": false,
|
|
30
|
-
"preserveConstEnums": true
|
|
18
|
+
"allowJs": true,
|
|
19
|
+
"outDir": "dist",
|
|
20
|
+
"emitDeclarationOnly": true
|
|
31
21
|
},
|
|
32
22
|
"exclude": [
|
|
23
|
+
"artifacts",
|
|
24
|
+
"public",
|
|
33
25
|
"dist",
|
|
26
|
+
"node_modules",
|
|
27
|
+
"package.json",
|
|
34
28
|
"esm.mjs",
|
|
35
|
-
"
|
|
29
|
+
"**/*.cjs",
|
|
30
|
+
"./dist"
|
|
36
31
|
],
|
|
37
32
|
"include": [
|
|
38
33
|
"**/*",
|
package/types/asset.d.ts
CHANGED
|
@@ -5,12 +5,12 @@ declare module '*.png' {
|
|
|
5
5
|
declare module '*.svg' {
|
|
6
6
|
import type { FunctionComponent, SVGProps } from 'react';
|
|
7
7
|
|
|
8
|
-
export const ReactComponent: FunctionComponent<
|
|
8
|
+
export const ReactComponent: FunctionComponent<
|
|
9
|
+
SVGProps<SVGSVGElement> & { title?: string }
|
|
10
|
+
>;
|
|
9
11
|
const src: string;
|
|
10
12
|
export default src;
|
|
11
13
|
}
|
|
12
|
-
|
|
13
|
-
// @TODO Gilad
|
|
14
14
|
declare module '*.jpg' {
|
|
15
15
|
const value: any;
|
|
16
16
|
export = value;
|
|
@@ -27,3 +27,15 @@ declare module '*.bmp' {
|
|
|
27
27
|
const value: any;
|
|
28
28
|
export = value;
|
|
29
29
|
}
|
|
30
|
+
declare module '*.otf' {
|
|
31
|
+
const value: any;
|
|
32
|
+
export = value;
|
|
33
|
+
}
|
|
34
|
+
declare module '*.woff' {
|
|
35
|
+
const value: any;
|
|
36
|
+
export = value;
|
|
37
|
+
}
|
|
38
|
+
declare module '*.woff2' {
|
|
39
|
+
const value: any;
|
|
40
|
+
export = value;
|
|
41
|
+
}
|