Class AddBundleOptions.Jsii$Proxy

    • Constructor Detail

      • Jsii$Proxy

        protected Jsii$Proxy​(software.amazon.jsii.JsiiObjectRef objRef)
        Constructor that initializes the object based on values retrieved from the JsiiObject.
        Parameters:
        objRef - Reference to the JSII managed object.
    • Method Detail

      • getBanner

        public final String getBanner()
        Description copied from interface: AddBundleOptions
        (experimental) Use this to insert an arbitrary string at the beginning of generated JavaScript files.

        This is similar to footer which inserts at the end instead of the beginning.

        This is commonly used to insert comments:

        Default: - no comments are passed

        Specified by:
        getBanner in interface AddBundleOptions
      • getCharset

        public final Charset getCharset()
        Description copied from interface: AddBundleOptions
        (experimental) The charset to use for esbuild's output.

        By default esbuild's output is ASCII-only. Any non-ASCII characters are escaped using backslash escape sequences. Using escape sequences makes the generated output slightly bigger, and also makes it harder to read. If you would like for esbuild to print the original characters without using escape sequences, use Charset.UTF8.

        Default: Charset.ASCII

        Specified by:
        getCharset in interface AddBundleOptions
        See Also:
        https://esbuild.github.io/api/#charset
      • getDefine

        public final Map<String,​String> getDefine()
        Description copied from interface: AddBundleOptions
        (experimental) Replace global identifiers with constant expressions.

        For example, { 'process.env.DEBUG': 'true' }.

        Another example, { 'process.env.API_KEY': JSON.stringify('xxx-xxxx-xxx') }.

        Default: - no replacements are made

        Specified by:
        getDefine in interface AddBundleOptions
      • getEsbuildArgs

        public final Map<String,​Object> getEsbuildArgs()
        Description copied from interface: AddBundleOptions
        (experimental) Build arguments to pass into esbuild.

        For example, to add the --log-limit flag:

         project.bundler.addBundle("./src/hello.ts", {
           platform: "node",
           target: "node18",
           sourcemap: true,
           format: "esm",
           esbuildArgs: {
             "--log-limit": "0",
           },
         });
         

        Default: - no additional esbuild arguments are passed

        Specified by:
        getEsbuildArgs in interface AddBundleOptions
      • getFooter

        public final String getFooter()
        Description copied from interface: AddBundleOptions
        (experimental) Use this to insert an arbitrary string at the end of generated JavaScript files.

        This is similar to banner which inserts at the beginning instead of the end.

        This is commonly used to insert comments

        Default: - no comments are passed

        Specified by:
        getFooter in interface AddBundleOptions
      • getFormat

        public final String getFormat()
        Description copied from interface: AddBundleOptions
        (experimental) Output format for the generated JavaScript files.

        There are currently three possible values that can be configured: "iife", "cjs", and "esm".

        If not set (undefined), esbuild picks an output format for you based on platform:

        • "cjs" if platform is "node"
        • "iife" if platform is "browser"
        • "esm" if platform is "neutral"

        Note: If making a bundle to run under node with ESM, set format to "esm" instead of setting platform to "neutral".

        Default: undefined

        Specified by:
        getFormat in interface AddBundleOptions
        See Also:
        https://esbuild.github.io/api/#format
      • getKeepNames

        public final Boolean getKeepNames()
        Description copied from interface: AddBundleOptions
        (experimental) Whether to preserve the original name values even in minified code.

        In JavaScript the name property on functions and classes defaults to a nearby identifier in the source code.

        However, minification renames symbols to reduce code size and bundling sometimes need to rename symbols to avoid collisions. That changes value of the name property for many of these cases. This is usually fine because the name property is normally only used for debugging. However, some frameworks rely on the name property for registration and binding purposes. If this is the case, you can enable this option to preserve the original name values even in minified code.

        Default: false

        Specified by:
        getKeepNames in interface AddBundleOptions
      • getLoaders

        public final Map<String,​String> getLoaders()
        Description copied from interface: AddBundleOptions
        (experimental) Map of file extensions (without dot) and loaders to use for this file type.

        Loaders are appended to the esbuild command by --loader:.extension=loader

        Specified by:
        getLoaders in interface AddBundleOptions
      • getLogLevel

        public final BundleLogLevel getLogLevel()
        Description copied from interface: AddBundleOptions
        (experimental) Log level for esbuild.

        This is also propagated to the package manager and applies to its specific install command.

        Default: LogLevel.WARNING

        Specified by:
        getLogLevel in interface AddBundleOptions
      • getMainFields

        public final List<String> getMainFields()
        Description copied from interface: AddBundleOptions
        (experimental) How to determine the entry point for modules.

        Try ['module', 'main'] to default to ES module versions.

        Default: []

        Specified by:
        getMainFields in interface AddBundleOptions
      • getMetafile

        public final Boolean getMetafile()
        Description copied from interface: AddBundleOptions
        (experimental) This option tells esbuild to write out a JSON file relative to output directory with metadata about the build.

        The metadata in this JSON file follows this schema (specified using TypeScript syntax):

         {
           outputs: {
             [path: string]: {
               bytes: number
               inputs: {
                 [path: string]: { bytesInOutput: number }
               }
               imports: { path: string }[]
               exports: string[]
             }
           }
         }
         

        This data can then be analyzed by other tools. For example, bundle buddy can consume esbuild's metadata format and generates a treemap visualization of the modules in your bundle and how much space each one takes up.

        Default: false

        Specified by:
        getMetafile in interface AddBundleOptions
        See Also:
        https://esbuild.github.io/api/#metafile
      • getOutfile

        public final String getOutfile()
        Description copied from interface: AddBundleOptions
        (experimental) Bundler output path relative to the asset's output directory.

        Default: "index.js"

        Specified by:
        getOutfile in interface AddBundleOptions
      • getTsconfigPath

        public final String getTsconfigPath()
        Description copied from interface: AddBundleOptions
        (experimental) The path of the tsconfig.json file to use for bundling.

        Default: "tsconfig.json"

        Specified by:
        getTsconfigPath in interface AddBundleOptions
      • getExternals

        public final List<String> getExternals()
        Description copied from interface: BundlingOptions
        (experimental) You can mark a file or a package as external to exclude it from your build.

        Instead of being bundled, the import will be preserved (using require for the iife and cjs formats and using import for the esm format) and will be evaluated at run time instead.

        This has several uses. First of all, it can be used to trim unnecessary code from your bundle for a code path that you know will never be executed. For example, a package may contain code that only runs in node but you will only be using that package in the browser. It can also be used to import code in node at run time from a package that cannot be bundled. For example, the fsevents package contains a native extension, which esbuild doesn't support.

        Default: []

        Specified by:
        getExternals in interface BundlingOptions
      • getWatchTask

        public final Boolean getWatchTask()
        Description copied from interface: BundlingOptions
        (experimental) In addition to the bundle:xyz task, creates bundle:xyz:watch task which will invoke the same esbuild command with the --watch flag.

        This can be used to continusouly watch for changes.

        Default: true

        Specified by:
        getWatchTask in interface BundlingOptions
      • $jsii$toJson

        @Internal
        public com.fasterxml.jackson.databind.JsonNode $jsii$toJson()
        Specified by:
        $jsii$toJson in interface software.amazon.jsii.JsiiSerializable
      • hashCode

        public final int hashCode()
        Overrides:
        hashCode in class Object