Enum SourceMapMode

java.lang.Object
java.lang.Enum<SourceMapMode>
software.amazon.awscdk.services.lambda.nodejs.SourceMapMode
All Implemented Interfaces:
Serializable, Comparable<SourceMapMode>, java.lang.constant.Constable

@Generated(value="jsii-pacmak/1.96.0 (build 921e240)", date="2024-04-10T22:22:30.143Z") @Stability(Stable) public enum SourceMapMode extends Enum<SourceMapMode>
SourceMap mode for esbuild.

Example:

 NodejsFunction.Builder.create(this, "my-handler")
         .bundling(BundlingOptions.builder()
                 .minify(true) // minify code, defaults to false
                 .sourceMap(true) // include source map, defaults to false
                 .sourceMapMode(SourceMapMode.INLINE) // defaults to SourceMapMode.DEFAULT
                 .sourcesContent(false) // do not include original source into source map, defaults to true
                 .target("es2020") // target environment for the generated JavaScript code
                 .loader(Map.of( // Use the 'dataurl' loader for '.png' files
                         ".png", "dataurl"))
                 .define(Map.of( // Replace strings during build time
                         "process.env.API_KEY", JSON.stringify("xxx-xxxx-xxx"),
                         "process.env.PRODUCTION", JSON.stringify(true),
                         "process.env.NUMBER", JSON.stringify(123)))
                 .logLevel(LogLevel.ERROR) // defaults to LogLevel.WARNING
                 .keepNames(true) // defaults to false
                 .tsconfig("custom-tsconfig.json") // use custom-tsconfig.json instead of default,
                 .metafile(true) // include meta file, defaults to false
                 .banner("/* comments */") // requires esbuild >= 0.9.0, defaults to none
                 .footer("/* comments */") // requires esbuild >= 0.9.0, defaults to none
                 .charset(Charset.UTF8) // do not escape non-ASCII characters, defaults to Charset.ASCII
                 .format(OutputFormat.ESM) // ECMAScript module output format, defaults to OutputFormat.CJS (OutputFormat.ESM requires Node.js >= 14)
                 .mainFields(List.of("module", "main")) // prefer ECMAScript versions of dependencies
                 .inject(List.of("./my-shim.js", "./other-shim.js")) // allows to automatically replace a global variable with an import from another file
                 .esbuildArgs(Map.of( // Pass additional arguments to esbuild
                         "--log-limit", "0",
                         "--splitting", true))
                 .build())
         .build();
 

See Also:
  • Nested Class Summary

    Nested classes/interfaces inherited from class java.lang.Enum

    Enum.EnumDesc<E extends Enum<E>>
  • Enum Constant Summary

    Enum Constants
    Enum Constant
    Description
    Both sourceMap mode - If you want to have the effect of both inline and external simultaneously.
    Default sourceMap mode - will generate a .js.map file alongside any generated .js file and add a special //# sourceMappingURL= comment to the bottom of the .js file pointing to the .js.map file.
    External sourceMap mode - If you want to omit the special //# sourceMappingURL= comment from the generated .js file but you still want to generate the .js.map files.
    Inline sourceMap mode - If you want to insert the entire source map into the .js file instead of generating a separate .js.map file.
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the enum constant of this type with the specified name.
    static SourceMapMode[]
    Returns an array containing the constants of this enum type, in the order they are declared.

    Methods inherited from class java.lang.Object

    getClass, notify, notifyAll, wait, wait, wait
  • Enum Constant Details

    • DEFAULT

      @Stability(Stable) public static final SourceMapMode DEFAULT
      Default sourceMap mode - will generate a .js.map file alongside any generated .js file and add a special //# sourceMappingURL= comment to the bottom of the .js file pointing to the .js.map file.
    • EXTERNAL

      @Stability(Stable) public static final SourceMapMode EXTERNAL
      External sourceMap mode - If you want to omit the special //# sourceMappingURL= comment from the generated .js file but you still want to generate the .js.map files.
    • INLINE

      @Stability(Stable) public static final SourceMapMode INLINE
      Inline sourceMap mode - If you want to insert the entire source map into the .js file instead of generating a separate .js.map file.
    • BOTH

      @Stability(Stable) public static final SourceMapMode BOTH
      Both sourceMap mode - If you want to have the effect of both inline and external simultaneously.
  • Method Details

    • values

      public static SourceMapMode[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      Returns:
      an array containing the constants of this enum type, in the order they are declared
    • valueOf

      public static SourceMapMode valueOf(String name)
      Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum type has no constant with the specified name
      NullPointerException - if the argument is null