@teambit/compiler 0.0.735 → 0.0.738
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/dist/compiler.aspect.js.map +1 -1
- package/dist/compiler.cmd.js.map +1 -1
- package/dist/compiler.composition.js.map +1 -1
- package/dist/compiler.main.runtime.js.map +1 -1
- package/dist/compiler.service.js.map +1 -1
- package/dist/compiler.task.js.map +1 -1
- package/dist/dist-artifact.js.map +1 -1
- package/dist/events/compiler-error.js.map +1 -1
- package/dist/events/component-compilation-on-done.js.map +1 -1
- package/dist/events/index.js.map +1 -1
- package/dist/exceptions/dist-artifact-not-found.js.map +1 -1
- package/dist/exceptions/index.js.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/output-formatter.js.map +1 -1
- package/dist/templates/compiler/files/aspect-file.js.map +1 -1
- package/dist/templates/compiler/files/compiler-file.js.map +1 -1
- package/dist/templates/compiler/files/index-file.js.map +1 -1
- package/dist/templates/compiler/files/main-runtime-file.js.map +1 -1
- package/dist/templates/compiler/index.js.map +1 -1
- package/dist/types.js.map +1 -1
- package/dist/workspace-compiler.js.map +1 -1
- package/package-tar/teambit-compiler-0.0.738.tgz +0 -0
- package/package.json +12 -12
- package/{preview-1652808661748.js → preview-1653227849497.js} +2 -2
- package/tsconfig.json +1 -1
- package/package-tar/teambit-compiler-0.0.735.tgz +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"names":["CompilerAspect","Aspect","create","id"],"sources":["compiler.aspect.ts"],"sourcesContent":["import { Aspect } from '@teambit/harmony';\n\nexport const CompilerAspect = Aspect.create({\n id: 'teambit.compilation/compiler',\n});\n"],"mappings":";;;;;;;AAAA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAEO,MAAMA,cAAc,GAAGC,iBAAA,CAAOC,MAAP,CAAc;EAC1CC,EAAE,EAAE;AADsC,CAAd,CAAvB"}
|
package/dist/compiler.cmd.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"names":["CompileCmd","constructor","compile","logger","pubsub","report","components","compilerOptions","startTimestamp","process","hrtime","setStatusLine","sub","CompilerAspect","id","onComponentCompilationDone","bind","outputString","compileComponents","initiator","CompilationInitiator","CmdReport","compileTimeLength","chalk","underline","formatCompileResults","componentsStatus","verbose","getStatusLine","clearStatusLine","data","code","getExitCode","json","deleteDistDir","compileResults","CmdJson","failedComponents","filter","component","errors","length","getSummaryIcon","green","red","yellow","numberOfComponents","numberOfFailingComponents","numberOfSuccessfulComponents","icon","summaryLine","prettyTime","event","type","ComponentCompilationOnDoneEvent","TYPE","push"],"sources":["compiler.cmd.ts"],"sourcesContent":["import { Command, CommandOptions } from '@teambit/cli';\nimport { Logger } from '@teambit/logger';\nimport type { PubsubMain, BitBaseEvent } from '@teambit/pubsub';\nimport chalk from 'chalk';\nimport prettyTime from 'pretty-time';\nimport { Component } from '@teambit/component';\nimport { formatCompileResults } from './output-formatter';\nimport { CompileError, WorkspaceCompiler, CompileOptions } from './workspace-compiler';\nimport { CompilationInitiator } from './types';\n\n// IDs & events\nimport { CompilerAspect } from './compiler.aspect';\nimport { ComponentCompilationOnDoneEvent } from './events';\n\nexport type ComponentsStatus = {\n buildResults: string[];\n component: Component;\n errors: CompileError[];\n};\n\nexport class CompileCmd implements Command {\n componentsStatus: ComponentsStatus[] = [];\n name = 'compile [component...]';\n description = 'compile components in the development workspace';\n alias = '';\n group = 'development';\n options = [\n ['c', 'changed', 'compile only new and modified components'],\n ['v', 'verbose', 'show more data, such as, dist paths'],\n ['j', 'json', 'return the compile results in json format'],\n ['d', 'delete-dist-dir', 'delete existing dist folder before writing new compiled files'],\n ] as CommandOptions;\n\n constructor(private compile: WorkspaceCompiler, private logger: Logger, private pubsub: PubsubMain) {}\n\n async report([components = []]: [string[]], compilerOptions: CompileOptions) {\n const startTimestamp = process.hrtime();\n this.logger.setStatusLine('Compiling your components, hold tight.');\n this.pubsub.sub(CompilerAspect.id, this.onComponentCompilationDone.bind(this));\n\n let outputString = '';\n await this.compile.compileComponents(components, {\n ...compilerOptions,\n initiator: CompilationInitiator.CmdReport,\n });\n const compileTimeLength = process.hrtime(startTimestamp);\n\n outputString += '\\n';\n outputString += ` ${chalk.underline('STATUS')}\\t${chalk.underline('COMPONENT ID')}\\n`;\n outputString += formatCompileResults(this.componentsStatus, !!compilerOptions.verbose);\n outputString += '\\n';\n\n outputString += this.getStatusLine(this.componentsStatus, compileTimeLength);\n\n this.logger.clearStatusLine();\n\n return {\n data: outputString,\n code: this.getExitCode(this.componentsStatus),\n };\n }\n\n async json([components]: [string[]], compilerOptions: CompileOptions) {\n compilerOptions.deleteDistDir = true;\n // @ts-ignore\n const compileResults = await this.compile.compileComponents(components, {\n ...compilerOptions,\n initiator: CompilationInitiator.CmdJson,\n });\n return {\n data: compileResults,\n // @todo: fix the code once compile is ready.\n code: 0,\n };\n }\n\n private failedComponents(componentsStatus: ComponentsStatus[]): ComponentsStatus[] {\n return componentsStatus.filter((component) => component.errors.length);\n }\n\n private getSummaryIcon(componentsStatus: ComponentsStatus[]) {\n switch (this.failedComponents(componentsStatus).length) {\n case 0:\n return chalk.green('✔');\n case componentsStatus.length:\n return chalk.red('✗');\n default:\n return chalk.yellow('⍻');\n }\n }\n\n private getExitCode(componentsStatus: ComponentsStatus[]) {\n return this.failedComponents(componentsStatus).length ? 1 : 0;\n }\n\n private getStatusLine(componentsStatus: ComponentsStatus[], compileTimeLength) {\n const numberOfComponents = componentsStatus.length;\n const numberOfFailingComponents = this.failedComponents(componentsStatus).length;\n const numberOfSuccessfulComponents = componentsStatus.filter((component) => !component.errors.length).length;\n\n const icon = this.getSummaryIcon(componentsStatus);\n const summaryLine = numberOfFailingComponents\n ? `${icon} ${numberOfFailingComponents}/${numberOfComponents} components failed to compile.`\n : `${icon} ${numberOfSuccessfulComponents}/${numberOfComponents} components compiled successfully.`;\n\n return `${summaryLine}\\nFinished. (${prettyTime(compileTimeLength)})`;\n }\n\n private onComponentCompilationDone(event: BitBaseEvent<any>) {\n if (event.type === ComponentCompilationOnDoneEvent.TYPE) {\n this.componentsStatus.push(event.data);\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAGA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAEA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAEA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAGA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;;;;;AAQO,MAAMA,UAAN,CAAoC;EAazCC,WAAW,CAASC,OAAT,EAA6CC,MAA7C,EAAqEC,MAArE,EAAyF;IAAA,KAAhFF,OAAgF,GAAhFA,OAAgF;IAAA,KAA5CC,MAA4C,GAA5CA,MAA4C;IAAA,KAApBC,MAAoB,GAApBA,MAAoB;IAAA,0DAZ7D,EAY6D;IAAA,8CAX7F,wBAW6F;IAAA,qDAVtF,iDAUsF;IAAA,+CAT5F,EAS4F;IAAA,+CAR5F,aAQ4F;IAAA,iDAP1F,CACR,CAAC,GAAD,EAAM,SAAN,EAAiB,0CAAjB,CADQ,EAER,CAAC,GAAD,EAAM,SAAN,EAAiB,qCAAjB,CAFQ,EAGR,CAAC,GAAD,EAAM,MAAN,EAAc,2CAAd,CAHQ,EAIR,CAAC,GAAD,EAAM,iBAAN,EAAyB,+DAAzB,CAJQ,CAO0F;EAAE;;EAE1F,MAANC,MAAM,CAAC,CAACC,UAAU,GAAG,EAAd,CAAD,EAAgCC,eAAhC,EAAiE;IAC3E,MAAMC,cAAc,GAAGC,OAAO,CAACC,MAAR,EAAvB;IACA,KAAKP,MAAL,CAAYQ,aAAZ,CAA0B,wCAA1B;IACA,KAAKP,MAAL,CAAYQ,GAAZ,CAAgBC,0BAAA,CAAeC,EA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B,IAAtB,CAA2BJ,KAAK,CAACtB,IAAjC;IACD;EACF;;AA5FwC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"names":["Logo","height","display","justifyContent","width"],"sources":["compiler.composition.tsx"],"sourcesContent":["import React from 'react';\n\nexport const Logo = () => (\n <div style={{ height: '100%', display: 'flex', justifyContent: 'center' }}>\n <img style={{ width: 70 }} src=\"https://static.bit.dev/extensions-icons/compiler.svg\" />\n </div>\n);\n"],"mappings":";;;;;;;;;AAAA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAEO,MAAMA,IAAI,GAAG,mBAClB;EAAK,KAAK,EAAE;IAAEC,MAAM,EAAE,MAAV;IAAkBC,OAAO,EAAE,MAA3B;IAAmCC,cAAc,EAAE;EAAnD;AAAZ,gBACE;EAAK,KAAK,EAAE;IAAEC,KAAK,EAAE;EAAT,CAAZ;EAA2B,GAAG,EAAC;AAA/B,EADF,CADK"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["compiler.main.runtime.ts"],"names":["CompilerMain","constructor","pubsub","workspaceCompiler","envs","builder","workspace","compileOnWorkspace","componentsIds","options","initiator","CompilationInitiator","ComponentAdded","compileComponents","createTask","name","compiler","CompilerTask","CompilerAspect","id","getDistPathBySrcPath","component","srcPath","environment","getEnv","env","compilerInstance","getCompiler","getRelativeDistFolder","getOrCalculateEnv","DEFAULT_DIST_DIRNAME","getDistDir","isDistDirExists","packageDir","getComponentPackagePath","distDir","pathToCheck","path","join","fs","existsSync","getDistsFiles","artifacts","getArtifactsVinylByExtension","length","DistArtifactNotFound","DistArtifact","addMissingDistsIssue","exist","state","issues","getOrCreate","IssuesClasses","MissingDists","data","undefined","provider","cli","loggerMain","aspectLoader","ui","generator","logger","createLogger","WorkspaceCompiler","registerService","CompilerService","compilerMain","register","CompileCmd","onComponentLoad","bind","registerComponentTemplate","compilerTemplate","ManyComponentsWriter","externalCompiler","MainRuntime","CL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X,CAAwB7C,2BAAeC,EAAvC,CAAf;AACA,UAAMhB,iBAAiB,GAAG,KAAI6D,sCAAJ,EAAsB1D,SAAtB,EAAiCF,IAAjC,EAAuCF,MAAvC,EAA+CyD,YAA/C,EAA6DC,EAA7D,EAAiEE,MAAjE,CAA1B;AACA1D,IAAAA,IAAI,CAAC6D,eAAL,CAAqB,KAAIC,4BAAJ,GAArB;AACA,UAAMC,YAAY,GAAG,IAAInE,YAAJ,CAAiBE,MAAjB,EAAyBC,iBAAzB,EAA4CC,IAA5C,EAAkDC,OAAlD,EAA2DC,SAA3D,CAArB;AACAmD,IAAAA,GAAG,CAACW,QAAJ,CAAa,KAAIC,uBAAJ,EAAelE,iBAAf,EAAkC2D,MAAlC,EAA0C5D,MAA1C,CAAb;;AACA,QAAII,SAAJ,EAAe;AACbA,MAAAA,SAAS,CAACgE,eAAV,CAA0BH,YAAY,CAACpB,oBAAb,CAAkCwB,IAAlC,CAAuCJ,YAAvC,CAA1B;AACD;;AACDN,IAAAA,SAAS,CAACW,yBAAV,CAAoC,CAACC,6BAAD,CAApC;AACAC,oCAAqBC,gBAArB,GAAwCR,YAAY,CAAC5D,kBAAb,CAAgCgE,IAAhC,CAAqCJ,YAArC,CAAxC;AAEA,WAAOA,YAAP;AACD;;AA/GuB;;;gCAAbnE,Y,aA0EM4E,kB;gCA1EN5E,Y,kBA4EW,CACpB6E,gBADoB,EAEpBC,4BAFoB,EAGpBC,kBAHoB,EAIpBC,sBAJoB,EAKpBC,sBALoB,EAMpBC,uBANoB,EAOpBC,wBAPoB,EAQpBC,aARoB,EASpBC,4BAToB,C;;AAsCxBnE,2BAAeoE,UAAf,CAA0BtF,YAA1B","sourcesContent":["import * as path from 'path';\nimport fs from 'fs-extra';\nimport AspectLoaderAspect, { AspectLoaderMain } from '@teambit/aspect-loader';\nimport { BuilderAspect, BuilderMain } from '@teambit/builder';\nimport { CLIAspect, CLIMain, MainRuntime } from '@teambit/cli';\nimport { IssuesClasses } from '@teambit/component-issues';\nimport { Component, ComponentID } from '@teambit/component';\nimport { DEFAULT_DIST_DIRNAME } from '@teambit/legacy/dist/constants';\nimport { EnvsAspect, EnvsMain } from '@teambit/envs';\nimport { BitId } from '@teambit/legacy-bit-id';\nimport ManyComponentsWriter from '@teambit/legacy/dist/consumer/component-ops/many-components-writer';\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 ) {}\n\n /**\n * Run compilation on `bit new` and when new components are imported\n */\n compileOnWorkspace(\n componentsIds: string[] | BitId[] | ComponentID[] = [], // when empty, it compiles all\n options: CompileOptions = { initiator: CompilationInitiator.ComponentAdded }\n ) {\n return this.workspaceCompiler.compileComponents(componentsIds, options);\n }\n /**\n * API to create a new compiler task, it facilitates the usage of multiple compilers.\n * with this method you can create any number of compilers and add them to the buildPipeline.\n */\n createTask(name: string, compiler: Compiler): CompilerTask {\n return new CompilerTask(CompilerAspect.id, name, compiler);\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 = environment.getCompiler?.();\n if (!compilerInstance) return DEFAULT_DIST_DIRNAME;\n return compilerInstance.getDistDir();\n }\n\n /**\n * Check if the dist folder (in the component package under node_modules) exist\n * @param component\n * @returns\n */\n isDistDirExists(component: Component): boolean {\n const packageDir = this.workspace.getComponentPackagePath(component);\n const distDir = this.getRelativeDistFolder(component);\n const pathToCheck = path.join(packageDir, distDir);\n return fs.existsSync(pathToCheck);\n }\n\n async getDistsFiles(component: Component): Promise<DistArtifact> {\n const artifacts = await this.builder.getArtifactsVinylByExtension(component, CompilerAspect.id);\n if (!artifacts.length) throw new DistArtifactNotFound(component.id);\n\n return new DistArtifact(artifacts);\n }\n\n async addMissingDistsIssue(component: Component) {\n const exist = this.isDistDirExists(component);\n if (!exist) {\n component.state.issues.getOrCreate(IssuesClasses.MissingDists).data = true;\n }\n // we don't want to add any data to the compiler aspect, only to add issues on the component\n return undefined;\n }\n\n static runtime = MainRuntime;\n\n static dependencies = [\n CLIAspect,\n WorkspaceAspect,\n EnvsAspect,\n LoggerAspect,\n PubsubAspect,\n AspectLoaderAspect,\n BuilderAspect,\n UIAspect,\n GeneratorAspect,\n ];\n\n static async provider([cli, workspace, envs, loggerMain, pubsub, aspectLoader, builder, ui, generator]: [\n CLIMain,\n Workspace,\n EnvsMain,\n LoggerMain,\n PubsubMain,\n AspectLoaderMain,\n BuilderMain,\n UiMain,\n GeneratorMain\n ]) {\n const logger = loggerMain.createLogger(CompilerAspect.id);\n const workspaceCompiler = new WorkspaceCompiler(workspace, envs, pubsub, aspectLoader, ui, logger);\n envs.registerService(new CompilerService());\n const compilerMain = new CompilerMain(pubsub, workspaceCompiler, envs, builder, workspace);\n cli.register(new CompileCmd(workspaceCompiler, logger, pubsub));\n if (workspace) {\n workspace.onComponentLoad(compilerMain.addMissingDistsIssue.bind(compilerMain));\n }\n generator.registerComponentTemplate([compilerTemplate]);\n ManyComponentsWriter.externalCompiler = compilerMain.compileOnWorkspace.bind(compilerMain);\n\n return compilerMain;\n }\n}\n\nCompilerAspect.addRuntime(CompilerMain);\n"]}
|
|
1
|
+
{"version":3,"names":["CompilerMain","constructor","pubsub","workspaceCompiler","envs","builder","workspace","compileOnWorkspace","componentsIds","options","initiator","CompilationInitiator","ComponentAdded","compileComponents","createTask","name","compiler","CompilerTask","CompilerAspect","id","getDistPathBySrcPath","component","srcPath","environment","getEnv","env","compilerInstance","getCompiler","getRelativeDistFolder","getOrCalculateEnv","DEFAULT_DIST_DIRNAME","getDistDir","isDistDirExists","packageDir","getComponentPackagePath","distDir","pathToCheck","path","join","fs","existsSync","getDistsFiles","artifacts","getArtifactsVinylByExtension","length","DistArtifactNotFound","DistArtifact","addMissingDistsIssue","exist","state","issues","getOrCreate","IssuesClasses","MissingDists","data","undefined","provider","cli","loggerMain","aspectLoader","ui","generator","logger","createLogger","WorkspaceCompiler","registerService","CompilerService","compilerMain","register","CompileCmd","onComponentLoad","bind","registerComponentTemplate","compilerTemplate","ManyComponentsWriter","externalCompiler","MainRuntime","CLIAspect","WorkspaceAspect","EnvsAspect","LoggerAspect","PubsubAspect","AspectLoaderAspect","BuilderAspect","UIAspect","GeneratorAspect","addRuntime"],"sources":["compiler.main.runtime.ts"],"sourcesContent":["import * as path from 'path';\nimport fs from 'fs-extra';\nimport AspectLoaderAspect, { AspectLoaderMain } from '@teambit/aspect-loader';\nimport { BuilderAspect, BuilderMain } from '@teambit/builder';\nimport { CLIAspect, CLIMain, MainRuntime } from '@teambit/cli';\nimport { IssuesClasses } from '@teambit/component-issues';\nimport { Component, ComponentID } from '@teambit/component';\nimport { DEFAULT_DIST_DIRNAME } from '@teambit/legacy/dist/constants';\nimport { EnvsAspect, EnvsMain } from '@teambit/envs';\nimport { BitId } from '@teambit/legacy-bit-id';\nimport ManyComponentsWriter from '@teambit/legacy/dist/consumer/component-ops/many-components-writer';\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 ) {}\n\n /**\n * Run compilation on `bit new` and when new components are imported\n */\n compileOnWorkspace(\n componentsIds: string[] | BitId[] | ComponentID[] = [], // when empty, it compiles all\n options: CompileOptions = { initiator: CompilationInitiator.ComponentAdded }\n ) {\n return this.workspaceCompiler.compileComponents(componentsIds, options);\n }\n /**\n * API to create a new compiler task, it facilitates the usage of multiple compilers.\n * with this method you can create any number of compilers and add them to the buildPipeline.\n */\n createTask(name: string, compiler: Compiler): CompilerTask {\n return new CompilerTask(CompilerAspect.id, name, compiler);\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 = environment.getCompiler?.();\n if (!compilerInstance) return DEFAULT_DIST_DIRNAME;\n return compilerInstance.getDistDir();\n }\n\n /**\n * Check if the dist folder (in the component package under node_modules) exist\n * @param component\n * @returns\n */\n isDistDirExists(component: Component): boolean {\n const packageDir = this.workspace.getComponentPackagePath(component);\n const distDir = this.getRelativeDistFolder(component);\n const pathToCheck = path.join(packageDir, distDir);\n return fs.existsSync(pathToCheck);\n }\n\n async getDistsFiles(component: Component): Promise<DistArtifact> {\n const artifacts = await this.builder.getArtifactsVinylByExtension(component, CompilerAspect.id);\n if (!artifacts.length) throw new DistArtifactNotFound(component.id);\n\n return new DistArtifact(artifacts);\n }\n\n async addMissingDistsIssue(component: Component) {\n const exist = this.isDistDirExists(component);\n if (!exist) {\n component.state.issues.getOrCreate(IssuesClasses.MissingDists).data = true;\n }\n // we don't want to add any data to the compiler aspect, only to add issues on the component\n return undefined;\n }\n\n static runtime = MainRuntime;\n\n static dependencies = [\n CLIAspect,\n WorkspaceAspect,\n EnvsAspect,\n LoggerAspect,\n PubsubAspect,\n AspectLoaderAspect,\n BuilderAspect,\n UIAspect,\n GeneratorAspect,\n ];\n\n static async provider([cli, workspace, envs, loggerMain, pubsub, aspectLoader, builder, ui, generator]: [\n CLIMain,\n Workspace,\n EnvsMain,\n LoggerMain,\n PubsubMain,\n AspectLoaderMain,\n BuilderMain,\n UiMain,\n GeneratorMain\n ]) {\n const logger = loggerMain.createLogger(CompilerAspect.id);\n const workspaceCompiler = new WorkspaceCompiler(workspace, envs, pubsub, aspectLoader, ui, logger);\n envs.registerService(new CompilerService());\n const compilerMain = new CompilerMain(pubsub, workspaceCompiler, envs, builder, workspace);\n cli.register(new CompileCmd(workspaceCompiler, logger, pubsub));\n if (workspace) {\n workspace.onComponentLoad(compilerMain.addMissingDistsIssue.bind(compilerMain));\n }\n generator.registerComponentTemplate([compilerTemplate]);\n ManyComponentsWriter.externalCompiler = compilerMain.compileOnWorkspace.bind(compilerMain);\n\n return compilerMain;\n }\n}\n\nCompilerAspect.addRuntime(CompilerMain);\n"],"mappings":";;;;;;;;;;;;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A6DC,EAA7D,EAAiEE,MAAjE,CAA1B;IACA1D,IAAI,CAAC6D,eAAL,CAAqB,KAAIC,4BAAJ,GAArB;IACA,MAAMC,YAAY,GAAG,IAAInE,YAAJ,CAAiBE,MAAjB,EAAyBC,iBAAzB,EAA4CC,IAA5C,EAAkDC,OAAlD,EAA2DC,SAA3D,CAArB;IACAmD,GAAG,CAACW,QAAJ,CAAa,KAAIC,uBAAJ,EAAelE,iBAAf,EAAkC2D,MAAlC,EAA0C5D,MAA1C,CAAb;;IACA,IAAII,SAAJ,EAAe;MACbA,SAAS,CAACgE,eAAV,CAA0BH,YAAY,CAACpB,oBAAb,CAAkCwB,IAAlC,CAAuCJ,YAAvC,CAA1B;IACD;;IACDN,SAAS,CAACW,yBAAV,CAAoC,CAACC,6BAAD,CAApC;IACAC,+BAAA,CAAqBC,gBAArB,GAAwCR,YAAY,CAAC5D,kBAAb,CAAgCgE,IAAhC,CAAqCJ,YAArC,CAAxC;IAEA,OAAOA,YAAP;EACD;;AA/GuB;;;gCAAbnE,Y,aA0EM4E,kB;gCA1EN5E,Y,kBA4EW,CACpB6E,gBADoB,EAEpBC,4BAFoB,EAGpBC,kBAHoB,EAIpBC,sBAJoB,EAKpBC,sBALoB,EAMpBC,uBANoB,EAOpBC,wBAPoB,EAQpBC,aARoB,EASpBC,4BAToB,C;;AAsCxBnE,0BAAA,CAAeoE,UAAf,CAA0BtF,YAA1B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"names":["CompilerService","render","env","descriptor","getDescriptor","id","displayName","version","config","highlight","language","ignoreIllegals","getCompiler","undefined","compiler","icon","displayConfig"],"sources":["compiler.service.tsx"],"sourcesContent":["import React from 'react';\nimport { Text, Newline } from 'ink';\nimport { EnvService, EnvDefinition } from '@teambit/envs';\nimport highlight from 'cli-highlight';\n\nexport type CompilerDescriptor = {\n id: string;\n icon?: string;\n config?: string;\n};\n\nexport class CompilerService implements EnvService<{}, CompilerDescriptor> {\n name = 'Compile';\n\n render(env: EnvDefinition) {\n const descriptor = this.getDescriptor(env);\n\n return (\n <Text key={descriptor?.id}>\n <Text color=\"cyan\">configured compiler: </Text>\n <Text>\n {descriptor?.id} ({descriptor?.displayName} @ {descriptor?.version})\n </Text>\n <Newline />\n <Text color=\"cyan\">compiler config:</Text>\n <Newline />\n <Text>\n {descriptor?.config && highlight(descriptor?.config, { language: 'javascript', ignoreIllegals: true })}\n </Text>\n <Newline />\n </Text>\n );\n }\n\n getDescriptor(env: EnvDefinition) {\n if (!env.env.getCompiler) return undefined;\n const compiler = env.env.getCompiler();\n\n return {\n id: compiler.id,\n icon: compiler.icon,\n config: compiler.displayConfig ? compiler.displayConfig() : undefined,\n version: compiler.version ? compiler.version() : '?',\n displayName: compiler.displayName ? compiler.displayName : '?',\n };\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAEA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAQO,MAAMA,eAAN,CAAoE;EAAA;IAAA,8CAClE,SADkE;EAAA;;EAGzEC,MAAM,CAACC,GAAD,EAAqB;IACzB,MAAMC,UAAU,GAAG,KAAKC,aAAL,CAAmBF,GAAnB,CAAnB;IAEA,oBACE,+BAAC,WAAD;MAAM,GAAG,EAAEC,UAAF,aAAEA,UAAF,uBAAEA,UAAU,CAAEE;IAAvB,gBACE,+BAAC,WAAD;MAAM,KAAK,EAAC;IAAZ,2BADF,eAEE,+BAAC,WAAD,QACGF,UADH,aACGA,UADH,uBACGA,UAAU,CAAEE,EADf,QACqBF,UADrB,aACqBA,UADrB,uBACqBA,UAAU,CAAEG,WADjC,SACiDH,UADjD,aACiDA,UADjD,uBACiDA,UAAU,CAAEI,OAD7D,MAFF,eAKE,+BAAC,cAAD,OALF,eAME,+BAAC,WAAD;MAAM,KAAK,EAAC;IAAZ,sBANF,eAOE,+BAAC,cAAD,OAPF,eAQE,+BAAC,WAAD,QACG,CAAAJ,UAAU,SAAV,IAAAA,UAAU,WAAV,YAAAA,UAAU,CAAEK,MAAZ,KAAsB,IAAAC,uBAAA,EAAUN,UAAV,aAAUA,UAAV,uBAAUA,UAAU,CAAEK,MAAtB,EAA8B;MAAEE,QAAQ,EAAE,YAAZ;MAA0BC,cAAc,EAAE;IAA1C,CAA9B,CADzB,CARF,eAWE,+BAAC,cAAD,OAXF,CADF;EAeD;;EAEDP,aAAa,CAACF,GAAD,EAAqB;IAChC,IAAI,CAACA,GAAG,CAACA,GAAJ,CAAQU,WAAb,EAA0B,OAAOC,SAAP;IAC1B,MAAMC,QAAQ,GAAGZ,GAAG,CAACA,GAAJ,CAAQU,WAAR,EAAjB;IAEA,OAAO;MACLP,EAAE,EAAES,QAAQ,CAACT,EADR;MAELU,IAAI,EAAED,QAAQ,CAACC,IAFV;MAGLP,MAAM,EAAEM,QAAQ,CAACE,aAAT,GAAyBF,QAAQ,CAACE,aAAT,EAAzB,GAAoDH,SAHvD;MAILN,OAAO,EAAEO,QAAQ,CAACP,OAAT,GAAmBO,QAAQ,CAACP,OAAT,EAAnB,GAAwC,GAJ5C;MAKLD,WAAW,EAAEQ,QAAQ,CAACR,WAAT,GAAuBQ,QAAQ,CAACR,WAAhC,GAA8C;IALtD,CAAP;EAOD;;AAlCwE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"names":["CompilerTask","constructor","aspectId","name","compilerInstance","artifactName","description","preBuild","context","Promise","all","capsuleNetwork","seedersCapsules","map","capsule","copyNonSupportedFiles","execute","buildResults","build","postBuild","tasksResults","compiler","shouldCopyNonSupportedFiles","component","filesystem","files","file","isFileSupported","path","content","contents","fs","outputFile","join","distDir","relative"],"sources":["compiler.task.ts"],"sourcesContent":["import { BuildContext, BuiltTaskResult, BuildTask, TaskResultsList } from '@teambit/builder';\nimport { Capsule } from '@teambit/isolator';\nimport fs from 'fs-extra';\nimport path from 'path';\n\nimport { Compiler } from './types';\n\n/**\n * compiler build task. Allows to compile components during component build.\n */\nexport class CompilerTask implements BuildTask {\n readonly description = 'compile components';\n constructor(readonly aspectId: string, readonly name: string, private compilerInstance: Compiler) {\n if (compilerInstance.artifactName) {\n this.description += ` for artifact ${compilerInstance.artifactName}`;\n }\n }\n\n async preBuild(context: BuildContext) {\n await Promise.all(\n context.capsuleNetwork.seedersCapsules.map((capsule) =>\n this.copyNonSupportedFiles(capsule, this.compilerInstance)\n )\n );\n if (!this.compilerInstance.preBuild) return;\n await this.compilerInstance.preBuild(context);\n }\n\n async execute(context: BuildContext): Promise<BuiltTaskResult> {\n const buildResults = await this.compilerInstance.build(context);\n return buildResults;\n }\n\n async postBuild?(context: BuildContext, tasksResults: TaskResultsList): Promise<void> {\n if (!this.compilerInstance.postBuild) return;\n await this.compilerInstance.postBuild(context, tasksResults);\n }\n\n async copyNonSupportedFiles(capsule: Capsule, compiler: Compiler) {\n if (!compiler.shouldCopyNonSupportedFiles) {\n return;\n }\n const component = capsule.component;\n await Promise.all(\n component.filesystem.files.map(async (file) => {\n if (compiler.isFileSupported(file.path)) return;\n const content = file.contents;\n await fs.outputFile(path.join(capsule.path, compiler.distDir, file.relative), content);\n })\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAEA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAIA;AACA;AACA;AACO,MAAMA,YAAN,CAAwC;EAE7CC,WAAW,CAAUC,QAAV,EAAqCC,IAArC,EAA2DC,gBAA3D,EAAuF;IAAA,KAA7EF,QAA6E,GAA7EA,QAA6E;IAAA,KAAlDC,IAAkD,GAAlDA,IAAkD;IAAA,KAA5BC,gBAA4B,GAA5BA,gBAA4B;IAAA,qDAD3E,oBAC2E;;IAChG,IAAIA,gBAAgB,CAACC,YAArB,EAAmC;MACjC,KAAKC,W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P,QAAQ,CAACa,OAAjC,EAA0CR,IAAI,CAACS,QAA/C,CAAd,EAAwEN,OAAxE,CAAN;IACD,CAJD,CADI,CAAN;EAOD;;AAxC4C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"names":["DistArtifact","constructor","artifacts","getFile","path","find","file","pathNormalizeToLinux","relative"],"sources":["dist-artifact.ts"],"sourcesContent":["import { AbstractVinyl } from '@teambit/legacy/dist/consumer/component/sources';\nimport { pathNormalizeToLinux } from '@teambit/legacy/dist/utils';\n\nexport class DistArtifact {\n constructor(private artifacts: AbstractVinyl[]) {}\n\n getFile(path: string) {\n return this.artifacts.find((file) => {\n return pathNormalizeToLinux(file.relative) === path;\n });\n }\n}\n"],"mappings":";;;;;;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAEO,MAAMA,YAAN,CAAmB;EACxBC,WAAW,CAASC,SAAT,EAAqC;IAAA,KAA5BA,SAA4B,GAA5BA,SAA4B;EAAE;;EAElDC,OAAO,CAACC,IAAD,EAAe;IACpB,OAAO,KAAKF,SAAL,CAAeG,IAAf,CAAqBC,IAAD,IAAU;MACnC,OAAO,IAAAC,6BAAA,EAAqBD,IAAI,CAACE,QAA1B,MAAwCJ,IAA/C;IACD,CAFM,CAAP;EAGD;;AAPuB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"names":["CompilerErrorEventData","constructor","error","CompilerErrorEvent","BitBaseEvent","timestamp","Date","now","TYPE"],"sources":["compiler-error.ts"],"sourcesContent":["/* eslint-disable max-classes-per-file */\nimport { BitBaseEvent } from '@teambit/pubsub';\n\nclass CompilerErrorEventData {\n constructor(readonly error: any) {}\n}\n\nexport class CompilerErrorEvent extends BitBaseEvent<CompilerErrorEventData> {\n static readonly TYPE = 'compiler-error';\n\n constructor(readonly error, readonly timestamp = Date.now()) {\n super(CompilerErrorEvent.TYPE, '0.0.1', timestamp, new CompilerErrorEventData(error));\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AADA;AAGA,MAAMA,sBAAN,CAA6B;EAC3BC,WAAW,CAAUC,KAAV,EAAsB;IAAA,KAAZA,KAAY,GAAZA,KAAY;EAAE;;AADR;;AAItB,MAAMC,kBAAN,SAAiCC,sBAAjC,CAAsE;EAG3EH,WAAW,CAAUC,KAAV,EAA0BG,SAAS,GAAGC,IAAI,CAACC,GAAL,EAAtC,EAAkD;IAC3D,MAAMJ,kBAAkB,CAACK,IAAzB,EAA+B,OAA/B,EAAwCH,SAAxC,EAAmD,IAAIL,sBAAJ,CAA2BE,KAA3B,CAAnD;IAD2D,KAAxCA,KAAwC,GAAxCA,KAAwC;IAAA,KAAxBG,SAAwB,GAAxBA,SAAwB;EAE5D;;AAL0E;;;gCAAhEF,kB,UACY,gB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"names":["ComponentCompilationOnDoneEventData","constructor","errors","component","buildResults","ComponentCompilationOnDoneEvent","BitBaseEvent","timestamp","Date","now","TYPE"],"sources":["component-compilation-on-done.ts"],"sourcesContent":["/* eslint-disable max-classes-per-file */\nimport { BitBaseEvent } from '@teambit/pubsub';\nimport { Component } from '@teambit/component';\nimport { CompileError } from '../workspace-compiler';\n\nclass ComponentCompilationOnDoneEventData {\n constructor(readonly errors: Array<CompileError>, readonly component: Component, readonly buildResults: string[]) {}\n}\n\nexport class ComponentCompilationOnDoneEvent extends BitBaseEvent<ComponentCompilationOnDoneEventData> {\n static readonly TYPE = 'component-compilation-on-done';\n\n constructor(\n readonly errors: Array<CompileError>,\n readonly component: Component,\n readonly buildResults: string[],\n readonly timestamp = Date.now()\n ) {\n super(\n ComponentCompilationOnDoneEvent.TYPE,\n '0.0.1',\n timestamp,\n new ComponentCompilationOnDoneEventData(errors, component, buildResults)\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AADA;AAKA,MAAMA,mCAAN,CAA0C;EACxCC,WAAW,CAAUC,MAAV,EAAgDC,SAAhD,EAA+EC,YAA/E,EAAuG;IAAA,KAA7FF,MAA6F,GAA7FA,MAA6F;IAAA,KAAvDC,SAAuD,GAAvDA,SAAuD;IAAA,KAAxBC,YAAwB,GAAxBA,YAAwB;EAAE;;AAD5E;;AAInC,MAAMC,+BAAN,SAA8CC,sBAA9C,CAAgG;EAGrGL,WAAW,CACAC,MADA,EAEAC,SAFA,EAGAC,YAHA,EAIAG,SAAS,GAAGC,IAAI,CAACC,GAAL,EAJZ,EAKT;IACA,MACEJ,+BAA+B,CAACK,IADlC,EAEE,OAFF,EAGEH,SAHF,EAIE,IAAIP,mCAAJ,CAAwCE,MAAxC,EAAgDC,SAAhD,EAA2DC,YAA3D,CAJF;IADA,KAJSF,MAIT,GAJSA,MAIT;IAAA,KAHSC,SAGT,GAHSA,SAGT;IAAA,KAFSC,YAET,GAFSA,YAET;IAAA,KADSG,SACT,GADSA,SACT;EAOD;;AAfoG;;;gCAA1FF,+B,UACY,+B"}
|
package/dist/events/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["index.ts"],"
|
|
1
|
+
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from './compiler-error';\nexport * from './component-compilation-on-done';\n"],"mappings":";;;;;;AAAA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"names":["DistArtifactNotFound","BitError","constructor","componentId","toString"],"sources":["dist-artifact-not-found.ts"],"sourcesContent":["import { ComponentID } from '@teambit/component';\nimport { BitError } from '@teambit/bit-error';\n\nexport class DistArtifactNotFound extends BitError {\n constructor(readonly componentId: ComponentID) {\n super(`dist artifact for component ${componentId.toString()} was not found`);\n }\n}\n"],"mappings":";;;;;;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAEO,MAAMA,oBAAN,SAAmCC,oBAAnC,CAA4C;EACjDC,WAAW,CAAUC,WAAV,EAAoC;IAC7C,MAAO,+BAA8BA,WAAW,CAACC,QAAZ,EAAuB,gBAA5D;IAD6C,KAA1BD,WAA0B,GAA1BA,WAA0B;EAE9C;;AAHgD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export { DistArtifactNotFound } from './dist-artifact-not-found';\n"],"mappings":";;;;;;;;;;;;AAAA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA"}
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export type { CompilerMain } from './compiler.main.runtime';\nexport { CompilerAspect } from './compiler.aspect';\nexport {\n Compiler,\n CompilerOptions,\n CompilationInitiator,\n TranspileFileOutput,\n TranspileFileParams,\n TranspileComponentParams,\n} from './types';\nexport * from './events';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAQA;;AAAA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"names":["formatCompileResults","compileResults","verbose","map","componentResult","componentId","component","id","fullName","files","buildResults","status","errors","length","icon","chalk","red","green","reduce","outputString","result","fileList","file"],"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;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAGO,MAAMA,oBAAoB,GAAG,CAACC,cAAD,EAAqCC,OAArC,KAClCD,cAAc,CACXE,GADH,CACQC,eAAD,KAAwC;EAC3CC,WAAW,EAAED,eAAe,CAACE,SAAhB,CAA0BC,EAA1B,CAA6BC,QADC;EAE3CC,KAAK,EAAEL,eAAe,CAACM,YAFoB;EAG3CC,MAAM,EAAEP,eAAe,CAACQ,MAAhB,CAAuBC,MAAvB,GAAgC,SAAhC,GAA4C,SAHT;EAI3CC,IAAI,EAAEV,eAAe,CAACQ,MAAhB,CAAuBC,MAAvB,GAAgCE,gBAAA,CAAMC,GAAN,CAAU,GAAV,CAAhC,GAAiDD,gBAAA,CAAME,KAAN,CAAY,GAAZ;AAJZ,CAAxC,CADP,EAOGC,MAPH,CAOU,CAACC,YAAD,EAAeC,MAAf,KAA0B;EAChCD,YAAY,IAAK,GAAEC,MAAM,CAACN,IAAK,IAAGM,MAAM,CAACT,MAAO,KAAIS,MAAM,CAACf,WAAY,EAAvE;;EACA,IAAIH,OAAJ,EAAa;IAAA;;IACXiB,YAAY,IAAI,GAAhB;IACAA,YAAY,IAAIC,MAAJ,aAAIA,MAAJ,wCAAIA,MAAM,CAAEX,KAAZ,kDAAI,cAAeS,MAAf,CAAsB,CAACG,QAAD,EAAWC,IAAX,KAAqB,GAAED,QAAS,UAASC,IAAK,IAApE,EAAyE,IAAzE,CAAhB;EACD;;EACDH,YAAY,IAAI,IAAhB;EACA,OAAOA,YAAP;AACD,CAfH,EAeK,EAfL,CADK"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"names":["aspectFile","namePascalCase","componentId"],"sources":["aspect-file.ts"],"sourcesContent":["import { ComponentContext } from '@teambit/generator';\n\nexport function aspectFile({ namePascalCase, componentId }: ComponentContext) {\n return `import { Aspect } from '@teambit/harmony';\n\nexport const ${namePascalCase}Aspect = Aspect.create({\n id: '${componentId}',\n});\n `;\n}\n"],"mappings":";;;;;;;AAEO,SAASA,UAAT,CAAoB;EAAEC,cAAF;EAAkBC;AAAlB,CAApB,EAAuE;EAC5E,OAAQ;AACV;AACA,eAAeD,cAAe;AAC9B,SAASC,WAAY;AACrB;AACA,GALE;AAMD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"names":["compilerFile","namePascalCase"],"sources":["compiler-file.ts"],"sourcesContent":["import { ComponentContext } from '@teambit/generator';\n\nexport function compilerFile({ namePascalCase }: ComponentContext) {\n return `import {\n BuildContext,\n BuiltTaskResult,\n ComponentResult,\n} from '@teambit/builder';\nimport {\n Compiler,\n CompilerMain,\n TranspileFileParams,\n TranspileFileOutput,\n} from '@teambit/compiler';\n\nexport class ${namePascalCase} implements Compiler {\n\n constructor(readonly id: string, readonly distDir, private compiler: CompilerMain) {}\n\n /**\n * Detemines whether unsupported files (such as assets)\n * should be copied by Compiler aspect into the 'dist' directory\n */\n shouldCopyNonSupportedFiles = true;\n\n /* The name of the compiler being used. For example, TypeScript, Babel, etc. */\n displayName = '';\n\n /* The version of the compiler being used. For example '1.0.0' */\n version(): string {};\n\n /**\n * Use this for compilation in the workspace.\n * This will compile one file content at a time (alternatively, use 'transpileComponent') */\n transpileFile( fileContent: string, transpileFileParams: TranspileFileParams): TranspileFileOutput {}\n\n\n async build(context: BuildContext): Promise<BuiltTaskResult> {\n let componentsResults: ComponentResult[] = [];\n return {\n /* Sets the files to persist as the Component's artifacts,\n and describes them. */\n artifacts: [\n {\n generatedBy: this.id,\n name: 'compilation output',\n globPatterns: [\\`\\${this.distDir}/**\\`],\n },\n ],\n componentsResults,\n };\n }\n\n /* This is optional but recommended.\n Not using it will require consumers of your compiler to use two APIs and have two depndencies\n to their Envs - your compiler\n */\n createTask() {\n return this.compiler.createTask('${namePascalCase}', this);\n }\n\n /**\n * Given a source file, return its parallel in the dists. e.g. index.ts => dist/index.js.\n * Needed by aspects such as Pkg to determine the main prop.\n */\n getDistPathBySrcPath(srcPath: string): string {}\n\n /**\n * Returns a boolean indicating whether a file is supported by the compiler or not.\n * For example, this API is used by Compiler aspect to copy unsupported files to the dist directory.\n */\n isFileSupported(filePath: string): boolean {}\n}\n `;\n}\n"],"mappings":";;;;;;;AAEO,SAASA,YAAT,CAAsB;EAAEC;AAAF,CAAtB,EAA4D;EACjE,OAAQ;AACV;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAeA,cAAe;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2CAA2CA,cAAe;AAC1D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAtEE;AAuED"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"names":["indexFile","namePascalCase","name"],"sources":["index-file.ts"],"sourcesContent":["import { ComponentContext } from '@teambit/generator';\n\nexport function indexFile({ namePascalCase, name }: ComponentContext) {\n return `import { ${namePascalCase}Aspect } from './${name}.aspect';\n\nexport type { ${namePascalCase}Main } from './${name}.main.runtime';\nexport default ${namePascalCase}Aspect;\nexport { ${namePascalCase}Aspect };\n`;\n}\n"],"mappings":";;;;;;;AAEO,SAASA,SAAT,CAAmB;EAAEC,cAAF;EAAkBC;AAAlB,CAAnB,EAA+D;EACpE,OAAQ,YAAWD,cAAe,oBAAmBC,IAAK;AAC5D;AACA,gBAAgBD,cAAe,kBAAiBC,IAAK;AACrD,iBAAiBD,cAAe;AAChC,WAAWA,cAAe;AAC1B,CALE;AAMD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"names":["mainRuntimeFile","name","namePascalCase"],"sources":["main-runtime-file.ts"],"sourcesContent":["import { ComponentContext } from '@teambit/generator';\n\nexport function mainRuntimeFile({ name, namePascalCase }: ComponentContext) {\n return `import { MainRuntime } from '@teambit/cli';\nimport { CompilerAspect, CompilerMain } from '@teambit/compiler';\nimport { ${namePascalCase} } from './${name}.compiler';\nimport { ${namePascalCase}Aspect } from './${name}.aspect';\n\nexport class ${namePascalCase}Main {\n constructor(private compiler: CompilerMain) {}\n\n static slots = [];\n static dependencies = [CompilerAspect];\n static runtime = MainRuntime;\n\n distDir = 'dist';\n\n /* Set the main property of the component's package with\n the relative output path for the main file */\n getPackageJsonProps() {\n return {\n main: '\\${this.distDir}/{main}.js',\n };\n }\n\n createCompiler(): ${namePascalCase} {\n return new ${namePascalCase}(${namePascalCase}Aspect.id, this.distDir, this.compiler);\n }\n\n static async provider([compiler]: [CompilerMain]) {\n return new ${namePascalCase}Main(compiler);\n }\n}\n\n${namePascalCase}Aspect.addRuntime(${namePascalCase}Main);\n`;\n}\n"],"mappings":";;;;;;;AAEO,SAASA,eAAT,CAAyB;EAAEC,IAAF;EAAQC;AAAR,CAAzB,EAAqE;EAC1E,OAAQ;AACV;AACA,WAAWA,cAAe,cAAaD,IAAK;AAC5C,WAAWC,cAAe,oBAAmBD,IAAK;AAClD;AACA,eAAeC,cAAe;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsBA,cAAe;AACrC,iBAAiBA,cAAe,IAAGA,cAAe;AAClD;AACA;AACA;AACA,iBAAiBA,cAAe;AAChC;AACA;AACA;AACA,EAAEA,cAAe,qBAAoBA,cAAe;AACpD,CAhCE;AAiCD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"names":["compilerTemplate","name","description","hidden","generateFiles","context","relativePath","content","indexFile","isMain","aspectFile","compilerFile","mainRuntimeFile"],"sources":["index.ts"],"sourcesContent":["import { ComponentContext, ComponentTemplate } from '@teambit/generator';\nimport { indexFile } from './files/index-file';\nimport { aspectFile } from './files/aspect-file';\nimport { mainRuntimeFile } from './files/main-runtime-file';\nimport { compilerFile } from './files/compiler-file';\n\nexport const compilerTemplate: ComponentTemplate = {\n name: 'compiler',\n description: 'A compiler implementation',\n hidden: true,\n generateFiles: (context: ComponentContext) => {\n return [\n {\n relativePath: 'index.ts',\n content: indexFile(context),\n isMain: true,\n },\n {\n relativePath: `${context.name}.aspect.ts`,\n content: aspectFile(context),\n },\n {\n relativePath: `${context.name}.compiler.ts`,\n content: compilerFile(context),\n },\n {\n relativePath: `${context.name}.main.runtime.ts`,\n content: mainRuntimeFile(context),\n },\n ];\n },\n};\n"],"mappings":";;;;;;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAEO,MAAMA,gBAAmC,GAAG;EACjDC,IAAI,EAAE,UAD2C;EAEjDC,WAAW,EAAE,2BAFoC;EAGjDC,MAAM,EAAE,IAHyC;EAIjDC,aAAa,EAAGC,OAAD,IAA+B;IAC5C,OAAO,CACL;MACEC,YAAY,EAAE,UADhB;MAEEC,OAAO,EAAE,IAAAC,sBAAA,EAAUH,OAAV,CAFX;MAGEI,MAAM,EAAE;IAHV,CADK,EAML;MACEH,YAAY,EAAG,GAAED,OAAO,CAACJ,IAAK,YADhC;MAEEM,OAAO,EAAE,IAAAG,wBAAA,EAAWL,OAAX;IAFX,CANK,EAUL;MACEC,YAAY,EAAG,GAAED,OAAO,CAACJ,IAAK,cADhC;MAEEM,OAAO,EAAE,IAAAI,4BAAA,EAAaN,OAAb;IAFX,CAVK,EAcL;MACEC,YAAY,EAAG,GAAED,OAAO,CAACJ,IAAK,kBADhC;MAEEM,OAAO,EAAE,IAAAK,kCAAA,EAAgBP,OAAhB;IAFX,CAdK,CAAP;EAmBD;AAxBgD,CAA5C"}
|
package/dist/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"names":["CompilationInitiator"],"sources":["types.ts"],"sourcesContent":["import { BuildContext, BuildTask, BuiltTaskResult, TaskResultsList } from '@teambit/builder';\nimport type { Component } from '@teambit/component';\n\nexport type TranspileFileParams = {\n componentDir: string; // absolute path of the component's root directory\n filePath: string; // relative path of the file inside the component directory\n};\n\nexport enum CompilationInitiator {\n CmdReport,\n CmdJson,\n PreStart,\n PreWatch,\n Start,\n ComponentChanged,\n AspectLoadFail,\n ComponentAdded,\n}\n\nexport type TranspileComponentParams = {\n component: Component;\n componentDir: string; // absolute path of the component's root directory\n outputDir: string; // absolute path of the component's output directory\n initiator: CompilationInitiator; // origin of the compilation's request\n};\n\nexport type TranspileFileOutput =\n | {\n outputText: string;\n outputPath: string;\n }[]\n | null;\n\nexport interface CompilerOptions {\n /**\n * name of the compiler.\n */\n name?: string;\n\n /**\n * relative path of the dist directory inside the capsule. e.g. \"dist\".\n */\n distDir: string;\n\n /**\n * determines which ones of the generated files will be saved in the bit objects when tagging.\n * e.g. distGlobPatterns = [`${this.distDir}/**`, `!${this.distDir}/tsconfig.tsbuildinfo`];\n * see https://github.com/mrmlnc/fast-glob for the supported glob patters syntax.\n */\n distGlobPatterns?: string[];\n\n /**\n * whether or not unsupported files (such as assets) should be copied into the dist directory\n */\n shouldCopyNonSupportedFiles?: boolean;\n\n /**\n * optional. default to \"dist\".\n * useful when the build pipeline has multiple compiler tasks of the same compiler.\n * e.g. using the same Babel compiler for two different tasks, one for creating \"es5\" files, and\n * the second for creating \"esm\". the artifact names would be \"es5\" and \"esm\" accordingly.\n */\n artifactName?: string;\n}\n\nexport interface Compiler extends CompilerOptions {\n /**\n * id of the compiler.\n */\n id: string;\n\n /**\n * Delete dist folder before writing the new compiled files\n */\n deleteDistDir?: boolean;\n\n /**\n * serialized config of the compiler.\n */\n displayConfig?(): string;\n\n /**\n * transpile a single file that gets saved into the workspace, used by `bit compile` and during\n * development\n */\n transpileFile?: (fileContent: string, params: TranspileFileParams) => TranspileFileOutput;\n\n /**\n * transpile all the files of a component, use this when you can't use `transpileFile`\n */\n transpileComponent?: (params: TranspileComponentParams) => Promise<void>;\n\n /**\n * compile components inside isolated capsules. this being used during tag for the release.\n * meaning, the final package of the component has the dists generated by this method.\n */\n build(context: BuildContext): Promise<BuiltTaskResult>;\n\n /**\n * return the dist dir of the compiled files (relative path from the component root dir)\n */\n getDistDir?(): string;\n\n /**\n * given a source file, return its parallel in the dists. e.g. \"index.ts\" => \"dist/index.js\"\n * both, the return path and the given path are relative paths.\n */\n getDistPathBySrcPath(srcPath: string): string;\n\n /**\n * given a component, returns the path to the source folder to use for the preview, uses the one\n * in node_modules by default\n */\n getPreviewComponentRootPath?(component: Component): string;\n\n /**\n * only supported files matching get compiled. others, are copied to the dist dir.\n */\n isFileSupported(filePath: string): boolean;\n\n /**\n * sugar to create a Compiler task via the concrete compiler\n */\n createTask?(name?: string): BuildTask;\n\n /**\n * run before the build pipeline has started. this is useful when some preparation are needed to\n * be done on all envs before the build starts.\n */\n preBuild?(context: BuildContext): Promise<void>;\n\n /**\n * run after the build pipeline completed for all envs. useful for some cleanups\n */\n postBuild?(context: BuildContext, tasksResults: TaskResultsList): Promise<void>;\n\n /**\n * returns the version of the current compiler instance (e.g. '4.0.1').\n */\n version(): string;\n\n /**\n * returns the display name of the current compiler instance (e.g. 'TypeScript')\n */\n displayName: string;\n}\n"],"mappings":";;;;;;IAQYA,oB;;;WAAAA,oB;EAAAA,oB,CAAAA,oB;EAAAA,oB,CAAAA,oB;EAAAA,oB,CAAAA,oB;EAAAA,oB,CAAAA,oB;EAAAA,oB,CAAAA,oB;EAAAA,oB,CAAAA,oB;EAAAA,oB,CAAAA,oB;EAAAA,oB,CAAAA,oB;GAAAA,oB,oCAAAA,oB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["workspace-compiler.ts"],"names":["ComponentCompiler","constructor","pubsub","workspace","component","compilerInstance","compilerId","logger","dists","compileErrors","compile","noThrow","options","dataToPersist","deleteDistDir","DataToPersist","removePath","RemovePath","distDir","addBasePath","path","persistAllToFS","compilers","canTranspileFile","find","c","transpileFile","canTranspileComponent","transpileComponent","Promise","all","filesystem","files","map","file","compileOneFile","initiator","compileAllFiles","Error","toString","throwOnCompileErrors","addManyFiles","buildResults","distFile","state","_consumer","compiler","loader","succeed","pub","CompilerAspect","id","ComponentCompilationOnDoneEvent","length","forEach","errorItem","error","formatError","err","join","CompilerErrorEvent","console","message","packageName","packageDir","distDirName","getDistDir","DEFAULT_DIST_DIRNAME","componentDir","filePath","relative","isFileSupported","compileResults","contents","push","base","result","Dist","outputPath","Buffer","from","outputText","shouldCopyNonSupportedFiles","filesToCompile","outputDir","getComponentPackagePath","WorkspaceCompiler","envs","aspectLoader","ui","registerOnComponentChange","onComponentChange","bind","registerOnComponentAdd","registerOnPreWatch","onPreWatch","registerPreStart","onPreStart","registerOnAspectLoadErrorSlot","onAspectLoadFail","preStartOpts","skipCompilation","compileComponents","changed","verbose","CompilationInitiator","PreStart","code","AspectLoadFail","ComponentChanged","results","components","watchOpts","preCompile","start","Date","now","_legacy","PreWatch","end","consoleSuccess","componentsIds","ConsumerNotFound","isLegacy","componentIds","getIdsToCompile","getMany","componentsCompilers","environment","getEnv","env","getCompiler","componentMap","getComponentDir","compilerName","name","resultOnWorkspace","componentCompiler","resolveMultipleComponentIds","getNewAndModifiedIds","getAllComponentIds"],"mappings":";;;;;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAKA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAGA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAEA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAKA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAvBA;AAyCO,MAAMA,iBAAN,CAAwB;AAC7BC,EAAAA,WAAW,CACDC,MADC,EAEDC,SAFC,EAGDC,SAHC,EAIDC,gBAJC,EAKDC,UALC,EAMDC,MANC,EAODC,KAAa,GAAG,EAPf,EAQDC,aAA6B,GAAG,EAR/B,EAST;AAAA,SARQP,MAQR,GARQA,MAQR;AAAA,SAPQC,SAOR,GAPQA,SAOR;AAAA,SANQC,SAMR,GANQA,SAMR;AAAA,SALQC,gBAKR,GALQA,gBAKR;AAAA,SAJQC,UAIR,GAJQA,UAIR;AAAA,SAHQC,MAGR,GAHQA,MAGR;AAAA,SAFQC,KAER,GAFQA,KAER;AAAA,SADQC,aACR,GADQA,aACR;AAAE;;AAES,QAAPC,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,GAAG,KAFiB,EAGH;AACxB,QAAIkB,aAAa,CAACpE,MAAlB,EAA0B;AACxB,aAAO,KAAKlD,SAAL,CAAeuI,2BAAf,CAA2CjB,aAA3C,CAAP;AACD;;AACD,QAAIlB,OAAJ,EAAa;AACX,aAAO,KAAKpG,SAAL,CAAewI,oBAAf,EAAP;AACD;;AACD,WAAO,KAAKxI,SAAL,CAAeyI,kBAAf,EAAP;AACD;;AAhH4B","sourcesContent":["/* eslint-disable max-classes-per-file */\nimport mapSeries from 'p-map-series';\nimport { Component, ComponentID } from '@teambit/component';\nimport { EnvsMain } from '@teambit/envs';\nimport type { PubsubMain } from '@teambit/pubsub';\nimport { SerializableResults, Workspace, WatchOptions } from '@teambit/workspace';\nimport path from 'path';\nimport { BitId } from '@teambit/legacy-bit-id';\nimport { Logger } from '@teambit/logger';\nimport loader from '@teambit/legacy/dist/cli/loader';\nimport { DEFAULT_DIST_DIRNAME } from '@teambit/legacy/dist/constants';\nimport { AbstractVinyl, Dist } from '@teambit/legacy/dist/consumer/component/sources';\nimport DataToPersist from '@teambit/legacy/dist/consumer/component/sources/data-to-persist';\nimport { AspectLoaderMain } from '@teambit/aspect-loader';\nimport { ConsumerNotFound } from '@teambit/legacy/dist/consumer/exceptions';\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 type { PreStartOpts } from '@teambit/ui';\nimport { PathOsBasedAbsolute, PathOsBasedRelative } from '@teambit/legacy/dist/utils/path';\nimport { MultiCompiler } from '@teambit/multi-compiler';\nimport { CompilerAspect } from './compiler.aspect';\nimport { CompilerErrorEvent, ComponentCompilationOnDoneEvent } from './events';\nimport { Compiler, CompilationInitiator } from './types';\n\nexport type BuildResult = { component: string; buildResults: string[] | null | undefined };\n\nexport type CompileOptions = {\n changed?: boolean; // compile only new and modified components\n verbose?: boolean; // show more data, such as, dist paths\n /**\n * whether the dist root dir should be deleted before writing new dists.\n * defaults to true for `bit compile` and false everywhere else, such as `bit watch` and `bit\n * start` to avoid webpack \"EINTR\" error.\n */\n deleteDistDir?: boolean;\n initiator: CompilationInitiator; // describes where the compilation is coming from\n};\n\nexport type CompileError = { path: string; error: Error };\n\nexport class ComponentCompiler {\n constructor(\n private pubsub: PubsubMain,\n private workspace: Workspace,\n private component: Component,\n private compilerInstance: Compiler,\n private compilerId: string,\n private logger: Logger,\n private 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 dataToPersist.removePath(new RemovePath(this.distDir));\n dataToPersist.addBasePath(this.workspace.path);\n await dataToPersist.persistAllToFS();\n }\n\n const compilers: Compiler[] = (this.compilerInstance as MultiCompiler).compilers\n ? (this.compilerInstance as MultiCompiler).compilers\n : [this.compilerInstance];\n const canTranspileFile = compilers.find((c) => c.transpileFile);\n const canTranspileComponent = compilers.find((c) => c.transpileComponent);\n\n if (canTranspileFile) {\n await Promise.all(\n this.component.filesystem.files.map((file: AbstractVinyl) => this.compileOneFile(file, options.initiator))\n );\n }\n\n if (canTranspileComponent) {\n await this.compileAllFiles(this.component, options.initiator);\n }\n\n if (!canTranspileFile && !canTranspileComponent) {\n throw new Error(\n `compiler ${this.compilerId.toString()} doesn't implement either \"transpileFile\" or \"transpileComponent\" methods`\n );\n }\n this.throwOnCompileErrors(noThrow);\n\n // writing the dists with `component.setDists(dists); component.dists.writeDists` is tricky\n // as it uses other base-paths and doesn't respect the new node-modules base path.\n dataToPersist = new DataToPersist();\n dataToPersist.addManyFiles(this.dists);\n dataToPersist.addBasePath(this.workspace.path);\n await dataToPersist.persistAllToFS();\n const buildResults = this.dists.map((distFile) => distFile.path);\n if (this.component.state._consumer.compiler) loader.succeed();\n this.pubsub.pub(\n CompilerAspect.id,\n new ComponentCompilationOnDoneEvent(this.compileErrors, this.component, buildResults)\n );\n return { component: this.component.id.toString(), buildResults };\n }\n\n private throwOnCompileErrors(noThrow = true) {\n if (this.compileErrors.length) {\n this.compileErrors.forEach((errorItem) => {\n this.logger.error(`compilation error at ${errorItem.path}`, errorItem.error);\n });\n const formatError = (errorItem) => `${errorItem.path}\\n${errorItem.error}`;\n const err = new Error(`compilation failed. see the following errors from the compiler\n${this.compileErrors.map(formatError).join('\\n')}`);\n\n this.pubsub.pub(CompilerAspect.id, new CompilerErrorEvent(err));\n\n if (!noThrow) {\n throw err;\n }\n\n this.logger.console(err.message);\n }\n }\n\n private get distDir(): 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 return path.join(packageDir, distDirName);\n }\n\n private get componentDir(): PathOsBasedAbsolute {\n return this.workspace.componentDir(this.component.id);\n }\n\n private async compileOneFile(file: AbstractVinyl, initiator: CompilationInitiator): Promise<void> {\n const options = { componentDir: this.componentDir, filePath: file.relative, initiator };\n const isFileSupported = this.compilerInstance.isFileSupported(file.path);\n let compileResults;\n if (isFileSupported) {\n try {\n compileResults = this.compilerInstance.transpileFile?.(file.contents.toString(), options);\n } catch (error: any) {\n this.compileErrors.push({ path: file.path, error });\n return;\n }\n }\n const base = this.distDir;\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 private async compileAllFiles(component: Component, initiator: CompilationInitiator): Promise<void> {\n const base = this.distDir;\n const filesToCompile: AbstractVinyl[] = [];\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 if (filesToCompile.length) {\n try {\n await this.compilerInstance.transpileComponent?.({\n component,\n componentDir: this.componentDir,\n outputDir: this.workspace.getComponentPackagePath(component),\n initiator,\n });\n } catch (error: any) {\n this.compileErrors.push({ path: this.componentDir, error });\n }\n }\n }\n}\n\nexport class WorkspaceCompiler {\n constructor(\n private workspace: Workspace,\n private envs: EnvsMain,\n private pubsub: PubsubMain,\n private aspectLoader: AspectLoaderMain,\n private ui: UiMain,\n private logger: Logger\n ) {\n if (this.workspace) {\n this.workspace.registerOnComponentChange(this.onComponentChange.bind(this));\n this.workspace.registerOnComponentAdd(this.onComponentChange.bind(this));\n this.workspace.registerOnPreWatch(this.onPreWatch.bind(this));\n this.ui.registerPreStart(this.onPreStart.bind(this));\n }\n if (this.aspectLoader) {\n this.aspectLoader.registerOnAspectLoadErrorSlot(this.onAspectLoadFail.bind(this));\n }\n }\n\n async onPreStart(preStartOpts: PreStartOpts): Promise<void> {\n if (preStartOpts.skipCompilation) {\n return;\n }\n await this.compileComponents([], {\n changed: true,\n verbose: false,\n deleteDistDir: false,\n initiator: CompilationInitiator.PreStart,\n });\n }\n\n async onAspectLoadFail(err: Error & { code?: string }, id: ComponentID): Promise<boolean> {\n if (err.code && err.code === 'MODULE_NOT_FOUND' && this.workspace) {\n await this.compileComponents([id.toString()], { initiator: CompilationInitiator.AspectLoadFail }, true);\n return true;\n }\n return false;\n }\n\n async onComponentChange(\n component: Component,\n files: string[],\n initiator?: CompilationInitiator\n ): Promise<SerializableResults> {\n const buildResults = await this.compileComponents(\n [component.id.toString()],\n { initiator: initiator || CompilationInitiator.ComponentChanged },\n true\n );\n return {\n results: buildResults,\n toString() {\n return `${buildResults[0]?.buildResults?.join('\\n\\t')}`;\n },\n };\n }\n\n async onPreWatch(components: Component[], watchOpts: WatchOptions) {\n if (watchOpts.preCompile) {\n const start = Date.now();\n this.logger.console(`compiling ${components.length} components`);\n await this.compileComponents(\n components.map((c) => c.id._legacy),\n { initiator: CompilationInitiator.PreWatch }\n );\n const end = Date.now() - start;\n this.logger.consoleSuccess(`compiled ${components.length} components successfully (${end / 1000} sec)`);\n }\n }\n\n async compileComponents(\n componentsIds: string[] | BitId[] | ComponentID[], // when empty, it compiles new+modified (unless options.all is set),\n options: CompileOptions,\n noThrow?: boolean\n ): Promise<BuildResult[]> {\n if (!this.workspace) throw new ConsumerNotFound();\n if (this.workspace.isLegacy) throw new Error('workspace-compiler should work for Harmony workspace only');\n const componentIds = await this.getIdsToCompile(componentsIds, options.changed);\n const components = await this.workspace.getMany(componentIds);\n\n const componentsCompilers: ComponentCompiler[] = [];\n components.forEach((c) => {\n const environment = this.envs.getEnv(c).env;\n const compilerInstance = environment.getCompiler?.();\n // if there is no componentDir (e.g. author that added files, not dir), then we can't write the dists\n // inside the component dir.\n if (compilerInstance && c.state._consumer.componentMap?.getComponentDir()) {\n const compilerName = compilerInstance.constructor.name || 'compiler';\n componentsCompilers.push(\n new ComponentCompiler(this.pubsub, this.workspace, c, compilerInstance, compilerName, this.logger)\n );\n }\n });\n const resultOnWorkspace = await mapSeries(componentsCompilers, (componentCompiler) =>\n componentCompiler.compile(noThrow, options)\n );\n\n return resultOnWorkspace;\n }\n\n private async getIdsToCompile(\n componentsIds: Array<string | ComponentID | BitId>,\n changed = false\n ): Promise<ComponentID[]> {\n if (componentsIds.length) {\n return this.workspace.resolveMultipleComponentIds(componentsIds);\n }\n if (changed) {\n return this.workspace.getNewAndModifiedIds();\n }\n return this.workspace.getAllComponentIds();\n }\n}\n"]}
|
|
1
|
+
{"version":3,"names":["ComponentCompiler","constructor","pubsub","workspace","component","compilerInstance","compilerId","logger","dists","compileErrors","compile","noThrow","options","dataToPersist","deleteDistDir","DataToPersist","removePath","RemovePath","distDir","addBasePath","path","persistAllToFS","compilers","canTranspileFile","find","c","transpileFile","canTranspileComponent","transpileComponent","Promise","all","filesystem","files","map","file","compileOneFile","initiator","compileAllFiles","Error","toString","throwOnCompileErrors","addManyFiles","buildResults","distFile","state","_consumer","compiler","loader","succeed","pub","CompilerAspect","id","ComponentCompilationOnDoneEvent","length","forEach","errorItem","error","formatError","err","join","CompilerErrorEvent","console","message","packageName","componentIdToPackageName","packageDir","distDirName","getDistDir","DEFAULT_DIST_DIRNAME","componentDir","filePath","relative","isFileSupported","compileResults","contents","push","base","result","Dist","outputPath","Buffer","from","outputText","shouldCopyNonSupportedFiles","filesToCompile","outputDir","getComponentPackagePath","WorkspaceCompiler","envs","aspectLoader","ui","registerOnComponentChange","onComponentChange","bind","registerOnComponentAdd","registerOnPreWatch","onPreWatch","registerPreStart","onPreStart","registerOnAspectLoadErrorSlot","onAspectLoadFail","preStartOpts","skipCompilation","compileComponents","changed","verbose","CompilationInitiator","PreStart","code","AspectLoadFail","ComponentChanged","results","components","watchOpts","preCompile","start","Date","now","_legacy","PreWatch","end","consoleSuccess","componentsIds","ConsumerNotFound","isLegacy","componentIds","getIdsToCompile","getMany","componentsCompilers","environment","getEnv","env","getCompiler","componentMap","getComponentDir","compilerName","name","resultOnWorkspace","mapSeries","componentCompiler","resolveMultipleComponentIds","getNewAndModifiedIds","getAllComponentIds"],"sources":["workspace-compiler.ts"],"sourcesContent":["/* eslint-disable max-classes-per-file */\nimport mapSeries from 'p-map-series';\nimport { Component, ComponentID } from '@teambit/component';\nimport { EnvsMain } from '@teambit/envs';\nimport type { PubsubMain } from '@teambit/pubsub';\nimport { SerializableResults, Workspace, WatchOptions } from '@teambit/workspace';\nimport path from 'path';\nimport { BitId } from '@teambit/legacy-bit-id';\nimport { Logger } from '@teambit/logger';\nimport loader from '@teambit/legacy/dist/cli/loader';\nimport { DEFAULT_DIST_DIRNAME } from '@teambit/legacy/dist/constants';\nimport { AbstractVinyl, Dist } from '@teambit/legacy/dist/consumer/component/sources';\nimport DataToPersist from '@teambit/legacy/dist/consumer/component/sources/data-to-persist';\nimport { AspectLoaderMain } from '@teambit/aspect-loader';\nimport { ConsumerNotFound } from '@teambit/legacy/dist/consumer/exceptions';\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 type { PreStartOpts } from '@teambit/ui';\nimport { PathOsBasedAbsolute, PathOsBasedRelative } from '@teambit/legacy/dist/utils/path';\nimport { MultiCompiler } from '@teambit/multi-compiler';\nimport { CompilerAspect } from './compiler.aspect';\nimport { CompilerErrorEvent, ComponentCompilationOnDoneEvent } from './events';\nimport { Compiler, CompilationInitiator } from './types';\n\nexport type BuildResult = { component: string; buildResults: string[] | null | undefined };\n\nexport type CompileOptions = {\n changed?: boolean; // compile only new and modified components\n verbose?: boolean; // show more data, such as, dist paths\n /**\n * whether the dist root dir should be deleted before writing new dists.\n * defaults to true for `bit compile` and false everywhere else, such as `bit watch` and `bit\n * start` to avoid webpack \"EINTR\" error.\n */\n deleteDistDir?: boolean;\n initiator: CompilationInitiator; // describes where the compilation is coming from\n};\n\nexport type CompileError = { path: string; error: Error };\n\nexport class ComponentCompiler {\n constructor(\n private pubsub: PubsubMain,\n private workspace: Workspace,\n private component: Component,\n private compilerInstance: Compiler,\n private compilerId: string,\n private logger: Logger,\n private 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 dataToPersist.removePath(new RemovePath(this.distDir));\n dataToPersist.addBasePath(this.workspace.path);\n await dataToPersist.persistAllToFS();\n }\n\n const compilers: Compiler[] = (this.compilerInstance as MultiCompiler).compilers\n ? (this.compilerInstance as MultiCompiler).compilers\n : [this.compilerInstance];\n const canTranspileFile = compilers.find((c) => c.transpileFile);\n const canTranspileComponent = compilers.find((c) => c.transpileComponent);\n\n if (canTranspileFile) {\n await Promise.all(\n this.component.filesystem.files.map((file: AbstractVinyl) => this.compileOneFile(file, options.initiator))\n );\n }\n\n if (canTranspileComponent) {\n await this.compileAllFiles(this.component, options.initiator);\n }\n\n if (!canTranspileFile && !canTranspileComponent) {\n throw new Error(\n `compiler ${this.compilerId.toString()} doesn't implement either \"transpileFile\" or \"transpileComponent\" methods`\n );\n }\n this.throwOnCompileErrors(noThrow);\n\n // writing the dists with `component.setDists(dists); component.dists.writeDists` is tricky\n // as it uses other base-paths and doesn't respect the new node-modules base path.\n dataToPersist = new DataToPersist();\n dataToPersist.addManyFiles(this.dists);\n dataToPersist.addBasePath(this.workspace.path);\n await dataToPersist.persistAllToFS();\n const buildResults = this.dists.map((distFile) => distFile.path);\n if (this.component.state._consumer.compiler) loader.succeed();\n this.pubsub.pub(\n CompilerAspect.id,\n new ComponentCompilationOnDoneEvent(this.compileErrors, this.component, buildResults)\n );\n return { component: this.component.id.toString(), buildResults };\n }\n\n private throwOnCompileErrors(noThrow = true) {\n if (this.compileErrors.length) {\n this.compileErrors.forEach((errorItem) => {\n this.logger.error(`compilation error at ${errorItem.path}`, errorItem.error);\n });\n const formatError = (errorItem) => `${errorItem.path}\\n${errorItem.error}`;\n const err = new Error(`compilation failed. see the following errors from the compiler\n${this.compileErrors.map(formatError).join('\\n')}`);\n\n this.pubsub.pub(CompilerAspect.id, new CompilerErrorEvent(err));\n\n if (!noThrow) {\n throw err;\n }\n\n this.logger.console(err.message);\n }\n }\n\n private get distDir(): 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 return path.join(packageDir, distDirName);\n }\n\n private get componentDir(): PathOsBasedAbsolute {\n return this.workspace.componentDir(this.component.id);\n }\n\n private async compileOneFile(file: AbstractVinyl, initiator: CompilationInitiator): Promise<void> {\n const options = { componentDir: this.componentDir, filePath: file.relative, initiator };\n const isFileSupported = this.compilerInstance.isFileSupported(file.path);\n let compileResults;\n if (isFileSupported) {\n try {\n compileResults = this.compilerInstance.transpileFile?.(file.contents.toString(), options);\n } catch (error: any) {\n this.compileErrors.push({ path: file.path, error });\n return;\n }\n }\n const base = this.distDir;\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 private async compileAllFiles(component: Component, initiator: CompilationInitiator): Promise<void> {\n const base = this.distDir;\n const filesToCompile: AbstractVinyl[] = [];\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 if (filesToCompile.length) {\n try {\n await this.compilerInstance.transpileComponent?.({\n component,\n componentDir: this.componentDir,\n outputDir: this.workspace.getComponentPackagePath(component),\n initiator,\n });\n } catch (error: any) {\n this.compileErrors.push({ path: this.componentDir, error });\n }\n }\n }\n}\n\nexport class WorkspaceCompiler {\n constructor(\n private workspace: Workspace,\n private envs: EnvsMain,\n private pubsub: PubsubMain,\n private aspectLoader: AspectLoaderMain,\n private ui: UiMain,\n private logger: Logger\n ) {\n if (this.workspace) {\n this.workspace.registerOnComponentChange(this.onComponentChange.bind(this));\n this.workspace.registerOnComponentAdd(this.onComponentChange.bind(this));\n this.workspace.registerOnPreWatch(this.onPreWatch.bind(this));\n this.ui.registerPreStart(this.onPreStart.bind(this));\n }\n if (this.aspectLoader) {\n this.aspectLoader.registerOnAspectLoadErrorSlot(this.onAspectLoadFail.bind(this));\n }\n }\n\n async onPreStart(preStartOpts: PreStartOpts): Promise<void> {\n if (preStartOpts.skipCompilation) {\n return;\n }\n await this.compileComponents([], {\n changed: true,\n verbose: false,\n deleteDistDir: false,\n initiator: CompilationInitiator.PreStart,\n });\n }\n\n async onAspectLoadFail(err: Error & { code?: string }, id: ComponentID): Promise<boolean> {\n if (err.code && err.code === 'MODULE_NOT_FOUND' && this.workspace) {\n await this.compileComponents([id.toString()], { initiator: CompilationInitiator.AspectLoadFail }, true);\n return true;\n }\n return false;\n }\n\n async onComponentChange(\n component: Component,\n files: string[],\n initiator?: CompilationInitiator\n ): Promise<SerializableResults> {\n const buildResults = await this.compileComponents(\n [component.id.toString()],\n { initiator: initiator || CompilationInitiator.ComponentChanged },\n true\n );\n return {\n results: buildResults,\n toString() {\n return `${buildResults[0]?.buildResults?.join('\\n\\t')}`;\n },\n };\n }\n\n async onPreWatch(components: Component[], watchOpts: WatchOptions) {\n if (watchOpts.preCompile) {\n const start = Date.now();\n this.logger.console(`compiling ${components.length} components`);\n await this.compileComponents(\n components.map((c) => c.id._legacy),\n { initiator: CompilationInitiator.PreWatch }\n );\n const end = Date.now() - start;\n this.logger.consoleSuccess(`compiled ${components.length} components successfully (${end / 1000} sec)`);\n }\n }\n\n async compileComponents(\n componentsIds: string[] | BitId[] | ComponentID[], // when empty, it compiles new+modified (unless options.all is set),\n options: CompileOptions,\n noThrow?: boolean\n ): Promise<BuildResult[]> {\n if (!this.workspace) throw new ConsumerNotFound();\n if (this.workspace.isLegacy) throw new Error('workspace-compiler should work for Harmony workspace only');\n const componentIds = await this.getIdsToCompile(componentsIds, options.changed);\n const components = await this.workspace.getMany(componentIds);\n\n const componentsCompilers: ComponentCompiler[] = [];\n components.forEach((c) => {\n const environment = this.envs.getEnv(c).env;\n const compilerInstance = environment.getCompiler?.();\n // if there is no componentDir (e.g. author that added files, not dir), then we can't write the dists\n // inside the component dir.\n if (compilerInstance && c.state._consumer.componentMap?.getComponentDir()) {\n const compilerName = compilerInstance.constructor.name || 'compiler';\n componentsCompilers.push(\n new ComponentCompiler(this.pubsub, this.workspace, c, compilerInstance, compilerName, this.logger)\n );\n }\n });\n const resultOnWorkspace = await mapSeries(componentsCompilers, (componentCompiler) =>\n componentCompiler.compile(noThrow, options)\n );\n\n return resultOnWorkspace;\n }\n\n private async getIdsToCompile(\n componentsIds: Array<string | ComponentID | BitId>,\n changed = false\n ): Promise<ComponentID[]> {\n if (componentsIds.length) {\n return this.workspace.resolveMultipleComponentIds(componentsIds);\n }\n if (changed) {\n return this.workspace.getNewAndModifiedIds();\n }\n return this.workspace.getAllComponentIds();\n }\n}\n"],"mappings":";;;;;;;;;;;;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAKA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAGA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAEA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAKA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EA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MkI,iBAAiB,GAAG,MAAM,IAAAC,qBAAA,EAAUV,mBAAV,EAAgCW,iBAAD,IAC7DA,iBAAiB,CAACjI,OAAlB,CAA0BC,OAA1B,EAAmCC,OAAnC,CAD8B,CAAhC;IAIA,OAAO6H,iBAAP;EACD;;EAE4B,MAAfX,eAAe,CAC3BJ,aAD2B,EAE3BlB,OAAO,GAAG,KAFiB,EAGH;IACxB,IAAIkB,aAAa,CAACrE,MAAlB,EAA0B;MACxB,OAAO,KAAKlD,SAAL,CAAeyI,2BAAf,CAA2ClB,aAA3C,CAAP;IACD;;IACD,IAAIlB,OAAJ,EAAa;MACX,OAAO,KAAKrG,SAAL,CAAe0I,oBAAf,EAAP;IACD;;IACD,OAAO,KAAK1I,SAAL,CAAe2I,kBAAf,EAAP;EACD;;AAhH4B"}
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teambit/compiler",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.738",
|
|
4
4
|
"homepage": "https://bit.dev/teambit/compilation/compiler",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"componentId": {
|
|
7
7
|
"scope": "teambit.compilation",
|
|
8
8
|
"name": "compiler",
|
|
9
|
-
"version": "0.0.
|
|
9
|
+
"version": "0.0.738"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"chalk": "2.4.2",
|
|
@@ -19,19 +19,19 @@
|
|
|
19
19
|
"core-js": "^3.0.0",
|
|
20
20
|
"@teambit/harmony": "0.3.3",
|
|
21
21
|
"@teambit/cli": "0.0.491",
|
|
22
|
-
"@teambit/component": "0.0.
|
|
22
|
+
"@teambit/component": "0.0.738",
|
|
23
23
|
"@teambit/logger": "0.0.583",
|
|
24
|
-
"@teambit/pubsub": "0.0.
|
|
25
|
-
"@teambit/aspect-loader": "0.0.
|
|
26
|
-
"@teambit/builder": "0.0.
|
|
24
|
+
"@teambit/pubsub": "0.0.738",
|
|
25
|
+
"@teambit/aspect-loader": "0.0.738",
|
|
26
|
+
"@teambit/builder": "0.0.738",
|
|
27
27
|
"@teambit/component-issues": "0.0.53",
|
|
28
|
-
"@teambit/envs": "0.0.
|
|
29
|
-
"@teambit/generator": "0.0.
|
|
28
|
+
"@teambit/envs": "0.0.738",
|
|
29
|
+
"@teambit/generator": "0.0.738",
|
|
30
30
|
"@teambit/legacy-bit-id": "0.0.399",
|
|
31
|
-
"@teambit/ui": "0.0.
|
|
32
|
-
"@teambit/workspace": "0.0.
|
|
33
|
-
"@teambit/isolator": "0.0.
|
|
34
|
-
"@teambit/multi-compiler": "0.0.
|
|
31
|
+
"@teambit/ui": "0.0.738",
|
|
32
|
+
"@teambit/workspace": "0.0.738",
|
|
33
|
+
"@teambit/isolator": "0.0.738",
|
|
34
|
+
"@teambit/multi-compiler": "0.0.738",
|
|
35
35
|
"@teambit/bit-error": "0.0.394"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const compositions = [require('/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.compilation_compiler@0.0.
|
|
2
|
-
export const overview = [require('/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.compilation_compiler@0.0.
|
|
1
|
+
export const compositions = [require('/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.compilation_compiler@0.0.738/dist/compiler.composition.js')]
|
|
2
|
+
export const overview = [require('/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.compilation_compiler@0.0.738/dist/compiler.docs.mdx')]
|
package/tsconfig.json
CHANGED
|
@@ -15,13 +15,13 @@
|
|
|
15
15
|
"declaration": true,
|
|
16
16
|
"sourceMap": true,
|
|
17
17
|
"skipLibCheck": true,
|
|
18
|
+
"experimentalDecorators": true,
|
|
18
19
|
"outDir": "dist",
|
|
19
20
|
"moduleResolution": "node",
|
|
20
21
|
"esModuleInterop": true,
|
|
21
22
|
"rootDir": ".",
|
|
22
23
|
"resolveJsonModule": true,
|
|
23
24
|
"emitDeclarationOnly": true,
|
|
24
|
-
"experimentalDecorators": true,
|
|
25
25
|
"emitDecoratorMetadata": true,
|
|
26
26
|
"allowSyntheticDefaultImports": true,
|
|
27
27
|
"strictPropertyInitialization": false,
|
|
Binary file
|