1
0
mirror of https://github.com/alecthomas/chroma.git synced 2025-03-29 21:56:56 +02:00
chroma/go.mod

12 lines
230 B
Modula-2
Raw Normal View History

Version 2 of Chroma This cleans up the API in general, removing a bunch of deprecated stuff, cleaning up circular imports, etc. But the biggest change is switching to an optional XML format for the regex lexer. Having lexers defined only in Go is not ideal for a couple of reasons. Firstly, it impedes a significant portion of contributors who use Chroma in Hugo, but don't know Go. Secondly, it bloats the binary size of any project that imports Chroma. Why XML? YAML is an abomination and JSON is not human editable. XML also compresses very well (eg. Go template lexer XML compresses from 3239 bytes to 718). Why a new syntax format? All major existing formats rely on the Oniguruma regex engine, which is extremely complex and for which there is no Go port. Why not earlier? Prior to the existence of fs.FS this was not a viable option. Benchmarks: $ hyperfine --warmup 3 \ './chroma.master --version' \ './chroma.xml-pre-opt --version' \ './chroma.xml --version' Benchmark 1: ./chroma.master --version Time (mean ± σ): 5.3 ms ± 0.5 ms [User: 3.6 ms, System: 1.4 ms] Range (min … max): 4.2 ms … 6.6 ms 233 runs Benchmark 2: ./chroma.xml-pre-opt --version Time (mean ± σ): 50.6 ms ± 0.5 ms [User: 52.4 ms, System: 3.6 ms] Range (min … max): 49.2 ms … 51.5 ms 51 runs Benchmark 3: ./chroma.xml --version Time (mean ± σ): 6.9 ms ± 1.1 ms [User: 5.1 ms, System: 1.5 ms] Range (min … max): 5.7 ms … 19.9 ms 196 runs Summary './chroma.master --version' ran 1.30 ± 0.23 times faster than './chroma.xml --version' 9.56 ± 0.83 times faster than './chroma.xml-pre-opt --version' A slight increase in init time, but I think this is okay given the increase in flexibility. And binary size difference: $ du -h lexers.test* $ du -sh chroma* 951371ms 8.8M chroma.master 7.8M chroma.xml 7.8M chroma.xml-pre-opt Benchmarks: $ hyperfine --warmup 3 \ './chroma.master --version' \ './chroma.xml-pre-opt --version' \ './chroma.xml --version' Benchmark 1: ./chroma.master --version Time (mean ± σ): 5.3 ms ± 0.5 ms [User: 3.6 ms, System: 1.4 ms] Range (min … max): 4.2 ms … 6.6 ms 233 runs Benchmark 2: ./chroma.xml-pre-opt --version Time (mean ± σ): 50.6 ms ± 0.5 ms [User: 52.4 ms, System: 3.6 ms] Range (min … max): 49.2 ms … 51.5 ms 51 runs Benchmark 3: ./chroma.xml --version Time (mean ± σ): 6.9 ms ± 1.1 ms [User: 5.1 ms, System: 1.5 ms] Range (min … max): 5.7 ms … 19.9 ms 196 runs Summary './chroma.master --version' ran 1.30 ± 0.23 times faster than './chroma.xml --version' 9.56 ± 0.83 times faster than './chroma.xml-pre-opt --version' Incompatible changes: - (*RegexLexer).SetAnalyser: changed from func(func(text string) float32) *RegexLexer to func(func(text string) float32) Lexer - (*TokenType).UnmarshalJSON: removed - Lexer.AnalyseText: added - Lexer.SetAnalyser: added - Lexer.SetRegistry: added - MustNewLazyLexer: removed - MustNewLexer: changed from func(*Config, Rules) *RegexLexer to func(*Config, func() Rules) *RegexLexer - Mutators: changed from func(...Mutator) MutatorFunc to func(...Mutator) Mutator - NewLazyLexer: removed - NewLexer: changed from func(*Config, Rules) (*RegexLexer, error) to func(*Config, func() Rules) (*RegexLexer, error) - Pop: changed from func(int) MutatorFunc to func(int) Mutator - Push: changed from func(...string) MutatorFunc to func(...string) Mutator - TokenType.MarshalJSON: removed - Using: changed from func(Lexer) Emitter to func(string) Emitter - UsingByGroup: changed from func(func(string) Lexer, int, int, ...Emitter) Emitter to func(int, int, ...Emitter) Emitter
2022-01-03 23:51:17 +11:00
module github.com/alecthomas/chroma/v2
go 1.19
require (
chore(deps): update all non-major dependencies (#997) This PR contains the following updates: | Package | Type | Update | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---|---|---| | [esbuild](https://redirect.github.com/evanw/esbuild) | | minor | `0.23.1` -> `0.24.0` | [![age](https://developer.mend.io/api/mc/badges/age/hermit/esbuild/0.24.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/hermit/esbuild/0.24.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/hermit/esbuild/0.23.1/0.24.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/hermit/esbuild/0.23.1/0.24.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | | [github.com/alecthomas/assert/v2](https://redirect.github.com/alecthomas/assert) | require | minor | `v2.10.0` -> `v2.11.0` | [![age](https://developer.mend.io/api/mc/badges/age/go/github.com%2falecthomas%2fassert%2fv2/v2.11.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/go/github.com%2falecthomas%2fassert%2fv2/v2.11.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/go/github.com%2falecthomas%2fassert%2fv2/v2.10.0/v2.11.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/go/github.com%2falecthomas%2fassert%2fv2/v2.10.0/v2.11.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | | [go](https://redirect.github.com/golang/go) | | patch | `1.23.0` -> `1.23.2` | [![age](https://developer.mend.io/api/mc/badges/age/hermit/go/1.23.2?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/hermit/go/1.23.2?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/hermit/go/1.23.0/1.23.2?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/hermit/go/1.23.0/1.23.2?slim=true)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>evanw/esbuild (esbuild)</summary> ### [`v0.24.0`](https://redirect.github.com/evanw/esbuild/blob/HEAD/CHANGELOG.md#0240) [Compare Source](https://redirect.github.com/evanw/esbuild/compare/v0.23.1...v0.24.0) ***This release deliberately contains backwards-incompatible changes.*** To avoid automatically picking up releases like this, you should either be pinning the exact version of `esbuild` in your `package.json` file (recommended) or be using a version range syntax that only accepts patch upgrades such as `^0.23.0` or `~0.23.0`. See npm's documentation about [semver](https://docs.npmjs.com/cli/v6/using-npm/semver/) for more information. - Drop support for older platforms ([#&#8203;3902](https://redirect.github.com/evanw/esbuild/pull/3902)) This release drops support for the following operating system: - macOS 10.15 Catalina This is because the Go programming language dropped support for this operating system version in Go 1.23, and this release updates esbuild from Go 1.22 to Go 1.23. Go 1.23 now requires macOS 11 Big Sur or later. Note that this only affects the binary esbuild executables that are published to the esbuild npm package. It's still possible to compile esbuild's source code for these older operating systems. If you need to, you can compile esbuild for yourself using an older version of the Go compiler (before Go version 1.23). That might look something like this: git clone https://github.com/evanw/esbuild.git cd esbuild go build ./cmd/esbuild ./esbuild --version - Fix class field decorators in TypeScript if `useDefineForClassFields` is `false` ([#&#8203;3913](https://redirect.github.com/evanw/esbuild/issues/3913)) Setting the `useDefineForClassFields` flag to `false` in `tsconfig.json` means class fields use the legacy TypeScript behavior instead of the standard JavaScript behavior. Specifically they use assign semantics instead of define semantics (e.g. setters are triggered) and fields without an initializer are not initialized at all. However, when this legacy behavior is combined with standard JavaScript decorators, TypeScript switches to always initializing all fields, even those without initializers. Previously esbuild incorrectly continued to omit field initializers for this edge case. These field initializers in this case should now be emitted starting with this release. - Avoid incorrect cycle warning with `tsconfig.json` multiple inheritance ([#&#8203;3898](https://redirect.github.com/evanw/esbuild/issues/3898)) TypeScript 5.0 introduced multiple inheritance for `tsconfig.json` files where `extends` can be an array of file paths. Previously esbuild would incorrectly treat files encountered more than once when processing separate subtrees of the multiple inheritance hierarchy as an inheritance cycle. With this release, `tsconfig.json` files containing this edge case should work correctly without generating a warning. - Handle Yarn Plug'n'Play stack overflow with `tsconfig.json` ([#&#8203;3915](https://redirect.github.com/evanw/esbuild/issues/3915)) Previously a `tsconfig.json` file that `extends` another file in a package with an `exports` map could cause a stack overflow when Yarn's Plug'n'Play resolution was active. This edge case should work now starting with this release. - Work around more issues with Deno 1.31+ ([#&#8203;3917](https://redirect.github.com/evanw/esbuild/pull/3917)) This version of Deno broke the `stdin` and `stdout` properties on command objects for inherited streams, which matters when you run esbuild's Deno module as the entry point (i.e. when `import.meta.main` is `true`). Previously esbuild would crash in Deno 1.31+ if you ran esbuild like that. This should be fixed starting with this release. This fix was contributed by [@&#8203;Joshix-1](https://redirect.github.com/Joshix-1). </details> <details> <summary>alecthomas/assert (github.com/alecthomas/assert/v2)</summary> ### [`v2.11.0`](https://redirect.github.com/alecthomas/assert/compare/v2.10.0...v2.11.0) [Compare Source](https://redirect.github.com/alecthomas/assert/compare/v2.10.0...v2.11.0) </details> <details> <summary>golang/go (go)</summary> ### [`v1.23.2`](https://redirect.github.com/golang/go/compare/go1.23.1...go1.23.2) [Compare Source](https://redirect.github.com/golang/go/compare/go1.23.1...go1.23.2) ### [`v1.23.1`](https://redirect.github.com/golang/go/compare/go1.23.0...go1.23.1) </details> --- ### Configuration 📅 **Schedule**: Branch creation - "before 4am on Monday" (UTC), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 👻 **Immortal**: This PR will be recreated if closed unmerged. Get [config help](https://redirect.github.com/renovatebot/renovate/discussions) if that's undesired. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR was generated by [Mend Renovate](https://mend.io/renovate/). View the [repository job log](https://developer.mend.io/github/alecthomas/chroma). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOC41OS4yIiwidXBkYXRlZEluVmVyIjoiMzguOTcuMCIsInRhcmdldEJyYW5jaCI6Im1hc3RlciIsImxhYmVscyI6W119--> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-10-06 23:53:20 +11:00
github.com/alecthomas/assert/v2 v2.11.0
github.com/alecthomas/repr v0.4.0
chore(deps): update all non-major dependencies (#985) [![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | Type | Update | |---|---|---|---|---|---|---|---| | [github.com/dlclark/regexp2](https://togithub.com/dlclark/regexp2) | `v1.11.2` -> `v1.11.4` | [![age](https://developer.mend.io/api/mc/badges/age/go/github.com%2fdlclark%2fregexp2/v1.11.4?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/go/github.com%2fdlclark%2fregexp2/v1.11.4?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/go/github.com%2fdlclark%2fregexp2/v1.11.2/v1.11.4?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/go/github.com%2fdlclark%2fregexp2/v1.11.2/v1.11.4?slim=true)](https://docs.renovatebot.com/merge-confidence/) | require | patch | | [svu](https://togithub.com/caarlos0/svu) | `2.0.1` -> `2.1.0` | [![age](https://developer.mend.io/api/mc/badges/age/hermit/svu/2.1.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/hermit/svu/2.1.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/hermit/svu/2.0.1/2.1.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/hermit/svu/2.0.1/2.1.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | | minor | --- ### Release Notes <details> <summary>dlclark/regexp2 (github.com/dlclark/regexp2)</summary> ### [`v1.11.4`](https://togithub.com/dlclark/regexp2/compare/v1.11.3...v1.11.4) [Compare Source](https://togithub.com/dlclark/regexp2/compare/v1.11.3...v1.11.4) ### [`v1.11.3`](https://togithub.com/dlclark/regexp2/compare/v1.11.2...v1.11.3) [Compare Source](https://togithub.com/dlclark/regexp2/compare/v1.11.2...v1.11.3) </details> <details> <summary>caarlos0/svu (svu)</summary> ### [`v2.1.0`](https://togithub.com/caarlos0/svu/releases/tag/v2.1.0) #### Changelog ##### New Features - [`680777b`](https://togithub.com/caarlos0/svu/commit/680777bb64e98b41ca434efd8be432239f5dde04): feat: try to infer sub-package tag ([#&#8203;161](https://togithub.com/caarlos0/svu/issues/161)) ([@&#8203;aymanbagabas](https://togithub.com/aymanbagabas)) ##### Bug fixes - [`3af7242`](https://togithub.com/caarlos0/svu/commit/3af72427abad6464185b35b2870c127a782bfa91): fix: pre-release flag only worked on the pr command ([#&#8203;160](https://togithub.com/caarlos0/svu/issues/160)) ([@&#8203;djgilcrease](https://togithub.com/djgilcrease)) ##### Other work - [`d3987e0`](https://togithub.com/caarlos0/svu/commit/d3987e0e06e39ad7215244a68fd8b9b3985ead9d): ci: goreleaser.yml ([@&#8203;caarlos0](https://togithub.com/caarlos0)) - [`5fedd09`](https://togithub.com/caarlos0/svu/commit/5fedd090515d9418a54c17f5b28a8407cb78c0dc): ci: update goreleaser configs ([@&#8203;caarlos0](https://togithub.com/caarlos0)) *** *Released with [GoReleaser Pro](https://goreleaser.com/pro)!* </details> --- ### Configuration 📅 **Schedule**: Branch creation - "before 4am on Monday" (UTC), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 👻 **Immortal**: This PR will be recreated if closed unmerged. Get [config help](https://togithub.com/renovatebot/renovate/discussions) if that's undesired. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR was generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View the [repository job log](https://developer.mend.io/github/alecthomas/chroma). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy40NDAuNyIsInVwZGF0ZWRJblZlciI6IjM3LjQ0MC43IiwidGFyZ2V0QnJhbmNoIjoibWFzdGVyIiwibGFiZWxzIjpbXX0=--> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-08-05 15:27:49 +10:00
github.com/dlclark/regexp2 v1.11.4
)
2022-02-21 16:25:58 +11:00
require github.com/hexops/gotextdiff v1.0.3 // indirect