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 ¶
var NoOpLogger = func(string, ...interface{}) {}
NoOpLogger can be used as the logger argument, it prints nothing.
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 set 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 (*Tsconfig) CompilerArgs ¶
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.