package config
import "github.com/evanw/esbuild/internal/config"
Index ¶
- func CompileFilterForPlugin(pluginName string, kind string, filter string) (*regexp.Regexp, error)
- func PluginAppliesToPath(path logger.Path, filter *regexp.Regexp, namespace string) bool
- type DefineData
- type DefineFunc
- type DotDefine
- type ExternalModules
- type FindSymbol
- type Format
- type InjectedFile
- type JSXOptions
- type LanguageTarget
- type Loader
- type Mode
- type OnLoad
- type OnLoadArgs
- type OnLoadResult
- type OnResolve
- type OnResolveArgs
- type OnResolveResult
- type Options
- type Platform
- type Plugin
- type ProcessedDefines
- type SourceMap
- type StdinInfo
- type StrictOptions
- type TSOptions
Functions ¶
func CompileFilterForPlugin ¶
func PluginAppliesToPath ¶
Types ¶
type DefineData ¶
type DefineData struct { DefineFunc DefineFunc // True if accessing this value is known to not have any side effects. For // example, a bare reference to "Object.create" can be removed because it // does not have any observable side effects. CanBeRemovedIfUnused bool // True if a call to this value is known to not have any side effects. For // example, a bare call to "Object()" can be removed because it does not // have any observable side effects. CallCanBeUnwrappedIfUnused bool // Set to true to warn users that this should be defined if it's not already. WarnAboutLackOfDefine bool }
type DefineFunc ¶
type DefineFunc func(logger.Loc, FindSymbol) js_ast.E
type DotDefine ¶
type DotDefine struct { Parts []string Data DefineData }
type ExternalModules ¶
type FindSymbol ¶
type Format ¶
type Format uint8
const ( // This is used when not bundling. It means to preserve whatever form the // import or export was originally in. ES6 syntax stays ES6 syntax and // CommonJS syntax stays CommonJS syntax. FormatPreserve Format = iota // IIFE stands for immediately-invoked function expression. That looks like // this: // // (() => { // ... bundled code ... // })(); // // If the optional ModuleName is configured, then we'll write out this: // // let moduleName = (() => { // ... bundled code ... // return exports; // })(); // FormatIIFE // The CommonJS format looks like this: // // ... bundled code ... // module.exports = exports; // FormatCommonJS // The ES module format looks like this: // // ... bundled code ... // export {...}; // FormatESModule )
func (Format) KeepES6ImportExportSyntax ¶
func (Format) String ¶
type InjectedFile ¶
type JSXOptions ¶
type LanguageTarget ¶
type LanguageTarget int8
type Loader ¶
type Loader int
const ( LoaderNone Loader = iota LoaderJS LoaderJSX LoaderTS LoaderTSX LoaderJSON LoaderText LoaderBase64 LoaderDataURL LoaderFile LoaderBinary LoaderCSS LoaderDefault )
func (Loader) CanHaveSourceMap ¶
func (Loader) IsTypeScript ¶
type Mode ¶
type Mode uint8
type OnLoad ¶
type OnLoad struct { Name string Filter *regexp.Regexp Namespace string Callback func(OnLoadArgs) OnLoadResult }
type OnLoadArgs ¶
type OnLoadResult ¶
type OnLoadResult struct { PluginName string Contents *string AbsResolveDir string Loader Loader Msgs []logger.Msg ThrownError error }
type OnResolve ¶
type OnResolve struct { Name string Filter *regexp.Regexp Namespace string Callback func(OnResolveArgs) OnResolveResult }
type OnResolveArgs ¶
type OnResolveResult ¶
type OnResolveResult struct { PluginName string Path logger.Path External bool Namespace string Msgs []logger.Msg ThrownError error }
type Options ¶
type Options struct { Mode Mode RemoveWhitespace bool MinifyIdentifiers bool MangleSyntax bool CodeSplitting bool // Setting this to true disables warnings about code that is very likely to // be a bug. This is used to ignore issues inside "node_modules" directories. // This has caught real issues in the past. However, it's not esbuild's job // to find bugs in other libraries, and these warnings are problematic for // people using these libraries with esbuild. The only fix is to either // disable all esbuild warnings and not get warnings about your own code, or // to try to get the warning fixed in the affected library. This is // especially annoying if the warning is a false positive as was the case in // https://github.com/firebase/firebase-js-sdk/issues/3814. So these warnings // are now disabled for code inside "node_modules" directories. SuppressWarningsAboutWeirdCode bool // If true, make sure to generate a single file that can be written to stdout WriteToStdout bool OmitRuntimeForTests bool PreserveUnusedImportsTS bool UseDefineForClassFields bool AvoidTDZ bool ASCIIOnly bool Defines *ProcessedDefines TS TSOptions JSX JSXOptions Platform Platform UnsupportedJSFeatures compat.JSFeature UnsupportedCSSFeatures compat.CSSFeature ExtensionOrder []string MainFields []string ExternalModules ExternalModules AbsOutputFile string AbsOutputDir string AbsOutputBase string OutputExtensions map[string]string ModuleName []string TsConfigOverride string ExtensionToLoader map[string]Loader OutputFormat Format PublicPath string InjectAbsPaths []string InjectedFiles []InjectedFile Plugins []Plugin // If present, metadata about the bundle is written as JSON here AbsMetadataFile string SourceMap SourceMap Stdin *StdinInfo }
func (*Options) OutputExtensionFor ¶
type Platform ¶
type Platform uint8
type Plugin ¶
type ProcessedDefines ¶
type ProcessedDefines struct { IdentifierDefines map[string]DefineData DotDefines map[string][]DotDefine }
func ProcessDefines ¶
func ProcessDefines(userDefines map[string]DefineData) 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 SourceMap ¶
type SourceMap uint8
const ( SourceMapNone SourceMap = iota SourceMapInline SourceMapLinkedWithComment SourceMapExternalWithoutComment )
type StdinInfo ¶
type StrictOptions ¶
type StrictOptions struct { // Loose: "class Foo { foo = 1 }" => "class Foo { constructor() { this.foo = 1; } }" // Strict: "class Foo { foo = 1 }" => "class Foo { constructor() { __publicField(this, 'foo', 1); } }" // // The disadvantage of strictness here is code bloat and performance. The // advantage is following the class field specification accurately. For // example, loose mode will incorrectly trigger setter methods while strict // mode won't. ClassFields bool }
type TSOptions ¶
type TSOptions struct { Parse bool }
Source Files ¶
- Version
- v0.8.3
- Published
- Nov 3, 2020
- Platform
- windows/amd64
- Imports
- 8 packages
- Last checked
- 14 minutes ago –
Tools for package owners.