From fc87512fc825fbdebfc1721e6bc52fe07dd80e1e Mon Sep 17 00:00:00 2001 From: Steven Levithan Date: Sat, 23 Nov 2024 05:50:33 +0100 Subject: [PATCH] feat: bump oniguruma-to-es for grammar support and perf (#842) --- docs/references/engine-js-compat.md | 12 ++++++------ packages/engine-javascript/src/index.ts | 7 +++++-- pnpm-lock.yaml | 22 ++++++++++++---------- pnpm-workspace.yaml | 2 +- 4 files changed, 24 insertions(+), 19 deletions(-) diff --git a/docs/references/engine-js-compat.md b/docs/references/engine-js-compat.md index 21ec25d2..e1c90c05 100644 --- a/docs/references/engine-js-compat.md +++ b/docs/references/engine-js-compat.md @@ -2,9 +2,9 @@ Compatibility reference of all built-in grammars with the [JavaScript RegExp engine](/guide/regex-engines#javascript-regexp-engine-experimental). -> Generated on Sunday, November 17, 2024 +> Generated on Friday, November 22, 2024 > -> Version `1.23.0` +> Version `1.23.1` > > Runtime: Node.js v22.11.0 @@ -13,8 +13,8 @@ Compatibility reference of all built-in grammars with the [JavaScript RegExp eng | | Count | | :-------------- | ---------------------------: | | Total Languages | 215 | -| Supported | [192](#supported-languages) | -| Mismatched | [10](#mismatched-languages) | +| Supported | [193](#supported-languages) | +| Mismatched | [9](#mismatched-languages) | | Unsupported | [13](#unsupported-languages) | ## Supported Languages @@ -129,6 +129,7 @@ In some edge cases, it's not guaranteed that the the highlighting will be 100% t | marko | ✅ OK | 926 | - | | | matlab | ✅ OK | 88 | - | | | mdx | ✅ OK | 197 | - | | +| mermaid | ✅ OK | 129 | - | | | mipsasm | ✅ OK | 17 | - | | | mojo | ✅ OK | 213 | - | | | move | ✅ OK | 120 | - | | @@ -235,7 +236,6 @@ Languages that do not throw with the JavaScript RegExp engine, but will produce | haskell | [🚧 Mismatch](https://textmate-grammars-themes.netlify.app/?grammar=haskell) | 157 | - | 39 | | kotlin | [🚧 Mismatch](https://textmate-grammars-themes.netlify.app/?grammar=kotlin) | 58 | - | 1953 | | kusto | [🚧 Mismatch](https://textmate-grammars-themes.netlify.app/?grammar=kusto) | 60 | - | 40 | -| mermaid | [🚧 Mismatch](https://textmate-grammars-themes.netlify.app/?grammar=mermaid) | 129 | - | 38 | | nginx | [🚧 Mismatch](https://textmate-grammars-themes.netlify.app/?grammar=nginx) | 378 | - | 4 | | php | [🚧 Mismatch](https://textmate-grammars-themes.netlify.app/?grammar=php) | 1131 | - | 605 | | po | [🚧 Mismatch](https://textmate-grammars-themes.netlify.app/?grammar=po) | 23 | - | 423 | @@ -254,7 +254,7 @@ Languages that throw with the JavaScript RegExp engine, either because they cont | rst | [🚧 Mismatch](https://textmate-grammars-themes.netlify.app/?grammar=rst) | 1855 | 2 | 62 | | hack | ❌ Error | 947 | 1 | 114 | | purescript | ❌ Error | 72 | 1 | 42 | -| cpp | ❌ Error | 510 | 2 | 8 | +| cpp | ❌ Error | 510 | 2 | 27 | | csharp | ❌ Error | 306 | 3 | 204 | | markdown | ❌ Error | 115 | 3 | 857 | | swift | ❌ Error | 326 | 3 | 40 | diff --git a/packages/engine-javascript/src/index.ts b/packages/engine-javascript/src/index.ts index 0ae44d7a..9428acaa 100644 --- a/packages/engine-javascript/src/index.ts +++ b/packages/engine-javascript/src/index.ts @@ -54,10 +54,13 @@ export function defaultJavaScriptRegexConstructor(pattern: string, options?: Oni return toRegExp( pattern, { - accuracy: 'loose', global: true, hasIndices: true, - tmGrammar: true, + rules: { + allowOrphanBackrefs: true, + allowUnhandledGAnchors: true, + asciiWordBoundaries: true, + }, ...options, }, ) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index eaf19ec7..83c797e7 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -139,8 +139,8 @@ catalogs: specifier: ^1.4.1 version: 1.4.1 oniguruma-to-es: - specifier: 0.4.1 - version: 0.4.1 + specifier: 0.6.0 + version: 0.6.0 picocolors: specifier: ^1.1.1 version: 1.1.1 @@ -553,7 +553,7 @@ importers: version: 9.3.0 oniguruma-to-es: specifier: 'catalog:' - version: 0.4.1 + version: 0.6.0 packages/engine-oniguruma: dependencies: @@ -4250,8 +4250,8 @@ packages: resolution: {integrity: sha512-VXJjc87FScF88uafS3JllDgvAm+c/Slfz06lorj2uAY34rlUu0Nt+v8wreiImcrgAjjIHp1rXpTDlLOGw29WwQ==} engines: {node: '>=18'} - oniguruma-to-es@0.4.1: - resolution: {integrity: sha512-rNcEohFz095QKGRovP/yqPIKc+nP+Sjs4YTHMv33nMePGKrq/r2eu9Yh4646M5XluGJsUnmwoXuiXE69KDs+fQ==} + oniguruma-to-es@0.6.0: + resolution: {integrity: sha512-YaRxSzO6b7hnCzpq3IiyImHPnTNnhqFvhRdhg68gFMAaTEiFm0Wa8vUKSWqVz89a691o14KBPVJTcybjdRA6aQ==} optionator@0.9.4: resolution: {integrity: sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g==} @@ -4645,8 +4645,8 @@ packages: regex-utilities@2.3.0: resolution: {integrity: sha512-8VhliFJAWRaUiVvREIiW2NXXTmHs4vMNnSzuJVhscgmGav3g9VDxLrQndI3dZZVVdp0ZO/5v0xmX516/7M9cng==} - regex@5.0.0: - resolution: {integrity: sha512-LO5oiSc2Kgbw1qlSQIkzeqapoPeOP3y4DxNoxjTDpuECk6xNcADfN2rJhmOxJSgrv8vQOcgbKSFuyfyPfMmlxw==} + regex@5.0.2: + resolution: {integrity: sha512-/pczGbKIQgfTMRV0XjABvc5RzLqQmwqxLHdQao2RTXPk+pmTXB2P0IaUHYdYyk412YLwUIkaeMd5T+RzVgTqnQ==} regexp-ast-analysis@0.7.1: resolution: {integrity: sha512-sZuz1dYW/ZsfG17WSAG7eS85r5a0dDsvg+7BiiYR5o6lKCAtUrEwdmRmaGF6rwVj3LcmAeYkOWKEPlbPzN3Y3A==} @@ -9502,10 +9502,10 @@ snapshots: dependencies: mimic-function: 5.0.1 - oniguruma-to-es@0.4.1: + oniguruma-to-es@0.6.0: dependencies: emoji-regex-xs: 1.0.0 - regex: 5.0.0 + regex: 5.0.2 regex-recursion: 4.2.1 optionator@0.9.4: @@ -9855,7 +9855,9 @@ snapshots: regex-utilities@2.3.0: {} - regex@5.0.0: {} + regex@5.0.2: + dependencies: + regex-utilities: 2.3.0 regexp-ast-analysis@0.7.1: dependencies: diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index da30e0f4..73a7a488 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -53,7 +53,7 @@ catalog: minimist: ^1.2.8 monaco-editor-core: ^0.52.0 ofetch: ^1.4.1 - oniguruma-to-es: 0.4.1 + oniguruma-to-es: 0.6.0 picocolors: ^1.1.1 pinia: ^2.2.6 pnpm: ^9.13.2