Summary
In f09e296, offset property is added to Node.Position. But, the property is wrong value in some cases. The offset is 1 larger than expected.
Reproduction
import { Declaration, parse, Rule } from 'postcss';
const css = parse('a { one: X }');
const a = css.first as Rule;
let one = a.first as Declaration;
console.log(css.source?.end); // ok
console.log(a.source?.end); // NG
console.log(one.source?.end); // NG
$ npm start
> start
> ts-node index.ts
{ column: 13, line: 1, offset: 12 }
{ column: 12, line: 1, offset: 12 }
{ column: 10, line: 1, offset: 10 }
Expected Behavior
The following will be output:
$ npm start
> start
> ts-node index.ts
{ column: 13, line: 1, offset: 12 }
{ column: 12, line: 1, offset: 11 }
{ column: 10, line: 1, offset: 9 }
Additional Information
Summary
In f09e296, offset property is added to Node.Position. But, the property is wrong value in some cases. The
offsetis 1 larger than expected.Reproduction
Expected Behavior
The following will be output:
Additional Information
CssSyntaxError.offsetandCssSyntaxError.endOffset#2022.