70 Commits
Author SHA1 Message Date
Alexander KireyevandGitHub 64117f22bc Fix Input#origin() mixing null and undefined for unmapped end position (#2106)
When the requested end position has no mapping in the source map,
originalPositionFor() returns an object with line/column set to null
rather than omitting them. endLine picked that null up correctly, but
endColumn was computed as `to && to.column + 1`, which due to operator
precedence is `to && (to.column + 1)`, turning null into 1. So callers
could get back { endColumn: 1, endLine: null }, which doesn't match
how every other unmapped case in this function behaves (undefined for
both). Looks like the +1 fix in #2036 covered the mapped case but not
this one.

Guard `to` the same way `from` already is, so an unmapped end position
just stays undefined.
2026-06-30 23:14:26 +02:00
Andrey Sitnik fb2bc3f358 Update formatting 2026-06-28 14:54:32 +00:00
mizdraandGitHub aef1148997 Fix Input#origin() returning incorrect position (#2036)
* Add missing `test.run()`

* Fix `Input#origin()` returning incorrect position

* Refactor test with source-map-js
2026-06-28 16:53:40 +02:00
Andrey Sitnik 85bf516d71 Move to oxfmt 2026-04-07 16:07:54 +00:00
mizdraandGitHub 676f35fe97 Add Input#fromLineAndColumn, CssSyntaxError.input.offset and CssSyntaxError.input.endOffset (#2034)
* Test the current behavior of error location

* Fix missing jsdoc for `Input#error(message, start, end, opts)`

* Refactor `fromOffset`

* Add `Input#fromLineAndColumn`

* Add `Input#offset` and `Input#endOffset`

* Convert `_getLineToIndex` to function
2025-03-22 18:08:32 +01:00
Andrey Sitnik d3d4d735df Update ESLint config 2025-02-19 13:43:47 +00:00
2f3c759a4b Add Input#document (#1996)
* Add `Input#document`

* Update lib/postcss.d.ts

Co-authored-by: Andrey Sitnik <[email protected]>

* apply suggestion from code review

---------

Co-authored-by: Andrey Sitnik <[email protected]>
2025-01-13 16:12:42 +01:00
Andrey Sitnik 19afb318d6 Sort source code and fix ESLint 2024-08-31 23:26:27 +02:00
Andrey Sitnik 584d6a8a91 Update linter 2023-09-18 23:22:49 +02:00
Andrey Sitnik 89b7f7ac78 Update dependencies and code style 2023-07-06 13:38:48 +02:00
Andrey Sitnik 1f1dc4854f Fix types 2023-01-06 21:24:38 +01:00
Andrey Kim afe45db6e8 Merge branch 'main' of https://github.com/postcss/postcss into main 2021-11-17 23:55:23 +03:00
Adaline Valentina Simonian 45097948ff feat: Support ranges for errors and warnings
Allows for better diagnostics in linters, language servers, and plugins.
2021-11-16 17:15:01 -08:00
Andrey Kim c5059e1501 Convert istanbul ignores to c8 2021-11-15 23:10:13 +03:00
Andrey Sitnik a6ef4cde14 Fix Symbol description 2021-06-14 01:31:22 -04:00
Andrey Sitnik 7014f712cf Fix merge 2021-05-17 08:52:32 -04:00
Barak Igal 2840ce2d8d remove source-map from browser build 2021-05-05 12:47:14 +03:00
Barak Igal 9da797eb41 Add covrage ignore on error paths 2021-04-11 12:02:45 +03:00
87502e8429 Apply suggestions from code review
Co-authored-by: Andrey Sitnik <[email protected]>
2021-04-11 12:00:26 +03:00
Barak Igal 8a9965aa17 disable url based features 2021-04-10 13:37:54 +03:00
Andrey Sitnik 843ab11b6e Add Prettier 2021-03-11 19:11:37 -05:00
Matt Jones 01e0bc1e80 Fix formatting 2021-03-09 13:32:41 +11:00
Matt Jones c87ed2c8f9 Handle empty path object in browser builds 2021-03-09 13:21:20 +11:00
Andrey Sitnik 4f8122e557 Clean up fromJSON 2020-12-05 19:36:10 -05:00
Niklas Mischkulnig 0fdd3b8477 Hide some instance variables 2020-12-05 11:11:43 +01:00
Niklas Mischkulnig 781e433bdb Add missing test, linting, typings 2020-12-05 11:07:00 +01:00
Niklas Mischkulnig ec69e352d9 fromJSON and toJSON 2020-12-05 00:15:24 +01:00
Andrey Sitnik 59e8949012 Fix parser performance regression 2020-12-03 19:10:18 -05:00
Bogdan Chadkin 2a08850fde Convert object 2020-11-21 21:05:46 +03:00
Bogdan Chadkin 3b476ea30b Replace line-column with vfile-location
vfile-location is dependency free and quite fresh package.
https://github.com/vfile/vfile-location

line-column has outdated dependencies and was not touched in 5 years.
https://github.com/io-monad/line-column
2020-11-21 19:15:57 +03:00
Remco Haszing b94a22e19f Fix usage of default exports with TypeScript
This is done by assigning the property `default` for all properties that are
exported using `export default` according to their type definitions.

Closes #1424
2020-11-10 14:24:37 +01:00
Andrey Sitnik bcf1dca455 Fix webpack bundling support 2020-09-15 15:11:10 -04:00
Andrey Sitnik 84a657d8be Remove line/column tracking from tokenizer 2020-09-09 01:21:14 -04:00
Andrey Sitnik 0048657b13 Add "use strict" because it may effect on tokenizer performance 2020-09-08 01:46:46 -04:00
Andrey Sitnik 96156e43c5 Fix Windows support 2020-07-28 13:56:08 -07:00
Andrey Sitnik e579368859 Remove old JSDoc 2020-07-28 12:35:55 -07:00
Andrey Sitnik 82663d7856 Work with sources as URL 2020-07-22 20:13:50 -07:00
Andrey Sitnik ffa5699271 Fix root for pathes from previous map 2020-07-22 15:27:53 -07:00
Andrey Sitnik 8aae507a45 Clean up types and replace JSDoc to TypeDoc 2020-07-08 17:55:13 -07:00
Andrey Sitnik fa6b5f9981 Add PrettierX 2020-07-06 17:24:57 -07:00
Andrey Sitnik 6d9f535132 Update dependencies 2020-06-21 19:13:53 -04:00
MapGridandAndrey Sitnik 982bc498c6 Fix circular dependencies (#1321)
* fix circular dependencies

* move to static methods to fix imports

* remove default import from terminal highlight
2020-06-21 19:13:53 -04:00
Andrey Sitnik 0b9bfd13e8 Fix rebase 2020-06-21 19:13:53 -04:00
Andrey Sitnik 8d6553d489 Speed up input ID generation 2020-06-21 19:13:53 -04:00
Andrey Sitnik 288d2ffdb6 Clean up code 2020-06-21 19:13:53 -04:00
Andrey Sitnik 746006b840 Use unique ID for unknown CSS sources 2020-06-21 19:13:53 -04:00
Andrey Sitnik 04b816cbde Remove Babel 2020-06-21 19:13:52 -04:00
Andrey Sitnik f43a45a907 Use .es6 ext for ES6 sources 2015-08-17 16:20:40 +03:00
Andrey Sitnik a400602412 Fix code from old refactoring 2015-08-17 16:20:39 +03:00
Andrey Sitnik 382de6113d Move Safe Parser to separated project 2015-08-17 16:20:39 +03:00