{"_id":"@deleeuwsoftware/prettier-plugin-apex","_rev":"2-bed424440d911125ee40dbeaaed4e622","name":"@deleeuwsoftware/prettier-plugin-apex","dist-tags":{"latest":"0.1.1"},"versions":{"0.1.0":{"name":"@deleeuwsoftware/prettier-plugin-apex","version":"0.1.0","keywords":["apex","prettier"],"author":{"name":"Dang Mai","email":"contact@dangmai.net"},"license":"MIT","_id":"@deleeuwsoftware/prettier-plugin-apex@0.1.0","maintainers":[{"name":"deleeuwsoftware","email":"matthew.de-leeuw@deleeuwsoftware.com"}],"homepage":"https://github.com/dangmai/prettier-plugin-apex#readme","bugs":{"url":"https://github.com/DeLeeuwSoftware/deleeuwsoftwarePrettier/issues"},"nx":{"targets":{"test":{"cache":false,"outputs":["{projectRoot}/coverage"],"dependsOn":["build:dev"]},"build:dev":{"dependsOn":["^build"]},"test:parser":{"cache":false,"options":{"cwd":"{projectRoot}","env":{"APEX_PARSER":"built-in"},"command":"pnpm test"},"outputs":["{projectRoot}/coverage"],"executor":"nx:run-commands","dependsOn":["build:dev"],"configurations":{"native":{"env":{"APEX_PARSER":"native"}},"built-in":{"env":{"APEX_PARSER":"built-in"}}}},"start-server":{"dependsOn":["^build"]}},"implicitDependencies":["apex-ast-serializer"]},"bin":{"stop-apex-server":"dist/bin/stop-apex-server.js","start-apex-server":"dist/bin/start-apex-server.js","apex-ast-serializer":"vendor/apex-ast-serializer/bin/apex-ast-serializer","apex-ast-serializer-http":"vendor/apex-ast-serializer/bin/apex-ast-serializer-http"},"dist":{"shasum":"9ba49370655603c2a3a4516ee1c3b591c6e6d6cb","tarball":"https://registry.npmjs.org/@deleeuwsoftware/prettier-plugin-apex/-/prettier-plugin-apex-0.1.0.tgz","fileCount":82,"integrity":"sha512-Uf5xQJnApvvuMbrvI21B9jjzShsyIchdHJ5pNNVUVyntc6wOBwjxw2CQXKds3DBm0WhthgkXtRO1HrkzJlX7WQ==","signatures":[{"sig":"MEUCIHuj1Q6Ypwx75EWSlnRfWTyeSdFbkMpfZogkOOw3j++wAiEAwaTLPSUy0JmKMcSr60NZB7CoOR6samf4gv9c4Gw+6Zc=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":23645668},"type":"module","types":"./dist/src/index.d.ts","unpkg":"dist/src/standalone.umd.cjs","browser":"dist/src/standalone.umd.cjs","exports":"./dist/src/index.js","gitHead":"dbd57e232fb8068bc2aa5a75e1b77d0617c506fc","scripts":{"lint":"biome lint ./src ./bin ./tests_config ./tests_perf","test":"vitest run","build":"del-cli dist && tsc --project tsconfig.prod.json && pnpm run build:standalone","clean":"del-cli node_modules dist","prepack":"pnpm run build","pretest":"pnpm run lint","prettier":"prettier --write \"{bin,src,playground,tests_config}/**/*.{js,mjs,ts,tsx,css,html}\" \"./*.{md,mjs,ts}\"","benchmark":"tsx tests_perf/setup.ts","build:dev":"tsc","stop-server":"tsx bin/stop-apex-server.ts","wait-server":"wait-on --timeout 300000 http://localhost:2117/api/ast/","start-server":"tsx bin/start-apex-server.ts -h 0.0.0.0 -c http://localhost:5173","test:package":"tsx tests_integration/package/run-package-tests.zx.mts","benchmark:core":"tsx tests_perf/run.ts","build:standalone":"vite build","debug-check:native":"prettier --no-config --apex-standalone-parser native --debug-check --plugin=./dist/src/index.js","debug-check:built-in":"prettier --apex-standalone-parser built-in --apex-standalone-port 2117 --debug-check --plugin=./dist/src/index.js"},"_npmUser":{"name":"deleeuwsoftware","email":"matthew.de-leeuw@deleeuwsoftware.com"},"repository":{"url":"git+https://github.com/DeLeeuwSoftware/deleeuwsoftwarePrettier.git","type":"git","directory":"packages/prettier-plugin-apex"},"_npmVersion":"11.19.0","description":"A fork of the Salesforce Apex plugin for Prettier, adding booleanChainBreaking and apexSoqlFieldBreaking","directories":{},"_nodeVersion":"25.2.1","dependencies":{"wait-on":"^9.0.0","jest-docblock":"^30.0.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"vite":"8.2.0","vitest":"4.1.10","@types/wait-on":"5.3.4","@inquirer/prompts":"^8.5.2","@vitest/coverage-v8":"4.1.10"},"peerDependencies":{"prettier":"^3.0.0"},"optionalDependencies":{"@prettier-apex/apex-ast-serializer-linux-x64":"^2.3.0","@prettier-apex/apex-ast-serializer-win32-x64":"^2.3.0","@prettier-apex/apex-ast-serializer-darwin-x64":"^2.3.0","@prettier-apex/apex-ast-serializer-darwin-arm64":"^2.3.0"},"_npmOperationalInternal":{"tmp":"tmp/prettier-plugin-apex_0.1.0_1786058959384_0.03319346607009188","host":"s3://npm-registry-packages-npm-production"}},"0.1.1":{"name":"@deleeuwsoftware/prettier-plugin-apex","version":"0.1.1","description":"A fork of the Salesforce Apex plugin for Prettier, adding booleanChainBreaking and apexSoqlFieldBreaking","repository":{"type":"git","url":"git+https://github.com/DeLeeuwSoftware/deleeuwsoftwarePrettier.git","directory":"packages/prettier-plugin-apex"},"homepage":"https://github.com/dangmai/prettier-plugin-apex#readme","bugs":{"url":"https://github.com/DeLeeuwSoftware/deleeuwsoftwarePrettier/issues"},"publishConfig":{"access":"public"},"type":"module","exports":"./dist/src/index.js","browser":"dist/src/standalone.umd.cjs","unpkg":"dist/src/standalone.umd.cjs","types":"./dist/src/index.d.ts","bin":{"start-apex-server":"dist/bin/start-apex-server.js","stop-apex-server":"dist/bin/stop-apex-server.js","apex-ast-serializer":"vendor/apex-ast-serializer/bin/apex-ast-serializer","apex-ast-serializer-http":"vendor/apex-ast-serializer/bin/apex-ast-serializer-http"},"scripts":{"build":"del-cli dist && tsc --project tsconfig.prod.json && pnpm run build:standalone","build:dev":"tsc","build:standalone":"vite build","clean":"del-cli node_modules dist","pretest":"pnpm run lint","test":"vitest run","test:package":"tsx tests_integration/package/run-package-tests.zx.mts","benchmark":"tsx tests_perf/setup.ts","benchmark:core":"tsx tests_perf/run.ts","start-server":"tsx bin/start-apex-server.ts -h 0.0.0.0 -c http://localhost:5173","wait-server":"wait-on --timeout 300000 http://localhost:2117/api/ast/","stop-server":"tsx bin/stop-apex-server.ts","lint":"biome lint ./src ./bin ./tests_config ./tests_perf","prettier":"prettier --write \"{bin,src,playground,tests_config}/**/*.{js,mjs,ts,tsx,css,html}\" \"./*.{md,mjs,ts}\"","prepack":"pnpm run build","debug-check:native":"prettier --no-config --apex-standalone-parser native --debug-check --plugin=./dist/src/index.js","debug-check:built-in":"prettier --apex-standalone-parser built-in --apex-standalone-port 2117 --debug-check --plugin=./dist/src/index.js"},"keywords":["apex","prettier"],"author":{"name":"Dang Mai","email":"contact@dangmai.net"},"license":"MIT","devDependencies":{"@inquirer/prompts":"^8.5.2","@types/wait-on":"5.3.4","@vitest/coverage-v8":"4.1.10","vite":"8.2.0","vitest":"4.1.10"},"peerDependencies":{"prettier":"^3.0.0 || ^0.1.0"},"dependencies":{"jest-docblock":"^30.0.0","wait-on":"^9.0.0"},"optionalDependencies":{"@prettier-apex/apex-ast-serializer-darwin-arm64":"^2.3.0","@prettier-apex/apex-ast-serializer-darwin-x64":"^2.3.0","@prettier-apex/apex-ast-serializer-linux-x64":"^2.3.0","@prettier-apex/apex-ast-serializer-win32-x64":"^2.3.0"},"nx":{"implicitDependencies":["apex-ast-serializer"],"targets":{"test":{"dependsOn":["build:dev"],"outputs":["{projectRoot}/coverage"],"cache":false},"test:parser":{"dependsOn":["build:dev"],"outputs":["{projectRoot}/coverage"],"cache":false,"executor":"nx:run-commands","options":{"cwd":"{projectRoot}","command":"pnpm test","env":{"APEX_PARSER":"built-in"}},"configurations":{"built-in":{"env":{"APEX_PARSER":"built-in"}},"native":{"env":{"APEX_PARSER":"native"}}}},"build:dev":{"dependsOn":["^build"]},"start-server":{"dependsOn":["^build"]}}},"gitHead":"ffa0e421f0c5ea8d02db0127e4a680dcb4a01252","_id":"@deleeuwsoftware/prettier-plugin-apex@0.1.1","_nodeVersion":"25.2.1","_npmVersion":"11.19.0","dist":{"integrity":"sha512-3q7djEDrRu6NQcKo04Kkm3a3WCWixquSPHyVwoJhRe8yqoXqYLV47G2Iu2KpCGdr8WNTX9W/AnnVrmRuRl3RFQ==","shasum":"dc1bb88b271432444c8e41571f84742cb8274077","tarball":"https://registry.npmjs.org/@deleeuwsoftware/prettier-plugin-apex/-/prettier-plugin-apex-0.1.1.tgz","fileCount":82,"unpackedSize":23645678,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIFJwq2LhUzOoJVm7iZE975/4z2qP9fPz+Pz6/q+aKwAKAiEAiTCIzZS1cpdrvtwzdH5A2TrdaeZ/VOwKvhzNOvk1nA0="}]},"_npmUser":{"name":"deleeuwsoftware","email":"matthew.de-leeuw@deleeuwsoftware.com"},"directories":{},"maintainers":[{"name":"deleeuwsoftware","email":"matthew.de-leeuw@deleeuwsoftware.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/prettier-plugin-apex_0.1.1_1786060089215_0.1402591147549701"},"_hasShrinkwrap":false}},"time":{"created":"2026-08-06T23:29:19.198Z","modified":"2026-08-06T23:48:09.849Z","0.1.0":"2026-08-06T23:29:19.810Z","0.1.1":"2026-08-06T23:48:09.668Z"},"bugs":{"url":"https://github.com/DeLeeuwSoftware/deleeuwsoftwarePrettier/issues"},"author":{"name":"Dang Mai","email":"contact@dangmai.net"},"license":"MIT","homepage":"https://github.com/dangmai/prettier-plugin-apex#readme","keywords":["apex","prettier"],"repository":{"type":"git","url":"git+https://github.com/DeLeeuwSoftware/deleeuwsoftwarePrettier.git","directory":"packages/prettier-plugin-apex"},"description":"A fork of the Salesforce Apex plugin for Prettier, adding booleanChainBreaking and apexSoqlFieldBreaking","maintainers":[{"name":"deleeuwsoftware","email":"matthew.de-leeuw@deleeuwsoftware.com"}],"readme":"# Prettier Apex\n\n[![Build Status](https://github.com/dangmai/prettier-plugin-apex/workflows/Tests%20and%20Deployments/badge.svg)](https://github.com/dangmai/prettier-plugin-apex/actions?query=workflow%3A%22Tests+and+Deployments%22) [![npm](https://img.shields.io/npm/v/prettier-plugin-apex.svg)](https://www.npmjs.com/package/prettier-plugin-apex) ![NPM](https://img.shields.io/npm/l/prettier-plugin-apex.svg) [![codecov](https://codecov.io/gh/dangmai/prettier-plugin-apex/branch/main/graph/badge.svg?flag=prettier-plugin-apex)](https://codecov.io/gh/dangmai/prettier-plugin-apex) [![Known Vulnerabilities](https://snyk.io/test/github/dangmai/prettier-plugin-apex/badge.svg)](https://snyk.io/test/github/dangmai/prettier-plugin-apex) [![Join the chat at https://gitter.im/prettier-plugin-apex/community](https://badges.gitter.im/prettier-plugin-apex/community.svg)](https://gitter.im/prettier-plugin-apex/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)\n\n![Prettier Banner](https://unpkg.com/prettier-logo@1.0.3/images/prettier-banner-light.svg)\n\n## 🥇 Intro\n\nPrettier Apex is an opinionated code formatter for the Apex programming language that focuses on correctness and consistency of the formatted code.\nIt uses the excellent [Prettier](https://prettier.io/) engine for formatting,\nas well as following Prettier's [philosophy](https://prettier.io/docs/en/why-prettier.html).\n\nPrettier Apex allows Salesforce development teams to enforce a consistent code style,\nwhile being able to focus on writing code instead of debating how their code should be formatted.\n\nSince it is built on top of `jorje`, Salesforce's own internal parser,\nit is able to format Apex code with a very high degree of accuracy.\nIn short, Prettier Apex parses your code the same way that the Salesforce platform does,\nand it has been tested extensively to make sure your code does not change behavior after formatting.\n\n## ⚡️ Quick start\n\nYou can automatically format Apex code in our [playground](https://apex.dangmai.net) without having to install anything.\n\nTo integrate Prettier Apex in your workflow, please follow the [Usage](#-usage) section.\n\n## ✨ Status\n\nThis project is production ready, and has been tested on multiple projects,\nincluding a mix of open source/proprietary/Salesforce internal code bases.\n\n## 📖 Usage\n\n### Requirements\n\n- Node >= 22 (that have not been End-of-Life'd)\n- Java Runtime Engine >= 17 _only_ for platforms without prebuilt native executables\n- The following platforms are provided with prebuilt native executables for improved parsing performance:\n  - Windows x64\n  - Linux x64\n  - macOS M-based (ARM64)\n  - macOS Intel-based (x64)\n\n### How to use\n\nFirst, install the library:\n\n```bash\n# Install locally\nnpm install --save-dev prettier prettier-plugin-apex\n\n# Or install globally\nnpm install --global prettier prettier-plugin-apex\n```\n\nIf you install globally, run:\n\n```bash\nprettier --plugin=prettier-plugin-apex --write \"/path/to/project/**/*.{trigger,cls}\"\n```\n\nIf you install locally, you can add prettier as a script in `package.json`:\n\n```json\n{\n  \"scripts\": {\n    \"prettier\": \"prettier\"\n  }\n}\n```\n\nThen in order to run it:\n\n```bash\nnpm run prettier -- --plugin=prettier-plugin-apex --write \"/path/to/project/**/*.{trigger,cls}\"\n```\n\n### Tips\n\n#### Initial run\n\nIf you are formatting a big code base for the first time,\nplease make sure that you have some form of version control in place,\nso that you can revert any change if necessary.\nYou should also run Prettier with the `--debug-check` [argument](https://prettier.io/docs/en/cli.html#debug-check).\nFor example:\n\n```bash\nprettier --plugin=prettier-plugin-apex --debug-check \"/path/to/project/**/*.{trigger,cls}\"\n```\n\nThis will guarantee that the behavior of your code will not change because of\nthe format.\n\nIf there are no errors, you can run `prettier` with `--write` next.\nIf there are errors, please file a bug report so that they can be fixed.\n\n#### Anonymous Apex\n\nYou can also format anonymous Apex with this program by using the\n`apex-anonymous` parser.\n\nFor example:\n\n```bash\nprettier --write \"/path/to/project/anonymous/**/*.cls\" --plugin=prettier-plugin-apex --parser apex-anonymous\n```\n\nNote that Prettier will treat any Apex file that it finds using the glob above\nas anonymous code blocks,\nso it is recommended that you collect all of your anonymous Apex files into\none directory and limit the use of `--apex-anonymous` only in that directory.\n\n#### Ignoring lines\n\nIf there are lines in your Apex code that you do not want formatted by Prettier\n(either because you don't agree with the formatting choice,\nor there is a bug), you can instruct Prettier to ignore it by including the comment\n`// prettier-ignore` or `/* prettier-ignore */` on the line before. For example:\n\n```\n// prettier-ignore\nmatrix(\n  1, 0, 0,\n  0, 1, 0,\n  0, 0, 1\n)\n```\n\n#### Checking your plugin version\n\nFor debugging purposes, you might want to check which version of the plugin you are using.\n\nUse NPM's `list` command, like this:\n\n```bash\nnpm list prettier-plugin-apex\n```\n\n### Configuration\n\nThis library follows the same configuration format as Prettier,\nwhich is documented [here](https://prettier.io/docs/en/configuration.html).\n\nThe amount of configuration is very limited,\nbecause this is intended to be a very opinionated formatter.\nHere is the default configuration that can be overriden:\n\n| Name                     | Default     | Description                                                                                                                                                                                                                                                                                                                                                             |\n| ------------------------ | ----------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `printWidth`             | `80`        | Same as in Prettier ([see prettier docs](https://prettier.io/docs/en/options.html#print-width))                                                                                                                                                                                                                                                                         |\n| `tabWidth`               | `2`         | Same as in Prettier ([see prettier docs](https://prettier.io/docs/en/options.html#tab-width))                                                                                                                                                                                                                                                                           |\n| `useTabs`                | `false`     | Same as in Prettier ([see prettier docs](https://prettier.io/docs/en/options.html#tabs))                                                                                                                                                                                                                                                                                |\n| `requirePragma`          | `false`     | Same as in Prettier ([see prettier docs](https://prettier.io/docs/en/options.html#require-pragma))                                                                                                                                                                                                                                                                      |\n| `insertPragma`           | `false`     | Same as in Prettier ([see prettier docs](https://prettier.io/docs/en/options.html#insert-pragma))                                                                                                                                                                                                                                                                       |\n| `apexInsertFinalNewline` | `true`      | Whether a newline is added as the last thing in the output                                                                                                                                                                                                                                                                                                              |\n| `apexStandaloneParser`   | `native`    | If set to `built-in`, Prettier uses the built in standalone parser for better performance. See [Using built-in HTTP Server](#-using-built-in-http-server).<br>If set to `none`, Prettier invokes the Java CLI parser for every file.<br>If set to `native`, Prettier uses the native executables to speed up the parsing process, with fallback to the Java CLI parser. |\n| `apexStandalonePort`     | `2117`      | The port that the standalone Apex parser listens on.<br>Only applicable if `apexStandaloneParser` is `built-in`.                                                                                                                                                                                                                                                        |\n| `apexStandaloneHost`     | `localhost` | The host that the standalone Apex parser listens on.<br>Only applicable if `apexStandaloneParser` is `built-in`.                                                                                                                                                                                                                                                        |\n| `apexStandaloneProtocol` | `http`      | The protocol that the standalone Apex parser uses.<br>Only applicable if `apexStandaloneParser` is `built-in`.                                                                                                                                                                                                                                                          |\n\n#### Boolean chains and query field lists\n\nThis fork formats boolean logic and queries more aggressively than upstream, and\ndoes so without options — in Prettier's spirit, these are decisions rather than\nsettings.\n\nA boolean expression holding two or more `&&`/`||` operators is always broken at\nevery one of them, whatever its length, and the parentheses nested inside it\nexpand with it. Operators lead the wrapped line:\n\n```\nBoolean b = (\n    abc.def()\n    && (\n        acd\n        || fhi.npm\n    )\n);\n```\n\nA single operator is not a chain, so `acd || fhi.npm` is left alone. Comparisons\n(`==`, `<`, ...) are not logical operators, so `a > 1 && b < 2` holds one\noperator and stays on one line. Where `&&` and `||` are mixed, the\ntighter-binding `&&` is parenthesized so the grouping cannot be misread — this is\nthe only case where the formatter adds something you did not write.\n\nSOQL and SOSL `WHERE` clauses follow the same rule on their `AND`/`OR` keywords,\nand a query selecting two or more fields puts each field on its own line:\n\n```\nList<Account> accounts = [\n    SELECT\n        Id,\n        Name,\n        (\n            SELECT\n                Id,\n                LastName\n            FROM Contacts\n        )\n    FROM Account\n    WHERE\n        Rating = 'Hot'\n        AND (\n            Industry = 'Tech'\n            OR Industry = 'Bio'\n        )\n];\n```\n\nA query selecting a single field is not a list, so `[SELECT Id FROM Account]`\nand `[SELECT COUNT() FROM Account]` are left alone.\n\n## 📝 Editor integration\n\n### VScode\n\nFollow [this tutorial](https://developer.salesforce.com/tools/vscode/en/user-guide/prettier) from Salesforce in order to use this plugin in VSCode.\n\n## 🚀 Performance Tips/3rd party integration\n\n### 💻 Using built-in HTTP Server\n\n> ‼️ Prettier Apex is now shipped with native executables for most popular platforms that significantly enhance the parsing performance. You should try this default configuration first before considering the built-in HTTP server.\n\nBy default,\nthis library invokes a CLI application to get the AST of the Apex code.\nHowever, since this CLI application is written in Java,\nthere is a heavy start up cost associated with it.\nIn order to alleviate this issue,\nwe also have an optional HTTP server\nthat makes sure the start up is invoked exactly once.\nThis is especially useful if this library is integrated in a 3rd party application.\n\nIn order to use this server,\nyou have to evoke it out of band before running Prettier,\nas well as specifying a special flag when running Prettier:\n\n```bash\n# Start the server (if installed globally)\nstart-apex-server\n# Or if installed locally\nnpx start-apex-server\n\n# In a separate console\nprettier --apex-standalone-parser built-in --write \"/path/to/project/**/*.{trigger,cls}\"\n\n# After you are done, stop the server (if installed globally)\nstop-apex-server\n# Or if installed locally\nnpx stop-apex-server\n```\n\nBy default, the server listens on `http://localhost:2117`.\nThis can be customized by specifying the `--host` and `--port` arguments:\n\n```bash\nstart-apex-server --host 127.0.0.1 --port 2118\n```\n\n## 🚢 Continuous Integration\n\nPrettier Apex can be used to automatically check correct formatting for Apex code\nin the context of CI/CD, for example:\n\n### Using default configuration\n\n```bash\nprettier --plugin=prettier-plugin-apex --check 'project/**/*.{trigger,cls}'\n```\n\n### Using built-in HTTP Server\n\n```bash\n# Start the language server for improved parsing performance,\n# and put it in the background (*nix only) so that next commands can be run.\nnohup start-apex-server >/dev/null 2>&1 &\n# Wait until the server is up before sending requests\nnpx wait-on http://localhost:2117/api/ast/\n# Check that Apex files are formatted according to Prettier Apex style\nprettier --plugin=prettier-plugin-apex --check 'project/**/*.{trigger,cls}' --apex-standalone-parser built-in\n# Clean up the language server\nstop-apex-server\n```\n","readmeFilename":"README.md"}