{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "additionalProperties": false,
  "definitions": {
    "nonEmptyString": {
      "type": "string",
      "minLength": 1
    },
    "arrayOfNonEmptyStrings": {
      "type": "array",
      "uniqueItems": true,
      "items": {
        "$ref": "#/definitions/nonEmptyString"
      }
    },
    "nonEmptyStringOrArrayOfNonEmptyStrings": {
      "anyOf": [
        {
          "$ref": "#/definitions/nonEmptyString"
        },
        {
          "$ref": "#/definitions/arrayOfNonEmptyStrings"
        }
      ]
    },
    "webAssemblyFeatures": {
      "type": "string",
      "enum": [
        "sign-extension",
        "mutable-globals",
        "nontrapping-f2i",
        "bulk-memory",
        "simd",
        "threads",
        "exception-handling",
        "tail-calls",
        "reference-types",
        "multi-value",
        "gc",
        "memory64"
      ]
    },
    "compilerOptions": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "optimize": {
          "description": "Optimizes the module.",
          "type": "boolean"
        },
        "optimizeLevel": {
          "description": "How much to focus on optimizing code.",
          "type": "number",
          "minimum": 0,
          "maximum": 3
        },
        "shrinkLevel": {
          "description": "How much to focus on shrinking code size.",
          "type": "number",
          "minimum": 0,
          "maximum": 2
        },
        "converge": {
          "description": "Re-optimizes until no further improvements can be made.",
          "type": "boolean"
        },
        "baseDir": {
          "description": "Specifies the base directory of input and output files.",
          "$ref": "#/definitions/nonEmptyString"
        },
        "outFile": {
          "description": "Specifies the WebAssembly output file (.wasm).",
          "$ref": "#/definitions/nonEmptyString"
        },
        "textFile": {
          "description": "Specifies the WebAssembly text output file (.wat).",
          "$ref": "#/definitions/nonEmptyString"
        },
        "bindings": {
          "description": "Specified the bindings to generate.",
          "definitions": {
            "bindings": {
              "enum": ["esm", "raw"]
            }
          },
          "anyOf": [
            {
              "$ref": "#/definitions/compilerOptions/properties/bindings/definitions/bindings"
            },
            {
              "type": "array",
              "uniqueItems": true,
              "items": {
                "$ref": "#/definitions/compilerOptions/properties/bindings/definitions/bindings"
              }
            }
          ]
        },
        "sourceMap": {
          "description": "Enables source map generation. Optionally takes the URL.",
          "anyOf": [
            {
              "type": "boolean"
            },
            {
              "$ref": "#/definitions/nonEmptyString"
            }
          ]
        },
        "runtime": {
          "description": "Specifies the runtime variant to include in the program.",
          "anyOf": [
            {
              "type": "string",
              "enum": ["incremental", "minimal", "stub"]
            },
            {
              "$ref": "#/definitions/nonEmptyString"
            }
          ]
        },
        "noUnsafe": {
          "description": "Disallows the use of unsafe features in user code.",
          "type": "boolean"
        },
        "debug": {
          "description": "Enables debug information in emitted binaries.",
          "type": "boolean"
        },
        "noAssert": {
          "description": "Replaces assertions with just their value without trapping.",
          "type": "boolean"
        },
        "noEmit": {
          "description": "Performs compilation as usual but does not emit code.",
          "type": "boolean"
        },
        "importMemory": {
          "description": "Imports the memory provided as 'env.memory'.",
          "type": "boolean"
        },
        "noExportMemory": {
          "description": "Does not export the memory as 'memory'.",
          "type": "boolean"
        },
        "initialMemory": {
          "description": "Sets the initial memory size in pages.",
          "type": "number"
        },
        "maximumMemory": {
          "description": "Sets the maximum memory size in pages.",
          "type": "number"
        },
        "sharedMemory": {
          "description": "Declare memory as shared. Requires maximumMemory.",
          "type": "number"
        },
        "zeroFilledMemory": {
          "description": "Assume that imported memory is zero filled. Requires importMemory.",
          "type": "boolean"
        },
        "memoryBase": {
          "description": "Sets the start offset of compiler-generated static memory.",
          "type": "number"
        },
        "importTable": {
          "description": "Imports the function table provided as 'env.table'.",
          "type": "boolean"
        },
        "exportTable": {
          "description": "Exports the function table as 'table'.",
          "type": "boolean"
        },
        "exportStart": {
          "description": "Exports the start function instead of calling it implicitly.",
          "$ref": "#/definitions/nonEmptyString"
        },
        "lib": {
          "description": "Adds one or multiple paths to custom library components.",
          "$ref": "#/definitions/nonEmptyStringOrArrayOfNonEmptyStrings"
        },
        "path": {
          "description": "Adds one or multiple paths to package resolution.",
          "$ref": "#/definitions/nonEmptyStringOrArrayOfNonEmptyStrings"
        },
        "use": {
          "description": "Aliases a global object under another name.",
          "$ref": "#/definitions/nonEmptyStringOrArrayOfNonEmptyStrings"
        },
        "trapMode": {
          "description": "Sets the trap mode to use.",
          "type": "string",
          "enum": ["allow", "clamp", "js"]
        },
        "runPasses": {
          "description": "Specifies additional Binaryen passes to run.",
          "$ref": "#/definitions/nonEmptyStringOrArrayOfNonEmptyStrings"
        },
        "noValidate": {
          "description": "Skips validating the module using Binaryen.",
          "type": "boolean"
        },
        "enable": {
          "description": "Enables WebAssembly features that are disabled by default.",
          "anyOf": [
            {
              "$ref": "#/definitions/webAssemblyFeatures"
            },
            {
              "type": "array",
              "uniqueItems": true,
              "items": {
                "$ref": "#/definitions/webAssemblyFeatures"
              }
            }
          ]
        },
        "disable": {
          "description": "Disables WebAssembly features that are enabled by default.",
          "anyOf": [
            {
              "$ref": "#/definitions/webAssemblyFeatures"
            },
            {
              "type": "array",
              "uniqueItems": true,
              "items": {
                "$ref": "#/definitions/webAssemblyFeatures"
              }
            }
          ]
        },
        "transform": {
          "$ref": "#/definitions/nonEmptyStringOrArrayOfNonEmptyStrings",
          "description": "Specifies the path to a custom transform to 'require'."
        },
        "pedantic": {
          "description": "Make yourself sad for no good reason.",
          "type": "boolean"
        },
        "stats": {
          "description": "Prints measuring information on I/O and compile times.",
          "type": "boolean"
        },
        "noColors": {
          "description": "Disables terminal colors.",
          "type": "boolean"
        },
        "exportRuntime": {
          "description": "Exports the runtime helpers (__new, __collect etc.).",
          "type": "boolean"
        },
        "stackSize": {
          "description": "Exports the runtime helpers (__new, __collect etc.).",
          "type": "number",
          "minimum": 0
        },
        "lowMemoryLimit": {
          "description": "Enforces very low (<64k) memory constraints.",
          "type": "number",
          "minimum": 0
        },
        "tableBase": {
          "description": "Sets the start offset of emitted table elements.",
          "type": "number",
          "minimum": 0
        },
        "wasm": {
          "description": "Uses the specified Wasm binary of the compiler.",
          "$ref": "#/definitions/nonEmptyString"
        }
      }
    }
  },
  "id": "https://json.schemastore.org/asconfig-schema.json",
  "properties": {
    "extends": {
      "$ref": "#/definitions/nonEmptyString"
    },
    "entries": {
      "$ref": "#/definitions/arrayOfNonEmptyStrings"
    },
    "options": {
      "$ref": "#/definitions/compilerOptions"
    },
    "targets": {
      "type": "object",
      "additionalProperties": {
        "$ref": "#/definitions/compilerOptions"
      }
    }
  },
  "title": "JSON schema for asconfig.json",
  "type": "object"
}