@gram-lang/format 1.4.0 → 1.4.2

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/dist/index.js +7 -7
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -91,6 +91,13 @@ function formatGram(source) {
91
91
  if (trimmed !== inner) changes.spacesInsideBraces++;
92
92
  return `{${trimmed}}`;
93
93
  });
94
+ body = body.replace(/\{([^}]*)\}/g, (_, inner) => {
95
+ const fixed = inner.replace(/(\d+)\s+°/g, (_m, n) => {
96
+ changes.temperatureSpacing++;
97
+ return `${n}\xB0`;
98
+ });
99
+ return `{${fixed}}`;
100
+ });
94
101
  body = body.replace(/\{(\d+)\.0+([a-zA-Z°%]*)\}/g, (_, n, u) => {
95
102
  changes.trailingZeros++;
96
103
  return `{${n}${u}}`;
@@ -99,13 +106,6 @@ function formatGram(source) {
99
106
  changes.trailingZeros++;
100
107
  return `{${n}${u}}`;
101
108
  });
102
- body = body.replace(/\{([^}]*)\}/g, (_, inner) => {
103
- const fixed = inner.replace(/(\d+)\s+°/g, (_m, n) => {
104
- changes.temperatureSpacing++;
105
- return `${n}\xB0`;
106
- });
107
- return `{${fixed}}`;
108
- });
109
109
  body = body.replace(/ *< *@/g, (match) => {
110
110
  if (match !== "<@") changes.compositeSeparatorSpacing++;
111
111
  return "<@";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gram-lang/format",
3
- "version": "1.4.0",
3
+ "version": "1.4.2",
4
4
  "description": "Canonical .gram source formatter, shared by the CLI and language server",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -34,7 +34,7 @@
34
34
  "prepublishOnly": "npm run build"
35
35
  },
36
36
  "devDependencies": {
37
- "@gram-lang/parser": "1.4.0"
37
+ "@gram-lang/parser": "1.4.2"
38
38
  },
39
39
  "type": "module"
40
40
  }