@@ -152,3 +152,119 @@ public extension SwiftyESBuild {
152152 }
153153 }
154154}
155+
156+ /**
157+ Simple options:
158+ --bundle Bundle all dependencies into the output files
159+ --define:K=V Substitute K with V while parsing
160+ --external:M Exclude module M from the bundle (can use * wildcards)
161+ --format=... Output format (iife | cjs | esm, no default when not
162+ bundling, otherwise default is iife when platform
163+ is browser and cjs when platform is node)
164+ --loader:X=L Use loader L to load file extension X, where L is
165+ one of: base64 | binary | copy | css | dataurl |
166+ empty | file | js | json | jsx | text | ts | tsx
167+ --minify Minify the output (sets all --minify-* flags)
168+ --outdir=... The output directory (for multiple entry points)
169+ --outfile=... The output file (for one entry point)
170+ --packages=... Set to "external" to avoid bundling any package
171+ --platform=... Platform target (browser | node | neutral,
172+ default browser)
173+ --serve=... Start a local HTTP server on this host:port for outputs
174+ --sourcemap Emit a source map
175+ --splitting Enable code splitting (currently only for esm)
176+ --target=... Environment target (e.g. es2017, chrome58, firefox57,
177+ safari11, edge16, node10, ie9, opera45, default esnext)
178+ --watch Watch mode: rebuild on file system changes (stops when
179+ stdin is closed, use "--watch=forever" to ignore stdin)
180+
181+ Advanced options:
182+ --allow-overwrite Allow output files to overwrite input files
183+ --analyze Print a report about the contents of the bundle
184+ (use "--analyze=verbose" for a detailed report)
185+ --asset-names=... Path template to use for "file" loader files
186+ (default "[name]-[hash]")
187+ --banner:T=... Text to be prepended to each output file of type T
188+ where T is one of: css | js
189+ --certfile=... Certificate for serving HTTPS (see also "--keyfile")
190+ --charset=utf8 Do not escape UTF-8 code points
191+ --chunk-names=... Path template to use for code splitting chunks
192+ (default "[name]-[hash]")
193+ --color=... Force use of color terminal escapes (true | false)
194+ --drop:... Remove certain constructs (console | debugger)
195+ --entry-names=... Path template to use for entry point output paths
196+ (default "[dir]/[name]", can also use "[hash]")
197+ --footer:T=... Text to be appended to each output file of type T
198+ where T is one of: css | js
199+ --global-name=... The name of the global for the IIFE format
200+ --ignore-annotations Enable this to work with packages that have
201+ incorrect tree-shaking annotations
202+ --inject:F Import the file F into all input files and
203+ automatically replace matching globals with imports
204+ --jsx-dev Use React's automatic runtime in development mode
205+ --jsx-factory=... What to use for JSX instead of React.createElement
206+ --jsx-fragment=... What to use for JSX instead of React.Fragment
207+ --jsx-import-source=... Override the package name for the automatic runtime
208+ (default "react")
209+ --jsx-side-effects Do not remove unused JSX expressions
210+ --jsx=... Set to "automatic" to use React's automatic runtime
211+ or to "preserve" to disable transforming JSX to JS
212+ --keep-names Preserve "name" on functions and classes
213+ --keyfile=... Key for serving HTTPS (see also "--certfile")
214+ --legal-comments=... Where to place legal comments (none | inline |
215+ eof | linked | external, default eof when bundling
216+ and inline otherwise)
217+ --log-level=... Disable logging (verbose | debug | info | warning |
218+ error | silent, default info)
219+ --log-limit=... Maximum message count or 0 to disable (default 6)
220+ --log-override:X=Y Use log level Y for log messages with identifier X
221+ --main-fields=... Override the main file order in package.json
222+ (default "browser,module,main" when platform is
223+ browser and "main,module" when platform is node)
224+ --mangle-cache=... Save "mangle props" decisions to a JSON file
225+ --mangle-props=... Rename all properties matching a regular expression
226+ --mangle-quoted=... Enable renaming of quoted properties (true | false)
227+ --metafile=... Write metadata about the build to a JSON file
228+ (see also: https://esbuild.github.io/analyze/)
229+ --minify-whitespace Remove whitespace in output files
230+ --minify-identifiers Shorten identifiers in output files
231+ --minify-syntax Use equivalent but shorter syntax in output files
232+ --out-extension:.js=.mjs Use a custom output extension instead of ".js"
233+ --outbase=... The base path used to determine entry point output
234+ paths (for multiple entry points)
235+ --preserve-symlinks Disable symlink resolution for module lookup
236+ --public-path=... Set the base URL for the "file" loader
237+ --pure:N Mark the name N as a pure function for tree shaking
238+ --reserve-props=... Do not mangle these properties
239+ --resolve-extensions=... A comma-separated list of implicit extensions
240+ (default ".tsx,.ts,.jsx,.js,.css,.json")
241+ --servedir=... What to serve in addition to generated output files
242+ --source-root=... Sets the "sourceRoot" field in generated source maps
243+ --sourcefile=... Set the source file for the source map (for stdin)
244+ --sourcemap=external Do not link to the source map with a comment
245+ --sourcemap=inline Emit the source map with an inline data URL
246+ --sources-content=false Omit "sourcesContent" in generated source maps
247+ --supported:F=... Consider syntax F to be supported (true | false)
248+ --tree-shaking=... Force tree shaking on or off (false | true)
249+ --tsconfig=... Use this tsconfig.json file instead of other ones
250+ --version Print the current version (0.18.6) and exit
251+
252+ Examples:
253+ # Produces dist/entry_point.js and dist/entry_point.js.map
254+ esbuild --bundle entry_point.js --outdir=dist --minify --sourcemap
255+
256+ # Allow JSX syntax in .js files
257+ esbuild --bundle entry_point.js --outfile=out.js --loader:.js=jsx
258+
259+ # Substitute the identifier RELEASE for the literal true
260+ esbuild example.js --outfile=out.js --define:RELEASE=true
261+
262+ # Provide input via stdin, get output via stdout
263+ esbuild --minify --loader=ts < input.ts > output.js
264+
265+ # Automatically rebuild when input files are changed
266+ esbuild app.ts --bundle --watch
267+
268+ # Start a local HTTP server for everything in "www"
269+ esbuild app.ts --bundle --servedir=www --outdir=www/js
270+ */
0 commit comments