{
  "name": "swc",
  "implementation": "/packages/js/src/executors/swc/swc.impl.ts",
  "schema": {
    "version": 2,
    "outputCapture": "direct-nodejs",
    "$schema": "http://json-schema.org/schema",
    "cli": "nx",
    "title": "Typescript Build Target",
    "description": "Builds using SWC.",
    "type": "object",
    "properties": {
      "main": {
        "type": "string",
        "description": "The name of the main entry-point file.",
        "x-completion-type": "file",
        "x-completion-glob": "main@(.js|.ts|.tsx)"
      },
      "outputPath": {
        "type": "string",
        "description": "The output path of the generated files.",
        "x-completion-type": "directory"
      },
      "tsConfig": {
        "type": "string",
        "description": "The path to the Typescript configuration file.",
        "x-completion-type": "file",
        "x-completion-glob": "tsconfig.*.json"
      },
      "swcrc": {
        "type": "string",
        "description": "The path to the SWC configuration file. Default: .swcrc",
        "x-completion-type": "file",
        "x-completion-glob": ".swcrc"
      },
      "assets": {
        "type": "array",
        "description": "List of static assets.",
        "default": [],
        "items": {
          "oneOf": [
            {
              "type": "object",
              "properties": {
                "glob": {
                  "type": "string",
                  "description": "The pattern to match."
                },
                "input": {
                  "type": "string",
                  "description": "The input directory path in which to apply 'glob'. Defaults to the project root."
                },
                "ignore": {
                  "description": "An array of globs to ignore.",
                  "type": "array",
                  "items": { "type": "string" }
                },
                "output": {
                  "type": "string",
                  "description": "Absolute path within the output."
                }
              },
              "additionalProperties": false,
              "required": ["glob", "input", "output"]
            },
            { "type": "string" }
          ]
        }
      },
      "watch": {
        "type": "boolean",
        "description": "Enable re-building when files change.",
        "default": false
      },
      "clean": {
        "type": "boolean",
        "description": "Remove previous output before build.",
        "default": true
      },
      "skipTypeCheck": {
        "type": "boolean",
        "description": "Whether to skip TypeScript type checking.",
        "default": false,
        "x-priority": "important"
      },
      "swcExclude": {
        "type": "array",
        "description": "List of SWC Glob/Regex to be excluded from compilation (https://swc.rs/docs/configuration/compilation#exclude).",
        "default": [
          "./src/**/.*.spec.ts$",
          "./**/.*.spec.ts$",
          "./src/**/jest-setup.ts$",
          "./**/jest-setup.ts$",
          "./**/.*.js$"
        ],
        "hidden": true
      },
      "updateBuildableProjectDepsInPackageJson": {
        "type": "boolean",
        "description": "Whether to update the buildable project dependencies in the build output package.json.",
        "default": true
      },
      "buildableProjectDepsInPackageJsonType": {
        "type": "string",
        "description": "When `updateBuildableProjectDepsInPackageJson` is `true`, this adds dependencies to either `peerDependencies` or `dependencies`.",
        "enum": ["dependencies", "peerDependencies"],
        "default": "peerDependencies"
      },
      "external": {
        "description": "A list projects to be treated as external. This feature is experimental",
        "oneOf": [
          { "type": "string", "enum": ["all", "none"] },
          { "type": "array", "items": { "type": "string" } }
        ]
      },
      "externalBuildTargets": {
        "type": "array",
        "items": { "type": "string" },
        "description": "List of target names that annotate a build target for a project",
        "default": ["build"]
      },
      "generateLockfile": {
        "type": "boolean",
        "description": "Generate a lockfile (e.g. package-lock.json) that matches the workspace lockfile to ensure package versions match.",
        "default": false,
        "x-priority": "internal"
      }
    },
    "required": ["main", "outputPath", "tsConfig"],
    "definitions": {
      "assetPattern": {
        "oneOf": [
          {
            "type": "object",
            "properties": {
              "glob": {
                "type": "string",
                "description": "The pattern to match."
              },
              "input": {
                "type": "string",
                "description": "The input directory path in which to apply 'glob'. Defaults to the project root."
              },
              "ignore": {
                "description": "An array of globs to ignore.",
                "type": "array",
                "items": { "type": "string" }
              },
              "output": {
                "type": "string",
                "description": "Absolute path within the output."
              }
            },
            "additionalProperties": false,
            "required": ["glob", "input", "output"]
          },
          { "type": "string" }
        ]
      }
    },
    "examplesFile": "## Examples\n\n{% tabs %}\n{% tab label=\"Inline libraries\" %}\n\n`@nx/js:swc` can inline non-buildable libraries by opt-in to **Inlining** mode with `external` option.\n\n```json {% fileName=\"libs/ts-lib/project.json\" %}\n{\n  \"build\": {\n    \"executor\": \"@nx/js:swc\",\n    \"options\": {\n      \"outputPath\": \"dist/libs/ts-lib\",\n      \"main\": \"libs/ts-lib/src/index.ts\",\n      \"tsConfig\": \"libs/ts-lib/tsconfig.lib.json\",\n      \"assets\": [\"libs/ts-lib/*.md\"],\n      \"external\": \"all\"\n    }\n  }\n}\n```\n\n```shell\nnpx nx build ts-lib --external=all\n```\n\n`@nx/js:swc` can also inline buildable libraries by setting `external: 'none'`\n\n```json {% fileName=\"libs/ts-lib/project.json\" %}\n{\n  \"build\": {\n    \"executor\": \"@nx/js:swc\",\n    \"options\": {\n      \"outputPath\": \"dist/libs/ts-lib\",\n      \"main\": \"libs/ts-lib/src/index.ts\",\n      \"tsConfig\": \"libs/ts-lib/tsconfig.lib.json\",\n      \"assets\": [\"libs/ts-lib/*.md\"],\n      \"external\": \"none\"\n    }\n  }\n}\n```\n\n```shell\nnpx nx build ts-lib --external=none\n```\n\n{% /tab %}\n{% tab label=\"Custom swcrc\" %}\n\n`@nx/js:swc` can compile your code with a custom `.swcrc`\n\n```json {% fileName=\"libs/ts-lib/project.json\" %}\n{\n  \"build\": {\n    \"executor\": \"@nx/js:swc\",\n    \"options\": {\n      \"outputPath\": \"dist/libs/ts-lib\",\n      \"main\": \"libs/ts-lib/src/index.ts\",\n      \"tsConfig\": \"libs/ts-lib/tsconfig.lib.json\",\n      \"assets\": [\"libs/ts-lib/*.md\"],\n      \"swcrc\": \"libs/ts-lib/.dev.swcrc\"\n    },\n    \"configurations\": {\n      \"production\": {\n        \"swcrc\": \"libs/ts-lib/.prod.swcrc\"\n      }\n    }\n  }\n}\n```\n\n{% /tab %}\n{% /tabs %}\n",
    "presets": []
  },
  "description": "Build a project using SWC.",
  "aliases": [],
  "hidden": false,
  "path": "/packages/js/src/executors/swc/schema.json",
  "type": "executor"
}
