Skip to content

Commit 48d3454

Browse files
dkryaklinclaude
andcommitted
chore: drop internal version codenames from code/tests/docs
The original branch was scaffolded as a 'v3 spike' and individual test annotations referenced a development-time 'v11.3' milestone. Both leak internal naming into permanent files. This pass converts those references plus the load-bearing 'v10' / 'v11' framing into evergreen wording. - test/index.js: slim header explaining the three-flag wrapper, drop the csstools-oracle env-var toggle (debugging-only), and compact every divergence annotation to one short line in the form `// <change description>`. Keeps the `/* legacy output */ new output` inline syntax so each diff is visible at a glance. Drops the 'flag mechanics' comments on tests whose expected output is unchanged — the wrapper at the top explains the flags once. - README: rename 'Migrating from postcss-calc 10.x' section to 'Behavior differences from the legacy parser'. The substantive content (three-flag combo + spec-aligned defaults list) is preserved with version-free phrasing. - src/, scripts/, configs: 'v3' → 'this implementation' / 'pratt pipeline'; 'v11.3' → 'planned follow-up'; 'v10' → 'legacy' / 'previously'. CHANGELOG left untouched (historical release entries pre-date this PR). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 3c376e9 commit 48d3454

17 files changed

Lines changed: 94 additions & 145 deletions

.dependency-cruiser.cjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// dependency-cruiser config — enforces module-boundary rules for the
2-
// TypeScript v11 sources. Keeps `core/` PostCSS-free so it stays portable,
2+
// TypeScript sources. Keeps `core/` PostCSS-free so it stays portable,
33
// and stops test code from being reachable from production.
44

55
module.exports = {

README.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -169,14 +169,14 @@ calc({dropZeroIdentities: true})
169169
| `calc(99.99% * 1/1 - 0rem)` | `calc(99.99% + 0rem)` | `99.99%` |
170170
| `calc((100px - 1em) + (-50px + 1em))` | `calc(50px + 0em)` | `50px` |
171171

172-
### Migrating from `postcss-calc` 10.x
172+
### Behavior differences from the legacy parser
173173

174-
10.x used a [jison][jison]-generated parser; 11.x ships a hand-written
174+
The legacy [jison][jison]-generated parser was replaced by a hand-written
175175
Pratt parser whose simplifier follows [CSS Values 4][css-values-4]. Most
176-
inputs reduce to identical output, but some 10.x results were jison
177-
implementation choices rather than spec-required behavior. The three opt-
178-
in flags above recover the most visible differences. Setting all three
179-
matches 10.x as closely as 11.x will go:
176+
inputs reduce to identical output, but some legacy results were jison
177+
implementation choices rather than spec-required behavior. The three
178+
opt-in flags above recover the most visible differences. Setting all
179+
three matches the legacy output as closely as possible:
180180

181181
```js
182182
calc({
@@ -186,14 +186,14 @@ calc({
186186
})
187187
```
188188

189-
A handful of 11.x behaviors aren't flag-controlled — they're spec-aligned
189+
A handful of behaviors aren't flag-controlled — they're spec-aligned
190190
or canonical-form decisions:
191191

192192
- **Constant folding.** `calc(43 + pi)` now folds to `46.14159` (§10.7.1).
193-
10.x kept `pi` / `e` symbolic.
193+
Previously `pi` / `e` stayed symbolic.
194194
- **Reciprocal conversion.** `calc(var(--x) / 2)` becomes
195-
`calc(var(--x) * 0.5)`. The two are mathematically equivalent; 10.x kept
196-
the division shape.
195+
`calc(var(--x) * 0.5)`. The two are mathematically equivalent;
196+
previously the division shape was kept.
197197
- **Distributive multiplication.** `calc(0.5 * (100vw - 10px))` becomes
198198
`calc(50vw - 5px)`.
199199
- **Unit case normalization.** `2PX` becomes `2px` (CSS units are case-

eslint.config.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ module.exports = [
1414
],
1515
},
1616
js.configs.recommended,
17-
// Type-aware lint for the v11 TypeScript sources.
17+
// Type-aware lint for the TypeScript sources.
1818
...tseslint.configs.recommendedTypeChecked.map((c) => ({
1919
...c,
2020
files: ['src/pratt/**/*.ts', 'scripts/**/*.ts'],
@@ -32,7 +32,7 @@ module.exports = [
3232
plugins: { sonarjs },
3333
rules: sonarjs.configs.recommended.rules,
3434
},
35-
// Project-specific lint adjustments for the v11 TypeScript sources.
35+
// Project-specific lint adjustments for the TypeScript sources.
3636
{
3737
files: ['src/pratt/**/*.ts', 'scripts/**/*.ts'],
3838
rules: {

scripts/check-issues.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Run each open issue's test case through the pratt pipeline and report
2-
// whether v3 resolves the v10-era complaint. See gh issue list --repo
3-
// postcss/postcss-calc --state open.
2+
// whether the new implementation resolves the legacy complaint. See
3+
// `gh issue list --repo postcss/postcss-calc --state open`.
44

55
import postcss from 'postcss';
66
import plugin from '../src/pratt/src/plugin/plugin.ts';
@@ -130,7 +130,7 @@ const cases: Case[] = [
130130
];
131131

132132
const META_NOTES: Record<number, string> = {
133-
198: 'Meta: hand-written Pratt parser is exactly what v3 ships.',
133+
198: 'Meta: hand-written Pratt parser is exactly what this rewrite ships.',
134134
67: 'Meta: browserlist integration is out of scope (cssnano territory).',
135135
};
136136

@@ -159,7 +159,7 @@ async function run(declaration: string): Promise<Run> {
159159
}
160160

161161
async function main(): Promise<void> {
162-
console.log(`Running ${cases.length} test cases against pratt v3.\n`);
162+
console.log(`Running ${cases.length} test cases against the pratt pipeline.\n`);
163163

164164
let resolved = 0;
165165
let unresolved = 0;

src/pratt/src/core/simplify/product.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ export function simplifyProduct(
6565

6666
// §10.10 distributive multiplication: `0.5 * (100vw - 10px)` → `50vw - 5px`.
6767
// Only distribute when every Sum term is Num/Dim — partial distribution
68-
// over opaque terms matches neither v10 nor csstools.
68+
// over opaque terms matches neither the legacy implementation nor csstools.
6969
if (
7070
remainingDims.length === 0 &&
7171
opaque.length === 1 &&

src/pratt/src/core/simplify/sum.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,8 @@ export function simplifySum(
7979
});
8080
for (const bucket of finalBuckets) {
8181
// Default: emit `0<unit>` for type info (WPT calc-serialization-002).
82-
// dropZeroIdentities flips to v10's "drop zero terms when typed siblings
83-
// survive" behavior.
82+
// dropZeroIdentities flips to the legacy "drop zero terms when typed
83+
// siblings survive" behavior.
8484
if (
8585
options.dropZeroIdentities &&
8686
bucket.total === 0 &&

src/pratt/src/plugin/plugin-csstools.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Drop-in alternative that delegates to @csstools/css-calc, used for
2-
// head-to-head comparison against the v10 regression suite.
2+
// head-to-head comparison against the legacy regression suite.
33

44
import type { PluginCreator } from 'postcss';
55
import { calc as csstoolsCalc } from '@csstools/css-calc';

src/pratt/src/plugin/plugin.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// PostCSS adapter. Walks declaration values (and optionally @rule params
22
// and selectors), feeds calc() bodies through tokenize → parse → simplify
33
// → serialize, and writes the result back. Drop-in compatible with the
4-
// v10 public option surface.
4+
// legacy public option surface.
55

66
import valueParser from 'postcss-value-parser';
77
import type { PluginCreator, Result, ChildNode } from 'postcss';

src/pratt/test/conformance/csstools.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
// produces the same output as csstools. Deliberately excluded:
66
// - csstools `globals` option (variable substitution) — not in our scope
77
// - relative-color math (`rgb(from ...)`) — out of scope
8-
// - exponential family (pow/sqrt/hypot/log/exp) — not yet implemented (v11.3)
8+
// - exponential family (pow/sqrt/hypot/log/exp) — not yet implemented
99
// - cases where floating-point serialization precision differs (we use
1010
// `precision: false` to emit full-float, but csstools occasionally
1111
// rounds at ~15 significant figures in its own way)

src/pratt/test/conformance/wpt.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
// - infinity / NaN serialization (covered when full IEEE-754 fold lands).
1010
//
1111
// Trig (§10.4: sin/cos/tan/asin/acos/atan/atan2) is covered below; the
12-
// exponential family (pow/sqrt/hypot/log/exp) lands in v11.3.
12+
// exponential family (pow/sqrt/hypot/log/exp) is a planned follow-up.
1313
//
1414
// Divergences are documented with `DIVERGE:` comments.
1515

0 commit comments

Comments
 (0)