prettier-plugin-sfmc 0.4.4 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +3 -3
  2. package/src/printer.js +4 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "prettier-plugin-sfmc",
3
- "version": "0.4.4",
3
+ "version": "0.6.0",
4
4
  "description": "Prettier plugin for Salesforce Marketing Cloud — AMPscript, SSJS, and SQL formatting",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
@@ -46,10 +46,10 @@
46
46
  ],
47
47
  "license": "MIT",
48
48
  "dependencies": {
49
- "ampscript-data": "^0.2.0",
49
+ "ampscript-data": "^2.0.3",
50
50
  "ampscript-parser": "^0.1.3",
51
51
  "prettier-plugin-sql": "^0.20.0",
52
- "ssjs-data": "^0.4.0"
52
+ "ssjs-data": "^0.5.0"
53
53
  },
54
54
  "devDependencies": {
55
55
  "@eslint/js": "^10.0.1",
package/src/printer.js CHANGED
@@ -12,6 +12,9 @@ import { needsLeadingBlockBreak, needsTrailingBlockBreak } from './ampscript-blo
12
12
 
13
13
  const { group, indent, join, line, softline, hardline } = prettier.doc.builders;
14
14
 
15
+ /** Lowercase keyword names for casing normalization (AMPSCRIPT_KEYWORDS is an object array). */
16
+ const AMPSCRIPT_KEYWORD_NAMES = new Set(AMPSCRIPT_KEYWORDS.map((k) => k.name.toLowerCase()));
17
+
15
18
  /**
16
19
  * Collect all variable names in first-occurrence order for consistent casing.
17
20
  *
@@ -478,7 +481,7 @@ function printAmpscriptNode(path, options, print) {
478
481
  const left = print('left');
479
482
  const right = print('right');
480
483
  const opLower = node.operator.toLowerCase();
481
- const op = AMPSCRIPT_KEYWORDS.includes(opLower)
484
+ const op = AMPSCRIPT_KEYWORD_NAMES.has(opLower)
482
485
  ? kw(node.operator, node.originalOperator)
483
486
  : node.operator;
484
487
  if (opLower === 'and' || opLower === 'or') {