New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@teambit/compiler

Package Overview
Dependencies
Maintainers
16
Versions
1636
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@teambit/compiler

The compiler is configured inside an environment and not directly on the component level.

  • 0.0.14
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2.2K
increased by79.58%
Maintainers
16
Weekly downloads
 
Created
Source

Workspace Configuration

The compiler is configured inside an environment and not directly on the component level.

As a task

A task is running with bit build or during the tag process on the capsules or the workspace (depends on the specific compiler implementation). The env extension should have this compiler extension as a dependency first, then add to the build() array the following: this.compiler.task.

As a command

A command is running on the workspace. To run: bit compile. An example of configuring a compiler in the React env.

/**
 * returns a component compiler.
 */
getCompiler(): Compiler {
  // eslint-disable-next-line global-require
  const tsConfig = require('./typescript/tsconfig.json');
  return this.ts.createCompiler(tsConfig);
}

Compiler Implementation

The compiler is responsible for two processes:

  1. compile during development This compilation takes place on the workspace and the dists are saved inside the component dir. The provider should implement transpileFile function as follows:
transpileFile: (fileContent: string, options: { componentDir: string, filePath: string }) => Array<{ outputText: string, outputPath: string }> | null;

In case the compiler receive an unsupported file, it should return null.

  1. compile for build (during the tag command) This compilation takes place on the isolated capsule. The provider should implement build function which returns the exit-code and the dist dir. From Compiler interface:
build(context: BuildContext): Promise<BuildResults>;

FYI, this api is going to be changed very soon. It should get components and capsules graph.

FAQs

Package last updated on 27 Aug 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc