Echo Banner
    Preparing search index...

    Function banner

    • Generate a production banner comment from package metadata.

      Parameters

      • __namedParameters: {
            fallback?: { name?: string; version?: string };
            pkg: PackageMeta;
            prefixVersion?: string;
            shebang?: false | Shebang;
            style?: "js";
            useDisplayName?: boolean;
        }
        • Optionalfallback?: { name?: string; version?: string }

          Fallback values when name or version are missing

        • pkg: PackageMeta

          Package metadata used to construct the banner

        • OptionalprefixVersion?: string

          Prefix applied before the version.

          "v"
          
        • Optionalshebang?: false | Shebang

          Optional shebang line (for CLI binaries).

          false
          
        • Optionalstyle?: "js"

          Banner comment style.

          Currently supports:

          • js
          "js"
          
        • OptionaluseDisplayName?: boolean

          Prefer displayName over name when available

      Returns string

      A formatted banner string suitable for insertion at the top of bundled files.

      This utility creates a formatted banner typically used at the top of bundled files (e.g., Rollup, tsdown, esbuild, webpack outputs).

      The banner includes:

      • Package name or display name
      • Version (with optional prefix)
      • Description
      • Copyright
      • License
      • Homepage
      • Repository URL

      Repository URLs are normalized by removing common prefixes such as git+ and suffixes like .git.

      Thrown if the provided pkg value is not a valid object.

      import pkg from "../package.json";

      const text = banner({ pkg });
      console.log(text);
      const text = banner({
      pkg,
      shebang: "#!/usr/bin/env node"
      });
      const text = banner({
      pkg,
      useDisplayName: true
      });