typescript

package
v10.1.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2018 License: BSD-3-Clause, BSD-3-Clause Imports: 9 Imported by: 0

README

Typescript

Typescript and alm-tools cloud editor automation tools for the iris web framework.

Table of contents

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

View Source
var (
	// NoOpLogger can be used as the logger argument, it prints nothing.
	NoOpLogger = func(string, ...interface{}) {}
)

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 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

type Typescript

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

Typescript contains the unique iris' typescript loader, holds all necessary fields & methods.

func New

func New(cfg ...Config) *Typescript

New creates & returns a new instnace typescript plugin

func (*Typescript) Run

func (t *Typescript) Run(logger func(format string, a ...interface{}))

Run starts the typescript filewatcher watcher and the typescript compiler.

Directories

Path Synopsis
_examples

Jump to

Keyboard shortcuts

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