Documentation
¶
Index ¶
- Constants
- func ModuleExportsAST(log logging.Log, source logging.Source, options ParseOptions, expr ast.Expr) ast.AST
- func Parse(log logging.Log, source logging.Source, options ParseOptions) (result ast.AST, ok bool)
- func ParseJSON(log logging.Log, source logging.Source, options ParseJSONOptions) (result ast.Expr, ok bool)
- type DefineFunc
- type DotDefine
- type FindSymbol
- type JSXOptions
- type LanguageTarget
- type ParseJSONOptions
- type ParseOptions
- type ProcessedDefines
- type TypeScriptOptions
Constants ¶
View Source
const ( // These are arranged such that ESNext is the default zero value and such // that earlier releases are less than later releases ES2015 = -6 ES2016 = -5 ES2017 = -4 ES2018 = -3 ES2019 = -2 ES2020 = -1 ESNext = 0 )
Variables ¶
This section is empty.
Functions ¶
func ModuleExportsAST ¶
Types ¶
type DefineFunc ¶
type DefineFunc func(FindSymbol) ast.E
type DotDefine ¶ added in v0.4.0
type DotDefine struct { Parts []string DefineFunc DefineFunc // This is used to whitelist certain functions that are known to be safe to // remove if their result is unused CanBeRemovedIfUnused bool }
type FindSymbol ¶
type JSXOptions ¶
type LanguageTarget ¶
type LanguageTarget int8
type ParseJSONOptions ¶
type ParseOptions ¶
type ParseOptions struct { // true: imports are scanned and bundled along with the file // false: imports are left alone and the file is passed through as-is IsBundling bool Defines *ProcessedDefines MangleSyntax bool TS TypeScriptOptions JSX JSXOptions Target LanguageTarget }
type ProcessedDefines ¶ added in v0.4.0
type ProcessedDefines struct { IdentifierDefines map[string]DefineFunc DotDefines map[string][]DotDefine }
func ProcessDefines ¶ added in v0.4.0
func ProcessDefines(userDefines map[string]DefineFunc) ProcessedDefines
This transformation is expensive, so we only want to do it once. Make sure to only call processDefines() once per compilation. Unfortunately Golang doesn't have an efficient way to copy a map and the overhead of copying all of the properties into a new map once for every new parser noticeably slows down our benchmarks.
type TypeScriptOptions ¶
type TypeScriptOptions struct {
Parse bool
}
Click to show internal directories.
Click to hide internal directories.