typescript

package
v12.0.0-...-09a2066 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 3, 2017 License: MIT, MIT Imports: 11 Imported by: 0

Documentation

Overview

Package typescript provides a typescript compiler with hot-reloader and optionally a cloud-based editor, called 'alm-tools'. typescript (by microsoft) and alm-tools (by basarat) have their own (open-source) licenses the tools are not used directly by this adaptor, but it's good to know where you can find the software.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CompilerOptions

type CompilerOptions struct {
	Declaration                      bool   `json:"declaration"`
	Module                           string `json:"module"`
	Target                           string `json:"target"`
	Watch                            bool   `json:"watch"`
	Charset                          string `json:"charset"`
	Diagnostics                      bool   `json:"diagnostics"`
	EmitBOM                          bool   `json:"emitBOM"`
	EmitDecoratorMetadata            bool   `json:"emitDecoratorMetadata"`
	ExperimentalDecorators           bool   `json:"experimentalDecorators"`
	InlineSourceMap                  bool   `json:"inlineSourceMap"`
	InlineSources                    bool   `json:"inlineSources"`
	IsolatedModules                  bool   `json:"isolatedModules"`
	Jsx                              string `json:"jsx"`
	ReactNamespace                   string `json:"reactNamespace"`
	ListFiles                        bool   `json:"listFiles"`
	Locale                           string `json:"locale"`
	MapRoot                          string `json:"mapRoot"`
	ModuleResolution                 string `json:"moduleResolution"`
	NewLine                          string `json:"newLine"`
	NoEmit                           bool   `json:"noEmit"`
	NoEmitOnError                    bool   `json:"noEmitOnError"`
	NoEmitHelpers                    bool   `json:"noEmitHelpers"`
	NoImplicitAny                    bool   `json:"noImplicitAny"`
	NoLib                            bool   `json:"noLib"`
	NoResolve                        bool   `json:"noResolve"`
	SkipDefaultLibCheck              bool   `json:"skipDefaultLibCheck"`
	OutDir                           string `json:"outDir"`
	OutFile                          string `json:"outFile"`
	PreserveConstEnums               bool   `json:"preserveConstEnums"`
	Pretty                           bool   `json:"pretty"`
	RemoveComments                   bool   `json:"removeComments"`
	RootDir                          string `json:"rootDir"`
	SourceMap                        bool   `json:"sourceMap"`
	SourceRoot                       string `json:"sourceRoot"`
	StripInternal                    bool   `json:"stripInternal"`
	SuppressExcessPropertyErrors     bool   `json:"suppressExcessPropertyErrors"`
	SuppressImplicitAnyIndexErrors   bool   `json:"suppressImplicitAnyIndexErrors"`
	AllowUnusedLabels                bool   `json:"allowUnusedLabels"`
	NoImplicitReturns                bool   `json:"noImplicitReturns"`
	NoFallthroughCasesInSwitch       bool   `json:"noFallthroughCasesInSwitch"`
	AllowUnreachableCode             bool   `json:"allowUnreachableCode"`
	ForceConsistentCasingInFileNames bool   `json:"forceConsistentCasingInFileNames"`
	AllowSyntheticDefaultImports     bool   `json:"allowSyntheticDefaultImports"`
	AllowJs                          bool   `json:"allowJs"`
	NoImplicitUseStrict              bool   `json:"noImplicitUseStrict"`
}

CompilerOptions contains all the compiler options used by the tsc (typescript compiler)

type Config

type Config struct {
	// Bin the path of the tsc binary file
	// if empty then the plugin tries to find it
	Bin string
	// Dir the client side directory, which typescript (.ts) files are live
	Dir string
	// Ignore ignore folders, default is /node_modules/
	Ignore string
	// Tsconfig the typescript build configs, including the compiler's options
	Tsconfig *Tsconfig
}

Config the configs for the Typescript plugin Has five (5) fields

1. Bin: string, the typescript installation directory/typescript/lib/tsc.js, if empty it will search inside global npm modules 2. Dir: string, Dir set the root, where to search for typescript files/project. Default "./" 3. Ignore: string, comma separated ignore typescript files/project from these directories. Default "" (node_modules are always ignored) 4. Tsconfig: &typescript.Tsconfig{}, here you can set all compilerOptions if no tsconfig.json exists inside the 'Dir' 5. Editor: typescript.Editor("username","password"), if setted then alm-tools browser-based typescript IDE will be available. Defailt is nil

func DefaultConfig

func DefaultConfig() Config

DefaultConfig returns the default Options of the Typescript adaptor Bin and Editor are setting in runtime via the adaptor

type TsAdaptor

type TsAdaptor struct {
	Config *Config
	// contains filtered or unexported fields
}

TsAdaptor the struct of the Typescript TsAdaptor, holds all necessary fields & methods

func New

func New() *TsAdaptor

New creates & returns a new instnace typescript plugin

func (*TsAdaptor) Adapt

func (t *TsAdaptor) Adapt(frame *iris.Policies)

Adapt addapts a TsAdaptor to the Policies via EventPolicy. We use that method instead of direct return EventPolicy from new because the user should be able to change its configuration from that public API

type Tsconfig

type Tsconfig struct {
	CompilerOptions CompilerOptions `json:"compilerOptions"`
	Exclude         []string        `json:"exclude"`
}

Tsconfig the struct for tsconfig.json

func DefaultTsconfig

func DefaultTsconfig() Tsconfig

DefaultTsconfig returns the default Tsconfig, with CompilerOptions module: commonjs, target: es5 and ignore the node_modules

func FromFile

func FromFile(tsConfigAbsPath string) (config Tsconfig, err error)

FromFile reads a file & returns the Tsconfig by its contents

func (*Tsconfig) CompilerArgs

func (tsconfig *Tsconfig) CompilerArgs() []string

CompilerArgs returns the CompilerOptions' contents of the Tsconfig it reads the json tags, add '--' at the start of each one and returns an array of strings this is from file

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL