Socket
Socket
Sign inDemoInstall

broccoli-typescript-compiler

Package Overview
Dependencies
Maintainers
8
Versions
37
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

broccoli-typescript-compiler

A Broccoli plugin which compiles TypeScript files.


Version published
Weekly downloads
813
increased by44.92%
Maintainers
8
Weekly downloads
 
Created
Source

broccoli-typescript-compiler

Build Status

A Broccoli plugin which compiles TypeScript files.

How to install?

$ npm install broccoli-typescript-compiler --save-dev

How to use?

var typescript = require("broccoli-typescript-compiler").default;
var cjsTree = typescript(inputTree, {
  tsconfig: {
    compilerOptions: {
      module: "commonjs",
      target: "es5",
      moduleResolution: "node",
      newLine: "LF",
      rootDir: "src",
      outDir: "dist",
      sourceMap: true,
      declaration: true,
    },
    files: ["src/index.ts", "src/tests/**"],
  },
  throwOnError: false,
  annotation: "compile program",
});

Config Options:

tsconfig:

annotation:

An optional string, which when provide should be a descriptive annotation. Useful for debugging, to tell multiple instances of the same plugin apart.

throwOnError

An optional boolean, defaulting to false. If set to true, will cause the build to break on errors.

note: if process.env.NODE_ENV === 'production' is true, throwOnError will default to true.

Ways to use:

via the broccoli plugin subclass

This outputs only the emitted files from the compiled program.

const { TypescriptCompiler } = require("broccoli-typescript-compiler");
let compiled = new TypescriptCompiler(input, options);

via function

This outputs only the emitted files from the compiled program.

const { default: typescript } = require("broccoli-typescript-compiler");

let compiled = typescript(src, options);

filter function (passthrough non .ts files)

This selects only ts files from the input to compile and merges emitted files with the non ts files in the input.

const { filterTypescript } = require("broccoli-typescript-compiler");
let output = filterTypescript(input, options);

Development

How to upgrade typescript

  1. Initialize git submodules. git submodule update --init
  2. Update typescript in package.json
  3. Run yarn run generate-tsconfig-interface
  4. Update vendor/typescript. cd vendor/typescript && git fetch --tags && git checkout v[new-version-of-typescript]
  5. Commit all of the above changes
  6. Run yarn test. There may be some changes needed to the tests to accomidate changes in TypeScript.

Keywords

FAQs

Package last updated on 02 Feb 2022

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