Debian Codegraph @

vendor/wikimedia/less.php/CONTRIBUTING.md

raw
1 # Maintainers guide
2
3 ## Release process
4
5 1. **Changelog.** Add a new section to the top of `CHANGES.md` with the output from `composer changelog`.
6
7 Edit your new section by following the [Keep a changelog](https://keepachangelog.com/en/1.0.0/) conventions, where by bullet points are under one of the "Added", "Changed", "Fixed", "Deprecated", or "Removed" labels.
8
9 Review each point and make sure it is phrased in a way that explains the impact on end-users of the library. If the change does not affect the public API or CSS output, remove the bullet point.
10
11 2. **Version bump.** Update `/lib/Less/Version.php` and set `version` to the version that you're about to release. Also increase `cache_version` to increment the last number.
12
13 3. **Commit.** Stage and commit your changes with the message `Tag vX.Y.Z`, and then push the commit for review.
14
15 4. **Tag.** After the above release commit is merged, checkout the master branch and pull down the latest changes. Then create a `vX.Y.Z` tag and push the tag.
16
17 Remember to, after the commit is merged, first checkout the master branch and pull down the latest changes. This is to make sure you have the merged version and not the draft commit that you pushed for review.
18
19 ## Internal overview
20
21 This is an overview of the high-level steps during the transformation
22 from Less to CSS, and how they compare between Less.js and Less.php.
23
24 Less.js:
25
26 * `less.render(input, { paths: … })`
27 * `Parser.parse` normalizes input
28 * `Parser.parse` parses input into rules via `parsers.primary`
29 * `Parser.parse` creates the "root" ruleset object
30 * `Parser.parse` applies ImportVisitor
31 * `ImportVisitor` applies these steps to each `Import` node:
32 * `ImportVisitor#processImportNode`
33 * `Import#evalForImport`
34 * `ImportVisitor` ends with `ImporVisitor#tryRun` loop (async, after last call to `ImportVisitor#onImported`.
35 * `less.render` callback
36 * `ParseTree.prototype.toCSS`
37 * `transformTree` applies pre-visitors, compiles all rules, and applies post-visitors.
38 * `ParseTree.prototype.toCSS` runs toCSS transform on the "root" ruleset.
39 * CSS result ready!
40
41 Less.php
42
43 * `Less_Parser->parseFile`
44 * `Less_Parser->_parse`
45 * `Less_Parser->GetRules` normalizes input (via `Less_Parser->SetInput`)
46 * `Less_Parser->GetRules` parses input into rules via `Less_Parser->parsePrimary`
47 * `Less_Parser->getCss`
48 * `Less_Parser->getCss` creates the "root" ruleset object
49 * `Less_Parser->getCss` applies Less_ImportVisitor
50 * `Less_ImportVisitor` applies these steps to each `Import` node:
51 * `ImportVisitor->processImportNode`
52 * `Less_Tree_Import->compileForImport`
53 * `ImportVisitor` ends with `ImporVisitor#tryRun` loop (all sync, no async needed).
54 * `Less_Parser->getCss` applies pre-visitors, compiles all rules, and applies post-visitors.
55 * `Less_Parser->getCss` runs toCSS transform on the "root" ruleset.
56 * CSS result ready!
57
58 ## Compatibility
59
60 The `wikimedia/less.php` package inherits a long history of loosely compatible
61 and interchangable Less compilers written in PHP.
62
63 Starting with less.php v3.2.1 (released in 2023), the public API is more clearly
64 documented, and internal code is now consistently marked `@private`.
65
66 The public API includes the `Less_Parser` class and several of its public methods.
67 For legacy reasons, some of its internal methods remain public. Maintainers must
68 take care to search the following downstream applications when changing or
69 removing public methods. If a method has one or more references in the below
70 codebases, treat it as a breaking change and document a migration path in the
71 commit message (and later in CHANGES.md), even if the method was undocumented
72 or feels like it is for internal use only.
73
74 * [MediaWiki (source code)](https://codesearch.wmcloud.org/core/?q=Less_Parser&files=php%24)
75 * [Matomo (source code)](https://github.com/matomo-org/matomo/blob/5.0.2/core/AssetManager/UIAssetMerger/StylesheetUIAssetMerger.php)
76 * [Adobe Magento (source code)](https://github.com/magento/magento2/blob/2.4.6/lib/internal/Magento/Framework/Css/PreProcessor/Adapter/Less/Processor.php)
77 * [Shopware 5 (source code)](https://github.com/shopware5/shopware/blob/5.7/engine/Shopware/Components/Theme/LessCompiler/Oyejorge.php)
78 * [Winter CMS Assetic (source code)](https://github.com/assetic-php/assetic/tree/v3.1.0/src/Assetic/Filter)
79 * [Flarum Framework (source code)](https://github.com/flarum/framework)