Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ts-browser-eval

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ts-browser-eval

Typescript compiler in the browser

  • 0.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

ts-browser-eval

Overview

Typescript compiler in the browser generating output chunks using rollup

Installation

$ npm install typed-route

###Quick example:

// lazy import for code splitting (package size ~2.5 MB)
const compile = await import('ts-browser-eval');

const project = {
  'main.ts': 'import {ABC} from "./inner.ts";\nconsole.log(ABC.a)',
  'inner.ts': 'export enum ABC {a, b, c}',
};

const result = await compile(project, 'root/main.ts', {
  target: 'ES2017',
}, {
  format: 'iife',
  name: 'bundle',
});

console.log(result[0].code);
/*
(function () {
    'use strict';

    var ABC;
    (function (ABC) {
        ABC[ABC["a"] = 0] = "a";
        ABC[ABC["b"] = 1] = "b";
        ABC[ABC["c"] = 2] = "c";
    })(ABC || (ABC = {}));

    console.log(ABC.a);

}());
*/

Arguments

  • project (flat object {[filename]: tsCode})
  • entry point (the root filename)
  • tsOptions (https://www.typescriptlang.org/docs/handbook/compiler-options.html NOTE: some options doesn't work in the browser)
  • outputOptions (rollup - https://rollupjs.org/guide/en/#outputoptions-object)

Return

Current issues

  • There're no type checks ☹

Keywords

FAQs

Package last updated on 24 Sep 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