Skip to content
PluginStats

prettier-plugin-pdx-script weekly downloads statistics

By Myriad4Link · npm · Prettier plugins

Prettier plugin for formatting PDXScript (Paradox game script) files

View on npm Fresh · Dec 6, 2026

prettier-plugin-pdx-script has 16 recorded weekly downloads on npm, an increase of 100% over the past 30 days, ranking #3034 of 3,247 tracked listings.

Weekly downloads
16
Official API · Dec 5, 2026
7-day growth
+60.0%
+6 weekly downloads
30-day growth
+100%
+8 weekly downloads
90-day growth
+33.3%
+4 weekly downloads
Rank
#3034
▼ 85 in 7 days

About prettier-plugin-pdx-script

prettier-plugin-pdx-script

License: MIT Prettier

A Prettier plugin for formatting PDXScript (Paradox game script) files. Powered by tree-sitter-pdx_script.

Overview

PDXScript is the scripting language used in Paradox Interactive games such as Victoria 3, Hearts of Iron IV, Stellaris, Europa Universalis IV, and Crusader Kings III. These scripts are distributed as .txt files with nested key-value and block structures.

This plugin provides automatic, consistent formatting for PDXScript files using Prettier. It uses a tree-sitter WASM parser to reliably parse PDXScript, then applies opinionated formatting rules. The parser is compiled from tree-sitter-pdx_script, a tree-sitter grammar for Paradox script files.

Installation

npm install --save-dev prettier-plugin-pdx-script

Prettier will automatically discover the plugin. No additional configuration is needed.

Usage

# Format a single file
npx prettier --write path/to/file.txt

# Check formatting without writing
npx prettier --check path/to/file.txt

# Format all .txt files in a directory
npx prettier --write "path/to/scripts/**/*.txt"

Formatting Rules

RuleBeforeAfter
Indentation4 spaces or mixedTabs (one per nesting level)
Empty blocksmy_decl = { }my_decl = {}
Block valueskey = { nested = val }key = {<br>    nested = val<br>}
Comments # comment# comment
OperatorsPreserved as-is=, >, < all supported
Example

Input:

my_declaration={
    key1= value1
    key2 =value2
    nested={
        inner_key = "hello world"
    }
    # a comment
}
another_decl = { }

Output:

my_declaration = {
	key1 = value1
	key2 = value2
	nested = {
		inner_key = "hello world"
	}
	# a comment
}
another_decl = {}

Architecture

The plugin follows the standard Prettier plugin architecture with three components:

Input Text
    │
    ▼
┌──────────────┐
│   Parser     │  tree-sitter WASM parser + AST conversion
│  (index.ts)  │  Converts tree-sitter SyntaxNodes → plain objects
└──────┬───────┘
       │
       ▼
┌──────────────┐
│  Printer     │  Walks the AST, produces Prettier Doc output
│(printer.ts)  │  Handles each node type with specific formatting rules
└──────┬───────┘
       │
       ▼
  Formatted Text
Key Design Decisions
  1. Tree-to-plain-object conversion: Tree-sitter nodes use JavaScript getters (e.g., node.children is computed), but Prettier's path.map/path.call traverse node properties directly. The convertTree() function in index.ts converts the tree-sitter AST to plain objects that Prettier can navigate.

  2. Tab indentation: Paradox script files conventionally use tab indentation, which is preserved in this plugin.

  3. Operator preservation: The =, >, and < operators in key-value pairs are preserved from the source. They are anonymous tokens in tree-sitter (not in namedChildren) and are found by iterating node.children.

CJS / ESM Dual Support

This package ships both ESM and CJS entry points:

{
  "main": "./dist/index.cjs",
  "module": "./dist/index.js",
  "exports": {
    ".": {
      "import": "./dist/index.js",
      "require": "./dist/index.cjs"
    },
    "./dist/tree-sitter/tree-sitter-pdx_script.wasm": "./dist/tree-sitter/tree-sitter-pdx_script.wasm",
    "./package.json": "./package.json"
  }
}

ESM consumers use import, CJS consumers use require() — no dynamic await import() needed.

The grammar WASM is also accessible via require.resolve("prettier-plugin-pdx-script/dist/tree-sitter/tree-sitter-pdx_script.wasm") for use with setGrammarBinary().

API

setGrammarBinary(loader)

Override the grammar WASM binary loader. Use this when bundling the plugin (e.g. in a VS Code extension) where the WASM file cannot be loaded from the plugin's package directory.

import { setGrammarBinary } from "prettier-plugin-pdx-script";

// Load from a bundled Uint8Array
setGrammarBinary(() => myWasmBinary);
getGrammarBinary()

Get the current grammar binary loader function. Useful for wrapping the default loader or testing.

setLocateFile(fn)

Override the locateFile callback used to locate web-tree-sitter's own runtime WASM (tree-sitter.wasm). This is passed directly to web-tree-sitter's Parser.init({ locateFile }).

Use this when bundling the plugin and the default resolution (relative to scriptDir) does not point to the correct location.

import { setLocateFile } from "prettier-plugin-pdx-script";

setLocateFile((fileName, _scriptDir) => {
  return path.join(__dirname, "wasm", fileName);
});

Important: setLocateFile() must be called before any parse() invocation (same constraint as setGrammarBinary()).

getLocateFile()

Get the current locateFile callback. Useful for wrapping the default resolver or testing.

Bundling

When bundling this plugin (e.g. in a VS Code extension or webpack/esbuild build), the default WASM loading may fail. There are two WASM files to account for:…

Description from the npm listing.

  • prettier
  • prettier-plugin
  • pdxscript
  • paradox
  • hoi4
  • tree-sitter
  • formatter

README badge

Show your rank in a README or on your website. The badge updates automatically.

Charts

Images: 30d · 1y · all time · 1600×900 dark

Adoption over time

prettier-plugin-pdx-script weekly downloads on npm, last 90 days: 16 weekly downloads as of Dec 5, 2026, +33.3% over 90 days.prettier-plugin-pdx-scriptWeekly downloads on npm · Last 90 days16downloads / week+33.3% over 90 days024681012141618Sep 6Sep 21Oct 6Oct 21Nov 5Nov 20Dec 5downloads / weekobservedarchived (Internet Archive)no observationsSep 7, 2026 – Dec 5, 2026 · 90 observations · Updated Dec …pluginstats.com
prettier-plugin-pdx-script weekly downloads on npm, last 90 days: 16 weekly downloads as of Dec 5, 2026, +33.3% over 90 days.

7/30/90-day growth

prettier-plugin-pdx-script weekly downloads growth on npm: +60.0% over 7 days, +100% over 30 days, +33.3% over 90 days.prettier-plugin-pdx-scriptWeekly downloads growth on npm16downloads / week now7-day growth+6 weekly downloads+60.0%30-day growth+8 weekly downloads+100%90-day growth+4 weekly downloads+33.3%Growth vs. nearest observation to each baseline date · Updated Dec 5, 2026pluginstats.com
prettier-plugin-pdx-script weekly downloads growth on npm: +60.0% over 7 days, +100% over 30 days, +33.3% over 90 days.

Ranking history

prettier-plugin-pdx-script npm ranking history: currently #3034 (by weekly downloads).prettier-plugin-pdx-scriptnpm ranking · by weekly downloads · Last 90 days#3034current rank#500#1000#1500#2000#2500#3000#3500Sep 7Sep 22Oct 7Oct 22Nov 6Nov 21Dec 6rankOct 17, 2026 – Dec 6, 2026 · 44 observations · Updated Dec 5, 2026pluginstats.com
prettier-plugin-pdx-script npm ranking history: currently #3034 (by weekly downloads).

Listing placement

All npm3,247 listings · 163 pages · 1,084 shown · page 152, #16 (overall #3,036)
All npm: every listing in weekly downloads order

Listing placement

Prettier plugins267 listings · 14 pages · page 10, #12 (overall #192)
Prettier plugins: every listing in weekly downloads order

Filled points are observed values; hollow points come from Internet Archive snapshots of the listing page. Dashed segments span periods with no observations — values between points are not interpolated.

Each band is one page of 20. Weekly downloads on a linear scale. Placement is projected from weekly downloads, so it can differ from the marketplace's own sort order. Hover a dot to see the listing.

Recent observations

Full history (591)
Recent weekly downloads observations for prettier-plugin-pdx-script
Date (UTC)Weekly downloadsChange vs. previous
160
16-1
17+12
50
5+2
30
3-7
100
10+1
90
9-2
110
11-6
17—

Similar npm Prettier plugins plugins

All 20 prettier-plugin-pdx-script alternatives

Data source

Weekly downloads (trailing 7 complete days) come from the official npm downloads API. Downloads include CI and mirrors and are not equivalent to installs or users. npm publishes no ratings.

Listing: https://www.npmjs.com/package/prettier-plugin-pdx-script. First seen Oct 16, 2026; last successful collection Dec 6, 2026. See the methodology.