{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://catalog.lintel.tools/schemas/schemastore/bun-lock/latest.json",
  "title": "Bun.lock file",
  "description": "Schema definition for Bun's `bun.lock` file (package manager lockfile). See <https://bun.sh/docs/install/lockfile>",
  "x-lintel": {
    "source": "https://www.schemastore.org/bun-lock.json",
    "sourceSha256": "76f75399699d13b028f9732d9cf4dbd240cc5b0ef0e028844c18c60a3e93741e",
    "fileMatch": [
      "bun.lock"
    ]
  },
  "type": "object",
  "properties": {
    "lockfileVersion": {
      "type": "integer",
      "enum": [
        0,
        1
      ],
      "description": "Specifies the version of the lockfile format. Currently only sypporting 0 or 1."
    },
    "workspaces": {
      "type": "object",
      "description": "Defines the project workspaces and their corresponding packages.",
      "patternProperties": {
        ".*": {
          "$ref": "#/$defs/BunLockFileWorkspacePackage"
        }
      }
    },
    "overrides": {
      "type": "object",
      "description": "Defines custom dependency resolutions for specific packages.",
      "patternProperties": {
        ".*": {
          "type": "string"
        }
      }
    },
    "patchedDependencies": {
      "type": "object",
      "description": "Lists dependencies that have been patched to modify their behavior.",
      "patternProperties": {
        ".*": {
          "type": "string"
        }
      }
    },
    "trustedDependencies": {
      "type": "array",
      "description": "An array of dependencies explicitly marked as trusted.",
      "items": {
        "type": "string"
      }
    },
    "packages": {
      "type": "object",
      "description": "Contains information about all the packages used in the project.",
      "patternProperties": {
        ".*": {
          "$ref": "#/$defs/BunLockFilePackageArray"
        }
      }
    }
  },
  "allowTrailingCommas": true,
  "$defs": {
    "BunLockFileBasePackageInfo": {
      "type": "object",
      "description": "Base information about a package, including dependencies and peer relationships.",
      "required": [],
      "properties": {
        "dependencies": {
          "type": "object",
          "description": "A map of dependencies required by this package.",
          "patternProperties": {
            ".*": {
              "type": "string"
            }
          }
        },
        "devDependencies": {
          "type": "object",
          "description": "A map of development-only dependencies.",
          "patternProperties": {
            ".*": {
              "type": "string"
            }
          }
        },
        "optionalDependencies": {
          "type": "object",
          "description": "A map of optional dependencies for this package.",
          "patternProperties": {
            ".*": {
              "type": "string"
            }
          }
        },
        "peerDependencies": {
          "type": "object",
          "description": "A map of peer dependencies for this package.",
          "patternProperties": {
            ".*": {
              "type": "string"
            }
          }
        },
        "optionalPeers": {
          "type": "array",
          "description": "An array of optional peer dependencies.",
          "items": {
            "type": "string"
          }
        },
        "bin": {
          "description": "Executable binaries provided by the package.",
          "oneOf": [
            {
              "type": "object",
              "patternProperties": {
                ".*": {
                  "type": "string"
                }
              }
            },
            {
              "type": "string"
            }
          ]
        },
        "binDir": {
          "type": "string",
          "description": "Directory where the package's binaries are located."
        }
      }
    },
    "BunLockFileWorkspacePackage": {
      "allOf": [
        {
          "$ref": "#/$defs/BunLockFileBasePackageInfo"
        },
        {
          "type": "object",
          "description": "Information specific to workspace packages.",
          "properties": {
            "name": {
              "type": "string",
              "description": "The name of the workspace package."
            },
            "version": {
              "type": "string",
              "description": "The version of the workspace package."
            }
          }
        }
      ]
    },
    "BunLockFilePackageInfo": {
      "allOf": [
        {
          "$ref": "#/$defs/BunLockFileBasePackageInfo"
        },
        {
          "type": "object",
          "description": "Detailed information about a specific package.",
          "properties": {
            "os": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                }
              ],
              "description": "Specifies operating systems supported by this package."
            },
            "cpu": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                }
              ],
              "description": "Specifies CPU architectures supported by this package."
            },
            "bundled": {
              "type": "boolean",
              "enum": [
                true
              ],
              "description": "Indicates if the package is bundled."
            }
          },
          "required": []
        }
      ]
    },
    "BunLockFilePackageArray": {
      "description": "An array representing a package in the lockfile.",
      "oneOf": [
        {
          "description": "Represents an npm package.",
          "type": "array",
          "maxItems": 4,
          "minItems": 4,
          "prefixItems": [
            {
              "type": "string",
              "description": "Package name and version in the format 'name@version'."
            },
            {
              "type": "string",
              "description": "Registry URL or empty string for the default registry."
            },
            {
              "$ref": "#/$defs/BunLockFilePackageInfo",
              "description": "Package metadata including dependencies and environment constraints."
            },
            {
              "type": "string",
              "description": "Integrity hash for the package."
            }
          ]
        },
        {
          "description": "Represents a symlink, folder, or tarball package.",
          "type": "array",
          "maxItems": 2,
          "minItems": 2,
          "prefixItems": [
            {
              "type": "string",
              "description": "Package name with a path."
            },
            {
              "$ref": "#/$defs/BunLockFilePackageInfo",
              "description": "Package metadata including dependencies and environment constraints."
            }
          ]
        },
        {
          "description": "Represents workspace package.",
          "type": "array",
          "maxItems": 1,
          "minItems": 1,
          "prefixItems": [
            {
              "type": "string",
              "description": "Package name with a workspace path."
            }
          ]
        },
        {
          "description": "Represents a git or GitHub package.",
          "type": "array",
          "maxItems": 3,
          "minItems": 3,
          "prefixItems": [
            {
              "type": "string",
              "description": "Package name with a git or GitHub prefix."
            },
            {
              "$ref": "#/$defs/BunLockFilePackageInfo",
              "description": "Package metadata including dependencies and environment constraints."
            },
            {
              "type": "string",
              "description": "Bun tag for the package."
            }
          ]
        },
        {
          "description": "Represents the root package.",
          "type": "array",
          "maxItems": 2,
          "minItems": 2,
          "prefixItems": [
            {
              "type": "string",
              "description": "Root package identifier in the format 'name@root:'."
            },
            {
              "type": "object",
              "properties": {
                "bin": {
                  "description": "Executable binaries provided by the root package.",
                  "oneOf": [
                    {
                      "type": "object",
                      "patternProperties": {
                        ".*": {
                          "type": "string"
                        }
                      }
                    },
                    {
                      "type": "string"
                    }
                  ]
                },
                "binDir": {
                  "type": "string",
                  "description": "Directory where the root package's binaries are located."
                }
              },
              "additionalProperties": false
            }
          ]
        }
      ]
    }
  },
  "required": [
    "lockfileVersion",
    "workspaces",
    "packages"
  ]
}
