{
  "$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": {
      "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": {
          "$ref": "#/definitions/nonEmptyString",
          "description": "Specifies the base directory of input and output files"
        },
        "outFile": {
          "$ref": "#/definitions/nonEmptyString",
          "description": "Specifies the WebAssembly output file (.wasm)"
        },
        "textFile": {
          "$ref": "#/definitions/nonEmptyString",
          "description": "Specifies the WebAssembly text output file (.wat)"
        },
        "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": [
            {
              "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": {
          "$ref": "#/definitions/nonEmptyString",
          "description": "Exports the start function instead of calling it implicitly"
        },
        "lib": {
          "$ref": "#/definitions/nonEmptyStringOrArrayOfNonEmptyStrings",
          "description": "Adds one or multiple paths to custom library components"
        },
        "path": {
          "$ref": "#/definitions/nonEmptyStringOrArrayOfNonEmptyStrings",
          "description": "Adds one or multiple paths to package resolution"
        },
        "use": {
          "$ref": "#/definitions/nonEmptyStringOrArrayOfNonEmptyStrings",
          "description": "Aliases a global object under another name"
        },
        "trapMode": {
          "description": "Sets the trap mode to use",
          "enum": ["allow", "clamp", "js"]
        },
        "runPasses": {
          "$ref": "#/definitions/nonEmptyStringOrArrayOfNonEmptyStrings",
          "description": "Specifies additional Binaryen passes to run"
        },
        "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": {
          "$ref": "#/definitions/nonEmptyString",
          "description": "Uses the specified Wasm binary of the compiler"
        }
      }
    }
  },
  "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"
}
